xmy 3 weeks ago
parent
commit
584bc77d31

+ 7 - 3
mjava-ounuo/src/main/java/com/malk/tuosi/service/impl/TbServiceImpl.java

@@ -942,11 +942,15 @@ public class TbServiceImpl implements TBService {
                     + "发生时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
             Map message = UtilMap.map("msgtype", "text");
             message.put("text", UtilMap.map("content", tips));
-            String result = ddClient_notice.sendNotification(ddClient.getAccessToken(),
+            // 注意: sendNotification 第一个参数是 agentId(不是 accessToken)
+            String agentId = String.valueOf(ddConf.getAgentId());
+            log.info("[创建任务自动更新确认流程] 准备发送钉钉告警, agentId: {}, targetUserId: 041114023523257781", agentId);
+            String result = ddClient_notice.sendNotification(agentId,
                     Arrays.asList("041114023523257781"), null, false, message);
-            log.info("[创建任务自动更新确认流程] 已发送钉钉告警至宁学刚(041114023523257781), 任务id: {}, 告警返回task_id: {}", taskId, result);
+            log.info("[创建任务自动更新确认流程] 已发送钉钉告警至宁学刚(041114023523257781), 任务id: {}, 告警返回: {}", taskId, result);
         } catch (Exception e) {
-            log.error("[创建任务自动更新确认流程] 钉钉告警发送失败, 任务id: {}", taskId, e);
+            log.error("[创建任务自动更新确认流程] 钉钉告警发送失败, 任务id: {}, 异常类型: {}, 异常消息: {}",
+                    taskId, e.getClass().getName(), e.getMessage(), e);
         }
     }