多语言-ApiException整合

This commit is contained in:
khalil
2024-04-10 22:20:18 +08:00
parent f484f76da5
commit bf87b44818
246 changed files with 372 additions and 23512 deletions

View File

@@ -1,9 +1,9 @@
package com.accompany.oauth2.service.account;
import com.accompany.core.exception.AdminServiceException;
import com.accompany.common.redis.RedisKey;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.base.SpringContextHolder;
import com.accompany.core.exception.ServiceException;
import com.accompany.core.mybatismapper.AccountLoginRecordMapperExpand;
import com.accompany.core.service.common.JedisService;
import com.accompany.core.util.JwtUtils;
@@ -77,7 +77,7 @@ public class AccountH5LoginService {
Integer isExists = accountLoginRecordMapperExpand.isExists(uid);
if (isExists > 0) {
deleteH5LoginJwtToken(uid);
throw new AdminServiceException(BusiStatus.REGION_NOT_OPEN_UP);
throw new ServiceException(BusiStatus.REGION_NOT_OPEN_UP);
}
}
return token;

View File

@@ -2,7 +2,6 @@ package com.accompany.oauth2.support.h5;
import cn.hutool.core.util.StrUtil;
import com.accompany.common.device.DeviceInfo;
import com.accompany.core.exception.AdminServiceException;
import com.accompany.common.utils.DESUtils;
import com.accompany.core.util.KeyStore;
import com.accompany.core.util.MD5;
@@ -13,6 +12,7 @@ import com.accompany.oauth2.service.MyUserDetailsService;
import com.accompany.oauth2.service.account.AccountH5LoginService;
import com.accompany.oauth2.token.H5AccessToken;
import com.accompany.oauth2.util.RequestContextHolderUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.security.core.userdetails.UserDetails;
@@ -37,6 +37,7 @@ public class PasswordH5TokenGranter extends AbstractH5TokenGranter {
this.accountH5LoginService = accountH5LoginService;
}
@SneakyThrows
@Override
public H5AccessToken authenticate(Map<String, Object> parameters) {
String phoneAreaCode = StrUtil.toString(parameters.get(PHONE_AREA_CODE));
@@ -63,7 +64,7 @@ public class PasswordH5TokenGranter extends AbstractH5TokenGranter {
userDetailsService.login(username, userDetails, LoginTypeEnum.PASSWORD, deviceInfo, code);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AdminServiceException(e.getMessage());
throw e;
}
return accountH5LoginService.createH5AccessToken(((AccountDetails) userDetails).getAccount().getUid());
}

View File

@@ -3,7 +3,6 @@ package com.accompany.oauth2.support.h5;
import cn.hutool.core.util.StrUtil;
import com.accompany.common.device.DeviceInfo;
import com.accompany.common.status.BusiStatus;
import com.accompany.core.exception.AdminServiceException;
import com.accompany.core.service.user.PhoneBlackService;
import com.accompany.oauth2.constant.GrantTypeEnum;
import com.accompany.oauth2.constant.LoginTypeEnum;
@@ -13,6 +12,7 @@ import com.accompany.oauth2.service.MyUserDetailsService;
import com.accompany.oauth2.service.account.AccountH5LoginService;
import com.accompany.oauth2.token.H5AccessToken;
import com.accompany.oauth2.util.RequestContextHolderUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.security.core.userdetails.UserDetails;
@@ -40,6 +40,7 @@ public class VerifyCodeH5TokenGranter extends AbstractH5TokenGranter {
this.accountH5LoginService = accountH5LoginService;
}
@SneakyThrows
@Override
public H5AccessToken authenticate(Map<String, Object> parameters) {
String phoneAreaCode = StrUtil.toString(parameters.get(PHONE_AREA_CODE));
@@ -62,7 +63,7 @@ public class VerifyCodeH5TokenGranter extends AbstractH5TokenGranter {
throw e;
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AdminServiceException(e.getMessage());
throw e;
}
return accountH5LoginService.createH5AccessToken(((AccountDetails) userDetails).getAccount().getUid());
}