648540858
2022-07-19 28b5cc39d0a2d9939f70b4c980a31d9b27fc1e4c
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -9,6 +9,7 @@
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;
@@ -47,6 +48,9 @@
    @Autowired
    private IVideoManagerStorage storager;
    @Autowired
    private IPlatformChannelService platformChannelService;
    @Autowired
    private IRedisCatchStorage redisCatchStorage;
@@ -236,6 +240,12 @@
        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) {
@@ -256,6 +266,8 @@
                }
            } else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()) { // 关闭启用时注销
                commanderForPlatform.unregister(parentPlatformOld, null, null);
                // 停止订阅相关的定时任务
                subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
            }
            wvpResult.setCode(0);
            wvpResult.setMsg("success");
@@ -405,7 +417,7 @@
        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);
    }
@@ -484,7 +496,6 @@
        }
        PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId());
        WVPResult<List<PlatformCatalog>> result = new WVPResult<>();
        if (platformCatalogInStore != null) {
            result.setCode(-1);