1616import me .chanjar .weixin .cp .util .json .WxCpGsonBuilder ;
1717import me .chanjar .weixin .cp .util .xml .XStreamTransformer ;
1818import org .apache .commons .io .IOUtils ;
19+ import org .apache .commons .lang3 .StringUtils ;
1920
2021import java .io .IOException ;
2122import java .io .InputStream ;
@@ -51,7 +52,7 @@ public class WxCpXmlMessage implements Serializable {
5152 ///////////////////////
5253
5354 @ XStreamAlias ("AgentID" )
54- private Integer agentId ;
55+ private String agentId ;
5556
5657 @ XStreamAlias ("ToUserName" )
5758 @ XStreamConverter (value = XStreamCDataConverter .class )
@@ -476,7 +477,7 @@ protected static WxCpXmlMessage fromXml(String xml) {
476477 return xmlMessage ;
477478 }
478479
479- public static WxCpXmlMessage fromXml (String xml , Integer agentId ) {
480+ public static WxCpXmlMessage fromXml (String xml , String agentId ) {
480481 //修改微信变态的消息内容格式,方便解析
481482 xml = xml .replace ("</PicList><PicList>" , "" );
482483 final WxCpXmlMessage xmlMessage = fromXml (xml );
@@ -497,7 +498,7 @@ public static WxCpXmlMessage fromEncryptedXml(String encryptedXml, WxCpConfigSto
497498 WxCpXmlMessage wxCpXmlMessage = fromXml (encryptedXml );
498499 String plainText = cryptUtil .decrypt (msgSignature , timestamp , nonce , encryptedXml );
499500 log .debug ("解密后的原始xml消息内容:{}" , plainText );
500- if (null != wxCpXmlMessage .getAgentId ()) {
501+ if (StringUtils . isNotEmpty ( wxCpXmlMessage .getAgentId () )) {
501502 return fromXml (plainText , wxCpXmlMessage .getAgentId ());
502503 } else {
503504 return fromXml (plainText );
0 commit comments