@@ -297,6 +297,43 @@ public class WxMpXmlMessage implements Serializable {
297297 @ XStreamAlias ("DeviceStatus" )
298298 private Integer deviceStatus ;
299299
300+ public static WxMpXmlMessage fromXml (String xml ) {
301+ return XStreamTransformer .fromXml (WxMpXmlMessage .class , xml );
302+ }
303+
304+ public static WxMpXmlMessage fromXml (InputStream is ) {
305+ return XStreamTransformer .fromXml (WxMpXmlMessage .class , is );
306+ }
307+
308+ /**
309+ * 从加密字符串转换
310+ *
311+ * @param encryptedXml
312+ * @param wxMpConfigStorage
313+ * @param timestamp
314+ * @param nonce
315+ * @param msgSignature
316+ */
317+ public static WxMpXmlMessage fromEncryptedXml (String encryptedXml ,
318+ WxMpConfigStorage wxMpConfigStorage , String timestamp , String nonce ,
319+ String msgSignature ) {
320+ WxMpCryptUtil cryptUtil = new WxMpCryptUtil (wxMpConfigStorage );
321+ String plainText = cryptUtil .decrypt (msgSignature , timestamp , nonce ,
322+ encryptedXml );
323+ return fromXml (plainText );
324+ }
325+
326+ public static WxMpXmlMessage fromEncryptedXml (InputStream is ,
327+ WxMpConfigStorage wxMpConfigStorage , String timestamp , String nonce ,
328+ String msgSignature ) {
329+ try {
330+ return fromEncryptedXml (IOUtils .toString (is , "UTF-8" ), wxMpConfigStorage ,
331+ timestamp , nonce , msgSignature );
332+ } catch (IOException e ) {
333+ throw new RuntimeException (e );
334+ }
335+ }
336+
300337 public Integer getOpType () {
301338 return opType ;
302339 }
@@ -611,43 +648,6 @@ public void setFromUser(String fromUser) {
611648 this .fromUser = fromUser ;
612649 }
613650
614- public static WxMpXmlMessage fromXml (String xml ) {
615- return XStreamTransformer .fromXml (WxMpXmlMessage .class , xml );
616- }
617-
618- public static WxMpXmlMessage fromXml (InputStream is ) {
619- return XStreamTransformer .fromXml (WxMpXmlMessage .class , is );
620- }
621-
622- /**
623- * 从加密字符串转换
624- *
625- * @param encryptedXml
626- * @param wxMpConfigStorage
627- * @param timestamp
628- * @param nonce
629- * @param msgSignature
630- */
631- public static WxMpXmlMessage fromEncryptedXml (String encryptedXml ,
632- WxMpConfigStorage wxMpConfigStorage , String timestamp , String nonce ,
633- String msgSignature ) {
634- WxMpCryptUtil cryptUtil = new WxMpCryptUtil (wxMpConfigStorage );
635- String plainText = cryptUtil .decrypt (msgSignature , timestamp , nonce ,
636- encryptedXml );
637- return fromXml (plainText );
638- }
639-
640- public static WxMpXmlMessage fromEncryptedXml (InputStream is ,
641- WxMpConfigStorage wxMpConfigStorage , String timestamp , String nonce ,
642- String msgSignature ) {
643- try {
644- return fromEncryptedXml (IOUtils .toString (is , "UTF-8" ), wxMpConfigStorage ,
645- timestamp , nonce , msgSignature );
646- } catch (IOException e ) {
647- throw new RuntimeException (e );
648- }
649- }
650-
651651 public String getStatus () {
652652 return this .status ;
653653 }
@@ -757,7 +757,7 @@ public WxMpXmlMessage.SendLocationInfo getSendLocationInfo() {
757757 }
758758
759759 public void setSendLocationInfo (
760- WxMpXmlMessage .SendLocationInfo sendLocationInfo ) {
760+ WxMpXmlMessage .SendLocationInfo sendLocationInfo ) {
761761 this .sendLocationInfo = sendLocationInfo ;
762762 }
763763
@@ -793,27 +793,31 @@ public void setFromKfAccount(String fromKfAccount) {
793793 this .fromKfAccount = fromKfAccount ;
794794 }
795795
796+ @ Override
797+ public String toString () {
798+ return ToStringUtils .toSimpleString (this );
799+ }
800+
796801 @ XStreamAlias ("HardWare" )
797802 public static class HardWare {
798- @ Override
799- public String toString () {
800- return ToStringUtils .toSimpleString (this );
801- }
802-
803803 /**
804804 * 消息展示,目前支持myrank(排行榜)
805805 */
806806 @ XStreamAlias ("MessageView" )
807807 @ XStreamConverter (value = XStreamCDataConverter .class )
808808 private String messageView ;
809-
810809 /**
811810 * 消息点击动作,目前支持ranklist(点击跳转排行榜)
812811 */
813812 @ XStreamAlias ("MessageAction" )
814813 @ XStreamConverter (value = XStreamCDataConverter .class )
815814 private String messageAction ;
816815
816+ @ Override
817+ public String toString () {
818+ return ToStringUtils .toSimpleString (this );
819+ }
820+
817821 public String getMessageView () {
818822 return messageView ;
819823 }
@@ -833,19 +837,18 @@ public void setMessageAction(String messageAction) {
833837
834838 @ XStreamAlias ("ScanCodeInfo" )
835839 public static class ScanCodeInfo {
836- @ Override
837- public String toString () {
838- return ToStringUtils .toSimpleString (this );
839- }
840-
841840 @ XStreamAlias ("ScanType" )
842841 @ XStreamConverter (value = XStreamCDataConverter .class )
843842 private String scanType ;
844-
845843 @ XStreamAlias ("ScanResult" )
846844 @ XStreamConverter (value = XStreamCDataConverter .class )
847845 private String scanResult ;
848846
847+ @ Override
848+ public String toString () {
849+ return ToStringUtils .toSimpleString (this );
850+ }
851+
849852 /**
850853 * 扫描类型,一般是qrcode
851854 */
@@ -873,17 +876,16 @@ public void setScanResult(String scanResult) {
873876
874877 @ XStreamAlias ("SendPicsInfo" )
875878 public static class SendPicsInfo {
879+ @ XStreamAlias ("PicList" )
880+ protected final List <Item > picList = new ArrayList <>();
881+ @ XStreamAlias ("Count" )
882+ private Long count ;
883+
876884 @ Override
877885 public String toString () {
878886 return ToStringUtils .toSimpleString (this );
879887 }
880888
881- @ XStreamAlias ("Count" )
882- private Long count ;
883-
884- @ XStreamAlias ("PicList" )
885- protected final List <Item > picList = new ArrayList <>();
886-
887889 public Long getCount () {
888890 return this .count ;
889891 }
@@ -898,15 +900,15 @@ public List<Item> getPicList() {
898900
899901 @ XStreamAlias ("item" )
900902 public static class Item {
903+ @ XStreamAlias ("PicMd5Sum" )
904+ @ XStreamConverter (value = XStreamCDataConverter .class )
905+ private String picMd5Sum ;
906+
901907 @ Override
902908 public String toString () {
903909 return ToStringUtils .toSimpleString (this );
904910 }
905911
906- @ XStreamAlias ("PicMd5Sum" )
907- @ XStreamConverter (value = XStreamCDataConverter .class )
908- private String picMd5Sum ;
909-
910912 public String getPicMd5Sum () {
911913 return this .picMd5Sum ;
912914 }
@@ -985,9 +987,4 @@ public void setPoiname(String poiname) {
985987 this .poiname = poiname ;
986988 }
987989 }
988-
989- @ Override
990- public String toString () {
991- return ToStringUtils .toSimpleString (this );
992- }
993990}
0 commit comments