From 4ad711f61a1a760a0f8f7f8475b75ec93e31d8ae Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 13 六月 2024 16:21:34 +0800 Subject: [PATCH] 去除调试日志日志 --- src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index d385d9a..a15de22 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; -import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -32,11 +31,13 @@ public void putCatalogSubscribe(String platformId, SubscribeInfo subscribeInfo) { catalogMap.put(platformId, subscribeInfo); - // 娣诲姞璁㈤槄鍒版湡 - String taskOverdueKey = taskOverduePrefix + "catalog_" + platformId; - // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 - dynamicTask.startDelay(taskOverdueKey, () -> removeCatalogSubscribe(subscribeInfo.getId()), - subscribeInfo.getExpires() * 1000); + if (subscribeInfo.getExpires() > 0) { + // 娣诲姞璁㈤槄鍒版湡 + String taskOverdueKey = taskOverduePrefix + "catalog_" + platformId; + // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 + dynamicTask.startDelay(taskOverdueKey, () -> removeCatalogSubscribe(subscribeInfo.getId()), + subscribeInfo.getExpires() * 1000); + } } public SubscribeInfo getCatalogSubscribe(String platformId) { @@ -50,24 +51,33 @@ Runnable runnable = dynamicTask.get(taskOverdueKey); if (runnable instanceof ISubscribeTask) { ISubscribeTask subscribeTask = (ISubscribeTask) runnable; - subscribeTask.stop(); + subscribeTask.stop(null); } // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 dynamicTask.stop(taskOverdueKey); } - public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) { + public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo, Runnable gpsTask) { mobilePositionMap.put(platformId, subscribeInfo); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 娣诲姞浠诲姟澶勭悊GPS瀹氭椂鎺ㄩ�� - dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(platformId), - subscribeInfo.getGpsInterval() * 1000); + + int cycleForCatalog; + if (subscribeInfo.getGpsInterval() <= 0) { + cycleForCatalog = 5; + }else { + cycleForCatalog = subscribeInfo.getGpsInterval(); + } + dynamicTask.startCron(key, gpsTask, + cycleForCatalog * 1000); String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId; - // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 - dynamicTask.startDelay(taskOverdueKey, () -> { - removeMobilePositionSubscribe(subscribeInfo.getId()); - }, - subscribeInfo.getExpires() * 1000); + if (subscribeInfo.getExpires() > 0) { + // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 + dynamicTask.startDelay(taskOverdueKey, () -> { + removeMobilePositionSubscribe(subscribeInfo.getId()); + }, + subscribeInfo.getExpires() * 1000); + } } public SubscribeInfo getMobilePositionSubscribe(String platformId) { @@ -83,7 +93,7 @@ Runnable runnable = dynamicTask.get(taskOverdueKey); if (runnable instanceof ISubscribeTask) { ISubscribeTask subscribeTask = (ISubscribeTask) runnable; - subscribeTask.stop(); + subscribeTask.stop(null); } // 娣诲姞浠诲姟澶勭悊璁㈤槄杩囨湡 dynamicTask.stop(taskOverdueKey); @@ -99,6 +109,16 @@ return platforms; } + public List<String> getAllMobilePositionSubscribePlatform() { + List<String> platforms = new ArrayList<>(); + if(!mobilePositionMap.isEmpty()) { + for (String key : mobilePositionMap.keySet()) { + platforms.add(mobilePositionMap.get(key).getId()); + } + } + return platforms; + } + public void removeAllSubscribe(String platformId) { removeMobilePositionSubscribe(platformId); removeCatalogSubscribe(platformId); -- Gitblit v1.8.0