@ -52,7 +52,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					    private  IcResiUserDao  icResiUserDao ;  
					 
					 
					    private  IcResiUserDao  icResiUserDao ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    @Override  
					 
					 
					    @Override  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    public  List < IcStatsResiWarnBuildingResultDTO >  buildingwWarnList ( String  agencyID )  {  
					 
					 
					    public  List < IcStatsResiWarnBuildingResultDTO >  buildingwWarnList ( String  customerId , String  agencyID )  {  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					        List < IcStatsResiWarnBuildingResultDTO >  result  =  new  ArrayList < > ( ) ;  
					 
					 
					        List < IcStatsResiWarnBuildingResultDTO >  result  =  new  ArrayList < > ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        //feign获取当前需要预警的配置信息以及阈值
  
					 
					 
					        //feign获取当前需要预警的配置信息以及阈值
  
				
			 
			
		
	
		
		
			
				
					 
					 
					        Result < List < IcResiCategoryWarnConfigDTO > >  warnResult  =  operCustomizeOpenFeignClient . resiCategoryWarnList ( ) ;  
					 
					 
					        Result < List < IcResiCategoryWarnConfigDTO > >  warnResult  =  operCustomizeOpenFeignClient . resiCategoryWarnList ( ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -81,7 +81,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					            return  resiWarnBuildingResultDTO ;  
					 
					 
					            return  resiWarnBuildingResultDTO ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ) . collect ( Collectors . toList ( ) ) ;  
					 
					 
					        } ) . collect ( Collectors . toList ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        //统计数量
  
					 
					 
					        //统计数量
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					        List < IcStatsResiWarnEntity >  icStatsResiWarnEntityList  =   icStatsResiWarnDao . selectResiWarnByAgencyId ( agencyID ) ;  
					 
					 
					        List < IcStatsResiWarnEntity >  icStatsResiWarnEntityList  =   icStatsResiWarnDao . selectResiWarnByAgencyId ( customerId , agencyID ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					        if ( CollectionUtils . isEmpty ( icStatsResiWarnEntityList  ) ) {  
					 
					 
					        if ( CollectionUtils . isEmpty ( icStatsResiWarnEntityList  ) ) {  
				
			 
			
		
	
		
		
			
				
					 
					 
					            return  result ;  
					 
					 
					            return  result ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        }  
					 
					 
					        }  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -115,7 +115,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					    }  
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    @Override  
					 
					 
					    @Override  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    public  List < IcStatsResiWarnUserResultDTO >  userWarnList ( String  configId ,  List < String >  buildingIdList )  {  
					 
					 
					    public  List < IcStatsResiWarnUserResultDTO >  userWarnList ( String  customerId , String  c onfigId ,  List < String >  buildingIdList )  {  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					        //feign根据buildingIdList 获取网格,小区,楼宇 信息
  
					 
					 
					        //feign根据buildingIdList 获取网格,小区,楼宇 信息
  
				
			 
			
		
	
		
		
			
				
					 
					 
					        Result < List < BuildingResultDTO > >  buildingList  =  govOrgOpenFeignClient . buildingListByIds ( buildingIdList ) ;  
					 
					 
					        Result < List < BuildingResultDTO > >  buildingList  =  govOrgOpenFeignClient . buildingListByIds ( buildingIdList ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        if  ( ! buildingList . success ( )  | |  null  = =  buildingList . getData ( ) )  {  
					 
					 
					        if  ( ! buildingList . success ( )  | |  null  = =  buildingList . getData ( ) )  {  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -137,7 +137,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					        IcResiCategoryWarnConfigDTO  icResiCategoryWarnConfigDTO  =  warnResult . getData ( ) ;  
					 
					 
					        IcResiCategoryWarnConfigDTO  icResiCategoryWarnConfigDTO  =  warnResult . getData ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					        //根据buildingID,tableName he columnName获取名字
  
					 
					 
					        //根据buildingID,tableName he columnName获取名字
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					        List < Map < String ,  String > >  maps  =  icStatsResiWarnDao . userWarnList ( buildingIdList ,  icResiCategoryWarnConfigDTO . getTableName ( ) ,  icResiCategoryWarnConfigDTO . getColumnName ( ) ) ;  
					 
					 
					        List < Map < String ,  String > >  maps  =  icStatsResiWarnDao . userWarnList ( customerId , buildingIdList ,  icResiCategoryWarnConfigDTO . getTableName ( ) ,  icResiCategoryWarnConfigDTO . getColumnName ( ) ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					        result . forEach ( item - > {  
					 
					 
					        result . forEach ( item - > {  
				
			 
			
		
	
		
		
			
				
					 
					 
					            item . setConfigId ( configId ) ;  
					 
					 
					            item . setConfigId ( configId ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            List < Map < String ,  String > >  buildingIds  =  maps . stream ( ) . filter ( map  - >  item . getBuildingId ( ) . equals ( map . get ( "buildingId" ) ) ) . collect ( Collectors . toList ( ) ) ;  
					 
					 
					            List < Map < String ,  String > >  buildingIds  =  maps . stream ( ) . filter ( map  - >  item . getBuildingId ( ) . equals ( map . get ( "buildingId" ) ) ) . collect ( Collectors . toList ( ) ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -147,7 +147,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					    }  
					 
					 
					    }  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					    @Override  
					 
					 
					    @Override  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					    public  List < IcStatsResiResultDTO >  list ( String  id ,  String  level )  {  
					 
					 
					    public  List < IcStatsResiResultDTO >  list ( String  customerId , String  id ,  String  level )  {  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					        //获取所有配置类项 getshow
  
					 
					 
					        //获取所有配置类项 getshow
  
				
			 
			
		
	
		
		
			
				
					 
					 
					        Result < List < IcResiCategoryStatsConfigDTO > >  statsResult  =  operCustomizeOpenFeignClient . resiCategoryStatsListShowd ( ) ;  
					 
					 
					        Result < List < IcResiCategoryStatsConfigDTO > >  statsResult  =  operCustomizeOpenFeignClient . resiCategoryStatsListShowd ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        if  ( ! statsResult . success ( )  | |  null  = =  statsResult . getData ( ) )  {  
					 
					 
					        if  ( ! statsResult . success ( )  | |  null  = =  statsResult . getData ( ) )  {  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -164,7 +164,7 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					            resultDTO . setHouseShowIcon ( item . getHouseShowIcon ( ) ) ;  
					 
					 
					            resultDTO . setHouseShowIcon ( item . getHouseShowIcon ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            resultDTO . setManagementIcon ( item . getManagementIcon ( ) ) ;  
					 
					 
					            resultDTO . setManagementIcon ( item . getManagementIcon ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            //根据id ,level 获取count
  
					 
					 
					            //根据id ,level 获取count
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					            Integer  count  =  icStatsResiWarnDao . countListByLevelAndCol ( item . getTableName ( ) , item . getColumnName ( ) , id , level ) ;  
					 
					 
					            Integer  count  =  icStatsResiWarnDao . countListByLevelAndCol ( customerId , item . getTableName ( ) , item . getColumnName ( ) , id , level ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					            resultDTO . setCount ( count ) ;  
					 
					 
					            resultDTO . setCount ( count ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            result . add ( resultDTO ) ;  
					 
					 
					            result . add ( resultDTO ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        } ) ;  
					 
					 
					        } ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -187,10 +187,10 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					        //保存数据
  
					 
					 
					        //保存数据
  
				
			 
			
		
	
		
		
			
				
					 
					 
					        List < IcStatsResiWarnEntity >  icStatsResiWarnEntities  =  new  ArrayList < > ( ) ;  
					 
					 
					        List < IcStatsResiWarnEntity >  icStatsResiWarnEntities  =  new  ArrayList < > ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        for  ( IcResiCategoryWarnConfigDTO  item  :  icResiCategoryWarnConfigDTOList )  {  
					 
					 
					        for  ( IcResiCategoryWarnConfigDTO  item  :  icResiCategoryWarnConfigDTOList )  {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					            icStatsResiWarnDao . delete ( new  QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( ) . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) ) ) ;  
					 
					 
					            icStatsResiWarnDao . delete ( new  QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( ) . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) ) . eq ( IcStatsResiWarnEntity : : getCustomerId , customerId ) ) ;  
				
			 
			
				
				
			
		
	
		
		
			
				
					 
					 
					            List < IcStatsResiWarnEntity >  maps  =  icStatsResiWarnDao . resiWarn ( item . getTableName ( ) ,  item . getColumnName ( ) ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            List < IcStatsResiWarnEntity >  maps  =  icStatsResiWarnDao . resiWarn ( customerId , item . getTableName ( ) ,  item . getColumnName ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            if ( CollectionUtils . isEmpty ( maps ) ) {  
					 
					 
					            if ( CollectionUtils . isEmpty ( maps ) ) {  
				
			 
			
		
	
		
		
			
				
					 
					 
					                continue ;  
					 
					 
					                continue ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            }  
					 
					 
					            }  
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					@ -226,6 +226,11 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					        if ( null  = =  icResiUserEntity ) {  
					 
					 
					        if ( null  = =  icResiUserEntity ) {  
				
			 
			
		
	
		
		
			
				
					 
					 
					            return   ;  
					 
					 
					            return   ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					        }  
					 
					 
					        }  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        IcStatsResiWarnEntity  query  =  new  IcStatsResiWarnEntity ( ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        query . setAgencyId ( icResiUserEntity . getAgencyId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        query . setGridId ( icResiUserEntity . getGridId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        query . setNeighborHoodId ( icResiUserEntity . getVillageId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					        query . setBuildingId ( icResiUserEntity . getBuildId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					        //保存数据
  
					 
					 
					        //保存数据
  
				
			 
			
		
	
		
		
			
				
					 
					 
					        for  ( IcResiCategoryWarnConfigDTO  item  :  icResiCategoryWarnConfigDTOList )  {  
					 
					 
					        for  ( IcResiCategoryWarnConfigDTO  item  :  icResiCategoryWarnConfigDTOList )  {  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -233,11 +238,13 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					
 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					            IcStatsResiWarnEntity  icStatsResiWarn  =  icStatsResiWarnDao . selectOne ( new  QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( )  
					 
					 
					            IcStatsResiWarnEntity  icStatsResiWarn  =  icStatsResiWarnDao . selectOne ( new  QueryWrapper < IcStatsResiWarnEntity > ( ) . lambda ( )  
				
			 
			
		
	
		
		
			
				
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) )  
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getConfigId , item . getId ( ) )  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getCustomerId , customerId )  
				
			 
			
		
	
		
		
			
				
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getAgencyId ,  icResiUserEntity . getAgencyId ( ) )  
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getAgencyId ,  icResiUserEntity . getAgencyId ( ) )  
				
			 
			
		
	
		
		
			
				
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getGridId ,  icResiUserEntity . getGridId ( ) )  
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getGridId ,  icResiUserEntity . getGridId ( ) )  
				
			 
			
		
	
		
		
			
				
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getNeighborHoodId ,  icResiUserEntity . getVillageId ( ) )  
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getNeighborHoodId ,  icResiUserEntity . getVillageId ( ) )  
				
			 
			
		
	
		
		
			
				
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getBuildingId ,  icResiUserEntity . getBuildId ( ) ) ) ;  
					 
					 
					                    . eq ( IcStatsResiWarnEntity : : getBuildingId ,  icResiUserEntity . getBuildId ( ) ) ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					
 
					 
					 
					            //统计数量
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					            IcStatsResiWarnEntity  resiWarnEntity  =  icStatsResiWarnDao . resiWarnById ( customerId , item . getTableName ( ) ,  item . getColumnName ( ) , query ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            if ( null  = =  icStatsResiWarn ) {  
					 
					 
					            if ( null  = =  icStatsResiWarn ) {  
				
			 
			
		
	
		
		
			
				
					 
					 
					                //如果不存在,新增统计数量
  
					 
					 
					                //如果不存在,新增统计数量
  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn  =  new  IcStatsResiWarnEntity ( ) ;  
					 
					 
					                icStatsResiWarn  =  new  IcStatsResiWarnEntity ( ) ;  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					@ -248,18 +255,23 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { 
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn . setBuildingId ( icResiUserEntity . getBuildId ( ) ) ;  
					 
					 
					                icStatsResiWarn . setBuildingId ( icResiUserEntity . getBuildId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn . setConfigId ( item . getId ( ) ) ;  
					 
					 
					                icStatsResiWarn . setConfigId ( item . getId ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn . setCustomerId ( customerId ) ;  
					 
					 
					                icStatsResiWarn . setCustomerId ( customerId ) ;  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					                IcStatsResiWarnEntity  resiWarnEntity  =  icStatsResiWarnDao . resiWarnById ( item . getTableName ( ) ,  item . getColumnName ( ) , icStatsResiWarn ) ;   
					 
					 
					
  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					                if ( null  = =  resiWarnEntity ) {  
					 
					 
					                if ( null  = =  resiWarnEntity ) {  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					                    continue ;  
					 
					 
					                    icStatsResiWarn . setCount ( 0 ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                } else {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					                }  
					 
					 
					                }  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;  
					 
					 
					 
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarnDao . insert ( icStatsResiWarn ) ;  
					 
					 
					                icStatsResiWarnDao . insert ( icStatsResiWarn ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					            } else {  
					 
					 
					            } else {  
				
			 
			
		
	
		
		
			
				
					 
					 
					                //如果存在,更新统计数量
  
					 
					 
					                //如果存在,更新统计数量
  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					                IcStatsResiWarnEntity  resiWarnEntity  =  icStatsResiWarnDao . resiWarnById ( item . getTableName ( ) ,  item . getColumnName ( ) , icStatsResiWarn ) ;  
					 
					 
					                if ( null  = =  resiWarnEntity ) {  
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					                icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;  
					 
					 
					                    icStatsResiWarn . setCount ( 0 ) ;  
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                } else {  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                    icStatsResiWarn . setCount ( resiWarnEntity . getCount ( ) ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					                }  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarn . setCustomerId ( customerId ) ;  
					 
					 
					                icStatsResiWarn . setCustomerId ( customerId ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					                icStatsResiWarnDao . updateById ( icStatsResiWarn ) ;  
					 
					 
					                icStatsResiWarnDao . updateById ( icStatsResiWarn ) ;  
				
			 
			
		
	
		
		
			
				
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					 
					 
					            }  
					 
					 
					            }