|  |  | 
 |  |  | import com.ruoyi.inspect.domain.ArdVideoInspectRecord;
 | 
 |  |  | import com.ruoyi.inspect.mapper.ArdVideoInspectRecordMapper;
 | 
 |  |  | import com.ruoyi.inspect.mapper.ArdVideoInspectTaskStepMapper;
 | 
 |  |  | import com.ruoyi.utils.websocket.util.WebSocketUtils;
 | 
 |  |  | import lombok.extern.slf4j.Slf4j;
 | 
 |  |  | import org.springframework.stereotype.Service;
 | 
 |  |  | import com.ruoyi.common.utils.StringUtils;
 | 
 |  |  | 
 |  |  |                     if (setTargetPosition) {
 | 
 |  |  |                         /*控制相机巡检成功,开始录像*/
 | 
 |  |  |                         cameraSdkService.recordStart(cmd);
 | 
 |  |  |                         //region 通知前端
 | 
 |  |  |                         Map<String, Object> message = new HashMap<>();
 | 
 |  |  |                         Map<String, String> data = new HashMap<>();
 | 
 |  |  |                         data.put("cameraId", cmd.getCameraId());
 | 
 |  |  |                         data.put("wellId", well.getWellId());
 | 
 |  |  |                         data.put("type", ardVideoInspectTask.getInspectMode()+"巡检");
 | 
 |  |  |                         message.put("70000", data);
 | 
 |  |  |                         WebSocketUtils.sendMessageAll(message);
 | 
 |  |  |                         //endregion
 | 
 |  |  |                     } else {
 | 
 |  |  |                         /*控制失败,当前步骤启动时间置null*/
 | 
 |  |  |                         ardVideoInspectTask.setCurrentStepStartTime("");
 | 
 |  |  | 
 |  |  |                         ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask);
 | 
 |  |  |                     } else {
 | 
 |  |  |                         log.debug("引导成功!");
 | 
 |  |  |                         //region 通知前端
 | 
 |  |  |                         Map<String, Object> message = new HashMap<>();
 | 
 |  |  |                         Map<String, String> data = new HashMap<>();
 | 
 |  |  |                         data.put("cameraId", cmd.getCameraId());
 | 
 |  |  |                         data.put("wellId", well.getWellId());
 | 
 |  |  |                         data.put("type", ardVideoInspectTask.getInspectMode()+"巡检");
 | 
 |  |  |                         message.put("70000", data);
 | 
 |  |  |                         WebSocketUtils.sendMessageAll(message);
 | 
 |  |  |                         //endregion
 | 
 |  |  |                     }
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  | 
 |  |  |     public List getCameraIdleTimeList(String cameraId) {
 | 
 |  |  |         LinkedList<String> timeList = new LinkedList();
 | 
 |  |  |         List<Map> usedPeriods = this.getTaskUsedCameraPeriods(cameraId);
 | 
 |  |  |         for (Map p :
 | 
 |  |  |                 usedPeriods) {
 | 
 |  |  |             timeList.add((String) p.get("start_time"));
 | 
 |  |  |             timeList.add((String) p.get("end_time"));
 | 
 |  |  |         }
 | 
 |  |  |         //判断第一个起始点
 | 
 |  |  |         if (timeList.size() > 0) {
 | 
 |  |  |             if ("00:00:00".equals(timeList.getFirst())) {
 | 
 |  |  |                 timeList.removeFirst();
 | 
 |  |  |             } else {
 | 
 |  |  |                 timeList.addFirst("00:00:00");
 | 
 |  |  |         //事件段为空,则全天作为一个时间段
 | 
 |  |  |         if (usedPeriods.size() == 0) {
 | 
 |  |  |             timeList.add("00:00:00");
 | 
 |  |  |             timeList.add("23:59:59");
 | 
 |  |  |         }else{
 | 
 |  |  |             for (Map p :
 | 
 |  |  |                     usedPeriods) {
 | 
 |  |  |                 timeList.add((String) p.get("start_time"));
 | 
 |  |  |                 timeList.add((String) p.get("end_time"));
 | 
 |  |  |             }
 | 
 |  |  |             //判断最后一个结束时间
 | 
 |  |  |             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");
 | 
 |  |  |             }
 | 
 |  |  |             //判断第一个起始点
 | 
 |  |  |             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");
 | 
 |  |  |                 }
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  |             }
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  |         return timeList;
 | 
 |  |  |     }
 | 
 |  |  | }
 |