From 1dcdbc3742835ccab28a8983ae002d2bbdba87eb Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 02 三月 2022 12:52:37 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into wvp-pro-record

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 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 56789d9..1baefbe 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
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.genersoft.iot.vmp.common.StreamInfo;
+import com.genersoft.iot.vmp.common.SystemInfoDto;
 import com.genersoft.iot.vmp.common.VideoManagerConstants;
 import com.genersoft.iot.vmp.conf.UserSetup;
 import com.genersoft.iot.vmp.gb28181.bean.*;
@@ -138,7 +139,6 @@
 
     @Override
     public StreamInfo queryPlayByDevice(String deviceId, String channelId) {
-//		List<Object> playLeys = redis.keys(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
         List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
                 userSetup.getServerId(),
                 deviceId,
@@ -534,4 +534,49 @@
         }
         return result;
     }
+
+    @Override
+    public void addCpuInfo(double cpuInfo) {
+        String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId();
+        SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
+        systemInfoDto.setTime(format.format(System.currentTimeMillis()));
+        systemInfoDto.setData(cpuInfo);
+        redis.lSet(key, systemInfoDto);
+        // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓�
+        if (redis.lGetListSize(key) > 30) {
+            for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
+                redis.lLeftPop(key);
+            }
+        }
+    }
+
+    @Override
+    public void addMemInfo(double memInfo) {
+        String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetup.getServerId();
+        SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>();
+        systemInfoDto.setTime(format.format(System.currentTimeMillis()));
+        systemInfoDto.setData(memInfo);
+        redis.lSet(key, systemInfoDto);
+        // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓�
+        if (redis.lGetListSize(key) > 30) {
+            for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
+                redis.lLeftPop(key);
+            }
+        }
+    }
+
+    @Override
+    public void addNetInfo(Map<String, String> networkInterfaces) {
+        String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetup.getServerId();
+        SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>();
+        systemInfoDto.setTime(format.format(System.currentTimeMillis()));
+        systemInfoDto.setData(networkInterfaces);
+        redis.lSet(key, systemInfoDto);
+        // 姣忕涓�涓紝鏈�澶氬彧瀛�30涓�
+        if (redis.lGetListSize(key) > 30) {
+            for (int i = 0; i < redis.lGetListSize(key) - 30; i++) {
+                redis.lLeftPop(key);
+            }
+        }
+    }
 }

--
Gitblit v1.8.0