From e6ee7fe7477b485676ce506b4e971c9a50dfa588 Mon Sep 17 00:00:00 2001
From: 648540858 <456panlinlin>
Date: 星期四, 14 四月 2022 16:52:48 +0800
Subject: [PATCH] 优化级联移动位置订阅位置更新

---
 src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java
index 569a9b7..f20baf9 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java
@@ -24,52 +24,50 @@
     private IVideoManagerStorage storager;
     private ISIPCommanderForPlatform sipCommanderForPlatform;
     private SubscribeHolder subscribeHolder;
-    private String platformId;
+    private ParentPlatform platform;
     private String sn;
     private String key;
 
     public MobilePositionSubscribeHandlerTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorage storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) {
+        System.out.println("MobilePositionSubscribeHandlerTask 鍒濆鍖�");
         this.redisCatchStorage = redisCatchStorage;
         this.storager = storager;
-        this.platformId = platformId;
+        this.platform = storager.queryParentPlatByServerGBId(platformId);
         this.sn = sn;
         this.key = key;
         this.sipCommanderForPlatform = sipCommanderForPlatform;
         this.subscribeHolder = subscribeInfo;
     }
 
-    @Async
     @Override
     public void run() {
 
         logger.info("鎵цMobilePositionSubscribeHandlerTask");
-        SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platformId);
+        if (platform == null) return;
+        SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId());
         if (subscribe != null) {
-            ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
-            if (parentPlatform == null ) {
-                logger.info("鍙戦�佽闃呮椂鏈壘鍒板钩鍙颁俊鎭細{}", platformId);
-                return;
-            }
-            if (!parentPlatform.isStatus()) {
-                logger.info("鍙戦�佽闃呮椂鍙戠幇骞冲彴宸茬粡绂荤嚎锛歿}", platformId);
-                return;
-            }
+
+//            if (!parentPlatform.isStatus()) {
+//                logger.info("鍙戦�佽闃呮椂鍙戠幇骞冲彴宸茬粡绂荤嚎锛歿}", platformId);
+//                return;
+//            }
             // TODO 鏆傛椂鍙鐞嗚棰戞祦鐨勫洖澶�,鍚庣画澧炲姞瀵瑰浗鏍囪澶囩殑鏀寔
-            List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(platformId);
+            List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(platform.getServerGBId());
             if (gbStreams.size() == 0) {
-                logger.info("鍙戦�佽闃呮椂鍙戠幇骞冲彴宸茬粡娌℃湁鍏宠仈鐨勭洿鎾祦锛歿}", platformId);
+                logger.info("鍙戦�佽闃呮椂鍙戠幇骞冲彴宸茬粡娌℃湁鍏宠仈鐨勭洿鎾祦锛歿}", platform.getServerGBId());
                 return;
             }
             for (GbStream gbStream : gbStreams) {
                 String gbId = gbStream.getGbId();
                 GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId);
                 if (gpsMsgInfo != null) { // 鏃犳渶鏂颁綅缃笉鍙戦��
+                    logger.info("鏃犳渶鏂颁綅缃笉鍙戦��");
                     // 缁忕含搴﹂兘涓�0涓嶅彂閫�
                     if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
                         continue;
                     }
                     // 鍙戦�丟PS娑堟伅
-                    sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe);
+                    sipCommanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, subscribe);
                 }
             }
         }

--
Gitblit v1.8.0