Bläddra i källkod

Merge commit 'e132d73957b965dfdbc7e933f2c61fbf2e194faf' into pro

linfutong 2 år sedan
förälder
incheckning
1e78c67dd1

+ 21 - 15
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/play/PlayController.java

@@ -107,21 +107,27 @@ public class PlayController {
         String deviceStr[] = deviceIds.split(",");
         String deviceStr[] = deviceIds.split(",");
         List<String> deviceList = Arrays.asList(deviceStr);
         List<String> deviceList = Arrays.asList(deviceStr);
         List<DeviceChannel> deviceChannelList = playService.queryChannelByDeviceId(deviceList, page, count);
         List<DeviceChannel> deviceChannelList = playService.queryChannelByDeviceId(deviceList, page, count);
-        for (DeviceChannel deviceChannel : deviceChannelList) {
-            // 获取可用的zlm
-            Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
-            MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
-            PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
-            DeferredResult<ResponseEntity<String>> result=playResult.getResult();
-            ResponseEntity responseEntity =  (ResponseEntity)result.getResult();
-            if(responseEntity != null && responseEntity.getStatusCode()==HttpStatus.OK){
-                WVPResult wvpResult = (WVPResult)responseEntity.getBody();
-                if (wvpResult.getCode() == 0) {
-                    StreamInfo streamInfo = (StreamInfo)wvpResult.getData();
-                    list.add(streamInfo);
-                }
-            }
-        }
+        if (deviceChannelList != null && deviceChannelList.size() > 0) {
+			for (DeviceChannel deviceChannel : deviceChannelList) {
+				// 获取可用的zlm
+				Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
+				MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
+				PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
+				if (playResult != null && playResult.getResult() != null) {
+					DeferredResult<ResponseEntity<String>> result = playResult.getResult();
+					if (result != null && result.getResult() != null) {
+						ResponseEntity responseEntity = (ResponseEntity) result.getResult();
+						if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
+							WVPResult wvpResult = (WVPResult) responseEntity.getBody();
+							if (wvpResult.getCode() == 0) {
+								StreamInfo streamInfo = (StreamInfo) wvpResult.getData();
+								list.add(streamInfo);
+							}
+						}
+					}
+				}
+			}
+		}
         Map<String, Object> map = new HashMap<>();
         Map<String, Object> map = new HashMap<>();
         map.put("code", "200");
         map.put("code", "200");
         map.put("msg", "成功!");
         map.put("msg", "成功!");

+ 1 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabRiskPlanController.java

@@ -362,8 +362,6 @@ public class LabRiskPlanController extends BaseController {
                 subFunction.setSubId(a.getSubjectId());
                 subFunction.setSubId(a.getSubjectId());
                 List<SensorFunctionStatus> sensorList = JSONArray.parseArray(a.getSensorJson(),SensorFunctionStatus.class);
                 List<SensorFunctionStatus> sensorList = JSONArray.parseArray(a.getSensorJson(),SensorFunctionStatus.class);
                 subFunction.setFunctionStatuses(sensorList);
                 subFunction.setFunctionStatuses(sensorList);
-                //删除火焰报警的redis验证,这样其他传感器上报预案就能执行了
-                redisService.deleteObject("subjectByHuoyan"+subFunction.getSubId());
                 //关闭预案
                 //关闭预案
                 labRiskPlanService.closeRiskPlan(subFunction);
                 labRiskPlanService.closeRiskPlan(subFunction);
             });
             });
@@ -371,7 +369,7 @@ public class LabRiskPlanController extends BaseController {
             logger.info("开始执行花费时间={}",interval);
             logger.info("开始执行花费时间={}",interval);
             return ResultData.success(1);
             return ResultData.success(1);
         }catch (Exception e){
         }catch (Exception e){
-            e.printStackTrace();
+            logger.error("手动关闭风险预案controller异常!{}",e);
         }
         }
         return ResultData.success(500);
         return ResultData.success(500);
     }
     }

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineServiceImpl.java

@@ -388,7 +388,7 @@ public class LabExitLineServiceImpl implements ILabExitLineService
                 }
                 }
             }
             }
         }catch (Exception e){
         }catch (Exception e){
-            logger.error("开启喇叭失败!!!!!:"+e);
+            logger.error("开启喇叭异常!{}",e);
         }
         }
     }
     }
 
 
@@ -544,7 +544,7 @@ public class LabExitLineServiceImpl implements ILabExitLineService
                     }
                     }
                 }
                 }
             }catch (Exception e){
             }catch (Exception e){
-                logger.error("开启喇叭失败!!!!!:"+e);
+                logger.error("开启喇叭异常!{}",e);
             }
             }
         }
         }
 
 

+ 47 - 39
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -653,14 +653,10 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             Long groupId = insertPlanAbnormalLog(labRiskPlanLevel, riskPlanJson, groupList, 1L, subFunction, riskAttribute);
             Long groupId = insertPlanAbnormalLog(labRiskPlanLevel, riskPlanJson, groupList, 1L, subFunction, riskAttribute);
             if (groupId != null) {
             if (groupId != null) {
                 log.info("日志组id不为空时,预警消息记录,groupId = {}", groupId);
                 log.info("日志组id不为空时,预警消息记录,groupId = {}", groupId);
-                try {
-                    //记录通知
-                    recordNotice(subFunction, labRiskPlanLevel, groupId);
-                    //向前端发送mqtt预案触发提示
-                    messageSendService.riskPlanTriggerNotice();
-                } catch (Exception e) {
-                    log.error("test日志={}",e);
-                }
+                //记录通知
+                recordNotice(subFunction, labRiskPlanLevel, groupId);
+                //向前端发送mqtt预案触发提示
+                messageSendService.riskPlanTriggerNotice();
                 //打开喇叭
                 //打开喇叭
                 openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel.getFloorId(), labRiskPlanLevel.getRiskPlanId());
                 openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel.getFloorId(), labRiskPlanLevel.getRiskPlanId());
                 //远程调用开始录制视频接口
                 //远程调用开始录制视频接口
@@ -671,6 +667,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             if (redisService.getCacheObject("subjectByYa" + subFunction.getSubId()) != null) {
             if (redisService.getCacheObject("subjectByYa" + subFunction.getSubId()) != null) {
                 return flag;
                 return flag;
             }
             }
+            log.info("传感器触发关闭预案!实验室id={}",subFunction.getSubId());
             for (LabRiskPlanAbnormalGroupVO groupVo : groupList) {
             for (LabRiskPlanAbnormalGroupVO groupVo : groupList) {
                 //更新结束预案日志
                 //更新结束预案日志
                 updateLogs(subFunction, groupVo);
                 updateLogs(subFunction, groupVo);
@@ -779,7 +776,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
                 log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-            log.error("远程调用结束录制视频接口失败!{}", e);
+            log.error("远程调用结束录制视频接口异常!{}", e);
         }
         }
         //更新风险概要  recordVideo - 视频记录存放地址
         //更新风险概要  recordVideo - 视频记录存放地址
         String handlePerson = "";
         String handlePerson = "";
@@ -825,7 +822,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 log.info("关闭喇叭-合成音乐列表为空,此预案不关闭喇叭!riskPlanId={}", riskPlanId);
                 log.info("关闭喇叭-合成音乐列表为空,此预案不关闭喇叭!riskPlanId={}", riskPlanId);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-            log.info("关闭喇叭失败!!={}", e);
+            log.error("关闭喇叭异常!{}", e);
         }
         }
     }
     }
 
 
@@ -1020,7 +1017,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 log.info("打开喇叭-合成音乐列表为空,此预案不触发音乐!riskPlanId={}", riskPlanId);
                 log.info("打开喇叭-合成音乐列表为空,此预案不触发音乐!riskPlanId={}", riskPlanId);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-            log.error("开启喇叭异常!={}",e);
+            log.error("开启喇叭异常!{}",e);
         }
         }
     }
     }
 
 
@@ -1033,17 +1030,20 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     private void startVideo(Long subjectId) {
     private void startVideo(Long subjectId) {
         try {
         try {
             LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subjectId);
             LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subjectId);
-            if (labHardware == null) {
+            if (labHardware != null || labHardware.getIpAddress() != null) {
+                //开始录制视频
+                log.info("远程调用开始录制视频ip地址={}", labHardware.getIpAddress());
+                remoteCameraService.stopRecord(labHardware.getIpAddress());
+                R r = remoteCameraService.startRecord(labHardware.getIpAddress());
+                log.info("开始录制视频返回结果打印={}", JSON.toJSONString(r));
+                if (r.getCode() == HttpStatus.SUCCESS) {
+                    log.info("开始录制视频成功!");
+                }else {
+                    log.info("开始录制视频失败!");
+                }
+            }else {
                 log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
                 log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
             }
             }
-            //开始录制视频
-            log.info("远程调用开始录制视频ip地址={}", labHardware.getIpAddress());
-            remoteCameraService.stopRecord(labHardware.getIpAddress());
-            R r = remoteCameraService.startRecord(labHardware.getIpAddress());
-            log.info("开始录制视频返回结果打印={}", JSON.toJSONString(r));
-            if (r.getCode() != HttpStatus.SUCCESS) {
-                log.info("开始录制视频失败!");
-            }
         } catch (Exception e) {
         } catch (Exception e) {
             log.error("远程调用开始录制视频接口失败!{}", e);
             log.error("远程调用开始录制视频接口失败!{}", e);
         }
         }
@@ -1052,25 +1052,33 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     @Override
     @Override
     public int closeRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {
     public int closeRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {
         //将风险预案写入归属组级表里面
         //将风险预案写入归属组级表里面
-        List<LabRiskPlanAbnormalGroupVO> groupList = getLabRiskPlanAbnormalGroupVOS(subFunction.getSubId());
-        if (redisService.getCacheObject("subjectByYa" + subFunction.getSubId()) != null) {
-            redisService.deleteObject("subjectByYa" + subFunction.getSubId());
-        }
-        for (LabRiskPlanAbnormalGroupVO groupVo : groupList) {
-            //向一体机传感器预警
-            messageSendService.sendWranFunctionToSub(subFunction.getSubId());
-            //首页预案流程通知
-            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_GROUP);
-            messageSendService.riskPlanTriggerNotice();
-            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
-            //首页预案是否同步疏散线路
-            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
-            //关闭喇叭
-            closeLoudSpeaker(subFunction.getSubId(), groupVo.getFloorId(), groupVo.getRiskPlanId());
-            //停止录像并记录日志
-            stopVideoAndRecordLog(subFunction.getSubId(), groupVo.getId());
-            //更新结束预案日志
-            updateLogs(subFunction, groupVo);
+        try {
+            List<LabRiskPlanAbnormalGroupVO> groupList = getLabRiskPlanAbnormalGroupVOS(subFunction.getSubId());
+            for (LabRiskPlanAbnormalGroupVO groupVo : groupList) {
+                //向一体机传感器预警
+                messageSendService.sendWranFunctionToSub(subFunction.getSubId());
+                //首页预案流程通知
+                messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_GROUP);
+                messageSendService.riskPlanTriggerNotice();
+                messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
+                //首页预案是否同步疏散线路
+                messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
+                //关闭喇叭
+                closeLoudSpeaker(subFunction.getSubId(), groupVo.getFloorId(), groupVo.getRiskPlanId());
+                //停止录像并记录日志
+                stopVideoAndRecordLog(subFunction.getSubId(), groupVo.getId());
+                //更新结束预案日志
+                updateLogs(subFunction, groupVo);
+            }
+        } catch (Exception e) {
+            log.error("手动关闭火焰预案发生异常!{}",e);
+        } finally {
+            //删除火焰报警的redis验证,这样其他传感器上报预案就能执行了
+            redisService.deleteObject("subjectByHuoyan"+subFunction.getSubId());
+            //删除预案升级火焰预案时,基本预案缓存
+            if (redisService.getCacheObject("subjectByYa" + subFunction.getSubId()) != null) {
+                redisService.deleteObject("subjectByYa" + subFunction.getSubId());
+            }
         }
         }
         return 0;
         return 0;
     }
     }

+ 48 - 40
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabAbnormalMapper.xml

@@ -59,55 +59,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     </sql>
 
 
     <sql id="selectLabEquipmentVo">
     <sql id="selectLabEquipmentVo">
-        SELECT xx.* FROM (
-        SELECT DISTINCT
-          h.id,
-          h.`name`,
-          h.`type`,
-          h.`subject_id`,
-          (SELECT
-            s.name
-          FROM
-            lab_subject s
-          WHERE s.id = h.`subject_id`) subject_name,
-          (SELECT
-            s.dept_id
-          FROM
-            lab_subject s
-          WHERE s.id = h.`subject_id`) dept_id,
-          (SELECT
-            d.dept_name
-          FROM
-            sys_dept d,lab_subject s
-          WHERE d.dept_id = s.dept_id AND s.id = h.`subject_id`) dept_name,
-          1 equipment_type,
-          h.`create_time`,
-          h.operate
+
+ SELECT xx.* FROM (
+        SELECT t1.*,
+        (SELECT
+        s.name
+        FROM
+        lab_subject s
+        WHERE s.id = t1.`subject_id`) subject_name,
+        (SELECT
+        s.dept_id
+        FROM
+        lab_subject s
+        WHERE s.id = t1.`subject_id`) dept_id,
+        (SELECT
+        d.dept_name
+        FROM
+        sys_dept d,lab_subject s
+        WHERE d.dept_id = s.dept_id AND s.id = t1.`subject_id`) dept_name,
+        1 equipment_type
+        FROM (
+        SELECT
+        h.id,
+        h.`name`,
+        h.`type`,
+        h.`subject_id`,
+        h.`create_time`,
+        h.operate
         FROM
         FROM
-          lab_hardware h INNER JOIN lab_abnormal a ON a.hardware_id = h.`id`
+        lab_hardware h INNER JOIN (SELECT DISTINCT al.hardware_id FROM lab_abnormal al) a ON a.hardware_id = h.`id`
+        )t1
 
 
         UNION ALL
         UNION ALL
 
 
-          SELECT DISTINCT so.id,so.name,so.type,
-          so.`subject_id`,
-          (SELECT
-            s.name
-          FROM
-            lab_subject s
-          WHERE s.id = so.`subject_id`) subject_name,
-          so.dept_id,
-          (SELECT
-            d.dept_name
-          FROM
-            sys_dept d,lab_subject s
-          WHERE d.dept_id = s.dept_id AND s.id = so.`subject_id`) dept_name,
+        SELECT t2.id,t2.name,t2.type,t2.`subject_id`,t2.create_time,t2.operate,
+        (SELECT
+        s.name
+        FROM
+        lab_subject s
+        WHERE s.id = t2.`subject_id`) subject_name,t2.dept_id,
+        (SELECT
+        d.dept_name
+        FROM
+        sys_dept d,lab_subject s
+        WHERE d.dept_id = s.dept_id AND s.id = t2.`subject_id`) dept_name,
+        t2.equipment_type
+
+        FROM (
+        SELECT so.id,so.name,so.type,
+        so.`subject_id`,
         2 equipment_type,
         2 equipment_type,
         so.`create_time`,
         so.`create_time`,
+        so.dept_id,
         so.sense_state operate
         so.sense_state operate
-         FROM lab_sensor so INNER JOIN lab_abnormal a ON a.sensor_id = so.`id`
+        FROM lab_sensor so INNER JOIN (SELECT DISTINCT al.sensor_id FROM lab_abnormal al) a ON a.sensor_id = so.`id`
+        )t2
         )xx
         )xx
 
 
-
   </sql>
   </sql>
 
 
   <select id="selectLabAbnormalList" parameterType="com.zd.laboratory.domain.vo.LabAbnormalVO" resultMap="LabAbnormalVOResult">
   <select id="selectLabAbnormalList" parameterType="com.zd.laboratory.domain.vo.LabAbnormalVO" resultMap="LabAbnormalVOResult">