| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -462,19 +462,34 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.info("组合后的数据{}:"+JSON.toJSONString(finalResult)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 父客户存在分类,但是父客户没有使用过此分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<Boolean, List<CategoryProjectResultDTO>> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CategoryProjectResultDTO> twoResult = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(groupByStatus.get(false))){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(groupByStatus.get(false), ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    entities.forEach(e -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setOrgId(entity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.addAll(entities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    twoResult.addAll(groupByStatus.get(false)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    entities.forEach(e -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setOrgId(entity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    twoResult.addAll(categoryProjectNotExists); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                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); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |