Parcourir la source

Merge branch 'han' of uskycloud/usky-modules into server-165

hanzhengyi il y a 10 mois
Parent
commit
dbf3b20d11

+ 5 - 1
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/listener/RabbitMQListener.java

@@ -31,7 +31,11 @@ public class RabbitMQListener {
                 eventVO1.put("eventCode",2);
                 PatrolAgbox.addEvent(eventVO1.toJSONString());
             }else {
-                eventVO.put("eventCode",16);
+                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)){
+                    eventVO.put("eventCode",5);
+                }else {
+                    eventVO.put("eventCode",16);
+                }
                 String timeWithT = eventVO1.get("createTime").toString();
                 eventVO.put("deviceId",eventVO1.get("deviceId"));
                 eventVO.put("triggerTime",timeWithT.replace("T", " "));

+ 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;
+
 }