|
@@ -1,5 +1,11 @@
|
|
|
package me.chanjar.weixin.mp.bean.message;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.Serializable;
|
|
|
+
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
+
|
|
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
|
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
|
|
import lombok.Data;
|
|
@@ -9,15 +15,10 @@ import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
|
|
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
|
|
import me.chanjar.weixin.mp.util.crypto.WxMpCryptUtil;
|
|
|
import me.chanjar.weixin.mp.util.xml.XStreamTransformer;
|
|
|
-import org.apache.commons.io.IOUtils;
|
|
|
-
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.io.Serializable;
|
|
|
|
|
|
/**
|
|
|
* <pre>
|
|
|
- * 微信推送过来的消息,xml格式
|
|
|
+ * 微信推送过来的消息,xml格式.
|
|
|
* 部分未注释的字段的解释请查阅相关微信开发文档:
|
|
|
* <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140453&token=&lang=zh_CN">接收普通消息</a>
|
|
|
* <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140454&token=&lang=zh_CN">接收事件推送</a>
|
|
@@ -129,28 +130,29 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
// 群发消息返回的结果
|
|
|
///////////////////////////////////////
|
|
|
/**
|
|
|
- * 群发的结果
|
|
|
+ * 群发的结果.
|
|
|
*/
|
|
|
@XStreamAlias("Status")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
private String status;
|
|
|
/**
|
|
|
- * group_id下粉丝数;或者openid_list中的粉丝数
|
|
|
+ * group_id下粉丝数;或者openid_list中的粉丝数.
|
|
|
*/
|
|
|
@XStreamAlias("TotalCount")
|
|
|
private Integer totalCount;
|
|
|
/**
|
|
|
- * 过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数,原则上,filterCount = sentCount + errorCount
|
|
|
+ * 过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数.
|
|
|
+ * 原则上,filterCount = sentCount + errorCount
|
|
|
*/
|
|
|
@XStreamAlias("FilterCount")
|
|
|
private Integer filterCount;
|
|
|
/**
|
|
|
- * 发送成功的粉丝数
|
|
|
+ * 发送成功的粉丝数.
|
|
|
*/
|
|
|
@XStreamAlias("SentCount")
|
|
|
private Integer sentCount;
|
|
|
/**
|
|
|
- * 发送失败的粉丝数
|
|
|
+ * 发送失败的粉丝数.
|
|
|
*/
|
|
|
@XStreamAlias("ErrorCount")
|
|
|
private Integer errorCount;
|
|
@@ -159,17 +161,17 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
// 客服会话管理相关事件推送
|
|
|
///////////////////////////////////////
|
|
|
/**
|
|
|
- * 创建或关闭客服会话时的客服帐号
|
|
|
+ * 创建或关闭客服会话时的客服帐号.
|
|
|
*/
|
|
|
@XStreamAlias("KfAccount")
|
|
|
private String kfAccount;
|
|
|
/**
|
|
|
- * 转接客服会话时的转入客服帐号
|
|
|
+ * 转接客服会话时的转入客服帐号.
|
|
|
*/
|
|
|
@XStreamAlias("ToKfAccount")
|
|
|
private String toKfAccount;
|
|
|
/**
|
|
|
- * 转接客服会话时的转出客服帐号
|
|
|
+ * 转接客服会话时的转出客服帐号.
|
|
|
*/
|
|
|
@XStreamAlias("FromKfAccount")
|
|
|
private String fromKfAccount;
|
|
@@ -177,6 +179,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
///////////////////////////////////////
|
|
|
// 卡券相关事件推送
|
|
|
///////////////////////////////////////
|
|
|
+
|
|
|
@XStreamAlias("CardId")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
private String cardId;
|
|
@@ -185,8 +188,11 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
private String friendUserName;
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否为转赠,1代表是,0代表否.
|
|
|
+ */
|
|
|
@XStreamAlias("IsGiveByFriend")
|
|
|
- private Integer isGiveByFriend; // 是否为转赠,1代表是,0代表否
|
|
|
+ private Integer isGiveByFriend;
|
|
|
|
|
|
@XStreamAlias("UserCardCode")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
@@ -200,14 +206,14 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
private Integer outerId;
|
|
|
|
|
|
/**
|
|
|
- * 用户删除会员卡后可重新找回,当用户本次操作为找回时,该值为1,否则为0
|
|
|
+ * 用户删除会员卡后可重新找回,当用户本次操作为找回时,该值为1,否则为0.
|
|
|
*/
|
|
|
@XStreamAlias("IsRestoreMemberCard")
|
|
|
private String isRestoreMemberCard;
|
|
|
|
|
|
/**
|
|
|
* <pre>
|
|
|
- * 领取场景值,用于领取渠道数据统计。可在生成二维码接口及添加Addcard接口中自定义该字段的字符串值。
|
|
|
+ * 领取场景值,用于领取渠道数据统计。可在生成二维码接口及添加Addcard接口中自定义该字段的字符串值.
|
|
|
* 核销卡券时:开发者发起核销时传入的自定义参数,用于进行核销渠道统计
|
|
|
* 另外:
|
|
|
* 官网文档中,微信卡券>>卡券事件推送>>2.7 进入会员卡事件推送 user_view_card
|
|
@@ -218,43 +224,45 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
private String outerStr;
|
|
|
|
|
|
/**
|
|
|
- * 是否转赠退回,0代表不是,1代表是。
|
|
|
+ * 是否转赠退回,0代表不是,1代表是.
|
|
|
*/
|
|
|
@XStreamAlias("IsReturnBack")
|
|
|
private String isReturnBack;
|
|
|
|
|
|
/**
|
|
|
- * 是否是群转赠,0代表不是,1代表是。
|
|
|
+ * 是否是群转赠,0代表不是,1代表是.
|
|
|
*/
|
|
|
@XStreamAlias("IsChatRoom")
|
|
|
private String isChatRoom;
|
|
|
|
|
|
/**
|
|
|
- * 核销来源。支持开发者统计API核销(FROM_API)、公众平台核销(FROM_MP)、卡券商户助手核销(FROM_MOBILE_HELPER)(核销员微信号)
|
|
|
+ * 核销来源.
|
|
|
+ * 支持开发者统计API核销(FROM_API)、公众平台核销(FROM_MP)、卡券商户助手核销(FROM_MOBILE_HELPER)(核销员微信号)
|
|
|
*/
|
|
|
@XStreamAlias("ConsumeSource")
|
|
|
private String consumeSource;
|
|
|
|
|
|
/**
|
|
|
- * 门店名称,当前卡券核销的门店名称(只有通过自助核销和买单核销时才会出现该字段)
|
|
|
+ * 门店名称.
|
|
|
+ * 当前卡券核销的门店名称(只有通过自助核销和买单核销时才会出现该字段)
|
|
|
*/
|
|
|
@XStreamAlias("LocationName")
|
|
|
private String locationName;
|
|
|
|
|
|
/**
|
|
|
- * 核销该卡券核销员的openid(只有通过卡券商户助手核销时才会出现)
|
|
|
+ * 核销该卡券核销员的openid(只有通过卡券商户助手核销时才会出现).
|
|
|
*/
|
|
|
@XStreamAlias("StaffOpenId")
|
|
|
private String staffOpenId;
|
|
|
|
|
|
/**
|
|
|
- * 自助核销时,用户输入的验证码
|
|
|
+ * 自助核销时,用户输入的验证码.
|
|
|
*/
|
|
|
@XStreamAlias("VerifyCode")
|
|
|
private String verifyCode;
|
|
|
|
|
|
/**
|
|
|
- * 自助核销时,用户输入的备注金额
|
|
|
+ * 自助核销时,用户输入的备注金额.
|
|
|
*/
|
|
|
@XStreamAlias("RemarkAmount")
|
|
|
private String remarkAmount;
|
|
@@ -262,7 +270,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
/**
|
|
|
* <pre>
|
|
|
* 官网文档中,微信卡券>>卡券事件推送>>2.10 库存报警事件card_sku_remind
|
|
|
- * Detail:报警详细信息
|
|
|
+ * Detail:报警详细信息.
|
|
|
* </pre>
|
|
|
*/
|
|
|
@XStreamAlias("Detail")
|
|
@@ -271,7 +279,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
/**
|
|
|
* <pre>
|
|
|
* 官网文档中,微信卡券>>卡券事件推送>>2.9 会员卡内容更新事件 update_member_card
|
|
|
- * ModifyBonus:变动的积分值
|
|
|
+ * ModifyBonus:变动的积分值.
|
|
|
* </pre>
|
|
|
*/
|
|
|
@XStreamAlias("ModifyBonus")
|
|
@@ -280,7 +288,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
/**
|
|
|
* <pre>
|
|
|
* 官网文档中,微信卡券>>卡券事件推送>>2.9 会员卡内容更新事件 update_member_card
|
|
|
- * ModifyBalance:变动的余额值
|
|
|
+ * ModifyBalance:变动的余额值.
|
|
|
* </pre>
|
|
|
*/
|
|
|
@XStreamAlias("ModifyBalance")
|
|
@@ -289,7 +297,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
/**
|
|
|
* <pre>
|
|
|
* 官网文档中,微信卡券>>卡券事件推送>>2.6 买单事件推送 User_pay_from_pay_cell
|
|
|
- * TransId:微信支付交易订单号(只有使用买单功能核销的卡券才会出现)
|
|
|
+ * TransId:微信支付交易订单号(只有使用买单功能核销的卡券才会出现).
|
|
|
* </pre>
|
|
|
*/
|
|
|
@XStreamAlias("TransId")
|
|
@@ -335,29 +343,25 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
// 门店审核事件推送
|
|
|
///////////////////////////////////////
|
|
|
/**
|
|
|
- * UniqId
|
|
|
- * 商户自己内部ID,即字段中的sid
|
|
|
+ * 商户自己内部ID,即字段中的sid.
|
|
|
*/
|
|
|
@XStreamAlias("UniqId")
|
|
|
private String storeUniqId;
|
|
|
|
|
|
/**
|
|
|
- * PoiId
|
|
|
- * 微信的门店ID,微信内门店唯一标示ID
|
|
|
+ * 微信的门店ID,微信内门店唯一标示ID.
|
|
|
*/
|
|
|
@XStreamAlias("PoiId")
|
|
|
private String poiId;
|
|
|
|
|
|
/**
|
|
|
- * Result
|
|
|
- * 审核结果,成功succ 或失败fail
|
|
|
+ * 审核结果,成功succ 或失败fail.
|
|
|
*/
|
|
|
@XStreamAlias("Result")
|
|
|
private String result;
|
|
|
|
|
|
/**
|
|
|
- * msg
|
|
|
- * 成功的通知信息,或审核失败的驳回理由
|
|
|
+ * 成功的通知信息,或审核失败的驳回理由.
|
|
|
*/
|
|
|
@XStreamAlias("msg")
|
|
|
private String msg;
|
|
@@ -366,46 +370,74 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
// 微信认证事件推送
|
|
|
///////////////////////////////////////
|
|
|
/**
|
|
|
- * ExpiredTime
|
|
|
- * 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期
|
|
|
+ * 资质认证成功/名称认证成功: 有效期 (整形),指的是时间戳,将于该时间戳认证过期.
|
|
|
* 年审通知: 有效期 (整形),指的是时间戳,将于该时间戳认证过期,需尽快年审
|
|
|
* 认证过期失效通知: 有效期 (整形),指的是时间戳,表示已于该时间戳认证过期,需要重新发起微信认证
|
|
|
*/
|
|
|
@XStreamAlias("ExpiredTime")
|
|
|
private Long expiredTime;
|
|
|
/**
|
|
|
- * FailTime
|
|
|
- * 失败发生时间 (整形),时间戳
|
|
|
+ * 失败发生时间 (整形),时间戳.
|
|
|
*/
|
|
|
@XStreamAlias("FailTime")
|
|
|
private Long failTime;
|
|
|
/**
|
|
|
- * FailReason
|
|
|
- * 认证失败的原因
|
|
|
+ * 认证失败的原因.
|
|
|
*/
|
|
|
@XStreamAlias("FailReason")
|
|
|
private String failReason;
|
|
|
|
|
|
+ ///////////////////////////////////////
|
|
|
+ // 微信小店 6.1订单付款通知
|
|
|
+ ///////////////////////////////////////
|
|
|
+ /**
|
|
|
+ * 订单ID.
|
|
|
+ */
|
|
|
+ @XStreamAlias("OrderId")
|
|
|
+ @XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
+ private String orderId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单状态.
|
|
|
+ */
|
|
|
+ @XStreamAlias("OrderStatus")
|
|
|
+ private String orderStatus;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品ID.
|
|
|
+ */
|
|
|
+ @XStreamAlias("ProductId")
|
|
|
+ @XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
+ private String productId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品SKU信息.
|
|
|
+ */
|
|
|
+ @XStreamAlias("SkuInfo")
|
|
|
+ @XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
+ private String skuInfo;
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
// 微信硬件平台相关事件推送
|
|
|
///////////////////////////////////////
|
|
|
/**
|
|
|
- * 设备类型,目前为"公众账号原始ID"
|
|
|
+ * 设备类型.
|
|
|
+ * 目前为"公众账号原始ID"
|
|
|
*/
|
|
|
@XStreamAlias("DeviceType")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
private String deviceType;
|
|
|
|
|
|
/**
|
|
|
- * 设备ID,第三方提供
|
|
|
+ * 设备ID.
|
|
|
+ * 第三方提供
|
|
|
*/
|
|
|
@XStreamAlias("DeviceID")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
|
private String deviceId;
|
|
|
|
|
|
/**
|
|
|
- * 微信用户账号的OpenID
|
|
|
+ * 微信用户账号的OpenID.
|
|
|
*/
|
|
|
@XStreamAlias("OpenID")
|
|
|
@XStreamConverter(value = XStreamCDataConverter.class)
|
|
@@ -415,13 +447,17 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
private HardWare hardWare = new HardWare();
|
|
|
|
|
|
/**
|
|
|
- * 请求类型:0:退订设备状态;1:心跳;(心跳的处理方式跟订阅一样)2:订阅设备状态
|
|
|
+ * 请求类型.
|
|
|
+ * 0:退订设备状态;
|
|
|
+ * 1:心跳;(心跳的处理方式跟订阅一样)
|
|
|
+ * 2:订阅设备状态
|
|
|
*/
|
|
|
@XStreamAlias("OpType")
|
|
|
private Integer opType;
|
|
|
|
|
|
/**
|
|
|
- * 设备状态:0:未连接;1:已连接
|
|
|
+ * 设备状态.
|
|
|
+ * 0:未连接;1:已连接
|
|
|
*/
|
|
|
@XStreamAlias("DeviceStatus")
|
|
|
private Integer deviceStatus;
|
|
@@ -437,7 +473,7 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 从加密字符串转换
|
|
|
+ * 从加密字符串转换.
|
|
|
*
|
|
|
* @param encryptedXml 密文
|
|
|
* @param wxMpConfigStorage 配置存储器对象
|
|
@@ -445,21 +481,17 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
* @param nonce 随机串
|
|
|
* @param msgSignature 签名串
|
|
|
*/
|
|
|
- public static WxMpXmlMessage fromEncryptedXml(String encryptedXml,
|
|
|
- WxMpConfigStorage wxMpConfigStorage, String timestamp, String nonce,
|
|
|
- String 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);
|
|
|
+ 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) {
|
|
|
+ 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);
|
|
|
+ return fromEncryptedXml(IOUtils.toString(is, "UTF-8"), wxMpConfigStorage, timestamp, nonce, msgSignature);
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
@@ -491,7 +523,6 @@ public class WxMpXmlMessage implements Serializable {
|
|
|
* {@link WxConsts.XmlMsgType#NEWS}
|
|
|
* {@link WxConsts.XmlMsgType#MUSIC}
|
|
|
* </pre>
|
|
|
- *
|
|
|
*/
|
|
|
public void setMsgType(String msgType) {
|
|
|
this.msgType = msgType;
|