|
@ -187,6 +187,10 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc |
|
|
* 2.查询子客户的分类标签,把子客户分类标签一样的累加 |
|
|
* 2.查询子客户的分类标签,把子客户分类标签一样的累加 |
|
|
* 3.子客户累加后的跟父客户对比 categoryCode,一样累加到父客户,不一样直接添加到父客户,agencyId一并改为父客户的 |
|
|
* 3.子客户累加后的跟父客户对比 categoryCode,一样累加到父客户,不一样直接添加到父客户,agencyId一并改为父客户的 |
|
|
* 4.父客户数据处理好,在存储一套子客户数据 |
|
|
* 4.父客户数据处理好,在存储一套子客户数据 |
|
|
|
|
|
* |
|
|
|
|
|
* |
|
|
|
|
|
* 2021-08-19新注释新修改 |
|
|
|
|
|
* 利用 EPMET_CATEGORY_CODE把外部客户的分类计算到内部客户 |
|
|
*/ |
|
|
*/ |
|
|
disposeMoreCustomer(customerId,dateId,relationInfo); |
|
|
disposeMoreCustomer(customerId,dateId,relationInfo); |
|
|
} |
|
|
} |
|
@ -397,19 +401,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc |
|
|
List<String> customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); |
|
|
List<String> customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); |
|
|
// 父客户存在的分类
|
|
|
// 父客户存在的分类
|
|
|
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); |
|
|
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); |
|
|
// 父客户不存在的分类
|
|
|
// 内部客户进行分组
|
|
|
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); |
|
|
|
|
|
// 子级客户的分类标签数据
|
|
|
|
|
|
List<CategoryProjectResultDTO> sonResult = new ArrayList<>(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(categoryProjectExists)){ |
|
|
|
|
|
categoryProjectResultDTOS.addAll(categoryProjectExists); |
|
|
|
|
|
sonResult.addAll(categoryProjectExists); |
|
|
|
|
|
} |
|
|
|
|
|
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ |
|
|
|
|
|
categoryProjectResultDTOS.addAll(categoryProjectNotExists); |
|
|
|
|
|
sonResult.addAll(categoryProjectNotExists); |
|
|
|
|
|
} |
|
|
|
|
|
// 此时的 'categoryProjectResultDTOS' 等于 父子客户所有的分类标签
|
|
|
|
|
|
Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode)); |
|
|
Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode)); |
|
|
// 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
|
|
|
// 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
|
|
|
result.clear(); |
|
|
result.clear(); |
|
@ -417,6 +409,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc |
|
|
groupByCategoryCode.forEach((code, list) -> { |
|
|
groupByCategoryCode.forEach((code, list) -> { |
|
|
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); |
|
|
ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); |
|
|
e.setCustomerId(customerId); |
|
|
e.setCustomerId(customerId); |
|
|
|
|
|
e.setCategoryOriginCustomerId(customerId); |
|
|
e.setCategoryCode(code); |
|
|
e.setCategoryCode(code); |
|
|
e.setOrgId(entity.getAgencyId()); |
|
|
e.setOrgId(entity.getAgencyId()); |
|
|
e.setProjectTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal))); |
|
|
e.setProjectTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal))); |
|
@ -426,8 +419,20 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc |
|
|
e.setLevel(list.get(NumConstant.ZERO).getLevel()); |
|
|
e.setLevel(list.get(NumConstant.ZERO).getLevel()); |
|
|
finalResult.add(e); |
|
|
finalResult.add(e); |
|
|
}); |
|
|
}); |
|
|
if (!CollectionUtils.isEmpty(sonResult)){ |
|
|
// 内部客户与外部客户 相同的分类累加
|
|
|
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class); |
|
|
if (!CollectionUtils.isEmpty(categoryProjectExists)){ |
|
|
|
|
|
finalResult.forEach(f -> { |
|
|
|
|
|
categoryProjectExists.forEach(c -> { |
|
|
|
|
|
if (f.getCategoryCode().equals(c.getCategoryCode())){ |
|
|
|
|
|
f.setProjectTotal(f.getProjectTotal() + c.getProjectTotal()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 父客户不存在的分类
|
|
|
|
|
|
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ |
|
|
|
|
|
List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); |
|
|
result.addAll(entities); |
|
|
result.addAll(entities); |
|
|
} |
|
|
} |
|
|
// 添加此 锦水、孔村、榆山 orgId,删除时使用
|
|
|
// 添加此 锦水、孔村、榆山 orgId,删除时使用
|
|
|