小程序消息订阅微信对接代码开发完成
This commit is contained in:
parent
0c1c45088f
commit
317e38e594
7
pom.xml
7
pom.xml
@ -34,6 +34,7 @@
|
|||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<lombok.version>1.18.4</lombok.version>
|
<lombok.version>1.18.4</lombok.version>
|
||||||
<knife4j.version>3.0.3</knife4j.version>
|
<knife4j.version>3.0.3</knife4j.version>
|
||||||
|
<simple-xml.version>2.7.1</simple-xml.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
@ -184,6 +185,12 @@
|
|||||||
<artifactId>postdischarge-mobile</artifactId>
|
<artifactId>postdischarge-mobile</artifactId>
|
||||||
<version>${xinelu.version}</version>
|
<version>${xinelu.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- xml文件序列化和反序列化 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.simpleframework</groupId>
|
||||||
|
<artifactId>simple-xml</artifactId>
|
||||||
|
<version>${simple-xml.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
@ -182,3 +182,26 @@ xss:
|
|||||||
excludes: /system/notice
|
excludes: /system/notice
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
# 微信小程序参数配置信息
|
||||||
|
applet-chat-config:
|
||||||
|
# 微信小程序id,wxdec3416aa3d60cab
|
||||||
|
applet-id: wxdc32268eca6b78f9
|
||||||
|
# 微信小程序密钥,f58e19be0380c2ebc6e9e9684c0dacce
|
||||||
|
secret: 0d0e41432908750460aef2bf0aa871ae
|
||||||
|
# 微信小程序返回国家语言
|
||||||
|
lang: zh_CN
|
||||||
|
# 微信小程序授权类型
|
||||||
|
grant-type: authorization_code
|
||||||
|
# 微信小程序事件回调令牌
|
||||||
|
token: uI1NGHesp7ylIYVYQvp0TlcDmUTKCHj2
|
||||||
|
# 微信小程序事件回调消息加密密钥
|
||||||
|
encoding-aes-key: 5rbyhMBpdnxTEVT54zeHMNcXi3ccilQZ209QqGi89EW
|
||||||
|
# 优惠券领取模板id
|
||||||
|
coupon-receive-template-id: e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA
|
||||||
|
# 商品订单支付成功通知模板id
|
||||||
|
goods-order-template-id: -IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ
|
||||||
|
# 预约服务订单通知模板id
|
||||||
|
appoint-order-template-id: nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU
|
||||||
|
# 签到成功通知模板id
|
||||||
|
sign-template-id: S_c9bR4znSWpXg-6ACIMn7AkaR11dzo113XM8w4CKz0
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
package com.xinelu.common.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序参数配置类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 15:52:38
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "applet-chat-config")
|
||||||
|
public class AppletChatConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序id
|
||||||
|
*/
|
||||||
|
private String appletId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序secret
|
||||||
|
*/
|
||||||
|
private String secret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
|
||||||
|
*/
|
||||||
|
private String lang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权类型
|
||||||
|
*/
|
||||||
|
private String grantType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序事件回调令牌
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序事件回调消息加密密钥
|
||||||
|
*/
|
||||||
|
private String encodingAesKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券领取模板id
|
||||||
|
*/
|
||||||
|
private String couponReceiveTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品订单支付成功通知模板id
|
||||||
|
*/
|
||||||
|
private String goodsOrderTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约服务订单通知模板id
|
||||||
|
*/
|
||||||
|
private String appointOrderTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到通知模板
|
||||||
|
*/
|
||||||
|
private String signTemplateId;
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.xinelu.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序订阅消息记录表 订阅消息类型枚举,
|
||||||
|
* @Date 2024-03-19 17:16:06
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum SubscribeMessageTypeEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约服务付款通知提醒
|
||||||
|
*/
|
||||||
|
APPOINT_ORDER_MESSAGE_PUSH("APPOINT_ORDER_MESSAGE_PUSH"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券领取提醒
|
||||||
|
*/
|
||||||
|
COUPON_RECEIVE_MESSAGE_PUSH("COUPON_RECEIVE_MESSAGE_PUSH"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品订单支付成功提醒
|
||||||
|
*/
|
||||||
|
GOODS_ORDER_MESSAGE_PUSH("GOODS_ORDER_MESSAGE_PUSH"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到积分通知提醒
|
||||||
|
*/
|
||||||
|
SIGN_MESSAGE_PUSH("SIGN_MESSAGE_PUSH"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final private String info;
|
||||||
|
|
||||||
|
SubscribeMessageTypeEnum(String info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -167,7 +167,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
* @param date LocalDate
|
* @param date LocalDate
|
||||||
* @param pattern 解析格式
|
* @param pattern 解析格式
|
||||||
* @return 日期字符串
|
* @return 日期字符串
|
||||||
* @Author jihan
|
* @Author 纪寒
|
||||||
*/
|
*/
|
||||||
public static String formatDateToString(LocalDate date, String pattern) {
|
public static String formatDateToString(LocalDate date, String pattern) {
|
||||||
if (Objects.isNull(date)) {
|
if (Objects.isNull(date)) {
|
||||||
@ -181,7 +181,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
*
|
*
|
||||||
* @param date 指定日期,如果为null,默认为当天
|
* @param date 指定日期,如果为null,默认为当天
|
||||||
* @return 结束日期
|
* @return 结束日期
|
||||||
* @author jihan
|
* @author 纪寒
|
||||||
*/
|
*/
|
||||||
public static LocalDateTime end(LocalDate date) {
|
public static LocalDateTime end(LocalDate date) {
|
||||||
return LocalDateTime.of(null == date ? LocalDate.now() : date, LocalTime.MAX);
|
return LocalDateTime.of(null == date ? LocalDate.now() : date, LocalTime.MAX);
|
||||||
@ -193,7 +193,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
* @param beginTime 开始时间
|
* @param beginTime 开始时间
|
||||||
* @param endTime 结束时间可以为null, 如果为null则表示now
|
* @param endTime 结束时间可以为null, 如果为null则表示now
|
||||||
* @return 分钟差值
|
* @return 分钟差值
|
||||||
* @author jihan
|
* @author 纪寒
|
||||||
*/
|
*/
|
||||||
public static long differenceMinutes(LocalDateTime beginTime, LocalDateTime endTime) {
|
public static long differenceMinutes(LocalDateTime beginTime, LocalDateTime endTime) {
|
||||||
if (null == beginTime) {
|
if (null == beginTime) {
|
||||||
@ -201,4 +201,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
}
|
}
|
||||||
return ChronoUnit.MINUTES.between(beginTime, null == endTime ? LocalDateTime.now() : endTime);
|
return ChronoUnit.MINUTES.between(beginTime, null == endTime ? LocalDateTime.now() : endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳转LocalDateTime
|
||||||
|
*
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @return java.time.LocalDateTime
|
||||||
|
* @author 纪寒
|
||||||
|
*/
|
||||||
|
public static LocalDateTime timestampToLocalDateTime(long timestamp) {
|
||||||
|
return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ public class SubscribeMessageRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用于订阅消息次数")
|
@ApiModelProperty(value = "用于订阅消息次数")
|
||||||
@Excel(name = "用于订阅消息次数")
|
@Excel(name = "用于订阅消息次数")
|
||||||
private Long subscribeCount;
|
private Integer subscribeCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订阅时间
|
* 订阅时间
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public class SubscribeMessageSendRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "推送结果状态码")
|
@ApiModelProperty(value = "推送结果状态码")
|
||||||
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功")
|
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功")
|
||||||
private Long errorCode;
|
private Integer errorCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送结果状态码,success:成功
|
* 推送结果状态码,success:成功
|
||||||
|
|||||||
@ -58,4 +58,12 @@ public interface PatientInfoMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePatientInfoByIds(Long[] ids);
|
public int deletePatientInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid查询被护理人信息
|
||||||
|
*
|
||||||
|
* @param openId 微信openId
|
||||||
|
* @return 被护理人基本信息
|
||||||
|
*/
|
||||||
|
PatientInfo getPatientInfoByOpenId(String openId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xinelu.manage.mapper.subscribemessagerecord;
|
package com.xinelu.manage.mapper.subscribemessagerecord;
|
||||||
|
|
||||||
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -58,4 +59,23 @@ public interface SubscribeMessageRecordMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteSubscribeMessageRecordByIds(Long[] ids);
|
int deleteSubscribeMessageRecordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecordList 新增微信小程序订阅消息记录
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int insertSubscribeMessageRecordList(List<SubscribeMessageRecord> subscribeMessageRecordList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据会员openid与templateId修改微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param openId 微信openid
|
||||||
|
* @param templateId 模板id
|
||||||
|
* @param subscribeStatus 订阅状态
|
||||||
|
* @param patientId 患者id
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int updateSubscribeMessageTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("subscribeStatus") String subscribeStatus, @Param("patientId") Long patientId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,4 +58,12 @@ public interface SubscribeMessageSendRecordMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
|
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增微信小程序订阅消息发送记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecordList 微信小程序订阅发送消息记录
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -519,4 +519,33 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="getPatientInfoByOpenId" parameterType="string" resultType="patientInfo">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
community_code,
|
||||||
|
area_code,
|
||||||
|
patient_code,
|
||||||
|
patient_name,
|
||||||
|
card_no,
|
||||||
|
user_id,
|
||||||
|
unionid,
|
||||||
|
openid,
|
||||||
|
phone,
|
||||||
|
address,
|
||||||
|
urgent_contact_name,
|
||||||
|
urgent_contact_phone,
|
||||||
|
community_alias_name,
|
||||||
|
home_longitude,
|
||||||
|
home_latitude,
|
||||||
|
head_picture_url
|
||||||
|
FROM
|
||||||
|
patient_info
|
||||||
|
<where>
|
||||||
|
del_flag = 0
|
||||||
|
<if test="openId != null and openId != ''">
|
||||||
|
and openid = #{openId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -193,4 +193,45 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertSubscribeMessageRecordList" parameterType="java.util.List">
|
||||||
|
insert into subscribe_message_record(
|
||||||
|
patient_id,
|
||||||
|
unionid,
|
||||||
|
openid,
|
||||||
|
template_id,
|
||||||
|
message_type,
|
||||||
|
subscribe_count,
|
||||||
|
subscribe_time,
|
||||||
|
applet_id,
|
||||||
|
subscribe_status,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time
|
||||||
|
) values
|
||||||
|
<foreach item="subscribeMessageRecordList" index="index" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
#{subscribeMessageRecordList.patientId},
|
||||||
|
#{subscribeMessageRecordList.unionid},
|
||||||
|
#{subscribeMessageRecordList.openid},
|
||||||
|
#{subscribeMessageRecordList.templateId},
|
||||||
|
#{subscribeMessageRecordList.messageType},
|
||||||
|
#{subscribeMessageRecordList.subscribeCount},
|
||||||
|
#{subscribeMessageRecordList.subscribeTime},
|
||||||
|
#{subscribeMessageRecordList.appletId},
|
||||||
|
#{subscribeMessageRecordList.subscribeStatus},
|
||||||
|
#{subscribeMessageRecordList.createBy},
|
||||||
|
#{subscribeMessageRecordList.createTime},
|
||||||
|
#{subscribeMessageRecordList.updateBy},
|
||||||
|
#{subscribeMessageRecordList.updateTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSubscribeMessageTemplateId">
|
||||||
|
update subscribe_message_record
|
||||||
|
set patient_id = #{patientId}, subscribe_status = #{subscribeStatus}, update_time = now()
|
||||||
|
where openid = #{openId} and template_id = #{templateId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -204,4 +204,31 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertSubscribeMessageSendRecordList" parameterType="java.util.List">
|
||||||
|
insert into subscribe_message_send_record(
|
||||||
|
openid,
|
||||||
|
applet_id,
|
||||||
|
subscribe_time,
|
||||||
|
template_id,
|
||||||
|
msg_id,
|
||||||
|
message_type,
|
||||||
|
error_code,
|
||||||
|
error_status,
|
||||||
|
create_time
|
||||||
|
) values
|
||||||
|
<foreach item="sendRecord" index="index" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
#{sendRecord.openid},
|
||||||
|
#{sendRecord.appletId},
|
||||||
|
#{sendRecord.subscribeTime},
|
||||||
|
#{sendRecord.templateId},
|
||||||
|
#{sendRecord.msgId},
|
||||||
|
#{sendRecord.messageType},
|
||||||
|
#{sendRecord.errorCode},
|
||||||
|
#{sendRecord.errorStatus},
|
||||||
|
#{sendRecord.createTime}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -34,5 +34,10 @@
|
|||||||
<groupId>com.xinelu</groupId>
|
<groupId>com.xinelu</groupId>
|
||||||
<artifactId>postdischarge-manage</artifactId>
|
<artifactId>postdischarge-manage</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- xml文件序列化和反序列化 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.simpleframework</groupId>
|
||||||
|
<artifactId>simple-xml</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.xinelu.mobile.mapper;
|
package com.xinelu.mobile.mapper.mobiletest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 测试 Mapper
|
* @Description 测试 Mapper
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.xinelu.mobile.service.wechatappletcallback;
|
||||||
|
|
||||||
|
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序事件回调业务层
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-15 15:45:50
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface WeChatAppletCallBackService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序消息推送事件回调POST处理
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 请求参数
|
||||||
|
*/
|
||||||
|
void handleWeChatAppletCallBack(WeChatMessagePushVO weChatMessagePushVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,278 @@
|
|||||||
|
package com.xinelu.mobile.service.wechatappletcallback.impl;
|
||||||
|
|
||||||
|
import com.xinelu.common.config.AppletChatConfig;
|
||||||
|
import com.xinelu.common.enums.SubscribeMessageTypeEnum;
|
||||||
|
import com.xinelu.common.exception.ServiceException;
|
||||||
|
import com.xinelu.common.utils.DateUtils;
|
||||||
|
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||||
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||||
|
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||||
|
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
|
||||||
|
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
|
||||||
|
import com.xinelu.mobile.service.wechatappletcallback.WeChatAppletCallBackService;
|
||||||
|
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.compress.utils.Lists;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序事件回调业务层实现类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 17:13:06
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubscribeMessageRecordMapper subscribeMessageRecordMapper;
|
||||||
|
@Resource
|
||||||
|
private AppletChatConfig appletChatConfig;
|
||||||
|
@Resource
|
||||||
|
private PatientInfoMapper patientInfoMapper;
|
||||||
|
@Resource
|
||||||
|
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
|
||||||
|
/**
|
||||||
|
* 微信消息推送变更事件标识
|
||||||
|
*/
|
||||||
|
private static final String SUBSCRIBE_MSG_CHANGE_EVENT = "subscribe_msg_change_event";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送订阅事件标识
|
||||||
|
*/
|
||||||
|
private static final String SUBSCRIBE_MSG_POPUP_EVENT = "subscribe_msg_popup_event";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信消息推送发送结果事件标识
|
||||||
|
*/
|
||||||
|
private static final String SUBSCRIBE_MSG__SENT_EVENT = "subscribe_msg_sent_event";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序消息推送事件回调POST处理
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 请求参数
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void handleWeChatAppletCallBack(WeChatMessagePushVO weChatMessagePushVO) {
|
||||||
|
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG_POPUP_EVENT)) {
|
||||||
|
//处理用户订阅授权事件
|
||||||
|
this.handleSubscribeMsgPopupEvent(weChatMessagePushVO);
|
||||||
|
}
|
||||||
|
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG_CHANGE_EVENT)) {
|
||||||
|
//处理订阅消息变更事件
|
||||||
|
this.handleSubscribeMsgChangeEvent(weChatMessagePushVO);
|
||||||
|
}
|
||||||
|
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG__SENT_EVENT)) {
|
||||||
|
//处理订阅消息发送结果事件
|
||||||
|
this.handleSubscribeMsgSentEvent(weChatMessagePushVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理用户订阅授权事件
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 参数信息
|
||||||
|
*/
|
||||||
|
private void handleSubscribeMsgPopupEvent(WeChatMessagePushVO weChatMessagePushVO) {
|
||||||
|
//处理订阅消息授权事件
|
||||||
|
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgPopupEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgPopupEvent().getSubscribeMsgPopupEventList())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//查询用户信息表
|
||||||
|
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
//组装数据
|
||||||
|
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_POPUP_EVENT);
|
||||||
|
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//根据openid查询数据库原有的订阅消息记录
|
||||||
|
SubscribeMessageRecord subscribeMessageRecord = new SubscribeMessageRecord();
|
||||||
|
subscribeMessageRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
List<SubscribeMessageRecord> existMessageRecordList = subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
|
||||||
|
List<SubscribeMessageRecord> subtractSubscribeList = new ArrayList<>(CollectionUtils.subtract(subscribeMessageRecordList, existMessageRecordList));
|
||||||
|
if (CollectionUtils.isNotEmpty(subtractSubscribeList)) {
|
||||||
|
//新增订阅记录信息
|
||||||
|
int insertCount = subscribeMessageRecordMapper.insertSubscribeMessageRecordList(subtractSubscribeList);
|
||||||
|
if (insertCount <= 0) {
|
||||||
|
log.error("微信订阅消息回调,新增用户订阅消息记录失败,记录信息为:[{}]", subtractSubscribeList);
|
||||||
|
throw new ServiceException("微信订阅消息回调,新增用户订阅消息记录失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<SubscribeMessageRecord> intersectionSubscribeList = new ArrayList<>(CollectionUtils.intersection(subscribeMessageRecordList, existMessageRecordList));
|
||||||
|
if (CollectionUtils.isNotEmpty(intersectionSubscribeList)) {
|
||||||
|
//修改订阅信息状态
|
||||||
|
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
|
||||||
|
Long patientId = null;
|
||||||
|
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
|
||||||
|
patientId = patientInfo.getId();
|
||||||
|
}
|
||||||
|
String openId = StringUtils.isBlank(messageRecord.getOpenid()) ? "" : messageRecord.getOpenid();
|
||||||
|
String templateId = StringUtils.isBlank(messageRecord.getTemplateId()) ? "" : messageRecord.getTemplateId();
|
||||||
|
String subscribeStatus = StringUtils.isBlank(messageRecord.getSubscribeStatus()) ? "" : messageRecord.getSubscribeStatus();
|
||||||
|
subscribeMessageRecordMapper.updateSubscribeMessageTemplateId(openId, templateId, subscribeStatus, patientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理订阅消息变更事件
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 信息
|
||||||
|
*/
|
||||||
|
private void handleSubscribeMsgChangeEvent(WeChatMessagePushVO weChatMessagePushVO) {
|
||||||
|
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgChangeEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgChangeEvent().getSubscribeMsgPopupEventList())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//查询用户信息表
|
||||||
|
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
//组装数据
|
||||||
|
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_CHANGE_EVENT);
|
||||||
|
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//根据openid查询数据库原有的订阅消息记录
|
||||||
|
SubscribeMessageRecord subscribeMessageRecord = new SubscribeMessageRecord();
|
||||||
|
subscribeMessageRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
List<SubscribeMessageRecord> existMessageRecordList = subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
|
||||||
|
List<SubscribeMessageRecord> intersectionSubscribeList = new ArrayList<>(CollectionUtils.intersection(subscribeMessageRecordList, existMessageRecordList));
|
||||||
|
if (CollectionUtils.isNotEmpty(intersectionSubscribeList)) {
|
||||||
|
//修改订阅信息状态
|
||||||
|
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
|
||||||
|
Long patientId = null;
|
||||||
|
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
|
||||||
|
patientId = patientInfo.getId();
|
||||||
|
}
|
||||||
|
String openId = StringUtils.isBlank(messageRecord.getOpenid()) ? "" : messageRecord.getOpenid();
|
||||||
|
String templateId = StringUtils.isBlank(messageRecord.getTemplateId()) ? "" : messageRecord.getTemplateId();
|
||||||
|
String subscribeStatus = StringUtils.isBlank(messageRecord.getSubscribeStatus()) ? "" : messageRecord.getSubscribeStatus();
|
||||||
|
subscribeMessageRecordMapper.updateSubscribeMessageTemplateId(openId, templateId, subscribeStatus, patientId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理订阅消息发送结果事件
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 信息
|
||||||
|
*/
|
||||||
|
private void handleSubscribeMsgSentEvent(WeChatMessagePushVO weChatMessagePushVO) {
|
||||||
|
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgSentEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgSentEvent().getSubscribeMsgSentEventList())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//组装数据
|
||||||
|
List<SubscribeMessageSendRecord> subscribeMessageSendRecordList = createSubscribeMessageSendRecordList(weChatMessagePushVO);
|
||||||
|
if (CollectionUtils.isNotEmpty(subscribeMessageSendRecordList)) {
|
||||||
|
int insertCount = subscribeMessageSendRecordMapper.insertSubscribeMessageSendRecordList(subscribeMessageSendRecordList);
|
||||||
|
if (insertCount <= 0) {
|
||||||
|
log.error("微信订阅消息回调,新增用户订阅消息发送记录失败,记录信息为:[{}]", subscribeMessageSendRecordList);
|
||||||
|
throw new ServiceException("微信订阅消息回调,新增用户订阅消息发送记录失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装订阅消息数据
|
||||||
|
*
|
||||||
|
* @param patientInfo 会员用户信息
|
||||||
|
* @param weChatMessagePushVO 微信请求参数信息
|
||||||
|
* @param eventType 事件类型
|
||||||
|
* @return List<SubscribeMessageRecord>
|
||||||
|
*/
|
||||||
|
private List<SubscribeMessageRecord> createSubscribeMessageRecordList(PatientInfo patientInfo, WeChatMessagePushVO weChatMessagePushVO, String eventType) {
|
||||||
|
List<SubscribeMessageRecord> subscribeMessageRecordList = Lists.newArrayList();
|
||||||
|
if (SUBSCRIBE_MSG_POPUP_EVENT.equals(eventType)) {
|
||||||
|
subscribeMessageRecordList = weChatMessagePushVO.getSubscribeMsgPopupEvent().getSubscribeMsgPopupEventList().stream().filter(Objects::nonNull).map(item -> {
|
||||||
|
SubscribeMessageRecord subscribe = new SubscribeMessageRecord();
|
||||||
|
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
|
||||||
|
subscribe.setPatientId(patientInfo.getId());
|
||||||
|
}
|
||||||
|
//此处模板通知需要根据实际情况进行修改
|
||||||
|
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
|
||||||
|
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
subscribe.setSubscribeCount(1);
|
||||||
|
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
|
||||||
|
subscribe.setCreateTime(LocalDateTime.now());
|
||||||
|
subscribe.setSubscribeStatus(StringUtils.isBlank(item.getSubscribeStatusString()) ? "" : item.getSubscribeStatusString());
|
||||||
|
return subscribe;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (SUBSCRIBE_MSG_CHANGE_EVENT.equals(eventType)) {
|
||||||
|
subscribeMessageRecordList = weChatMessagePushVO.getSubscribeMsgChangeEvent().getSubscribeMsgPopupEventList().stream().filter(Objects::nonNull).map(item -> {
|
||||||
|
SubscribeMessageRecord subscribe = new SubscribeMessageRecord();
|
||||||
|
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
|
||||||
|
subscribe.setPatientId(patientInfo.getId());
|
||||||
|
}
|
||||||
|
//此处模板通知需要根据实际情况进行修改
|
||||||
|
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
|
||||||
|
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
|
||||||
|
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
|
||||||
|
}
|
||||||
|
subscribe.setSubscribeCount(1);
|
||||||
|
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
|
||||||
|
subscribe.setCreateTime(LocalDateTime.now());
|
||||||
|
subscribe.setSubscribeStatus(StringUtils.isBlank(item.getSubscribeStatusString()) ? "" : item.getSubscribeStatusString());
|
||||||
|
return subscribe;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return subscribeMessageRecordList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装订阅消息发送结果数据
|
||||||
|
*
|
||||||
|
* @param weChatMessagePushVO 微信请求参数信息
|
||||||
|
* @return List<SubscribeMessageSendRecord>
|
||||||
|
*/
|
||||||
|
private List<SubscribeMessageSendRecord> createSubscribeMessageSendRecordList(WeChatMessagePushVO weChatMessagePushVO) {
|
||||||
|
return weChatMessagePushVO.getSubscribeMsgSentEvent().getSubscribeMsgSentEventList().stream().map(item -> {
|
||||||
|
SubscribeMessageSendRecord sendRecord = new SubscribeMessageSendRecord();
|
||||||
|
sendRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
|
||||||
|
sendRecord.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
|
||||||
|
sendRecord.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
|
||||||
|
sendRecord.setMessageType(StringUtils.isBlank(weChatMessagePushVO.getMsgType()) ? "" : weChatMessagePushVO.getMsgType());
|
||||||
|
sendRecord.setMsgId(StringUtils.isBlank(item.getMsgId()) ? "" : item.getMsgId());
|
||||||
|
sendRecord.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
|
||||||
|
sendRecord.setCreateTime(LocalDateTime.now());
|
||||||
|
sendRecord.setErrorStatus(StringUtils.isBlank(item.getErrorStatus()) ? "" : item.getErrorStatus());
|
||||||
|
sendRecord.setErrorCode(StringUtils.isBlank(item.getErrorCode()) ? null : Integer.parseInt(item.getErrorCode()));
|
||||||
|
return sendRecord;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.ElementList;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 当用户在手机端服务通知里消息卡片右上角“...”管理消息实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:12:17
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "SubscribeMsgChangeEvent", strict = false)
|
||||||
|
@Data
|
||||||
|
public class SubscribeMsgChangeEventVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6682105837610124794L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@ElementList(inline = true, required = false)
|
||||||
|
private List<SubscribeMsgPopupEventListVO> subscribeMsgPopupEventList;
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.Element;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 模板信息集合
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:10:28
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "List", strict = false)
|
||||||
|
@Data
|
||||||
|
public class SubscribeMsgPopupEventListVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 548605591615555467L;
|
||||||
|
/**
|
||||||
|
* 模板id
|
||||||
|
*/
|
||||||
|
@Element(name = "TemplateId", required = false)
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅结果(accept接收;reject拒收)
|
||||||
|
*/
|
||||||
|
@Element(name = "SubscribeStatusString", required = false)
|
||||||
|
private String subscribeStatusString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹框场景,0代表在小程序页面内
|
||||||
|
*/
|
||||||
|
@Element(name = "PopupScene", required = false)
|
||||||
|
private String popupScene;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.ElementList;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 当用户触发订阅消息弹框后信息实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:09:23
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "SubscribeMsgPopupEvent", strict = false)
|
||||||
|
@Data
|
||||||
|
public class SubscribeMsgPopupEventVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6682105837610124794L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@ElementList(inline = true, required = false)
|
||||||
|
private List<SubscribeMsgPopupEventListVO> subscribeMsgPopupEventList;
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.Element;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 调用订阅消息接口发送消息给用户的最终结果信息集合实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:13:39
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "List", strict = false)
|
||||||
|
@Data
|
||||||
|
public class SubscribeMsgSentEventListVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 3771741965224817805L;
|
||||||
|
/**
|
||||||
|
* 模板id
|
||||||
|
*/
|
||||||
|
@Element(name = "TemplateId", required = false)
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id(调用接口时也会返回)
|
||||||
|
*/
|
||||||
|
@Element(name = "MsgID", required = false)
|
||||||
|
private String msgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送结果状态码(0表示成功)
|
||||||
|
*/
|
||||||
|
@Element(name = "ErrorCode", required = false)
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送结果状态码对应的含义
|
||||||
|
*/
|
||||||
|
@Element(name = "ErrorStatus", required = false)
|
||||||
|
private String errorStatus;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.ElementList;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 调用订阅消息接口发送消息给用户的最终结果实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:13:23
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "SubscribeMsgSentEvent", strict = false)
|
||||||
|
@Data
|
||||||
|
public class SubscribeMsgSentEventVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = -6682105837610124794L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@ElementList(inline = true, required = false)
|
||||||
|
private List<SubscribeMsgSentEventListVO> subscribeMsgSentEventList;
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.Element;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序消息推送回调实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 16:06:17
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "xml", strict = false)
|
||||||
|
@Data
|
||||||
|
public class WeChatMessagePushVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 6233209958847696141L;
|
||||||
|
/**
|
||||||
|
* 小程序账号
|
||||||
|
*/
|
||||||
|
@Element(name = "ToUserName", required = false)
|
||||||
|
private String toUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户openid
|
||||||
|
*/
|
||||||
|
@Element(name = "FromUserName", required = false)
|
||||||
|
private String fromUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
@Element(name = "CreateTime", required = false)
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型
|
||||||
|
*/
|
||||||
|
@Element(name = "MsgType", required = false)
|
||||||
|
private String msgType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型
|
||||||
|
*/
|
||||||
|
@Element(name = "Event", required = false)
|
||||||
|
private String event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当用户触发订阅消息弹框后触发时间集合
|
||||||
|
*/
|
||||||
|
@Element(name = "SubscribeMsgPopupEvent", required = false)
|
||||||
|
private SubscribeMsgPopupEventVO subscribeMsgPopupEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当用户在手机端服务通知里消息卡片右上角“...”管理消息时
|
||||||
|
*/
|
||||||
|
@Element(name = "SubscribeMsgChangeEvent", required = false)
|
||||||
|
private SubscribeMsgChangeEventVO subscribeMsgChangeEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当用户在手机端服务通知里消息卡片右上角“...”管理消息时
|
||||||
|
*/
|
||||||
|
@Element(name = "SubscribeMsgSentEvent", required = false)
|
||||||
|
private SubscribeMsgSentEventVO subscribeMsgSentEvent;
|
||||||
|
}
|
||||||
@ -2,5 +2,5 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.xinelu.mobile.mapper.MobileTestMapper">
|
<mapper namespace="com.xinelu.mobile.mapper.mobiletest.MobileTestMapper">
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user