@ -2,6 +2,7 @@ package com.epmet.service.impl; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.baomidou.mybatisplus.core.metadata.IPage ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.commons.mybatis.service.impl.BaseServiceImpl ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.commons.tools.constant.FieldConstant ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -18,10 +19,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.commons.tools.redis.common.bean.HouseInfoCache ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.commons.tools.utils.ConvertUtils ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.commons.tools.utils.Result ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.IcResiUserDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.IcVolunteerPolyCategoryDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.IcVolunteerPolyDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.UserBaseInfoDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dao.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.IcVolunteerPolyDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.VolunteerInfoDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.form.* ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -29,10 +27,7 @@ import com.epmet.dto.result.ResiUserBaseInfoResultDTO; 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.result.VolunteerPolyListResultDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.result.VolunteerPolyMapDataResultDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.dto.result.VolunteerPolyPieResultDTO ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.entity.IcResiUserEntity ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.entity.IcVolunteerPolyCategoryEntity ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.entity.IcVolunteerPolyEntity ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.entity.UserBaseInfoEntity ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.entity.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.feign.EpmetHeartOpenFeignClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.feign.OperCustomizeOpenFeignClient ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					import  com.epmet.service.IcVolunteerPolyCategoryService ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -77,6 +72,8 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    private  IcVolunteerPolyCategoryService  icVolunteerPolyCategoryService ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    @Resource  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    private  IcVolunteerPolyCategoryDao  icVolunteerPolyCategoryDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    @Resource  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    private  IcPartyMemberDao  icPartyMemberDao ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    @Override  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    public  PageData < IcVolunteerPolyDTO >  page ( Map < String ,  Object >  params )  {  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -202,10 +199,14 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            log . error ( "志愿者数据抽取-获取小程序志愿者失败" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        List < IcVolunteerPolyDTO >  appVolunteerList  =  result . getData ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        appVolunteerList . forEach ( item  - >  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if ( NumConstant . ONE_STR . equals ( item . getIsParty ( ) )  & &  ( NumConstant . ONE_STR . equals ( item . getIsDyzxh ( ) ) ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                item . setVolunteerCategory ( item . getVolunteerCategory ( ) . concat ( ",dangyuanzhongxinhu" ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        } ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        if  ( CollectionUtils . isNotEmpty ( appVolunteerList ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            //获取居民信息
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < String >  userIds  =  appVolunteerList . stream ( ) . map ( IcVolunteerPolyDTO : : getUserId ) . collect ( Collectors . toList ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            //根据志愿者的userId获取居民信息并转成map
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < UserBaseInfoEntity >  userList  =  new  ArrayList < > ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < List < String > >  partition  =  ListUtils . partition ( userIds ,  NumConstant . FIFTY ) ;  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -301,6 +302,7 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					     * /  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    private  void  icVolunteer ( String  customerId ,  String  userId )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        IcResiUserEntity  icUser  =  icResiUserDao . selectById ( userId ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        boolean  isDyzxh  =  false ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        if  ( null  ! =  icUser )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            //设置wrapper条件
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            List < IcVolunteerPolyDTO >  volunteerList  =  icResiUserDao . getVolunteerList ( customerId ,  userId ) ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -312,6 +314,15 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            categoryWrapper . eq ( IcVolunteerPolyCategoryEntity : : getCustomerId ,  customerId ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            categoryWrapper . eq ( IcVolunteerPolyCategoryEntity : : getIdCard ,  icUser . getIdCard ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            //判断是否党员中心户
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( NumConstant . ONE_STR . equals ( icUser . getIsParty ( ) ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                LambdaUpdateWrapper < IcPartyMemberEntity >  memberWrapper  =  new  LambdaUpdateWrapper < > ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                memberWrapper . eq ( IcPartyMemberEntity : : getIcResiUser ,  icUser . getId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                IcPartyMemberEntity  memberEntity  =  icPartyMemberDao . selectOne ( memberWrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( null  ! =  memberEntity  & &  NumConstant . ONE_STR . equals ( memberEntity . getIsDyzxh ( ) ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    isDyzxh  =  true ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            //判断是否是志愿者
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            if  ( NumConstant . ONE_STR . equals ( icUser . getIsVolunteer ( ) ) )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( CollectionUtils . isNotEmpty ( volunteerList ) )  {  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -325,6 +336,9 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        baseDao . insert ( entity ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    List < String >  categoryList  =  Arrays . asList ( volunteerList . get ( NumConstant . ZERO ) . getVolunteerCategory ( ) . split ( StrConstant . COMMA ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( isDyzxh )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        categoryList . add ( "dangyuanzhongxinhu" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    List < IcVolunteerPolyCategoryEntity >  entityList  =  categoryList . stream ( ) . map ( o  - >  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        IcVolunteerPolyCategoryEntity  category  =  new  IcVolunteerPolyCategoryEntity ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        category . setCustomerId ( entity . getCustomerId ( ) ) ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -340,9 +354,31 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryService . insertBatch ( entityList ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  else  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                //删除志愿者信息
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                baseDao . delete ( wrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                icVolunteerPolyCategoryDao . delete ( categoryWrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                if  ( ! isDyzxh )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    //删除志愿者信息
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    baseDao . delete ( wrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryDao . delete ( categoryWrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  else  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    IcVolunteerPolyEntity  volunteer  =  baseDao . selectOne ( wrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    IcVolunteerPolyEntity  entity  =  ConvertUtils . sourceToTarget ( volunteerList . get ( NumConstant . ZERO ) ,  IcVolunteerPolyEntity . class ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( null  ! =  volunteer )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        entity . setId ( volunteer . getId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        baseDao . updateById ( entity ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  else  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        baseDao . insert ( entity ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    IcVolunteerPolyCategoryEntity  category  =  new  IcVolunteerPolyCategoryEntity ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setCustomerId ( entity . getCustomerId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setIdCard ( entity . getIdCard ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( null  ! =  volunteer )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        category . setLatitude ( volunteer . getLatitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        category . setLongitude ( volunteer . getLongitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setVolunteerCategory ( "dangyuanzhongxinhu" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryDao . delete ( categoryWrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryService . insert ( category ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					            }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					        }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					    }  
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				
					@ -402,15 +438,6 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    baseDao . updateById ( entity ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    IcVolunteerPolyCategoryEntity  category  =  new  IcVolunteerPolyCategoryEntity ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setCustomerId ( entity . getCustomerId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setIdCard ( entity . getIdCard ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setLatitude ( volunteer . getLatitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setLongitude ( volunteer . getLongitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setVolunteerCategory ( "qita" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryDao . delete ( categoryWrapper ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryDao . insert ( category ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                }  else  if  ( null  = =  volunteer )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    if  ( null  ! =  icResiUser )  {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                        entity . setIcResiUser ( icResiUser . getId ( ) ) ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				
					@ -419,8 +446,6 @@ public class IcVolunteerPolyServiceImpl extends BaseServiceImpl<IcVolunteerPolyD 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    IcVolunteerPolyCategoryEntity  category  =  new  IcVolunteerPolyCategoryEntity ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setCustomerId ( entity . getCustomerId ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setIdCard ( entity . getIdCard ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setLatitude ( volunteer . getLatitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setLongitude ( volunteer . getLongitude ( ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    category . setVolunteerCategory ( "qita" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				
					                    icVolunteerPolyCategoryDao . delete ( categoryWrapper ) ;