From 183755f7eb2b2c83350064094d63032678e1d136 Mon Sep 17 00:00:00 2001 From: tianxinlei Date: Tue, 2 Jun 2026 14:16:02 +0800 Subject: [PATCH] 6-2 fix --- .../tasklist/FeedbackExceptionCheckExe.java | 20 +++++++++++++------ .../mapper/tasklist/TaskListMapper.xml | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/web-app/src/main/java/com/zcloud/safetyDutyList/command/tasklist/FeedbackExceptionCheckExe.java b/web-app/src/main/java/com/zcloud/safetyDutyList/command/tasklist/FeedbackExceptionCheckExe.java index fa3667e..e150ae7 100644 --- a/web-app/src/main/java/com/zcloud/safetyDutyList/command/tasklist/FeedbackExceptionCheckExe.java +++ b/web-app/src/main/java/com/zcloud/safetyDutyList/command/tasklist/FeedbackExceptionCheckExe.java @@ -16,6 +16,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; /** @@ -82,7 +83,12 @@ public class FeedbackExceptionCheckExe { // 遍历每个任务 for (TaskDetailE taskDetail : taskDetails) { - checkTaskFeedback(taskList, taskDetail); + boolean hasException = checkTaskFeedback(taskList, taskDetail); + if (hasException) { + // 存在异常 + taskDetail.setFeedbackStatus(2); + taskDetailGateway.update(taskDetail); + } } } } @@ -93,18 +99,18 @@ public class FeedbackExceptionCheckExe { * @param taskList 所属清单(用于获取周期起始时间) * @param taskDetail 任务详情 */ - private void checkTaskFeedback(TaskListE taskList, TaskDetailE taskDetail) { + private Boolean checkTaskFeedback(TaskListE taskList, TaskDetailE taskDetail) { Integer feedbackCycleType = taskDetail.getFeedbackCycleType(); if (feedbackCycleType == null) { log.warn("【定时任务-安全责任清单-检测反馈异常】任务[{}]反馈周期类型为空,跳过检测", taskDetail.getTaskDetailId()); - return; + return false; } // 当前时间处于首周期,跳过 if (FeedbackCycleUtil.isFirstCycle(feedbackCycleType, taskList.getPeriodStartTime())) { log.info("【定时任务-安全责任清单-检测反馈异常】清单[{}]任务[{}]周期类型为{},仍处于首周期内,跳过检测", taskList.getTaskListId(), taskDetail.getTaskDetailId(), feedbackCycleType); - return; + return false; } // 上一阶段周期标识 @@ -112,7 +118,7 @@ public class FeedbackExceptionCheckExe { if (previousPeriodFlag == null) { log.warn("【定时任务-安全责任清单-检测反馈异常】任务[{}]无法生成上一阶段周期标识,feedbackCycleType={}", taskDetail.getTaskDetailId(), feedbackCycleType); - return; + return false; } // 异常记录是否存在 @@ -120,7 +126,7 @@ public class FeedbackExceptionCheckExe { if (alreadyHasException) { log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]已存在异常记录,跳过", taskDetail.getTaskDetailId(), previousPeriodFlag); - return; + return false; } // 上一阶段周期标识对应的反馈记录是否存在 @@ -130,9 +136,11 @@ public class FeedbackExceptionCheckExe { createFeedbackException(taskDetail, previousPeriodFlag); log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]未反馈,已添加异常记录", taskDetail.getTaskDetailId(), previousPeriodFlag); + return true; } else { log.info("【定时任务-安全责任清单-检测反馈异常】任务[{}]在周期[{}]已正常反馈", taskDetail.getTaskDetailId(), previousPeriodFlag); + return false; } } diff --git a/web-infrastructure/src/main/resources/mapper/tasklist/TaskListMapper.xml b/web-infrastructure/src/main/resources/mapper/tasklist/TaskListMapper.xml index 88ae274..2406ad6 100644 --- a/web-infrastructure/src/main/resources/mapper/tasklist/TaskListMapper.xml +++ b/web-infrastructure/src/main/resources/mapper/tasklist/TaskListMapper.xml @@ -6,6 +6,7 @@