|
|
@@ -1,5 +1,7 @@
|
|
|
package com.zd.laboratory.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.date.TimeInterval;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@@ -17,6 +19,7 @@ import com.zd.common.core.security.TokenService;
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
import com.zd.common.core.utils.SecurityUtils;
|
|
|
import com.zd.common.core.utils.StringUtils;
|
|
|
+import com.zd.laboratory.api.constant.RiskPlanConstants;
|
|
|
import com.zd.laboratory.api.entity.FunctionStatus;
|
|
|
import com.zd.laboratory.api.entity.LabMessageContent;
|
|
|
import com.zd.laboratory.api.entity.SensorFunctionStatus;
|
|
|
@@ -1071,8 +1074,8 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
});
|
|
|
//有效预案延长一分钟
|
|
|
// if(redisService.getCacheObject("subjectByYa"+subFunction.getSubId())==null){
|
|
|
- redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 10L, TimeUnit.SECONDS);
|
|
|
-// redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 2L, TimeUnit.MINUTES);
|
|
|
+// redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 10L, TimeUnit.SECONDS);
|
|
|
+ redisService.setCacheObject("subjectByYa" + subFunction.getSubId(), subFunction.getSubId(), 2L, TimeUnit.MINUTES);
|
|
|
log.info("@@@@@@@@@@@@@@@@@@@@预案延长3分钟@@@@@@@@@@@@@@@@@@@@");
|
|
|
// }
|
|
|
Map<SenseType, List<SensorFunctionStatus>> sensorFunctionStatusListMap = hardwareFunctionStatusConfig.getSensorFunctionStatusListMap();
|
|
|
@@ -1085,7 +1088,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
String funNum1 = sensorFunctionStatusListMap.get(SenseType.getByCode(rps.getSensorType())).get(0).getFunNum();
|
|
|
if (funNum1.equals(sensorFunc.getFunNum())) {
|
|
|
getJsonStr(riskPlanJson, sensorFunc);
|
|
|
- labRiskPlanLevel.setTopName(labRiskPlanLevel.getTopName() + " " + sensorFunc.getDescribe());
|
|
|
+ labRiskPlanLevel.setTopName(labRiskPlanLevel.getTopName() + "-" + sensorFunc.getDescribe()+":"+sensorFunc.getVal());
|
|
|
sb.append(sensorFunc.getDescribe()).append("、");
|
|
|
}
|
|
|
}
|
|
|
@@ -1115,8 +1118,9 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
|
|
|
//向一体机推送语音播报
|
|
|
log.error("向一体机推送语音播报开始=======================================================");
|
|
|
+ String str = StringUtils.isBlank(labRiskPlanLevel.getVoicebroadcast()) ? "" : labRiskPlanLevel.getVoicebroadcast();
|
|
|
try {
|
|
|
- messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getVoicebroadcast());
|
|
|
+ messageSendService.sendOnepcSubNews(subFunction.getSubId(), 2, RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
|
|
|
} catch (Exception e) {
|
|
|
log.error("向一体机推送语音播报异常:" + e);
|
|
|
}
|
|
|
@@ -1127,7 +1131,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
log.error("向一体机传感器预警结束=======================================================");
|
|
|
//向一体机发送预警消息展示
|
|
|
log.error("向一体机发送预警消息展示开始=======================================================");
|
|
|
- insertMachineContent(subFunction.getSubId(), labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getVoicebroadcast());
|
|
|
+ insertMachineContent(subFunction.getSubId(), RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + str);
|
|
|
log.error("向一体机发送预警消息展示结束=======================================================");
|
|
|
|
|
|
//首页消息通知
|
|
|
@@ -1180,20 +1184,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
} catch (Exception e) {
|
|
|
log.error("开启喇叭失败!!!!!:" + e);
|
|
|
}
|
|
|
-
|
|
|
-// // TODO: 2022/3/26 目前只有c111外的响
|
|
|
-// List<PlayVo> playVoList = new ArrayList<>();
|
|
|
-// PlayVo playVo = new PlayVo();
|
|
|
-// playVo.setSn("ls20://0201BFB9D686");
|
|
|
-// playVo.setPort(18884);
|
|
|
-// ParamVo paramVo=new ParamVo();
|
|
|
-// playVo.setParams(paramVo);
|
|
|
-// playVoList.add(playVo);
|
|
|
-// if(radioStr.length()>0){
|
|
|
-// remoteSpeakService.textParseUrlAppIps(radioStr.toString(),playVoList);
|
|
|
-// log.info("喇叭播放完成!");
|
|
|
-// }
|
|
|
-
|
|
|
//首页预案流程通知
|
|
|
messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
|
|
|
//首页预案组通知
|
|
|
@@ -1204,22 +1194,24 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
redisService.setCacheObject("subjectByExit" + subFunction.getSubId(), subFunction.getSubId(), 30L, TimeUnit.SECONDS);
|
|
|
messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
|
|
|
}
|
|
|
+ //远程调用结束录制视频接口
|
|
|
try {
|
|
|
LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
|
|
|
- if (labHardware != null) {
|
|
|
- //开始录制视频
|
|
|
- // remoteCameraService.startRecord("192.168.1.64");
|
|
|
-// remoteCameraService.startRecord(labHardware.getIpAddress());
|
|
|
+ if (labHardware == null) {
|
|
|
+ log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
+ }
|
|
|
+ //开始录制视频
|
|
|
+ log.info("远程调用开始录制视频ip地址={}",labHardware.getIpAddress());
|
|
|
+ R r = remoteCameraService.startRecord(labHardware.getIpAddress());
|
|
|
+ log.info("开始录制视频返回结果打印={}", JSON.toJSONString(r));
|
|
|
+ if (r.getCode() != HttpStatus.SUCCESS){
|
|
|
+ log.info("开始录制视频失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ log.error("远程调用开始录制视频接口失败!{}",e);
|
|
|
}
|
|
|
-
|
|
|
- R r = remoteCameraService.startRecord("192.168.1.64");
|
|
|
- log.info("摄像头信息={}", JSON.toJSONString(r));
|
|
|
//向前端发送mqtt预案触发提示
|
|
|
messageSendService.riskPlanTriggerNotice();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -1298,22 +1290,28 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
// todo 操作人和视频结束时候的 url
|
|
|
|
|
|
//关闭视频录像
|
|
|
- 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) {
|
|
|
-
|
|
|
+ String recordVideo = "";
|
|
|
+ try {
|
|
|
+ LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
|
|
|
+ if (labHardware != null) {
|
|
|
+ //开始录制视频
|
|
|
+ log.info("远程调用关闭视频ip地址={}",labHardware.getIpAddress());
|
|
|
+ R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
|
|
|
+ log.info("录制视频结束返回结果打印={}", JSON.toJSONString(r));
|
|
|
+ if (r.getCode() == HttpStatus.SUCCESS){
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(r.getData()));
|
|
|
+ recordVideo = jsonObject.getString("msg");
|
|
|
+ }else {
|
|
|
+ log.info("结束录制视频失败!");
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("远程调用结束录制视频接口失败!{}",e);
|
|
|
}
|
|
|
-
|
|
|
- R r = remoteCameraService.stopRecord("192.168.1.64");
|
|
|
- log.info("摄像头信息2={}", JSON.toJSONString(r));
|
|
|
-
|
|
|
- //TODO 更新风险概要 recordVideo - 视频记录存放地址
|
|
|
- String handlePerson = null;
|
|
|
- String recordVideo = "";
|
|
|
+ //更新风险概要 recordVideo - 视频记录存放地址
|
|
|
+ String handlePerson = tokenService.getLoginUser().getNickName();
|
|
|
labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
|
|
|
log.info("groupId = {}",groupList.get(0).getId());
|
|
|
writerEnterRiskPlan(groupList.get(0).getId(),2);
|
|
|
@@ -1338,6 +1336,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
|
|
|
@Override
|
|
|
public int closeRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {
|
|
|
+ TimeInterval timer = DateUtil.timer();
|
|
|
//将风险预案写入归属组级表里面
|
|
|
LabRiskPlanAbnormalGroup labRiskPlanAbnormalGroup = new LabRiskPlanAbnormalGroup();
|
|
|
labRiskPlanAbnormalGroup.setSubjectId(subFunction.getSubId());
|
|
|
@@ -1413,10 +1412,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
newGroupOP.setStatus(0L);
|
|
|
newGroupOP.setUpdateTime(new Date());
|
|
|
labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
|
|
|
- //TODO 更新风险概要
|
|
|
- String handlePerson = null;
|
|
|
- String recordVideo = "";
|
|
|
- labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
|
|
|
//插入预案结束日志
|
|
|
insertPlanAbnormalLogByOver(groupVo, allRiskPlanJson, subFunction);
|
|
|
//向一体机传感器预警
|
|
|
@@ -1427,21 +1422,31 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_LOG);
|
|
|
//首页预案是否同步疏散线路
|
|
|
messageSendService.SendBigViewUpdate(BigViewDataType.SUB_RISKPLAN_EXIT);
|
|
|
- //关闭视频录像
|
|
|
- LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
|
|
|
- if (labHardware != null){
|
|
|
+ //远程调用结束录制视频接口
|
|
|
+ String recordVideo = "";
|
|
|
+ try {
|
|
|
+ LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subFunction.getSubId());
|
|
|
+ if (labHardware == null) {
|
|
|
+ log.info("手动关闭火焰预案-未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
+ }
|
|
|
//开始录制视频
|
|
|
-// remoteCameraService.startRecord("192.168.1.14");
|
|
|
- R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
|
|
|
- if (r.getCode() == HttpStatus.SUCCESS) {
|
|
|
-
|
|
|
+ log.info("手动关闭火焰预案-远程调用结束录制视频ip地址={}",labHardware.getIpAddress());
|
|
|
+ R r = remoteCameraService.startRecord(labHardware.getIpAddress());
|
|
|
+ log.info("手动关闭火焰预案-结束录制视频返回结果打印={}", JSON.toJSONString(r));
|
|
|
+ if (r.getCode() == HttpStatus.SUCCESS){
|
|
|
+ com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(JSON.toJSONString(r.getData()));
|
|
|
+ recordVideo = jsonObject.getString("msg");
|
|
|
+ }else {
|
|
|
+ log.info("手动关闭火焰预案-结束录制视频失败!");
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("手动关闭火焰预案-远程调用结束录制视频接口失败!{}",e);
|
|
|
}
|
|
|
- R r = remoteCameraService.stopRecord("192.168.1.64");
|
|
|
- if (r.getCode()== HttpStatus.SUCCESS){
|
|
|
-
|
|
|
- }
|
|
|
- log.info("assddd");
|
|
|
+ //更新风险概要
|
|
|
+ String handlePerson = tokenService.getLoginUser().getNickName();
|
|
|
+ labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
|
|
|
+ long interval = timer.interval();
|
|
|
+ log.info("执行花费时间={}",interval);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1608,7 +1613,8 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
//这里给消息记录表插入数据(给一体机设备发送语音通知)
|
|
|
LabWarnPushMessage labWarnPushMessage = new LabWarnPushMessage();
|
|
|
labWarnPushMessage.setRiskGroup(groupId);
|
|
|
- labWarnPushMessage.setContext(labRiskPlanLevel.getTopName() + "" + labRiskPlanLevel.getInformation());
|
|
|
+ String string = StringUtils.isBlank(labRiskPlanLevel.getInformation()) ? "" : labRiskPlanLevel.getInformation();
|
|
|
+ labWarnPushMessage.setContext(RiskPlanConstants.LAB_SAFETY_MANAGEMENT_SYSTEM + labRiskPlanLevel.getTopName() + string);
|
|
|
labWarnPushMessage.setPushType(WarnMessageTypeEnum.voice);
|
|
|
labWarnPushMessage.setWarnId(labRiskPlanLevel.getRiskPlanId());
|
|
|
labWarnPushMessage.setSubId(subjectId);
|