From abb60593cb77e9e9b6e67e8276fc416c2aede43f Mon Sep 17 00:00:00 2001
From: lin <18010473990@163.com>
Date: 星期六, 08 一月 2022 17:35:00 +0800
Subject: [PATCH] 优化级联平台GPS订阅

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index adda231..2dcc217 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -453,7 +453,7 @@
     @Override
     public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
         String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId();
-        redis.set(key, gpsMsgInfo);
+        redis.set(key, gpsMsgInfo, 60); // 榛樿GPS娑堟伅淇濆瓨1鍒嗛挓
     }
 
     @Override
@@ -476,4 +476,20 @@
     public void delSubscribe(String key) {
         redis.del(key);
     }
+
+    @Override
+    public List<GPSMsgInfo> getAllGpsMsgInfo() {
+        String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*";
+        List<GPSMsgInfo> result = new ArrayList<>();
+        List<Object> keys = redis.scan(scanKey);
+        for (int i = 0; i < keys.size(); i++) {
+            String key = (String) keys.get(i);
+            GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key);
+            if (!gpsMsgInfo.isStored()) { // 鍙彇娌℃湁瀛樿繃寰�
+                result.add((GPSMsgInfo)redis.get(key));
+            }
+        }
+
+        return result;
+    }
 }

--
Gitblit v1.8.0