|
@ -29,6 +29,16 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 个体推送及微信模板接口
|
|
|
|
* ·配置及调用微信模板流程:
|
|
|
|
* 1.配置yml对应的模板ID ,再此类中注入实体
|
|
|
|
* 2.新增模板枚举类型enum pushType
|
|
|
|
* 3.新增枚举与模板映射关系
|
|
|
|
* 4.调用putWxMsg(WechatMsgVo wx)发送微信模板消息
|
|
|
|
* ·个推系统消息:
|
|
|
|
* 1.调用put方法即可.
|
|
|
|
*/
|
|
@Component
|
|
@Component
|
|
public class PushMsgTask {
|
|
public class PushMsgTask {
|
|
|
|
|
|
@ -45,24 +55,34 @@ public class PushMsgTask {
|
|
@Value("${putMesType.wechat}")
|
|
@Value("${putMesType.wechat}")
|
|
private String putMesType;
|
|
private String putMesType;
|
|
|
|
|
|
//模板id
|
|
|
|
|
|
//===微信模板配置流程:1.配置yml对应模板ID====
|
|
@Value("${wechat.message.template_consult_notice}")
|
|
@Value("${wechat.message.template_consult_notice}")
|
|
private String template_consult_notice;
|
|
private String template_consult_notice;
|
|
@Value("${wechat.message.template_health_notice}")
|
|
@Value("${wechat.message.template_health_notice}")
|
|
private String template_health_notice;
|
|
private String template_health_notice;
|
|
|
|
|
|
|
|
@Value("${wechat.message.template_healthy_article}")
|
|
|
|
private String template_healthy_article;
|
|
|
|
@Value("${wechat.message.information_change_notice}")
|
|
|
|
private String information_change_notice;
|
|
|
|
@Value("${wechat.message.feedback_processing_notice}")
|
|
|
|
private String feedback_processing_notice;
|
|
|
|
//=======微信模板配置流程=======================
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private WechatPushLogDao wechatPushLogDao;
|
|
private WechatPushLogDao wechatPushLogDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 微信推送类型枚举
|
|
|
|
|
|
* 微信模板配置流程:
|
|
|
|
* 2.微信推送类型枚举
|
|
* 新增模板在此添加枚举类型
|
|
* 新增模板在此添加枚举类型
|
|
*/
|
|
*/
|
|
public enum pushType{
|
|
public enum pushType{
|
|
|
|
|
|
|
|
//dome,根据实际情况配置相应模板
|
|
consult("咨询回复",1),
|
|
consult("咨询回复",1),
|
|
health_education("健康教育",2);
|
|
|
|
|
|
health_education("健康教育",2),
|
|
|
|
healthy_article("患教通知",3),
|
|
|
|
change_notice("信息变更",4),
|
|
|
|
feedback_processing("反馈处理",5);
|
|
|
|
|
|
private String name;
|
|
private String name;
|
|
private int value;
|
|
private int value;
|
|
@ -70,7 +90,6 @@ public class PushMsgTask {
|
|
this.name = name;
|
|
this.name = name;
|
|
this.value = value;
|
|
this.value = value;
|
|
}
|
|
}
|
|
|
|
|
|
public String getName() {
|
|
public String getName() {
|
|
return name;
|
|
return name;
|
|
}
|
|
}
|
|
@ -90,8 +109,8 @@ public class PushMsgTask {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 通过类型获取模板
|
|
|
|
* 新增模板在此添加枚举类型与模板映射
|
|
|
|
|
|
* 微信模板配置流程:
|
|
|
|
* 3.通过类型获取模板,新增模板在此添加枚举类型与模板映射
|
|
* @param type
|
|
* @param type
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@ -101,6 +120,12 @@ public class PushMsgTask {
|
|
return template_consult_notice;
|
|
return template_consult_notice;
|
|
}else if(pushType.health_education.getValue()==type){
|
|
}else if(pushType.health_education.getValue()==type){
|
|
return template_health_notice;
|
|
return template_health_notice;
|
|
|
|
}else if(pushType.healthy_article.getValue()==type){
|
|
|
|
return template_healthy_article;
|
|
|
|
}else if(pushType.change_notice.getValue()==type){
|
|
|
|
return information_change_notice;
|
|
|
|
}else if(pushType.feedback_processing.getValue()==type){
|
|
|
|
return feedback_processing_notice;
|
|
}else {
|
|
}else {
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
@ -110,7 +135,8 @@ public class PushMsgTask {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 微信消息接口
|
|
|
|
|
|
* 微信模板调用接口
|
|
|
|
* 1.微信消息接口
|
|
*/
|
|
*/
|
|
public void putWxMsg(WechatMsgVo wx) {
|
|
public void putWxMsg(WechatMsgVo wx) {
|
|
try {
|
|
try {
|