소스 검색

feat: 超时通知标记保留 1 小时,预警保留 24 小时,期间不再重复发送

wuwenyi 1 주 전
부모
커밋
360bba2368
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/main/java/com/qqflow/engine/domain/flow/job/OverdueCheckJob.java

+ 5 - 0
src/main/java/com/qqflow/engine/domain/flow/job/OverdueCheckJob.java

@@ -86,6 +86,9 @@ public class OverdueCheckJob {
     }
 
     private void sendReminder(ApprovalTask task, boolean overdue) {
+        // Redis 标记,发过一次不再重复发送
+        String flagKey = "notify:" + (overdue ? "overdue:" : "warning:") + task.getId();
+        if (redissonService.exists(flagKey)) return;
         try {
             ProcessInstance instance = this.processInstanceMapper.selectById(task.getInstanceId());
             String processName = instance != null && instance.getProcessName() != null ? instance.getProcessName() : "";
@@ -93,6 +96,8 @@ public class OverdueCheckJob {
             String nodeName = task.getNodeName();
             this.notificationService.notifyTaskOverdue(
                     task, processName, title, nodeName, overdue);
+            // 超时通知标记保留 1 小时,预警保留 24 小时,期间不再重复发送
+            redissonService.set(flagKey, "1", overdue ? 1 : 24, TimeUnit.HOURS);
         } catch (Exception e) {
             log.error("[超时检查] 发送催办通知失败,taskId={}", task.getId(), e);
         }