|
@ -29,6 +29,8 @@ public class WeiXinEventProcess {
|
|
|
|
|
|
@Value("${wechat.id}")
|
|
|
private String wechatId;
|
|
|
@Value("${wechat.appId}")
|
|
|
private String appId;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
|
|
@ -49,9 +51,9 @@ public class WeiXinEventProcess {
|
|
|
if (message.containsKey("EventKey") && StringUtils.isNotEmpty(message.get("EventKey")) && message.containsKey("Ticket")
|
|
|
&& StringUtils.isNotEmpty(message.get("Ticket"))) {
|
|
|
result = scanEventProcess(message);
|
|
|
} /*else {
|
|
|
} else {
|
|
|
result = subscribeEventProcess(message);
|
|
|
}*/
|
|
|
}
|
|
|
break;
|
|
|
/*case WeiXinMessageUtils.EVENT_TYPE_UNSUBSCRIBE: // 取消订阅事件
|
|
|
result = unsubscribeEventProcess(message);
|
|
@ -65,6 +67,24 @@ public class WeiXinEventProcess {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 关注事件消息构建回复消息体(图文消息xml,模板消息json串)
|
|
|
*
|
|
|
* @param message
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private String subscribeEventProcess(Map<String, String> message) throws Exception {
|
|
|
String result = "";
|
|
|
// 场景值
|
|
|
String eventKey = message.get("EventKey");
|
|
|
List<Map<String, String>> articles = new ArrayList<>();
|
|
|
setUrlItems(articles);
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 微信扫码事件处理(封装图文消息体)
|
|
|
*
|
|
@ -93,17 +113,11 @@ public class WeiXinEventProcess {
|
|
|
}
|
|
|
// 医生二维码跳转URL
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
url = "https://intel.yanketong.com/ims-wx/#/doctorInfo?doctorCode="+keys[0];
|
|
|
picUrl = "https://intel.yanketong.com/"+picUrl;
|
|
|
article.put("Url", url);
|
|
|
article.put("Title", keys[1] + "医生个人诊间");
|
|
|
article.put("Description", "厦门眼科中心医院互联网医院");
|
|
|
article.put("PicUrl", picUrl);
|
|
|
articles.add(article);
|
|
|
}else {
|
|
|
url = "https://intm/ims-wx/#/doctorInfo?doctorCode="+keys[0];
|
|
|
picUrl = "https://im/"+picUrl;
|
|
|
article.put("Url", url);
|
|
|
article.put("Title", keys[1] + "医生个人诊间");
|
|
|
article.put("Description", "海沧医院互联网医院");
|
|
|
article.put("Description", "医养云照护");
|
|
|
article.put("PicUrl", picUrl);
|
|
|
articles.add(article);
|
|
|
}
|
|
@ -122,5 +136,46 @@ public class WeiXinEventProcess {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置微信公共的图文消息
|
|
|
*
|
|
|
* @param articles
|
|
|
*/
|
|
|
public void setUrlItems(List<Map<String, String>> articles) {
|
|
|
Map<String, String> articleBooking = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlBooking = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2Fhome%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
|
|
urlBooking = urlBooking.replace("{appId}", appId);
|
|
|
articleBooking.put("Url", urlBooking);
|
|
|
articleBooking.put("Title", "你好啊,欢迎来到朝晖云照护!");
|
|
|
articleBooking.put("Description", "这里是智慧养老和健康管理服务社区+幼儿成长教育服务平台\n" +
|
|
|
"我们陪你一起,关爱老人,呵护孩子!\n" +
|
|
|
"感谢关注,点击下方菜单直接进入朝晖云照护平台");
|
|
|
articleBooking.put("PicUrl", "http://hzijk.cityihealth.com/image/index.png");
|
|
|
|
|
|
articles.add(articleBooking);
|
|
|
|
|
|
Map<String, String> articleDevice = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlDevice = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FonlineRegistration%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
|
|
urlDevice = urlDevice.replace("{appId}", appId);
|
|
|
articleDevice.put("Url", urlDevice);
|
|
|
articleDevice.put("Title", "在线入园");
|
|
|
articleDevice.put("Description", "申请专业托育机构入园资格");
|
|
|
articleDevice.put("PicUrl", "http://hzijk.cityihealth.com/image/doorCoach.png");
|
|
|
|
|
|
articles.add(articleDevice);
|
|
|
|
|
|
Map<String, String> articleFamily = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri=http%3A%2F%2Fhzijk.cityihealth.com%2Fmedical-care-patient%2FlifeCare%2Findex&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
|
|
urlFamily = urlFamily.replace("{appId}", appId);
|
|
|
articleFamily.put("Url", urlFamily);
|
|
|
articleFamily.put("Title", "上门预约");
|
|
|
articleFamily.put("Description", "预约幼儿教育专家上门育儿指导");
|
|
|
articleFamily.put("PicUrl", "http://hzijk.cityihealth.com/image/online.png");
|
|
|
|
|
|
articles.add(articleFamily);
|
|
|
}
|
|
|
|
|
|
}
|