diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index 9c9e8b0333..de2d896d08 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -1130,37 +1130,38 @@ public class DataStatsServiceImpl implements DataStatsService { } ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { - - List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); - if (CollectionUtils.isEmpty(subAgencyIds)) { - subAgencyIds = new ArrayList<>(); - } - subAgencyIds.add(formDTO.getAgencyId()); - List list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); - if (CollectionUtils.isNotEmpty(list)) { - //问题解决总数 - Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getProblemResolvedCount).sum(); - //未出小组即未转议题的:话题关闭已解决数 - Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicResolvedCount).sum(); - //未出小组即未转议题的:话题关闭无需解决数 - Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicUnResolvedCount).sum(); - //未出当前网格的,结案项目数 - Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getGridSelfGovernProjectTotal).sum(); - //由社区结案的项目总数 - Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getCommunityClosedCount).sum(); - //由街道结案的项目总数 - Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getStreetClosedCount).sum(); - //由区直部门结案的项目总数 - Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getDistrictDeptClosedCount).sum(); - - resultDTO.setProblemResolvedCount(problemResolvedCount); - resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); - resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); - resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); - resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); - resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); - - return resultDTO; + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); + if (CollectionUtils.isEmpty(subAgencyIds)) { + subAgencyIds = new ArrayList<>(); + } + subAgencyIds.add(formDTO.getAgencyId()); + List list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); + if (CollectionUtils.isNotEmpty(list)) { + //问题解决总数 + Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getProblemResolvedCount).sum(); + //未出小组即未转议题的:话题关闭已解决数 + Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicResolvedCount).sum(); + //未出小组即未转议题的:话题关闭无需解决数 + Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getInGroupTopicUnResolvedCount).sum(); + //未出当前网格的,结案项目数 + Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity::getGridSelfGovernProjectTotal).sum(); + //由社区结案的项目总数 + Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getCommunityClosedCount).sum(); + //由街道结案的项目总数 + Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getStreetClosedCount).sum(); + //由区直部门结案的项目总数 + Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity::getDistrictDeptClosedCount).sum(); + + resultDTO.setProblemResolvedCount(problemResolvedCount); + resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); + resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); + resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); + resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); + resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); + + return resultDTO; + } } } //1.按日期查询当前组织事件治理指数 @@ -1381,12 +1382,14 @@ public class DataStatsServiceImpl implements DataStatsService { if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { - ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.getAreaCode(), formDTO.getDateId()); - resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount())); - resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount())); - resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount())); - resultDTO.setSatisfactionRatio(getPercentage(governData.getSatisfactionCount(), governData.getClosedProjectCount())); - return resultDTO; + if (OrgConstant.PROVINCE.equals(agencyDTO.getLevel()) || OrgConstant.CITY.equals(agencyDTO.getLevel()) || OrgConstant.DISTRICT.equals(agencyDTO.getLevel())) { + ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.getAreaCode(), formDTO.getDateId()); + resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount())); + resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount())); + resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount())); + resultDTO.setSatisfactionRatio(getPercentage(governData.getSatisfactionCount(), governData.getClosedProjectCount())); + return resultDTO; + } } }