From 560165b6679f96f04cd3f8f6d5709b1214afddfb Mon Sep 17 00:00:00 2001
From: wangyimeng <421132955@qq.com>
Date: 星期六, 26 二月 2022 11:14:56 +0800
Subject: [PATCH] 增加拉流代理修改功能
---
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 74 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 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 1d68943..92fdf6c 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.*;
@@ -250,7 +251,7 @@
@Override
public void updatePlatformRegisterInfo(String callId, String platformGbId) {
String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId;
- redis.set(key, platformGbId);
+ redis.set(key, platformGbId, 30);
}
@@ -508,4 +509,75 @@
return result;
}
+
+ @Override
+ public List<SubscribeInfo> getAllSubscribe() {
+ String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_*";
+ List<SubscribeInfo> result = new ArrayList<>();
+ List<Object> keys = redis.scan(scanKey);
+ for (int i = 0; i < keys.size(); i++) {
+ String key = (String) keys.get(i);
+ SubscribeInfo subscribeInfo = (SubscribeInfo) redis.get(key);
+ result.add(subscribeInfo);
+ }
+ return result;
+ }
+
+ @Override
+ public List<String> getAllSubscribePlatform() {
+ String scanKey = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_*";
+ List<String> result = new ArrayList<>();
+ List<Object> keys = redis.scan(scanKey);
+ for (int i = 0; i < keys.size(); i++) {
+ String key = (String) keys.get(i);
+ String platformId = key.substring(scanKey.length() - 1);
+ result.add(platformId);
+ }
+ 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