| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -401,12 +401,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<String> customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 父客户存在的分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 父客户不存在的分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 外部客户所有分类 = 父客户存在的分类 + 父客户不存在的分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CategoryProjectResultDTO> sonResult = baseDao.selectOrgCategoryMoreCustomerInfoPlus(customerIds, dateId, level, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                categoryProjectResultDTOS.addAll(sonResult); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 此时的 'categoryProjectResultDTOS' 等于 父子客户所有的分类标签
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 内部客户进行分组
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                result.clear(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -414,6 +409,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                groupByCategoryCode.forEach((code, list) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setCategoryOriginCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setCategoryCode(code); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setOrgId(entity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setProjectTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal))); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -423,8 +419,20 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setLevel(list.get(NumConstant.ZERO).getLevel()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    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); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 添加此 锦水、孔村、榆山 orgId,删除时使用
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |