提交 248523a0 编写于 作者: minghao.wu's avatar minghao.wu

fix: 已注册的用户返回登录信息

上级 0cfcd35e
流水线 #49127 已失败 于阶段
...@@ -309,6 +309,7 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -309,6 +309,7 @@ public class RegisterServiceImpl implements RegisterService {
if(StringUtil.isEmpty(mobile)){ if(StringUtil.isEmpty(mobile)){
mobile = ""; mobile = "";
} }
Date currentTime = new Date();
//对注册接口做幂等性处理:注册成功,删除缓存,注册失败提示用户 //对注册接口做幂等性处理:注册成功,删除缓存,注册失败提示用户
String nxKey = Constants.REPEAT_REGISTER_PREFIX + mobile; String nxKey = Constants.REPEAT_REGISTER_PREFIX + mobile;
Long resultNx = redisClient.setnx(nxKey, mobile); Long resultNx = redisClient.setnx(nxKey, mobile);
...@@ -325,7 +326,6 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -325,7 +326,6 @@ public class RegisterServiceImpl implements RegisterService {
//added by joy end //added by joy end
if (accountInfoEntity == null) { if (accountInfoEntity == null) {
redisClient.expire(nxKey, 30); redisClient.expire(nxKey, 30);
Date currentTime = new Date();
int productType = 5; int productType = 5;
int sourceType = 9; int sourceType = 9;
// 默认使用手机号做密码 // 默认使用手机号做密码
...@@ -403,10 +403,24 @@ public class RegisterServiceImpl implements RegisterService { ...@@ -403,10 +403,24 @@ public class RegisterServiceImpl implements RegisterService {
return result; return result;
} else { } else {
logger.info("register-account is exists"); Account account = accountMapper.getByMobilePhone(mobileEncrypt);
intactUtil.sendIntact(batchNo,"register",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"该手机号已注册,请直接登录");
throw new AccountException(AccountExceptionEnum.PICA_ALREADY_REGISTER); Long userId = account.getId();
Account accountToken = new Account();
accountToken.setId(userId);
accountToken.setAcctId(account.getAcctId());
accountToken.setCreatTime(currentTime);
accountToken.setMobilePhone(mobile);
accountToken.setRegisterSource(accountInfoEntity.getRegisterSource());
String newToken = tokenUtils.generateToken(accountToken);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setEntireFlag(1);
result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
result.setMobile(mobile);
result.setAcctId(accountInfoEntity.getId());
return result;
} }
} else { } else {
logger.info("register-nxKey is exists"); logger.info("register-nxKey is exists");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册