fuyuhchuan 1 год назад
Родитель
Сommit
8b454ec486

+ 7 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -239,11 +239,16 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         if (planSonList.size() <= 0) {
             throw new BusinessException("计划不存在,可能已被删除,请联系管理人员");
         }
-
+        /*
+        * 巡检时间判断
+        * */
         LocalDateTime now = LocalDateTime.now();
         LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         if (inspectionDateTime.isAfter(now)) {
-            throw new BusinessException("不能操作未来的计划");
+            throw new BusinessException("计划未开始,不可巡检");
+        } else if (now.isAfter(inspectionDateTime1)){
+            throw new BusinessException("巡检时间已过,请联系管理员");
         }