|
@ -7,6 +7,7 @@ import com.epmet.commons.tools.enums.CoverageEnums; |
|
|
import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum; |
|
|
import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
@ -458,10 +459,11 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
return heartService.countCommunityOrgEntities(customerId, agencyId, staffOrgIds, search, categoryKey); |
|
|
return heartService.countCommunityOrgEntities(customerId, agencyId, staffOrgIds, search, categoryKey); |
|
|
} else if (CoveragePlaceTypeEnum.PARTY_UNIT.getCode().equals(placeType)) { |
|
|
} else if (CoveragePlaceTypeEnum.PARTY_UNIT.getCode().equals(placeType)) { |
|
|
// 机关直属部门(联建单位) 楼宇党建 0;两新组织 1;区域单位党建 2;机关直属部门 3;社会团体 4;民办非企业单位 5;基金会 6;其他 7
|
|
|
// 机关直属部门(联建单位) 楼宇党建 0;两新组织 1;区域单位党建 2;机关直属部门 3;社会团体 4;民办非企业单位 5;基金会 6;其他 7
|
|
|
if (categoryKey.equals("pu_jgzsbm")) { |
|
|
// if (categoryKey.equals("pu_jgzsbm")) {
|
|
|
String partyUnitType = "3"; |
|
|
// String partyUnitType = "3";
|
|
|
return heartService.countPartyUnitEntities(customerId, agencyId, staffOrgIds, partyUnitType, search); |
|
|
// }
|
|
|
} |
|
|
String[] parts = categoryKey.split("_"); |
|
|
|
|
|
return heartService.countPartyUnitEntities(customerId, agencyId, staffOrgIds, parts[1], search); |
|
|
} else if (CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode().equals(placeType)) { |
|
|
} else if (CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode().equals(placeType)) { |
|
|
// 危化企业
|
|
|
// 危化企业
|
|
|
return orgCoverageService.countDangerousChemicalEntities(customerId, staffOrgIds, search, categoryKey); |
|
|
return orgCoverageService.countDangerousChemicalEntities(customerId, staffOrgIds, search, categoryKey); |
|
@ -568,17 +570,16 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
|
|
|
|
|
} else if (CoveragePlaceTypeEnum.PARTY_UNIT.getCode().equals(placeType)) { |
|
|
} else if (CoveragePlaceTypeEnum.PARTY_UNIT.getCode().equals(placeType)) { |
|
|
// 机关直属部门(联建单位) 楼宇党建 0;两新组织 1;区域单位党建 2;机关直属部门 3;社会团体 4;民办非企业单位 5;基金会 6;其他 7
|
|
|
// 机关直属部门(联建单位) 楼宇党建 0;两新组织 1;区域单位党建 2;机关直属部门 3;社会团体 4;民办非企业单位 5;基金会 6;其他 7
|
|
|
if (categoryKey.equals("pu_jgzsbm")) { |
|
|
// if (categoryKey.equals("pu_jgzsbm")) {
|
|
|
String partyUnitType = "3"; |
|
|
// String partyUnitType = "3";
|
|
|
List<IcPartyUnitEntity> l = heartService.searchPartyUnitEntities( |
|
|
// }
|
|
|
customerId, agencyId, staffOrgIds, partyUnitType, search, isPage, pageNo, pageSize); |
|
|
String[] parts = categoryKey.split("_"); |
|
|
|
|
|
List<IcPartyUnitEntity> l = heartService.searchPartyUnitEntities( |
|
|
return l.stream() |
|
|
customerId, agencyId, staffOrgIds, parts[1], search, isPage, pageNo, pageSize); |
|
|
.map(dc -> new CoverageAnalisisDataListResultDTO(dc.getId(), categoryKey, |
|
|
return l.stream() |
|
|
isPage ? categoryDict.getCategoryName() : null, placeType, isPage ? dc.getUnitName() : null, dc.getLatitude(), dc.getLongitude())) |
|
|
.map(dc -> new CoverageAnalisisDataListResultDTO(dc.getId(), categoryKey, |
|
|
.collect(Collectors.toList()); |
|
|
isPage ? categoryDict.getCategoryName() : null, placeType, isPage ? dc.getUnitName() : null, dc.getLatitude(), dc.getLongitude())) |
|
|
} |
|
|
.collect(Collectors.toList()); |
|
|
return new ArrayList<>(); |
|
|
|
|
|
} else if (CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode().equals(placeType)) { |
|
|
} else if (CoveragePlaceTypeEnum.DANGEROUS_CHEMICALS.getCode().equals(placeType)) { |
|
|
// 危化企业
|
|
|
// 危化企业
|
|
|
List<IcDangerousChemicalsEntity> l = orgCoverageService.searchDangerousChemicalEntities( |
|
|
List<IcDangerousChemicalsEntity> l = orgCoverageService.searchDangerousChemicalEntities( |
|
@ -680,7 +681,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<AnalysisResourceCategoriesResult> listAnalysisResourceCategories() { |
|
|
public List<AnalysisResourceCategoriesResult> listAnalysisResourceCategories(String agencyId) { |
|
|
|
|
|
|
|
|
// 获取所有菜单的url
|
|
|
// 获取所有菜单的url
|
|
|
List<String> menuUrls = new ArrayList<>(128); |
|
|
List<String> menuUrls = new ArrayList<>(128); |
|
@ -700,7 +701,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
AnalysisResourceCategoriesResult categoriesOfThisCoverage = new AnalysisResourceCategoriesResult(); |
|
|
AnalysisResourceCategoriesResult coverageResult = new AnalysisResourceCategoriesResult(); |
|
|
HashMap<String, AnalysisResourceCategoriesResult.PlaceType> placeTypeMap = new HashMap<>(); |
|
|
HashMap<String, AnalysisResourceCategoriesResult.PlaceType> placeTypeMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
List<IcCoverageCategoryDictEntity> categoryDictEntities = govOrgCoverageService.listResourceCategoryEntities(coverage.getKey()); |
|
|
List<IcCoverageCategoryDictEntity> categoryDictEntities = govOrgCoverageService.listResourceCategoryEntities(coverage.getKey()); |
|
@ -714,9 +715,9 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
if (StringUtils.isBlank(category.getPlaceTypeInAnalysis())) { |
|
|
if (StringUtils.isBlank(category.getPlaceTypeInAnalysis())) { |
|
|
// 没有placetype的
|
|
|
// 没有placetype的
|
|
|
if ("all".equals(category.getMenuUrl()) || menuUrls.contains(category.getMenuUrl())) { |
|
|
if ("all".equals(category.getMenuUrl()) || menuUrls.contains(category.getMenuUrl())) { |
|
|
categoriesOfThisCoverage.getCategories() |
|
|
coverageResult.getCategories() |
|
|
.add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), category.getCategoryName(), |
|
|
.add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), category.getCategoryName(), |
|
|
category.getCoverageType(), category.getPlaceType(), category.getQuantity())); |
|
|
category.getCoverageType(), category.getPlaceType(), 0)); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 有placetype的
|
|
|
// 有placetype的
|
|
@ -725,33 +726,94 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
|
|
|
|
|
if (placeType == null) { |
|
|
if (placeType == null) { |
|
|
placeType = new AnalysisResourceCategoriesResult.PlaceType( |
|
|
placeType = new AnalysisResourceCategoriesResult.PlaceType( |
|
|
category.getPlaceTypeInAnalysis(), CoveragePlaceTypeEnum.getEnum(category.getPlaceTypeInAnalysis()).getName(), category.getQuantity(), new ArrayList<>()); |
|
|
category.getPlaceTypeInAnalysis(), CoveragePlaceTypeEnum.getEnum(category.getPlaceTypeInAnalysis()).getName(), new AtomicInteger(0), new ArrayList<>()); |
|
|
placeTypeMap.put(category.getPlaceTypeInAnalysis(), placeType); |
|
|
placeTypeMap.put(category.getPlaceTypeInAnalysis(), placeType); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
placeType.getCategories().add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), |
|
|
placeType.getCategories().add(new AnalysisResourceCategoriesResult.Category(category.getCategoryKey(), |
|
|
category.getCategoryName(), category.getCoverageType(), category.getPlaceType(), category.getQuantity())); |
|
|
category.getCategoryName(), category.getCoverageType(), category.getPlaceType(), 0)); |
|
|
placeType.setQuantity(placeType.getQuantity() + category.getQuantity()); // todo 0改为category的count
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
AtomicReference<Integer> total = new AtomicReference<>(0); |
|
|
|
|
|
placeTypeMap.forEach((placeTypeKey, placeType) -> { |
|
|
placeTypeMap.forEach((placeTypeKey, placeType) -> { |
|
|
categoriesOfThisCoverage.getPlaceTypesInAnalysis().add(placeType); |
|
|
coverageResult.getPlaceTypesInAnalysis().add(placeType); |
|
|
total.updateAndGet(v -> v + placeType.getQuantity()); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
categoriesOfThisCoverage.setCoverageType(coverage.getKey()); |
|
|
coverageResult.setCoverageType(coverage.getKey()); |
|
|
categoriesOfThisCoverage.setCoverageName(CoverageEnums.getEnum(coverage.getKey()).getCoverageName()); |
|
|
coverageResult.setCoverageName(CoverageEnums.getEnum(coverage.getKey()).getCoverageName()); |
|
|
categoriesOfThisCoverage.setQuantity(total.get()); |
|
|
results.add(coverageResult); |
|
|
results.add(categoriesOfThisCoverage); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|
|
|
|
|
String userId = EpmetRequestHolder.getLoginUserId(); |
|
|
|
|
|
|
|
|
|
|
|
Map<String,String> stafInfoMap=getStaffPidsFromStaffInfo(customerId, userId, agencyId,OrgConstant.AGENCY); |
|
|
|
|
|
String staffOrgPath = stafInfoMap.get(OrgConstant.AGENC_PATH); |
|
|
|
|
|
|
|
|
|
|
|
// 填充数量quantity字段
|
|
|
|
|
|
fillQuantities4ResourcesCoverages(results, customerId, agencyId, staffOrgPath); |
|
|
|
|
|
|
|
|
return results; |
|
|
return results; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fillQuantities4ResourcesCoverages(ArrayList<AnalysisResourceCategoriesResult> coverages, String customerId, String agencyId, String staffOrgIds) { |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<CompletableFuture<Void>> futures = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
coverages.forEach(coverage -> { |
|
|
|
|
|
List<AnalysisResourceCategoriesResult.Category> categoriesInCoverage = coverage.getCategories(); |
|
|
|
|
|
List<AnalysisResourceCategoriesResult.PlaceType> placeTypesInCoverage = coverage.getPlaceTypesInAnalysis(); |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(categoriesInCoverage)) { |
|
|
|
|
|
// 直属于图层的category。异步提交计算任务
|
|
|
|
|
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> fillQuantities4ResourcesCategories(coverage, null, categoriesInCoverage, customerId, agencyId, staffOrgIds)); |
|
|
|
|
|
futures.add(future); |
|
|
|
|
|
} |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(placeTypesInCoverage)) { |
|
|
|
|
|
// placeType,需要拆开来算, 异步提交计算任务
|
|
|
|
|
|
placeTypesInCoverage.forEach(placeType -> { |
|
|
|
|
|
List<AnalysisResourceCategoriesResult.Category> categoriesInPlaceType = placeType.getCategories(); |
|
|
|
|
|
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> fillQuantities4ResourcesCategories(coverage, placeType, categoriesInPlaceType, customerId, agencyId, staffOrgIds)); |
|
|
|
|
|
futures.add(future); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 等待异步任务计算完成
|
|
|
|
|
|
futures.forEach(f -> { |
|
|
|
|
|
try { |
|
|
|
|
|
f.get(); |
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
log.error("【五大图层】可视化-右侧资源列表异步计算数量quantity失败,计算被中止,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|
|
|
} catch (ExecutionException e) { |
|
|
|
|
|
log.error("【五大图层】可视化-右侧资源列表异步计算数量quantity失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void fillQuantities4ResourcesCategories(AnalysisResourceCategoriesResult coverage, |
|
|
|
|
|
AnalysisResourceCategoriesResult.PlaceType placeType, |
|
|
|
|
|
List<AnalysisResourceCategoriesResult.Category> categories, |
|
|
|
|
|
String customerId, String agencyId, String staffOrgIds) { |
|
|
|
|
|
|
|
|
|
|
|
AtomicInteger total = new AtomicInteger(); |
|
|
|
|
|
|
|
|
|
|
|
categories.forEach(cat -> { |
|
|
|
|
|
Integer quantity = doDataListCount(customerId, agencyId, staffOrgIds, cat.getPlaceType(), cat.getCategoryKey(), null); |
|
|
|
|
|
cat.setQuantity(quantity); |
|
|
|
|
|
total.getAndAdd(quantity); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 分别给所属的coverage和placeType的quantity增加quantity
|
|
|
|
|
|
coverage.getQuantity().getAndAdd(total.get()); |
|
|
|
|
|
|
|
|
|
|
|
if (placeType != null) { |
|
|
|
|
|
placeType.getQuantity().getAndAdd(total.get()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<AnalysisGovernedTargetsResult> listGovernedTargetCategories(String agencyId) { |
|
|
public List<AnalysisGovernedTargetsResult> listGovernedTargetCategories(String agencyId) { |
|
|
|
|
|
|
|
@ -776,7 +838,6 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
|
|
|
|
|
List<AnalysisGovernedTargetsResult> results = new ArrayList<>(); |
|
|
List<AnalysisGovernedTargetsResult> results = new ArrayList<>(); |
|
|
HashMap<String, List<AnalysisGovernedTargetsResult>> placeTypeTargetMap = new HashMap<>(); |
|
|
HashMap<String, List<AnalysisGovernedTargetsResult>> placeTypeTargetMap = new HashMap<>(); |
|
|
HashMap<String, Integer> placeTypeQuantityMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
targetCategories.forEach(rc -> { |
|
|
targetCategories.forEach(rc -> { |
|
|
String placeTypeInAnalysis = rc.getPlaceTypeInAnalysis(); |
|
|
String placeTypeInAnalysis = rc.getPlaceTypeInAnalysis(); |
|
@ -790,7 +851,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
// 只有一层,没有子级
|
|
|
// 只有一层,没有子级
|
|
|
if (menuUrls.contains(rc.getMenuUrl()) || "all".equals(rc.getMenuUrl())) { |
|
|
if (menuUrls.contains(rc.getMenuUrl()) || "all".equals(rc.getMenuUrl())) { |
|
|
results.add(new AnalysisGovernedTargetsResult(rc.getCategoryKey(), rc.getCategoryName(), rc.getCoverageType(), |
|
|
results.add(new AnalysisGovernedTargetsResult(rc.getCategoryKey(), rc.getCategoryName(), rc.getCoverageType(), |
|
|
rc.getPlaceType(), CoveragePlaceTypeEnum.getEnum(rc.getPlaceType()).getName(), rc.getQuantity(), new ArrayList<>())); |
|
|
rc.getPlaceType(), CoveragePlaceTypeEnum.getEnum(rc.getPlaceType()).getName(), 0, new ArrayList<>())); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
// 有子级,需要使用placeTypeInAnalysis分组
|
|
|
// 有子级,需要使用placeTypeInAnalysis分组
|
|
@ -799,12 +860,9 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
if (CollectionUtils.isEmpty(targets)) { |
|
|
if (CollectionUtils.isEmpty(targets)) { |
|
|
targets = new ArrayList<>(); |
|
|
targets = new ArrayList<>(); |
|
|
placeTypeTargetMap.put(placeTypeInAnalysis, targets); |
|
|
placeTypeTargetMap.put(placeTypeInAnalysis, targets); |
|
|
placeTypeQuantityMap.put(placeTypeInAnalysis, 0); |
|
|
|
|
|
} |
|
|
} |
|
|
targets.add(new AnalysisGovernedTargetsResult(rc.getCategoryKey(), rc.getCategoryName(), rc.getCoverageType(), |
|
|
targets.add(new AnalysisGovernedTargetsResult(rc.getCategoryKey(), rc.getCategoryName(), rc.getCoverageType(), |
|
|
rc.getPlaceType(), CoveragePlaceTypeEnum.getEnum(rc.getPlaceType()).getName(), rc.getQuantity(), new ArrayList<>())); |
|
|
rc.getPlaceType(), CoveragePlaceTypeEnum.getEnum(rc.getPlaceType()).getName(), 0, new ArrayList<>())); |
|
|
|
|
|
|
|
|
placeTypeQuantityMap.put(placeTypeInAnalysis, placeTypeQuantityMap.get(placeTypeInAnalysis) + rc.getQuantity()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -814,7 +872,6 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
placeTypeTargetMap.forEach((placeTypeInAnalysis, targetObjects) -> { |
|
|
placeTypeTargetMap.forEach((placeTypeInAnalysis, targetObjects) -> { |
|
|
AnalysisGovernedTargetsResult tr = new AnalysisGovernedTargetsResult(); |
|
|
AnalysisGovernedTargetsResult tr = new AnalysisGovernedTargetsResult(); |
|
|
tr.setPlaceType(placeTypeInAnalysis); |
|
|
tr.setPlaceType(placeTypeInAnalysis); |
|
|
tr.setQuantity(placeTypeQuantityMap.get(placeTypeInAnalysis)); |
|
|
|
|
|
tr.setPlaceTypeName(CoveragePlaceTypeEnum.getEnum(placeTypeInAnalysis).getName()); |
|
|
tr.setPlaceTypeName(CoveragePlaceTypeEnum.getEnum(placeTypeInAnalysis).getName()); |
|
|
tr.setChildren(targetObjects); |
|
|
tr.setChildren(targetObjects); |
|
|
results.add(tr); |
|
|
results.add(tr); |
|
@ -854,9 +911,9 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
try { |
|
|
try { |
|
|
future.get(); |
|
|
future.get(); |
|
|
} catch (InterruptedException e) { |
|
|
} catch (InterruptedException e) { |
|
|
e.printStackTrace(); |
|
|
log.error("【五大图层】可视化-左侧异步计算数量quantity失败,计算被中止,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
} catch (ExecutionException e) { |
|
|
} catch (ExecutionException e) { |
|
|
e.printStackTrace(); |
|
|
log.error("【五大图层】可视化-左侧异步计算数量quantity失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|