Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into develop

dev_shibei_match
zxc 4 years ago
parent
commit
53400489e1
  1. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  2. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

@ -462,19 +462,34 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
log.info("组合后的数据{}:"+JSON.toJSONString(finalResult)); log.info("组合后的数据{}:"+JSON.toJSONString(finalResult));
// 父客户存在分类,但是父客户没有使用过此分类 // 父客户存在分类,但是父客户没有使用过此分类
Map<Boolean, List<CategoryProjectResultDTO>> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); Map<Boolean, List<CategoryProjectResultDTO>> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus));
List<CategoryProjectResultDTO> twoResult = new ArrayList<>();
if (!CollectionUtils.isEmpty(groupByStatus.get(false))){ if (!CollectionUtils.isEmpty(groupByStatus.get(false))){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(groupByStatus.get(false), ScreenProjectCategoryOrgDailyEntity.class); twoResult.addAll(groupByStatus.get(false));
entities.forEach(e -> {
e.setOrgId(entity.getAgencyId());
});
result.addAll(entities);
} }
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ if (!CollectionUtils.isEmpty(categoryProjectNotExists)){
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); twoResult.addAll(categoryProjectNotExists);
entities.forEach(e -> { }
e.setOrgId(entity.getAgencyId()); if (!CollectionUtils.isEmpty(twoResult)){
Map<String, List<CategoryProjectResultDTO>> groupOrigin = twoResult.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryOriginCustomerId));
List<ScreenProjectCategoryOrgDailyEntity> finalResult1 = result;
groupOrigin.forEach((originCustomerId, list) -> {
// 父客户存在但是未使用的分类 + 父客户不存在的分类,根据categoryCode分组
Map<String, List<CategoryProjectResultDTO>> sonGroupByCode = list.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode));
sonGroupByCode.forEach((code,list2) -> {
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity();
e.setCustomerId(customerId);
e.setCategoryOriginCustomerId(originCustomerId);
e.setCategoryCode(code);
e.setOrgId(entity.getAgencyId());
e.setProjectTotal(CollectionUtils.isEmpty(list2) ? NumConstant.ZERO : list2.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal)));
e.setPid(entity.getPid());
e.setPids(StringUtils.isEmpty(entity.getPids()) ? NumConstant.ZERO_STR : entity.getPids());
// 因为根据categoryCode分组,所以level都一样,取第一条的
e.setLevel(list2.get(NumConstant.ZERO).getLevel());
finalResult1.add(e);
});
}); });
result.addAll(entities);
} }
} }
} }

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -47,7 +47,7 @@
<!-- 查询组织分类信息【多客户】 --> <!-- 查询组织分类信息【多客户】 -->
<select id="selectOrgCategoryMoreCustomerInfo" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO"> <select id="selectOrgCategoryMoreCustomerInfo" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT SELECT
IF(od.pid = '0', od.ORG_ID,od.pid) AS orgId, od.ORG_ID AS orgId,
IFNULL(sca.PID,'0') AS pid, IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids, IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId, #{customerId} as customerId,
@ -64,7 +64,7 @@
od.DATE_ID od.DATE_ID
FROM screen_project_category_org_daily od FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID) LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.PID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.ORG_ID
WHERE 1=1 WHERE 1=1
AND od.DEL_FLAG = '0' AND od.DEL_FLAG = '0'
AND ( AND (
@ -81,7 +81,7 @@
</if> </if>
AND od.pid = '0' AND od.pid = '0'
AND od.date_id = #{dateId} AND od.date_id = #{dateId}
GROUP BY categoryCode,od.pid GROUP BY categoryCode,od.ORG_ID
</select> </select>
<!-- 查询内部客户组织的项目分类 --> <!-- 查询内部客户组织的项目分类 -->

Loading…
Cancel
Save