Prechádzať zdrojové kódy

Merge commit '69e9602229ef3ca976b2fb44d9c14c96dcd697f9' into pro

linfutong 2 rokov pred
rodič
commit
2bf2c17bf2

+ 3 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java

@@ -76,7 +76,7 @@ public class SubMessageSendManager {
         messageBody.setData(bigViewDataType);
         //仅发送一次
         commonSend.send(MqttConstants.TOPIC_LAB_BIG_VIEW, messageBody, SendMode.ONCE);
-        logger.info("发送大屏数据更新通知完成!topic={},msg={}",MqttConstants.TOPIC_LAB_BIG_VIEW,messageBody);
+        logger.info("发送大屏数据更新通知完成!topic={},msg={}",MqttConstants.TOPIC_LAB_BIG_VIEW,JSON.toJSONString(messageBody));
     }
 
     /**
@@ -239,7 +239,7 @@ public class SubMessageSendManager {
         MessageBody messageBody = new MessageBody();
         messageBody.setData(BigViewDataType.SUB_WRAN);
         commonSend.send(MqttConstants.TOPIC_LAB_WRAN + id, messageBody, SendMode.ONCE);
-        logger.info("向一体机发送预警数据完成!topic={},msg={}",MqttConstants.TOPIC_LAB_WRAN + id,messageBody);
+        logger.info("向一体机发送预警数据完成!topic={},msg={}",MqttConstants.TOPIC_LAB_WRAN + id,JSON.toJSONString(messageBody));
     }
 
     /**
@@ -351,7 +351,7 @@ public class SubMessageSendManager {
         messageBody.setData(map);
         //仅发送一次
         commonSend.send(MqttConstants.TOPIC_LAB_ONEPC_SUB_NEWS + subId, messageBody, SendMode.ONCE);
-        logger.info("发送一体机通知消息完成,topic={},msg={}",MqttConstants.TOPIC_LAB_ONEPC_SUB_NEWS + subId,messageBody);
+        logger.info("发送一体机通知消息完成,topic={},msg={}",MqttConstants.TOPIC_LAB_ONEPC_SUB_NEWS + subId,JSON.toJSONString(messageBody));
     }
 
     /**

+ 7 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalGroupServiceImpl.java

@@ -76,7 +76,13 @@ public class LabRiskPlanAbnormalGroupServiceImpl implements ILabRiskPlanAbnormal
                 JSONArray sensorList = JSONObject.parseArray(b.getSensorJson());
                 for(int x=0;x<sensorList.size();x++){
                     JSONObject jsonObj=sensorList.getJSONObject(x);
-                    sensorStr.append(jsonObj.get("describe")+":"+jsonObj.get("value")+""+jsonObj.get("unit")==null?"":jsonObj.get("unit")+"  ");
+                    String unit = jsonObj.get("unit")+"";
+                    if(StringUtils.isNotNull(unit)){
+                        sensorStr.append(jsonObj.get("describe")+":"+jsonObj.get("value")+""+jsonObj.get("unit")+"  ");
+                    }else{
+                        sensorStr.append(jsonObj.get("describe")+":"+jsonObj.get("value")+"  ");
+                    }
+//                    sensorStr.append(jsonObj.get("describe")+":"+jsonObj.get("value")+""+jsonObj.get("unit")==null?"":jsonObj.get("unit")+"  ");
                     if(StringUtils.isNotNull(jsonObj.get("funNum")) && (jsonObj.get("funNum")+"").equals("huoyan")){
                         if(!a.getClosePlan()){
                             a.setClosePlan(true);

+ 83 - 79
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -653,10 +653,14 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             Long groupId = insertPlanAbnormalLog(labRiskPlanLevel, riskPlanJson, groupList, 1L, subFunction, riskAttribute);
             if (groupId != null) {
                 log.info("日志组id不为空时,预警消息记录,groupId = {}", groupId);
-                //记录通知
-                recordNotice(subFunction, labRiskPlanLevel, groupId);
-                //向前端发送mqtt预案触发提示
-                messageSendService.riskPlanTriggerNotice();
+                try {
+                    //记录通知
+                    recordNotice(subFunction, labRiskPlanLevel, groupId);
+                    //向前端发送mqtt预案触发提示
+                    messageSendService.riskPlanTriggerNotice();
+                } catch (Exception e) {
+                    log.error("test日志={}",e);
+                }
                 //打开喇叭
                 openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel.getFloorId(), labRiskPlanLevel.getRiskPlanId());
                 //远程调用开始录制视频接口
@@ -800,27 +804,28 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             LabAudioSynthesis labAudioSynthesis = new LabAudioSynthesis();
             labAudioSynthesis.setRiskPlanId(riskPlanId);
             List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
+            log.info("关闭喇叭-查询的音乐列表信息 audioSyntheses= {}", JSON.toJSONString(audioSyntheses));
             if (audioSyntheses != null && audioSyntheses.size() > 0) {
-                log.info("远程调用查询喇叭列表,楼层id={},实验室id={}", floorId, subjectid);
+                log.info("关闭喇叭-远程调用查询喇叭列表,楼层id={},实验室id={}", floorId, subjectid);
                 R deviceList = remoteSpeakService.getDeviceList(1, 100, floorId, subjectid);
-                log.info("远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
+                log.info("关闭喇叭-远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
                 if (deviceList.getCode() == 200) {
                     List<Map<String, Object>> mapList = (List<Map<String, Object>>) deviceList.getData();
                     for (Map<String, Object> map : mapList) {
                         if (StringUtils.isNotNull(map.get("deviceSn")) && StringUtils.isNotNull(map.get("port"))) {
-                            log.info("远程调用关闭喇叭播放音乐!url={},deviceSn={}", audioSyntheses.get(0).getNewMusicUrl(), map.get("deviceSn"));
+                            log.info("关闭喇叭-远程调用喇叭播放音乐!url={},deviceSn={}", audioSyntheses.get(0).getNewMusicUrl(), map.get("deviceSn"));
                             R r = remoteSpeakService.stopPlayMusic(map.get("deviceSn") + "", audioSyntheses.get(0).getNewMusicUrl());
-                            log.info("远程调用关闭喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
+                            log.info("关闭喇叭-远程调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
                         } else {
-                            log.info("喇叭deviceSn/port为空!");
+                            log.info("关闭喇叭deviceSn/port为空!");
                         }
                     }
                 }
             } else {
-                log.info("合成音乐列表为空,此预案不关闭喇叭!riskPlanId={}", riskPlanId);
+                log.info("关闭喇叭-合成音乐列表为空,此预案不关闭喇叭!riskPlanId={}", riskPlanId);
             }
         } catch (Exception e) {
-            log.error("关闭喇叭失败!!!!!:" + e);
+            log.info("关闭喇叭失败!!={}", e);
         }
     }
 
@@ -920,48 +925,52 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
      * @Return void
      **/
     private void recordNotice(SubFunction<SensorFunctionStatus> subFunction, LabRiskPlanLevel labRiskPlanLevel, Long groupId) {
-        //记录预警消息记录开始
-        insertWarnPushMessageByOnePc(labRiskPlanLevel, subFunction.getSubId(), groupId);
+        try {
+            //记录预警消息记录开始
+            insertWarnPushMessageByOnePc(labRiskPlanLevel, subFunction.getSubId(), groupId);
 
-        //记录语音播报开始
-        insertPlanAbnormalLogByVoice(labRiskPlanLevel, subFunction.getSubId(), groupId);
+            //记录语音播报开始
+            insertPlanAbnormalLogByVoice(labRiskPlanLevel, subFunction.getSubId(), groupId);
 
-        //记录语音电话开始
-        insertPlanAbnormalLogByPhone(labRiskPlanLevel, subFunction.getSubId(), groupId);
+            //记录语音电话开始
+            insertPlanAbnormalLogByPhone(labRiskPlanLevel, subFunction.getSubId(), groupId);
 
-        //一键灭火日志记录
-        insertPlanAbnormalLogByOneClickFire(labRiskPlanLevel, subFunction, groupId);
+            //一键灭火日志记录
+            insertPlanAbnormalLogByOneClickFire(labRiskPlanLevel, subFunction, groupId);
 
-        //向一体机推送语音播报
-        String str = StringUtils.isBlank(labRiskPlanLevel.getVoicebroadcast()) ? "" : labRiskPlanLevel.getVoicebroadcast();
-        try {
-            messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
-        } catch (Exception e) {
-            log.error("向一体机推送语音播报异常:" + e);
-        }
+            //向一体机推送语音播报
+            String str = StringUtils.isBlank(labRiskPlanLevel.getVoicebroadcast()) ? "" : labRiskPlanLevel.getVoicebroadcast();
+            try {
+                messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
+            } catch (Exception e) {
+                log.error("向一体机推送语音播报异常:" + e);
+            }
 
-        //向一体机传感器预警
-        messageSendService.sendWranFunctionToSub(subFunction.getSubId());
+            //向一体机传感器预警
+            messageSendService.sendWranFunctionToSub(subFunction.getSubId());
 
-        //向一体机发送预警消息展示
-        insertMachineContent(subFunction.getSubId(), RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
+            //向一体机发送预警消息展示
+            insertMachineContent(subFunction.getSubId(), RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
 
-        //首页消息通知
-        messageSendService.SendBigViewUpdate(BigViewDataType.SUB_WRAN_MESSAGE);
+            //首页消息通知
+            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_WRAN_MESSAGE);
 
-        //发送大屏左下角预警消息
-        labMessageContentService.sendWranMessage(subFunction.getSubId(), labRiskPlanLevel, groupId);
+            //发送大屏左下角预警消息
+            labMessageContentService.sendWranMessage(subFunction.getSubId(), labRiskPlanLevel, groupId);
 
-        //首页预案流程通知
-        messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
+            //首页预案流程通知
+            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
 
-        //首页预案组通知
-        messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_GROUP);
+            //首页预案组通知
+            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_GROUP);
 
-        //首页预案是否同步疏散线路
-        if (labRiskPlanLevel.getIfExit() != null && labRiskPlanLevel.getIfExit() == 1) {
-            redisService.setCacheObject("subjectByExit" + subFunction.getSubId(), subFunction.getSubId(), 30L, TimeUnit.SECONDS);
-            messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
+            //首页预案是否同步疏散线路
+            if (labRiskPlanLevel.getIfExit() != null && labRiskPlanLevel.getIfExit() == 1) {
+                redisService.setCacheObject("subjectByExit" + subFunction.getSubId(), subFunction.getSubId(), 30L, TimeUnit.SECONDS);
+                messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
+            }
+        } catch (Exception e) {
+            log.error("预案处理消息异常!{}",e);
         }
     }
 
@@ -978,49 +987,40 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             LabAudioSynthesis labAudioSynthesis = new LabAudioSynthesis();
             labAudioSynthesis.setRiskPlanId(riskPlanId);
             List<LabAudioSynthesis> audioSyntheses = labAudioSynthesisMapper.selectLabAudioSynthesisList(labAudioSynthesis);
-            log.info("查询的音乐列表信息 audioSyntheses= {}", JSON.toJSONString(audioSyntheses));
+            log.info("打开喇叭-查询的音乐列表信息 audioSyntheses= {}", JSON.toJSONString(audioSyntheses));
             if (audioSyntheses != null && audioSyntheses.size() > 0) {
                 //预案调用喇叭
-                log.info("远程调用查询喇叭列表,楼层id={},实验室id={}", floorId, subjectId);
+                log.info("打开喇叭-远程调用查询喇叭列表,楼层id={},实验室id={}", floorId, subjectId);
                 R deviceList = remoteSpeakService.getDeviceList(1, 100, floorId, subjectId);
-                log.info("远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
+                log.info("打开喇叭-远程调用喇叭列表返回内容: deviceList={}", JSON.toJSONString(deviceList));
                 if (deviceList.getCode() == 200) {
-                    log.info("调用喇叭1");
                     List<Map<String, Object>> mapList = (List<Map<String, Object>>) deviceList.getData();
-                    log.info("调用喇叭2={}",JSON.toJSONString(mapList));
                     for (Map<String, Object> map : mapList) {
                         if (StringUtils.isNotNull(map.get("deviceSn")) && StringUtils.isNotNull(map.get("port"))) {
-                            log.info("调用喇叭3");
                             List<PlayVo> playVoList = new ArrayList<>();
                             PlayVo playVo = new PlayVo();
-                            log.info("调用喇叭4");
                             playVo.setSn(map.get("deviceSn") + "");
-                            log.info("调用喇叭5");
                             playVo.setDeviceIp(map.get("deviceIp") + "");
-                            log.info("调用喇叭6");
                             playVo.setPort(Integer.parseInt(map.get("port") + ""));
-                            log.info("调用喇叭7");
                             ParamVo paramVo = new ParamVo();
                             paramVo.setVol(Integer.parseInt(map.get("deviceVol").toString()));
-                            log.info("调用喇叭8");
                             playVo.setParams(paramVo);
-                            log.info("调用喇叭9");
                             playVoList.add(playVo);
-                            log.info("远程调用喇叭播放音乐!url={},playVoList={}", audioSyntheses.get(0).getNewMusicUrl(), JSON.toJSONString(playVoList));
+                            log.info("打开喇叭-远程调用喇叭播放音乐!url={},playVoList={}", audioSyntheses.get(0).getNewMusicUrl(), JSON.toJSONString(playVoList));
                             R r = remoteSpeakService.textParseUrlAppIps(audioSyntheses.get(0).getNewMusicUrl(), playVoList);
-                            log.info("远程调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
+                            log.info("打开喇叭-远程调用喇叭播放音乐返回信息:{}", JSON.toJSONString(r));
                         } else {
-                            log.info("喇叭deviceSn/port为空!");
+                            log.info("打开喇叭-喇叭deviceSn/port为空!");
                         }
                     }
                 } else {
-                    log.info("远程查询喇叭信息错误!");
+                    log.info("打开喇叭-远程查询喇叭信息错误!");
                 }
             } else {
-                log.info("合成音乐列表为空,此预案不触发音乐!riskPlanId={}", riskPlanId);
+                log.info("打开喇叭-合成音乐列表为空,此预案不触发音乐!riskPlanId={}", riskPlanId);
             }
         } catch (Exception e) {
-            log.info("开启喇叭失败!={}",e);
+            log.error("开启喇叭异常!={}",e);
         }
     }
 
@@ -1281,25 +1281,29 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     }
 
     public void insertPlanAbnormalLogByOneClickFire(LabRiskPlanLevel labRiskPlanLevel, SubFunction<SensorFunctionStatus> subFunction, Long groupId) {
-        //将一件灭火插入日志
-        subFunction.getFunctionStatuses().stream().filter(a -> "huoyan".equals(a.getFunNum())).forEach(a -> {
-            if (a.getAutomanual() == 0 || a.getAutomanual() == 1) {
-                LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
-                labRiskPlanAbnormalLog.setRiskPlanId(labRiskPlanLevel.getRiskPlanId());
-                labRiskPlanAbnormalLog.setRiskPlanName("一键灭火");
-                labRiskPlanAbnormalLog.setSubjectId(subFunction.getSubId());
-                labRiskPlanAbnormalLog.setCreateTime(new Date());
-                labRiskPlanAbnormalLog.setGroupId(groupId);
-                labRiskPlanAbnormalLog.setRiskAttribute(labRiskPlanLevel.getRiskAttribute());
-                labRiskPlanAbnormalLog.setRiskPlanLevelId(labRiskPlanLevel.getId());
-                labRiskPlanAbnormalLog.setRiskPlanLevelName(RiskPlanLevelEnum.getValue(labRiskPlanLevel.getRiskPlanLevel()));
-                labRiskPlanAbnormalLog.setRiskPlanLevel(labRiskPlanLevel.getRiskPlanLevel());
-                labRiskPlanAbnormalLog.setRiskStatus(6L);
-                labRiskPlanAbnormalLog.setRemark(a.getAutomanual() == 1 ? "自动灭火" : "手动灭火");
-                //插入风险日志
-                labRiskPlanAbnormalLogMapper.insertLabRiskPlanAbnormalLog(labRiskPlanAbnormalLog);
-            }
-        });
+        try {
+            //将一件灭火插入日志
+            subFunction.getFunctionStatuses().stream().filter(a -> "huoyan".equals(a.getFunNum()) && a.getAutomanual() != null).forEach(a -> {
+                if (a.getAutomanual() == 0 || a.getAutomanual() == 1) {
+                    LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
+                    labRiskPlanAbnormalLog.setRiskPlanId(labRiskPlanLevel.getRiskPlanId());
+                    labRiskPlanAbnormalLog.setRiskPlanName("一键灭火");
+                    labRiskPlanAbnormalLog.setSubjectId(subFunction.getSubId());
+                    labRiskPlanAbnormalLog.setCreateTime(new Date());
+                    labRiskPlanAbnormalLog.setGroupId(groupId);
+                    labRiskPlanAbnormalLog.setRiskAttribute(labRiskPlanLevel.getRiskAttribute());
+                    labRiskPlanAbnormalLog.setRiskPlanLevelId(labRiskPlanLevel.getId());
+                    labRiskPlanAbnormalLog.setRiskPlanLevelName(RiskPlanLevelEnum.getValue(labRiskPlanLevel.getRiskPlanLevel()));
+                    labRiskPlanAbnormalLog.setRiskPlanLevel(labRiskPlanLevel.getRiskPlanLevel());
+                    labRiskPlanAbnormalLog.setRiskStatus(6L);
+                    labRiskPlanAbnormalLog.setRemark(a.getAutomanual() == 1 ? "自动灭火" : "手动灭火");
+                    //插入风险日志
+                    labRiskPlanAbnormalLogMapper.insertLabRiskPlanAbnormalLog(labRiskPlanAbnormalLog);
+                }
+            });
+        } catch (Exception e) {
+            log.error("一键灭火插入日志异常!{}",e);
+        }
     }
 
     /**

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabNotifyplanMapper.xml

@@ -104,10 +104,10 @@
             <if test="updateUserid != null ">and t.update_userid = #{updateUserid}</if>
             <if test="updateUsername != null  and updateUsername != ''">and t.update_username like concat('%', #{updateUsername}, '%')</if>
             <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
-                and str_to_date(t.date_format(create_time,'%Y-%m-%d'),'%Y-%m-%d') &gt;= str_to_date(#{beginTime},'%Y-%m-%d')
+                and str_to_date(date_format(t.create_time,'%Y-%m-%d'),'%Y-%m-%d') &gt;= str_to_date(#{beginTime},'%Y-%m-%d')
             </if>
             <if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
-                and str_to_date(t.date_format(create_time,'%Y-%m-%d'),'%Y-%m-%d') &lt;= str_to_date(#{endTime},'%Y-%m-%d')
+                and str_to_date(date_format(t.create_time,'%Y-%m-%d'),'%Y-%m-%d') &lt;= str_to_date(#{endTime},'%Y-%m-%d')
             </if>
             <if test="searchValue != null and searchValue != ''">
                 and (

+ 0 - 15
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabViolationMapper.xml

@@ -380,21 +380,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             )
             ) v ON s.`id` = v.`subject_id`
             )x2 GROUP BY x2.subjectId ORDER BY num DESC LIMIT 10
-            SELECT x2.subjectId currencyId,IFNULL(COUNT(1),0) num,x2.subjectName currencyName FROM (
-            SELECT v.id,v.`violation_type`,s.id subjectId,s.`name` subjectName
-            FROM sys_dept t INNER JOIN lab_subject s ON t.`dept_id` = s.`build_id` INNER JOIN (
-            SELECT v.reason violation_type, vs.`id`,v.`laboratory_id` subject_id,v.`create_time`
-            FROM lab_negativelist_history v INNER JOIN lab_violation_score_site vs ON v.`reason` = vs.`violation_name`
-            UNION ALL
-            SELECT '其他' violation_type , '-99' id,v.`laboratory_id` subject_id,v.`create_time`
-            FROM lab_negativelist_history v
-            WHERE v.reason NOT IN(
-            SELECT vs.`violation_name`
-            FROM lab_violation_score_site vs
-            )
-            ) v ON s.`id` = v.`subject_id`
-
-            )x2 GROUP BY x2.subjectId ORDER BY num DESC LIMIT 10
         )xs1 LEFT JOIN (
         SELECT xx2.type,xx2.content,xx2.num,xx2.subjectId currencyId,xx2.subjectName currencyName FROM (SELECT x2.subjectId,IFNULL(COUNT(1),0) num FROM (
         SELECT v.id,v.`violation_type`,s.id subjectId,s.`name` subjectName