| | |
| | | import com.ruoyi.alarm.radar.service.IArdAlarmRadarPumpService; |
| | | import com.ruoyi.alarm.tube.domain.ArdAlarmTube; |
| | | import com.ruoyi.alarm.tube.service.IArdAlarmTubeService; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.device.camera.domain.ArdCameras; |
| | | import com.ruoyi.device.camera.domain.CameraCmd; |
| | | import com.ruoyi.device.camera.service.ICameraSdkService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.Duration; |
| | | import java.time.Instant; |
| | | import java.util.HashMap; |
| | |
| | | @Slf4j(topic = "guideQueue") |
| | | @Component |
| | | public class QueueHandler { |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | |
| | | /** |
| | | * å¼å¯¼ä»»å¡å
¥é |
| | | * åèä¹ |
| | |
| | | /*éè¿ç¸æºIDè·åå¼å¯¼éåï¼å¹¶å°å¼å¯¼ä»»å¡å å
¥éå*/ |
| | | PriorityBlockingQueue<GuideTask> guideTaskQueue = GuidePriorityQueue.cameraQueueMap.get(cameraId); |
| | | if (StringUtils.isNull(guideTaskQueue)) { |
| | | log.info("ç¸æºæªç»å½,没æéå,æ æ³å
¥éå¼å¯¼"); |
| | | log.debug("ç¸æºæªç»å½,没æéå,æ æ³å
¥éå¼å¯¼"); |
| | | return; |
| | | } |
| | | log.debug("æ°ä»»å¡å
¥é:" + task.getAlarmId()); |
| | |
| | | |
| | | public void processTask(GuideTask guideTask) { |
| | | try { |
| | | if (!IsEnableGuide(guideTask.getCameraId())) { |
| | | return; |
| | | } |
| | | String url = ""; |
| | | CameraCmd cmd = new CameraCmd(); |
| | | cmd.setCameraId(guideTask.getCameraId()); |
| | |
| | | Instant currentTime = Instant.now(); |
| | | long elapsedSeconds = Duration.between(startTime, currentTime).getSeconds(); |
| | | if (elapsedSeconds >= 30) { |
| | | recordFlag = false; |
| | | recordFlag = false;//è¾¾å°30ç§å½å忢 |
| | | url = cameraSdkService.recordStopToMinio(cmd);//忢å½åè¿åurl |
| | | } |
| | | if (!IsEnableGuide(guideTask.getCameraId())) { |
| | | recordFlag = false;//ç¸æºå
³éå¼å¯¼å½å忢 |
| | | } |
| | | //夿éåä¸ç¬¬ä¸æ¡æ°æ®çä¼å
级æ¯å¦å¤§äºå½åæ°æ®çä¼å
级 |
| | | PriorityBlockingQueue<GuideTask> guideTasks = GuidePriorityQueue.cameraQueueMap.get(guideTask.getCameraId()); |
| | |
| | | log.info("线ç¨ä»»å¡å¼å¸¸:" + ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
çµæ¯å¦å¼å¯æ¥è¦å¼å¯¼åè½ |
| | | * åèä¹ |
| | | * 2023/7/7 14:03 |
| | | */ |
| | | private Boolean IsEnableGuide(String cameraId) { |
| | | boolean enabled = false; |
| | | ArdCameras ardCameras = redisCache.getCacheObject(CacheConstants.CAMERA_LIST_KEY + cameraId); |
| | | if (ardCameras != null) { |
| | | if (ardCameras.getCamAlarmGuideEnable().equals(1)) { |
| | | enabled = true; |
| | | } |
| | | } |
| | | return enabled; |
| | | } |
| | | } |