| | |
| | | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 获取国标服务的配置 |
| | |
| | | }) |
| | | public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) { |
| | | |
| | | // if (logger.isDebugEnabled()) { |
| | | // logger.debug("查询所有上级设备API调用"); |
| | | // } |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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); |
| | |
| | | if (updateResult) { |
| | | // 保存时启用就发送注册 |
| | | if (parentPlatform.isEnable()) { |
| | | if (parentPlatformOld.isStatus()) { |
| | | if (parentPlatformOld != null && parentPlatformOld.isStatus()) { |
| | | commanderForPlatform.unregister(parentPlatformOld, null, null); |
| | | try { |
| | | Thread.sleep(500); |
| | |
| | | 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缓存 |
| | |
| | | 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 { |
| | |
| | | * @param platformId 上级平台ID |
| | | * @param query 查询内容 |
| | | * @param online 是否在线 |
| | | * @param choosed 是否已选中 |
| | | * @param channelType 通道类型 |
| | | * @return |
| | | */ |