From a012007f36ba1ce44e9c932ea33120949835dfb7 Mon Sep 17 00:00:00 2001 From: 648540858 <456panlinlin> Date: 星期一, 25 四月 2022 17:12:29 +0800 Subject: [PATCH] 多级虚拟组织处理修复 --- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java | 42 ++++++++++++++++++++++++++++++------------ 1 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java index caca64e..ff424a0 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java @@ -2,13 +2,15 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.genersoft.iot.vmp.gb28181.bean.CatalogData; -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.common.VideoManagerConstants; +import com.genersoft.iot.vmp.conf.DynamicTask; +import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; +import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; @@ -40,16 +42,25 @@ private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); @Autowired - private IVideoManagerStorager storager; + private UserSetting userSetting; + + @Autowired + private IVideoManagerStorage storager; @Autowired private IRedisCatchStorage redisCatchStorage; + + @Autowired + private SubscribeHolder subscribeHolder; @Autowired private ISIPCommanderForPlatform commanderForPlatform; @Autowired private SipConfig sipConfig; + + @Autowired + private DynamicTask dynamicTask; /** * 鑾峰彇鍥芥爣鏈嶅姟鐨勯厤缃� @@ -103,10 +114,14 @@ }) public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) { -// if (logger.isDebugEnabled()) { -// logger.debug("鏌ヨ鎵�鏈変笂绾ц澶嘇PI璋冪敤"); -// } - return storager.queryParentPlatformList(page, count); + PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); + if (parentPlatformPageInfo.getList().size() > 0) { + for (ParentPlatform platform : parentPlatformPageInfo.getList()) { + platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null); + platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null); + } + } + return parentPlatformPageInfo; } /** @@ -215,6 +230,7 @@ wvpResult.setMsg("missing parameters"); return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); } + parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); boolean updateResult = storager.updateParentPlatform(parentPlatform); @@ -222,7 +238,7 @@ if (updateResult) { // 淇濆瓨鏃跺惎鐢ㄥ氨鍙戦�佹敞鍐� if (parentPlatform.isEnable()) { - if (parentPlatformOld.isStatus()) { + if (parentPlatformOld != null && parentPlatformOld.isStatus()) { commanderForPlatform.unregister(parentPlatformOld, null, null); try { Thread.sleep(500); @@ -287,8 +303,11 @@ boolean deleteResult = storager.deleteParentPlatform(parentPlatform); storager.delCatalogByPlatformId(parentPlatform.getServerGBId()); storager.delRelationByPlatformId(parentPlatform.getServerGBId()); - - + // 鍋滄鍙戦�佷綅缃闃呭畾鏃朵换鍔� + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId(); + dynamicTask.stop(key); + // 鍒犻櫎缂撳瓨鐨勮闃呬俊鎭� + subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId()); if (deleteResult) { return new ResponseEntity<>("success", HttpStatus.OK); } else { @@ -325,7 +344,6 @@ * @param platformId 涓婄骇骞冲彴ID * @param query 鏌ヨ鍐呭 * @param online 鏄惁鍦ㄧ嚎 - * @param choosed 鏄惁宸查�変腑 * @param channelType 閫氶亾绫诲瀷 * @return */ -- Gitblit v1.8.0