hanzhiwei лет назад: 3
Родитель
Сommit
7da49e4ab2

+ 11 - 0
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/constant/RiskPlanConstants.java

@@ -17,4 +17,15 @@ public interface RiskPlanConstants {
      * 非火灾预案
      */
     int RISK_ATTRIBUTE_NO_FIRE = 2;
+
+    /**
+     * 温度funNum
+     */
+    String TEMPERATURE_FUN_NUM = "wendu";
+
+    /**
+     * 烟感funNum
+     */
+    String SMOKE_FUN_NUM = "yangan";
+
 }

+ 28 - 17
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -1045,6 +1045,9 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
 
         //如果预案里面配置传感器都达标,需要执行预案对应的硬件操作
         if (labRiskPlanLevel.getRiskPlanId() != null) {
+
+            labRiskPlanLevel.setRiskAttribute(riskAttribute);
+
             LabRiskPlan labRiskPlan = labRiskPlanMapper.selectLabRiskPlanByRiskPlanId(labRiskPlanLevel.getRiskPlanId());
             labRiskPlanLevel.setFloorId(labRiskPlan.getFloorId());
             labRiskPlanLevel.setTopName(labRiskPlan.getTopName());
@@ -1223,17 +1226,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                     log.error("关闭喇叭失败!!!!!:" + e);
                 }
 
-                //关闭视频录像
-                LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
-                if (labHardware != null){
-                    //开始录制视频
-//                    remoteCameraService.startRecord("192.168.1.14");
-                    R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
-                    if (r.getCode() == HttpStatus.SUCCESS) {
-
-                    }
-                }
-
                 //查询风险日志下,根据预案ID查询风险日志
                 LabRiskPlanAbnormalLog labRiskPlanAbnormalLogByGroupId = new LabRiskPlanAbnormalLog();
                 labRiskPlanAbnormalLogByGroupId.setGroupId(groupVo.getId());
@@ -1271,10 +1263,21 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 newGroupOP.setStatus(0L);
                 labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
                 // todo 操作人和视频结束时候的 url
-                R r = remoteCameraService.stopRecord("192.168.1.14");
-//                if (r.getCode().equals(HttpStatus.SUCCESS)){
-//
-//                }
+
+                //关闭视频录像
+                LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
+                if (labHardware != null){
+                    //开始录制视频
+//                    remoteCameraService.startRecord("192.168.1.14");
+                    R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
+                    if (r.getCode() == HttpStatus.SUCCESS) {
+
+                    }
+                }
+
+                //结束前向前端发送mqtt预案触发提示
+                messageSendService.riskPlanTriggerNotice();
+
 //                labRiskPlanAbnormalGroupService.doneRiskExeRecord(groupVo.getId(), "handledPerson", "recordVideo");
                 //插入预案结束日志
                 insertPlanAbnormalLogByOver(groupVo, allRiskPlanJson, subFunction);
@@ -1424,8 +1427,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         labRiskPlanAbnormalLog.setRiskStatus(riskStatus);
         labRiskPlanAbnormalLog.setSubjectId(subFunction.getSubId());
 
-        //是否火灾 带个flag
-        labRiskPlanAbnormalLog.setRiskAttribute(1);
+        labRiskPlanAbnormalLog.setRiskAttribute(labRiskPlanLevel.getRiskAttribute());
         labRiskPlanAbnormalLog.setRiskPlanLevelId(labRiskPlanLevel.getId());
         labRiskPlanAbnormalLog.setRiskPlanLevelName(RiskPlanLevelEnum.getValue(labRiskPlanLevel.getRiskPlanLevel()));
         labRiskPlanAbnormalLog.setRiskPlanLevel(labRiskPlanLevel.getRiskPlanLevel());
@@ -1525,6 +1527,11 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         labRiskPlanAbnormalLog.setOpreateAct(hardRelation.getOperate());
         labRiskPlanAbnormalLog.setSubjectId(subjectId);
         labRiskPlanAbnormalLog.setSensorJson(riskPlanJson);
+
+        labRiskPlanAbnormalLog.setRiskAttribute(labRiskPlanLevel.getRiskAttribute());
+        labRiskPlanAbnormalLog.setRiskPlanLevelId(labRiskPlanLevel.getId());
+        labRiskPlanAbnormalLog.setRiskPlanLevelName(RiskPlanLevelEnum.getValue(labRiskPlanLevel.getRiskPlanLevel()));
+        labRiskPlanAbnormalLog.setRiskPlanLevel(labRiskPlanLevel.getRiskPlanLevel());
         labRiskPlanAbnormalLogMapper.insertLabRiskPlanAbnormalLog(labRiskPlanAbnormalLog);
     }
 
@@ -1684,6 +1691,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         List<Long> list = new ArrayList<>();
         collect.forEach((key, value) -> {
             Integer count = 0;
+//            Integer fireCount = 0;
 
             Map<SenseType, List<SensorFunctionStatus>> sensorFunctionStatusListMap = hardwareFunctionStatusConfig.getSensorFunctionStatusListMap();
             //预案级别下传感器列表
@@ -1702,6 +1710,9 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                         //判断值范围  在范围内存储预案ID和类型名称 (火焰,温度,湿度)
                         if ((senseVal >= labRiskPlanSensorRelation.getMinMonitor().floatValue()) && (senseVal <= labRiskPlanSensorRelation.getMaxMonitor().floatValue())) {
                             count++;
+//                            if (funNum.equals(RiskPlanConstants.TEMPERATURE_FUN_NUM) || funNum.equals(RiskPlanConstants.SMOKE_FUN_NUM)){
+//                                fireCount++;
+//                            }
                         }
                     }
                 }