From 990dc8058414cca32f2b8f9b4a2d87861cebe152 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 29 Jun 2021 14:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=BB=E7=90=86=E6=8C=87=E6=95=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/EvaluationIndexDao.java | 9 +++ .../datastats/impl/DataStatsServiceImpl.java | 81 ++++++++++--------- .../EvaluationIndexService.java | 9 +++ .../impl/EvaluationIndexServiceImpl.java | 13 +++ .../evaluationindex/EvaluationIndexDao.xml | 14 ++++ 5 files changed, 87 insertions(+), 39 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java index 392ec5991a..613700f3aa 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java @@ -67,4 +67,13 @@ public interface EvaluationIndexDao { * @return java.util.List */ ScreenGovernRankDataDailyDTO getGovernRankList(@Param("agencyIds") List agencyIds, @Param("dateId") String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:58 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(@Param("agencyId") String agencyId); } \ No newline at end of file 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 48bd39d76f..d70b3a3dfb 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 @@ -19,6 +19,7 @@ import com.epmet.dataaggre.entity.datastats.DimGridEntity; import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; +import com.epmet.dataaggre.service.opercrm.CustomerRelation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -46,6 +47,8 @@ public class DataStatsServiceImpl implements DataStatsService { private DataStatsDao dataStatsDao; @Autowired private EvaluationIndexService indexService; + @Autowired + private CustomerRelation customerRelation; /** @@ -1127,40 +1130,39 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } - if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) { - if (StringUtils.isNotBlank(formDTO.getAreaCode())) { + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { - List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.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; - } + 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.按日期查询当前组织事件治理指数 @@ -1201,8 +1203,9 @@ public class DataStatsServiceImpl implements DataStatsService { return resultList; } List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); - if (StringUtils.isNotBlank(formDTO.getAreaCode())) { - List subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); + if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { + List subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode()); agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); subAgencyList = subAgencies.stream().map(item -> { DimAgencyEntity entity = new DimAgencyEntity(); @@ -1377,10 +1380,10 @@ public class DataStatsServiceImpl implements DataStatsService { SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); formDTO.setDateId(format.format(yesterday)); } - - if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) { - if (StringUtils.isNotBlank(formDTO.getAreaCode())) { - ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), formDTO.getAreaCode(), formDTO.getDateId()); + if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { + ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); + if (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())); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java index fe6fef6bfc..ae8849e81d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java @@ -49,4 +49,13 @@ public interface EvaluationIndexService { * @return java.util.List */ ScreenGovernRankDataDailyDTO getGovernRank(String agencyId, String areaCode, String dateId); + + /** + * 获取组织信息 + * @author zhaoqifeng + * @date 2021/6/29 13:57 + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + */ + ScreenCustomerAgencyDTO getAgencyInfo(String agencyId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java index 96c86d7d53..c4c45b0fd2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java @@ -90,4 +90,17 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { return evaluationIndexDao.getGovernRankList(agencyIdList, dateId); } + /** + * 获取组织信息 + * + * @param agencyId + * @return com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO + * @author zhaoqifeng + * @date 2021/6/29 13:57 + */ + @Override + public ScreenCustomerAgencyDTO getAgencyInfo(String agencyId) { + return evaluationIndexDao.getAgencyInfo(agencyId); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml index af8d39f643..188b3e5c58 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml @@ -96,5 +96,19 @@ AND ORG_TYPE = 'agency' AND DATE_ID = #{dateId} + \ No newline at end of file