| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -31,12 +31,14 @@ import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.ScreenCustomerGridDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screen.result.CategoryProjectResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.screencoll.ScreenCollFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.crm.CustomerRelationEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.crm.CustomerRelationService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -74,6 +76,8 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenProjectCategoryGridDailyDao gridDailyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private ScreenCustomerGridService gridService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private FactOriginProjectCategoryDailyService factOriginProjectCategoryDailyService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public PageData<ScreenProjectCategoryOrgDailyDTO> page(Map<String, Object> params) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -194,23 +198,23 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 社区级别
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.STREET)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 街道级别
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 区级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.CITY)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 市级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 省级
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,agencyIdList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -224,7 +228,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @author zxc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @date 2021/3/25 上午10:44 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId,List<CustomerAgencyInfoResultDTO> agencyIdList){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<ScreenProjectCategoryOrgDailyEntity> result = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (isGrid){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 是社区级别
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -255,6 +259,34 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 组织项目分类 项目数
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<String> orgIds = agencyIdList.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); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |