648540858
2022-07-22 e29d94c83f62960bb1d6dacac4c978debc85c5ef
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -443,20 +443,6 @@
      // 更新缓存
      parentPlatformCatch.setParentPlatform(parentPlatform);
      redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
      if (parentPlatform.isEnable()) {
         // 共享所有视频流,需要将现有视频流添加到此平台
         List<GbStream> gbStreams = gbStreamMapper.queryStreamNotInPlatform();
         if (gbStreams.size() > 0) {
            for (GbStream gbStream : gbStreams) {
               gbStream.setCatalogId(parentPlatform.getCatalogId());
            }
            if (parentPlatform.isShareAllLiveStream()) {
               gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId());
            }else {
               gbStreamService.delPlatformInfo(parentPlatform.getServerGBId(), gbStreams);
            }
         }
      }
      return result > 0;
   }
@@ -673,24 +659,6 @@
      streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
      streamPushMapper.add(streamPushItem);
      mediaOffline(streamPushItem.getApp(), streamPushItem.getStream());
      if(!StringUtils.isEmpty(streamPushItem.getGbId() )){
         // 查找开启了全部直播流共享的上级平台
         List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
         if (parentPlatforms.size() > 0) {
            for (ParentPlatform parentPlatform : parentPlatforms) {
               StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(),
                     parentPlatform.getServerGBId());
               if (streamProxyItem == null) {
                  streamPushItem.setCatalogId(parentPlatform.getCatalogId());
                  streamPushItem.setPlatformId(parentPlatform.getServerGBId());
                  platformGbStreamMapper.add(streamPushItem);
                  eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), streamPushItem, CatalogEvent.ADD);
               }
            }
         }
      }
   }
   @Override
@@ -773,6 +741,7 @@
         if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) {
            // 第一层节点
            platformCatalog.setBusinessGroupId(platformCatalog.getId());
            platformCatalog.setParentId(platform.getDeviceGBId());
         }else {
            // 获取顶层的
            PlatformCatalog topCatalog = getTopCatalog(platformCatalog.getParentId(), platformCatalog.getPlatformId());
@@ -781,6 +750,10 @@
      }
      if (platform.getTreeType().equals(TreeType.CIVIL_CODE)) {
         platformCatalog.setCivilCode(platformCatalog.getId());
         if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) {
            // 第一层节点
            platformCatalog.setParentId(platform.getDeviceGBId());
         }
      }
      int result = catalogMapper.add(platformCatalog);