| | |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.mapper.ArdCamerasMapper; |
| | |
| | | //开始下一步骤 |
| | | videoInspectTask.setCurrentStepId(nextStepId); |
| | | startRunStep(videoInspectTask); |
| | | }else{ |
| | | } else { |
| | | //未过期尝试引导,引导失败清空当前步骤开始时间,标记中断 |
| | | tryGuide(videoInspectTask); |
| | | } |
| | |
| | | //开始下一步骤 |
| | | videoInspectTask.setCurrentStepId(nextStepId); |
| | | startRunStep(videoInspectTask); |
| | | }else{tryGuide(videoInspectTask);} |
| | | } else { |
| | | tryGuide(videoInspectTask); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | |
| | | cmd.setChannelNum(channel); |
| | | cmd.setTargetPosition(targetPositon); |
| | | cmd.setOperator("sys_patrol_inspect"); |
| | | cmd.setExpired(step.getRecordingTime()*60); |
| | | cmd.setExpired(step.getRecordingTime() * 60); |
| | | boolean setTargetPosition = hikClientService.guideTargetPosition(cmd); |
| | | if (setTargetPosition) { |
| | | /*控制相机巡检成功,开始录像*/ |
| | | cmd.setEnable(true);//启动录像 |
| | | hikClientService.recordToMinio(cmd); |
| | | hikClientService.recordStart(cmd); |
| | | } else { |
| | | /*控制失败,当前步骤启动时间置null*/ |
| | | ardVideoInspectTask.setCurrentStepStartTime(""); |
| | |
| | | log.error("巡检开始异常:" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //尝试控制引导 |
| | | private void tryGuide(ArdVideoInspectTask ardVideoInspectTask) { |
| | | try { |
| | |
| | | cmd.setChannelNum(channel); |
| | | cmd.setTargetPosition(targetPositon); |
| | | cmd.setOperator("sys_patrol_inspect"); |
| | | cmd.setExpired(step.getRecordingTime()*60); |
| | | cmd.setExpired(step.getRecordingTime() * 60); |
| | | boolean setTargetPosition = hikClientService.guideTargetPosition(cmd); |
| | | if (!setTargetPosition) { |
| | | /*控制失败,当前步骤启动时间置null*/ |
| | | ardVideoInspectTask.setCurrentStepStartTime(""); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask); |
| | | } else { |
| | | log.debug("引导成功!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | log.error("巡检尝试引导异常:" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //步骤停止 |
| | | private void stopRunStep(ArdVideoInspectTask ardVideoInspectTask) { |
| | | try { |
| | |
| | | cmd.setCameraId(cameraId); |
| | | cmd.setChannelNum(channel); |
| | | cmd.setOperator("sys_patrol_inspect"); |
| | | cmd.setEnable(false);//停止录像 |
| | | cmd.setRecordBucketName("record"); |
| | | cmd.setRecordObjectName("inspect"); |
| | | cmd.setUploadMinio(true); |
| | | String url= hikClientService.recordToMinio(cmd); |
| | | cmd.setRecordObjectName("inspect_" + IdUtils.fastSimpleUUID()); |
| | | String url = hikClientService.recordStopToMinio(cmd); |
| | | /*插入巡检记录*/ |
| | | ArdVideoInspectRecord ardVideoInspectRecord = new ArdVideoInspectRecord(); |
| | | ardVideoInspectRecord.setStepId(step.getId()); |
| | |
| | | return ardVideoInspectTaskMapper.getTaskUsedCameraPeriods(cameraId); |
| | | } |
| | | |
| | | /** |
| | | * 获取相机的空闲时段 |
| | | * @param cameraId |
| | | * @return |
| | | */ |
| | | public List getCameraIdleTimeList(String cameraId) { |
| | | LinkedList<String> timeList = new LinkedList(); |
| | | List<Map> usedPeriods = this.getTaskUsedCameraPeriods(cameraId); |
| | |
| | | timeList.add((String) p.get("end_time")); |
| | | } |
| | | //判断第一个起始点 |
| | | if (timeList.getFirst().equals("00:00:00")) { |
| | | timeList.removeFirst(); |
| | | } else { |
| | | timeList.addFirst("00:00:00"); |
| | | } |
| | | //判断最后一个结束时间 |
| | | if (timeList.getLast().equals("23:59:59")) { |
| | | timeList.removeLast(); |
| | | } else { |
| | | timeList.addLast("23:59:59"); |
| | | } |
| | | //事件段为空,则全天作为一个时间段 |
| | | if (timeList.size() == 0) { |
| | | timeList.add("00:00:00"); |
| | | timeList.add("23:59:59"); |
| | | if (timeList.size() > 0) { |
| | | if ("00:00:00".equals(timeList.getFirst())) { |
| | | timeList.removeFirst(); |
| | | } else { |
| | | timeList.addFirst("00:00:00"); |
| | | } |
| | | //判断最后一个结束时间 |
| | | if ("23:59:59".equals(timeList.getLast())) { |
| | | timeList.removeLast(); |
| | | } else { |
| | | timeList.addLast("23:59:59"); |
| | | } |
| | | //事件段为空,则全天作为一个时间段 |
| | | if (timeList.size() == 0) { |
| | | timeList.add("00:00:00"); |
| | | timeList.add("23:59:59"); |
| | | } |
| | | |
| | | } |
| | | |
| | | return timeList; |