ソースを参照

巡检计划可执行时间限制

fuyuhchuan 1 年間 前
コミット
e3be617472

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
+import com.usky.common.core.util.DateUtils;
 import com.usky.common.core.util.StringUtils;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
@@ -238,6 +239,14 @@ 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"));
+        if (inspectionDateTime.isAfter(now)) {
+            throw new BusinessException("不能操作未来的计划");
+        }
+
+
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
         queryWrapperOne.select(PatrolInspectionArea::getId, PatrolInspectionArea::getAreaName)
                 .eq(PatrolInspectionArea::getId, planSonList.get(0).getAreaId());
@@ -254,6 +263,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         patrolInspectionRecord.setSiteStatus(planRecordVo.getSiteStatus());
         patrolInspectionRecord.setLongitude(planRecordVo.getLongitude());
         patrolInspectionRecord.setLatitude(planRecordVo.getLatitude());
+
         String startDate = null;
         String endDate = null;
         if (planSonList.get(0).getPlanType() == 1) {