瀏覽代碼

增加发送记录提醒

xueyiming 7 月之前
父節點
當前提交
21fdd115df

+ 9 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComHistoryDataJob.java

@@ -123,6 +123,7 @@ public class WeComHistoryDataJob {
         for (Staff staff : staffList) {
             SendDetail sendDetail = new SendDetail();
             sendDetail.setRemark(staff.getRemark());
+            sendDetail.setStaffId(staff.getId());
             List<Long> countList = new ArrayList<>();
             for (Integer status : statusList) {
                 HistoryMessageExample example = new HistoryMessageExample();
@@ -149,6 +150,13 @@ public class WeComHistoryDataJob {
             Long notSentCount = sendCountList.get(0);
             if (notSentCount != 0) {
                 LarkRobotUtil.sendMessage("@薛一鸣 存在未发送记录,请检查");
+                if (sendDetail.getStaffId() == 3) {
+                    LarkRobotUtil.sendTipMessage("@王钧灏 存在未发送记录,请检查");
+                } else if (sendDetail.getStaffId() == 4) {
+                    LarkRobotUtil.sendTipMessage("@刘坤宇 存在未发送记录,请检查");
+                } else {
+                    LarkRobotUtil.sendTipMessage("@孟庆红 存在未发送记录,请检查");
+                }
             }
             stringBuilder.append("总发送数量:").append(count).append("   ");
             stringBuilder.append("未发送数量:").append(sendCountList.get(0)).append("   ");
@@ -158,6 +166,7 @@ public class WeComHistoryDataJob {
             stringBuilder.append("\n");
         }
         LarkRobotUtil.sendMessage(stringBuilder.toString());
+        LarkRobotUtil.sendTipMessage(stringBuilder.toString());
     }
 
     private void selectGroupMsgList(Long startTime, Long endTime, Long corpId, Long staffId) {

+ 2 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/bo/SendDetail.java

@@ -7,6 +7,8 @@ import java.util.List;
 @Data
 public class SendDetail {
 
+    private Long staffId;
+
     private String remark;
 
     private List<Long> sendCountList;

+ 19 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/utils/LarkRobotUtil.java

@@ -17,6 +17,8 @@ public class LarkRobotUtil {
 
     private static final String URL = "https://open.feishu.cn/open-apis/bot/v2/hook/93787b70-33d3-42c1-beae-c09310c9b38b";
 
+    private static final String TIP_URL = "https://open.feishu.cn/open-apis/bot/v2/hook/0eb8793a-5bb3-43d7-aa74-fed1c91e3d9b";
+
     private static final HttpPoolClientUtil HTTP_POOL_CLIENT_UTIL_DEFAULT = HttpClientUtil.create(3000, 10000, 20, 100, 3, 3000);
 
 
@@ -41,6 +43,23 @@ public class LarkRobotUtil {
         }
     }
 
+    public static void sendTipMessage(String msg) {
+        sendTipMessage("text", "企微推送结果:" + msg);
+    }
+
+    public static void sendTipMessage(String type, String msg) {
+        try {
+            JSONObject param = new JSONObject();
+            param.put("msg_type", type);
+            JSONObject content = new JSONObject();
+            content.put("text", msg);
+            param.put("content", content);
+            HTTP_POOL_CLIENT_UTIL_DEFAULT.post(TIP_URL, param.toJSONString());
+        } catch (Exception e) {
+            log.error("Lark sendMessage error", e);
+        }
+    }
+
     private static String getSign(long timestamp) throws NoSuchAlgorithmException, InvalidKeyException {
         //把timestamp+"\n"+密钥当做签名字符串
         String stringToSign = timestamp + "\n" + SECRET;