错误码的 Starter 的初始化,暂未完成
This commit is contained in:
@@ -3,18 +3,21 @@ package cn.iocoder.mall.systemservice.enums.errorcode;
|
||||
/**
|
||||
* 错误码的类型枚举
|
||||
*
|
||||
* 考虑到便利性,我们会扫描每个项目的错误码枚举类,自动添加到错误码数据库中,并标记为 {@link #AUTO_GENERATION} 类型
|
||||
* 经过管理员手动编辑过的错误码,会标记为 {@link #MANUAL_OPERATION} 类型,并禁止自动同步
|
||||
*
|
||||
* @author ding
|
||||
*/
|
||||
public enum ErrorCodeTypeEnum {
|
||||
|
||||
/**
|
||||
* 内置错误码
|
||||
* 自动生成
|
||||
*/
|
||||
SYSTEM(1),
|
||||
AUTO_GENERATION(1),
|
||||
/**
|
||||
* 自定义错误码
|
||||
* 手动处理
|
||||
*/
|
||||
CUSTOM(2);
|
||||
MANUAL_OPERATION(2);
|
||||
|
||||
private final Integer type;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.errorcode;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.systemservice.rpc.errorcode.dto.ErrorCodeAutoGenerateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.errorcode.vo.ErrorCodeVO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface ErrorCodeRpc {
|
||||
|
||||
CommonResult<List<ErrorCodeVO>> listErrorCodes(String group, Date minUpdateTime);
|
||||
|
||||
CommonResult<Boolean> autoGenerateErrorCodes(ErrorCodeAutoGenerateDTO autoGenerateDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.errorcode.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodeAutoGenerateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 错误码编码
|
||||
*/
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误码错误提示
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 错误码分组
|
||||
*/
|
||||
private String group;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.errorcode.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 错误码 VO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 错误码编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 错误码编码
|
||||
*/
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误码错误提示
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 错误码类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 错误码分组
|
||||
*/
|
||||
private String group;
|
||||
/**
|
||||
* 错误码备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -23,6 +23,11 @@
|
||||
<artifactId>system-service-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>mall-spring-boot-starter-system-error-code</artifactId> <!-- 错误码 -->
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 和 Config 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.mall.systemservice.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync(proxyTargetClass = true) // 开启 Spring Async 异步的功能
|
||||
public class AsyncConfiguration {
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package cn.iocoder.mall.systemservice.dal.mysql.dataobject.datadict;
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
@@ -16,6 +17,7 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@TableName("system_data_dict")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class DataDictDO extends DeletableDO {
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.mall.systemservice.dal.mysql.dataobject.errorcode;
|
||||
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import cn.iocoder.mall.systemservice.enums.errorcode.ErrorCodeTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 错误码实体
|
||||
*/
|
||||
@TableName(value = "error_code")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class ErrorCodeDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 错误码编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 错误码编码
|
||||
*/
|
||||
private Integer code;
|
||||
/**
|
||||
* 错误码错误提示
|
||||
*/
|
||||
private String message;
|
||||
/**
|
||||
* 错误码类型
|
||||
*
|
||||
* 外键 {@link ErrorCodeTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 错误码分组
|
||||
*
|
||||
* 一般情况下,可以采用应用名
|
||||
*/
|
||||
private Integer group;
|
||||
/**
|
||||
* 错误码备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.mall.systemservice.rpc.errorcode;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.systemservice.rpc.errorcode.dto.ErrorCodeAutoGenerateDTO;
|
||||
import cn.iocoder.mall.systemservice.rpc.errorcode.vo.ErrorCodeVO;
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service(version = "${dubbo.provider.ErrorCodeRpc.version}")
|
||||
public class ErrorCodeRpcImpl implements ErrorCodeRpc {
|
||||
|
||||
@Override
|
||||
public CommonResult<List<ErrorCodeVO>> listErrorCodes(String group, Date minUpdateTime) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> autoGenerateErrorCodes(ErrorCodeAutoGenerateDTO autoGenerateDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,3 +52,10 @@ dubbo:
|
||||
version: 1.0.0
|
||||
SystemAccessLogRpc:
|
||||
version: 1.0.0
|
||||
ErrorCodeRpc:
|
||||
version: 1.0.0
|
||||
|
||||
# Mall 配置项
|
||||
mall:
|
||||
error-code:
|
||||
constants-class: cn.iocoder.mall.systemservice.enums.SystemErrorCodeConstants
|
||||
|
||||
Reference in New Issue
Block a user