|
|
|
|
@ -894,38 +894,47 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan |
|
|
|
|
//User user = users.get(0);
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
Date date = new Date(); |
|
|
|
|
//巡检任务 定时任务 触发位置: OrderSafeJob.java
|
|
|
|
|
//定时任务原配置:0 0 0,2,5,7 * * ? (每天 0点、2点、5点、7点执行),即当前任务超时一小时但下一个任务(定时任务未执行)算未准时完成
|
|
|
|
|
//else 缺卡(默认处理)
|
|
|
|
|
// // TODO: 2026/4/24 整理定时任务逻辑
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 先处理最近一次生成的任务, |
|
|
|
|
* 如果最近一次生成的任务超过一个小时算未准时完成, |
|
|
|
|
* 一个小时内包括一个小时算已检。 |
|
|
|
|
* 其他的任务待检任务都改为缺卡 |
|
|
|
|
* |
|
|
|
|
* 在PDA上做巡检任务提交时,默认执行生成时间离当前时间最近的任务, |
|
|
|
|
* 【当前时间-任务生成时间】<1h,状态为【已检】, |
|
|
|
|
* 如果【当前时间-任务生成时间】> 1h,状态为【未准时完成】; |
|
|
|
|
* 再遍历该巡检点的【待检】任务,更新为【缺卡】状态 |
|
|
|
|
* */ |
|
|
|
|
|
|
|
|
|
// 最近一次生成的任务
|
|
|
|
|
spiList.sort((a, b) -> b.getLaunchTime().compareTo(a.getLaunchTime())); |
|
|
|
|
BsSafePatrolInspectionEntity latestTask = spiList.get(0); |
|
|
|
|
|
|
|
|
|
// 计算最新任务的时间差(毫秒)
|
|
|
|
|
long timeDiff = date.getTime() - latestTask.getLaunchTime().getTime(); |
|
|
|
|
|
|
|
|
|
// 处理所有任务
|
|
|
|
|
for (BsSafePatrolInspectionEntity safePatrolInspection : spiList) { |
|
|
|
|
// 不超过一个小时算正常检验
|
|
|
|
|
if (new Date().getTime() - safePatrolInspection.getLaunchTime().getTime() <= 60 * 60 * 1000) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.CHECKED.toString()); |
|
|
|
|
} else { |
|
|
|
|
// 超过一个小时但是下个任务并没有触发
|
|
|
|
|
int hours = safePatrolInspection.getLaunchTime().getHours(); |
|
|
|
|
int hours1 = new Date().getHours(); |
|
|
|
|
if (hours == 0 && hours1 < 2) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 2 && hours1 < 5) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 5 && hours1 < 7) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} else if (hours == 7 && hours1 < 8) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
if (safePatrolInspection.getId().equals(latestTask.getId())) { |
|
|
|
|
// 最近一次生成的任务:1小时内(含)算已检,超过1小时算未准时完成
|
|
|
|
|
if (timeDiff <= 60 * 60 * 1000) { |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.CHECKED.toString()); |
|
|
|
|
} else { |
|
|
|
|
// 超过一个小时但是下个任务已触发
|
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NO_CHECK.toString()); |
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NOT_ON_TIME.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
// 其他任务都改为缺卡
|
|
|
|
|
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NO_CHECK.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
safePatrolInspection.setTestTime(date); |
|
|
|
|
safePatrolInspection.setInsMan(user.getUserName()); |
|
|
|
|
safePatrolInspection.setParMemo(memo); |
|
|
|
|
safePatrolInspection.setPath(pathStr); |
|
|
|
|
// // TODO: 区别旧mes 显示修改 inspectionService.updateById(safePatrolInspection);bsSafeInspectionPointService.updateById(safeInspectionPoint);
|
|
|
|
|
inspectionService.updateById(safePatrolInspection); |
|
|
|
|
|
|
|
|
|
BsSafeInspectionPointEntity safeInspectionPoint = bsSafeInspectionPointService.getByKey(safePatrolInspection.getIpId()); |
|
|
|
|
safeInspectionPoint.setLastInsCycle(date); |
|
|
|
|
bsSafeInspectionPointService.updateById(safeInspectionPoint); |
|
|
|
|
|