Commit 45b721e1 authored by Shen's avatar Shen

1. 机构移动端派单添加服务人员消息推送

parent 750025ed
......@@ -21,4 +21,6 @@ public class WechatAccountConfig {
private String templateId;
private String serviceTemplateId;
}
......@@ -202,6 +202,7 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
pensionOrderEntity.setOrderRecipientPhone(recipient.getMobile());
pensionOrderEntity.setOrderRecipientTime(new Date());
update(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class));
pushMessage.sendServiceWeChatMsg(ConvertUtils.sourceToTarget(pensionOrderEntity, PensionOrderDTO.class), recipient.getOpenid());
}else {
return false;
}
......
......@@ -6,6 +6,8 @@ public interface PushMessage {
void sendWeChatMsg(PensionOrderDTO pensionOrderDTO, String openId, String flag);
void sendServiceWeChatMsg(PensionOrderDTO pensionOrderDTO, String openId);
void sendSMSMsg(PensionOrderDTO pensionOrderDTO, String receiver);
}
......@@ -69,6 +69,34 @@ public class PushMessageImpl implements PushMessage {
}
}
@Override
public void sendServiceWeChatMsg(PensionOrderDTO pensionOrderDTO, String openId) {
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
templateMessage.setTemplateId(wechatAccountConfig.getServiceTemplateId());
templateMessage.setToUser(openId);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm");
String appointmentTime = sdf.format(pensionOrderDTO.getAppointmentTime());
List<WxMpTemplateData> data = Arrays.asList(
new WxMpTemplateData("first", "【智慧养老】您的服务单提醒"),
new WxMpTemplateData("keyword1", pensionOrderDTO.getAppointmentPerson() + " - "+ pensionOrderDTO.getAppointmentPhone()),
new WxMpTemplateData("keyword2", appointmentTime),
new WxMpTemplateData("keyword3", pensionOrderDTO.getAddress()),
new WxMpTemplateData("keyword4", pensionOrderDTO.getServiceName()),
new WxMpTemplateData("keyword5", pensionOrderDTO.getRemark()),
new WxMpTemplateData("remark", "当前状态:" + pensionOrderDTO.getStatusName())
);
templateMessage.setData(data);
String url = SYSURL + "/#/orderDetail/?openid=" + openId + "&id=" + pensionOrderDTO.getId()+"&flag=attendant";
templateMessage.setUrl(url);
try{
wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
}catch (WxErrorException e){
log.error("【微信模板消息】发送失败,{}", e);
}
}
@Override
public void sendSMSMsg(PensionOrderDTO pensionOrderDTO, String receiver) {
try {
......
......@@ -83,4 +83,5 @@ wechat:
# mpAppId: wx6e3288074243a47f
mpAppSecret: f7b1120a49de078dd1be0080832ad42f
# mpAppSecret: 603d6ebf4db906bdb24eb9a1c0cbb444
templateId: gU3gtQxrwX0Z6khAL_9tuwzT83KlXk3oV6jbPNuNHbc
\ No newline at end of file
templateId: gU3gtQxrwX0Z6khAL_9tuwzT83KlXk3oV6jbPNuNHbc
serviceTemplateId: xAaQHjjq17i9ONly90rEXfdRj3yPQsjELRmFEUh4idQ
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment