Browse Source

Merge branch 'dev_data_fusion' into develop

dev_shibei_match
sunyuchao 4 years ago
parent
commit
0e16f45385
  1. 13
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
  2. 6
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  3. 14
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
  4. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/CustomerRelation.java
  5. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/opercrm/impl/CustomerRelationImpl.java
  6. 48
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

13
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<String> getAgencyIdsByAgencyId(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List<String> list);
/**
* @Description 查询直属下级组织列表有areaCode的按areaCode查没有的按agencyId查
* @author sun
*/
List<ScreenCustomerAgencyDTO> getSubAgencyListByAgency(@Param("agencyId") String agencyId, @Param("areaCode") String areaCode, @Param("list") List<String> list);
}

6
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<String> subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode());
if (CollectionUtils.isEmpty(subAgencyIds)) {
@ -1202,7 +1202,7 @@ public class DataStatsServiceImpl implements DataStatsService {
}
List<String> 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<ScreenCustomerAgencyDTO> 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()));

14
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<String> 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<String> 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);
}
}

4
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<String>
*/
boolean haveSubCustomer(String customerId);
List<String> haveSubCustomer(String customerId);
}

5
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<String> list = customerRelationDao.selectAllSubCustomerIds(customerId);
return CollectionUtils.isNotEmpty(list);
public List<String> haveSubCustomer(String customerId) {
return customerRelationDao.selectAllSubCustomerIds(customerId);
}
}

48
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

@ -126,4 +126,52 @@
AND agency_id = #{agencyId}
</select>
<select id="getAgencyIdsByAgencyId" resultType="java.lang.String">
SELECT
agency_id
FROM
screen_customer_agency
WHERE
del_flag = '0'
AND parent_area_code = #{areaCode}
AND customer_id != (
SELECT
customer_id
FROM
screen_customer_agency
WHERE
agency_id = #{agencyId}
)
<foreach collection="list" item="customerId" open="AND (" separator=" OR " close=")">
customer_id = #{customerId}
</foreach>
</select>
<select id="getSubAgencyListByAgency" resultType="com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerAgencyDTO">
SELECT
customer_id AS customerId,
agency_id AS agencyId,
agency_name AS agencyName,
level AS level,
area_code AS areaCode,
parent_area_code AS parentAreaCode
FROM
screen_customer_agency
WHERE
del_flag = '0'
<choose>
<when test="areaCode != null and areaCode.trim() != ''">
AND parent_area_code = #{areaCode}
</when>
<otherwise>
AND pid = #{agencyId}
</otherwise>
</choose>
<if test="null != list and list.size() > 0">
<foreach collection="list" item="customerId" open="AND (" separator=" OR " close=")">
customer_id = #{customerId}
</foreach>
</if>
</select>
</mapper>
Loading…
Cancel
Save