| @@ -50,3 +50,7 @@ weixin-java-tools | |||||
| * [1.0.3升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_0_3升级指南) | * [1.0.3升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_0_3升级指南) | ||||
| * [1.1.0升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_0升级指南) | * [1.1.0升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_0升级指南) | ||||
| * [1.1.1升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_1升级指南) | * [1.1.1升级指南](https://github.com/chanjarster/weixin-java-tools/wiki/1_1_1升级指南) | ||||
| ## 关于Pull Request | |||||
| 非常欢迎和感谢对本项目发起Pull Request的同学,不过本项目基于[git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)开发流程,因此在发起Pull Request的时候请选择develop分支。 | |||||
| @@ -29,6 +29,7 @@ public class WxConsts { | |||||
| public static final String CUSTOM_MSG_MUSIC = "music"; | public static final String CUSTOM_MSG_MUSIC = "music"; | ||||
| public static final String CUSTOM_MSG_NEWS = "news"; | public static final String CUSTOM_MSG_NEWS = "news"; | ||||
| public static final String CUSTOM_MSG_FILE = "file"; | public static final String CUSTOM_MSG_FILE = "file"; | ||||
| public static final String CUSTOM_MSG_TRANSFER_CUSTOMER_SERVICE = "transfer_customer_service"; | |||||
| /////////////////////// | /////////////////////// | ||||
| // 群发消息的消息类型 | // 群发消息的消息类型 | ||||
| @@ -38,14 +38,7 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri | |||||
| user.setPosition(GsonHelper.getString(o, "position")); | user.setPosition(GsonHelper.getString(o, "position")); | ||||
| user.setMobile(GsonHelper.getString(o, "mobile")); | user.setMobile(GsonHelper.getString(o, "mobile")); | ||||
| Integer gender = GsonHelper.getInteger(o, "gender"); | |||||
| if (new Integer(1).equals(gender)) { | |||||
| user.setGender("男"); | |||||
| } else if (new Integer(2).equals(gender)) { | |||||
| user.setGender("女"); | |||||
| } else { | |||||
| user.setGender("未知"); | |||||
| } | |||||
| user.setGender(GsonHelper.getString(o, "gender")); | |||||
| user.setTel(GsonHelper.getString(o, "tel")); | user.setTel(GsonHelper.getString(o, "tel")); | ||||
| user.setEmail(GsonHelper.getString(o, "email")); | user.setEmail(GsonHelper.getString(o, "email")); | ||||
| user.setWeiXinId(GsonHelper.getString(o, "weixinid")); | user.setWeiXinId(GsonHelper.getString(o, "weixinid")); | ||||
| @@ -88,7 +81,7 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri | |||||
| o.addProperty("mobile", user.getMobile()); | o.addProperty("mobile", user.getMobile()); | ||||
| } | } | ||||
| if (user.getGender() != null) { | if (user.getGender() != null) { | ||||
| o.addProperty("gender", user.getGender().equals("男") ? 0 : 1); | |||||
| o.addProperty("gender", user.getGender()); | |||||
| } | } | ||||
| if (user.getTel() != null) { | if (user.getTel() != null) { | ||||
| o.addProperty("tel", user.getTel()); | o.addProperty("tel", user.getTel()); | ||||
| @@ -121,4 +121,12 @@ public abstract class WxMpXmlOutMessage implements Serializable { | |||||
| public static NewsBuilder NEWS() { | public static NewsBuilder NEWS() { | ||||
| return new NewsBuilder(); | return new NewsBuilder(); | ||||
| } | } | ||||
| /** | |||||
| * 获得客服消息builder | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| public static TransferCustomerServiceBuilder TRANSFER_CUSTOMER_SERVICE() { | |||||
| return new TransferCustomerServiceBuilder(); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,41 @@ | |||||
| package me.chanjar.weixin.mp.bean; | |||||
| import com.thoughtworks.xstream.annotations.XStreamAlias; | |||||
| import com.thoughtworks.xstream.annotations.XStreamConverter; | |||||
| import me.chanjar.weixin.common.api.WxConsts; | |||||
| import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||||
| import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter; | |||||
| @XStreamAlias("xml") | |||||
| public class WxMpXmlOutTransferCustomerServiceMessage extends WxMpXmlOutMessage { | |||||
| @XStreamAlias("TransInfo") | |||||
| protected final TransInfo transInfo = new TransInfo(); | |||||
| public WxMpXmlOutTransferCustomerServiceMessage() { | |||||
| this.msgType = WxConsts.CUSTOM_MSG_TRANSFER_CUSTOMER_SERVICE; | |||||
| } | |||||
| public String getKfAccount() { | |||||
| return transInfo.getKfAccount(); | |||||
| } | |||||
| public void setKfAccount(String kfAccount) { | |||||
| transInfo.setKfAccount(kfAccount); | |||||
| } | |||||
| @XStreamAlias("TransInfo") | |||||
| public static class TransInfo { | |||||
| @XStreamAlias("KfAccount") | |||||
| @XStreamConverter(value=XStreamCDataConverter.class) | |||||
| private String kfAccount; | |||||
| public String getKfAccount() { | |||||
| return kfAccount; | |||||
| } | |||||
| public void setKfAccount(String kfAccount) { | |||||
| this.kfAccount = kfAccount; | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| package me.chanjar.weixin.mp.bean.outxmlbuilder; | |||||
| import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferCustomerServiceMessage; | |||||
| /** | |||||
| * 客服消息builder | |||||
| * <pre> | |||||
| * 用法: WxMpCustomMessage m = WxMpCustomMessage.TRANSFER_CUSTOMER_SERVICE().content(...).toUser(...).build(); | |||||
| * </pre> | |||||
| * | |||||
| * @author chanjarster | |||||
| */ | |||||
| public final class TransferCustomerServiceBuilder extends BaseBuilder<TransferCustomerServiceBuilder, WxMpXmlOutTransferCustomerServiceMessage> { | |||||
| private String kfAccount; | |||||
| public TransferCustomerServiceBuilder kfAccount(String kfAccount) { | |||||
| this.kfAccount = kfAccount; | |||||
| return this; | |||||
| } | |||||
| public WxMpXmlOutTransferCustomerServiceMessage build() { | |||||
| WxMpXmlOutTransferCustomerServiceMessage m = new WxMpXmlOutTransferCustomerServiceMessage(); | |||||
| setCommon(m); | |||||
| m.setKfAccount(kfAccount); | |||||
| return m; | |||||
| } | |||||
| } | |||||