liusuyi
2024-03-08 867b69b7e8b946dd839f1ef04de062ff68e43f9e
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -435,39 +435,38 @@
                String wellId = step.getWellId();
                if (!StringUtils.isNull(wellId)) {
                    /*获取井坐标*/
                    ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    ArdAlarmpointsWell well = ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(wellId);
                    if(StringUtils.isNull(well))
                    {
                        log.debug("找不到井:" + well.getWellId());
                        return;
                    }
                    log.debug("找到井:" + well.getWellId());
                    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();
                    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);
                    //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.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,11 +501,11 @@
                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);
                    double[] targetPositon = new double[2];
                    targetPositon[0] = well.getLongitude();
                    targetPositon[1] = well.getLatitude();
                    //targetPositon[2] = well.getAltitude();
                    /*获取相机坐标*/
                    ArdCameras cameras = ardCamerasMapper.selectArdCamerasById(cameraId);
                    if (StringUtils.isNull(cameras)) {
@@ -523,18 +522,8 @@
                    cmd.setChanNo(channel);
                    cmd.setTargetPosition(targetPositon);
                    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) {
                        /*控制失败,当前步骤启动时间置null*/
                        ardVideoInspectTask.setCurrentStepStartTime("");
@@ -572,7 +561,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();