| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper; |
| | | import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.mapper.ArdCamerasMapper; |
| | | import com.ruoyi.device.camera.service.IArdCamerasService; |
| | | import com.ruoyi.device.hiksdk.config.MinioClientSingleton; |
| | | import com.ruoyi.device.hiksdk.service.IHikClientService; |
| | | import com.ruoyi.inspect.domain.ArdVideoInspectRecord; |
| | | import com.ruoyi.inspect.mapper.ArdVideoInspectRecordMapper; |
| | | import com.ruoyi.inspect.service.IArdVideoInspectRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import com.ruoyi.inspect.mapper.ArdVideoInspectTaskMapper; |
| | | import com.ruoyi.inspect.domain.ArdVideoInspectTask; |
| | | import com.ruoyi.inspect.service.IArdVideoInspectTaskService; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动巡检任务 |
| | | */ |
| | |
| | | /*遍历所有时间满足的自动任务*/ |
| | | boolean timeCompare = DateUtils.TimeCompare(videoInspectTask.getStartTime(), videoInspectTask.getEndTime()); |
| | | if (timeCompare) { |
| | | log.info("自动任务启动:" + videoInspectTask.getId()); |
| | | //log.info("自动任务启动:" + videoInspectTask.getId()); |
| | | /*获取当前任务的所有巡检步骤*/ |
| | | List<ArdVideoInspectTaskStep> ardVideoInspectTaskStepList = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(videoInspectTask.getId()).getArdVideoInspectTaskStepList(); |
| | | if (ardVideoInspectTaskStepList.size() == 0) { |
| | |
| | | } |
| | | videoInspectTask.setArdVideoInspectTaskStepList(ardVideoInspectTaskStepList); |
| | | String currentStepId = videoInspectTask.getCurrentStepId(); |
| | | if (StringUtils.isNull(currentStepId)) { |
| | | String currentStepStartTime = videoInspectTask.getCurrentStepStartTime(); |
| | | if (StringUtils.isNull(currentStepId)||StringUtils.isEmpty(currentStepId)) { |
| | | //开始当前任务的第一个步骤 |
| | | videoInspectTask.setCurrentStepId(ardVideoInspectTaskStepList.get(0).getId()); |
| | | startRunStep(videoInspectTask);//开始当前任务的第一个步骤 |
| | | startRunStep(videoInspectTask); |
| | | } else /*当前任务已经执行,判断是否到期*/ { |
| | | if (StringUtils.isNull(videoInspectTask.getCurrentStepStartTime())) { |
| | | //当前任务启动时间为null,则说明当前步骤被中断,直接启动当前步骤 |
| | | if (StringUtils.isNull(currentStepStartTime)||StringUtils.isEmpty(currentStepStartTime)) { |
| | | //当前任务启动时间为空,则说明当前步骤被中断,直接启动当前步骤 |
| | | startRunStep(videoInspectTask); |
| | | } else { |
| | | boolean expird = isExpirdStep(videoInspectTask); /*判断当前步骤时间是否过期*/ |
| | | //判断当前步骤时间是否过期 |
| | | boolean expird = isExpirdStep(videoInspectTask); |
| | | if (expird) { |
| | | //停止录像 |
| | | stopRunStep(videoInspectTask); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自动手动合并,扫库方式,目前不使用 |
| | | */ |
| | | @Override |
| | | public void taskRun() { |
| | | /*扫描所有可执行任务1-时间满足2-自动*/ |
| | | ArdVideoInspectTask ardVideoInspectTask = new ArdVideoInspectTask(); |
| | | List<ArdVideoInspectTask> ardVideoInspectTasks = ardVideoInspectTaskMapper.selectArdVideoInspectTaskList(ardVideoInspectTask); |
| | | for (ArdVideoInspectTask videoInspectTask : ardVideoInspectTasks) { |
| | |
| | | continue; |
| | | } |
| | | videoInspectTask.setArdVideoInspectTaskStepList(ardVideoInspectTaskStepList); |
| | | String currentStepId = videoInspectTask.getCurrentStepId(); |
| | | if (StringUtils.isNull(currentStepId)) { |
| | | String currentStepId = videoInspectTask.getCurrentStepId();//当前步骤id |
| | | String currentStepStartTime = videoInspectTask.getCurrentStepStartTime();//当前步骤启动时间 |
| | | if (StringUtils.isNull(currentStepId)||StringUtils.isEmpty(currentStepId)) { |
| | | //开始第一个步骤 |
| | | videoInspectTask.setCurrentStepId(ardVideoInspectTaskStepList.get(0).getId()); |
| | | startRunStep(videoInspectTask);//开始当前任务的第一个步骤 |
| | | } else /*当前任务已经执行,判断是否到期*/ { |
| | | if (StringUtils.isNull(videoInspectTask.getCurrentStepStartTime())) { |
| | | //当前任务启动时间为null,则说明当前步骤被中断,直接启动当前步骤 |
| | | startRunStep(videoInspectTask); |
| | | } else { |
| | | if (StringUtils.isNull(currentStepStartTime)||StringUtils.isEmpty(currentStepStartTime)) { |
| | | //当前任务启动时间为空,则说明当前步骤被中断,直接启动当前步骤 |
| | | startRunStep(videoInspectTask); |
| | | } else { |
| | | boolean expird = isExpirdStep(videoInspectTask); /*判断当前步骤时间是否过期*/ |