Commit 4f9f73d8 authored by mlchun's avatar mlchun

1.添加微信消息模板推送

parent e60bcc72
...@@ -19,4 +19,6 @@ public class WechatAccountConfig { ...@@ -19,4 +19,6 @@ public class WechatAccountConfig {
private String mpAppSecret; private String mpAppSecret;
private String templateId;
} }
package io.hmit.service.impl; package io.hmit.service.impl;
import io.hmit.config.WeChatMpConfig;
import io.hmit.config.WechatAccountConfig;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.service.PushMessage; import io.hmit.service.PushMessage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -27,10 +29,13 @@ public class PushMessageImpl implements PushMessage { ...@@ -27,10 +29,13 @@ public class PushMessageImpl implements PushMessage {
@Autowired @Autowired
private WxMpService wxMpService; private WxMpService wxMpService;
@Autowired
private WechatAccountConfig wechatAccountConfig;
@Override @Override
public void sendMsg(PensionOrderDTO pensionOrderDTO, String openId) { public void sendMsg(PensionOrderDTO pensionOrderDTO, String openId) {
WxMpTemplateMessage templateMessage = new WxMpTemplateMessage(); WxMpTemplateMessage templateMessage = new WxMpTemplateMessage();
templateMessage.setTemplateId("GsGydVGl-vzOv5aA0LaIdA-FcMM88TEpe37U-lZ6HJ8"); templateMessage.setTemplateId(wechatAccountConfig.getTemplateId());
templateMessage.setToUser(openId); templateMessage.setToUser(openId);
List<WxMpTemplateData> data = Arrays.asList( List<WxMpTemplateData> data = Arrays.asList(
......
...@@ -76,4 +76,5 @@ QR: ...@@ -76,4 +76,5 @@ QR:
wechat: wechat:
mpAppId: wxfa2386639794d998 mpAppId: wxfa2386639794d998
mpAppSecret: 8f624f83c9585baa9d1697e24fdffd81 mpAppSecret: 8f624f83c9585baa9d1697e24fdffd81
\ No newline at end of file templateId: GsGydVGl-vzOv5aA0LaIdA-FcMM88TEpe37U-lZ6HJ8
\ 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