Browse Source

调整早到迟到

hanzhengyi 10 months ago
parent
commit
161f519220

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

@@ -73,6 +73,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     @Autowired
     private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
 
+    @Autowired
+    private PatrolInspectionEventService patrolInspectionEventService;
+
     @Override
     public Map<String, Object> appPlanStatistics(String currentDate) {
         Integer planSonCount = 0;
@@ -246,8 +249,26 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         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)) {
+            PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
+            patrolInspectionEvent.setEventName("早到");
+            patrolInspectionEvent.setEventType(33);
+            patrolInspectionEvent.setEventLevel(1);
+            patrolInspectionEvent.setEventCategory(1);
+            patrolInspectionEvent.setDeviceId(planRecordVo.getDeviceId());
+            patrolInspectionEvent.setCreateBy(SecurityUtils.getUsername());
+            patrolInspectionEvent.setCreateTime(LocalDateTime.now());
+            patrolInspectionEventService.add(patrolInspectionEvent);
             throw new BusinessException("计划未开始,不可巡检");
         } else if (now.isAfter(inspectionDateTime1)){
+            PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
+            patrolInspectionEvent.setEventName("迟到");
+            patrolInspectionEvent.setEventType(34);
+            patrolInspectionEvent.setEventLevel(1);
+            patrolInspectionEvent.setEventCategory(1);
+            patrolInspectionEvent.setDeviceId(planRecordVo.getDeviceId());
+            patrolInspectionEvent.setCreateBy(SecurityUtils.getUsername());
+            patrolInspectionEvent.setCreateTime(LocalDateTime.now());
+            patrolInspectionEventService.add(patrolInspectionEvent);
             throw new BusinessException("巡检时间已过,请联系管理员");
         }
 

+ 7 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PlanRecordVo.java

@@ -1,6 +1,7 @@
 package com.usky.fire.service.vo;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.usky.fire.domain.PatrolInspectionRecordOption;
 import com.usky.fire.domain.PatrolInspectionRecordPicture;
@@ -143,4 +144,10 @@ public class PlanRecordVo implements Serializable {
      */
     private List<PatrolInspectionRecordOption> recordOptionList;
 
+    /**
+     * 设备ID
+     */
+    @TableField(exist = false)
+    private String deviceId;
+
 }