|
@@ -4,8 +4,8 @@ package com.hfln.portal.infrastructure.gateway.impl;
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
import cn.dev33.satoken.session.SaSession;
|
|
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
-import cn.hfln.framework.common.redis.service.RedisService;
|
|
|
|
|
import cn.hfln.framework.extension.BizException;
|
|
import cn.hfln.framework.extension.BizException;
|
|
|
|
|
+import cn.hfln.framework.redis.util.RedisUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -67,7 +67,7 @@ public class UserGatewayImpl implements UserGateway {
|
|
|
private RestTemplate restTemplate;
|
|
private RestTemplate restTemplate;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private RedisService redisService;
|
|
|
|
|
|
|
+ private RedisUtil redisService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private UserService userService;
|
|
private UserService userService;
|
|
@@ -209,7 +209,7 @@ public class UserGatewayImpl implements UserGateway {
|
|
|
String redisKey = RedisCacheConstant.SMS_SIGNUP_CODE + request.getPhone();
|
|
String redisKey = RedisCacheConstant.SMS_SIGNUP_CODE + request.getPhone();
|
|
|
log.info("验证注册验证码:手机号={}, 输入验证码={}, Redis key={}", request.getPhone(), request.getCode(), redisKey);
|
|
log.info("验证注册验证码:手机号={}, 输入验证码={}, Redis key={}", request.getPhone(), request.getCode(), redisKey);
|
|
|
|
|
|
|
|
- Object cacheCodeObj = redisService.getCacheObject(redisKey);
|
|
|
|
|
|
|
+ Object cacheCodeObj = redisService.get(redisKey);
|
|
|
log.info("从Redis获取验证码:key={}, value={}", redisKey, cacheCodeObj);
|
|
log.info("从Redis获取验证码:key={}, value={}", redisKey, cacheCodeObj);
|
|
|
|
|
|
|
|
if (Objects.isNull(cacheCodeObj)) {
|
|
if (Objects.isNull(cacheCodeObj)) {
|
|
@@ -228,7 +228,7 @@ public class UserGatewayImpl implements UserGateway {
|
|
|
throw new BizException(ErrorEnum.USER_ALREADY_EXISTS.getErrorCode(), ErrorEnum.USER_ALREADY_EXISTS.getErrorMessage());
|
|
throw new BizException(ErrorEnum.USER_ALREADY_EXISTS.getErrorCode(), ErrorEnum.USER_ALREADY_EXISTS.getErrorMessage());
|
|
|
}
|
|
}
|
|
|
// 验证通过 清除验证码入库
|
|
// 验证通过 清除验证码入库
|
|
|
- redisService.deleteObject(redisKey);
|
|
|
|
|
|
|
+ redisService.del(redisKey);
|
|
|
UserInfo user = new UserInfo();
|
|
UserInfo user = new UserInfo();
|
|
|
user.setPhone(request.getPhone());
|
|
user.setPhone(request.getPhone());
|
|
|
String encryptedPassword = PasswordUtil.encrypt(request.getPassword());
|
|
String encryptedPassword = PasswordUtil.encrypt(request.getPassword());
|
|
@@ -266,7 +266,7 @@ public class UserGatewayImpl implements UserGateway {
|
|
|
String redisKey = RedisCacheConstant.SMS_LOGIN_CODE + phone;
|
|
String redisKey = RedisCacheConstant.SMS_LOGIN_CODE + phone;
|
|
|
log.info("验证登录验证码:手机号={}, 输入验证码={}, Redis key={}", phone, request.getSmsCode(), redisKey);
|
|
log.info("验证登录验证码:手机号={}, 输入验证码={}, Redis key={}", phone, request.getSmsCode(), redisKey);
|
|
|
|
|
|
|
|
- Object cacheSmsCodeObj = redisService.getCacheObject(redisKey);
|
|
|
|
|
|
|
+ Object cacheSmsCodeObj = redisService.get(redisKey);
|
|
|
log.info("从Redis获取登录验证码:key={}, value={}", redisKey, cacheSmsCodeObj);
|
|
log.info("从Redis获取登录验证码:key={}, value={}", redisKey, cacheSmsCodeObj);
|
|
|
|
|
|
|
|
if (Objects.isNull(cacheSmsCodeObj)) {
|
|
if (Objects.isNull(cacheSmsCodeObj)) {
|
|
@@ -280,7 +280,7 @@ public class UserGatewayImpl implements UserGateway {
|
|
|
log.warn("登录验证码错误:手机号={}, 输入={}, 缓存={}", phone, request.getSmsCode(), cacheSmsCode);
|
|
log.warn("登录验证码错误:手机号={}, 输入={}, 缓存={}", phone, request.getSmsCode(), cacheSmsCode);
|
|
|
throw new BizException(ErrorEnum.SMS_CODE_ERROR.getErrorCode(), ErrorEnum.SMS_CODE_ERROR.getErrorMessage());
|
|
throw new BizException(ErrorEnum.SMS_CODE_ERROR.getErrorCode(), ErrorEnum.SMS_CODE_ERROR.getErrorMessage());
|
|
|
}
|
|
}
|
|
|
- redisService.deleteObject(redisKey);
|
|
|
|
|
|
|
+ redisService.del(redisKey);
|
|
|
}
|
|
}
|
|
|
BeanUtils.copyProperties(user, userDto);
|
|
BeanUtils.copyProperties(user, userDto);
|
|
|
userDto.setUserId(user.getUserId()
|
|
userDto.setUserId(user.getUserId()
|