@ -32,6 +32,7 @@ import com.epmet.constant.ScreenConstant; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.project.result.ClosedProjectTotalResultDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.screen.ScreenCustomerGridDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -264,6 +265,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        categoryProjectGrid . forEach ( grid  - >  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            if  ( agency . getOrgId ( ) . equals ( grid . getOrgId ( ) )  & &  agency . getCategoryCode ( ) . equals ( grid . getCategoryCode ( ) ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                agency . setProjectTotal ( agency . getProjectTotal ( )  +  grid . getProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                agency . setClosedProjectTotal ( agency . getClosedProjectTotal ( )  +  grid . getClosedProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                grid . setStatus ( true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        } ) ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -280,7 +282,11 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        // 组织项目分类 项目数
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        List < CustomerAgencyInfoResultDTO >  levelAgencyInfo  =  groupByLevel . get ( level ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        if  ( ! CollectionUtils . isEmpty ( levelAgencyInfo ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  screenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds , customerId , NumConstant . FOUR ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  screenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds , customerId , NumConstant . FOUR , "all" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  closedScreenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds , customerId , NumConstant . FOUR , "closed" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( ! CollectionUtils . isEmpty ( closedScreenProjectCategory ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                screenProjectCategory . forEach ( l  - >  closedScreenProjectCategory . stream ( ) . filter ( c  - >  l . getGridId ( ) . equals ( c . getGridId ( ) )  & &  l . getCategoryCode ( ) . equals ( c . getCategoryCode ( ) ) ) . forEach ( c  - >  l . setClosedProjectTotal ( c . getClosedProjectTotal ( ) ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( ! CollectionUtils . isEmpty ( result ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! CollectionUtils . isEmpty ( screenProjectCategory ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    result . forEach ( r  - >  {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -288,6 +294,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            if  ( r . getOrgId ( ) . equals ( pc . getOrgId ( ) )  & &  r . getCategoryCode ( ) . equals ( pc . getCategoryCode ( ) ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                pc . setStatus ( true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                r . setProjectTotal ( r . getProjectTotal ( )  +  pc . getProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                r . setClosedProjectTotal ( r . getClosedProjectTotal ( )  +  pc . getClosedProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        } ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    } ) ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -390,6 +397,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            // 组织ID 和 分类标签code一样时,项目数累加
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            if  ( agency . getOrgId ( ) . equals ( grid . getOrgId ( ) )  & &  agency . getCategoryCode ( ) . equals ( grid . getCategoryCode ( ) ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                agency . setProjectTotal ( agency . getProjectTotal ( )  +  grid . getProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                agency . setClosedProjectTotal ( agency . getClosedProjectTotal ( )  +  grid . getClosedProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                grid . setStatus ( true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        } ) ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -417,13 +425,23 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                // 父客户存在的分类
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                List < CategoryProjectResultDTO >  categoryProjectExists  =  baseDao . selectOrgCategoryMoreCustomerInfo ( customerIds ,  dateId ,  level ,  customerId ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                log . info ( "父客户存在的分类{}" +  JSON . toJSONString ( categoryProjectExists ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                // 父客户存在的分类 已结案的项目数
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                List < ClosedProjectTotalResultDTO >  closedProjectTotalExist  =  baseDao . selectClosedProjectTotal ( customerIds ,  dateId ,  true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                // 父客户不存在的分类
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                List < CategoryProjectResultDTO >  categoryProjectNotExists  =  baseDao . selectOrgCategoryMoreCustomerInfoNotExists ( customerIds ,  dateId ,  level ,  customerId ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                log . info ( "父客户不存在的分类{}" +  JSON . toJSONString ( categoryProjectNotExists ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                // 父客户 不存在 的分类 已结案的项目数
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                List < ClosedProjectTotalResultDTO >  closedProjectTotalNotExist  =  baseDao . selectClosedProjectTotal ( customerIds ,  dateId ,  false ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! CollectionUtils . isEmpty ( categoryProjectExists ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( ! CollectionUtils . isEmpty ( closedProjectTotalExist ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        categoryProjectExists . forEach ( l  - >  closedProjectTotalExist . stream ( ) . filter ( c  - >  l . getOrgId ( ) . equals ( c . getOrgId ( ) )  & &  l . getCategoryCode ( ) . equals ( c . getCategoryCode ( ) ) ) . forEach ( c  - >  l . setClosedProjectTotal ( c . getClosedProjectTotal ( ) ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    sonCustomerList . addAll ( categoryProjectExists ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! CollectionUtils . isEmpty ( categoryProjectNotExists ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( ! CollectionUtils . isEmpty ( closedProjectTotalNotExist ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        categoryProjectNotExists . forEach ( l  - >  closedProjectTotalNotExist . stream ( ) . filter ( c  - >  l . getOrgId ( ) . equals ( c . getOrgId ( ) )  & &  l . getCategoryCode ( ) . equals ( c . getCategoryCode ( ) ) ) . forEach ( c  - >  l . setClosedProjectTotal ( c . getClosedProjectTotal ( ) ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    sonCustomerList . addAll ( categoryProjectNotExists ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! CollectionUtils . isEmpty ( sonCustomerList ) ) {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -443,6 +461,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        categoryProjectExists . forEach ( c  - >  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            if  ( f . getCategoryCode ( ) . equals ( c . getCategoryCode ( ) ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                f . setProjectTotal ( f . getProjectTotal ( )  +  c . getProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                f . setClosedProjectTotal ( f . getClosedProjectTotal ( )  +  c . getClosedProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                c . setStatus ( true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        } ) ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -481,6 +500,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setCategoryCode ( code ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setOrgId ( entity . getAgencyId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setProjectTotal ( CollectionUtils . isEmpty ( list2 )  ?  NumConstant . ZERO  :  list2 . stream ( ) . collect ( Collectors . summingInt ( CategoryProjectResultDTO : : getProjectTotal ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setClosedProjectTotal ( CollectionUtils . isEmpty ( list2 )  ?  NumConstant . ZERO  :  list2 . stream ( ) . collect ( Collectors . summingInt ( CategoryProjectResultDTO : : getClosedProjectTotal ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setPid ( entity . getPid ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            e . setPids ( StringUtils . isEmpty ( entity . getPids ( ) )  ?  NumConstant . ZERO_STR  :  entity . getPids ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            // 因为根据categoryCode分组,所以level都一样,取第一条的
  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -496,7 +516,11 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        List < CustomerAgencyInfoResultDTO >  levelAgencyInfo  =  groupByLevel . get ( level ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        if  ( ! CollectionUtils . isEmpty ( levelAgencyInfo ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            // 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  screenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds ,  customerId , NumConstant . TWO ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  screenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds ,  customerId , NumConstant . TWO , "all" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < ScreenProjectCategoryGridDailyDTO >  closedScreenProjectCategory  =  factOriginProjectCategoryDailyService . selectListProjectCategoryByOrg ( orgIds ,  customerId , NumConstant . TWO , "closed" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( ! CollectionUtils . isEmpty ( closedScreenProjectCategory ) ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                screenProjectCategory . forEach ( l  - >  closedScreenProjectCategory . stream ( ) . filter ( c  - >  l . getGridId ( ) . equals ( c . getGridId ( ) )  & &  l . getCategoryCode ( ) . equals ( c . getCategoryCode ( ) ) ) . forEach ( c  - >  l . setClosedProjectTotal ( c . getClosedProjectTotal ( ) ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            log . info ( "直接立项的统计:" + screenProjectCategory ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( ! CollectionUtils . isEmpty ( result ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! CollectionUtils . isEmpty ( screenProjectCategory ) )  {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -505,6 +529,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            if  ( r . getOrgId ( ) . equals ( pc . getOrgId ( ) )  & &  r . getCategoryCode ( ) . equals ( pc . getCategoryCode ( ) ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                pc . setStatus ( true ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                r . setProjectTotal ( r . getProjectTotal ( )  +  pc . getProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                                r . setClosedProjectTotal ( r . getClosedProjectTotal ( )  +  pc . getClosedProjectTotal ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        } ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    } ) ;