| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | |
| | | ardVideoInspectTask.setUpdateBy(SecurityUtils.getUsername()); |
| | | ardVideoInspectTask.setUpdateTime(DateUtils.getNowDate()); |
| | | // ardVideoInspectTaskMapper.deleteArdVideoInspectTaskStepByTaskId(ardVideoInspectTask.getId()); |
| | | // insertArdVideoInspectTaskStep(ardVideoInspectTask); |
| | | insertArdVideoInspectTaskStep(ardVideoInspectTask); |
| | | return ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask); |
| | | } |
| | | |
| | |
| | | public void manualTaskRun(String TaskId) { |
| | | try { |
| | | ArdVideoInspectTask videoInspectTask = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(TaskId); |
| | | if(!videoInspectTask.getMenualSwitch().equals("开")) |
| | | { |
| | | if (!videoInspectTask.getMenualSwitch().equals("开")) { |
| | | return; |
| | | } |
| | | if (videoInspectTask.getArdVideoInspectTaskStepList().size() == 0) { |
| | |
| | | continue; |
| | | } |
| | | videoInspectTask.setArdVideoInspectTaskStepList(ardVideoInspectTaskStepList); |
| | | |
| | | String currentStepId = videoInspectTask.getCurrentStepId(); |
| | | String currentStepStartTime = videoInspectTask.getCurrentStepStartTime(); |
| | | if (StringUtils.isNull(currentStepId) || StringUtils.isEmpty(currentStepId)) { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if(Global.task_record.contains(videoInspectTask.getId())) |
| | | { |
| | | /*停止录像*/ |
| | | CameraCmd cmd = new CameraCmd(); |
| | | cmd.setCameraId(videoInspectTask.getCameraId()); |
| | | cmd.setChannelNum(videoInspectTask.getChannel()); |
| | | cmd.setOperator("sys_patrol_inspect"); |
| | | cmd.setEnable(false);//停止录像 |
| | | String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | String time = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | String recordName = videoInspectTask.getCameraId() + "/" + time + "/" + uuid + ".mp4"; |
| | | cmd.setRecordBucketName("record"); |
| | | cmd.setRecordObjectName(recordName); |
| | | cmd.setUploadMinio(true); |
| | | hikClientService.recordToMinio(cmd); |
| | | } |
| | | if (StringUtils.isEmpty(videoInspectTask.getCurrentStepId()) || StringUtils.isEmpty(videoInspectTask.getCurrentStepStartTime())) { |
| | | continue; |
| | | } |
| | | /*过期的任务清空当前步骤信息*/ |
| | | // if(Global.task_record.contains(videoInspectTask.getId())) |
| | | // { |
| | | // /*停止录像*/ |
| | | // CameraCmd cmd = new CameraCmd(); |
| | | // cmd.setCameraId(videoInspectTask.getCameraId()); |
| | | // cmd.setChannelNum(videoInspectTask.getChannel()); |
| | | // cmd.setOperator("sys_patrol_inspect"); |
| | | // cmd.setEnable(false);//停止录像 |
| | | // String uuid = UUID.randomUUID().toString().replace("-", ""); |
| | | // String time = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | // String recordName = videoInspectTask.getCameraId() + "/" + time + "/" + uuid + ".mp4"; |
| | | // cmd.setRecordBucketName("record"); |
| | | // cmd.setRecordObjectName(recordName); |
| | | // cmd.setUploadMinio(true); |
| | | // hikClientService.recordToMinio(cmd); |
| | | // } |
| | | if (StringUtils.isNotEmpty(videoInspectTask.getCurrentStepId())) { |
| | | videoInspectTask.setCurrentStepId(""); |
| | | videoInspectTask.setCurrentStepStartTime(""); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTask(videoInspectTask); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(videoInspectTask); |
| | | } |
| | | if (StringUtils.isNotEmpty(videoInspectTask.getCurrentStepStartTime())) { |
| | | videoInspectTask.setCurrentStepId(""); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(videoInspectTask); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | /*更新任务当前步骤id和步骤启动时间*/ |
| | | ardVideoInspectTask.setCurrentStepId(step.getId()); |
| | | ardVideoInspectTask.setCurrentStepStartTime(DateUtils.getTime()); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask); |
| | | String wellId = step.getWellId(); |
| | | if (!StringUtils.isNull(wellId)) { |
| | | /*获取井坐标*/ |
| | |
| | | cmd.setExpired(step.getRecordingTime()); |
| | | boolean setTargetPosition = hikClientService.setTargetPosition(cmd); |
| | | if (setTargetPosition) { |
| | | if(!Global.task_record.contains(ardVideoInspectTask.getId())) |
| | | { |
| | | if (!Global.task_record.contains(ardVideoInspectTask.getId())) { |
| | | /*控制相机巡检成功,开始录像*/ |
| | | cmd.setEnable(true);//启动录像 |
| | | hikClientService.recordToMinio(cmd); |
| | |
| | | hikClientService.recordToMinio(cmd); |
| | | /*控制失败,当前步骤启动时间置null*/ |
| | | ardVideoInspectTask.setCurrentStepStartTime(""); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask); |
| | | } |
| | | } |
| | | } |
| | |
| | | log.error("巡检开始异常:" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //步骤停止 |
| | | private void stopRunStep(ArdVideoInspectTask ardVideoInspectTask) { |
| | | try { |
| | |
| | | log.error("巡检停止异常:" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | //步骤判断是否过期 |
| | | private boolean isExpirdStep(ArdVideoInspectTask ardVideoInspectTask) { |
| | | try { |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //步骤切换 |
| | | private String changeNextStep(ArdVideoInspectTask ardVideoInspectTask) { |
| | | try { |
| | |
| | | .findFirst() |
| | | .orElse(null); |
| | | avit.setCurrentStepId(nextStepId); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTask(avit); |
| | | ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(avit); |
| | | log.info("步骤:" + currentStepId + "切换为" + nextStepId); |
| | | return nextStepId; |
| | | } |