‘liusuyi’
2024-03-15 9ab35c4cbc2bf535ab15305b173d0e6d27ffb3ba
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;
@@ -436,17 +437,13 @@
                if (!StringUtils.isNull(wellId)) {
                    /*获取井坐标*/
                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    if(StringUtils.isNull(well))
                    {
                    if (StringUtils.isNull(well)) {
                        log.debug("找不到井:" + well.getWellId());
                        return;
                    }
                    log.debug("找到井:" + well.getWellId());
                    double[] targetPositon = new double[3];
                    targetPositon[0] = well.getLongitude();
                    targetPositon[1] = well.getLatitude();
                    //targetPositon[2] = well.getAltitude();
                    log.debug("找到井坐标:" +well.getLongitude()+"-"+well.getLatitude()+"-"+well.getAltitude());
                    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)) {
@@ -454,19 +451,14 @@
                        return;
                    }
                    log.debug("找到相机:" + 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.setChanNo(channel);
                    cmd.setTargetPosition(targetPositon);
                    cmd.setTargetPosition(new double[]{guidePoint.getLongitude(), guidePoint.getLatitude()});
                    cmd.setOperator("sys_patrol_inspect");
                    cmd.setExpired(step.getRecordingTime());//秒为单位
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd).get("code").equals(200);
                    if (setTargetPosition) {
                        /*控制相机巡检成功,开始录像*/
                        cameraSdkService.recordStart(cmd);
@@ -502,28 +494,28 @@
                if (!StringUtils.isNull(wellId)) {
                    /*获取井坐标*/
                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    double[] targetPositon = new double[2];
                    targetPositon[0] = well.getLongitude();
                    targetPositon[1] = well.getLatitude();
                    //targetPositon[2] = well.getAltitude();
                    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());//秒为单位
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd).get("code").equals(200);
                    if (!setTargetPosition) {
                        /*控制失败,当前步骤启动时间置null*/
                        ardVideoInspectTask.setCurrentStepStartTime("");
@@ -561,7 +553,7 @@
                cmd.setChanNo(channel);
                cmd.setOperator("sys_patrol_inspect");
                cmd.setRecordBucketName("record");
                cmd.setRecordObjectName("inspectGuide/" + DateUtils.getDateYYYYMMDD()+"/"+ IdUtils.fastSimpleUUID());
                cmd.setRecordObjectName("inspectGuide/" + DateUtils.getDateYYYYMMDD() + "/" + IdUtils.fastSimpleUUID());
                String url = cameraSdkService.recordStopToMinio(cmd);
                /*插入巡检记录*/
                ArdVideoInspectRecord ardVideoInspectRecord = new ArdVideoInspectRecord();
@@ -572,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);
@@ -598,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;