From 9ab35c4cbc2bf535ab15305b173d0e6d27ffb3ba Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期五, 15 三月 2024 15:28:07 +0800
Subject: [PATCH] 增加密码验证接口

---
 ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java |   74 +++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 36 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 3ca1966..9312614 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
@@ -1,6 +1,8 @@
 package com.ruoyi.inspect.service.impl;
 
 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;
@@ -21,6 +23,7 @@
 import com.ruoyi.inspect.mapper.ArdVideoInspectTaskMapper;
 import com.ruoyi.inspect.domain.ArdVideoInspectTask;
 import com.ruoyi.inspect.service.IArdVideoInspectTaskService;
+
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 
@@ -433,30 +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();
-                    /*鑾峰彇鐩告満鍧愭爣*/
-                    ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
-                    if(StringUtils.isNull(cameras))
-                    {
-                        log.debug("鎵句笉鍒扮浉鏈�:"+cameraId);
+                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
+                    if (StringUtils.isNull(well)) {
+                        log.debug("鎵句笉鍒颁簳:" + well.getWellId());
                         return;
                     }
-                    double[] cameraPositon = new double[3];
-                    cameraPositon[0] = cameras.getLongitude();
-                    cameraPositon[1] = cameras.getLatitude();
-                    cameraPositon[2] = cameras.getAltitude();
+                    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;
+                    }
+                    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);
-                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
+                    cmd.setExpired(step.getRecordingTime());//绉掍负鍗曚綅
+                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd).get("code").equals(200);
                     if (setTargetPosition) {
                         /*鎺у埗鐩告満宸℃鎴愬姛锛屽紑濮嬪綍鍍�*/
                         cameraSdkService.recordStart(cmd);
@@ -491,30 +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();
-                    /*鑾峰彇鐩告満鍧愭爣*/
-                    ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
-                    if(StringUtils.isNull(cameras))
+                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
+                    if(StringUtils.isNull(well))
                     {
-                        log.debug("鎵句笉鍒扮浉鏈�:"+cameraId);
+                        log.debug("鎵句笉鍒颁簳:" + well.getWellId());
                         return;
                     }
-                    double[] cameraPositon = new double[3];
-                    cameraPositon[0] = cameras.getLongitude();
-                    cameraPositon[1] = cameras.getLatitude();
-                    cameraPositon[2] = cameras.getAltitude();
+                    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;
+                    }
+                    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);
-                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
+                    cmd.setExpired(step.getRecordingTime());//绉掍负鍗曚綅
+                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd).get("code").equals(200);
                     if (!setTargetPosition) {
                         /*鎺у埗澶辫触,褰撳墠姝ラ鍚姩鏃堕棿缃畁ull*/
                         ardVideoInspectTask.setCurrentStepStartTime("");
@@ -552,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();
@@ -563,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);
@@ -589,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;
@@ -649,6 +650,7 @@
 
     /**
      * 鑾峰彇鐩告満鐨勭┖闂叉椂娈�
+     *
      * @param cameraId
      * @return
      */

--
Gitblit v1.9.3