Browse Source

微信消息推送调整

dzx 5 tháng trước cách đây
mục cha
commit
2ea3d84d1b

+ 45 - 3
src/test/java/com/xjrsoft/module/job/AttendanceMessageTaskTest.java

@@ -86,6 +86,48 @@ class AttendanceMessageTaskTest {
     private IWechatMessageLogService wechatMessageLogService;
 
 
+    @Test
+    void test2(){
+        String  wechatTemplate = "o-KboOcqcJ3YpjPN2xwgM_NcjN-0yzwWlDDXYfTM0Q4";
+        WeChatSendMessageDto weChatSendMessageDto = new WeChatSendMessageDto();
+        weChatSendMessageDto.setTemplateId(wechatTemplate);
+        JSONObject paramJson = new JSONObject();
+
+        JSONObject thing6 = new JSONObject();
+        thing6.put("value", "教职工");
+        paramJson.put("thing6", thing6);
+
+        JSONObject time11 = new JSONObject();
+        time11.put("value", "2024-6-12 11:02:30");
+        paramJson.put("time11", time11);
+
+        JSONObject const23 = new JSONObject();
+        const23.put("value", "上午考勤");
+        paramJson.put("const23", const23);
+
+        JSONObject character_string18 = new JSONObject();
+        character_string18.put("value", "222");
+        paramJson.put("character_string18", character_string18);
+
+        JSONObject const3 = new JSONObject();
+        const3.put("value", "出勤率 99%");
+        paramJson.put("const3", const3);
+
+        weChatSendMessageDto.setContent(paramJson);
+        weChatSendMessageDto.setUrl(StrUtil.format("{}pages/attendance/teacher/index", commonPropertiesConfig.getDomainApp()));
+
+        List<String> userList = new ArrayList<>();
+        userList.add("oWZy-wec72H78ApagVBFomC5TNyw");
+        userList.add("oWZy-wUTki8Vi7ao3Wn5JGNDauVI");
+        for (String xjrUser : userList) {
+            weChatSendMessageDto.setMsgId(xjrUser);
+            weChatSendMessageDto.setUserId(xjrUser);
+            weChatService.sendTemplateMessage(weChatSendMessageDto);
+        }
+
+
+    }
+
     @Test
     void test(){
         doExecute();
@@ -111,9 +153,9 @@ class AttendanceMessageTaskTest {
                         .eq(WechatMessageLog::getSendTime, recentlyTime)
                         .eq(WechatMessageLog::getTemplateId, wechatTemplate)
         );
-        if(log != null){//已经推送过,不再进行推送
-            return;
-        }
+//        if(log != null){//已经推送过,不再进行推送
+//            return;
+//        }
 
         WechatMessageLog messageLog = new WechatMessageLog();
         messageLog.setTemplateId(wechatTemplate);