Browse Source

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

wuwenyi 1 week ago
parent
commit
360bba2368

+ 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);
         }