From 7d6aaf3bb0a4bdcc319eaec1840c78ab32cfa81e Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 12 十月 2023 16:36:07 +0800 Subject: [PATCH] 修复国标接连选择通道相关的问题 --- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java index a316a5c..e96e09b 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java @@ -74,6 +74,9 @@ private PlatformChannelMapper platformChannelMapper; @Autowired + private PlatformCatalogMapper platformCatalogMapper; + + @Autowired private StreamProxyMapper streamProxyMapper; @Autowired @@ -910,9 +913,43 @@ eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); } int delChannelresult = platformChannelMapper.delByCatalogId(platformId, id); + // 鏌ョ湅鏄惁瀛樺湪瀛愮洰褰曪紝濡傛灉瀛樺湪涓�骞跺垹闄� + List<String> allChildCatalog = getAllChildCatalog(id, platformId); + if (!allChildCatalog.isEmpty()) { + int limitCount = 50; + if (allChildCatalog.size() > limitCount) { + for (int i = 0; i < allChildCatalog.size(); i += limitCount) { + int toIndex = i + limitCount; + if (i + limitCount > allChildCatalog.size()) { + toIndex = allChildCatalog.size(); + } + delChannelresult += platformCatalogMapper.deleteAll(platformId, allChildCatalog.subList(i, toIndex)); + } + }else { + delChannelresult += platformCatalogMapper.deleteAll(platformId, allChildCatalog); + } + } return delresult + delChannelresult + delStreamresult; } + private List<String> getAllChildCatalog(String id, String platformId) { + List<String> catalogList = platformCatalogMapper.queryCatalogFromParent(id, platformId); + List<String> catalogListChild = new ArrayList<>(); + if (catalogList != null && !catalogList.isEmpty()) { + for (String childId : catalogList) { + List<String> allChildCatalog = getAllChildCatalog(childId, platformId); + if (allChildCatalog != null && !allChildCatalog.isEmpty()) { + catalogListChild.addAll(allChildCatalog); + } + + } + } + if (!catalogListChild.isEmpty()) { + catalogList.addAll(catalogListChild); + } + return catalogList; + } + @Override public int updateCatalog(PlatformCatalog platformCatalog) { -- Gitblit v1.8.0