| @@ -297,6 +297,43 @@ public class WxMpXmlMessage implements Serializable { | |||||
| @XStreamAlias("DeviceStatus") | @XStreamAlias("DeviceStatus") | ||||
| private Integer deviceStatus; | private Integer deviceStatus; | ||||
| public static WxMpXmlMessage fromXml(String xml) { | |||||
| return XStreamTransformer.fromXml(WxMpXmlMessage.class, xml); | |||||
| } | |||||
| public static WxMpXmlMessage fromXml(InputStream is) { | |||||
| return XStreamTransformer.fromXml(WxMpXmlMessage.class, is); | |||||
| } | |||||
| /** | |||||
| * 从加密字符串转换 | |||||
| * | |||||
| * @param encryptedXml | |||||
| * @param wxMpConfigStorage | |||||
| * @param timestamp | |||||
| * @param nonce | |||||
| * @param msgSignature | |||||
| */ | |||||
| public static WxMpXmlMessage fromEncryptedXml(String encryptedXml, | |||||
| WxMpConfigStorage wxMpConfigStorage, String timestamp, String nonce, | |||||
| String msgSignature) { | |||||
| WxMpCryptUtil cryptUtil = new WxMpCryptUtil(wxMpConfigStorage); | |||||
| String plainText = cryptUtil.decrypt(msgSignature, timestamp, nonce, | |||||
| encryptedXml); | |||||
| return fromXml(plainText); | |||||
| } | |||||
| public static WxMpXmlMessage fromEncryptedXml(InputStream is, | |||||
| WxMpConfigStorage wxMpConfigStorage, String timestamp, String nonce, | |||||
| String msgSignature) { | |||||
| try { | |||||
| return fromEncryptedXml(IOUtils.toString(is, "UTF-8"), wxMpConfigStorage, | |||||
| timestamp, nonce, msgSignature); | |||||
| } catch (IOException e) { | |||||
| throw new RuntimeException(e); | |||||
| } | |||||
| } | |||||
| public Integer getOpType() { | public Integer getOpType() { | ||||
| return opType; | return opType; | ||||
| } | } | ||||
| @@ -611,43 +648,6 @@ public class WxMpXmlMessage implements Serializable { | |||||
| this.fromUser = fromUser; | this.fromUser = fromUser; | ||||
| } | } | ||||
| public static WxMpXmlMessage fromXml(String xml) { | |||||
| return XStreamTransformer.fromXml(WxMpXmlMessage.class, xml); | |||||
| } | |||||
| public static WxMpXmlMessage fromXml(InputStream is) { | |||||
| return XStreamTransformer.fromXml(WxMpXmlMessage.class, is); | |||||
| } | |||||
| /** | |||||
| * 从加密字符串转换 | |||||
| * | |||||
| * @param encryptedXml | |||||
| * @param wxMpConfigStorage | |||||
| * @param timestamp | |||||
| * @param nonce | |||||
| * @param msgSignature | |||||
| */ | |||||
| public static WxMpXmlMessage fromEncryptedXml(String encryptedXml, | |||||
| WxMpConfigStorage wxMpConfigStorage, String timestamp, String nonce, | |||||
| String msgSignature) { | |||||
| WxMpCryptUtil cryptUtil = new WxMpCryptUtil(wxMpConfigStorage); | |||||
| String plainText = cryptUtil.decrypt(msgSignature, timestamp, nonce, | |||||
| encryptedXml); | |||||
| return fromXml(plainText); | |||||
| } | |||||
| public static WxMpXmlMessage fromEncryptedXml(InputStream is, | |||||
| WxMpConfigStorage wxMpConfigStorage, String timestamp, String nonce, | |||||
| String msgSignature) { | |||||
| try { | |||||
| return fromEncryptedXml(IOUtils.toString(is, "UTF-8"), wxMpConfigStorage, | |||||
| timestamp, nonce, msgSignature); | |||||
| } catch (IOException e) { | |||||
| throw new RuntimeException(e); | |||||
| } | |||||
| } | |||||
| public String getStatus() { | public String getStatus() { | ||||
| return this.status; | return this.status; | ||||
| } | } | ||||
| @@ -757,7 +757,7 @@ public class WxMpXmlMessage implements Serializable { | |||||
| } | } | ||||
| public void setSendLocationInfo( | public void setSendLocationInfo( | ||||
| WxMpXmlMessage.SendLocationInfo sendLocationInfo) { | |||||
| WxMpXmlMessage.SendLocationInfo sendLocationInfo) { | |||||
| this.sendLocationInfo = sendLocationInfo; | this.sendLocationInfo = sendLocationInfo; | ||||
| } | } | ||||
| @@ -793,20 +793,19 @@ public class WxMpXmlMessage implements Serializable { | |||||
| this.fromKfAccount = fromKfAccount; | this.fromKfAccount = fromKfAccount; | ||||
| } | } | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| @XStreamAlias("HardWare") | @XStreamAlias("HardWare") | ||||
| public static class HardWare { | public static class HardWare { | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| /** | /** | ||||
| * 消息展示,目前支持myrank(排行榜) | * 消息展示,目前支持myrank(排行榜) | ||||
| */ | */ | ||||
| @XStreamAlias("MessageView") | @XStreamAlias("MessageView") | ||||
| @XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
| private String messageView; | private String messageView; | ||||
| /** | /** | ||||
| * 消息点击动作,目前支持ranklist(点击跳转排行榜) | * 消息点击动作,目前支持ranklist(点击跳转排行榜) | ||||
| */ | */ | ||||
| @@ -814,6 +813,11 @@ public class WxMpXmlMessage implements Serializable { | |||||
| @XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
| private String messageAction; | private String messageAction; | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| public String getMessageView() { | public String getMessageView() { | ||||
| return messageView; | return messageView; | ||||
| } | } | ||||
| @@ -833,19 +837,18 @@ public class WxMpXmlMessage implements Serializable { | |||||
| @XStreamAlias("ScanCodeInfo") | @XStreamAlias("ScanCodeInfo") | ||||
| public static class ScanCodeInfo { | public static class ScanCodeInfo { | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| @XStreamAlias("ScanType") | @XStreamAlias("ScanType") | ||||
| @XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
| private String scanType; | private String scanType; | ||||
| @XStreamAlias("ScanResult") | @XStreamAlias("ScanResult") | ||||
| @XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
| private String scanResult; | private String scanResult; | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| /** | /** | ||||
| * 扫描类型,一般是qrcode | * 扫描类型,一般是qrcode | ||||
| */ | */ | ||||
| @@ -873,17 +876,16 @@ public class WxMpXmlMessage implements Serializable { | |||||
| @XStreamAlias("SendPicsInfo") | @XStreamAlias("SendPicsInfo") | ||||
| public static class SendPicsInfo { | public static class SendPicsInfo { | ||||
| @XStreamAlias("PicList") | |||||
| protected final List<Item> picList = new ArrayList<>(); | |||||
| @XStreamAlias("Count") | |||||
| private Long count; | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return ToStringUtils.toSimpleString(this); | return ToStringUtils.toSimpleString(this); | ||||
| } | } | ||||
| @XStreamAlias("Count") | |||||
| private Long count; | |||||
| @XStreamAlias("PicList") | |||||
| protected final List<Item> picList = new ArrayList<>(); | |||||
| public Long getCount() { | public Long getCount() { | ||||
| return this.count; | return this.count; | ||||
| } | } | ||||
| @@ -898,15 +900,15 @@ public class WxMpXmlMessage implements Serializable { | |||||
| @XStreamAlias("item") | @XStreamAlias("item") | ||||
| public static class Item { | public static class Item { | ||||
| @XStreamAlias("PicMd5Sum") | |||||
| @XStreamConverter(value = XStreamCDataConverter.class) | |||||
| private String picMd5Sum; | |||||
| @Override | @Override | ||||
| public String toString() { | public String toString() { | ||||
| return ToStringUtils.toSimpleString(this); | return ToStringUtils.toSimpleString(this); | ||||
| } | } | ||||
| @XStreamAlias("PicMd5Sum") | |||||
| @XStreamConverter(value = XStreamCDataConverter.class) | |||||
| private String picMd5Sum; | |||||
| public String getPicMd5Sum() { | public String getPicMd5Sum() { | ||||
| return this.picMd5Sum; | return this.picMd5Sum; | ||||
| } | } | ||||
| @@ -985,9 +987,4 @@ public class WxMpXmlMessage implements Serializable { | |||||
| this.poiname = poiname; | this.poiname = poiname; | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringUtils.toSimpleString(this); | |||||
| } | |||||
| } | } | ||||