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 878e376bce..fd509f640d 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 @@ -82,4 +82,17 @@ public interface EvaluationIndexDao { * @author sun */ ScreenCustomerAgencyDTO getByAgencyId(@Param("agencyId") String agencyId); + + /** + * @Description 存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + * @author sun + */ + List getAgencyIdsByAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + + /** + * @Description 查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查 + * @author sun + */ + List getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List list); + } \ 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 d3a596036f..9c9e8b0333 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 @@ -1129,7 +1129,7 @@ public class DataStatsServiceImpl implements DataStatsService { formDTO.setDateId(format.format(yesterday)); } ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); - if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { + if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) { List subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); if (CollectionUtils.isEmpty(subAgencyIds)) { @@ -1202,7 +1202,7 @@ public class DataStatsServiceImpl implements DataStatsService { } List agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); - if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { + if (CollectionUtils.isNotEmpty(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 -> { @@ -1380,7 +1380,7 @@ public class DataStatsServiceImpl implements DataStatsService { } if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); - if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { + 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())); 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 c9fa3bf7d2..8351deeaf6 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 @@ -115,11 +115,12 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { //1.查询agencyId对应组织信息 ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); //2.判断客户是否存在子客户 - if (!customerRelation.haveSubCustomer(dto.getCustomerId())) { + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { return new ArrayList<>(); } - //3.存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的客户组织列表 - return evaluationIndexDao.getAgencyByAreaCodeAgencyId(agencyId, dto.getAreaCode()); + //3.存在子客户的,查询当前组织的areaCode对应的直属下级且不是agencyId对应的客户id的但是存在父子客户关系的客户组织列表 + return evaluationIndexDao.getAgencyIdsByAgencyId(agencyId, dto.getAreaCode(), list); } /** @@ -131,10 +132,11 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService { //1.查询agencyId对应组织信息 ScreenCustomerAgencyDTO dto = evaluationIndexDao.getByAgencyId(agencyId); //2.判断客户是否存在子客户 - if (!customerRelation.haveSubCustomer(dto.getCustomerId())) { - return evaluationIndexDao.getSubAgencyList(agencyId, null); + List list = customerRelation.haveSubCustomer(dto.getCustomerId()); + if (!CollectionUtils.isNotEmpty(list)) { + return evaluationIndexDao.getSubAgencyListByAgency(agencyId, null, null); } else { - return evaluationIndexDao.getSubAgencyList(null, dto.getAreaCode()); + return evaluationIndexDao.getSubAgencyListByAgency(null, dto.getAreaCode(), list); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java index c53ce0348e..71d96fe17b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java @@ -16,7 +16,7 @@ public interface CustomerRelation { * @author zhaoqifeng * @date 2021/6/29 11:06 * @param customerId - * @return boolean + * @return List */ - boolean haveSubCustomer(String customerId); + List haveSubCustomer(String customerId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java index 13dd247d1b..af5f40e53f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java @@ -38,8 +38,7 @@ public class CustomerRelationImpl implements CustomerRelation { * @date 2021/6/29 11:06 */ @Override - public boolean haveSubCustomer(String customerId) { - List list = customerRelationDao.selectAllSubCustomerIds(customerId); - return CollectionUtils.isNotEmpty(list); + public List haveSubCustomer(String customerId) { + return customerRelationDao.selectAllSubCustomerIds(customerId); } } 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 b76960a3d2..ccc4ef9b35 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 @@ -126,4 +126,52 @@ AND agency_id = #{agencyId} + + + + \ No newline at end of file