| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -5,6 +5,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.StrConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.enums.RelationshipEnum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -12,22 +13,24 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.redis.common.bean.GridInfoCache; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.IcResiCollectDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.IcResiMemberDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.IcResiUserDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.IcNeighborHoodDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.CollectHouseInfoResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.CollectListResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.IcHouseInfoCollectResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.CollectPageListDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.LatestCollectResDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.IcResiCollectEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.IcResiMemberEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.IcResiUserEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.entity.IcUserChangeRecordEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.GovOrgFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.GovOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.IcResiCollectService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.service.IcUserChangeRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageHelper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.github.pagehelper.PageInfo; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.apache.commons.collections4.CollectionUtils; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -55,10 +58,20 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GovOrgOpenFeignClient govOrgOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcResiMemberDao icResiMemberDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcResiUserDao icResiUserDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcResiCollectDao icResiCollectDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private GovOrgFeignClient govOrgFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetUserOpenFeignClient epmetUserOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcUserChangeRecordService icUserChangeRecordService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void save(IcResiCollectFormDTO formDTO) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -321,48 +334,236 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void collectCheck(IcResiCollectCheckFormDTO formDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void collectCheck(IcResiCollectCheckFormDTO formDTO, TokenDto tokenDto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if("1".equals(formDTO.getCheckState())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 未通过
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcResiCollectEntity entity = ConvertUtils.sourceToTarget(formDTO, IcResiCollectEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            baseDao.updateById(entity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<ResiUserBaseInfoResultDTO> userResult = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!userResult.success()){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new EpmetException("查询用户信息失败..."); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        formDTO.setRealName(userResult.getData().getRealName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 通过
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 获取登记表信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcResiCollectEntity icResiCollectEntity = baseDao.selectById(formDTO.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // fegin获取房屋信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getBuildingUnitId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 获取登记的成员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcResiCollectMemDetailDTO> memberList = icResiMemberDao.selectListByCollectId(formDTO.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if("1".equals(formDTO.getAddFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 新增房屋 ( todo 需要collect更新上房屋ID)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 更新审核信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icResiCollectEntity.setCheckState(formDTO.getCheckState()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icResiCollectEntity.setCheckReason(formDTO.getCheckReason()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.updateById(icResiCollectEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 审核通过
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if("2".equals(formDTO.getCheckState())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if("1".equals(formDTO.getAddFlag())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 新增房屋(新增房屋操作已在审核接口之前,前端调用新增接口实现)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 更新登记表房屋ID
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                icResiCollectEntity = updateHomeId(icResiCollectEntity,formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for(int i = 0 ; i < memberList.size() ; i++){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 根据身份证号和房屋ID获取人员信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(memberList.get(i).getIdNum(),icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Map<String, IcResiUserEntity> userMap = queryOriginUserByHomeId(icResiCollectEntity.getHomeId(),icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if(userIdCardEntity != null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 已存在人员 人员房屋不一致(更新人员信息和变更记录)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 不存在人员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        insertUserInfo(icResiCollectEntity,memberList.get(i),formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 更新房屋
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                collectHouseFormDTO.setId(formDTO.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                collectHouseFormDTO.setOwnerName(formDTO.getOwnerName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                collectHouseFormDTO.setRentFlag(formDTO.getRentFlag()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                govOrgFeignClient.updateCollect(collectHouseFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                updateHouseInfo(icResiCollectEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for(int i = 0 ; i < memberList.size() ; i++){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 根据身份证号和房屋ID获取人员信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    IcResiUserEntity userIdCardEntity = queryOriginUserByIdCard(memberList.get(i).getIdNum(),icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Map<String, IcResiUserEntity> userMap = queryOriginUserByHomeId(icResiCollectEntity.getHomeId(),icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if(userIdCardEntity != null){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 已存在人员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if(userMap.containsKey(memberList.get(i).getIdNum())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            // 人员房屋一致(只更新人员信息)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            updateUserInfo(icResiCollectEntity,memberList.get(i),false,formDTO,userIdCardEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            // 人员房屋不一致(更新人员信息和变更记录)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            updateUserInfo(icResiCollectEntity,memberList.get(i),true,formDTO,userIdCardEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        // 不存在人员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        insertUserInfo(icResiCollectEntity,memberList.get(i),formDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 更新登记表房屋ID | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param icResiCollectEntity | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcResiCollectEntity updateHomeId(IcResiCollectEntity icResiCollectEntity,IcResiCollectCheckFormDTO formDTO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // fegin获取房屋信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GetHouseInfoToCollectFormDTO getHouseInfoToCollectFormDTO = new GetHouseInfoToCollectFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        getHouseInfoToCollectFormDTO.setBuildingUnitId(formDTO.getBuildingUnitId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        getHouseInfoToCollectFormDTO.setDoorName(formDTO.getDoorName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<IcHouseInfoCollectResultDTO> resultDTOResult = govOrgFeignClient.getHouseInfoToCollect(getHouseInfoToCollectFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcHouseInfoCollectResultDTO icHouseInfoCollectResultDTO = resultDTOResult.getData(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 获取登记的成员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 新增房屋后需要collect更新上房屋ID
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icResiCollectEntity.setHomeId(icHouseInfoCollectResultDTO.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.updateById(icResiCollectEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return icResiCollectEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 更新房屋信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param icResiCollectEntity | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void updateHouseInfo(IcResiCollectEntity icResiCollectEntity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        CollectHouseFormDTO collectHouseFormDTO = new CollectHouseFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collectHouseFormDTO.setId(icResiCollectEntity.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collectHouseFormDTO.setOwnerName(icResiCollectEntity.getHouseHolderName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collectHouseFormDTO.setRentFlag(Integer.parseInt(icResiCollectEntity.getHouseType())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collectHouseFormDTO.setCustomerId(icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        collectHouseFormDTO.setResiNumber(icResiCollectEntity.getTotalResi()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        govOrgFeignClient.updateCollect(collectHouseFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 更新人员信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param icResiCollectEntity 登记信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param icResiCollectMemDetailDTO 登记城阳信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param isUpdateLog 是否更新记录 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO 入参 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param userEntity 根据身份证号查询到的user信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void updateUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,Boolean isUpdateLog, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                                IcResiCollectCheckFormDTO formDTO,IcResiUserEntity userEntity){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcResiUserEntity> entityList = icResiUserDao.selectList(wrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isNotEmpty(entityList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String errorMsg = "房屋下已存在户主"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setPids(icResiCollectEntity.getPids()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setGridId(icResiCollectEntity.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setVillageId(icResiCollectEntity.getVillageId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setBuildId(icResiCollectEntity.getBuildId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setUnitId(icResiCollectEntity.getUnitId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setHomeId(icResiCollectEntity.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setName(icResiCollectMemDetailDTO.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icResiUserDao.updateById(userEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 判断是否需要更新记录
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if(isUpdateLog){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //变更记录表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setOperatorId(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setIcUserId(userEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setOperatorName(formDTO.getRealName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setIcUserName(userEntity.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setType("update"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setTypeName("修改"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setBeforeChangeName("-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setAfterChangeName("-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            changeRecordEntity.setChangeTime(new java.util.Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            icUserChangeRecordService.insert(changeRecordEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 新增人员信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param icResiCollectMemDetailDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void insertUserInfo(IcResiCollectEntity icResiCollectEntity,IcResiCollectMemDetailDTO icResiCollectMemDetailDTO,IcResiCollectCheckFormDTO formDTO){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 这个房屋下已经设置了户主后,再次选择户主时提示提示“房屋下已存在户主” PS.户主指与户主关系是本人的用户
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (RelationshipEnum.SELF.getCode().equals(icResiCollectMemDetailDTO.getRelationship())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcResiUserEntity::getHomeId, icResiCollectEntity.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcResiUserEntity::getYhzgx, RelationshipEnum.SELF.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcResiUserEntity> entityList = icResiUserDao.selectList(wrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isNotEmpty(entityList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String errorMsg = "房屋下已存在户主"; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                throw new EpmetException(EpmetErrorCode.ORG_ADD_FAILED.getCode(), errorMsg, errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // 新增人员
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcResiUserEntity userEntity = new IcResiUserEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setPids(icResiCollectEntity.getPids()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setAgencyId(icResiCollectEntity.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setGridId(icResiCollectEntity.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setVillageId(icResiCollectEntity.getVillageId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setBuildId(icResiCollectEntity.getBuildId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setUnitId(icResiCollectEntity.getUnitId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setHomeId(icResiCollectEntity.getHomeId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setName(icResiCollectMemDetailDTO.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setMobile(icResiCollectMemDetailDTO.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setIdCard(icResiCollectMemDetailDTO.getIdNum()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setYhzgx(icResiCollectMemDetailDTO.getRelationship()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setGzdw(icResiCollectMemDetailDTO.getWorkPlace()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userEntity.setRemarks(icResiCollectMemDetailDTO.getRemark()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icResiUserDao.updateById(userEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //变更记录表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setCustomerId(icResiCollectEntity.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setOperatorId(formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setIcUserId(userEntity.getId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setOperatorName(formDTO.getRealName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setIcUserName(userEntity.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setType("add"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setTypeName("新增"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setBeforeChangeName("-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setAfterChangeName("-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        changeRecordEntity.setChangeTime(new java.util.Date()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        icUserChangeRecordService.insert(changeRecordEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 获取人员信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param idCard | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcResiUserEntity queryOriginUserByIdCard(String idCard,String customerId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        query.eq(IcResiUserEntity::getIdCard, idCard); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        query.eq(IcResiUserEntity::getCustomerId, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        IcResiUserEntity originUser = icResiUserDao.selectOne(query); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return originUser; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private Map<String, IcResiUserEntity> queryOriginUserByHomeId(String homeId,String customerId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        query.eq(IcResiUserEntity::getHomeId, homeId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        query.eq(IcResiUserEntity::getCustomerId, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        List<IcResiUserEntity> originUserList = icResiUserDao.selectList(query); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, IcResiUserEntity> memMap = originUserList.stream().collect(Collectors.toMap(IcResiUserEntity::getIdCard, Function.identity())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return memMap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |