system-service 服务,接入新的错误码
This commit is contained in:
parent
4397cbe643
commit
32c1cfb3a7
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.common.framework.exception;
|
||||
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
|
||||
/**
|
||||
@ -11,18 +11,34 @@ public class GlobalException extends RuntimeException {
|
||||
/**
|
||||
* 全局错误码
|
||||
*
|
||||
* @see GlobalErrorCodeEnum
|
||||
* @see GlobalErrorCodeConstants
|
||||
*/
|
||||
private final Integer code;
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
* * 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public GlobalException() {
|
||||
}
|
||||
|
||||
public GlobalException(ErrorCode errorCode) {
|
||||
this.code = errorCode.getCode();
|
||||
this.message = errorCode.getMessage();
|
||||
}
|
||||
|
||||
public GlobalException(Integer code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
@ -38,4 +54,18 @@ public class GlobalException extends RuntimeException {
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalException setCode(Integer code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public GlobalException setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,30 +5,6 @@ import cn.iocoder.common.framework.vo.CommonResult;
|
||||
|
||||
/**
|
||||
* 业务逻辑异常 Exception
|
||||
*
|
||||
* 参考 https://www.kancloud.cn/onebase/ob/484204 文章
|
||||
*
|
||||
* 一共 10 位,分成四段
|
||||
*
|
||||
* 第一段,1 位,类型
|
||||
* 1 - 业务级别异常
|
||||
* 2 - 系统级别异常
|
||||
* 第二段,3 位,系统类型
|
||||
* 001 - 用户系统
|
||||
* 002 - 商品系统
|
||||
* 003 - 订单系统
|
||||
* 004 - 支付系统
|
||||
* 005 - 优惠劵系统
|
||||
* ... - ...
|
||||
* 第三段,3 位,模块
|
||||
* 不限制规则。
|
||||
* 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子:
|
||||
* 001 - OAuth2 模块
|
||||
* 002 - User 模块
|
||||
* 003 - MobileCode 模块
|
||||
* 第四段,3 位,错误码
|
||||
* 不限制规则。
|
||||
* 一般建议,每个模块自增。
|
||||
*/
|
||||
public final class ServiceException extends RuntimeException {
|
||||
|
||||
@ -37,7 +13,11 @@ public final class ServiceException extends RuntimeException {
|
||||
*
|
||||
* @see ServiceErrorCodeRange
|
||||
*/
|
||||
private final Integer code;
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
*
|
||||
@ -45,9 +25,20 @@ public final class ServiceException extends RuntimeException {
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public ServiceException() {
|
||||
}
|
||||
|
||||
public ServiceException(ErrorCode errorCode) {
|
||||
this.code = errorCode.getCode();
|
||||
this.message = errorCode.getMessage();
|
||||
}
|
||||
|
||||
public ServiceException(Integer code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
@ -63,4 +54,18 @@ public final class ServiceException extends RuntimeException {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ServiceException setCode(Integer code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public ServiceException setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.common.framework.exception.enums;
|
||||
|
||||
import cn.iocoder.common.framework.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 全局错误码枚举
|
||||
* 0-999 系统异常编码保留
|
||||
*
|
||||
* 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
|
||||
* 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
|
||||
* 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
|
||||
*/
|
||||
public interface GlobalErrorCodeConstants {
|
||||
|
||||
ErrorCode SUCCESS = new ErrorCode(0, "成功");
|
||||
|
||||
// ========== 客户端错误段 ==========
|
||||
|
||||
ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确");
|
||||
ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录");
|
||||
ErrorCode FORBIDDEN = new ErrorCode(403, "没有该操作权限");
|
||||
ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到");
|
||||
ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "请求方法不正确");
|
||||
|
||||
// ========== 服务端错误段 ==========
|
||||
|
||||
ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常");
|
||||
|
||||
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
|
||||
|
||||
|
||||
static boolean isMatch(Integer code) {
|
||||
return code != null
|
||||
&& code >= SUCCESS.getCode() && code <= UNKNOWN.getCode();
|
||||
}
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package cn.iocoder.common.framework.exception.enums;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
|
||||
/**
|
||||
* 全局错误码枚举
|
||||
* 0-999 系统异常编码保留
|
||||
*
|
||||
* 一般情况下,{@link GlobalErrorCodeEnum#getCode()} ()} 使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
|
||||
* 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
|
||||
* 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
|
||||
*/
|
||||
public enum GlobalErrorCodeEnum implements ServiceExceptionUtil.Enumerable<GlobalErrorCodeEnum> {
|
||||
|
||||
SUCCESS(0, "成功"),
|
||||
|
||||
// ========== 客户端错误段 ==========
|
||||
|
||||
BAD_REQUEST(400, "请求参数不正确"),
|
||||
UNAUTHORIZED(401, "账号未登录"),
|
||||
FORBIDDEN(403, "没有该操作权限"),
|
||||
NOT_FOUND(404, "请求未找到"),
|
||||
METHOD_NOT_ALLOWED(405, "请求方法不正确"),
|
||||
|
||||
// ========== 服务端错误段 ==========
|
||||
|
||||
INTERNAL_SERVER_ERROR(500, "系统异常"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
GlobalErrorCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroup() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
package cn.iocoder.common.framework.util;
|
||||
|
||||
import cn.iocoder.common.framework.exception.ErrorCode;
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -27,19 +26,6 @@ public class ServiceExceptionUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceExceptionUtil.class);
|
||||
|
||||
/**
|
||||
* 错误枚举的接口
|
||||
*/
|
||||
public interface Enumerable<V extends Enum> {
|
||||
|
||||
int getCode();
|
||||
|
||||
String getMessage();
|
||||
|
||||
int getGroup();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 错误码提示模板
|
||||
*/
|
||||
@ -57,35 +43,16 @@ public class ServiceExceptionUtil {
|
||||
ServiceExceptionUtil.messages.remove(code, message);
|
||||
}
|
||||
|
||||
// ========== 和 CommonResult 的集成 ==========
|
||||
|
||||
public static <T> CommonResult<T> error(Enumerable enumerable) {
|
||||
return error(enumerable.getCode());
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> error(Enumerable enumerable, Object... params) {
|
||||
return error(enumerable.getCode(), params);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> error(Integer code) {
|
||||
return CommonResult.error(code, messages.get(code));
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> error(Integer code, Object... params) {
|
||||
String message = doFormat(code, messages.get(code), params);
|
||||
return CommonResult.error(code, message);
|
||||
}
|
||||
|
||||
// ========== 和 ServiceException 的集成 ==========
|
||||
|
||||
public static ServiceException exception(Enumerable enumerable) {
|
||||
String messagePattern = messages.getOrDefault(enumerable.getCode(), enumerable.getMessage());
|
||||
return exception0(enumerable.getCode(), messagePattern);
|
||||
public static ServiceException exception(ErrorCode errorCode) {
|
||||
String messagePattern = messages.getOrDefault(errorCode.getCode(), errorCode.getMessage());
|
||||
return exception0(errorCode.getCode(), messagePattern);
|
||||
}
|
||||
|
||||
public static ServiceException exception(Enumerable enumerable, Object... params) {
|
||||
String messagePattern = messages.getOrDefault(enumerable.getCode(), enumerable.getMessage());
|
||||
return exception0(enumerable.getCode(), messagePattern, params);
|
||||
public static ServiceException exception(ErrorCode errorCode, Object... params) {
|
||||
String messagePattern = messages.getOrDefault(errorCode.getCode(), errorCode.getMessage());
|
||||
return exception0(errorCode.getCode(), messagePattern, params);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,10 +81,7 @@ public class ServiceExceptionUtil {
|
||||
return new ServiceException(code, message);
|
||||
}
|
||||
|
||||
public static ServiceException exception(CommonResult result) {
|
||||
Assert.isTrue(result.isError(), "结果必须是错误的");
|
||||
return new ServiceException(result.getCode(), result.getMessage());
|
||||
}
|
||||
// ========== 格式化方法 ==========
|
||||
|
||||
/**
|
||||
* 将错误编号对应的消息使用 params 进行格式化。
|
||||
|
@ -1,8 +1,9 @@
|
||||
package cn.iocoder.common.framework.vo;
|
||||
|
||||
import cn.iocoder.common.framework.exception.ErrorCode;
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.exception.GlobalException;
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@ -15,8 +16,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public final class CommonResult<T> implements Serializable {
|
||||
|
||||
private static final Integer CODE_SUCCESS = GlobalErrorCodeEnum.SUCCESS.getCode();
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*
|
||||
@ -30,7 +29,7 @@ public final class CommonResult<T> implements Serializable {
|
||||
/**
|
||||
* 错误提示,用户可阅读
|
||||
*
|
||||
* @see ErrorCode#getMsg()
|
||||
* @see ErrorCode#getMessage() ()
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
@ -48,20 +47,25 @@ public final class CommonResult<T> implements Serializable {
|
||||
* @return 新的 CommonResult 对象
|
||||
*/
|
||||
public static <T> CommonResult<T> error(CommonResult<?> result) {
|
||||
return error(result.getCode(), result.getMessage());
|
||||
return error(result.getCode(), result.getMessage(), result.detailMessage);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> error(Integer code, String message) {
|
||||
Assert.isTrue(!CODE_SUCCESS.equals(code), "code 必须是错误的!");
|
||||
return error(code, message, null);
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> error(Integer code, String message, String detailMessage) {
|
||||
Assert.isTrue(!GlobalErrorCodeConstants.SUCCESS.getCode().equals(code), "code 必须是错误的!");
|
||||
CommonResult<T> result = new CommonResult<>();
|
||||
result.code = code;
|
||||
result.message = message;
|
||||
result.detailMessage = detailMessage;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> CommonResult<T> success(T data) {
|
||||
CommonResult<T> result = new CommonResult<>();
|
||||
result.code = CODE_SUCCESS;
|
||||
result.code = GlobalErrorCodeConstants.SUCCESS.getCode();
|
||||
result.data = data;
|
||||
result.message = "";
|
||||
return result;
|
||||
@ -102,7 +106,7 @@ public final class CommonResult<T> implements Serializable {
|
||||
|
||||
@JSONField(serialize = false) // 避免序列化
|
||||
public boolean isSuccess() {
|
||||
return CODE_SUCCESS.equals(code);
|
||||
return GlobalErrorCodeConstants.SUCCESS.getCode().equals(code);
|
||||
}
|
||||
|
||||
@JSONField(serialize = false) // 避免序列化
|
||||
@ -110,23 +114,31 @@ public final class CommonResult<T> implements Serializable {
|
||||
return !isSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有异常。如果有,则抛出 {@link cn.iocoder.common.framework.exception.ServiceException} 异常
|
||||
*/
|
||||
public void checkError() {
|
||||
if (isSuccess()) {
|
||||
return;
|
||||
}
|
||||
throw ServiceExceptionUtil.exception0(code, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CommonResult{" +
|
||||
"code=" + code +
|
||||
", message='" + message + '\'' +
|
||||
", data=" + data +
|
||||
", message='" + message + '\'' +
|
||||
", detailMessage='" + detailMessage + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
// ========= 和 Exception 异常体系集成 =========
|
||||
|
||||
/**
|
||||
* 判断是否有异常。如果有,则抛出 {@link GlobalException} 或 {@link ServiceException} 异常
|
||||
*/
|
||||
public void checkError() throws GlobalException, ServiceException {
|
||||
if (isSuccess()) {
|
||||
return;
|
||||
}
|
||||
// 全局异常
|
||||
if (GlobalErrorCodeConstants.isMatch(code)) {
|
||||
throw new GlobalException(code, message).setDetailMessage(detailMessage);
|
||||
}
|
||||
// 业务异常
|
||||
throw new ServiceException(code, message).setDetailMessage(detailMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.mybatis.dataobject;
|
||||
package cn.iocoder.mall.mybatis.core.dataobject;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.mybatis.dataobject;
|
||||
package cn.iocoder.mall.mybatis.core.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.mybatis.enums;
|
||||
package cn.iocoder.mall.mybatis.core.enums;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
|
||||
/**
|
||||
* {@link DeletableDO#getDeleted()} delete 状态
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.mybatis.query;
|
||||
package cn.iocoder.mall.mybatis.core.query;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.mall.mybatis.type;
|
||||
package cn.iocoder.mall.mybatis.core.type;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.security.admin.core.interceptor;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.security.admin.core.context.AdminSecurityContextHolder;
|
||||
import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum;
|
||||
import cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
@ -22,7 +22,7 @@ public class AdminDemoInterceptor extends HandlerInterceptorAdapter {
|
||||
// 当 Admin 编号等于 0 时,约定为演示账号
|
||||
if (Objects.equals(AdminSecurityContextHolder.getAdminId(), 0)
|
||||
&& request.getMethod().equalsIgnoreCase(HttpMethod.POST.toString())) {
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.PERMISSION_DEMO_PERMISSION_DENY);
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.PERMISSION_DEMO_PERMISSION_DENY);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.security.admin.core.interceptor;
|
||||
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.enums.UserTypeEnum;
|
||||
import cn.iocoder.common.framework.exception.GlobalException;
|
||||
import cn.iocoder.common.framework.util.CollectionUtils;
|
||||
import cn.iocoder.common.framework.util.HttpUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
@ -23,7 +23,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.OAUTH_USER_TYPE_ERROR;
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR;
|
||||
|
||||
public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
@ -68,7 +69,7 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||
private void checkAuthentication(HandlerMethod handlerMethod, Integer adminId) {
|
||||
boolean requiresAuthenticate = !handlerMethod.hasMethodAnnotation(RequiresNone.class); // 对于 ADMIN 来说,默认需登录
|
||||
if (requiresAuthenticate && adminId == null) {
|
||||
throw ServiceExceptionUtil.exception(GlobalErrorCodeEnum.UNAUTHORIZED);
|
||||
throw new GlobalException(UNAUTHORIZED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.OAUTH_USER_TYPE_ERROR;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.OAUTH_USER_TYPE_ERROR;
|
||||
|
||||
public class UserSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.web.core.handler;
|
||||
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants;
|
||||
import cn.iocoder.common.framework.util.ExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.HttpUtil;
|
||||
import cn.iocoder.common.framework.util.MallUtils;
|
||||
@ -32,6 +32,8 @@ import javax.validation.ConstraintViolation;
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 全局异常处理器,将 Exception 翻译成 CommonResult + 对应的异常编号
|
||||
*/
|
||||
@ -62,7 +64,7 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(value = MissingServletRequestParameterException.class)
|
||||
public CommonResult missingServletRequestParameterExceptionHandler(MissingServletRequestParameterException ex) {
|
||||
logger.warn("[missingServletRequestParameterExceptionHandler]", ex);
|
||||
return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(),
|
||||
return CommonResult.error(BAD_REQUEST.getCode(),
|
||||
String.format("请求参数缺失:%s", ex.getParameterName()));
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
|
||||
public CommonResult methodArgumentTypeMismatchExceptionHandler(MethodArgumentTypeMismatchException ex) {
|
||||
logger.warn("[missingServletRequestParameterExceptionHandler]", ex);
|
||||
return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(),
|
||||
return CommonResult.error(BAD_REQUEST.getCode(),
|
||||
String.format("请求参数类型错误:%s", ex.getMessage()));
|
||||
}
|
||||
|
||||
@ -86,7 +88,7 @@ public class GlobalExceptionHandler {
|
||||
logger.warn("[methodArgumentNotValidExceptionExceptionHandler]", ex);
|
||||
FieldError fieldError = ex.getBindingResult().getFieldError();
|
||||
assert fieldError != null; // 断言,避免告警
|
||||
return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(),
|
||||
return CommonResult.error(BAD_REQUEST.getCode(),
|
||||
String.format("请求参数不正确:%s", fieldError.getDefaultMessage()));
|
||||
}
|
||||
|
||||
@ -98,7 +100,7 @@ public class GlobalExceptionHandler {
|
||||
logger.warn("[handleBindException]", ex);
|
||||
FieldError fieldError = ex.getFieldError();
|
||||
assert fieldError != null; // 断言,避免告警
|
||||
return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(),
|
||||
return CommonResult.error(BAD_REQUEST.getCode(),
|
||||
String.format("请求参数不正确:%s", fieldError.getDefaultMessage()));
|
||||
}
|
||||
|
||||
@ -109,7 +111,7 @@ public class GlobalExceptionHandler {
|
||||
public CommonResult constraintViolationExceptionHandler(ConstraintViolationException ex) {
|
||||
logger.warn("[constraintViolationExceptionHandler]", ex);
|
||||
ConstraintViolation<?> constraintViolation = ex.getConstraintViolations().iterator().next();
|
||||
return CommonResult.error(GlobalErrorCodeEnum.BAD_REQUEST.getCode(),
|
||||
return CommonResult.error(BAD_REQUEST.getCode(),
|
||||
String.format("请求参数不正确:%s", constraintViolation.getMessage()));
|
||||
}
|
||||
|
||||
@ -123,7 +125,7 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public CommonResult noHandlerFoundExceptionHandler(NoHandlerFoundException ex) {
|
||||
logger.warn("[noHandlerFoundExceptionHandler]", ex);
|
||||
return CommonResult.error(GlobalErrorCodeEnum.NOT_FOUND.getCode(),
|
||||
return CommonResult.error(GlobalErrorCodeConstants.NOT_FOUND.getCode(),
|
||||
String.format("请求地址不存在:%s", ex.getRequestURL()));
|
||||
}
|
||||
|
||||
@ -135,7 +137,7 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
public CommonResult httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException ex) {
|
||||
logger.warn("[httpRequestMethodNotSupportedExceptionHandler]", ex);
|
||||
return CommonResult.error(GlobalErrorCodeEnum.METHOD_NOT_ALLOWED.getCode(),
|
||||
return CommonResult.error(GlobalErrorCodeConstants.METHOD_NOT_ALLOWED.getCode(),
|
||||
String.format("请求方法不正确:%s", ex.getMessage()));
|
||||
}
|
||||
|
||||
@ -169,7 +171,7 @@ public class GlobalExceptionHandler {
|
||||
logger.error("[defaultExceptionHandler][插入访问日志({}) 发生异常({})", JSON.toJSONString(exceptionLog), ExceptionUtils.getRootCauseMessage(th));
|
||||
}
|
||||
// 返回 ERROR CommonResult
|
||||
return CommonResult.error(GlobalErrorCodeEnum.INTERNAL_SERVER_ERROR.getCode(), GlobalErrorCodeEnum.INTERNAL_SERVER_ERROR.getMessage());
|
||||
return CommonResult.error(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(), GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getMessage());
|
||||
}
|
||||
|
||||
private void initExceptionLog(SystemExceptionLogCreateDTO exceptionLog, HttpServletRequest request, Throwable e) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.bo;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.bo;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.bo.order;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.bo.order;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.order.biz.dataobject.comment;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
@ -11,10 +11,10 @@
|
||||
<resultMap id="PayNotifyTaskResultMap" type="PayNotifyTaskDO">
|
||||
<result property="transaction" column="transaction"
|
||||
javaType="cn.iocoder.mall.pay.biz.dataobject.PayNotifyTaskDO$Transaction"
|
||||
typeHandler="cn.iocoder.mall.mybatis.type.JSONTypeHandler"/>
|
||||
typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/>
|
||||
<result property="refund" column="refund"
|
||||
javaType="cn.iocoder.mall.pay.biz.dataobject.PayNotifyTaskDO$Refund"
|
||||
typeHandler="cn.iocoder.mall.mybatis.type.JSONTypeHandler"/>
|
||||
typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" parameterType="PayNotifyTaskDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.attr;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.attr;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.brand;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.category;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.spu;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.product.biz.dataobject.attr.ProductAttrDO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.biz.dataobject.spu;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package cn.iocoder.mall.product.biz.service.attr;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrBO;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrSimpleWithValueBO;
|
||||
import cn.iocoder.mall.product.biz.bo.attr.ProductAttrValueBO;
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.service.brand;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.biz.bo.brand.ProductBrandBO;
|
||||
import cn.iocoder.mall.product.biz.convert.brand.ProductBrandConvert;
|
||||
import cn.iocoder.mall.product.biz.dao.brand.ProductBrandMapper;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.biz.service.category;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.biz.bo.category.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.biz.convert.category.ProductCategoryConvert;
|
||||
import cn.iocoder.mall.product.biz.dao.category.ProductCategoryMapper;
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.product.biz.service.spu;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.StringUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.biz.bo.product.ProductAttrAndValuePairBO;
|
||||
import cn.iocoder.mall.product.biz.bo.product.ProductSpuDetailBO;
|
||||
import cn.iocoder.mall.product.biz.convert.sku.ProductSpuConvert;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.product.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.message;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.api.UserProductSpuCollectionsService;
|
||||
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
|
||||
import cn.iocoder.mall.product.api.dto.UserProductSpuCollectionsAddDTO;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.api.ProductAttrService;
|
||||
import cn.iocoder.mall.product.api.bo.*;
|
||||
import cn.iocoder.mall.product.api.constant.ProductAttrConstants;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.api.ProductCategoryService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductCategoryBO;
|
||||
import cn.iocoder.mall.product.api.constant.ProductCategoryConstants;
|
||||
|
@ -3,7 +3,7 @@ package cn.iocoder.mall.product.service;
|
||||
import cn.iocoder.common.framework.util.CollectionUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.StringUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.*;
|
||||
import cn.iocoder.mall.product.api.constant.ProductCategoryConstants;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.product.service;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.api.UserProductSpuCollectionsService;
|
||||
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsBO;
|
||||
import cn.iocoder.mall.product.api.bo.UserProductSpuCollectionsPageBO;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package cn.iocoder.mall.promotion.biz.service.banner;
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.promotion.biz.api.enums.PromotionErrorCodeEnum;
|
||||
import cn.iocoder.mall.promotion.biz.bo.banner.BannerListBO;
|
||||
import cn.iocoder.mall.promotion.biz.bo.banner.BannerListOnReleaseBO;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.promotion.api.constant.ProductRecommendTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.promotion.biz.mybatis;
|
||||
|
||||
import cn.iocoder.mall.mybatis.type.JSONTypeHandler;
|
||||
import cn.iocoder.mall.mybatis.core.type.JSONTypeHandler;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO;
|
||||
|
||||
public class TestHandler extends JSONTypeHandler<PromotionActivityDO.TimeLimitedDiscount> {
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.promotion.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.BannerService;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.promotion.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.product.rpc.api.ProductSpuRpc;
|
||||
import cn.iocoder.mall.promotion.api.ProductRecommendService;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
|
@ -9,8 +9,8 @@
|
||||
</sql>
|
||||
|
||||
<resultMap id="PromotionActivityResultMap" type="PromotionActivityDO">
|
||||
<result property="timeLimitedDiscount" column="time_limited_discount" javaType="cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO$TimeLimitedDiscount" typeHandler="cn.iocoder.mall.mybatis.type.JSONTypeHandler"/>
|
||||
<result property="fullPrivilege" column="full_privilege" javaType="cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO$FullPrivilege" typeHandler="cn.iocoder.mall.mybatis.type.JSONTypeHandler"/>
|
||||
<result property="timeLimitedDiscount" column="time_limited_discount" javaType="cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO$TimeLimitedDiscount" typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/>
|
||||
<result property="fullPrivilege" column="full_privilege" javaType="cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO$FullPrivilege" typeHandler="cn.iocoder.mall.mybatis.core.type.JSONTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="PromotionActivityDO">-->
|
||||
|
@ -0,0 +1,84 @@
|
||||
package cn.iocoder.mall.systemservice.enums;
|
||||
|
||||
import cn.iocoder.common.framework.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 错误码枚举类
|
||||
*
|
||||
* system 系统,使用 1-002-000-000 段
|
||||
*/
|
||||
public interface SystemErrorCodeConstants {
|
||||
|
||||
// ========== OAUTH2 模块 ==========
|
||||
ErrorCode OAUTH2_UNKNOWN = new ErrorCode(1001001000, "未知错误"); // 预留
|
||||
// 预留 1001001001 ~ 1001001099 错误码,方便前端
|
||||
ErrorCode OAUTH2_ACCESS_TOKEN_NOT_FOUND = new ErrorCode(1001001001, "访问令牌不存在");
|
||||
ErrorCode OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED = new ErrorCode(1001001002, "访问令牌已过期");
|
||||
ErrorCode OAUTH2_ACCESS_TOKEN_INVALID = new ErrorCode(1001001003, "访问令牌已失效");
|
||||
ErrorCode OAUTH2_REFRESH_TOKEN_NOT_FOUND = new ErrorCode(1001001005, "刷新令牌不存在");
|
||||
ErrorCode OAUTH_REFRESH_TOKEN_EXPIRED = new ErrorCode(1001001006, "访问令牌已过期");
|
||||
ErrorCode OAUTH_REFRESH_TOKEN_INVALID = new ErrorCode(1001001007, "刷新令牌已失效");
|
||||
// 其它 1001001100 开始
|
||||
ErrorCode OAUTH_USER_TYPE_ERROR = new ErrorCode(1001001101, "用户类型并不正确");
|
||||
|
||||
// ========== 管理员模块 1002002000 ==========
|
||||
ErrorCode ADMIN_NOT_FOUND = new ErrorCode(1002002000, "管理员不存在");
|
||||
ErrorCode ADMIN_PASSWORD_ERROR = new ErrorCode(1002002001, "密码不正确");
|
||||
ErrorCode ADMIN_IS_DISABLE = new ErrorCode(1002002002, "账号被禁用");
|
||||
ErrorCode ADMIN_USERNAME_EXISTS = new ErrorCode(1002002002, "账号已经存在");
|
||||
ErrorCode ADMIN_STATUS_EQUALS = new ErrorCode(1002002003, "账号已经是该状态");
|
||||
// ErrorCode ADMIN_DELETE_ONLY_DISABLE = new ErrorCode(1002002004, "只有关闭的账号才可以删除");
|
||||
ErrorCode ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE = new ErrorCode(1002002005, "管理员的账号状态不允许变更");
|
||||
ErrorCode ADMIN_ASSIGN_ROLE_NOT_EXISTS = new ErrorCode(1002002006, "分配员工角色时,有角色不存在");
|
||||
ErrorCode ADMIN_ADMIN_CAN_NOT_UPDATE = new ErrorCode(1002002008, "管理员的账号不允许变更");
|
||||
ErrorCode ADMIN_USERNAME_NOT_EXISTS = new ErrorCode(1002002008, "账号不存在");
|
||||
|
||||
// ========== 资源模块 1002003000 ==========
|
||||
ErrorCode RESOURCE_NAME_DUPLICATE = new ErrorCode(1002003000, "已经存在该名字的资源");
|
||||
ErrorCode RESOURCE_PARENT_NOT_EXISTS = new ErrorCode(1002003001, "父资源不存在");
|
||||
ErrorCode RESOURCE_PARENT_ERROR = new ErrorCode(1002003002, "不能设置自己为父资源");
|
||||
ErrorCode RESOURCE_NOT_EXISTS = new ErrorCode(1002003003, "资源不存在");
|
||||
ErrorCode RESOURCE_EXISTS_CHILDREN = new ErrorCode(1002003004, "存在子资源,无法删除");
|
||||
ErrorCode RESOURCE_PARENT_NOT_MENU = new ErrorCode(1002003005, "父资源的类型必须是菜单");
|
||||
|
||||
// ========== 角色模块 1002004000 ==========
|
||||
ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1002004000, "角色不存在");
|
||||
ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1002004001, "已经存在名为【{}}】的角色");
|
||||
ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002004002, "已经存在编码为【{}}】的角色");
|
||||
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002004004, "不能修改类型为系统内置的角色");
|
||||
ErrorCode ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE = new ErrorCode(1002004005, "不能删除类型为系统内置的角色");
|
||||
|
||||
// ========== 数据字典模块 1002005000 ==========
|
||||
ErrorCode DATA_DICT_EXISTS = new ErrorCode(1002005000, "该数据字典已经存在");
|
||||
ErrorCode DATA_DICT_NOT_EXISTS = new ErrorCode(1002005001, "该数据字典不存在");
|
||||
|
||||
// ========== 短信模板 1002006000 ==========
|
||||
ErrorCode SMS_PLATFORM_FAIL = new ErrorCode(1002006000, "短信平台调用失败【具体错误会动态替换】");
|
||||
ErrorCode SMS_SIGN_NOT_EXISTENT = new ErrorCode(1002006001, "短信签名不存在");
|
||||
ErrorCode SMS_SIGN_IS_EXISTENT = new ErrorCode(1002006002, "短信签名已存在");
|
||||
ErrorCode SMS_TEMPLATE_NOT_EXISTENT = new ErrorCode(1002006020, "短信签名不存在");
|
||||
ErrorCode SMS_TEMPLATE_IS_EXISTENT = new ErrorCode(1002006021, "短信签名不存在");
|
||||
ErrorCode SMS_NOT_SEND_CLIENT = new ErrorCode(1002006030, "短信没有发送的client");
|
||||
|
||||
// ========== 部门模块 1002007000 ==========
|
||||
ErrorCode DEPARTMENT_NAME_DUPLICATE = new ErrorCode(1002007001, "已经存在该名字的部门");
|
||||
ErrorCode DEPARTMENT_PARENT_NOT_EXITS = new ErrorCode(1002007002,"父级部门不存在");
|
||||
ErrorCode DEPARTMENT_NOT_FOUND = new ErrorCode(1002007003, "当前部门不存在");
|
||||
ErrorCode DEPARTMENT_EXITS_CHILDREN = new ErrorCode(1002007004, "存在子部门,无法删除");
|
||||
ErrorCode DEPARTMENT_PARENT_ERROR = new ErrorCode(1002007005, "不能设置自己为父资源");
|
||||
ErrorCode DEPARTMENT_EXISTS_ADMIN = new ErrorCode(1002007006, "部门中存在员工,无法删除");
|
||||
|
||||
// ========== 权限模块 1002008000 ==========
|
||||
ErrorCode PERMISSION_DEMO_PERMISSION_DENY = new ErrorCode(1002008002, "演示账号,暂不允许写操作。欢迎加入我们的交流群:http://t.cn/EKEr5WE");
|
||||
ErrorCode PERMISSION_ROLE_ASSIGN_RESOURCE_NOT_EXISTS = new ErrorCode(1002008004, "分配角色资源时,有资源不存在");
|
||||
|
||||
// ========== 错误码模块 1002009000 ==========
|
||||
ErrorCode ERROR_CODE_NOT_EXISTS = new ErrorCode(1002009000, "错误码不存在");
|
||||
ErrorCode ERROR_CODE_DUPLICATE = new ErrorCode(1002009001, "已经存在编码为【{}}】的错误码");
|
||||
ErrorCode ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR = new ErrorCode(1002004003, "不能修改类型为系统内置的错误码");
|
||||
|
||||
// ========== 系统异常日志模块 1002010000 ==========
|
||||
ErrorCode SYSTEM_EXCEPTION_LOG_NOT_FOUND = new ErrorCode(1002010000, "系统异常日志不存在");
|
||||
ErrorCode SYSTEM_EXCEPTION_LOG_PROCESSED = new ErrorCode(1002010001, "系统异常日志已处理");
|
||||
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
package cn.iocoder.mall.systemservice.enums;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
|
||||
/**
|
||||
* 错误码枚举类
|
||||
*
|
||||
* system 系统,使用 1-002-000-000 段
|
||||
*/
|
||||
public enum SystemErrorCodeEnum implements ServiceExceptionUtil.Enumerable<SystemErrorCodeEnum> {
|
||||
|
||||
// ========== OAUTH2 模块 ==========
|
||||
OAUTH2_UNKNOWN(1001001000, "未知错误"), // 预留
|
||||
// 预留 1001001001 ~ 1001001099 错误码,方便前端
|
||||
OAUTH2_ACCESS_TOKEN_NOT_FOUND(1001001001, "访问令牌不存在"),
|
||||
OAUTH2_ACCESS_TOKEN_TOKEN_EXPIRED(1001001002, "访问令牌已过期"),
|
||||
OAUTH2_ACCESS_TOKEN_INVALID(1001001003, "访问令牌已失效"),
|
||||
OAUTH2_REFRESH_TOKEN_NOT_FOUND(1001001005, "刷新令牌不存在"),
|
||||
OAUTH_REFRESH_TOKEN_EXPIRED(1001001006, "访问令牌已过期"),
|
||||
OAUTH_REFRESH_TOKEN_INVALID(1001001007, "刷新令牌已失效"),
|
||||
// 其它 1001001100 开始
|
||||
OAUTH_USER_TYPE_ERROR(1001001101, "用户类型并不正确"),
|
||||
|
||||
// ========== 管理员模块 1002002000 ==========
|
||||
ADMIN_NOT_FOUND(1002002000, "管理员不存在"),
|
||||
ADMIN_PASSWORD_ERROR(1002002001, "密码不正确"),
|
||||
ADMIN_IS_DISABLE(1002002002, "账号被禁用"),
|
||||
ADMIN_USERNAME_EXISTS(1002002002, "账号已经存在"),
|
||||
ADMIN_STATUS_EQUALS(1002002003, "账号已经是该状态"),
|
||||
// ADMIN_DELETE_ONLY_DISABLE(1002002004, "只有关闭的账号才可以删除"),
|
||||
ADMIN_ADMIN_STATUS_CAN_NOT_UPDATE(1002002005, "管理员的账号状态不允许变更"),
|
||||
ADMIN_ASSIGN_ROLE_NOT_EXISTS(1002002006, "分配员工角色时,有角色不存在"),
|
||||
ADMIN_ADMIN_CAN_NOT_UPDATE(1002002008, "管理员的账号不允许变更"),
|
||||
ADMIN_USERNAME_NOT_EXISTS(1002002008, "账号不存在"),
|
||||
|
||||
// ========== 资源模块 1002003000 ==========
|
||||
RESOURCE_NAME_DUPLICATE(1002003000, "已经存在该名字的资源"),
|
||||
RESOURCE_PARENT_NOT_EXISTS(1002003001, "父资源不存在"),
|
||||
RESOURCE_PARENT_ERROR(1002003002, "不能设置自己为父资源"),
|
||||
RESOURCE_NOT_EXISTS(1002003003, "资源不存在"),
|
||||
RESOURCE_EXISTS_CHILDREN(1002003004, "存在子资源,无法删除"),
|
||||
RESOURCE_PARENT_NOT_MENU(1002003005, "父资源的类型必须是菜单"),
|
||||
|
||||
// ========== 角色模块 1002004000 ==========
|
||||
ROLE_NOT_EXISTS(1002004000, "角色不存在"),
|
||||
ROLE_NAME_DUPLICATE(1002004001, "已经存在名为【{}}】的角色"),
|
||||
ROLE_CODE_DUPLICATE(1002004002, "已经存在编码为【{}}】的角色"),
|
||||
ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE(1002004004, "不能修改类型为系统内置的角色"),
|
||||
ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE(1002004005, "不能删除类型为系统内置的角色"),
|
||||
|
||||
// ========== 数据字典模块 1002005000 ==========
|
||||
DATA_DICT_EXISTS(1002005000, "该数据字典已经存在"),
|
||||
DATA_DICT_NOT_EXISTS(1002005001, "该数据字典不存在"),
|
||||
|
||||
// ========== 短信模板 1002006000 ==========
|
||||
SMS_PLATFORM_FAIL(1002006000, "短信平台调用失败【具体错误会动态替换】"),
|
||||
SMS_SIGN_NOT_EXISTENT(1002006001, "短信签名不存在"),
|
||||
SMS_SIGN_IS_EXISTENT(1002006002, "短信签名已存在"),
|
||||
SMS_TEMPLATE_NOT_EXISTENT(1002006020, "短信签名不存在"),
|
||||
SMS_TEMPLATE_IS_EXISTENT(1002006021, "短信签名不存在"),
|
||||
SMS_NOT_SEND_CLIENT(1002006030, "短信没有发送的client"),
|
||||
|
||||
// ========== 部门模块 1002007000 ==========
|
||||
DEPARTMENT_NAME_DUPLICATE(1002007001, "已经存在该名字的部门"),
|
||||
DEPARTMENT_PARENT_NOT_EXITS(1002007002,"父级部门不存在"),
|
||||
DEPARTMENT_NOT_FOUND(1002007003, "当前部门不存在"),
|
||||
DEPARTMENT_EXITS_CHILDREN(1002007004, "存在子部门,无法删除"),
|
||||
DEPARTMENT_PARENT_ERROR(1002007005, "不能设置自己为父资源"),
|
||||
DEPARTMENT_EXISTS_ADMIN(1002007006, "部门中存在员工,无法删除"),
|
||||
|
||||
// ========== 权限模块 1002008000 ==========
|
||||
PERMISSION_DEMO_PERMISSION_DENY(1002008002, "演示账号,暂不允许写操作。欢迎加入我们的交流群:http://t.cn/EKEr5WE"),
|
||||
PERMISSION_ROLE_ASSIGN_RESOURCE_NOT_EXISTS(1002008004, "分配角色资源时,有资源不存在"),
|
||||
|
||||
// ========== 错误码模块 1002009000 ==========
|
||||
ERROR_CODE_NOT_EXISTS(1002009000, "错误码不存在"),
|
||||
ERROR_CODE_DUPLICATE(1002009001, "已经存在编码为【{}}】的错误码"),
|
||||
ERROR_CAN_NOT_UPDATE_SYSTEM_TYPE_ERROR(1002004003, "不能修改类型为系统内置的错误码"),
|
||||
|
||||
// ========== 系统异常日志模块 1002010000 ==========
|
||||
SYSTEM_EXCEPTION_LOG_NOT_FOUND(1002010000, "系统异常日志不存在"),
|
||||
SYSTEM_EXCEPTION_LOG_PROCESSED(1002010001, "系统异常日志已处理"),
|
||||
|
||||
;
|
||||
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
SystemErrorCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
// TODO: 2020-05-22 封装成start的时候,直接在start中定义一个统一的枚举,从中取值;
|
||||
@Override
|
||||
public int getGroup() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package cn.iocoder.mall.systemservice.config;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.EventListener;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Configuration
|
||||
public class ServiceExceptionConfiguration {
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void initMessages() {
|
||||
Arrays.stream(SystemErrorCodeEnum.values()).forEach(
|
||||
item -> ServiceExceptionUtil.put(item.getCode(), item.getMessage()));
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.systemservice.enums.admin.AdminStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.datadict;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth;
|
||||
|
||||
import cn.iocoder.common.framework.enums.UserTypeEnum;
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.oauth;
|
||||
|
||||
import cn.iocoder.common.framework.enums.UserTypeEnum;
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.systemservice.enums.permission.RoleCodeEnum;
|
||||
import cn.iocoder.mall.systemservice.enums.permission.RoleTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.enums.UserTypeEnum;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.enums.UserTypeEnum;
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
import cn.iocoder.mall.systemservice.enums.systemlog.SystemExceptionLogProcessStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
import cn.iocoder.mall.systemservice.service.admin.bo.AdminPageBO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.admin;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.DepartmentDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.ResourceDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.permission;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.mall.systemservice.service.permission.bo.RolePageBO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.systemlog;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog.SystemAccessLogDO;
|
||||
import cn.iocoder.mall.systemservice.service.systemlog.bo.SystemAccessLogPageBO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.mapper.systemlog;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.systemlog.SystemExceptionLogDO;
|
||||
import cn.iocoder.mall.systemservice.service.systemlog.bo.SystemExceptionLogPageBO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
@ -18,7 +18,7 @@ import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum.FORBIDDEN;
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.FORBIDDEN;
|
||||
|
||||
/**
|
||||
* 权限 Manager
|
||||
|
@ -17,7 +17,7 @@ import cn.iocoder.mall.systemservice.service.admin.bo.AdminUpdateBO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
@Service
|
||||
public class AdminService {
|
||||
|
@ -17,7 +17,7 @@ import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 部门 Service
|
||||
|
@ -14,7 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 数据字典 Service
|
||||
|
@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* OAuth2.0 Service
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.mall.systemservice.service.permission;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.common.framework.exception.GlobalException;
|
||||
import cn.iocoder.common.framework.util.CollectionUtils;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.admin.AdminDO;
|
||||
@ -21,8 +22,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeEnum.FORBIDDEN;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.FORBIDDEN;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 权限 Service
|
||||
@ -151,7 +152,7 @@ public class PermissionService {
|
||||
// 权限验证
|
||||
List<RoleResourceDO> roleResourceDOs = roleResourceMapper.selectListByResourceIds(permissionIds);
|
||||
if (CollectionUtil.isEmpty(roleResourceDOs)) { // 资源未授予任何角色,必然权限验证不通过
|
||||
throw ServiceExceptionUtil.exception(FORBIDDEN);
|
||||
throw new GlobalException(FORBIDDEN);
|
||||
}
|
||||
Map<Integer, List<Integer>> resourceRoleMap = CollectionUtils.convertMultiMap(roleResourceDOs,
|
||||
RoleResourceDO::getResourceId, RoleResourceDO::getRoleId);
|
||||
|
@ -7,7 +7,7 @@ import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.ResourceDO;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.dataobject.permission.RoleResourceDO;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.ResourceMapper;
|
||||
import cn.iocoder.mall.systemservice.dal.mysql.mapper.permission.RoleResourceMapper;
|
||||
import cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum;
|
||||
import cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants;
|
||||
import cn.iocoder.mall.systemservice.enums.permission.ResourceIdEnum;
|
||||
import cn.iocoder.mall.systemservice.enums.permission.ResourceTypeEnum;
|
||||
import cn.iocoder.mall.systemservice.service.permission.bo.ResourceBO;
|
||||
@ -22,7 +22,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 资源 Service
|
||||
@ -83,11 +83,11 @@ public class ResourceService {
|
||||
public void deleteResource(Integer resourceId) {
|
||||
// 校验更新的资源是否存在
|
||||
if (resourceMapper.selectById(resourceId) == null) {
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.RESOURCE_NOT_EXISTS);
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.RESOURCE_NOT_EXISTS);
|
||||
}
|
||||
// 校验是否还有子资源
|
||||
if (resourceMapper.selectCountByPid(resourceId) > 0) {
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.RESOURCE_EXISTS_CHILDREN);
|
||||
throw ServiceExceptionUtil.exception(SystemErrorCodeConstants.RESOURCE_EXISTS_CHILDREN);
|
||||
}
|
||||
// 校验删除的资源是否存在
|
||||
if (resourceMapper.selectById(resourceId) == null) {
|
||||
|
@ -26,7 +26,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.*;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 角色 Service
|
||||
|
@ -13,8 +13,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.SYSTEM_EXCEPTION_LOG_NOT_FOUND;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeEnum.SYSTEM_EXCEPTION_LOG_PROCESSED;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.SYSTEM_EXCEPTION_LOG_NOT_FOUND;
|
||||
import static cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants.SYSTEM_EXCEPTION_LOG_PROCESSED;
|
||||
|
||||
/**
|
||||
* 系统异常日志 Service
|
||||
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.mall.system.biz.dao.errorcode;
|
||||
|
||||
import cn.iocoder.mall.mybatis.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.mall.system.biz.dataobject.authorization.RoleDO;
|
||||
import cn.iocoder.mall.system.biz.dataobject.authorization.RoleResourceDO;
|
||||
import cn.iocoder.mall.system.biz.dataobject.errorcode.ErrorCodeDO;
|
||||
import cn.iocoder.mall.system.biz.dto.authorization.RolePageDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.errorcode.ErrorCodeDTO;
|
||||
import cn.iocoder.mall.system.biz.dto.errorcode.ErrorCodePageDTO;
|
||||
import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum;
|
||||
import cn.iocoder.mall.system.biz.enums.errorcode.ErrorCodeTypeEnum;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.system.biz.dataobject.errorcode;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.system.biz.dataobject.sms;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.BaseDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.system.biz.dataobject.sms;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.mall.system.biz.dataobject.sms;
|
||||
|
||||
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -2,7 +2,7 @@ package cn.iocoder.mall.system.biz.service.errorcode;
|
||||
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.system.biz.bo.errorcode.ErrorCodeBO;
|
||||
import cn.iocoder.mall.system.biz.convert.errorcode.ErrorCodeConvert;
|
||||
import cn.iocoder.mall.system.biz.dao.errorcode.ErrorCodeMapper;
|
||||
|
@ -3,7 +3,7 @@ package cn.iocoder.mall.system.biz.service.sms;
|
||||
import cn.iocoder.common.framework.exception.ServiceException;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.system.biz.bo.smsSign.ListSmsSignBO;
|
||||
import cn.iocoder.mall.system.biz.bo.smsSign.SmsSignBO;
|
||||
import cn.iocoder.mall.system.biz.bo.smsTemplate.ListSmsTemplateBO;
|
||||
@ -23,17 +23,14 @@ import cn.iocoder.mall.system.biz.dto.smsTemplate.ListSmsTemplateDTO;
|
||||
import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum;
|
||||
import cn.iocoder.mall.system.biz.enums.sms.SmsApplyStatusEnum;
|
||||
import cn.iocoder.mall.system.biz.enums.sms.SmsPlatformEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user