From cab19659c068862c9c2ed2dac666a70e295c5d38 Mon Sep 17 00:00:00 2001 From: "review512jwy@163.com" <“review512jwy@163.com”> Date: Sat, 28 Feb 2026 15:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BBbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OverviewServiceImpl.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/dongjian-dashboard-back-service/src/main/java/com/dongjian/dashboard/back/service/impl/OverviewServiceImpl.java b/dongjian-dashboard-back-service/src/main/java/com/dongjian/dashboard/back/service/impl/OverviewServiceImpl.java index fd5363d..c0f302c 100644 --- a/dongjian-dashboard-back-service/src/main/java/com/dongjian/dashboard/back/service/impl/OverviewServiceImpl.java +++ b/dongjian-dashboard-back-service/src/main/java/com/dongjian/dashboard/back/service/impl/OverviewServiceImpl.java @@ -95,6 +95,12 @@ public class OverviewServiceImpl implements OverviewService { MonitoringPointCategorySearchParams categorySearchParam = new MonitoringPointCategorySearchParams(); categorySearchParam.setCompanyIdList(List.of(companyId)); List categoryList = monitoringPointCategoryMapperExt.getListPage(categorySearchParam); + + List allCategoryIds = categoryList.stream() + .map(MonitoringPointCategoryPageVO::getMonitoringPointCategoryId) + .filter(Objects::nonNull) + .toList(); + //所有楼宇的监测点分类 Map allCategoryParamMap = new HashMap<>(); allCategoryParamMap.put("companyId", companyId); @@ -113,16 +119,17 @@ public class OverviewServiceImpl implements OverviewService { )); Map> notExistingCategoryMap = new HashMap<>(); - existingCategoryMap.forEach((buildingId, existingCategoryIds) -> { - List missingCategoryIds = - categoryList.stream() - .map(MonitoringPointCategoryPageVO::getMonitoringPointCategoryId) - .filter(Objects::nonNull) - .filter(id -> !existingCategoryIds.contains(id)) - .collect(Collectors.toList()); - - notExistingCategoryMap.put(buildingId, missingCategoryIds); - }); + for (OverviewVO building : buildingInfoList) { + Long buildingId = building.getBuildingId(); + Set existingIds = existingCategoryMap.getOrDefault(buildingId, Collections.emptySet()); + List missingIds = new ArrayList<>(); + for (Long categoryId : allCategoryIds) { + if (!existingIds.contains(categoryId)) { + missingIds.add(categoryId); + } + } + notExistingCategoryMap.put(buildingId, missingIds); + } return notExistingCategoryMap; }