| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -309,23 +309,23 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 社区级别
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,relationInfo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,relationInfo,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.STREET)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 街道级别
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.STREET,false,customerId,dateId,relationInfo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.STREET,false,customerId,dateId,relationInfo,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 区级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,relationInfo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,relationInfo,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.CITY)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 市级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.CITY,false,customerId,dateId,relationInfo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.CITY,false,customerId,dateId,relationInfo,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 省级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,relationInfo); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeMoreCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,relationInfo,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -340,7 +340,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2021/3/25 下午1:29 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void disposeMoreCustomerSub(String level,Boolean isGrid,String customerId, String dateId, List<CustomerRelationEntity> relationInfo){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void disposeMoreCustomerSub(String level,Boolean isGrid,String customerId, String dateId, List<CustomerRelationEntity> relationInfo,List<CustomerAgencyInfoResultDTO> agencyIdList){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenProjectCategoryOrgDailyEntity> result = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (isGrid){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // community级别走这
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -399,6 +399,41 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 目前不考虑计算子客户组织直接创建的项目,只算内部客户
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!CollectionUtils.isEmpty(levelAgencyInfo)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<String> orgIds = levelAgencyInfo.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(result)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(screenProjectCategory)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        screenProjectCategory.forEach(pc -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            if (r.getOrgId().equals(pc.getOrgId()) && r.getCategoryCode().equals(pc.getCategoryCode())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                pc.setStatus(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                r.setProjectTotal(r.getProjectTotal() + pc.getProjectTotal()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Map<Boolean, List<ScreenProjectCategoryGridDailyDTO>> groupByStatus = screenProjectCategory.stream().collect(Collectors.groupingBy(ScreenProjectCategoryGridDailyDTO::getStatus)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    List<ScreenProjectCategoryGridDailyDTO> screenProjectCategoryNoCal = groupByStatus.get(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (!CollectionUtils.isEmpty(screenProjectCategoryNoCal)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        List<ScreenProjectCategoryOrgDailyEntity> noCalCategory = ConvertUtils.sourceToTarget(screenProjectCategoryNoCal, ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        result.addAll(noCalCategory); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if (!CollectionUtils.isEmpty(screenProjectCategory)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    result = ConvertUtils.sourceToTarget(screenProjectCategory, ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!CollectionUtils.isEmpty(result)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                result.forEach(r -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    r.setOrgType(level); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    r.setDateId(dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        deleteAndInsert(customerId,dateId,result); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |