master
tianxinlei 2026-06-02 14:16:02 +08:00
parent 2f8b4b4df5
commit 183755f7eb
2 changed files with 16 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -6,6 +6,7 @@
<select id="listPage" resultType="com.zcloud.safetyDutyList.persistence.dataobject.tasklist.TaskListDO">
SELECT tl.*,
exec_corp.corp_name AS executeCorpName,
exec_dept.name AS executeDepartmentName,
exec_user.name AS executeUserName,
rating_dept.name AS ratingDepartmentName,
@ -13,6 +14,7 @@
IFNULL(td_agg.task_count, 0) AS taskCount,
CASE WHEN td_agg.has_abnormal &gt; 0 THEN 2 ELSE 1 END AS feedbackStatus
FROM safety_accountability_task_list tl
LEFT JOIN corp_info exec_corp ON tl.execute_corp_id = exec_corp.id
LEFT JOIN department exec_dept ON tl.execute_department_id = exec_dept.id
LEFT JOIN user exec_user ON tl.execute_user_id = exec_user.id
LEFT JOIN department rating_dept ON tl.rating_department_id = rating_dept.id