From 4269d20178cfab9253aacac15e1c02905c192428 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期五, 15 十二月 2023 13:33:52 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java | 49 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
index a2e632f..2eb90d2 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
@@ -2,8 +2,10 @@
import com.ruoyi.alarm.global.domain.GuidePriorityQueue;
import com.ruoyi.alarm.global.domain.GuideTask;
+import com.ruoyi.alarm.global.service.impl.QueueHandler;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.device.camera.factory.CameraSDK;
import com.ruoyi.device.camera.domain.ArdCameras;
@@ -62,7 +64,8 @@
private IVtduService vtduService;
@Value("${minio.endpoint}")
private String minioEndPoint;
-
+ @Resource
+ private QueueHandler queueHandler;
// 璁惧鏂嚎閫氱煡鍥炶皟
private static DisConnect disConnect = new DisConnect();
@@ -74,6 +77,7 @@
* 鐧诲綍
* 鍒樿嫃涔�
* 2023/10/17 8:28:13
+ *
* @return
*/
@Override
@@ -152,17 +156,22 @@
}
//鍒涘缓寮曞闃熷垪
- if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
- Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
- PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
- GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
+ //鍒涘缓寮曞闃熷垪
+ if (camera.getCamAlarmGuideEnable() == 1) {
+ if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
+ Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
+ PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
+ GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
+ }
+ //鍚姩闃熷垪澶勭悊鍣�
+ queueHandler.process(camera.getId());
}
return true;
}
@Override
@Async("loginExecutor")
- public void asyncLogin(ArdCameras camera){
+ public void asyncLogin(ArdCameras camera) {
LoginModule.init(disConnect, haveReConnect);
NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
NetSDKLib.LLong loginId = LoginModule.login(camera.getIp(), camera.getPort(), camera.getUsername(), camera.getPassword(), m_stDeviceInfo);
@@ -208,7 +217,14 @@
ardChannelService.insertArdChannel(channel);
}
//閰嶇疆鍒版祦濯掍綋
- for (int i = 1; i < m_stDeviceInfo.byChanNum + 1; i++) {
+ addVtdu(camera);
+ //鍒涘缓寮曞闃熷垪
+ createGuideQueue(camera);
+ }
+
+ //娣诲姞鍒版祦濯掍綋
+ private void addVtdu(ArdCameras camera) {
+ for (int i = 1; i < camera.getChanNum() + 1; i++) {
String name = camera.getId() + "_" + i;
String rtspSource = "rtsp://" + camera.getUsername() + ":" + camera.getPassword() + "@" + camera.getIp() + ":" + camera.getRtspPort() + "/cam/realmonitor?channel=" + i + "&subtype=0";
Vtdu vtdu = vtduService.selectVtduByName(name);
@@ -234,12 +250,20 @@
vtdu.setCameraId(camera.getId());
vtduService.insertVtdu(vtdu);
}
+ }
- //鍒涘缓寮曞闃熷垪
- if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
- Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
- PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
- GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
+ //鍒涘缓寮曞闃熷垪
+ private void createGuideQueue(ArdCameras camera) {
+ if (camera.getCamAlarmGuideEnable() != null) {
+ if (camera.getCamAlarmGuideEnable() == 1) {
+ if (!GuidePriorityQueue.cameraQueueMap.containsKey(camera.getId())) {
+ Comparator<GuideTask> comparator = GuidePriorityQueue.getComparator();
+ PriorityBlockingQueue<GuideTask> priorityQueue = new PriorityBlockingQueue<>(1000, comparator);
+ GuidePriorityQueue.cameraQueueMap.put(camera.getId(), priorityQueue);
+ //鍚姩闃熷垪澶勭悊鍣�
+ queueHandler.process(camera.getId());
+ }
+ }
}
}
@@ -247,6 +271,7 @@
* 娉ㄩ攢
* 鍒樿嫃涔�
* 2023/10/17 8:28:13
+ *
* @return
*/
@Override
--
Gitblit v1.9.3