消息通知修改

This commit is contained in:
zhangheng 2024-08-02 16:01:26 +08:00
parent ce46a17bc9
commit d9a5c415ee

View File

@ -192,14 +192,21 @@ public class WeChatOfficialAccountUtils {
*/
public Integer sendAppletTemplateMessage(PatientVO patientVO) {
//微信模版组装
String thing5 = "每日阅读有助于了解当前情况哦";
String thing1 = "新入院注意事项指导、术前须知";
List<TemplateContent> templateContents = JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class);
if (CollectionUtils.isNotEmpty(templateContents)) {
TemplateContent templateContent = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing5".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing5 = templateContent.getValue();
TemplateContent templateContentTwo = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing1".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing1 = templateContentTwo.getValue();
List<TemplateContent> templateContents = new ArrayList<>();
String thing5 = null;
String thing1 = null;
try {
//判断推送内容格式是否符合
templateContents = JSON.parseArray(patientVO.getAppletNodeContent(), TemplateContent.class);
if (CollectionUtils.isNotEmpty(templateContents)) {
TemplateContent templateContent = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing5".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing5 = templateContent.getValue();
TemplateContent templateContentTwo = templateContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getName()) && Objects.nonNull(item.getValue()) && "thing1".equals(item.getName())).findFirst().orElse(new TemplateContent());
thing1 = templateContentTwo.getValue();
}
} catch (Exception e) {
thing5 = "每日阅读有助于了解当前情况哦";
thing1 = "新入院注意事项指导、术前须知";
}
//获取微信小程序的accessToken
String accessToken = this.getWeChatAppletAccessToken();
@ -209,7 +216,7 @@ public class WeChatOfficialAccountUtils {
paramsMap.put("template_id", weChatAppletChatConfig.getHealthyPropagandaId());
//跳转小程序类型developer为开发版trial为体验版formal为正式版默认为正式版
//paramsMap.put("miniprogram_state", "developer");
paramsMap.put("page", "pages/propaganda/propaganda?manageRouteNodeId="+patientVO.getSignPatientManageRouteNodeId());
paramsMap.put("page", "pages/pushDetails/pushDetails?manageRouteNodeId=" + patientVO.getSignPatientManageRouteNodeId());
Map<String, Object> dataMap = new LinkedHashMap<>();
dataMap.put("thing5", new MessageValueEntity(thing5));
dataMap.put("thing4", new MessageValueEntity(patientVO.getHospitalAgencyName()));