648540858
2021-11-12 eca1e05aeed3c51cce36bbce80c71bc3cbcea87d
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -52,10 +52,10 @@
    @GetMapping("/server_config")
    public ResponseEntity<JSONObject> serverConfig() {
        JSONObject result = new JSONObject();
        result.put("deviceIp", sipConfig.getSipIp());
        result.put("devicePort", sipConfig.getSipPort());
        result.put("username", sipConfig.getSipId());
        result.put("password", sipConfig.getSipPassword());
        result.put("deviceIp", sipConfig.getIp());
        result.put("devicePort", sipConfig.getPort());
        result.put("username", sipConfig.getId());
        result.put("password", sipConfig.getPassword());
        return new ResponseEntity<>(result, HttpStatus.OK);
    }
@@ -73,9 +73,9 @@
    })
    public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count){
        if (logger.isDebugEnabled()) {
            logger.debug("查询所有上级设备API调用");
        }
//        if (logger.isDebugEnabled()) {
//            logger.debug("查询所有上级设备API调用");
//        }
        return storager.queryParentPlatformList(page, count);
    }
@@ -111,7 +111,7 @@
        // TODO 检查是否已经存在,且注册成功, 如果注册成功,需要先注销之前再,修改并注册
        // ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId());
        ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getServerGBId());
        ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
        boolean updateResult = storager.updateParentPlatform(parentPlatform);
@@ -119,12 +119,10 @@
            // 保存时启用就发送注册
            if (parentPlatform.isEnable()) {
                //  只要保存就发送注册
                commanderForPlatform.register(parentPlatform);
                commanderForPlatform.register(parentPlatform, null, null);
            } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 关闭启用时注销
                commanderForPlatform.unregister(parentPlatform, null, null);
            }
            return new ResponseEntity<>("success", HttpStatus.OK);
        } else {
            return new ResponseEntity<>("fail", HttpStatus.OK);
@@ -151,7 +149,7 @@
        ){
            return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
        }
        ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
        ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
        if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
        // 发送离线消息,无论是否成功都删除缓存
        commanderForPlatform.unregister(parentPlatform, (event -> {
@@ -189,10 +187,10 @@
    @ResponseBody
    public ResponseEntity<String> exitPlatform(@PathVariable String serverGBId){
        if (logger.isDebugEnabled()) {
            logger.debug("查询上级平台是否存在API调用:" + serverGBId);
        }
        ParentPlatform parentPlatform = storager.queryParentPlatById(serverGBId);
//        if (logger.isDebugEnabled()) {
//            logger.debug("查询上级平台是否存在API调用:" + serverGBId);
//        }
        ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
        return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
    }
@@ -226,9 +224,9 @@
                                              @RequestParam(required = false) Boolean choosed,
                                              @RequestParam(required = false) Boolean channelType){
        if (logger.isDebugEnabled()) {
            logger.debug("查询所有所有通道API调用");
        }
//        if (logger.isDebugEnabled()) {
//            logger.debug("查询所有所有通道API调用");
//        }
        PageInfo<ChannelReduce> channelReduces = null;
        if (platformId != null ) {
            channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, choosed);