16
16
import me .chanjar .weixin .cp .util .json .WxCpGsonBuilder ;
17
17
import me .chanjar .weixin .cp .util .xml .XStreamTransformer ;
18
18
import org .apache .commons .io .IOUtils ;
19
+ import org .apache .commons .lang3 .StringUtils ;
19
20
20
21
import java .io .IOException ;
21
22
import java .io .InputStream ;
@@ -51,7 +52,7 @@ public class WxCpXmlMessage implements Serializable {
51
52
///////////////////////
52
53
53
54
@ XStreamAlias ("AgentID" )
54
- private Integer agentId ;
55
+ private String agentId ;
55
56
56
57
@ XStreamAlias ("ToUserName" )
57
58
@ XStreamConverter (value = XStreamCDataConverter .class )
@@ -476,7 +477,7 @@ protected static WxCpXmlMessage fromXml(String xml) {
476
477
return xmlMessage ;
477
478
}
478
479
479
- public static WxCpXmlMessage fromXml (String xml , Integer agentId ) {
480
+ public static WxCpXmlMessage fromXml (String xml , String agentId ) {
480
481
//修改微信变态的消息内容格式,方便解析
481
482
xml = xml .replace ("</PicList><PicList>" , "" );
482
483
final WxCpXmlMessage xmlMessage = fromXml (xml );
@@ -497,7 +498,7 @@ public static WxCpXmlMessage fromEncryptedXml(String encryptedXml, WxCpConfigSto
497
498
WxCpXmlMessage wxCpXmlMessage = fromXml (encryptedXml );
498
499
String plainText = cryptUtil .decrypt (msgSignature , timestamp , nonce , encryptedXml );
499
500
log .debug ("解密后的原始xml消息内容:{}" , plainText );
500
- if (null != wxCpXmlMessage .getAgentId ()) {
501
+ if (StringUtils . isNotEmpty ( wxCpXmlMessage .getAgentId () )) {
501
502
return fromXml (plainText , wxCpXmlMessage .getAgentId ());
502
503
} else {
503
504
return fromXml (plainText );
0 commit comments