Browse Source

修改微信下发

guozx 3 years ago
parent
commit
b25f694b25

+ 3 - 3
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/entry/TemplateEntry.java

@@ -26,7 +26,7 @@ public class TemplateEntry {
     /**
      * 模板内容
      */
-    private HashMap<String, String> data;
+    private HashMap<String, ValEntry> data;
 
     public String getTemplate_id() {
         return template_id;
@@ -68,11 +68,11 @@ public class TemplateEntry {
         this.touser = touser;
     }
 
-    public HashMap<String, String> getData() {
+    public HashMap<String, ValEntry> getData() {
         return data;
     }
 
-    public void setData(HashMap<String, String> data) {
+    public void setData(HashMap<String, ValEntry> data) {
         this.data = data;
     }
 }

+ 17 - 0
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/entry/ValEntry.java

@@ -0,0 +1,17 @@
+package com.jihengbel.intelligent.applicationtask.entry;
+
+public class ValEntry {
+
+    public ValEntry(String value){
+        this.value=value;
+    }
+
+    private String value;
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 1 - 1
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/init/OnsiteRemindJob.java

@@ -256,7 +256,7 @@ public class OnsiteRemindJob implements Job {
                         SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
                         //发送微信消息
                         SendMsgReq sendMsgReq = new SendMsgReq();
-                        sendMsgReq.setToUserId(userid);
+                        sendMsgReq.setToUserId(userid);//351L
                         sendMsgReq.setTitle("提醒执行计划");
                         sendMsgReq.setContent("您有待提醒的执行计划,请登录小程序查看【计划提醒】");
                         sendMsgReq.setEndTime(ft.format(date));

+ 6 - 0
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/init/TimerTaskInit.java

@@ -1,6 +1,7 @@
 package com.jihengbel.intelligent.applicationtask.init;
 
 import com.jihengbel.intelligent.applicationtask.service.FirstTaskService;
+import com.jihengbel.intelligent.applicationtask.service.MsgService;
 import com.jihengbel.intelligent.applicationtask.service.OnsiteTaskService;
 import org.quartz.Scheduler;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,11 +38,16 @@ public class TimerTaskInit implements CommandLineRunner {
     @Autowired
     SchedulerFactoryBean schedulerFactoryBean;
 
+    @Autowired
+    MsgService msgService;
+
+
     @Override
     public void run(String... args) throws Exception {
         ConcurrentMap<String, Object> param = new ConcurrentHashMap<String, Object>();
         param.put("onsiteTaskService", onsiteTaskService);
         param.put("firstTaskService", firstTaskService);
+        param.put("msgService", msgService);
         Scheduler sche = schedulerFactoryBean.getScheduler();
         addAutoApproveErrorTask(param, sche);
         addOnsiteTask(param, sche);

+ 6 - 5
application-task/src/main/java/com/jihengbel/intelligent/applicationtask/service/impl/MsgServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.jihengbel.intelligent.applicationtask.common.HttpCilentUntil;
 import com.jihengbel.intelligent.applicationtask.entry.SendMsgReq;
 import com.jihengbel.intelligent.applicationtask.entry.TemplateEntry;
+import com.jihengbel.intelligent.applicationtask.entry.ValEntry;
 import com.jihengbel.intelligent.applicationtask.model.UserMapper;
 import com.jihengbel.intelligent.applicationtask.service.MsgService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,11 +48,11 @@ public class MsgServiceImpl implements MsgService {
             params.put("appid", appid);
             params.put("grant_type", "client_credential");
 
-            HashMap<String, String> dataMap = new HashMap();
-            dataMap.put("thing1", sendMsgReq.getContent());
-            dataMap.put("thing2", sendMsgReq.getTitle());
-            dataMap.put("time3", sendMsgReq.getEndTime());
-            dataMap.put("thing4", "智云工厂系统");
+            HashMap<String, ValEntry> dataMap = new HashMap();
+            dataMap.put("thing1", new ValEntry(sendMsgReq.getContent()));
+            dataMap.put("thing2", new ValEntry(sendMsgReq.getTitle()));
+            dataMap.put("time3", new ValEntry(sendMsgReq.getEndTime()));
+            dataMap.put("thing4",  new ValEntry("智云工厂系统"));
 
             String openId = userMapper.getOpenIdByUserId(sendMsgReq.getToUserId());
             TemplateEntry template = new TemplateEntry();