| | |
| | | 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.service.IPlatformChannelService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private IPlatformChannelService platformChannelService; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | |
| | | wvpResult.setMsg("平台 " + parentPlatform.getServerGBId() + " 已存在"); |
| | | return new ResponseEntity<>(wvpResult, HttpStatus.OK); |
| | | } |
| | | parentPlatform.setCreateTime(DateUtil.getNow()); |
| | | parentPlatform.setUpdateTime(DateUtil.getNow()); |
| | | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
| | | |
| | | if (updateResult) { |
| | |
| | | } |
| | | parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase()); |
| | | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); |
| | | parentPlatform.setUpdateTime(DateUtil.getNow()); |
| | | if (!parentPlatformOld.getTreeType().equals(parentPlatform.getTreeType())) { |
| | | // 目录结构发生变化,清空之前的关联关系 |
| | | logger.info("保存平台{}时发现目录结构变化,清空关联关系", parentPlatform.getDeviceGBId()); |
| | | storager.cleanContentForPlatform(parentPlatform.getServerGBId()); |
| | | |
| | | } |
| | | boolean updateResult = storager.updateParentPlatform(parentPlatform); |
| | | |
| | | if (updateResult) { |
| | |
| | | } |
| | | } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()) { // 关闭启用时注销 |
| | | commanderForPlatform.unregister(parentPlatformOld, null, null); |
| | | // 停止订阅相关的定时任务 |
| | | subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId()); |
| | | } |
| | | wvpResult.setCode(0); |
| | | wvpResult.setMsg("success"); |
| | |
| | | return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST); |
| | | } |
| | | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId); |
| | | if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK); |
| | | if (parentPlatform == null) { |
| | | return new ResponseEntity<>("fail", HttpStatus.OK); |
| | | } |
| | | // 发送离线消息,无论是否成功都删除缓存 |
| | | commanderForPlatform.unregister(parentPlatform, (event -> { |
| | | // 清空redis缓存 |
| | |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("给上级平台添加国标通道API调用"); |
| | | } |
| | | int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); |
| | | int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId()); |
| | | |
| | | return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); |
| | | } |
| | |
| | | } |
| | | PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId()); |
| | | WVPResult<List<PlatformCatalog>> result = new WVPResult<>(); |
| | | |
| | | |
| | | if (platformCatalogInStore != null) { |
| | | result.setCode(-1); |