From 93cecfaf0fae080ebd0212adea714726290d0d4a Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期四, 01 八月 2024 20:36:54 +0800
Subject: [PATCH] 电磁锁串口协议发送加入线程排队提交

---
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
index 0b089e4..edd182e 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SyncTask.java
@@ -18,6 +18,7 @@
 import com.ruoyi.media.service.IVtduService;
 import com.ruoyi.rongcloud.service.RongCloudService;
 import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.sdk.common.GlobalVariable;
 import com.ruoyi.utils.sdk.dhsdk.service.impl.DahuaSDK;
 import com.ruoyi.utils.sdk.hiksdk.service.impl.HikvisionSDK;
 import lombok.extern.slf4j.Slf4j;
@@ -53,6 +54,7 @@
     private CameraSDKFactory cameraSDKFactory;
     @Resource
     private IArdChannelService ardChannelService;
+
     /**
      * 鍚屾鐩告満鍦ㄧ嚎鐘舵��
      * 鍒樿嫃涔�
@@ -87,21 +89,23 @@
      * @Description 鍚屾閫氶亾鐘舵�佸疄鏃跺悓姝ユ祦濯掍綋
      * @Date 2024/7/9 16:01
      */
-    public void syncChannelState() {
-        log.warn("瀹氭椂鍚屾閫氶亾浠诲姟寮�濮�");
+    public void syncChannelState(){
+        log.debug("瀹氭椂鍚屾閫氶亾浠诲姟寮�濮�");
         //鑾峰彇鎵�鏈塶vr璁惧
-        List<ArdCameras> ardCamerasList = iArdCamerasService.selectArdCamerasListNoDataScope(new ArdCameras());
+        List<ArdCameras> ardCamerasList = GlobalVariable.loginedSet.stream().collect(Collectors.toList());
         if (ardCamerasList.size() > 0) {
             ardCamerasList.stream()
                     .forEach(ardCameras -> {
-                        //閫氳繃SDK鑾峰彇NVR瀹為檯閫氶亾
-                        CameraSDK cameraSDK = cameraSDKFactory.createCameraSDK(ardCameras.getFactory());
-                        List<ArdChannel> ardChannelList = cameraSDK.getChannels(ardCameras);
-                        //鍚屾閫氶亾琛�
-                        ArdChannel ardChannel=new ArdChannel();
-                        ardChannel.setDeviceId(ardCameras.getId());
-                        List<ArdChannel> ardChannelListDb = ardChannelService.selectArdChannelList(ardChannel);
-                        ardChannelService.asyncChannel(ardCameras,ardChannelListDb,ardChannelList);
+                        if (ardCameras.getLoginId() > 0) {
+                            //閫氳繃SDK鑾峰彇NVR瀹為檯閫氶亾
+                            CameraSDK cameraSDK = cameraSDKFactory.createCameraSDK(ardCameras.getFactory());
+                            List<ArdChannel> ardChannelList = cameraSDK.getChannels(ardCameras);
+                            //鍚屾閫氶亾琛�
+                            ArdChannel ardChannel = new ArdChannel();
+                            ardChannel.setDeviceId(ardCameras.getId());
+                            List<ArdChannel> ardChannelListDb = ardChannelService.selectArdChannelList(ardChannel);
+                            ardChannelService.asyncChannel(ardCameras, ardChannelListDb, ardChannelList);
+                        }
                     });
         }
     }
@@ -139,9 +143,9 @@
      * 2023/10/13 14:13:53
      */
     public void syncVtdu() {
-        log.warn("瀹氭椂鍚屾娴佸獟浣撲换鍔″紑濮�");
+        log.debug("瀹氭椂鍚屾娴佸獟浣撲换鍔″紑濮�");
         List<String> nameList = mediaService.getNameList();
         List<Vtdu> vtduList = vtduService.selectVtduList(new Vtdu());
-        vtduService.asyncVtdu(vtduList,nameList);
+        vtduService.asyncVtdu(vtduList, nameList);
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3