From a3649ca243f827f78b85dbb41af2c3d7d978aa89 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 27 四月 2021 15:38:00 +0800
Subject: [PATCH] 优化mysql建库脚本
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
index 995f916..bf54f50 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
@@ -3,7 +3,9 @@
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -67,4 +69,45 @@
}
return event;
}
+
+ public void removeSubscribe(HookType type, JSONObject hookResponse) {
+ Map<JSONObject, Event> eventMap = allSubscribes.get(type);
+ if (eventMap == null) {
+ return;
+ }
+ for (JSONObject key : eventMap.keySet()) {
+ Boolean result = null;
+ for (String s : key.keySet()) {
+ if (result == null) {
+ result = key.getString(s).equals(hookResponse.getString(s));
+ }else {
+ result = result && key.getString(s).equals(hookResponse.getString(s));
+ }
+
+ }
+ if (result) {
+ eventMap.remove(key);
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇鏌愪釜绫诲瀷鐨勬墍鏈夌殑璁㈤槄
+ * @param type
+ * @return
+ */
+ public List<ZLMHttpHookSubscribe.Event> getSubscribes(HookType type) {
+ // ZLMHttpHookSubscribe.Event event= null;
+ Map<JSONObject, Event> eventMap = allSubscribes.get(type);
+ if (eventMap == null) {
+ return null;
+ }
+ List<ZLMHttpHookSubscribe.Event> result = new ArrayList<>();
+ for (JSONObject key : eventMap.keySet()) {
+ result.add(eventMap.get(key));
+ }
+ return result;
+ }
+
+
}
--
Gitblit v1.8.0