Browse Source

分类bug

ppt-20260120
review512jwy@163.com 1 month ago
parent
commit
cab19659c0
  1. 27
      dongjian-dashboard-back-service/src/main/java/com/dongjian/dashboard/back/service/impl/OverviewServiceImpl.java

27
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<MonitoringPointCategoryPageVO> categoryList = monitoringPointCategoryMapperExt.getListPage(categorySearchParam);
List<Long> allCategoryIds = categoryList.stream()
.map(MonitoringPointCategoryPageVO::getMonitoringPointCategoryId)
.filter(Objects::nonNull)
.toList();
//所有楼宇的监测点分类
Map<String, Object> allCategoryParamMap = new HashMap<>();
allCategoryParamMap.put("companyId", companyId);
@ -113,16 +119,17 @@ public class OverviewServiceImpl implements OverviewService {
));
Map<Long, List<Long>> notExistingCategoryMap = new HashMap<>();
existingCategoryMap.forEach((buildingId, existingCategoryIds) -> {
List<Long> 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<Long> existingIds = existingCategoryMap.getOrDefault(buildingId, Collections.emptySet());
List<Long> missingIds = new ArrayList<>();
for (Long categoryId : allCategoryIds) {
if (!existingIds.contains(categoryId)) {
missingIds.add(categoryId);
}
}
notExistingCategoryMap.put(buildingId, missingIds);
}
return notExistingCategoryMap;
}

Loading…
Cancel
Save