|
@ -22,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@ -153,6 +154,20 @@ public class MessageUtil {
|
|
|
}
|
|
|
|
|
|
//推送模板消息
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param wechatId
|
|
|
* @param templateName
|
|
|
* @param scene
|
|
|
* @param openId
|
|
|
* @param first
|
|
|
* @param url 跳转链接
|
|
|
* @param remark
|
|
|
* @param type 模板通知类型
|
|
|
* @param josn 用于对跳转连接的修改,手动传入url时 该值不传
|
|
|
* @param keywords
|
|
|
*/
|
|
|
public void putTemplateWxMessage(String wechatId, String templateName, String scene, String openId, String first,String url, String remark, Integer type,JSONObject josn,String ...keywords) {
|
|
|
try {
|
|
|
System.out.println(wechatId);
|
|
@ -167,7 +182,9 @@ public class MessageUtil {
|
|
|
logger.info("wx_access_token表获取为空,wechatId" + wechatId);
|
|
|
return;
|
|
|
}
|
|
|
WxTemplateConfigDO newConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
|
|
|
WxTemplateConfigDO templateConfig = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, templateName, scene, 1);
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
BeanUtils.copyProperties(templateConfig,newConfig);
|
|
|
if (newConfig == null) {
|
|
|
logger.info("微信模板不存在!请确认wechatId:" + wechatId + ",templateName:" + templateName + ",scene:" + scene);
|
|
|
return;
|
|
@ -177,7 +194,7 @@ public class MessageUtil {
|
|
|
newConfig.setFirst(first);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(url)){
|
|
|
newConfig.setUrl(url);
|
|
|
newConfig.setUrl(url);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(remark)){
|
|
|
newConfig.setRemark(remark);
|
|
@ -229,7 +246,7 @@ public class MessageUtil {
|
|
|
}
|
|
|
|
|
|
public WxTemplateConfigDO setTemPlateUrl(WxTemplateConfigDO wxTemplateConfigDO,Integer type,String openid,JSONObject json){
|
|
|
String url = server_url + "wx/html/";
|
|
|
String url = server_url + "taian-wx/html/";
|
|
|
if (json==null){
|
|
|
return wxTemplateConfigDO;
|
|
|
}
|
|
@ -244,17 +261,17 @@ public class MessageUtil {
|
|
|
wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?resultCode=" + json.getString("resultCode"));
|
|
|
}
|
|
|
}
|
|
|
if (type==31){ //上门服务医生评分 //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
|
|
|
if (type==31){ //上门服务医生评分 //
|
|
|
wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl()+"?openid=" + openid + "&id=" + json.getString("id")+ "&finish=" + json.getString("finish"));
|
|
|
}
|
|
|
if(type==32){ //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
|
|
|
if(type==32){ //
|
|
|
String url1 = server_url + "wx/common/";
|
|
|
wxTemplateConfigDO.setUrl(url1 + wxTemplateConfigDO.getUrl()+"?openid=" + openid + "&consult=" + json.getString("consult") + "&status=" + json.getInteger("status"));
|
|
|
}
|
|
|
if(type==34){ //TPbq9m0SAiVfRhXtXq17SDmYIfrJ8Whp2NpSrq9wlfI
|
|
|
if(type==34){ //居民授权电子健康卡
|
|
|
wxTemplateConfigDO.setUrl(url + wxTemplateConfigDO.getUrl() + "?openid=" + openid + "&orderId=" + json.get("orderId")+ "&authorizeImage=" + json.getString("authorizeImage"));
|
|
|
}
|
|
|
if (type==19){ //zSR9w5AjfZFLc_g8AxGBvDKZASoKAeXQuGnvPAQzvps
|
|
|
if (type==19){ //
|
|
|
String urlStr= wxTemplateConfigDO.getUrl();
|
|
|
boolean status = urlStr.contains("openid=");
|
|
|
if(!status){
|
|
@ -262,6 +279,7 @@ public class MessageUtil {
|
|
|
}
|
|
|
wxTemplateConfigDO.setUrl(url + urlStr );
|
|
|
}
|
|
|
// if (type==)
|
|
|
return wxTemplateConfigDO;
|
|
|
}
|
|
|
|