Browse Source

'调整推送微信字段格式'

james 11 months ago
parent
commit
8fbbad1787

+ 8 - 7
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/WeChatController.java

@@ -16,6 +16,7 @@ import com.usky.iot.domain.SysWxOpuser;
 import com.usky.iot.service.SysWxOpuserService;
 import com.usky.iot.service.vo.SendWeChatMessageRequestVO;
 import com.usky.iot.service.vo.SignUpRequestVO;
+import com.usky.iot.service.vo.TemplateData;
 import com.usky.iot.service.vo.TemplateMsgEntityVO;
 import lombok.extern.slf4j.Slf4j;
 import ma.glasnost.orika.impl.util.StringUtil;
@@ -356,13 +357,13 @@ public class WeChatController {
 
         String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="  + token;
         Map<String,Object> content=new HashMap<>();
-        JSONObject data = new JSONObject();
-        data.put("first",new JSONObject().put("value",messageVo.getTTitle()));
-        data.put("keyword1",new JSONObject().put("value",messageVo.getTKeyword1()));
-        data.put("keyword2",new JSONObject().put("value",messageVo.getTKeyword2()));
-        data.put("keyword3",new JSONObject().put("value",messageVo.getTKeyword3()));
-        data.put("keyword4",new JSONObject().put("value",messageVo.getTKeyword4()));
-        data.put("remark",new JSONObject().put("value",messageVo.getTRemark()));
+        Map<String, TemplateData> data = new HashMap<>();
+        data.put("first",new TemplateData(messageVo.getTTitle()));
+        data.put("keyword1",new TemplateData(messageVo.getTKeyword1()));
+        data.put("keyword2",new TemplateData(messageVo.getTKeyword2()));
+        data.put("keyword3",new TemplateData(messageVo.getTKeyword3()));
+        data.put("keyword4",new TemplateData(messageVo.getTKeyword4()));
+        data.put("remark",new TemplateData(messageVo.getTRemark()));
 
         content.put("touser",openId);
         content.put("url",messageVo.getTUrl());

+ 10 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/vo/TemplateData.java

@@ -0,0 +1,10 @@
+package com.usky.iot.service.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+@AllArgsConstructor
+@Data
+public class TemplateData {
+    private String value;
+}