| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -19,6 +19,7 @@ package com.epmet.service.impl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.common.token.util.UserUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -33,6 +34,7 @@ import com.epmet.constant.UserRoleConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.UserResiInfoDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.UserWechatDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.UserResiInfoDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.UserResiRegisterVisitDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.UserRoleDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.IssueInitiatorResultDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -164,8 +166,8 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							}*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//2:再次判断手机号是否可用
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//2:再次判断手机号是否在客户下可用
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//手机号验证失败则更新行为记录表数据 返回前台结果
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								userResiRegisterVisitService.updateResiRegisterVisit(false, userResiInfoDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -221,15 +223,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//1:更新居民注册访问记录表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//2:判断手机号是否可用
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//2020-07-29 根据要注册的网格获取客户Id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							UserResiRegisterVisitDTO registerVisitDTO = userResiRegisterVisitService.get(verificationCodeFormDTO.getResiVisitId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile(), registerVisitDTO.getCustomerId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//3:调用短信服务 生成验证码发送短信
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result<SendVerificationCodeResultDTO> result = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if(!result.success()||null==result.getData()||StringUtils.isBlank(result.getData().getCode())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getCode())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//4:删除缓存中可能存在的旧验证码
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -244,7 +248,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Result result = new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							//判断手机号是否可用
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (getResiInfoByMobile(userResiInfoDTO.getRegMobile())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (getResiInfoByMobile(userResiInfoDTO.getRegMobile(), userResiInfoDTO.getCustomerId())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//数据存入居民注册表
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								saveUserResiInfo(userResiInfoDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//居民注册关系表新增数据 首次注册数加一 注册数加一 参与数加一
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -280,12 +284,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * 判断手机号是否可用-根据手机号查询居民注册信息(user_resi_info)表数据 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param mobile | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @param customerId | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * @Author sun | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private Boolean getResiInfoByMobile(String mobile) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private Boolean getResiInfoByMobile(String mobile, String customerId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (StringUtils.isBlank(customerId)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								customerId = UserUtil.getCurrentUser().getCustomerId(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								log.info("getResiInfoByMobile UserUtil.getCustomerId:{}", customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							Boolean bl = true; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							List<UserResiInfoDTO> list = userResiInfoDao.selectResiInfoByMobile(mobile, customerId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (list.size() > 0) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								bl = false; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |