|
|
@@ -1,5 +1,6 @@
|
|
|
package com.sckw.system.service;
|
|
|
|
|
|
+import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.ApprovalEnum;
|
|
|
@@ -7,6 +8,7 @@ import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
+import com.sckw.redis.constant.RedisConstant;
|
|
|
import com.sckw.redis.utils.RedissonUtils;
|
|
|
import com.sckw.system.api.model.dto.req.RegisterReqDto;
|
|
|
import com.sckw.system.api.model.dto.req.UpdatePasswordReqDto;
|
|
|
@@ -111,6 +113,12 @@ public class KwsUserService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = {})
|
|
|
public RegisterResDto register(RegisterReqDto reqDto) throws SystemException {
|
|
|
+ String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqDto.getPhone());
|
|
|
+ String sms = RedissonUtils.getString(key);
|
|
|
+ if (!reqDto.getCaptcha().equals(sms)) {
|
|
|
+ throw new SystemException(HttpStatus.CODE_10301, HttpStatus.CAPTCHA_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
commonService.checkEntRepeat(reqDto.getEntName(), reqDto.getPhone());
|
|
|
/*1、数据校验*/
|
|
|
checkAccountValid(reqDto.getPhone(), reqDto.getSystemType());
|
|
|
@@ -421,8 +429,8 @@ public class KwsUserService {
|
|
|
KwsUser kwsUser = checkUserBase(reqVo.getAccount(), reqVo.getSystemType());
|
|
|
|
|
|
//从缓存中取出验证码,校验
|
|
|
- String sms = "12345";
|
|
|
-// String sms = RedissonUtils.getString(Global.getForgetKey(reqVo.getSystemType(), reqVo.getAccount()));
|
|
|
+ String key = StringUtils.format(RedisConstant.MESSAGE_SMS_VERIFY_CODE_VALUE_KEY, DictEnum.SMS_REGISTER.getValue(), reqVo.getAccount());
|
|
|
+ String sms = RedissonUtils.getString(key);
|
|
|
if (!reqVo.getCaptcha().equals(sms)) {
|
|
|
throw new SystemException(HttpStatus.CODE_10301, HttpStatus.CAPTCHA_ERROR);
|
|
|
}
|
|
|
@@ -440,7 +448,7 @@ public class KwsUserService {
|
|
|
*/
|
|
|
public KwsUser checkUserBase(String account, int systemType) throws SystemException {
|
|
|
KwsUser kwsUser = getUserByAccount(account, systemType);
|
|
|
- if (Objects.isNull(kwsUser)) {
|
|
|
+ if (Objects.isNull(kwsUser) || kwsUser.getStatus().equals(Global.YES)) {
|
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.ACCOUNT_NOT_EXISTS);
|
|
|
}
|
|
|
return kwsUser;
|
|
|
@@ -552,6 +560,7 @@ public class KwsUserService {
|
|
|
if (kwsUserDao.update(kwsUser) <= 0) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
|
|
|
}
|
|
|
+ RedissonUtils.remove(Global.getFullUserLoginKey(kwsUser.getSystemType(), kwsUser.getId()));
|
|
|
}
|
|
|
}
|
|
|
|