diff --git a/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java b/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java index 36d502b..14621d8 100644 --- a/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java +++ b/src/main/java/com/cm/inspection/service/count/impl/CountServiceImpl.java @@ -175,6 +175,7 @@ public class CountServiceImpl extends BaseService implements ICountService { // 地区企业总数 params.put("isLogOff", 0); params.put("area" + areaLevel, areaDTO.getDictionaryId()); + setParentArea(areaDTO.getDictionaryParentId(), areaLevel - 1, params); params.put("year", year); Integer enterpriseCount = enterpriseService.countEnterpriseReturnInteger(params); resultListMap.put("enterpriseCount", enterpriseCount); @@ -792,8 +793,10 @@ public class CountServiceImpl extends BaseService implements ICountService { private Integer countEnterpriseOfArea(String areaId, Integer areaLevel, String year) { Map params = getHashMap(6); params.put("isLogOff", 0); - params.put("area" + areaLevel, areaId); + // params.put("area" + areaLevel, areaId); + setParentArea(areaId, areaLevel, params); params.put("year", year); + return enterpriseOfGridOperatorService.countEnterpriseOfArea(params); } @@ -918,4 +921,13 @@ public class CountServiceImpl extends BaseService implements ICountService { resultListMap.put("rectificationRatio", totalRectificationCount == 0 ? 0 : String.format("%.2f", (double) rectificationCount / (unRectificationCount + rectificationCount) * 100)); } + private void setParentArea(String parentAreaId, int parentAreaLevel, Map params) { + if (parentAreaLevel == 0) { + return; + } + params.put("area" + parentAreaLevel, parentAreaId); + DataDictionaryDTO dataDictionaryDTO = dataDictionaryService.getDictionaryById(parentAreaId); + setParentArea(dataDictionaryDTO.getDictionaryParentId(), parentAreaLevel - 1, params); + } + }