|
|
|
@ -655,6 +655,14 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
@Override |
|
|
|
public List<AnalysisResourceCategoriesResult> listAnalysisResourceCategories() { |
|
|
|
|
|
|
|
// 获取所有菜单的url
|
|
|
|
List<String> menuUrls = new ArrayList<>(128); |
|
|
|
|
|
|
|
List<GovMenuDTO> menus = govCustomerMenuRedis.getCustomerMenuList(EpmetRequestHolder.getLoginUserCustomerId(), 0, "gov_menu"); |
|
|
|
if (CollectionUtils.isNotEmpty(menus)) { |
|
|
|
menus.stream().forEach(m -> menuUrls.add(m.getUrl())); |
|
|
|
} |
|
|
|
|
|
|
|
//结果集
|
|
|
|
ArrayList<AnalysisResourceCategoriesResult> results = new ArrayList<>(); |
|
|
|
|
|
|
|
@ -674,29 +682,31 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 2.根据menuUrl过滤 todo
|
|
|
|
|
|
|
|
// 2.计算各类数量 todo
|
|
|
|
|
|
|
|
// 3.对上一步得到的数据进行分组,使用PLACE_TYPE_IN_ANALYSIS分组,然后放入placeType,这一列为空的说明不分组,直接属于coverage
|
|
|
|
categoryDictEntities.forEach(c -> { |
|
|
|
if (StringUtils.isBlank(c.getPlaceTypeInAnalysis())) { |
|
|
|
categoryDictEntities.forEach(category -> { |
|
|
|
if (StringUtils.isBlank(category.getPlaceTypeInAnalysis())) { |
|
|
|
// 没有placetype的
|
|
|
|
categoriesOfThisCoverage.getCategories() |
|
|
|
.add(new AnalysisResourceCategoriesResult.Category(c.getCategoryKey(), c.getCategoryName(), |
|
|
|
c.getCoverageType(), c.getPlaceType(), c.getQuantity())); |
|
|
|
if ("all".equals(category.getMenuUrl()) || menuUrls.contains(category.getMenuUrl())) { |
|
|
|
categoriesOfThisCoverage.getCategories() |
|
|
|
.add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), category.getCategoryName(), |
|
|
|
category.getCoverageType(), category.getPlaceType(), category.getQuantity())); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 有placetype的
|
|
|
|
AnalysisResourceCategoriesResult.PlaceType placeType = placeTypeMap.get(c.getPlaceTypeInAnalysis()); |
|
|
|
if (placeType == null) { |
|
|
|
placeType = new AnalysisResourceCategoriesResult.PlaceType( |
|
|
|
c.getPlaceTypeInAnalysis(), CoveragePlaceTypeEnum.getEnum(c.getPlaceTypeInAnalysis()).getName(), c.getQuantity(), new ArrayList<>()); |
|
|
|
placeTypeMap.put(c.getPlaceTypeInAnalysis(), placeType); |
|
|
|
AnalysisResourceCategoriesResult.PlaceType placeType = placeTypeMap.get(category.getPlaceTypeInAnalysis()); |
|
|
|
if ("all".equals(category.getMenuUrl()) || menuUrls.contains(category.getMenuUrl())) { |
|
|
|
|
|
|
|
if (placeType == null) { |
|
|
|
placeType = new AnalysisResourceCategoriesResult.PlaceType( |
|
|
|
category.getPlaceTypeInAnalysis(), CoveragePlaceTypeEnum.getEnum(category.getPlaceTypeInAnalysis()).getName(), category.getQuantity(), new ArrayList<>()); |
|
|
|
placeTypeMap.put(category.getPlaceTypeInAnalysis(), placeType); |
|
|
|
} |
|
|
|
|
|
|
|
placeType.getCategories().add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), |
|
|
|
category.getCategoryName(), category.getCoverageType(), category.getPlaceType(), category.getQuantity())); |
|
|
|
placeType.setQuantity(placeType.getQuantity() + category.getQuantity()); // todo 0改为category的count
|
|
|
|
} |
|
|
|
placeType.getCategories().add(new AnalysisResourceCategoriesResult.Category(c.getCategoryKey(), |
|
|
|
c.getCategoryName(), c.getCoverageType(), c.getPlaceType(), c.getQuantity())); |
|
|
|
|
|
|
|
placeType.setQuantity(placeType.getQuantity() + c.getQuantity()); // todo 0改为category的count
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
@ -718,6 +728,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
@Override |
|
|
|
public List<AnalysisGovernedTargetsResult> listGovernedTargetCategories() { |
|
|
|
|
|
|
|
// 获取所有菜单的url
|
|
|
|
List<String> menuUrls = new ArrayList<>(128); |
|
|
|
|
|
|
|
List<GovMenuDTO> menus = govCustomerMenuRedis.getCustomerMenuList(EpmetRequestHolder.getLoginUserCustomerId(), 0, "gov_menu"); |
|
|
|
@ -732,11 +743,22 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
//2.从oper_customize.ic_resi_category_warn_config表中取18大类居民中需要预警的类出来
|
|
|
|
List<IcResiCategoryWarnConfigEntity> categoriesNeed2Warn = icResiCategoryWarnService.listResiCategoriesNeed2Warn(EpmetRequestHolder.getLoginUserCustomerId()); |
|
|
|
List<String> resiCategories2Show = categoriesNeed2Warn.stream().map(wc -> wc.getColumnName()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<AnalysisGovernedTargetsResult> results = new ArrayList<>(); |
|
|
|
HashMap<String, List<AnalysisGovernedTargetsResult>> placeTypeMap = new HashMap<>(); |
|
|
|
HashMap<String, List<AnalysisGovernedTargetsResult>> placeTypeTargetMap = new HashMap<>(); |
|
|
|
HashMap<String, Integer> placeTypeQuantityMap = new HashMap<>(); |
|
|
|
|
|
|
|
targetCategories.forEach(rc -> { |
|
|
|
String placeTypeInAnalysis = rc.getPlaceTypeInAnalysis(); |
|
|
|
if (CoveragePlaceTypeEnum.RESI.getCode().equals(placeTypeInAnalysis) && !resiCategories2Show.contains(rc.getCategoryKey())) { |
|
|
|
// 因为公共服务-人群,是需要跟oper_customize.ic_resi_category_warn_config表对应,只显示warn=1的,
|
|
|
|
// 所以如果是被管理对象中的公共服务人群,如果不开启预警,就跳过;其他情况都放进去
|
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isEmpty(placeTypeInAnalysis)) { |
|
|
|
// 只有一层,没有子级
|
|
|
|
if (menuUrls.contains(rc.getMenuUrl()) || "all".equals(rc.getMenuUrl())) { |
|
|
|
@ -745,41 +767,33 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 有子级,需要使用placeTypeInAnalysis分组
|
|
|
|
List<AnalysisGovernedTargetsResult> targets = placeTypeMap.get(placeTypeInAnalysis); |
|
|
|
if (CollectionUtils.isEmpty(targets)) { |
|
|
|
targets = new ArrayList<>(); |
|
|
|
placeTypeMap.put(placeTypeInAnalysis, targets); |
|
|
|
} |
|
|
|
if (menuUrls.contains(rc.getMenuUrl()) || "all".equals(rc.getMenuUrl())) { |
|
|
|
List<AnalysisGovernedTargetsResult> targets = placeTypeTargetMap.get(placeTypeInAnalysis); |
|
|
|
if (CollectionUtils.isEmpty(targets)) { |
|
|
|
targets = new ArrayList<>(); |
|
|
|
placeTypeTargetMap.put(placeTypeInAnalysis, targets); |
|
|
|
placeTypeQuantityMap.put(placeTypeInAnalysis, 0); |
|
|
|
} |
|
|
|
targets.add(new AnalysisGovernedTargetsResult(rc.getCategoryKey(), rc.getCategoryName(), rc.getCoverageType(), |
|
|
|
rc.getPlaceType(), CoveragePlaceTypeEnum.getEnum(rc.getPlaceType()).getName(), rc.getQuantity(), new ArrayList<>())); |
|
|
|
|
|
|
|
placeTypeQuantityMap.put(placeTypeInAnalysis, placeTypeQuantityMap.get(placeTypeInAnalysis) + rc.getQuantity()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if (placeTypeMap.size() > 0) { |
|
|
|
placeTypeMap.forEach((placeTypeInAnalysis, targetObjects) -> { |
|
|
|
// 最后,把需要分组的"公共服务人群","综合治理人群"放到最后的结果列表中
|
|
|
|
if (placeTypeTargetMap.size() > 0) { |
|
|
|
placeTypeTargetMap.forEach((placeTypeInAnalysis, targetObjects) -> { |
|
|
|
AnalysisGovernedTargetsResult tr = new AnalysisGovernedTargetsResult(); |
|
|
|
tr.setPlaceType(placeTypeInAnalysis); |
|
|
|
tr.setQuantity(placeTypeQuantityMap.get(placeTypeInAnalysis)); |
|
|
|
tr.setPlaceTypeName(CoveragePlaceTypeEnum.getEnum(placeTypeInAnalysis).getName()); |
|
|
|
tr.setChildren(targetObjects); |
|
|
|
results.add(tr); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
//2.从oper_customize.ic_resi_category_warn_config表中取18大类居民中需要预警的类出来
|
|
|
|
List<IcResiCategoryWarnConfigEntity> categoriesNeed2Warn = icResiCategoryWarnService.listResiCategoriesNeed2Warn(EpmetRequestHolder.getLoginUserCustomerId()); |
|
|
|
List<AnalysisGovernedTargetsResult> ggfwrqCategories = categoriesNeed2Warn.stream().map(wc -> |
|
|
|
new AnalysisGovernedTargetsResult(wc.getColumnName(), wc.getTableName(), |
|
|
|
CoverageEnums.GGFW.getKey(), CoveragePlaceTypeEnum.RESI.getCode(), CoveragePlaceTypeEnum.RESI.getName(), |
|
|
|
0, new ArrayList<>())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
AnalysisGovernedTargetsResult ggfwRq = new AnalysisGovernedTargetsResult(); |
|
|
|
ggfwRq.setPlaceType(CoveragePlaceTypeEnum.RESI.getCode()); |
|
|
|
ggfwRq.setPlaceTypeName(CoveragePlaceTypeEnum.RESI.getName()); |
|
|
|
ggfwRq.setChildren(ggfwrqCategories); |
|
|
|
|
|
|
|
results.add(ggfwRq); |
|
|
|
return results; |
|
|
|
} |
|
|
|
|
|
|
|
|