| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -413,7 +413,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, List<CategoryProjectResultDTO>> groupByCategoryCode = categoryProjectResultDTOS.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getCategoryCode)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                result.clear(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<ScreenProjectCategoryOrgDailyEntity> finalResult = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<ScreenProjectCategoryOrgDailyEntity> finalResult = result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                groupByCategoryCode.forEach((code, list) -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setCustomerId(customerId); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -428,37 +428,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(sonResult)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<ScreenProjectCategoryOrgDailyEntity> entities = ConvertUtils.sourceToTarget(sonResult, ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    finalResult.addAll(entities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 计算内部客户的分类
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(levelAgencyInfo)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    orgIds.addAll(orgIdss); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<CategoryProjectResultDTO> selfOrgCategory = baseDao.selectSelfAgencyCategory(dateId, orgIdss); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (!CollectionUtils.isEmpty(selfOrgCategory)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<ScreenProjectCategoryOrgDailyEntity> selfResult = ConvertUtils.sourceToTarget(selfOrgCategory, ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        selfResult.forEach(s -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            finalResult.forEach(f -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                if (s.getCategoryCode().equals(f.getCategoryCode())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    s.setProjectTotal(s.getProjectTotal() + f.getProjectTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                    f.setUseStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.addAll(selfResult); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<Boolean, List<ScreenProjectCategoryOrgDailyEntity>> groupByStatus = finalResult.stream().collect(Collectors.groupingBy(ScreenProjectCategoryOrgDailyEntity::getUseStatus)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<ScreenProjectCategoryOrgDailyEntity> falseList = groupByStatus.get(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(falseList)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.addAll(falseList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        r.setCustomerId(customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        r.setOrgId(entity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        r.setPid(entity.getPid()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.addAll(entities); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 添加此 锦水、孔村、榆山 orgId,删除时使用
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                orgIds.add(PingYinConstant.JIN_SHUI_AGENCY_ID); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -471,8 +441,9 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!CollectionUtils.isEmpty(levelAgencyInfo)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> orgIdss = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            orgIds.addAll(orgIdss); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIdss, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(result)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(screenProjectCategory)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.forEach(r -> { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |