From 70c20364af15fce16992fce499efc623823ce221 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 22 九月 2022 14:10:26 +0800
Subject: [PATCH] 修复流注销时移除流认证信息
---
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java | 51 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
index 3a5d19a..3c5644b 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
@@ -1,17 +1,17 @@
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.conf.DynamicTask;
-import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
-import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
-import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
-import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
+import com.genersoft.iot.vmp.conf.UserSetting;
+import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.IPlatformService;
+import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
+import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -56,6 +56,12 @@
@Autowired
private SubscribeHolder subscribeHolder;
+
+ @Autowired
+ private GbStreamMapper gbStreamMapper;
+
+ @Autowired
+ private UserSetting userSetting;
@@ -102,7 +108,7 @@
@Override
public void online(ParentPlatform parentPlatform) {
- logger.info("[鍥芥爣绾ц仈]锛歿}, 骞冲彴涓婄嚎", parentPlatform.getServerGBId());
+ logger.info("[鍥芥爣绾ц仈]锛歿}, 骞冲彴涓婄嚎/鏇存柊娉ㄥ唽", parentPlatform.getServerGBId());
platformMapper.updateParentPlatformStatus(parentPlatform.getServerGBId(), true);
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
if (parentPlatformCatch != null) {
@@ -125,7 +131,7 @@
dynamicTask.startDelay(registerTaskKey,
// 娉ㄥ唽澶辫触锛堟敞鍐屾垚鍔熸椂鐢辩▼搴忕洿鎺ヨ皟鐢ㄤ簡online鏂规硶锛�
()->commanderForPlatform.register(parentPlatform, eventResult -> offline(parentPlatform),null),
- parentPlatform.getExpires()*1000);
+ (parentPlatform.getExpires() - 10) *1000);
final String keepaliveTaskKey = KEEPALIVE_KEY_PREFIX + parentPlatform.getServerGBId();
if (!dynamicTask.contains(keepaliveTaskKey)) {
@@ -164,7 +170,7 @@
redisCatchStorage.updatePlatformCatchInfo(platformCatch);
}
}),
- parentPlatform.getExpires()*1000);
+ (parentPlatform.getKeepTimeout() - 10)*1000);
}
}
@@ -213,7 +219,6 @@
param.put("stream", sendRtpItem.getStreamId());
zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
}
-
}
}
@@ -229,4 +234,34 @@
60*1000);
}, null);
}
+
+ @Override
+ public void sendNotifyMobilePosition(String platformId) {
+ ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
+ if (platform == null) {
+ return;
+ }
+ SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId());
+ if (subscribe != null) {
+
+ // TODO 鏆傛椂鍙鐞嗚棰戞祦鐨勫洖澶�,鍚庣画澧炲姞瀵瑰浗鏍囪澶囩殑鏀寔
+ List<DeviceChannel> gbStreams = gbStreamMapper.queryGbStreamListInPlatform(platform.getServerGBId(), userSetting.isUsePushingAsStatus());
+ if (gbStreams.size() == 0) {
+ return;
+ }
+ for (DeviceChannel deviceChannel : gbStreams) {
+ String gbId = deviceChannel.getChannelId();
+ GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId);
+ // 鏃犳渶鏂颁綅缃笉鍙戦��
+ if (gpsMsgInfo != null) {
+ // 缁忕含搴﹂兘涓�0涓嶅彂閫�
+ if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
+ continue;
+ }
+ // 鍙戦�丟PS娑堟伅
+ commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, subscribe);
+ }
+ }
+ }
+ }
}
--
Gitblit v1.8.0