|
@ -625,31 +625,38 @@ public class PatientDeviceService {
|
|
|
* @param type 1同意解绑,2不同意
|
|
|
*/
|
|
|
public void sendWxMessage(DevicePatientDevice patientDevice, int type) {
|
|
|
BasePatientDO patient = patientDao.findById(patientDevice.getUser()).orElse(null);
|
|
|
WxTemplateConfigDO templateConfig = null;
|
|
|
//判断是同意解绑还是拒绝解绑
|
|
|
if(type == 1){
|
|
|
templateConfig = wxMessageUtil.findByWechatIdAndTemplateNameAndSceneAndStatus(null,"template_process_feedback","unbind",1);
|
|
|
}else if(type == 2) {
|
|
|
templateConfig = wxMessageUtil.findByWechatIdAndTemplateNameAndSceneAndStatus(null,"template_process_feedback", "refuse",1);
|
|
|
}
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
BeanUtils.copyProperties(templateConfig,newConfig);
|
|
|
String first = newConfig.getFirst();
|
|
|
first = first.replace("key1", patientDevice.getDeviceName());
|
|
|
String keyword2 = newConfig.getKeyword2();
|
|
|
if(keyword2.contains("key2")){
|
|
|
keyword2 = keyword2.replace("key2", patientDevice.getRefuseReason());
|
|
|
}
|
|
|
newConfig.setFirst(first);
|
|
|
newConfig.setKeyword2(keyword2);
|
|
|
newConfig.setKeyword1(DateUtil.dateToStrShort(new Date()));
|
|
|
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
json.put("deviceId", patientDevice.getCategoryCode());
|
|
|
json.put("id", patientDevice.getId());
|
|
|
if(patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
|
|
|
wxMessageUtil.putWxMsg(null, patient.getOpenid(),newConfig, 33, json);
|
|
|
try {
|
|
|
BasePatientDO patient = patientDao.findById(patientDevice.getUser()).orElse(null);
|
|
|
WxTemplateConfigDO templateConfig = null;
|
|
|
//判断是同意解绑还是拒绝解绑
|
|
|
if(type == 1){
|
|
|
templateConfig = wxMessageUtil.findByWechatIdAndTemplateNameAndSceneAndStatus(null,"template_process_feedback","unbind",1);
|
|
|
}else if(type == 2) {
|
|
|
templateConfig = wxMessageUtil.findByWechatIdAndTemplateNameAndSceneAndStatus(null,"template_process_feedback", "refuse",1);
|
|
|
}
|
|
|
if(templateConfig==null){
|
|
|
return;
|
|
|
}
|
|
|
WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
|
|
|
BeanUtils.copyProperties(templateConfig,newConfig);
|
|
|
String first = newConfig.getFirst();
|
|
|
first = first.replace("key1", patientDevice.getDeviceName());
|
|
|
String keyword2 = newConfig.getKeyword2();
|
|
|
if(keyword2.contains("key2")){
|
|
|
keyword2 = keyword2.replace("key2", patientDevice.getRefuseReason());
|
|
|
}
|
|
|
newConfig.setFirst(first);
|
|
|
newConfig.setKeyword2(keyword2);
|
|
|
newConfig.setKeyword1(DateUtil.dateToStrShort(new Date()));
|
|
|
com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
|
|
|
|
|
|
json.put("deviceId", patientDevice.getCategoryCode());
|
|
|
json.put("id", patientDevice.getId());
|
|
|
if(patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
|
|
|
wxMessageUtil.putWxMsg(null, patient.getOpenid(),newConfig, 33, json);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|