| | |
| | | package com.ruoyi.alarm.global.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.alarm.access.domain.ArdAlarmAccess; |
| | | import com.ruoyi.alarm.access.service.IArdAlarmAccessService; |
| | | import com.ruoyi.alarm.external.domain.ArdAlarmExternal; |
| | |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import com.ruoyi.utils.websocket.util.WebSocketUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.*; |
| | | |
| | | import static com.ruoyi.utils.websocket.util.WebSocketUtils.ONLINE_USER_SESSIONS; |
| | | |
| | | /** |
| | | * @Description: 队列处理器 |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //异步处理任务 |
| | | public void processTask(GuideTask guideTask) { |
| | | try { |
| | |
| | | cmd.setChanNo(guideTask.getChanNo()); |
| | | cmd.setOperator(guideTask.getAlarmType()); |
| | | cmd.setExpired(30); |
| | | Map<String, Double> ptzMap=new HashMap<>(); |
| | | if(guideTask.getTargetPTZ()!=null) { |
| | | if (guideTask.getChanNo() == 1) { |
| | | ptzMap.put("p", guideTask.getTargetPTZ().getP1()); |
| | | ptzMap.put("t", guideTask.getTargetPTZ().getT1()); |
| | | ptzMap.put("z", guideTask.getTargetPTZ().getZ1()); |
| | | } |
| | | if (guideTask.getChanNo() == 2) { |
| | | ptzMap.put("p", guideTask.getTargetPTZ().getP2()); |
| | | ptzMap.put("t", guideTask.getTargetPTZ().getT2()); |
| | | ptzMap.put("z", guideTask.getTargetPTZ().getZ2()); |
| | | } |
| | | cmd.setPtzMap(ptzMap); |
| | | } |
| | | cmd.setRecordBucketName("record"); |
| | | cmd.setTargetPosition(guideTask.getTargetPosition()); |
| | | cmd.setRecordObjectName("alarmGuide/"+ DateUtils.getDateYYYYMMDD()+"/"+guideTask.getAlarmType()+"/"+guideTask.getAlarmId()); |
| | | cmd.setRecordObjectName("alarmGuide/" + DateUtils.getDateYYYYMMDD() + "/" + guideTask.getAlarmType() + "/" + guideTask.getAlarmId()); |
| | | ICameraSdkService cameraSdkService = SpringUtils.getBean(ICameraSdkService.class); |
| | | log.debug("开始引导"); |
| | | boolean recordFlag = false; |
| | | boolean guideRes = cameraSdkService.guideTargetPosition(cmd); |
| | | boolean guideRes = false; |
| | | if (guideTask.getIsGuidePTZ()) { |
| | | AjaxResult result = cameraSdkService.setPtz(cmd); |
| | | if (result.get("code").equals(200)) { |
| | | guideRes = true; |
| | | } |
| | | } else { |
| | | guideRes = cameraSdkService.guideTargetPosition(cmd); |
| | | } |
| | | if (guideRes) { |
| | | log.debug("引导成功"); |
| | | //region 通知前端 |
| | | Map<String, Object> message = new HashMap<>(); |
| | | Map<String, String> data = new HashMap<>(); |
| | | data.put("cameraId", cmd.getCameraId()); |
| | | data.put("chanNo", cmd.getChanNo().toString()); |
| | | data.put("alarmType", cmd.getOperator()); |
| | | data.put("alarmId", guideTask.getAlarmId()); |
| | | data.put("wellId", guideTask.getWellId()); |
| | | message.put("70000", data); |
| | | WebSocketUtils.sendMessageAll(message); |
| | | //endregion |
| | | cameraSdkService.controlLock(cmd);//上锁 |
| | | cameraSdkService.recordStart(cmd);//开始录像 |
| | | recordFlag = true; |