Parcourir la source

预案相关日志优化,减少日志输出

hanzhiwei il y a 2 ans
Parent
commit
ab3deb0f69

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/LabMessageListener.java

@@ -1,6 +1,5 @@
 package com.zd.laboratory.event;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
 import com.zd.laboratory.api.constant.RiskPlanConstants;
 import com.zd.laboratory.api.entity.SensorFunctionStatus;

+ 7 - 9
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -628,7 +628,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
      */
     @Override
     public synchronized int triggerRiskPlan(SubFunction<SensorFunctionStatus> subFunction, Integer riskAttribute) {
-        //log.info("======进入触发预案======");
         int flag = 200;
         //这里判断火焰预案,就不继续往下执行了,锁死火焰预案
         if (redisService.getCacheObject("subjectByHuoyan" + subFunction.getSubId()) != null) {
@@ -637,12 +636,11 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         }
         //实验室传感器是否触发预案
         LabRiskPlanLevel labRiskPlanLevel = matchingRiskPlan(subFunction);
-        //log.info("触发预案具体信息={}", JSON.toJSONString(labRiskPlanLevel));
         //获取当前实验室触发预案的风险异常组列表
         List<LabRiskPlanAbnormalGroupVO> groupList = getLabRiskPlanAbnormalGroupVOS(subFunction.getSubId());
         //如果预案里面配置传感器都达标,需要执行预案对应的硬件操作
         if (labRiskPlanLevel.getRiskPlanId() != null) {
-            log.info("触发预案id:{}", labRiskPlanLevel.getRiskPlanId());
+            log.info("触发预案具体信息={}", JSON.toJSONString(labRiskPlanLevel));
             //预案缓存信息处理
             riskPlanRedisCache(subFunction);
             //获取系统配置通知模板
@@ -673,7 +671,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 log.info("预案缓存冗余时间,请等待...");
                 return flag;
             }
-            //log.info("传感器触发关闭预案!实验室id={}", subFunction.getSubId());
+            log.info("传感器触发关闭预案!实验室id={}", subFunction.getSubId());
             for (LabRiskPlanAbnormalGroupVO groupVo : groupList) {
                 //更新结束预案日志
                 updateLogs(subFunction, groupVo);
@@ -957,7 +955,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             try {
                 messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getContent() + str);
             } catch (Exception e) {
-                log.error("向一体机推送语音播报异常:" + e);
+                log.error("向一体机推送语音播报异常:{}",e);
             }
 
             //向一体机传感器预警
@@ -1181,7 +1179,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                     //插入风险硬件日志
                     operateHardWareInfo(labRiskPlanLevel, labRiskPlanAbnormalGroup.getSubjectId(), labRiskPlanAbnormalLog.getGroupId(), riskPlanJson.toString());
                 } catch (Exception e) {
-                    log.error("操作硬件设备异常::::" + e);
+                    log.error("操作硬件设备异!{}",e);
                 } finally {
                     return groupId;
                 }
@@ -1224,7 +1222,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                                 redisService.setCacheSetV2(BaseConstants.WRAN_KEY + subFunction.getSubId(), funSet);
                             });
                         } catch (Exception e) {
-                            log.error("操作硬件设备异常::::" + e);
+                            log.error("操作硬件设备异常{}",e);
                         } finally {
                             return groupId;
                         }
@@ -1240,7 +1238,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     }
 
     public void insertPlanAbnormalLogByHard(LabRiskPlanLevel labRiskPlanLevel, LabRiskPlanHardwareRelation hardRelation, Long subjectId, Long groupId, String riskPlanJson) {
-        log.error("打开硬件记录风险日志");
+        log.error("硬件记录风险日志");
         LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
         String operate = hardwareFunctionStatusConfig.getCache().get(hardRelation.getHardwareType() + "-" + hardRelation.getOperate()).getDescribe();
         labRiskPlanAbnormalLog.setRiskPlanId(labRiskPlanLevel.getRiskPlanId());
@@ -1359,7 +1357,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
      * @return 结果
      */
     public void operateHardWareInfo(LabRiskPlanLevel labRiskPlanLevel, Long subjectId, Long groupId, String riskPlanJson) {
-        log.error("这里需要开始调用相关硬件设备=======================================================");
+        log.info("开始调用相关硬件设备");
         //这里获取预案下的硬件关联列表
         List<LabRiskPlanHardwareRelation> riskPlanHardwareList = labRiskPlanLevel.getRiskPlanHardwareList();
         Map<HardwareTypeEnum, List<FunctionStatus>> hardwareFunList = hardwareFunctionStatusConfig.getHardwareFunctionStatusListMap();

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

@@ -127,9 +127,9 @@ public class LabSubjectManagerService {
 //    @Async("labExecutor")
     public void operationHardware(FunctionStatus status, List<LabHardware> hardwareList) {
         try {
-            logger.info("异步线程处理硬件信息:id={},name={}",Thread.currentThread().getId(),Thread.currentThread().getName());
             for (LabHardware hard : hardwareList) {
                 ResultData result = excutingComm(hard, status);
+                logger.info("操作硬件返回信息result={}",result);
                 Thread.sleep(timeWaitConfigUtils.getWaitTime());
             }
         } catch (InterruptedException e) {