|
@ -55,24 +55,116 @@ public class WeiXinEventProcess {
|
|
|
String result = "";
|
|
|
if(message.get("EventKey").equals("caozuoshuoming")){
|
|
|
|
|
|
String tempStr = subscribeEventProcess(message);
|
|
|
int firsIndex = tempStr.indexOf("<item>");
|
|
|
String tempStr = clickEventProcess(message);
|
|
|
/*int firsIndex = tempStr.indexOf("<item>");
|
|
|
String result1 = tempStr.substring(0,firsIndex-1);
|
|
|
int secondIndex = tempStr.indexOf("<item>",firsIndex+10);
|
|
|
String result2 = tempStr.substring(secondIndex-1);
|
|
|
result=(result1+result2).replace("<ArticleCount>5</ArticleCount>","<ArticleCount>4</ArticleCount>");
|
|
|
String result2 = tempStr.substring(secondIndex-1);*/
|
|
|
result=tempStr.replace("<ArticleCount>5</ArticleCount>","<ArticleCount>4</ArticleCount>");
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 关注事件消息发送
|
|
|
* 菜单点击消息发送
|
|
|
*
|
|
|
* @param message
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private static String clickEventProcess(Map<String,String> message) throws Exception{
|
|
|
String result = "";
|
|
|
// 配置信息
|
|
|
Properties systemConf = SystemConf.getInstance().getSystemProperties();
|
|
|
// 图文信息
|
|
|
List<Map<String,String>> articles = new ArrayList<>();
|
|
|
|
|
|
|
|
|
Map<String,String> articleConsult = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlConsult = systemConf.getProperty("patient_consult_url");
|
|
|
// 图文消息图片URL
|
|
|
String picUrlConsult = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
|
// URL设置服务器URL、AppId
|
|
|
urlConsult = urlConsult.replace("{server}", systemConf.getProperty("wechat_base_url"))
|
|
|
.replace("{appId}", systemConf.getProperty("appId"));
|
|
|
//图片地址
|
|
|
picUrlConsult = picUrlConsult.replace("{server}", systemConf.getProperty("server_url"));
|
|
|
|
|
|
articleConsult.put("Url",urlConsult);
|
|
|
articleConsult.put("Title", "医生咨询功能使用说明");
|
|
|
articleConsult.put("Description","功能使用说明");
|
|
|
articleConsult.put("PicUrl",picUrlConsult);
|
|
|
|
|
|
articles.add(articleConsult);
|
|
|
|
|
|
Map<String,String> articleBooking = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlBooking = systemConf.getProperty("patient_booking_url");
|
|
|
// 图文消息图片URL
|
|
|
String picUrlBooking = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
|
// URL设置服务器URL、AppId
|
|
|
urlBooking = urlBooking.replace("{server}", systemConf.getProperty("wechat_base_url"))
|
|
|
.replace("{appId}", systemConf.getProperty("appId"));
|
|
|
//图片地址
|
|
|
picUrlBooking = picUrlBooking.replace("{server}", systemConf.getProperty("server_url"));
|
|
|
|
|
|
articleBooking.put("Url",urlBooking);
|
|
|
articleBooking.put("Title", "预约挂号功能使用说明");
|
|
|
articleBooking.put("Description","功能使用说明");
|
|
|
articleBooking.put("PicUrl",picUrlBooking);
|
|
|
|
|
|
articles.add(articleBooking);
|
|
|
|
|
|
Map<String,String> articleDevice = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlDevice = systemConf.getProperty("patient_device_url");
|
|
|
// 图文消息图片URL
|
|
|
String picUrlDevice = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
|
// URL设置服务器URL、AppId
|
|
|
urlDevice = urlDevice.replace("{server}", systemConf.getProperty("wechat_base_url"))
|
|
|
.replace("{appId}", systemConf.getProperty("appId"));
|
|
|
//图片地址
|
|
|
picUrlDevice = picUrlDevice.replace("{server}", systemConf.getProperty("server_url"));
|
|
|
|
|
|
articleDevice.put("Url",urlDevice);
|
|
|
articleDevice.put("Title", "体征设备管理功能使用说明");
|
|
|
articleDevice.put("Description","功能使用说明");
|
|
|
articleDevice.put("PicUrl",picUrlDevice);
|
|
|
|
|
|
articles.add(articleDevice);
|
|
|
|
|
|
Map<String,String> articleFamily = new HashMap<>();
|
|
|
// 图文URL
|
|
|
String urlFamily = systemConf.getProperty("patient_family_url");
|
|
|
// 图文消息图片URL
|
|
|
String picUrlFamily = systemConf.getProperty("patient_operatinginstrutions_pic_url");
|
|
|
// URL设置服务器URL、AppId
|
|
|
urlFamily = urlFamily.replace("{server}", systemConf.getProperty("wechat_base_url"))
|
|
|
.replace("{appId}", systemConf.getProperty("appId"));
|
|
|
//图片地址
|
|
|
picUrlFamily = picUrlFamily.replace("{server}", systemConf.getProperty("server_url"));
|
|
|
|
|
|
articleFamily.put("Url",urlFamily);
|
|
|
articleFamily.put("Title", "我的家庭功能使用说明");
|
|
|
articleFamily.put("Description","功能使用说明");
|
|
|
articleFamily.put("PicUrl",picUrlFamily);
|
|
|
|
|
|
articles.add(articleFamily);
|
|
|
|
|
|
// 构建回复消息XML
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 关注事件消息发送
|
|
|
* @param message
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private static String subscribeEventProcess(Map<String,String> message) throws Exception{
|
|
|
String result = "";
|
|
|
// 配置信息
|
|
@ -173,13 +265,6 @@ public class WeiXinEventProcess {
|
|
|
// 构建回复消息XML
|
|
|
result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"),message.get("ToUserName"),articles);
|
|
|
|
|
|
/*String tempStr = result;
|
|
|
int firsIndex = tempStr.indexOf("<item>");
|
|
|
String result1 = tempStr.substring(0,firsIndex-1);
|
|
|
int secondIndex = tempStr.indexOf("<item>",firsIndex+10);
|
|
|
String result2 = tempStr.substring(secondIndex-1);
|
|
|
result=(result1+result2).replace("<ArticleCount>5</ArticleCount>","<ArticleCount>4</ArticleCount>");*/
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|