From 4b085b357d5e3137a79b4618a15dcba1fc5adf7b Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期四, 14 三月 2024 08:53:43 +0800
Subject: [PATCH] 优化
---
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java | 75 ++++++++++++++-----------------------
1 files changed, 28 insertions(+), 47 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 fa639b2..482cbf0 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
@@ -2,6 +2,7 @@
import java.util.*;
+import com.ruoyi.alarm.global.domain.GuidePoint;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.common.utils.DateUtils;
@@ -435,39 +436,29 @@
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();
+ ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
+ if (StringUtils.isNull(well)) {
+ log.debug("鎵句笉鍒颁簳:" + well.getWellId());
+ return;
+ }
+ log.debug("鎵惧埌浜�:" + well.getWellId());
+ GuidePoint guidePoint = new GuidePoint().setLongitude(well.getLongitude()).setLatitude(well.getLatitude());
+ log.debug("鎵惧埌浜曞潗鏍�:" + well.getLongitude() + "-" + well.getLatitude() + "-" + well.getAltitude());
/*鑾峰彇鐩告満鍧愭爣*/
ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
if (StringUtils.isNull(cameras)) {
log.debug("鎵句笉鍒扮浉鏈�:" + cameraId);
return;
}
- double[] cameraPositon = new double[3];
- cameraPositon[0] = cameras.getLongitude();
- cameraPositon[1] = cameras.getLatitude();
- cameraPositon[2] = cameras.getAltitude();
+ log.debug("鎵惧埌鐩告満:" + cameraId);
/*鎺у埗鐩告満宸℃*/
CameraCmd cmd = new CameraCmd();
cmd.setCameraId(cameraId);
cmd.setChanNo(channel);
- cmd.setTargetPosition(targetPositon);
+ cmd.setTargetPosition(new double[]{guidePoint.getLongitude(), guidePoint.getLatitude()});
cmd.setOperator("sys_patrol_inspect");
- cmd.setExpired(step.getRecordingTime() * 60);
- Map<String, Double> ptzMap = new HashMap<>();
- ptzMap.put("p", ardAlarmpointsWell.getGuideP());
- ptzMap.put("t", ardAlarmpointsWell.getGuideT());
- ptzMap.put("z", ardAlarmpointsWell.getGuideZ());
- cmd.setPtzMap(ptzMap);
- boolean setTargetPosition;
- if (cmd.getPtzMap().get("p") != null) {
- setTargetPosition = cameraSdkService.setPtz(cmd);
- } else {
- setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
- }
+ cmd.setExpired(step.getRecordingTime());//绉掍负鍗曚綅
+ boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
if (setTargetPosition) {
/*鎺у埗鐩告満宸℃鎴愬姛锛屽紑濮嬪綍鍍�*/
cameraSdkService.recordStart(cmd);
@@ -502,39 +493,29 @@
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();
+ ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
+ if(StringUtils.isNull(well))
+ {
+ log.debug("鎵句笉鍒颁簳:" + well.getWellId());
+ return;
+ }
+ log.debug("鎵惧埌浜�:" + well.getWellId());
+ GuidePoint guidePoint = new GuidePoint().setLongitude(well.getLongitude()).setLatitude(well.getLatitude());
/*鑾峰彇鐩告満鍧愭爣*/
ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
if (StringUtils.isNull(cameras)) {
log.debug("鎵句笉鍒扮浉鏈�:" + cameraId);
return;
}
- double[] cameraPositon = new double[3];
- cameraPositon[0] = cameras.getLongitude();
- cameraPositon[1] = cameras.getLatitude();
- cameraPositon[2] = cameras.getAltitude();
+ log.debug("鎵惧埌鐩告満:" + cameraId);
/*鎺у埗鐩告満宸℃*/
CameraCmd cmd = new CameraCmd();
cmd.setCameraId(cameraId);
cmd.setChanNo(channel);
- cmd.setTargetPosition(targetPositon);
+ cmd.setTargetPosition(new double[]{guidePoint.getLongitude(), guidePoint.getLatitude()});
cmd.setOperator("sys_patrol_inspect");
- cmd.setExpired(step.getRecordingTime() * 60);
- Map<String, Double> ptzMap = new HashMap<>();
- ptzMap.put("p", ardAlarmpointsWell.getGuideP());
- ptzMap.put("t", ardAlarmpointsWell.getGuideT());
- ptzMap.put("z", ardAlarmpointsWell.getGuideZ());
- cmd.setPtzMap(ptzMap);
- boolean setTargetPosition;
- if (cmd.getPtzMap().get("p") != null) {
- setTargetPosition = cameraSdkService.setPtz(cmd);
- } else {
- setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
- }
+ cmd.setExpired(step.getRecordingTime());//绉掍负鍗曚綅
+ boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
if (!setTargetPosition) {
/*鎺у埗澶辫触,褰撳墠姝ラ鍚姩鏃堕棿缃畁ull*/
ardVideoInspectTask.setCurrentStepStartTime("");
@@ -572,7 +553,7 @@
cmd.setChanNo(channel);
cmd.setOperator("sys_patrol_inspect");
cmd.setRecordBucketName("record");
- cmd.setRecordObjectName("inspect_" + IdUtils.fastSimpleUUID());
+ cmd.setRecordObjectName("inspectGuide/" + DateUtils.getDateYYYYMMDD() + "/" + IdUtils.fastSimpleUUID());
String url = cameraSdkService.recordStopToMinio(cmd);
/*鎻掑叆宸℃璁板綍*/
ArdVideoInspectRecord ardVideoInspectRecord = new ArdVideoInspectRecord();
@@ -583,7 +564,7 @@
ardVideoInspectRecord.setWellName(ardAlarmpointsWell.getWellId());
}
Date currentStepStartDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, currentStepStartTime);
- Date currentStepStopDate = DateUtils.addMinutes(currentStepStartDate, step.getRecordingTime());
+ Date currentStepStopDate = DateUtils.addSeconds(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));
ardVideoInspectRecord.setRecordFilePath(url);
@@ -609,7 +590,7 @@
ArdVideoInspectTaskStep currentStep = objectOptional.get();
/*鑾峰彇鍒板綋鍓嶆楠ょ殑寮�濮嬪拰缁撴潫鏃堕棿*/
Date currentStepStartDate = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, currentStepStartTime);
- Date currentStepStopDate = DateUtils.addMinutes(currentStepStartDate, currentStep.getRecordingTime());
+ Date currentStepStopDate = DateUtils.addSeconds(currentStepStartDate, currentStep.getRecordingTime());
/*鍒ゆ柇褰撳墠姝ラ鏃堕棿鏄惁杩囨湡*/
if (!DateUtils.TimeCompare(currentStepStartDate, currentStepStopDate)) {
return true;
--
Gitblit v1.9.3