| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
|
| | |
| | | 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];
|
| | |
| | | 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);
|
| | |
| | | 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];
|
| | |
| | | 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("");
|
| | |
| | |
|
| | | /**
|
| | | * 获取相机的空闲时段
|
| | | *
|
| | | * @param cameraId
|
| | | * @return
|
| | | */
|