old mode 100644
new mode 100755
| | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| | | 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; |
| | |
| | | throw new ControllerException(ErrorCode.ERROR400); |
| | | } |
| | | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); |
| | | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId); |
| | | if (parentPlatform == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在"); |
| | | } |
| | | if (parentPlatformCatch == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台不存在"); |
| | | } |
| | | // 发送离线消息,无论是否成功都删除缓存 |
| | | try { |
| | | commanderForPlatform.unregister(parentPlatform, (event -> { |
| | | commanderForPlatform.unregister(parentPlatform, parentPlatformCatch.getSipTransactionInfo(), (event -> { |
| | | // 清空redis缓存 |
| | | redisCatchStorage.delPlatformCatchInfo(parentPlatform.getServerGBId()); |
| | | redisCatchStorage.delPlatformKeepalive(parentPlatform.getServerGBId()); |
| | |
| | | if (platform == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "平台未找到"); |
| | | } |
| | | if (platformId.equals(parentId)) { |
| | | parentId = platform.getDeviceGBId(); |
| | | // if (platformId.equals(parentId)) { |
| | | // parentId = platform.getDeviceGBId(); |
| | | // } |
| | | |
| | | if (platformId.equals(platform.getDeviceGBId())) { |
| | | parentId = null; |
| | | } |
| | | |
| | | return storager.getChildrenCatalogByPlatform(platformId, parentId); |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("添加目录,{}", JSON.toJSONString(platformCatalog)); |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId()); |
| | | |
| | | if (platformCatalogInStore != null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists"); |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("编辑目录,{}", JSON.toJSONString(platformCatalog)); |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId()); |
| | | |
| | | if (platformCatalogInStore == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists"); |
| | |
| | | throw new ControllerException(ErrorCode.ERROR400); |
| | | } |
| | | |
| | | int delResult = storager.delCatalog(id); |
| | | int delResult = storager.delCatalog(platformId, id); |
| | | // 如果删除的是默认目录则根目录设置为默认目录 |
| | | PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId); |
| | | |