Commit d895b93e by 刘红梅

修改异常

parent c5492616
...@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Validator; ...@@ -4,6 +4,7 @@ import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.IdcardUtil; import cn.hutool.core.util.IdcardUtil;
import com.cnooc.expert.common.constant.TokenConstants; import com.cnooc.expert.common.constant.TokenConstants;
import com.cnooc.expert.common.exception.BusinessException; import com.cnooc.expert.common.exception.BusinessException;
import com.cnooc.expert.common.exception.GlobalErrorCodeConstants;
import com.cnooc.expert.common.utils.JwtUtils; import com.cnooc.expert.common.utils.JwtUtils;
import com.cnooc.expert.common.utils.Sm2Util; import com.cnooc.expert.common.utils.Sm2Util;
import com.cnooc.expert.common.utils.ValidUtils; import com.cnooc.expert.common.utils.ValidUtils;
...@@ -64,6 +65,7 @@ public class LoginServiceImpl implements LoginService { ...@@ -64,6 +65,7 @@ public class LoginServiceImpl implements LoginService {
@Override @Override
public String login(LoginVO loginVO) { public String login(LoginVO loginVO) {
log.info("开始执行登录逻辑"); log.info("开始执行登录逻辑");
ValidUtils.isNotNull(loginVO.getLoginType(), GlobalErrorCodeConstants.PARAM_REQUIRED);
String token; String token;
switch (loginVO.getLoginType()) { switch (loginVO.getLoginType()) {
case ID_NUMBER_PASSWORD: case ID_NUMBER_PASSWORD:
...@@ -205,13 +207,13 @@ public class LoginServiceImpl implements LoginService { ...@@ -205,13 +207,13 @@ public class LoginServiceImpl implements LoginService {
//1.根据手机号去库中查询是否存在 //1.根据手机号去库中查询是否存在
ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null); ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null);
if(expertInfoResp == null){ if(expertInfoResp == null){
return "用户信息不存在"; throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg());
} }
//2.存在校验验证码 //2.存在校验验证码
if (!smsService.verifySmsCode(loginVO.getPhoneNumber(), loginVO.getPhoneCode())) { if (!smsService.verifySmsCode(loginVO.getPhoneNumber(), loginVO.getPhoneCode())) {
//登录日志 //登录日志
//sysLogLoginService.savePortal(login.getPhone(), Constant.FAIL, LoginOperationEnum.CAPTCHA_FAIL.getValue(), 1); //sysLogLoginService.savePortal(login.getPhone(), Constant.FAIL, LoginOperationEnum.CAPTCHA_FAIL.getValue(), 1);
throw new IllegalArgumentException("手机验证码错误"); throw new BusinessException(GlobalErrorCodeConstants.CAPTCHA_EXPIRED.getCode(),GlobalErrorCodeConstants.CAPTCHA_EXPIRED.getMsg());
} }
//3.生成相应的uuid作为redis的key //3.生成相应的uuid作为redis的key
String uuidKey = UUID.randomUUID().toString(); String uuidKey = UUID.randomUUID().toString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment