aijinhui
2023-12-14 0306d5836a7a56614e01af35b9e70f0224b47cb2
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.inspect.service.impl;
import java.util.*;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.common.utils.DateUtils;
@@ -9,7 +10,6 @@
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.mapper.ArdCamerasMapper;
import com.ruoyi.device.camera.service.ICameraSdkService;
import com.ruoyi.utils.sdk.hiksdk.service.IHikClientService;
import com.ruoyi.inspect.domain.ArdVideoInspectRecord;
import com.ruoyi.inspect.mapper.ArdVideoInspectRecordMapper;
import com.ruoyi.inspect.mapper.ArdVideoInspectTaskStepMapper;
@@ -22,6 +22,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;
@@ -434,16 +435,15 @@
                String wellId = step.getWellId();
                if (!StringUtils.isNull(wellId)) {
                    /*获取井坐标*/
                    ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    double[] targetPositon = new double[3];
                    targetPositon[0] = ardAlarmpointsWell.getLongitude();
                    targetPositon[1] = ardAlarmpointsWell.getLatitude();
                    targetPositon[2] = ardAlarmpointsWell.getAltitude();
                    targetPositon[0] = well.getLongitude();
                    targetPositon[1] = well.getLatitude();
                    targetPositon[2] = well.getAltitude();
                    /*获取相机坐标*/
                    ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
                    if(StringUtils.isNull(cameras))
                    {
                        log.debug("找不到相机:"+cameraId);
                    if (StringUtils.isNull(cameras)) {
                        log.debug("找不到相机:" + cameraId);
                        return;
                    }
                    double[] cameraPositon = new double[3];
@@ -457,7 +457,26 @@
                    cmd.setTargetPosition(targetPositon);
                    cmd.setOperator("sys_patrol_inspect");
                    cmd.setExpired(step.getRecordingTime() * 60);
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    Map<String, Double> ptzMap = new HashMap<>();
                    switch (channel) {
                        case 1:
                            ptzMap.put("p", well.getGuideP1());
                            ptzMap.put("t", well.getGuideT1());
                            ptzMap.put("z", well.getGuideZ1());
                            break;
                        case 2:
                            ptzMap.put("p", well.getGuideP2());
                            ptzMap.put("t", well.getGuideT2());
                            ptzMap.put("z", well.getGuideZ2());
                            break;
                    }
                    cmd.setPtzMap(ptzMap);
                    boolean setTargetPosition;
                    if (cmd.getPtzMap().get("p") != null) {
                        setTargetPosition = cameraSdkService.setPtz(cmd);
                    } else {
                        setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    }
                    if (setTargetPosition) {
                        /*控制相机巡检成功,开始录像*/
                        cameraSdkService.recordStart(cmd);
@@ -492,16 +511,15 @@
                String wellId = step.getWellId();
                if (!StringUtils.isNull(wellId)) {
                    /*获取井坐标*/
                    ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    double[] targetPositon = new double[3];
                    targetPositon[0] = ardAlarmpointsWell.getLongitude();
                    targetPositon[1] = ardAlarmpointsWell.getLatitude();
                    targetPositon[2] = ardAlarmpointsWell.getAltitude();
                    targetPositon[0] = well.getLongitude();
                    targetPositon[1] = well.getLatitude();
                    targetPositon[2] = well.getAltitude();
                    /*获取相机坐标*/
                    ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
                    if(StringUtils.isNull(cameras))
                    {
                        log.debug("找不到相机:"+cameraId);
                    if (StringUtils.isNull(cameras)) {
                        log.debug("找不到相机:" + cameraId);
                        return;
                    }
                    double[] cameraPositon = new double[3];
@@ -515,7 +533,26 @@
                    cmd.setTargetPosition(targetPositon);
                    cmd.setOperator("sys_patrol_inspect");
                    cmd.setExpired(step.getRecordingTime() * 60);
                    boolean setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    Map<String, Double> ptzMap = new HashMap<>();
                    switch (channel) {
                        case 1:
                            ptzMap.put("p", well.getGuideP1());
                            ptzMap.put("t", well.getGuideT1());
                            ptzMap.put("z", well.getGuideZ1());
                            break;
                        case 2:
                            ptzMap.put("p", well.getGuideP2());
                            ptzMap.put("t", well.getGuideT2());
                            ptzMap.put("z", well.getGuideZ2());
                            break;
                    }
                    cmd.setPtzMap(ptzMap);
                    boolean setTargetPosition;
                    if (cmd.getPtzMap().get("p") != null) {
                        setTargetPosition = cameraSdkService.setPtz(cmd);
                    } else {
                        setTargetPosition = cameraSdkService.guideTargetPosition(cmd);
                    }
                    if (!setTargetPosition) {
                        /*控制失败,当前步骤启动时间置null*/
                        ardVideoInspectTask.setCurrentStepStartTime("");
@@ -650,6 +687,7 @@
    /**
     * 获取相机的空闲时段
     *
     * @param cameraId
     * @return
     */