| 
						
						
							
								
							
						
						
					 | 
					@ -124,29 +124,35 @@ public class LoginServiceImpl implements LoginService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 * @since 2020/3/14 19:34 | 
					 | 
					 | 
						 * @since 2020/3/14 19:34 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 */ | 
					 | 
					 | 
						 */ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						private String getUserId(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) { | 
					 | 
					 | 
						private String getUserId(LoginByWxCodeFormDTO formDTO, WxMaJscode2SessionResult wxMaJscode2SessionResult) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							WxLoginUserInfoFormDTO wxLoginUserInfoFormDTO=new WxLoginUserInfoFormDTO(); | 
					 | 
					 | 
							WxLoginUserInfoFormDTO wxLoginUserInfoFormDTO = new WxLoginUserInfoFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							wxLoginUserInfoFormDTO.setApp(formDTO.getApp()); | 
					 | 
					 | 
							wxLoginUserInfoFormDTO.setApp(formDTO.getApp()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							wxLoginUserInfoFormDTO.setOpenId(wxMaJscode2SessionResult.getOpenid()); | 
					 | 
					 | 
							wxLoginUserInfoFormDTO.setOpenId(wxMaJscode2SessionResult.getOpenid()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							Result<String> userResult=epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO); | 
					 | 
					 | 
							Result<String> userResult = epmetUserFeignClient.selecWxLoginUserInfo(wxLoginUserInfoFormDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							String userId=""; | 
					 | 
					 | 
							String userId = ""; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							if(!userResult.success()){ | 
					 | 
					 | 
							if (!userResult.success()) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
								throw new RenException("获取用户信息失败"+userResult.getMsg()); | 
					 | 
					 | 
								throw new RenException("获取用户信息失败" + userResult.getMsg()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							userId= (String) userResult.getData(); | 
					 | 
					 | 
							userId = (String) userResult.getData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							if (StringUtils.isBlank(userId)&&LoginConstant.APP_GOV.equals(formDTO.getApp())) { | 
					 | 
					 | 
							if (StringUtils.isBlank(userId) && LoginConstant.APP_GOV.equals(formDTO.getApp())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								//查询customer_staff待完善
 | 
					 | 
					 | 
								//查询customer_staff待完善
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							} else if (StringUtils.isBlank(userId)&&LoginConstant.APP_OPER.equals(formDTO.getApp())) { | 
					 | 
					 | 
							} else if (StringUtils.isBlank(userId) && LoginConstant.APP_OPER.equals(formDTO.getApp())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								//查询oper_user待完善
 | 
					 | 
					 | 
								//查询oper_user待完善
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							} else if (StringUtils.isBlank(userId)&&LoginConstant.APP_RESI.equals(formDTO.getApp())) { | 
					 | 
					 | 
							} else if (StringUtils.isBlank(userId) && LoginConstant.APP_RESI.equals(formDTO.getApp())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								//查询customer_user
 | 
					 | 
					 | 
								//查询customer_user
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								CustomerUserDTO customerUserDTO = new CustomerUserDTO(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								if (StringUtils.isNotBlank(formDTO.getIv()) && StringUtils.isNotBlank(formDTO.getEncryptedData())) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
									WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService() | 
					 | 
					 | 
									WxMaUserInfo wxMaUserInfo = wxMaServiceUtils.resiWxMaService().getUserService() | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
											.getUserInfo(wxMaJscode2SessionResult.getSessionKey(), | 
					 | 
					 | 
											.getUserInfo(wxMaJscode2SessionResult.getSessionKey(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
													formDTO.getEncryptedData(), | 
					 | 
					 | 
													formDTO.getEncryptedData(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
													formDTO.getIv()); | 
					 | 
					 | 
													formDTO.getIv()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
								CustomerUserDTO customerUserDTO=this.packageCustomerUserDTO(wxMaUserInfo); | 
					 | 
					 | 
									customerUserDTO = this.packageCustomerUserDTO(wxMaUserInfo); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
								Result<String> saveCustomerUserResult=epmetUserFeignClient.saveCustomerUser(customerUserDTO); | 
					 | 
					 | 
								} else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
								if(!saveCustomerUserResult.success()){ | 
					 | 
					 | 
									customerUserDTO.setWxOpenId(wxMaJscode2SessionResult.getOpenid()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
									throw new RenException("创建用户失败"+userResult.getMsg()); | 
					 | 
					 | 
									customerUserDTO.setUnionId(wxMaJscode2SessionResult.getUnionid()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								Result<String> saveCustomerUserResult = epmetUserFeignClient.saveCustomerUser(customerUserDTO); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
								if (!saveCustomerUserResult.success()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
									throw new RenException("创建用户失败" + userResult.getMsg()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								} | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
								userId = saveCustomerUserResult.getData(); | 
					 | 
					 | 
								userId = saveCustomerUserResult.getData(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -222,22 +228,22 @@ public class LoginServiceImpl implements LoginService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						public Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO) { | 
					 | 
					 | 
						public Result<UserTokenResultDTO> loginByPassword(LoginByPassWordFormDTO formDTO) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//1、验证码是否正确
 | 
					 | 
					 | 
							//1、验证码是否正确
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); | 
					 | 
					 | 
							boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							if(!flag){ | 
					 | 
					 | 
							if (!flag) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								return new Result<UserTokenResultDTO>().error(ErrorCode.CAPTCHA_ERROR); | 
					 | 
					 | 
								return new Result<UserTokenResultDTO>().error(ErrorCode.CAPTCHA_ERROR); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//2、账号是否存在
 | 
					 | 
					 | 
							//2、账号是否存在
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//获取用户信息
 | 
					 | 
					 | 
							//获取用户信息
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO=new PasswordLoginUserInfoFormDTO(); | 
					 | 
					 | 
							PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO = new PasswordLoginUserInfoFormDTO(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
							passwordLoginUserInfoFormDTO.setApp(formDTO.getApp()); | 
					 | 
					 | 
							passwordLoginUserInfoFormDTO.setApp(formDTO.getApp()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							passwordLoginUserInfoFormDTO.setPhone(formDTO.getPhone()); | 
					 | 
					 | 
							passwordLoginUserInfoFormDTO.setPhone(formDTO.getPhone()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							Result<PasswordLoginUserInfoResultDTO> userInfoResult=epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); | 
					 | 
					 | 
							Result<PasswordLoginUserInfoResultDTO> userInfoResult = epmetUserFeignClient.selectLoginUserInfoByPassword(passwordLoginUserInfoFormDTO); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							logger.info(userInfoResult.getCode()+userInfoResult.getMsg()); | 
					 | 
					 | 
							logger.info(userInfoResult.getCode() + userInfoResult.getMsg()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
							if(!userInfoResult.success()||null==userInfoResult.getData()){ | 
					 | 
					 | 
							if (!userInfoResult.success() || null == userInfoResult.getData()) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								return new Result<UserTokenResultDTO>().error("账号不存在"); | 
					 | 
					 | 
								return new Result<UserTokenResultDTO>().error("账号不存在"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//3、密码是否正确
 | 
					 | 
					 | 
							//3、密码是否正确
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//密码错误
 | 
					 | 
					 | 
							//密码错误
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
							if(!PasswordUtils.matches(formDTO.getPassword(),userInfoResult.getData().getPassWord())){ | 
					 | 
					 | 
							if (!PasswordUtils.matches(formDTO.getPassword(), userInfoResult.getData().getPassWord())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
								throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR); | 
					 | 
					 | 
								throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							} | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							//4、生成token返回,且将TokenDto存到redis
 | 
					 | 
					 | 
							//4、生成token返回,且将TokenDto存到redis
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |