From bfc38cacac67f1bf2a5e857865d64cd49dc8175e Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 21 六月 2023 15:53:44 +0800
Subject: [PATCH] 增加通用光电报警接收 增加报警类型配置
---
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java | 80 ++++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 16 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
index 73f0659..e8123e7 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -34,7 +34,7 @@
* @date 2023-05-30
*/
@Service
-@Slf4j
+@Slf4j(topic = "PatrolInspectionTask")
public class ArdVideoInspectTaskServiceImpl implements IArdVideoInspectTaskService {
@Resource
private ArdVideoInspectTaskMapper ardVideoInspectTaskMapper;
@@ -229,6 +229,9 @@
//寮�濮嬩笅涓�姝ラ
videoInspectTask.setCurrentStepId(nextStepId);
startRunStep(videoInspectTask);
+ }else{
+ //鏈繃鏈熷皾璇曞紩瀵硷紝寮曞澶辫触娓呯┖褰撳墠姝ラ寮�濮嬫椂闂达紝鏍囪涓柇
+ tryGuide(videoInspectTask);
}
}
}
@@ -337,7 +340,7 @@
//寮�濮嬩笅涓�姝ラ
videoInspectTask.setCurrentStepId(nextStepId);
startRunStep(videoInspectTask);
- }
+ }else{tryGuide(videoInspectTask);}
}
}
} else {
@@ -414,7 +417,7 @@
log.info("褰撳墠寮�濮嬪贰妫�姝ラid涓虹┖");
return;
}
- log.info("姝ラ锛�" + currentStepId + "寮�濮�");
+ log.debug("宸℃姝ラ锛�" + currentStepId + "灏濊瘯寮�濮�");
String cameraId = ardVideoInspectTask.getCameraId();
Integer channel = ardVideoInspectTask.getChannel();
Optional<ArdVideoInspectTaskStep> objectOptional = ardVideoInspectTask.getArdVideoInspectTaskStepList().stream()
@@ -446,16 +449,13 @@
cmd.setChannelNum(channel);
cmd.setTargetPosition(targetPositon);
cmd.setOperator("sys_patrol_inspect");
- cmd.setExpired(step.getRecordingTime());
- boolean setTargetPosition = hikClientService.setTargetPosition(cmd);
+ cmd.setExpired(step.getRecordingTime()*60);
+ boolean setTargetPosition = hikClientService.guideTargetPosition(cmd);
if (setTargetPosition) {
/*鎺у埗鐩告満宸℃鎴愬姛锛屽紑濮嬪綍鍍�*/
cmd.setEnable(true);//鍚姩褰曞儚
hikClientService.recordToMinio(cmd);
} else {
- cmd.setEnable(false);//鍋滄褰曞儚
- cmd.setUploadMinio(true);
- hikClientService.recordToMinio(cmd);
/*鎺у埗澶辫触,褰撳墠姝ラ鍚姩鏃堕棿缃畁ull*/
ardVideoInspectTask.setCurrentStepStartTime("");
ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask);
@@ -466,12 +466,64 @@
log.error("宸℃寮�濮嬪紓甯革細" + ex.getMessage());
}
}
-
+ //灏濊瘯鎺у埗寮曞
+ private void tryGuide(ArdVideoInspectTask ardVideoInspectTask) {
+ try {
+ String currentStepId = ardVideoInspectTask.getCurrentStepId();
+ if (StringUtils.isNull(currentStepId)) {
+ log.info("褰撳墠寮�濮嬪贰妫�姝ラid涓虹┖");
+ return;
+ }
+ log.debug("宸℃姝e父锛屽皾璇曞紩瀵硷細" + currentStepId);
+ String cameraId = ardVideoInspectTask.getCameraId();
+ Integer channel = ardVideoInspectTask.getChannel();
+ Optional<ArdVideoInspectTaskStep> objectOptional = ardVideoInspectTask.getArdVideoInspectTaskStepList().stream()
+ .filter(obj -> obj.getId().equals(currentStepId))
+ .findFirst();
+ if (objectOptional.isPresent()) {
+ ArdVideoInspectTaskStep step = objectOptional.get();
+ String wellId = step.getWellId();
+ if (!StringUtils.isNull(wellId)) {
+ /*鑾峰彇浜曞潗鏍�*/
+ ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
+ double[] targetPositon = new double[3];
+ targetPositon[0] = ardAlarmpointsWell.getLongitude();
+ targetPositon[1] = ardAlarmpointsWell.getLatitude();
+ targetPositon[2] = ardAlarmpointsWell.getAltitude();
+ /*鑾峰彇鐩告満鍧愭爣*/
+ ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
+ double[] cameraPositon = new double[3];
+ cameraPositon[0] = cameras.getLongitude();
+ cameraPositon[1] = cameras.getLatitude();
+ cameraPositon[2] = cameras.getAltitude();
+ /*鎺у埗鐩告満宸℃*/
+ CameraCmd cmd = new CameraCmd();
+ cmd.setCameraId(cameraId);
+ cmd.setChannelNum(channel);
+ cmd.setTargetPosition(targetPositon);
+ cmd.setOperator("sys_patrol_inspect");
+ cmd.setExpired(step.getRecordingTime()*60);
+ boolean setTargetPosition = hikClientService.guideTargetPosition(cmd);
+ if (!setTargetPosition) {
+ /*鎺у埗澶辫触,褰撳墠姝ラ鍚姩鏃堕棿缃畁ull*/
+ ardVideoInspectTask.setCurrentStepStartTime("");
+ ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask);
+ }
+ else
+ {
+ log.debug("寮曞鎴愬姛!");
+ }
+ }
+ }
+ } catch (Exception ex) {
+ log.error("宸℃灏濊瘯寮曞寮傚父锛�" + ex.getMessage());
+ }
+ }
//姝ラ鍋滄
private void stopRunStep(ArdVideoInspectTask ardVideoInspectTask) {
try {
String currentStepId = ardVideoInspectTask.getCurrentStepId();
- log.info("姝ラ锛�" + currentStepId + "鍋滄");
+ log.debug("宸℃姝ラ锛�" + currentStepId + "鍋滄");
if (StringUtils.isNull(currentStepId)) {
log.info("褰撳墠鍋滄宸℃姝ラid涓虹┖");
return;
@@ -490,13 +542,10 @@
cmd.setChannelNum(channel);
cmd.setOperator("sys_patrol_inspect");
cmd.setEnable(false);//鍋滄褰曞儚
- String uuid = UUID.randomUUID().toString().replace("-", "");
- String time = new SimpleDateFormat("yyyyMMdd").format(new Date());
- String recordName = cameraId + "/" + time + "/" + uuid + ".mp4";
cmd.setRecordBucketName("record");
- cmd.setRecordObjectName(recordName);
+ cmd.setRecordObjectName("inspect");
cmd.setUploadMinio(true);
- hikClientService.recordToMinio(cmd);
+ String url= hikClientService.recordToMinio(cmd);
/*鎻掑叆宸℃璁板綍*/
ArdVideoInspectRecord ardVideoInspectRecord = new ArdVideoInspectRecord();
ardVideoInspectRecord.setStepId(step.getId());
@@ -508,7 +557,6 @@
Date currentStepStopDate = DateUtils.addMinutes(currentStepStartDate, step.getRecordingTime());
ardVideoInspectRecord.setStartTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, currentStepStartDate));
ardVideoInspectRecord.setEndTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, currentStepStopDate));
- String url = MinioClientSingleton.domainUrl + "/" + cmd.getRecordBucketName() + "/" + recordName;
ardVideoInspectRecord.setRecordFilePath(url);
ardVideoInspectRecordMapper.insertArdVideoInspectRecord(ardVideoInspectRecord);
}
--
Gitblit v1.9.3