|
|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zd.algorithm.api.camera.feign.RemoteCameraService;
|
|
|
+import com.zd.algorithm.api.forward.feign.RemoteForwardService;
|
|
|
import com.zd.algorithm.api.speaker.entity.ParamVo;
|
|
|
import com.zd.algorithm.api.speaker.entity.PlayVo;
|
|
|
import com.zd.algorithm.api.speaker.feign.RemoteSpeakService;
|
|
|
@@ -37,6 +38,7 @@ import com.zd.model.constant.BaseConstants;
|
|
|
import com.zd.model.constant.HttpStatus;
|
|
|
import com.zd.model.domain.R;
|
|
|
import com.zd.model.domain.ResultData;
|
|
|
+import com.zd.model.entity.SysFile;
|
|
|
import com.zd.model.entity.SysUser;
|
|
|
import com.zd.model.enums.HardwareTypeEnum;
|
|
|
import com.zd.model.enums.RiskPlanLevelEnum;
|
|
|
@@ -51,6 +53,7 @@ import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -148,6 +151,12 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
@Autowired
|
|
|
private ILabSparseHardwareService labSparseHardwareService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RemoteForwardService remoteForwardService;
|
|
|
+
|
|
|
+ //目前矿大环测 c111 192.168.1.4 192.168.1.5均使用下面密码
|
|
|
+ private final String streamUrlFormat = "rtsp://admin:bai12345@{}:554/h264/ch1/main/av_stream";
|
|
|
+
|
|
|
private static final Logger log = LoggerFactory.getLogger(LabRiskPlanServiceImpl.class);
|
|
|
|
|
|
|
|
|
@@ -647,8 +656,10 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
recordNotice(subFunction, labRiskPlanLevel, groupId);
|
|
|
//打开喇叭
|
|
|
openLoudSpeaker(subFunction.getSubId(), labRiskPlanLevel);
|
|
|
+ //获取摄像头第一帧
|
|
|
+ cutPhoto(subFunction.getSubId(),groupId);
|
|
|
//远程调用开始录制视频接口
|
|
|
- startVideo(subFunction.getSubId());
|
|
|
+ //startVideo(subFunction.getSubId());
|
|
|
//向前端发送mqtt预案触发提示
|
|
|
messageSendService.riskPlanTriggerNotice();
|
|
|
} else {
|
|
|
@@ -677,6 +688,26 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
return flag;
|
|
|
}
|
|
|
|
|
|
+ private void cutPhoto(Long subId, Long groupId) {
|
|
|
+ try {
|
|
|
+ LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subId);
|
|
|
+ if (labHardware != null && labHardware.getIpAddress() != null) {
|
|
|
+ String streamUrl = StrUtil.format(streamUrlFormat,labHardware.getIpAddress());
|
|
|
+ log.info("streamUrl = {}",streamUrl);
|
|
|
+ ResultData<SysFile> photograph = remoteForwardService.photograph(streamUrl);
|
|
|
+ log.info("文件上传状态:{},接口返回消息:{},文件上传路径:{}", photograph.getCode(), photograph.getMsg(), photograph.getData());
|
|
|
+ //更新风险概要 recordPhoto - 视频图片存放地址
|
|
|
+ String url = "statics/2023/11/23/87dfcc76-a75d-471d-ac79-90333f36b622.jpg";
|
|
|
+ labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupId, url);
|
|
|
+ //labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupId, photograph.getData().getUrl());
|
|
|
+ } else {
|
|
|
+ log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("远程调用截取图片接口异常!{}", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 更新结束预案日志
|
|
|
*
|
|
|
@@ -748,24 +779,24 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
|
|
|
private void stopVideoAndRecordLog(Long subjectId, Long groupId) {
|
|
|
//关闭视频录像
|
|
|
String recordVideo = "";
|
|
|
- try {
|
|
|
- LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subjectId);
|
|
|
- if (labHardware != null) {
|
|
|
- //开始录制视频
|
|
|
- log.info("远程调用关闭视频ip地址={}", labHardware.getIpAddress());
|
|
|
- R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
|
|
|
- log.info("录制视频结束返回结果打印={}", JSON.toJSONString(r));
|
|
|
- if (r.getCode() == HttpStatus.SUCCESS) {
|
|
|
- recordVideo = String.valueOf(r.getData());
|
|
|
- } else {
|
|
|
- log.info("结束录制视频失败!");
|
|
|
- }
|
|
|
- } else {
|
|
|
- log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("远程调用结束录制视频接口异常!{}", e);
|
|
|
- }
|
|
|
+// try {
|
|
|
+// LabHardware labHardware = labHardwareService.selectLabHardwareCameraBySub(subjectId);
|
|
|
+// if (labHardware != null) {
|
|
|
+// //开始录制视频
|
|
|
+// log.info("远程调用关闭视频ip地址={}", labHardware.getIpAddress());
|
|
|
+// R r = remoteCameraService.stopRecord(labHardware.getIpAddress());
|
|
|
+// log.info("录制视频结束返回结果打印={}", JSON.toJSONString(r));
|
|
|
+// if (r.getCode() == HttpStatus.SUCCESS) {
|
|
|
+// recordVideo = String.valueOf(r.getData());
|
|
|
+// } else {
|
|
|
+// log.info("结束录制视频失败!");
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// log.info("未查询到实验室关联摄像头信息!请检查ip是否为空!");
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("远程调用结束录制视频接口异常!{}", e);
|
|
|
+// }
|
|
|
//更新风险概要 recordVideo - 视频记录存放地址
|
|
|
String handlePerson = "";
|
|
|
if (!Objects.isNull(tokenService.getLoginUser())) {
|