Merge branch 'dev' into 3.11_院后第二增量
# Conflicts: # postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java
This commit is contained in:
commit
68c3995ab9
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>
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,8 @@ token:
|
|||||||
secret: DIweGcEWJTbvo48dnvOMR8GsDW
|
secret: DIweGcEWJTbvo48dnvOMR8GsDW
|
||||||
# 令牌有效期(默认30分钟)
|
# 令牌有效期(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 30
|
||||||
|
# 请求拦截白名单
|
||||||
|
ant-matchers: /postDischarge/**,/testMobile/**
|
||||||
|
|
||||||
## MyBatis-Plus配置
|
## MyBatis-Plus配置
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
@ -184,3 +186,39 @@ xss:
|
|||||||
excludes: /system/notice,/system/specialDiseaseNode/add,/system/specialDiseaseNode/edit
|
excludes: /system/notice,/system/specialDiseaseNode/add,/system/specialDiseaseNode/edit
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
# 院后微信小程序参数配置信息
|
||||||
|
wechat-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
|
||||||
|
|
||||||
|
# 院后微信公众号参数配置
|
||||||
|
wechat-official-account-config:
|
||||||
|
# 微信公众号id
|
||||||
|
official-account-app-id: wx9d87c7c73ef1ebde
|
||||||
|
# 微信公众号secret
|
||||||
|
official-account-app-secret: 20ab2c266b1da75d71e9932e7d28326e
|
||||||
|
# 微信公众号事件回调令牌
|
||||||
|
official-account-token: xinyilu
|
||||||
|
# 微信公众号事件回调消息加密密钥
|
||||||
|
official-account-encoding-aes-key: Awcn7nvDU4bcfBwAZmiRbB3lFgXAm2RIg45utdb5Zt3
|
||||||
|
# 测试模板id
|
||||||
|
test-template-id: WUCYtSbH-QFRV_fMcfmn86QLsz1zo881QW7fQNTWOjc
|
||||||
@ -111,6 +111,12 @@
|
|||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- httpclient 依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
<version>4.5.13</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@ -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 = "wechat-applet-chat-config")
|
||||||
|
public class WeChatAppletChatConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序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,36 @@
|
|||||||
|
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-21 11:12:04
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Component
|
||||||
|
@ConfigurationProperties(prefix = "wechat-official-account-config")
|
||||||
|
public class WeChatOfficialAccountConfig {
|
||||||
|
/**
|
||||||
|
* 微信公众号id
|
||||||
|
*/
|
||||||
|
private String officialAccountAppId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号secret
|
||||||
|
*/
|
||||||
|
private String officialAccountAppSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号事件回调令牌
|
||||||
|
*/
|
||||||
|
private String officialAccountToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号事件回调消息加密密钥
|
||||||
|
*/
|
||||||
|
private String officialAccountEncodingAesKey;
|
||||||
|
}
|
||||||
@ -228,4 +228,59 @@ public class Constants {
|
|||||||
* 路径编码
|
* 路径编码
|
||||||
*/
|
*/
|
||||||
public static final String ROUTE_CODE = "RC";
|
public static final String ROUTE_CODE = "RC";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信小程序accessToken的redis的键前缀
|
||||||
|
*/
|
||||||
|
public static final String WE_CHAT_APPLET_ACCESS_TOKEN = "WE_CHAT_APPLET_ACCESS_TOKEN_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号accessToken的redis的键前缀
|
||||||
|
*/
|
||||||
|
public static final String WE_CHAT_OFFICIAL_ACCOUNT_ACCESS_TOKEN = "WE_CHAT_OFFICIAL_ACCOUNT_ACCESS_TOKEN_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序和微信公众号accessToken的url地址
|
||||||
|
*/
|
||||||
|
public static final String WE_CHAT_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板消息推送发送接口地址
|
||||||
|
*/
|
||||||
|
public static final String OFFICIAL_ACCOUNT_TEMPLATE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口
|
||||||
|
*/
|
||||||
|
public static final int INVALID_CREDENTIAL_ACCESS_TOKEN_ISINVALID_OR_NOT_LATEST = 40001;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不合法的 OpenID ,请开发者确认 OpenID (该用户)是否已关注公众号,或是否是其他公众号的 OpenID
|
||||||
|
*/
|
||||||
|
public static final int INVALID_OPENID = 40003;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不合法的 access_token ,请开发者认真比对 access_token 的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口
|
||||||
|
*/
|
||||||
|
public static final int INVALID_ACCESS_TOKEN = 40014;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不合法的 template_id
|
||||||
|
*/
|
||||||
|
public static final int INVALID_TEMPLATE_ID = 40037;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户拒接订阅
|
||||||
|
*/
|
||||||
|
public static final int DENY_SUBSCRIPTION = 43101;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数无效
|
||||||
|
*/
|
||||||
|
public static final int ARGUMENT_INVALID = 47003;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功
|
||||||
|
*/
|
||||||
|
public static final int SUCCESS_ERROR_CODE = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.xinelu.common.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信小程序和微信公众号accessToken信息实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 14:00:10
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AccessToken implements Serializable {
|
||||||
|
private static final long serialVersionUID = -7751995012730354177L;
|
||||||
|
/**
|
||||||
|
* accessToken值
|
||||||
|
*/
|
||||||
|
@JSONField(name = "access_token")
|
||||||
|
private String accessToken;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* access_token有效时间,有效时间为7200秒
|
||||||
|
*/
|
||||||
|
@JSONField(name = "expires_in")
|
||||||
|
private String expiresIn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误状态码
|
||||||
|
* 40001:AppSecret 错误或者 AppSecret 不属于这个小程序,请开发者确认 AppSecret 的正确性
|
||||||
|
* 40002:请确保 grant_type 字段值为 client_credential
|
||||||
|
* 40013:不合法的 AppID,请开发者检查 AppID 的正确性,避免异常字符,注意大小写
|
||||||
|
*/
|
||||||
|
private Integer errcode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误状态值
|
||||||
|
* 40001:AppSecret 错误或者 AppSecret 不属于这个小程序,请开发者确认 AppSecret 的正确性
|
||||||
|
* 40002:请确保 grant_type 字段值为 client_credential
|
||||||
|
* 40013:不合法的 AppID,请开发者检查 AppID 的正确性,避免异常字符,注意大小写
|
||||||
|
*/
|
||||||
|
private String errmsg;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.xinelu.common.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 消息推送信息实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-26 17:09:50
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MessageValueEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = -1257378392221120423L;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public MessageValueEntity(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.xinelu.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 小程序消息推送结果状态枚举
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 10:57:43
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum ErrorStatusEnum {
|
||||||
|
/**
|
||||||
|
* 成功
|
||||||
|
*/
|
||||||
|
success("success"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败
|
||||||
|
*/
|
||||||
|
fail("fail");
|
||||||
|
final private String value;
|
||||||
|
|
||||||
|
ErrorStatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.xinelu.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 消息推送枚举
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 10:12:39
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum MessageTypeEnum {
|
||||||
|
/**
|
||||||
|
* 电话外呼
|
||||||
|
*/
|
||||||
|
PHONE_OUTBOUND("PHONE_OUTBOUND"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问卷量表
|
||||||
|
*/
|
||||||
|
QUESTIONNAIRE_SCALE("QUESTIONNAIRE_SCALE"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宣教文章
|
||||||
|
*/
|
||||||
|
PROPAGANDA_ARTICLE("QUESTIONNAIRE_SCALE"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文字提醒
|
||||||
|
*/
|
||||||
|
TEXT_REMIND("TEXT_REMIND"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人工随访
|
||||||
|
*/
|
||||||
|
ARTIFICIAL_FOLLOW_UP("ARTIFICIAL_FOLLOW_UP"),
|
||||||
|
;
|
||||||
|
final private String value;
|
||||||
|
|
||||||
|
MessageTypeEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.xinelu.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信公众号事件枚举
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-25 14:38:27
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum OfficialAccountEventEnum {
|
||||||
|
/**
|
||||||
|
* 模板消息推送事件
|
||||||
|
*/
|
||||||
|
TEMPLATESENDJOBFINISH("TEMPLATESENDJOBFINISH"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关系公众号事件
|
||||||
|
*/
|
||||||
|
SUBSCRIBE("subscribe"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取关公众号事件
|
||||||
|
*/
|
||||||
|
UNSUBSCRIBE("unsubscribe"),
|
||||||
|
;
|
||||||
|
|
||||||
|
final private String info;
|
||||||
|
|
||||||
|
OfficialAccountEventEnum(String info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.xinelu.common.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 订阅状态枚举
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-19 10:20:05
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum SubscribeStatusEnum {
|
||||||
|
/**
|
||||||
|
* 接受
|
||||||
|
*/
|
||||||
|
accept("accept"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝
|
||||||
|
*/
|
||||||
|
rejet("rejet");
|
||||||
|
final private String value;
|
||||||
|
|
||||||
|
SubscribeStatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,55 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信AES解密异常信息类
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:17:50
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class AesException extends Exception {
|
||||||
|
|
||||||
|
public final static int OK = 0;
|
||||||
|
public final static int VALIDATE_SIGNATURE_ERROR = -40001;
|
||||||
|
public final static int PARSE_XML_ERROR = -40002;
|
||||||
|
public final static int COMPUTE_SIGNATURE_ERROR = -40003;
|
||||||
|
public final static int ILLEGAL_AES_KEY = -40004;
|
||||||
|
public final static int VALIDATE_APP_ID_ERROR = -40005;
|
||||||
|
public final static int ENCRYPT_AES_ERROR = -40006;
|
||||||
|
public final static int DECRYPT_AES_ERROR = -40007;
|
||||||
|
public final static int ILLEGAL_BUFFER = -40008;
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
private static String getMessage(int code) {
|
||||||
|
switch (code) {
|
||||||
|
case VALIDATE_SIGNATURE_ERROR:
|
||||||
|
return "签名验证错误";
|
||||||
|
case PARSE_XML_ERROR:
|
||||||
|
return "xml解析失败";
|
||||||
|
case COMPUTE_SIGNATURE_ERROR:
|
||||||
|
return "sha加密生成签名失败";
|
||||||
|
case ILLEGAL_AES_KEY:
|
||||||
|
return "SymmetricKey非法";
|
||||||
|
case VALIDATE_APP_ID_ERROR:
|
||||||
|
return "appid校验失败";
|
||||||
|
case ENCRYPT_AES_ERROR:
|
||||||
|
return "aes加密失败";
|
||||||
|
case DECRYPT_AES_ERROR:
|
||||||
|
return "aes解密失败";
|
||||||
|
case ILLEGAL_BUFFER:
|
||||||
|
return "解密后得到的buffer非法";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
AesException(int code) {
|
||||||
|
super(getMessage(code));
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 字节数组
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:17:56
|
||||||
|
*/
|
||||||
|
class ByteGroup {
|
||||||
|
List<Byte> byteContainer = new ArrayList<>();
|
||||||
|
|
||||||
|
public byte[] toBytes() {
|
||||||
|
byte[] bytes = new byte[byteContainer.size()];
|
||||||
|
for (int i = 0; i < byteContainer.size(); i++) {
|
||||||
|
bytes[i] = byteContainer.get(i);
|
||||||
|
}
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBytes(byte[] bytes) {
|
||||||
|
for (byte b : bytes) {
|
||||||
|
byteContainer.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return byteContainer.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 提供基于PKCS7算法的加解密接口
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:18:21
|
||||||
|
*/
|
||||||
|
class PKCS7Encoder {
|
||||||
|
static Charset CHARSET = StandardCharsets.UTF_8;
|
||||||
|
static int BLOCK_SIZE = 32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得对明文进行补位填充的字节.
|
||||||
|
*
|
||||||
|
* @param count 需要进行填充补位操作的明文字节个数
|
||||||
|
* @return 补齐用的字节数组
|
||||||
|
*/
|
||||||
|
static byte[] encode(int count) {
|
||||||
|
// 计算需要填充的位数
|
||||||
|
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
|
||||||
|
if (amountToPad == 0) {
|
||||||
|
amountToPad = BLOCK_SIZE;
|
||||||
|
}
|
||||||
|
// 获得补位所用的字符
|
||||||
|
char padChr = chr(amountToPad);
|
||||||
|
StringBuilder tmp = new StringBuilder();
|
||||||
|
for (int index = 0; index < amountToPad; index++) {
|
||||||
|
tmp.append(padChr);
|
||||||
|
}
|
||||||
|
return tmp.toString().getBytes(CHARSET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除解密后明文的补位字符
|
||||||
|
*
|
||||||
|
* @param decrypted 解密后的明文
|
||||||
|
* @return 删除补位字符后的明文
|
||||||
|
*/
|
||||||
|
static byte[] decode(byte[] decrypted) {
|
||||||
|
int pad = decrypted[decrypted.length - 1];
|
||||||
|
if (pad < 1 || pad > 32) {
|
||||||
|
pad = 0;
|
||||||
|
}
|
||||||
|
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将数字转化成ASCII码对应的字符,用于对明文进行补码
|
||||||
|
*
|
||||||
|
* @param a 需要转化的数字
|
||||||
|
* @return 转化得到的字符
|
||||||
|
*/
|
||||||
|
static char chr(int a) {
|
||||||
|
byte target = (byte) (a & 0xFF);
|
||||||
|
return (char) target;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SHA1 class
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @Description 计算公众平台的消息签名接口
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:19:50
|
||||||
|
*/
|
||||||
|
class SHA1 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用SHA1算法生成安全签名
|
||||||
|
*
|
||||||
|
* @param token 票据
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @param encrypt 密文
|
||||||
|
* @return 安全签名
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
public static String getShaOne(String token, String timestamp, String nonce, String encrypt) throws AesException {
|
||||||
|
return signatureByShaOne(token, timestamp, nonce, encrypt, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用SHA1算法生成安全签名,小程序回调设置验证URL时计算签名使用
|
||||||
|
*
|
||||||
|
* @param token 票据
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @return 安全签名
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
public static String getShaTwo(String token, String timestamp, String nonce) throws AesException {
|
||||||
|
return signatureByShaOne(token, timestamp, nonce, "", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用SHA-1计算签名公共方法
|
||||||
|
*
|
||||||
|
* @param token 令牌
|
||||||
|
* @param timestamp 时间粗
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @param encrypt 密文
|
||||||
|
* @param encryptFlag 密文传入标识
|
||||||
|
* @return String 明文
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
private static String signatureByShaOne(String token, String timestamp, String nonce, String encrypt, boolean encryptFlag) throws AesException {
|
||||||
|
try {
|
||||||
|
String[] array;
|
||||||
|
int size;
|
||||||
|
if (BooleanUtils.isTrue(encryptFlag)) {
|
||||||
|
array = new String[]{token, timestamp, nonce, encrypt};
|
||||||
|
size = 4;
|
||||||
|
} else {
|
||||||
|
array = new String[]{token, timestamp, nonce};
|
||||||
|
size = 3;
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
// 字符串排序
|
||||||
|
Arrays.sort(array);
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
sb.append(array[i]);
|
||||||
|
}
|
||||||
|
String str = sb.toString();
|
||||||
|
// SHA1签名生成
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||||
|
md.update(str.getBytes());
|
||||||
|
byte[] digest = md.digest();
|
||||||
|
StringBuilder hexStr = new StringBuilder();
|
||||||
|
String shaHex;
|
||||||
|
for (byte b : digest) {
|
||||||
|
shaHex = Integer.toHexString(b & 0xFF);
|
||||||
|
if (shaHex.length() < 2) {
|
||||||
|
hexStr.append(0);
|
||||||
|
}
|
||||||
|
hexStr.append(shaHex);
|
||||||
|
}
|
||||||
|
return hexStr.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AesException(AesException.COMPUTE_SIGNATURE_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:18:26
|
||||||
|
*/
|
||||||
|
public class WXBizMsgCrypt {
|
||||||
|
static Charset CHARSET = StandardCharsets.UTF_8;
|
||||||
|
Base64 base64 = new Base64();
|
||||||
|
byte[] aesKey;
|
||||||
|
String token;
|
||||||
|
String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
*
|
||||||
|
* @param token 公众平台上,开发者设置的token
|
||||||
|
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
|
||||||
|
* @param appId 公众平台appid
|
||||||
|
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||||
|
*/
|
||||||
|
public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException {
|
||||||
|
int length = 43;
|
||||||
|
if (encodingAesKey.length() != length) {
|
||||||
|
throw new AesException(AesException.ILLEGAL_AES_KEY);
|
||||||
|
}
|
||||||
|
this.token = token;
|
||||||
|
this.appId = appId;
|
||||||
|
aesKey = Base64.decodeBase64(encodingAesKey + "=");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成4个字节的网络字节序
|
||||||
|
*
|
||||||
|
* @param sourceNumber 数值
|
||||||
|
* @return 字节数组
|
||||||
|
*/
|
||||||
|
byte[] getNetworkBytesOrder(int sourceNumber) {
|
||||||
|
byte[] orderBytes = new byte[4];
|
||||||
|
orderBytes[3] = (byte) (sourceNumber & 0xFF);
|
||||||
|
orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
|
||||||
|
orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
|
||||||
|
orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
|
||||||
|
return orderBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还原4个字节的网络字节序
|
||||||
|
*
|
||||||
|
* @param orderBytes 字节数组
|
||||||
|
* @return 数值
|
||||||
|
*/
|
||||||
|
int recoverNetworkBytesOrder(byte[] orderBytes) {
|
||||||
|
int sourceNumber = 0;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
sourceNumber <<= 8;
|
||||||
|
sourceNumber |= orderBytes[i] & 0xff;
|
||||||
|
}
|
||||||
|
return sourceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机生成16位字符串
|
||||||
|
*
|
||||||
|
* @return 随机字符串
|
||||||
|
*/
|
||||||
|
String getRandomStr() {
|
||||||
|
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
Random random = new Random();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
int number = random.nextInt(base.length());
|
||||||
|
sb.append(base.charAt(number));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对明文进行加密.
|
||||||
|
*
|
||||||
|
* @param text 需要加密的明文
|
||||||
|
* @return 加密后base64编码的字符串
|
||||||
|
* @throws AesException aes加密失败
|
||||||
|
*/
|
||||||
|
String encrypt(String randomStr, String text) throws AesException {
|
||||||
|
ByteGroup byteCollector = new ByteGroup();
|
||||||
|
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
|
||||||
|
byte[] textBytes = text.getBytes(CHARSET);
|
||||||
|
byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
|
||||||
|
byte[] appidBytes = appId.getBytes(CHARSET);
|
||||||
|
// randomStr + networkBytesOrder + text + appid
|
||||||
|
byteCollector.addBytes(randomStrBytes);
|
||||||
|
byteCollector.addBytes(networkBytesOrder);
|
||||||
|
byteCollector.addBytes(textBytes);
|
||||||
|
byteCollector.addBytes(appidBytes);
|
||||||
|
// ... + pad: 使用自定义的填充方式对明文进行补位填充
|
||||||
|
byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
|
||||||
|
byteCollector.addBytes(padBytes);
|
||||||
|
// 获得最终的字节流, 未加密
|
||||||
|
byte[] unencrypted = byteCollector.toBytes();
|
||||||
|
try {
|
||||||
|
// 设置加密模式为AES的CBC模式
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||||
|
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
|
||||||
|
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
|
||||||
|
// 加密
|
||||||
|
byte[] encrypted = cipher.doFinal(unencrypted);
|
||||||
|
// 使用BASE64对加密后的字符串进行编码
|
||||||
|
return base64.encodeToString(encrypted);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AesException(AesException.ENCRYPT_AES_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对密文进行解密.
|
||||||
|
*
|
||||||
|
* @param text 需要解密的密文
|
||||||
|
* @return 解密得到的明文
|
||||||
|
* @throws AesException aes解密失败
|
||||||
|
*/
|
||||||
|
String decrypt(String text) throws AesException {
|
||||||
|
byte[] original;
|
||||||
|
try {
|
||||||
|
// 设置解密模式为AES的CBC模式
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||||
|
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
|
||||||
|
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, keySpec, iv);
|
||||||
|
// 使用BASE64对密文进行解码
|
||||||
|
byte[] encrypted = Base64.decodeBase64(text);
|
||||||
|
// 解密
|
||||||
|
original = cipher.doFinal(encrypted);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AesException(AesException.DECRYPT_AES_ERROR);
|
||||||
|
}
|
||||||
|
String xmlContent, fromAppid;
|
||||||
|
try {
|
||||||
|
// 去除补位字符
|
||||||
|
byte[] bytes = PKCS7Encoder.decode(original);
|
||||||
|
// 分离16位随机字符串,网络字节序和AppId
|
||||||
|
byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
|
||||||
|
int xmlLength = recoverNetworkBytesOrder(networkOrder);
|
||||||
|
xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
|
||||||
|
fromAppid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
|
||||||
|
CHARSET);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AesException(AesException.ILLEGAL_BUFFER);
|
||||||
|
}
|
||||||
|
// appid不相同的情况
|
||||||
|
if (!fromAppid.equals(appId)) {
|
||||||
|
throw new AesException(AesException.VALIDATE_APP_ID_ERROR);
|
||||||
|
}
|
||||||
|
return xmlContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMsg 公众平台待回复用户的消息,xml格式的字符串
|
||||||
|
* @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp
|
||||||
|
* @param nonce 随机串,可以自己生成,也可以用URL参数的nonce
|
||||||
|
* @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
|
||||||
|
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||||
|
* @Description 将公众平台回复用户的消息加密打包.
|
||||||
|
*/
|
||||||
|
public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
|
||||||
|
// 加密
|
||||||
|
String encrypt = encrypt(getRandomStr(), replyMsg);
|
||||||
|
// 生成安全签名
|
||||||
|
if ("".equals(timeStamp)) {
|
||||||
|
timeStamp = Long.toString(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
String signature = SHA1.getShaOne(token, timeStamp, nonce, encrypt);
|
||||||
|
// 生成发送的xml
|
||||||
|
return XMLParse.generate(encrypt, signature, timeStamp, nonce);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||||
|
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||||
|
* @param nonce 随机串,对应URL参数的nonce
|
||||||
|
* @param postData 密文,对应POST请求的数据
|
||||||
|
* @return 解密后的原文
|
||||||
|
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||||
|
* @Description 检验消息的真实性,并且获取解密后的明文.
|
||||||
|
*/
|
||||||
|
public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
|
||||||
|
throws AesException {
|
||||||
|
// 密钥,公众账号的app secret
|
||||||
|
// 提取密文
|
||||||
|
Object[] encrypt = XMLParse.extract(postData);
|
||||||
|
// 验证安全签名
|
||||||
|
String signature = SHA1.getShaTwo(token, timeStamp, nonce);
|
||||||
|
// 和URL中的签名比较是否相等
|
||||||
|
if (!signature.equals(msgSignature)) {
|
||||||
|
throw new AesException(AesException.VALIDATE_SIGNATURE_ERROR);
|
||||||
|
}
|
||||||
|
// 解密
|
||||||
|
return decrypt(encrypt[1].toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证URL
|
||||||
|
*
|
||||||
|
* @param msgSignature 签名串,对应URL参数的msg_signature
|
||||||
|
* @param timeStamp 时间戳,对应URL参数的timestamp
|
||||||
|
* @param nonce 随机串,对应URL参数的nonce
|
||||||
|
* @param echoStr 随机串,对应URL参数的echostr
|
||||||
|
* @return 原始的随机串echostr
|
||||||
|
* @throws AesException 执行失败,请查看该异常的错误码和具体的错误信息
|
||||||
|
*/
|
||||||
|
public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) throws AesException {
|
||||||
|
String signature = SHA1.getShaTwo(token, timeStamp, nonce);
|
||||||
|
if (!signature.equals(msgSignature)) {
|
||||||
|
throw new AesException(AesException.VALIDATE_SIGNATURE_ERROR);
|
||||||
|
}
|
||||||
|
return echoStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.xinelu.common.utils.aes;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import java.io.StringReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 提供提取消息格式中的密文及生成回复消息格式的接口.
|
||||||
|
* @Author WeChat
|
||||||
|
* @Date 2024-03-21 10:18:57
|
||||||
|
*/
|
||||||
|
class XMLParse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取出xml数据包中的加密消息
|
||||||
|
*
|
||||||
|
* @param xmltext 待提取的xml字符串
|
||||||
|
* @return 提取出的加密消息字符串
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
public static Object[] extract(String xmltext) throws AesException {
|
||||||
|
Object[] result = new Object[3];
|
||||||
|
try {
|
||||||
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
|
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
|
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||||
|
dbf.setXIncludeAware(false);
|
||||||
|
dbf.setExpandEntityReferences(false);
|
||||||
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||||
|
StringReader sr = new StringReader(xmltext);
|
||||||
|
InputSource is = new InputSource(sr);
|
||||||
|
Document document = db.parse(is);
|
||||||
|
Element root = document.getDocumentElement();
|
||||||
|
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
|
||||||
|
NodeList nodelist2 = root.getElementsByTagName("ToUserName");
|
||||||
|
result[0] = 0;
|
||||||
|
result[1] = nodelist1.item(0).getTextContent();
|
||||||
|
result[2] = nodelist2.item(0).getTextContent();
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new AesException(AesException.PARSE_XML_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成xml消息
|
||||||
|
*
|
||||||
|
* @param encrypt 加密后的消息密文
|
||||||
|
* @param signature 安全签名
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @return 生成的xml字符串
|
||||||
|
*/
|
||||||
|
public static String generate(String encrypt, String signature, String timestamp, String nonce) {
|
||||||
|
String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
|
||||||
|
+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
|
||||||
|
+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
|
||||||
|
return String.format(format, encrypt, signature, timestamp, nonce);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,16 @@ package com.xinelu.common.utils.http;
|
|||||||
|
|
||||||
import com.xinelu.common.constant.Constants;
|
import com.xinelu.common.constant.Constants;
|
||||||
import com.xinelu.common.utils.StringUtils;
|
import com.xinelu.common.utils.StringUtils;
|
||||||
|
import org.apache.http.Consts;
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.client.config.RequestConfig;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.utils.HttpClientUtils;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -207,4 +217,40 @@ public class HttpUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送json格式的POST类型的http请求
|
||||||
|
*
|
||||||
|
* @param url 请求地址
|
||||||
|
* @param param json格式的请求参数
|
||||||
|
* @return String 返回值信息
|
||||||
|
*/
|
||||||
|
public static String sendPostJson(String url, String param) {
|
||||||
|
String result = null;
|
||||||
|
CloseableHttpClient httpClient = null;
|
||||||
|
CloseableHttpResponse response = null;
|
||||||
|
try {
|
||||||
|
httpClient = HttpClients.createDefault();
|
||||||
|
// 字符串编码
|
||||||
|
StringEntity entity = new StringEntity(param, Consts.UTF_8);
|
||||||
|
// 设置content-type
|
||||||
|
entity.setContentType("application/json");
|
||||||
|
HttpPost httpPost = new HttpPost(url);
|
||||||
|
httpPost.setConfig(RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000).build());
|
||||||
|
// 防止被当成攻击添加的
|
||||||
|
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/54.0.2840.87 Safari/537.36");
|
||||||
|
// 接收参数设置
|
||||||
|
httpPost.setHeader("Accept", "application/json");
|
||||||
|
httpPost.setEntity(entity);
|
||||||
|
response = httpClient.execute(httpPost);
|
||||||
|
HttpEntity httpEntity = response.getEntity();
|
||||||
|
result = EntityUtils.toString(httpEntity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("post请求发送失败,请求路径:[{}],请求参数:[{}],异常信息:[{}]", url, param, e);
|
||||||
|
} finally {
|
||||||
|
HttpClientUtils.closeQuietly(response);
|
||||||
|
HttpClientUtils.closeQuietly(httpClient);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -4,6 +4,7 @@ import com.xinelu.framework.config.properties.PermitAllUrlProperties;
|
|||||||
import com.xinelu.framework.security.filter.JwtAuthenticationTokenFilter;
|
import com.xinelu.framework.security.filter.JwtAuthenticationTokenFilter;
|
||||||
import com.xinelu.framework.security.handle.AuthenticationEntryPointImpl;
|
import com.xinelu.framework.security.handle.AuthenticationEntryPointImpl;
|
||||||
import com.xinelu.framework.security.handle.LogoutSuccessHandlerImpl;
|
import com.xinelu.framework.security.handle.LogoutSuccessHandlerImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
@ -64,6 +65,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
@Resource
|
@Resource
|
||||||
private PermitAllUrlProperties permitAllUrl;
|
private PermitAllUrlProperties permitAllUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求拦截白名单
|
||||||
|
*/
|
||||||
|
@Value("${token.ant-matchers}")
|
||||||
|
private String antMatchers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解决 无法直接注入 AuthenticationManager
|
* 解决 无法直接注入 AuthenticationManager
|
||||||
*
|
*
|
||||||
@ -111,6 +118,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
|
.antMatchers(antMatchers.split(",")).permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
|||||||
@ -167,7 +167,7 @@ public class GenUtils {
|
|||||||
*
|
*
|
||||||
* @param replacementm 替换值
|
* @param replacementm 替换值
|
||||||
* @param searchList 替换列表
|
* @param searchList 替换列表
|
||||||
* @return
|
* @return 文本结果
|
||||||
*/
|
*/
|
||||||
public static String replaceFirst(String replacementm, String[] searchList) {
|
public static String replaceFirst(String replacementm, String[] searchList) {
|
||||||
String text = replacementm;
|
String text = replacementm;
|
||||||
|
|||||||
@ -125,7 +125,7 @@ public class VelocityUtils {
|
|||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getTemplateList(String tplCategory) {
|
public static List<String> getTemplateList(String tplCategory) {
|
||||||
List<String> templates = new ArrayList<String>();
|
List<String> templates = new ArrayList<>();
|
||||||
templates.add("vm/java/domain.java.vm");
|
templates.add("vm/java/domain.java.vm");
|
||||||
templates.add("vm/java/mapper.java.vm");
|
templates.add("vm/java/mapper.java.vm");
|
||||||
templates.add("vm/java/service.java.vm");
|
templates.add("vm/java/service.java.vm");
|
||||||
|
|||||||
@ -13,15 +13,15 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xinyilu.common.annotation.Log;
|
import com.xinelu.common.annotation.Log;
|
||||||
import com.xinyilu.common.core.controller.BaseController;
|
import com.xinelu.common.core.controller.BaseController;
|
||||||
import com.xinyilu.common.core.domain.AjaxResult;
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinyilu.common.enums.BusinessType;
|
import com.xinelu.common.enums.BusinessType;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
import com.xinyilu.common.utils.poi.ExcelUtil;
|
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||||
#if($table.crud || $table.sub)
|
#if($table.crud || $table.sub)
|
||||||
import com.xinyilu.common.core.page.TableDataInfo;
|
import com.xinelu.common.core.page.TableDataInfo;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|||||||
@ -13,11 +13,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.xinyilu.common.annotation.Excel;
|
import com.xinelu.common.annotation.Excel;
|
||||||
#if($table.crud)
|
#if($table.crud)
|
||||||
import com.xinyilu.common.core.domain.BaseEntity;
|
import com.xinelu.common.core.domain.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.xinyilu.common.core.domain.TreeEntity;
|
import com.xinelu.common.core.domain.TreeEntity;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,7 +32,7 @@ import com.xinyilu.common.core.domain.TreeEntity;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ApiModel(value = "${functionName}对象", description = "${tableName}")
|
@ApiModel(value = "${functionName}对象", description = "${tableName}")
|
||||||
#if($table.crud)
|
#if($table.crud)
|
||||||
#set($Entity="BaseDomain")
|
#set($Entity="BaseEntity")
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#set($Entity="TreeEntity")
|
#set($Entity="TreeEntity")
|
||||||
#end
|
#end
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public interface ${ClassName}Mapper {
|
|||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
* @return ${functionName}
|
* @return ${functionName}
|
||||||
*/
|
*/
|
||||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public interface I${ClassName}Service {
|
|||||||
* @param ${pkColumn.javaField} ${functionName}主键
|
* @param ${pkColumn.javaField} ${functionName}主键
|
||||||
* @return ${functionName}
|
* @return ${functionName}
|
||||||
*/
|
*/
|
||||||
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询${functionName}列表
|
* 查询${functionName}列表
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||||
import com.xinyilu.common.utils.DateUtils;
|
import com.xinelu.common.utils.DateUtils;
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.xinyilu.common.utils.StringUtils;
|
import com.xinelu.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import ${packageName}.domain.${subClassName};
|
import ${packageName}.domain.${subClassName};
|
||||||
#end
|
#end
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package ${packageName}.domain;
|
|||||||
#foreach ($import in $subImportList)
|
#foreach ($import in $subImportList)
|
||||||
import ${import};
|
import ${import};
|
||||||
#end
|
#end
|
||||||
import com.xinyilu.common.annotation.Excel;
|
import com.xinelu.common.annotation.Excel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${subTable.functionName}对象 ${subTableName}
|
* ${subTable.functionName}对象 ${subTableName}
|
||||||
|
|||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.xinelu.manage.controller.subscribemessagerecord;
|
||||||
|
|
||||||
|
import com.xinelu.common.annotation.Log;
|
||||||
|
import com.xinelu.common.core.controller.BaseController;
|
||||||
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
|
import com.xinelu.common.core.page.TableDataInfo;
|
||||||
|
import com.xinelu.common.enums.BusinessType;
|
||||||
|
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||||
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
import com.xinelu.manage.service.subscribemessagerecord.ISubscribeMessageRecordService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息记录Controller
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/manage/sendRecord")
|
||||||
|
public class SubscribeMessageRecordController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ISubscribeMessageRecordService subscribeMessageRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
startPage();
|
||||||
|
List<SubscribeMessageRecord> list = subscribeMessageRecordService.selectSubscribeMessageRecordList(subscribeMessageRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出微信小程序订阅消息记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:export')")
|
||||||
|
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
List<SubscribeMessageRecord> list = subscribeMessageRecordService.selectSubscribeMessageRecordList(subscribeMessageRecord);
|
||||||
|
ExcelUtil<SubscribeMessageRecord> util = new ExcelUtil<>(SubscribeMessageRecord.class);
|
||||||
|
util.exportExcel(response, list, "微信小程序订阅消息记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序订阅消息记录详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(subscribeMessageRecordService.selectSubscribeMessageRecordById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:add')")
|
||||||
|
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
return toAjax(subscribeMessageRecordService.insertSubscribeMessageRecord(subscribeMessageRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:edit')")
|
||||||
|
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
return toAjax(subscribeMessageRecordService.updateSubscribeMessageRecord(subscribeMessageRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendRecord:remove')")
|
||||||
|
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(subscribeMessageRecordService.deleteSubscribeMessageRecordByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.xinelu.manage.controller.subscribemessagesendrecord;
|
||||||
|
|
||||||
|
import com.xinelu.common.annotation.Log;
|
||||||
|
import com.xinelu.common.core.controller.BaseController;
|
||||||
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
|
import com.xinelu.common.core.page.TableDataInfo;
|
||||||
|
import com.xinelu.common.enums.BusinessType;
|
||||||
|
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||||
|
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||||
|
import com.xinelu.manage.service.subscribemessagesendrecord.ISubscribeMessageSendRecordService;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息发送结果记录Controller
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/manage/sendResult")
|
||||||
|
public class SubscribeMessageSendRecordController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private ISubscribeMessageSendRecordService subscribeMessageSendRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
startPage();
|
||||||
|
List<SubscribeMessageSendRecord> list = subscribeMessageSendRecordService.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出微信小程序订阅消息发送结果记录列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:export')")
|
||||||
|
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
List<SubscribeMessageSendRecord> list = subscribeMessageSendRecordService.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
|
||||||
|
ExcelUtil<SubscribeMessageSendRecord> util = new ExcelUtil<>(SubscribeMessageSendRecord.class);
|
||||||
|
util.exportExcel(response, list, "微信小程序订阅消息发送结果记录数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序订阅消息发送结果记录详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return AjaxResult.success(subscribeMessageSendRecordService.selectSubscribeMessageSendRecordById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:add')")
|
||||||
|
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
return toAjax(subscribeMessageSendRecordService.insertSubscribeMessageSendRecord(subscribeMessageSendRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:edit')")
|
||||||
|
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
return toAjax(subscribeMessageSendRecordService.updateSubscribeMessageSendRecord(subscribeMessageSendRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('manage:sendResult:remove')")
|
||||||
|
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(subscribeMessageSendRecordService.deleteSubscribeMessageSendRecordByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,94 @@
|
|||||||
|
package com.xinelu.manage.domain.officialaccountsubscribeevent;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xinelu.common.annotation.Excel;
|
||||||
|
import com.xinelu.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号关注和取消事件信息对象 official_account_subscribe_event
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "微信公众号关注和取消事件信息对象", description = "official_account_subscribe_event")
|
||||||
|
public class OfficialAccountSubscribeEvent extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 4235213866159646854L;
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信公众号openid")
|
||||||
|
@Excel(name = "微信公众号openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信公众号id")
|
||||||
|
@Excel(name = "微信公众号id")
|
||||||
|
private String officialAccountAppId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息创建时间 ,yyyy-MM-dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息创建时间 ,yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "消息创建时间 ,yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime sendTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型是事件,固定取值为:event
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息类型是事件,固定取值为:event")
|
||||||
|
@Excel(name = "消息类型是事件,固定取值为:event")
|
||||||
|
private String msgType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型,订阅:subscribe,取消订阅:unsubscribe
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "事件类型,订阅:subscribe,取消订阅:unsubscribe")
|
||||||
|
@Excel(name = "事件类型,订阅:subscribe,取消订阅:unsubscribe")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅状态,关注:FOCUS,取消:CANCEL
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "订阅状态,关注:FOCUS,取消:CANCEL")
|
||||||
|
@Excel(name = "订阅状态,关注:FOCUS,取消:CANCEL")
|
||||||
|
private String subscribeStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("openid", getOpenid())
|
||||||
|
.append("officialAccountAppId", getOfficialAccountAppId())
|
||||||
|
.append("sendTime", getSendTime())
|
||||||
|
.append("msgType", getMsgType())
|
||||||
|
.append("eventType", getEventType())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
package com.xinelu.manage.domain.officialaccounttemplateevent;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xinelu.common.annotation.Excel;
|
||||||
|
import com.xinelu.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板信息事件推送对象 official_account_template_event
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "微信公众号模板信息事件推送对象", description = "official_account_template_event")
|
||||||
|
public class OfficialAccountTemplateEvent extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = -8437491233815143821L;
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者信息表id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "患者信息表id")
|
||||||
|
@Excel(name = "患者信息表id")
|
||||||
|
private Long patientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者姓名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "患者姓名")
|
||||||
|
@Excel(name = "患者姓名")
|
||||||
|
private String patientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信用户openid")
|
||||||
|
@Excel(name = "微信用户openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信公众号id")
|
||||||
|
@Excel(name = "微信公众号id")
|
||||||
|
private String officialAccountAppId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送时间,即:事件创建时间,yyyy-MM-dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "发送时间,即:事件创建时间,yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "发送时间,即:事件创建时间,yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private LocalDateTime sendTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型是事件,固定取值为:event
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息类型是事件,固定取值为:event")
|
||||||
|
@Excel(name = "消息类型是事件,固定取值为:event")
|
||||||
|
private String msgType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件为模板消息发送结束,固定取值为:TEMPLATESENDJOBFINISH
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "事件为模板消息发送结束,固定取值为:TEMPLATESENDJOBFINISH")
|
||||||
|
@Excel(name = "事件为模板消息发送结束,固定取值为:TEMPLATESENDJOBFINISH")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息id")
|
||||||
|
@Excel(name = "消息id")
|
||||||
|
private String msgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送状态,成功:success,用户拒绝接收:failed:user block,发送失败(非用户拒绝):failed:system failed
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "发送状态,成功:success,用户拒绝接收:failed:user block,发送失败")
|
||||||
|
@Excel(name = "发送状态,成功:success,用户拒绝接收:failed:user block,发送失败", readConverterExp = "非=用户拒绝")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("patientId", getPatientId())
|
||||||
|
.append("patientName", getPatientName())
|
||||||
|
.append("openid", getOpenid())
|
||||||
|
.append("officialAccountAppId", getOfficialAccountAppId())
|
||||||
|
.append("sendTime", getSendTime())
|
||||||
|
.append("msgType", getMsgType())
|
||||||
|
.append("eventType", getEventType())
|
||||||
|
.append("msgId", getMsgId())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -115,6 +115,13 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@Excel(name = "签约时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "签约时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private LocalDateTime signTime;
|
private LocalDateTime signTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开证医生(预住院患者)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "开证医生")
|
||||||
|
@Excel(name = "开证医生", readConverterExp = "预住院患者")
|
||||||
|
private String certificateIssuingDoctor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就诊方式,门诊:OUTPATIENT_SERVICE,住院:BE_IN_HOSPITAL
|
* 就诊方式,门诊:OUTPATIENT_SERVICE,住院:BE_IN_HOSPITAL
|
||||||
*/
|
*/
|
||||||
@ -142,6 +149,13 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "主要诊断")
|
@ApiModelProperty(value = "主要诊断")
|
||||||
private String mainDiagnosis;
|
private String mainDiagnosis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主治医生
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "主治医生")
|
||||||
|
@Excel(name = "主治医生")
|
||||||
|
private String attendingPhysician;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所属医院id
|
* 所属医院id
|
||||||
*/
|
*/
|
||||||
@ -194,6 +208,13 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@Excel(name = "所属病区名称")
|
@Excel(name = "所属病区名称")
|
||||||
private String wardName;
|
private String wardName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 住院号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "住院号")
|
||||||
|
@Excel(name = "住院号")
|
||||||
|
private String admissionNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 责任护士
|
* 责任护士
|
||||||
*/
|
*/
|
||||||
@ -212,6 +233,12 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "就诊流水号")
|
@ApiModelProperty(value = "就诊流水号")
|
||||||
private String visitSerialNumber;
|
private String visitSerialNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手术名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手术名称")
|
||||||
|
private String surgicalName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入院时间,时间格式:yyyy-MM-dd
|
* 入院时间,时间格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@ -224,6 +251,12 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "出院时间(出院患者)")
|
@ApiModelProperty(value = "出院时间(出院患者)")
|
||||||
private LocalDateTime dischargeTime;
|
private LocalDateTime dischargeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病历内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "病历内容")
|
||||||
|
private String medicalRecordContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预约治疗组(取值以及枚举未知?)
|
* 预约治疗组(取值以及枚举未知?)
|
||||||
*/
|
*/
|
||||||
@ -255,14 +288,29 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@Excel(name = "门诊/住院号 ", readConverterExp = "门诊/住院号 ")
|
@Excel(name = "门诊/住院号 ", readConverterExp = "门诊/住院号 ")
|
||||||
private String inHospitalNumber;
|
private String inHospitalNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门诊号(门诊患者)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "门诊号")
|
||||||
|
@Excel(name = "门诊号", readConverterExp = "门=诊患者")
|
||||||
|
private String outpatientNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就诊时间,格式:yyyy-MM-dd HH:mm:ss
|
* 就诊时间,格式:yyyy-MM-dd HH:mm:ss
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "就诊时间,格式:yyyy-MM-dd HH:mm:ss")
|
@ApiModelProperty(value = "就诊时间,格式:yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "就诊时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "就诊时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime visitDate;
|
private LocalDateTime visitDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 就诊时间(门诊患者),时间格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "就诊时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "就诊时间", readConverterExp = "门=诊患者")
|
||||||
|
private LocalDate visitTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出院方式(出院患者)
|
* 出院方式(出院患者)
|
||||||
*/
|
*/
|
||||||
@ -270,6 +318,24 @@ public class PatientInfo extends BaseEntity {
|
|||||||
@Excel(name = "出院方式", readConverterExp = "出=院患者")
|
@Excel(name = "出院方式", readConverterExp = "出=院患者")
|
||||||
private String dischargeMethod;
|
private String dischargeMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序openid,微信小程序唯一标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信小程序openid,微信小程序唯一标识")
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信unionid,微信小程序和微信公众号统一标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信unionid,微信小程序和微信公众号统一标识 ")
|
||||||
|
private String unionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号openid,微信众号唯一标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信公众号openid,微信众号唯一标识 ")
|
||||||
|
private String officialAccountOpenId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 患者来源,微信小程序:WE_CHAT_APPLET,微信公众号:WE_CHAT_OFFICIAL_ACCOUNT,管理端:MANAGE_END
|
* 患者来源,微信小程序:WE_CHAT_APPLET,微信公众号:WE_CHAT_OFFICIAL_ACCOUNT,管理端:MANAGE_END
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信小程序订阅消息记录对象 subscribe_message_record
|
* 微信小程序订阅消息记录对象 subscribe_message_record
|
||||||
@ -87,21 +87,21 @@ public class SubscribeMessageRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "用于订阅消息次数")
|
@ApiModelProperty(value = "用于订阅消息次数")
|
||||||
@Excel(name = "用于订阅消息次数")
|
@Excel(name = "用于订阅消息次数")
|
||||||
private Long subscribeCount;
|
private Integer subscribeCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订阅时间
|
* 订阅时间
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "订阅时间")
|
@ApiModelProperty(value = "订阅时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "订阅时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "订阅时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date subscribeTime;
|
private LocalDateTime subscribeTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订阅状态,accept:接受,reject:拒绝
|
* 订阅状态,accept:接受,reject:拒绝
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "订阅状态,accept:接受,reject:拒绝")
|
@ApiModelProperty(value = "订阅状态,ACCEPT:接受,REJECT:拒绝")
|
||||||
@Excel(name = "订阅状态,accept:接受,reject:拒绝")
|
@Excel(name = "订阅状态,ACCEPT:接受,REJECT:拒绝")
|
||||||
private String subscribeStatus;
|
private String subscribeStatus;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,136 @@
|
|||||||
|
package com.xinelu.manage.domain.subscribemessagesendrecord;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xinelu.common.annotation.Excel;
|
||||||
|
import com.xinelu.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息发送结果记录对象 subscribe_message_send_record
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel(value = "微信小程序订阅消息发送结果记录对象", description = "subscribe_message_send_record")
|
||||||
|
public class SubscribeMessageSendRecord extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "患者id")
|
||||||
|
@Excel(name = "患者id")
|
||||||
|
private Long patientId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签约患者管理任务节点表id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "签约患者管理任务节点表id")
|
||||||
|
@Excel(name = "签约患者管理任务节点表id")
|
||||||
|
private Long manageRouteNodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信unionid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信unionid")
|
||||||
|
@Excel(name = "微信unionid")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信openid
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信openid")
|
||||||
|
@Excel(name = "微信openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信小程序id")
|
||||||
|
@Excel(name = "微信小程序id")
|
||||||
|
private String appletId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅消息发送时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "订阅消息发送时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "订阅消息发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime subscribeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息模板id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息模板id")
|
||||||
|
@Excel(name = "消息模板id")
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息id")
|
||||||
|
@Excel(name = "消息id")
|
||||||
|
private String msgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅任务消息类型,电话外呼:PHONE_OUTBOUND,问卷量表:QUESTIONNAIRE_SCALE,宣教文章:PROPAGANDA_ARTICLE,文字提醒:TEXT_REMIND,人工随访:ARTIFICIAL_FOLLOW_UP
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "订阅任务消息类型,电话外呼:PHONE_OUTBOUND,问卷量表:QUESTIONNAIRE_SCALE,宣教文章:PROPAGANDA_ARTICLE,文字提醒:TEXT_REMIND,人工随访:ARTIFICIAL_FOLLOW_UP")
|
||||||
|
@Excel(name = "订阅任务消息类型,电话外呼:PHONE_OUTBOUND,问卷量表:QUESTIONNAIRE_SCALE,宣教文章:PROPAGANDA_ARTICLE,文字提醒:TEXT_REMIND,人工随访:ARTIFICIAL_FOLLOW_UP")
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送结果状态码(0表示成功)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "推送结果状态码")
|
||||||
|
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功")
|
||||||
|
private Integer errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送结果状态码,success:成功
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "推送结果状态码,success:成功,fail:失败")
|
||||||
|
@Excel(name = "推送结果状态码,success:成功, fail:失败")
|
||||||
|
private String errorStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("patientId", getPatientId())
|
||||||
|
.append("manageRouteNodeId", getManageRouteNodeId())
|
||||||
|
.append("unionid", getUnionid())
|
||||||
|
.append("openid", getOpenid())
|
||||||
|
.append("appletId", getAppletId())
|
||||||
|
.append("subscribeTime", getSubscribeTime())
|
||||||
|
.append("templateId", getTemplateId())
|
||||||
|
.append("msgId", getMsgId())
|
||||||
|
.append("messageType", getMessageType())
|
||||||
|
.append("errorCode", getErrorCode())
|
||||||
|
.append("errorStatus", getErrorStatus())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.xinelu.manage.mapper.officialaccountsubscribeevent;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号关注和取消事件信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-26
|
||||||
|
*/
|
||||||
|
public interface OfficialAccountSubscribeEventMapper {
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 微信公众号关注和取消事件信息
|
||||||
|
*/
|
||||||
|
OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息列表
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 微信公众号关注和取消事件信息集合
|
||||||
|
*/
|
||||||
|
List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountSubscribeEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountSubscribeEventByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid查询用户是否订阅公众号
|
||||||
|
*
|
||||||
|
* @param openId 公众号openID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int getSubscribeEventInfo(String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid修改订阅信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSubscribeEventInfo(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xinelu.manage.mapper.officialaccounttemplateevent;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板信息事件推送Mapper接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface OfficialAccountTemplateEventMapper {
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 微信公众号模板信息事件推送
|
||||||
|
*/
|
||||||
|
OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送列表
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 微信公众号模板信息事件推送集合
|
||||||
|
*/
|
||||||
|
List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountTemplateEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountTemplateEventByIds(Long[] ids);
|
||||||
|
}
|
||||||
@ -19,7 +19,7 @@ public interface PatientInfoMapper {
|
|||||||
* @param id 患者信息主键
|
* @param id 患者信息主键
|
||||||
* @return 患者信息
|
* @return 患者信息
|
||||||
*/
|
*/
|
||||||
public PatientInfo selectPatientInfoById(Long id);
|
PatientInfo selectPatientInfoById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询患者信息
|
* 查询患者信息
|
||||||
@ -27,7 +27,7 @@ public interface PatientInfoMapper {
|
|||||||
* @param id 主键id
|
* @param id 主键id
|
||||||
* @return 患者信息
|
* @return 患者信息
|
||||||
*/
|
*/
|
||||||
public PatientBaseInfoVo getPatientBaseInfo(Long id);
|
PatientBaseInfoVo getPatientBaseInfo(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询患者信息列表
|
* 查询患者信息列表
|
||||||
@ -59,7 +59,7 @@ public interface PatientInfoMapper {
|
|||||||
* @param id 患者信息主键
|
* @param id 患者信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePatientInfoById(Long id);
|
int deletePatientInfoById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除患者信息
|
* 批量删除患者信息
|
||||||
@ -67,5 +67,13 @@ public interface PatientInfoMapper {
|
|||||||
* @param ids 需要删除的数据主键集合
|
* @param ids 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePatientInfoByIds(Long[] ids);
|
int deletePatientInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid查询被护理人信息
|
||||||
|
*
|
||||||
|
* @param openId 微信openId
|
||||||
|
* @return 被护理人基本信息
|
||||||
|
*/
|
||||||
|
PatientInfo getPatientInfoByOpenId(String openId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.xinelu.manage.mapper.subscribemessagerecord;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
public interface SubscribeMessageRecordMapper {
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
SubscribeMessageRecord selectSubscribeMessageRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 微信小程序订阅消息记录集合
|
||||||
|
*/
|
||||||
|
List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.xinelu.manage.mapper.subscribemessagesendrecord;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息发送结果记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
public interface SubscribeMessageSendRecordMapper {
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 微信小程序订阅消息发送结果记录集合
|
||||||
|
*/
|
||||||
|
List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageSendRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增微信小程序订阅消息发送记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecordList 微信小程序订阅发送消息记录
|
||||||
|
* @return int
|
||||||
|
**/
|
||||||
|
int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList);
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xinelu.manage.service.officialaccountsubscribeevent;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号关注和取消事件信息Service接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-26
|
||||||
|
*/
|
||||||
|
public interface IOfficialAccountSubscribeEventService {
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 微信公众号关注和取消事件信息
|
||||||
|
*/
|
||||||
|
OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息列表
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 微信公众号关注和取消事件信息集合
|
||||||
|
*/
|
||||||
|
List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信公众号关注和取消事件信息主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountSubscribeEventByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号关注和取消事件信息信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountSubscribeEventById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.xinelu.manage.service.officialaccountsubscribeevent.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
|
||||||
|
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
|
||||||
|
import com.xinelu.manage.service.officialaccountsubscribeevent.IOfficialAccountSubscribeEventService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号关注和取消事件信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OfficialAccountSubscribeEventServiceImpl implements IOfficialAccountSubscribeEventService {
|
||||||
|
@Resource
|
||||||
|
private OfficialAccountSubscribeEventMapper officialAccountSubscribeEventMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 微信公众号关注和取消事件信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id) {
|
||||||
|
return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号关注和取消事件信息列表
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 微信公众号关注和取消事件信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
|
||||||
|
return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventList(officialAccountSubscribeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
|
||||||
|
officialAccountSubscribeEvent.setCreateTime(LocalDateTime.now());
|
||||||
|
return officialAccountSubscribeEventMapper.insertOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
|
||||||
|
officialAccountSubscribeEvent.setUpdateTime(LocalDateTime.now());
|
||||||
|
return officialAccountSubscribeEventMapper.updateOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号关注和取消事件信息
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信公众号关注和取消事件信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOfficialAccountSubscribeEventByIds(Long[] ids) {
|
||||||
|
return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号关注和取消事件信息信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号关注和取消事件信息主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOfficialAccountSubscribeEventById(Long id) {
|
||||||
|
return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xinelu.manage.service.officialaccounttemplateevent;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板信息事件推送Service接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface IOfficialAccountTemplateEventService {
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 微信公众号模板信息事件推送
|
||||||
|
*/
|
||||||
|
OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送列表
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 微信公众号模板信息事件推送集合
|
||||||
|
*/
|
||||||
|
List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信公众号模板信息事件推送主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountTemplateEventByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号模板信息事件推送信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteOfficialAccountTemplateEventById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.xinelu.manage.service.officialaccounttemplateevent.impl;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
|
||||||
|
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
|
||||||
|
import com.xinelu.manage.service.officialaccounttemplateevent.IOfficialAccountTemplateEventService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板信息事件推送Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OfficialAccountTemplateEventServiceImpl implements IOfficialAccountTemplateEventService {
|
||||||
|
@Resource
|
||||||
|
private OfficialAccountTemplateEventMapper officialAccountTemplateEventMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 微信公众号模板信息事件推送
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id) {
|
||||||
|
return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信公众号模板信息事件推送列表
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 微信公众号模板信息事件推送
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
|
||||||
|
return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventList(officialAccountTemplateEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
|
||||||
|
officialAccountTemplateEvent.setCreateTime(LocalDateTime.now());
|
||||||
|
return officialAccountTemplateEventMapper.insertOfficialAccountTemplateEvent(officialAccountTemplateEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
|
||||||
|
officialAccountTemplateEvent.setUpdateTime(LocalDateTime.now());
|
||||||
|
return officialAccountTemplateEventMapper.updateOfficialAccountTemplateEvent(officialAccountTemplateEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信公众号模板信息事件推送
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信公众号模板信息事件推送主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOfficialAccountTemplateEventByIds(Long[] ids) {
|
||||||
|
return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信公众号模板信息事件推送信息
|
||||||
|
*
|
||||||
|
* @param id 微信公众号模板信息事件推送主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteOfficialAccountTemplateEventById(Long id) {
|
||||||
|
return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xinelu.manage.service.subscribemessagerecord;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息记录Service接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
public interface ISubscribeMessageRecordService {
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
SubscribeMessageRecord selectSubscribeMessageRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 微信小程序订阅消息记录集合
|
||||||
|
*/
|
||||||
|
List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信小程序订阅消息记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageRecordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息记录信息
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageRecordById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.xinelu.manage.service.subscribemessagerecord.impl;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
|
||||||
|
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
|
||||||
|
import com.xinelu.manage.service.subscribemessagerecord.ISubscribeMessageRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SubscribeMessageRecordServiceImpl implements ISubscribeMessageRecordService {
|
||||||
|
@Resource
|
||||||
|
private SubscribeMessageRecordMapper subscribeMessageRecordMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscribeMessageRecord selectSubscribeMessageRecordById(Long id) {
|
||||||
|
return subscribeMessageRecordMapper.selectSubscribeMessageRecordById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 微信小程序订阅消息记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
return subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
subscribeMessageRecord.setCreateTime(LocalDateTime.now());
|
||||||
|
return subscribeMessageRecordMapper.insertSubscribeMessageRecord(subscribeMessageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageRecord 微信小程序订阅消息记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
|
||||||
|
subscribeMessageRecord.setUpdateTime(LocalDateTime.now());
|
||||||
|
return subscribeMessageRecordMapper.updateSubscribeMessageRecord(subscribeMessageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信小程序订阅消息记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSubscribeMessageRecordByIds(Long[] ids) {
|
||||||
|
return subscribeMessageRecordMapper.deleteSubscribeMessageRecordByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息记录信息
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSubscribeMessageRecordById(Long id) {
|
||||||
|
return subscribeMessageRecordMapper.deleteSubscribeMessageRecordById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xinelu.manage.service.subscribemessagesendrecord;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息发送结果记录Service接口
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
public interface ISubscribeMessageSendRecordService {
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 微信小程序订阅消息发送结果记录集合
|
||||||
|
*/
|
||||||
|
List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信小程序订阅消息发送结果记录主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息发送结果记录信息
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteSubscribeMessageSendRecordById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.xinelu.manage.service.subscribemessagesendrecord.impl;
|
||||||
|
|
||||||
|
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
|
||||||
|
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
|
||||||
|
import com.xinelu.manage.service.subscribemessagesendrecord.ISubscribeMessageSendRecordService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序订阅消息发送结果记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-03-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SubscribeMessageSendRecordServiceImpl implements ISubscribeMessageSendRecordService {
|
||||||
|
@Resource
|
||||||
|
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id) {
|
||||||
|
return subscribeMessageSendRecordMapper.selectSubscribeMessageSendRecordById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信小程序订阅消息发送结果记录列表
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 微信小程序订阅消息发送结果记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
return subscribeMessageSendRecordMapper.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
subscribeMessageSendRecord.setCreateTime(LocalDateTime.now());
|
||||||
|
return subscribeMessageSendRecordMapper.insertSubscribeMessageSendRecord(subscribeMessageSendRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord) {
|
||||||
|
subscribeMessageSendRecord.setUpdateTime(LocalDateTime.now());
|
||||||
|
return subscribeMessageSendRecordMapper.updateSubscribeMessageSendRecord(subscribeMessageSendRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除微信小程序订阅消息发送结果记录
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSubscribeMessageSendRecordByIds(Long[] ids) {
|
||||||
|
return subscribeMessageSendRecordMapper.deleteSubscribeMessageSendRecordByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信小程序订阅消息发送结果记录信息
|
||||||
|
*
|
||||||
|
* @param id 微信小程序订阅消息发送结果记录主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSubscribeMessageSendRecordById(Long id) {
|
||||||
|
return subscribeMessageSendRecordMapper.deleteSubscribeMessageSendRecordById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,191 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper">
|
||||||
|
|
||||||
|
<resultMap type="OfficialAccountSubscribeEvent" id="OfficialAccountSubscribeEventResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="officialAccountAppId" column="official_account_app_id"/>
|
||||||
|
<result property="sendTime" column="send_time"/>
|
||||||
|
<result property="msgType" column="msg_type"/>
|
||||||
|
<result property="eventType" column="event_type"/>
|
||||||
|
<result property="subscribeStatus" column="subscribe_status"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectOfficialAccountSubscribeEventVo">
|
||||||
|
select id, openid, official_account_app_id, send_time, msg_type, event_type, subscribe_status, create_by, create_time, update_by, update_time from official_account_subscribe_event
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectOfficialAccountSubscribeEventList" parameterType="OfficialAccountSubscribeEvent"
|
||||||
|
resultMap="OfficialAccountSubscribeEventResult">
|
||||||
|
<include refid="selectOfficialAccountSubscribeEventVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="openid != null and openid != ''">
|
||||||
|
and openid = #{openid}
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null and officialAccountAppId != ''">
|
||||||
|
and official_account_app_id = #{officialAccountAppId}
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null ">
|
||||||
|
and send_time = #{sendTime}
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null and msgType != ''">
|
||||||
|
and msg_type = #{msgType}
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null and eventType != ''">
|
||||||
|
and event_type = #{eventType}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOfficialAccountSubscribeEventById" parameterType="Long"
|
||||||
|
resultMap="OfficialAccountSubscribeEventResult">
|
||||||
|
<include refid="selectOfficialAccountSubscribeEventVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertOfficialAccountSubscribeEvent" parameterType="OfficialAccountSubscribeEvent"
|
||||||
|
useGeneratedKeys="true"
|
||||||
|
keyProperty="id">
|
||||||
|
insert into official_account_subscribe_event
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="openid != null">openid,
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">official_account_app_id,
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">send_time,
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">msg_type,
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">event_type,
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">subscribe_status,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="openid != null">#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">#{officialAccountAppId},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">#{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">#{msgType},
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">#{eventType},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">#{subscribeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateOfficialAccountSubscribeEvent" parameterType="OfficialAccountSubscribeEvent">
|
||||||
|
update official_account_subscribe_event
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="openid != null">openid =
|
||||||
|
#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">official_account_app_id =
|
||||||
|
#{officialAccountAppId},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">send_time =
|
||||||
|
#{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">msg_type =
|
||||||
|
#{msgType},
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">event_type =
|
||||||
|
#{eventType},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">subscribe_status =
|
||||||
|
#{subscribeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by =
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time =
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by =
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time =
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteOfficialAccountSubscribeEventById" parameterType="Long">
|
||||||
|
delete from official_account_subscribe_event where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteOfficialAccountSubscribeEventByIds" parameterType="String">
|
||||||
|
delete from official_account_subscribe_event where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getSubscribeEventInfo" resultType="int">
|
||||||
|
select count(1) from official_account_subscribe_event where openid = #{openid}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateSubscribeEventInfo" parameterType="OfficialAccountSubscribeEvent">
|
||||||
|
update official_account_subscribe_event
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="openid != null">openid =
|
||||||
|
#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">official_account_app_id =
|
||||||
|
#{officialAccountAppId},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">send_time =
|
||||||
|
#{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">msg_type =
|
||||||
|
#{msgType},
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">event_type =
|
||||||
|
#{eventType},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">subscribe_status =
|
||||||
|
#{subscribeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by =
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time =
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by =
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time =
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where openid = #{openid}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,185 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper">
|
||||||
|
|
||||||
|
<resultMap type="OfficialAccountTemplateEvent" id="OfficialAccountTemplateEventResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="patientId" column="patient_id"/>
|
||||||
|
<result property="patientName" column="patient_name"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="officialAccountAppId" column="official_account_app_id"/>
|
||||||
|
<result property="sendTime" column="send_time"/>
|
||||||
|
<result property="msgType" column="msg_type"/>
|
||||||
|
<result property="eventType" column="event_type"/>
|
||||||
|
<result property="msgId" column="msg_id"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectOfficialAccountTemplateEventVo">
|
||||||
|
select id, patient_id, patient_name, openid, official_account_app_id, send_time, msg_type, event_type, msg_id, status, create_by, create_time, update_by, update_time from official_account_template_event
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectOfficialAccountTemplateEventList" parameterType="OfficialAccountTemplateEvent"
|
||||||
|
resultMap="OfficialAccountTemplateEventResult">
|
||||||
|
<include refid="selectOfficialAccountTemplateEventVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="patientId != null ">
|
||||||
|
and patient_id = #{patientId}
|
||||||
|
</if>
|
||||||
|
<if test="patientName != null and patientName != ''">
|
||||||
|
and patient_name like concat('%', #{patientName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="openid != null and openid != ''">
|
||||||
|
and openid = #{openid}
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null and officialAccountAppId != ''">
|
||||||
|
and official_account_app_id = #{officialAccountAppId}
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null ">
|
||||||
|
and send_time = #{sendTime}
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null and msgType != ''">
|
||||||
|
and msg_type = #{msgType}
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null and eventType != ''">
|
||||||
|
and event_type = #{eventType}
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null and msgId != ''">
|
||||||
|
and msg_id = #{msgId}
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
and status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectOfficialAccountTemplateEventById" parameterType="Long"
|
||||||
|
resultMap="OfficialAccountTemplateEventResult">
|
||||||
|
<include refid="selectOfficialAccountTemplateEventVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertOfficialAccountTemplateEvent" parameterType="OfficialAccountTemplateEvent" useGeneratedKeys="true"
|
||||||
|
keyProperty="id">
|
||||||
|
insert into official_account_template_event
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id,
|
||||||
|
</if>
|
||||||
|
<if test="patientName != null">patient_name,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid,
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">official_account_app_id,
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">send_time,
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">msg_type,
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">event_type,
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">msg_id,
|
||||||
|
</if>
|
||||||
|
<if test="status != null">status,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="patientName != null">#{patientName},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">#{officialAccountAppId},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">#{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">#{msgType},
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">#{eventType},
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">#{msgId},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">#{status},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateOfficialAccountTemplateEvent" parameterType="OfficialAccountTemplateEvent">
|
||||||
|
update official_account_template_event
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id =
|
||||||
|
#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="patientName != null">patient_name =
|
||||||
|
#{patientName},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid =
|
||||||
|
#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="officialAccountAppId != null">official_account_app_id =
|
||||||
|
#{officialAccountAppId},
|
||||||
|
</if>
|
||||||
|
<if test="sendTime != null">send_time =
|
||||||
|
#{sendTime},
|
||||||
|
</if>
|
||||||
|
<if test="msgType != null">msg_type =
|
||||||
|
#{msgType},
|
||||||
|
</if>
|
||||||
|
<if test="eventType != null">event_type =
|
||||||
|
#{eventType},
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">msg_id =
|
||||||
|
#{msgId},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">status =
|
||||||
|
#{status},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by =
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time =
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by =
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time =
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteOfficialAccountTemplateEventById" parameterType="Long">
|
||||||
|
delete from official_account_template_event where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteOfficialAccountTemplateEventByIds" parameterType="String">
|
||||||
|
delete from official_account_template_event where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@ -507,4 +507,34 @@
|
|||||||
#{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,
|
||||||
|
official_account_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>
|
||||||
@ -0,0 +1,237 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper">
|
||||||
|
|
||||||
|
<resultMap type="SubscribeMessageRecord" id="SubscribeMessageRecordResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="patientId" column="patient_id"/>
|
||||||
|
<result property="manageRouteNodeId" column="manage_route_node_id"/>
|
||||||
|
<result property="unionid" column="unionid"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="appletId" column="applet_id"/>
|
||||||
|
<result property="templateId" column="template_id"/>
|
||||||
|
<result property="messageType" column="message_type"/>
|
||||||
|
<result property="subscribeCount" column="subscribe_count"/>
|
||||||
|
<result property="subscribeTime" column="subscribe_time"/>
|
||||||
|
<result property="subscribeStatus" column="subscribe_status"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSubscribeMessageRecordVo">
|
||||||
|
select id, patient_id, manage_route_node_id, unionid, openid, applet_id, template_id, message_type, subscribe_count, subscribe_time, subscribe_status, create_by, create_time, update_by, update_time from subscribe_message_record
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSubscribeMessageRecordList" parameterType="SubscribeMessageRecord"
|
||||||
|
resultMap="SubscribeMessageRecordResult">
|
||||||
|
<include refid="selectSubscribeMessageRecordVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="patientId != null ">
|
||||||
|
and patient_id = #{patientId}
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null ">
|
||||||
|
and manage_route_node_id = #{manageRouteNodeId}
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null and unionid != ''">
|
||||||
|
and unionid = #{unionid}
|
||||||
|
</if>
|
||||||
|
<if test="openid != null and openid != ''">
|
||||||
|
and openid = #{openid}
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null and appletId != ''">
|
||||||
|
and applet_id = #{appletId}
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null and templateId != ''">
|
||||||
|
and template_id = #{templateId}
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null and messageType != ''">
|
||||||
|
and message_type = #{messageType}
|
||||||
|
</if>
|
||||||
|
<if test="subscribeCount != null ">
|
||||||
|
and subscribe_count = #{subscribeCount}
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null ">
|
||||||
|
and subscribe_time = #{subscribeTime}
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null and subscribeStatus != ''">
|
||||||
|
and subscribe_status = #{subscribeStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSubscribeMessageRecordById" parameterType="Long"
|
||||||
|
resultMap="SubscribeMessageRecordResult">
|
||||||
|
<include refid="selectSubscribeMessageRecordVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSubscribeMessageRecord" parameterType="SubscribeMessageRecord" useGeneratedKeys="true"
|
||||||
|
keyProperty="id">
|
||||||
|
insert into subscribe_message_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id,
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">manage_route_node_id,
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">unionid,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid,
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">applet_id,
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">template_id,
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">message_type,
|
||||||
|
</if>
|
||||||
|
<if test="subscribeCount != null">subscribe_count,
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">subscribe_time,
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">subscribe_status,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">#{unionid},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">#{appletId},
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">#{templateId},
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">#{messageType},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeCount != null">#{subscribeCount},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">#{subscribeTime},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">#{subscribeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSubscribeMessageRecord" parameterType="SubscribeMessageRecord">
|
||||||
|
update subscribe_message_record
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id =
|
||||||
|
#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">manage_route_node_id =
|
||||||
|
#{manageRouteNodeId},
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">unionid =
|
||||||
|
#{unionid},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid =
|
||||||
|
#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">applet_id =
|
||||||
|
#{appletId},
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">template_id =
|
||||||
|
#{templateId},
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">message_type =
|
||||||
|
#{messageType},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeCount != null">subscribe_count =
|
||||||
|
#{subscribeCount},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">subscribe_time =
|
||||||
|
#{subscribeTime},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeStatus != null">subscribe_status =
|
||||||
|
#{subscribeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by =
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time =
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by =
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time =
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSubscribeMessageRecordById" parameterType="Long">
|
||||||
|
delete from subscribe_message_record where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSubscribeMessageRecordByIds" parameterType="String">
|
||||||
|
delete from subscribe_message_record where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</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>
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper">
|
||||||
|
|
||||||
|
<resultMap type="SubscribeMessageSendRecord" id="SubscribeMessageSendRecordResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="patientId" column="patient_id"/>
|
||||||
|
<result property="manageRouteNodeId" column="manage_route_node_id"/>
|
||||||
|
<result property="unionid" column="unionid"/>
|
||||||
|
<result property="openid" column="openid"/>
|
||||||
|
<result property="appletId" column="applet_id"/>
|
||||||
|
<result property="subscribeTime" column="subscribe_time"/>
|
||||||
|
<result property="templateId" column="template_id"/>
|
||||||
|
<result property="msgId" column="msg_id"/>
|
||||||
|
<result property="messageType" column="message_type"/>
|
||||||
|
<result property="errorCode" column="error_code"/>
|
||||||
|
<result property="errorStatus" column="error_status"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSubscribeMessageSendRecordVo">
|
||||||
|
select id, patient_id, manage_route_node_id, unionid, openid, applet_id, subscribe_time, template_id, msg_id, message_type, error_code, error_status, create_by, create_time, update_by, update_time from subscribe_message_send_record
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSubscribeMessageSendRecordList" parameterType="SubscribeMessageSendRecord"
|
||||||
|
resultMap="SubscribeMessageSendRecordResult">
|
||||||
|
<include refid="selectSubscribeMessageSendRecordVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="patientId != null ">
|
||||||
|
and patient_id = #{patientId}
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null ">
|
||||||
|
and manage_route_node_id = #{manageRouteNodeId}
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null and unionid != ''">
|
||||||
|
and unionid = #{unionid}
|
||||||
|
</if>
|
||||||
|
<if test="openid != null and openid != ''">
|
||||||
|
and openid = #{openid}
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null and appletId != ''">
|
||||||
|
and applet_id = #{appletId}
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null ">
|
||||||
|
and subscribe_time = #{subscribeTime}
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null and templateId != ''">
|
||||||
|
and template_id = #{templateId}
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null and msgId != ''">
|
||||||
|
and msg_id = #{msgId}
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null and messageType != ''">
|
||||||
|
and message_type = #{messageType}
|
||||||
|
</if>
|
||||||
|
<if test="errorCode != null ">
|
||||||
|
and error_code = #{errorCode}
|
||||||
|
</if>
|
||||||
|
<if test="errorStatus != null and errorStatus != ''">
|
||||||
|
and error_status = #{errorStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSubscribeMessageSendRecordById" parameterType="Long"
|
||||||
|
resultMap="SubscribeMessageSendRecordResult">
|
||||||
|
<include refid="selectSubscribeMessageSendRecordVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSubscribeMessageSendRecord" parameterType="SubscribeMessageSendRecord" useGeneratedKeys="true"
|
||||||
|
keyProperty="id">
|
||||||
|
insert into subscribe_message_send_record
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id,
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">manage_route_node_id,
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">unionid,
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid,
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">applet_id,
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">subscribe_time,
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">template_id,
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">msg_id,
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">message_type,
|
||||||
|
</if>
|
||||||
|
<if test="errorCode != null">error_code,
|
||||||
|
</if>
|
||||||
|
<if test="errorStatus != null">error_status,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">#{unionid},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">#{appletId},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">#{subscribeTime},
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">#{templateId},
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">#{msgId},
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">#{messageType},
|
||||||
|
</if>
|
||||||
|
<if test="errorCode != null">#{errorCode},
|
||||||
|
</if>
|
||||||
|
<if test="errorStatus != null">#{errorStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSubscribeMessageSendRecord" parameterType="SubscribeMessageSendRecord">
|
||||||
|
update subscribe_message_send_record
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="patientId != null">patient_id =
|
||||||
|
#{patientId},
|
||||||
|
</if>
|
||||||
|
<if test="manageRouteNodeId != null">manage_route_node_id =
|
||||||
|
#{manageRouteNodeId},
|
||||||
|
</if>
|
||||||
|
<if test="unionid != null">unionid =
|
||||||
|
#{unionid},
|
||||||
|
</if>
|
||||||
|
<if test="openid != null">openid =
|
||||||
|
#{openid},
|
||||||
|
</if>
|
||||||
|
<if test="appletId != null">applet_id =
|
||||||
|
#{appletId},
|
||||||
|
</if>
|
||||||
|
<if test="subscribeTime != null">subscribe_time =
|
||||||
|
#{subscribeTime},
|
||||||
|
</if>
|
||||||
|
<if test="templateId != null">template_id =
|
||||||
|
#{templateId},
|
||||||
|
</if>
|
||||||
|
<if test="msgId != null">msg_id =
|
||||||
|
#{msgId},
|
||||||
|
</if>
|
||||||
|
<if test="messageType != null">message_type =
|
||||||
|
#{messageType},
|
||||||
|
</if>
|
||||||
|
<if test="errorCode != null">error_code =
|
||||||
|
#{errorCode},
|
||||||
|
</if>
|
||||||
|
<if test="errorStatus != null">error_status =
|
||||||
|
#{errorStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null">create_by =
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">create_time =
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null">update_by =
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">update_time =
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSubscribeMessageSendRecordById" parameterType="Long">
|
||||||
|
delete from subscribe_message_send_record where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSubscribeMessageSendRecordByIds" parameterType="String">
|
||||||
|
delete from subscribe_message_send_record where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</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>
|
||||||
@ -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,8 +1,13 @@
|
|||||||
package com.xinelu.mobile.controller;
|
package com.xinelu.mobile.controller;
|
||||||
|
|
||||||
|
import com.xinelu.mobile.utils.WeChatAppletUtils;
|
||||||
|
import com.xinelu.mobile.utils.WeChatOfficialAccountUtils;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 测试controller
|
* @Description 测试controller
|
||||||
* @Author 纪寒
|
* @Author 纪寒
|
||||||
@ -12,5 +17,32 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/testMobile")
|
@RequestMapping("/testMobile")
|
||||||
public class MobileTestController {
|
public class MobileTestController {
|
||||||
|
@Resource
|
||||||
|
private WeChatAppletUtils weChatAppletUtils;
|
||||||
|
@Resource
|
||||||
|
private WeChatOfficialAccountUtils weChatOfficialAccountUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试获取微信小程序accessToken
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAppletAcccessToken")
|
||||||
|
public String getAppletAccessToken() {
|
||||||
|
return weChatAppletUtils.getWeChatAppletAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试获取微信公众号accessToken
|
||||||
|
*/
|
||||||
|
@GetMapping("/getOfficialAccountAccessToken")
|
||||||
|
public String getOfficialAccountAccessToken() {
|
||||||
|
return weChatOfficialAccountUtils.getWeChatOfficialAccountAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试微信公众号模板消息发送
|
||||||
|
*/
|
||||||
|
@GetMapping("/sendOfficialAccountTemplate")
|
||||||
|
public void sendOfficialAccountTemplateMessage() {
|
||||||
|
weChatOfficialAccountUtils.sendOfficialAccountTemplateMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.xinelu.mobile.controller.wechatappletcallback;
|
||||||
|
|
||||||
|
import com.xinelu.common.config.WeChatAppletChatConfig;
|
||||||
|
import com.xinelu.common.utils.aes.AesException;
|
||||||
|
import com.xinelu.common.utils.aes.WXBizMsgCrypt;
|
||||||
|
import com.xinelu.mobile.dto.wechatappletcallback.MessageSignDTO;
|
||||||
|
import com.xinelu.mobile.service.wechatappletcallback.WeChatAppletCallBackService;
|
||||||
|
import com.xinelu.mobile.utils.XmlUtil;
|
||||||
|
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后微信小程序事件回调控制器
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 10:20:32
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/postDischarge/weChatAppletCallBack")
|
||||||
|
public class WeChatAppletCallBackController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WeChatAppletChatConfig appletChatConfig;
|
||||||
|
@Resource
|
||||||
|
private WeChatAppletCallBackService weChatAppletCallBackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序回调验证方法
|
||||||
|
*
|
||||||
|
* @param messageSignDTO 微信输入参数
|
||||||
|
* @return 解密后的字符串
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String getWeChatAppletCallBack(MessageSignDTO messageSignDTO) throws AesException {
|
||||||
|
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(appletChatConfig.getToken(), appletChatConfig.getEncodingAesKey(), appletChatConfig.getAppletId());
|
||||||
|
String verifyMessage = wxCpt.verifyUrl(messageSignDTO.getSignature(), messageSignDTO.getTimestamp(), messageSignDTO.getNonce(), messageSignDTO.getEchostr());
|
||||||
|
log.info("院后微信小程序回调设置验证URL成功,验证信息:verifyMessage = [{}]", verifyMessage);
|
||||||
|
return verifyMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序消息推送事件回调POST处理
|
||||||
|
*
|
||||||
|
* @param signature 签名
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @param postData 消息体,xml格式
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public void handleWeChatAppletCallBack(@RequestParam("signature") String signature,
|
||||||
|
@RequestParam("timestamp") String timestamp,
|
||||||
|
@RequestParam("nonce") String nonce,
|
||||||
|
@RequestBody String postData) throws AesException {
|
||||||
|
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(appletChatConfig.getToken(), appletChatConfig.getEncodingAesKey(), appletChatConfig.getAppletId());
|
||||||
|
String decryptMsg = wxCpt.decryptMsg(signature, timestamp, nonce, postData);
|
||||||
|
WeChatMessagePushVO weChatMessagePushVO = (WeChatMessagePushVO) XmlUtil.fromXml(decryptMsg, WeChatMessagePushVO.class);
|
||||||
|
if (Objects.isNull(weChatMessagePushVO)) {
|
||||||
|
log.error("院后微信小程序xml数据转换失败,请求信息为: [{}]", decryptMsg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(weChatMessagePushVO.getEvent()) || StringUtils.isBlank(weChatMessagePushVO.getMsgType())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("院后微信小程序消息推送回调执行,消息数据为: [{}]", weChatMessagePushVO);
|
||||||
|
weChatAppletCallBackService.handleWeChatAppletCallBack(weChatMessagePushVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
package com.xinelu.mobile.controller.wechatofficialaccountcallback;
|
||||||
|
|
||||||
|
import com.xinelu.common.config.WeChatOfficialAccountConfig;
|
||||||
|
import com.xinelu.common.enums.OfficialAccountEventEnum;
|
||||||
|
import com.xinelu.common.utils.aes.AesException;
|
||||||
|
import com.xinelu.common.utils.aes.WXBizMsgCrypt;
|
||||||
|
import com.xinelu.mobile.dto.wechatappletcallback.MessageSignDTO;
|
||||||
|
import com.xinelu.mobile.service.wechatofficialaccountcallback.WeChatOfficialAccountCallbackService;
|
||||||
|
import com.xinelu.mobile.utils.XmlUtil;
|
||||||
|
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后微信公众号事件回调控制器
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 14:26:56
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/postDischarge/officialAccountCallback")
|
||||||
|
public class WeChatOfficialAccountCallbackController {
|
||||||
|
@Resource
|
||||||
|
private WeChatOfficialAccountConfig weChatOfficialAccountConfig;
|
||||||
|
@Resource
|
||||||
|
private WeChatOfficialAccountCallbackService weChatOfficialAccountCallbackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号回调验证方法
|
||||||
|
*
|
||||||
|
* @param messageSignDTO 微信输入参数
|
||||||
|
* @return 解密后的字符串
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String getWeChatOfficialAccountCallBack(MessageSignDTO messageSignDTO) throws AesException {
|
||||||
|
//解密微信报文信息并验证微信公众号与服务器之间是否正常通信
|
||||||
|
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(weChatOfficialAccountConfig.getOfficialAccountToken(), weChatOfficialAccountConfig.getOfficialAccountEncodingAesKey(), weChatOfficialAccountConfig.getOfficialAccountAppId());
|
||||||
|
String verifyMessage = wxCpt.verifyUrl(messageSignDTO.getSignature(), messageSignDTO.getTimestamp(), messageSignDTO.getNonce(), messageSignDTO.getEchostr());
|
||||||
|
log.info("院后微信公众号回调设置验证URL成功,验证信息:verifyMessage = [{}]", verifyMessage);
|
||||||
|
return verifyMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号模板消息事件回调处理
|
||||||
|
*
|
||||||
|
* @param signature 签名
|
||||||
|
* @param timestamp 时间戳
|
||||||
|
* @param nonce 随机字符串
|
||||||
|
* @param postData 事件报文内容
|
||||||
|
* @throws AesException 异常信息
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public void handleWeChatOfficialAccountCallBack(@RequestParam("signature") String signature,
|
||||||
|
@RequestParam("timestamp") String timestamp,
|
||||||
|
@RequestParam("nonce") String nonce,
|
||||||
|
@RequestBody String postData) throws AesException {
|
||||||
|
//解密微信报文信息并验证微信公众号与服务器之间是否正常通信
|
||||||
|
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(weChatOfficialAccountConfig.getOfficialAccountToken(), weChatOfficialAccountConfig.getOfficialAccountEncodingAesKey(), weChatOfficialAccountConfig.getOfficialAccountAppId());
|
||||||
|
String verifyMessage = wxCpt.verifyUrl(signature, timestamp, nonce, postData);
|
||||||
|
WeChatOfficialAccountEventPushVO eventPush = (WeChatOfficialAccountEventPushVO) XmlUtil.fromXml(verifyMessage, WeChatOfficialAccountEventPushVO.class);
|
||||||
|
if (Objects.isNull(eventPush)) {
|
||||||
|
log.info("院后微信公众号模板消息事件xml数据转换失败,请求信息为: [{}]", verifyMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(eventPush.getToUserName()) || StringUtils.isBlank(eventPush.getEvent()) || StringUtils.isBlank(eventPush.getMsgType())) {
|
||||||
|
log.info("院后微信公众号模板消息事件解析事件数据为空!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//微信模板公众号消息事件
|
||||||
|
if (OfficialAccountEventEnum.TEMPLATESENDJOBFINISH.getInfo().equals(eventPush.getEvent())) {
|
||||||
|
weChatOfficialAccountCallbackService.handleOfficialAccountTemplateEvent(eventPush);
|
||||||
|
}
|
||||||
|
//微信公众号关注和取消事件
|
||||||
|
if (OfficialAccountEventEnum.SUBSCRIBE.getInfo().equals(eventPush.getEvent()) ||
|
||||||
|
OfficialAccountEventEnum.UNSUBSCRIBE.getInfo().equals(eventPush.getEvent())) {
|
||||||
|
weChatOfficialAccountCallbackService.handleOfficialAccountSubscribeEvent(eventPush);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.xinelu.mobile.dto.wechatappletcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 消息验证实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 10:09:01
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MessageSignDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 357274374767303359L;
|
||||||
|
/**
|
||||||
|
* 微信小程序签名
|
||||||
|
*/
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private String timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机字符串
|
||||||
|
*/
|
||||||
|
private String nonce;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密的字符串
|
||||||
|
*/
|
||||||
|
private String echostr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调数据包,xml格式
|
||||||
|
*/
|
||||||
|
private String postData;
|
||||||
|
}
|
||||||
@ -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.WeChatAppletChatConfig;
|
||||||
|
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 WeChatAppletChatConfig 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.service.wechatofficialaccountcallback;
|
||||||
|
|
||||||
|
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后微信公众号事件回调service
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-25 14:52:03
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface WeChatOfficialAccountCallbackService {
|
||||||
|
/**
|
||||||
|
* 院后微信公众号模板消息事件回调处理
|
||||||
|
*
|
||||||
|
* @param eventPushVO 模板消息事件回调数据
|
||||||
|
*/
|
||||||
|
void handleOfficialAccountTemplateEvent(WeChatOfficialAccountEventPushVO eventPushVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号取消和关注事件回调处理
|
||||||
|
*
|
||||||
|
* @param eventPushVO 公众号取消和关注事件回调数据
|
||||||
|
*/
|
||||||
|
void handleOfficialAccountSubscribeEvent(WeChatOfficialAccountEventPushVO eventPushVO);
|
||||||
|
}
|
||||||
@ -0,0 +1,133 @@
|
|||||||
|
package com.xinelu.mobile.service.wechatofficialaccountcallback.impl;
|
||||||
|
|
||||||
|
import com.xinelu.common.enums.OfficialAccountEventEnum;
|
||||||
|
import com.xinelu.common.enums.SubscribeStatusEnum;
|
||||||
|
import com.xinelu.common.exception.ServiceException;
|
||||||
|
import com.xinelu.common.utils.DateUtils;
|
||||||
|
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
|
||||||
|
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
|
||||||
|
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||||
|
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
|
||||||
|
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
|
||||||
|
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||||
|
import com.xinelu.mobile.service.wechatofficialaccountcallback.WeChatOfficialAccountCallbackService;
|
||||||
|
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后微信公众号事件回调service实现
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-25 14:55:53
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class WeChatOfficialAccountCallbackServiceImpl implements WeChatOfficialAccountCallbackService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PatientInfoMapper patientInfoMapper;
|
||||||
|
@Resource
|
||||||
|
private OfficialAccountTemplateEventMapper officialAccountTemplateEventMapper;
|
||||||
|
@Resource
|
||||||
|
private OfficialAccountSubscribeEventMapper officialAccountSubscribeEventMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号模板消息事件回调处理
|
||||||
|
*
|
||||||
|
* @param eventPushVO 模板消息事件回调数据
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void handleOfficialAccountTemplateEvent(WeChatOfficialAccountEventPushVO eventPushVO) {
|
||||||
|
//查询患者信息
|
||||||
|
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(eventPushVO.getFromUserName());
|
||||||
|
if (Objects.isNull(patientInfo)) {
|
||||||
|
log.info("当前患者信息不存在,微信用户openid为:{}", eventPushVO.getFromUserName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OfficialAccountTemplateEvent templateEvent = new OfficialAccountTemplateEvent();
|
||||||
|
templateEvent.setPatientId(Objects.isNull(patientInfo.getId()) ? null : patientInfo.getId());
|
||||||
|
templateEvent.setPatientName(StringUtils.isBlank(patientInfo.getPatientName()) ? "" : patientInfo.getPatientName());
|
||||||
|
templateEvent.setOpenid(eventPushVO.getFromUserName());
|
||||||
|
templateEvent.setOfficialAccountAppId(StringUtils.isBlank(eventPushVO.getToUserName()) ? "" : eventPushVO.getToUserName());
|
||||||
|
templateEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
|
||||||
|
templateEvent.setMsgType(StringUtils.isBlank(eventPushVO.getMsgType()) ? "" : eventPushVO.getMsgType());
|
||||||
|
templateEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
|
||||||
|
templateEvent.setMsgId(StringUtils.isBlank(eventPushVO.getMsgId()) ? "" : eventPushVO.getMsgId());
|
||||||
|
templateEvent.setStatus(StringUtils.isBlank(eventPushVO.getStatus()) ? "" : eventPushVO.getStatus());
|
||||||
|
templateEvent.setCreateTime(LocalDateTime.now());
|
||||||
|
templateEvent.setCreateBy("xinyilu");
|
||||||
|
int insertTemplateEventCount = officialAccountTemplateEventMapper.insertOfficialAccountTemplateEvent(templateEvent);
|
||||||
|
if (insertTemplateEventCount < 0) {
|
||||||
|
log.error("院后微信公众号模板事件推送,新增模板事件消息信息失败,信息为:[{}]", templateEvent);
|
||||||
|
throw new ServiceException("院后微信公众号模板事件推送记录信息失败!");
|
||||||
|
}
|
||||||
|
log.info("院后微信公众号模板事件推送处理成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 院后微信公众号取消和关注事件回调处理
|
||||||
|
*
|
||||||
|
* @param eventPushVO 公众号取消和关注事件回调数据
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void handleOfficialAccountSubscribeEvent(WeChatOfficialAccountEventPushVO eventPushVO) {
|
||||||
|
//关注公众号事件
|
||||||
|
if (OfficialAccountEventEnum.SUBSCRIBE.getInfo().equals(eventPushVO.getEvent())) {
|
||||||
|
handleSubscribeEventInfo(eventPushVO, SubscribeStatusEnum.accept.getValue());
|
||||||
|
}
|
||||||
|
//取消关注公众号事件
|
||||||
|
if (OfficialAccountEventEnum.UNSUBSCRIBE.getInfo().equals(eventPushVO.getEvent())) {
|
||||||
|
handleSubscribeEventInfo(eventPushVO, SubscribeStatusEnum.rejet.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理公众号订阅信息
|
||||||
|
*
|
||||||
|
* @param eventPushVO 公众号取消和关注事件回调数据
|
||||||
|
* @param subscribeStatus 订阅状态
|
||||||
|
*/
|
||||||
|
private void handleSubscribeEventInfo(WeChatOfficialAccountEventPushVO eventPushVO, String subscribeStatus) {
|
||||||
|
int subscribeEventCount = officialAccountSubscribeEventMapper.getSubscribeEventInfo(eventPushVO.getFromUserName());
|
||||||
|
if (subscribeEventCount == 0) {
|
||||||
|
//没有订阅过,直接新增
|
||||||
|
OfficialAccountSubscribeEvent subscribeEvent = new OfficialAccountSubscribeEvent();
|
||||||
|
subscribeEvent.setOpenid(eventPushVO.getFromUserName());
|
||||||
|
subscribeEvent.setOfficialAccountAppId(StringUtils.isBlank(eventPushVO.getToUserName()) ? "" : eventPushVO.getToUserName());
|
||||||
|
subscribeEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
|
||||||
|
subscribeEvent.setMsgType(StringUtils.isBlank(eventPushVO.getMsgType()) ? "" : eventPushVO.getMsgType());
|
||||||
|
subscribeEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
|
||||||
|
subscribeEvent.setSubscribeStatus(subscribeStatus);
|
||||||
|
subscribeEvent.setCreateTime(LocalDateTime.now());
|
||||||
|
subscribeEvent.setCreateBy("xinyilu");
|
||||||
|
int insertSubscribeEvent = officialAccountSubscribeEventMapper.insertOfficialAccountSubscribeEvent(subscribeEvent);
|
||||||
|
if (insertSubscribeEvent < 0) {
|
||||||
|
log.error("院后微信公众号关注和取消事件,新增信息失败,信息为:[{}]", subscribeEvent);
|
||||||
|
throw new ServiceException("新增院后微信公众号关注和取消事件信息失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//订阅过,修改
|
||||||
|
OfficialAccountSubscribeEvent subscribeEvent = new OfficialAccountSubscribeEvent();
|
||||||
|
subscribeEvent.setOpenid(eventPushVO.getFromUserName());
|
||||||
|
subscribeEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
|
||||||
|
subscribeEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
|
||||||
|
subscribeEvent.setSubscribeStatus(subscribeStatus);
|
||||||
|
subscribeEvent.setUpdateTime(LocalDateTime.now());
|
||||||
|
subscribeEvent.setUpdateBy("xinyilu");
|
||||||
|
int updateSubscribeEvent = officialAccountSubscribeEventMapper.updateSubscribeEventInfo(subscribeEvent);
|
||||||
|
if (updateSubscribeEvent < 0) {
|
||||||
|
log.error("院后微信公众号关注和取消事件,修改信息失败,信息为:[{}]", subscribeEvent);
|
||||||
|
throw new ServiceException("修改院后微信公众号关注和取消事件信息失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.xinelu.mobile.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.xinelu.common.config.WeChatAppletChatConfig;
|
||||||
|
import com.xinelu.common.constant.Constants;
|
||||||
|
import com.xinelu.common.entity.AccessToken;
|
||||||
|
import com.xinelu.common.exception.ServiceException;
|
||||||
|
import com.xinelu.common.utils.http.HttpUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后微信小程序公共方法工具类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 13:41:08
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class WeChatAppletUtils {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
@Resource
|
||||||
|
private WeChatAppletChatConfig weChatAppletChatConfig;
|
||||||
|
/**
|
||||||
|
* 返回成功状态码
|
||||||
|
*/
|
||||||
|
private static final int SUCCESS_CODE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序的accessToken值
|
||||||
|
*
|
||||||
|
* @return 小程序accessToken值
|
||||||
|
*/
|
||||||
|
public String getWeChatAppletAccessToken() {
|
||||||
|
String accessToken;
|
||||||
|
String accessTokenRedisKey = Constants.WE_CHAT_APPLET_ACCESS_TOKEN + "accessToken";
|
||||||
|
//从Redis中取出accessToken
|
||||||
|
Object object = redisTemplate.opsForValue().get(accessTokenRedisKey);
|
||||||
|
if (Objects.isNull(object)) {
|
||||||
|
//没有,获取accessToken
|
||||||
|
String accessTokenUrl = Constants.WE_CHAT_ACCESS_TOKEN_URL + "&appid=" + weChatAppletChatConfig.getAppletId() + "&secret=" + weChatAppletChatConfig.getSecret();
|
||||||
|
//发送请求
|
||||||
|
String result = HttpUtils.sendGet(accessTokenUrl);
|
||||||
|
if (StringUtils.isBlank(result)) {
|
||||||
|
throw new ServiceException("获取微信小程序accessToken信息失败", 201);
|
||||||
|
}
|
||||||
|
AccessToken weAppletAccessToken = JSON.parseObject(result, AccessToken.class);
|
||||||
|
if (Objects.isNull(weAppletAccessToken)) {
|
||||||
|
throw new ServiceException("获取微信小程序accessToken信息失败");
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(weAppletAccessToken.getErrcode()) && weAppletAccessToken.getErrcode() != SUCCESS_CODE) {
|
||||||
|
throw new ServiceException("获取微信小程序accessToken信息失败,失败信息为:" + weAppletAccessToken.getErrmsg(), 201);
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(weAppletAccessToken.getAccessToken())) {
|
||||||
|
throw new ServiceException("微信小程序accessToken信息为空");
|
||||||
|
}
|
||||||
|
accessToken = weAppletAccessToken.getAccessToken();
|
||||||
|
//存入Redis中
|
||||||
|
redisTemplate.opsForValue().set(accessTokenRedisKey, accessToken, 3600, TimeUnit.SECONDS);
|
||||||
|
} else {
|
||||||
|
accessToken = (String) object;
|
||||||
|
}
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
package com.xinelu.mobile.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.xinelu.common.config.WeChatOfficialAccountConfig;
|
||||||
|
import com.xinelu.common.constant.Constants;
|
||||||
|
import com.xinelu.common.entity.AccessToken;
|
||||||
|
import com.xinelu.common.entity.MessageValueEntity;
|
||||||
|
import com.xinelu.common.exception.ServiceException;
|
||||||
|
import com.xinelu.common.utils.http.HttpUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 院后公众号公众方法工具类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 13:42:31
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class WeChatOfficialAccountUtils {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
@Resource
|
||||||
|
private WeChatOfficialAccountConfig weChatOfficialAccountConfig;
|
||||||
|
/**
|
||||||
|
* 返回成功状态码
|
||||||
|
*/
|
||||||
|
private static final int SUCCESS_CODE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取院后微信公众号accessToken
|
||||||
|
*
|
||||||
|
* @return 微信公众号的accessToken
|
||||||
|
*/
|
||||||
|
public String getWeChatOfficialAccountAccessToken() {
|
||||||
|
String accessToken;
|
||||||
|
String accessTokenRedisKey = Constants.WE_CHAT_OFFICIAL_ACCOUNT_ACCESS_TOKEN + "accessToken";
|
||||||
|
//从Redis中取出accessToken
|
||||||
|
Object object = redisTemplate.opsForValue().get(accessTokenRedisKey);
|
||||||
|
if (Objects.isNull(object)) {
|
||||||
|
//没有,获取accessToken
|
||||||
|
String accessTokenUrl = Constants.WE_CHAT_ACCESS_TOKEN_URL + "&appid=" + weChatOfficialAccountConfig.getOfficialAccountAppId() + "&secret=" + weChatOfficialAccountConfig.getOfficialAccountAppSecret();
|
||||||
|
//发送请求
|
||||||
|
String result = HttpUtils.sendGet(accessTokenUrl);
|
||||||
|
if (StringUtils.isBlank(result)) {
|
||||||
|
throw new ServiceException("获取微信公众号accessToken信息失败", 201);
|
||||||
|
}
|
||||||
|
AccessToken officialAccountAccessToken = JSON.parseObject(result, AccessToken.class);
|
||||||
|
if (Objects.isNull(officialAccountAccessToken)) {
|
||||||
|
throw new ServiceException("获取微信公众号accessToken信息失败");
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(officialAccountAccessToken.getErrcode()) && officialAccountAccessToken.getErrcode() != SUCCESS_CODE) {
|
||||||
|
throw new ServiceException("获取微信公众号accessToken信息失败,失败信息为:" + officialAccountAccessToken.getErrmsg(), 201);
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(officialAccountAccessToken.getAccessToken())) {
|
||||||
|
throw new ServiceException("微信公众号accessToken信息为空");
|
||||||
|
}
|
||||||
|
accessToken = officialAccountAccessToken.getAccessToken();
|
||||||
|
//存入Redis中
|
||||||
|
redisTemplate.opsForValue().set(accessTokenRedisKey, accessToken, 3600, TimeUnit.SECONDS);
|
||||||
|
} else {
|
||||||
|
accessToken = (String) object;
|
||||||
|
}
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信公众号模板消息发送
|
||||||
|
*/
|
||||||
|
public void sendOfficialAccountTemplateMessage() {
|
||||||
|
//获取微信公众号的accessToken
|
||||||
|
String accessToken = this.getWeChatOfficialAccountAccessToken();
|
||||||
|
//定义模板内容,公众模板内容
|
||||||
|
Map<String, Object> paramsMap = new LinkedHashMap<>();
|
||||||
|
paramsMap.put("touser", "oSwvX5qknp3DrAXfBgFjoMvG6WCI");
|
||||||
|
paramsMap.put("template_id", "WUCYtSbH-QFRV_fMcfmn86QLsz1zo881QW7fQNTWOjc");
|
||||||
|
//微信小程序跳转内容
|
||||||
|
Map<String, Object> miniprogramMap = new LinkedHashMap<>();
|
||||||
|
miniprogramMap.put("appid", "wxdc32268eca6b78f9");
|
||||||
|
miniprogramMap.put("pagepath", "pages/startup/startup");
|
||||||
|
//微信小程序模板data内容
|
||||||
|
Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||||
|
dataMap.put("phrase7", new MessageValueEntity("泉医陪护"));
|
||||||
|
dataMap.put("character_string3", new MessageValueEntity("000026315412331612100"));
|
||||||
|
dataMap.put("time6", new MessageValueEntity("2024-03-25 16:21:32"));
|
||||||
|
dataMap.put("time10", new MessageValueEntity("2024-03-27 10:00:00"));
|
||||||
|
dataMap.put("thing11", new MessageValueEntity("济南市槐荫区首诺城市之光东座22楼E10"));
|
||||||
|
paramsMap.put("miniprogram", miniprogramMap);
|
||||||
|
paramsMap.put("data", dataMap);
|
||||||
|
//拼接请求地址并发送
|
||||||
|
String messageUrl = Constants.OFFICIAL_ACCOUNT_TEMPLATE_SEND_URL + accessToken;
|
||||||
|
String param = JSON.toJSONString(paramsMap);
|
||||||
|
String result = HttpUtils.sendPostJson(messageUrl, param);
|
||||||
|
//返回参数映射
|
||||||
|
AccessToken errCode = JSON.parseObject(result, AccessToken.class);
|
||||||
|
if (Objects.nonNull(errCode) && Objects.nonNull(errCode.getErrcode())) {
|
||||||
|
switch (errCode.getErrcode()) {
|
||||||
|
case Constants.SUCCESS_ERROR_CODE:
|
||||||
|
log.info("发送消息成功!");
|
||||||
|
break;
|
||||||
|
case Constants.INVALID_CREDENTIAL_ACCESS_TOKEN_ISINVALID_OR_NOT_LATEST:
|
||||||
|
log.error("取 access_token 时 AppSecret 错误,或者 access_token 无效!");
|
||||||
|
break;
|
||||||
|
case Constants.INVALID_OPENID:
|
||||||
|
log.error("不合法的 OpenId!");
|
||||||
|
break;
|
||||||
|
case Constants.INVALID_ACCESS_TOKEN:
|
||||||
|
log.error("合法的 access_token!");
|
||||||
|
break;
|
||||||
|
case Constants.INVALID_TEMPLATE_ID:
|
||||||
|
log.error("不合法的 template_id!");
|
||||||
|
break;
|
||||||
|
case Constants.ARGUMENT_INVALID:
|
||||||
|
log.error("参数无效!");
|
||||||
|
break;
|
||||||
|
case Constants.DENY_SUBSCRIPTION:
|
||||||
|
log.error("用户拒接订阅!");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.xinelu.mobile.utils;
|
||||||
|
|
||||||
|
import org.simpleframework.xml.Serializer;
|
||||||
|
import org.simpleframework.xml.core.Persister;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description Xml格式数据工具类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-21 10:22:34
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public class XmlUtil {
|
||||||
|
/**
|
||||||
|
* Xml数据转换
|
||||||
|
*
|
||||||
|
* @param xml 数据格式
|
||||||
|
* @param objClass 要转换的类
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
public static Object fromXml(String xml, Class objClass) {
|
||||||
|
Serializer serializer = new Persister();
|
||||||
|
try {
|
||||||
|
return serializer.read(objClass, xml);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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 = 1500711025576966938L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@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 = -4591923245411784629L;
|
||||||
|
/**
|
||||||
|
* 模板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 = -2068512537328225075L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@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 = -2104837918391487594L;
|
||||||
|
/**
|
||||||
|
* 模板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 = -8280763002307815282L;
|
||||||
|
/**
|
||||||
|
* 信息集合
|
||||||
|
*/
|
||||||
|
@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 = 7102691058196437738L;
|
||||||
|
/**
|
||||||
|
* 小程序账号
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.xinelu.mobile.vo.wechatofficialaccountcallback;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.simpleframework.xml.Element;
|
||||||
|
import org.simpleframework.xml.Root;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 微信公众号模板消息事件推送实体类
|
||||||
|
* @Author 纪寒
|
||||||
|
* @Date 2024-03-25 13:36:17
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Root(name = "xml", strict = false)
|
||||||
|
@Data
|
||||||
|
public class WeChatOfficialAccountEventPushVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 4329284826265109369L;
|
||||||
|
/**
|
||||||
|
* 公众号微信号
|
||||||
|
*/
|
||||||
|
@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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
@Element(name = "MsgID", required = false)
|
||||||
|
private String msgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送状态为,成功:success,用户拒绝接收:failed:user block,发送失败(非用户拒绝):failed:system failed
|
||||||
|
*/
|
||||||
|
@Element(name = "Status", required = false)
|
||||||
|
private String status;
|
||||||
|
}
|
||||||
@ -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