diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java index 53f6645e..73dd228d 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java @@ -894,38 +894,47 @@ public class PdaSaveServiceImpl extends BaseServiceImpl 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);