1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cn.iocoder.yudao.framework.excel.core.enums;
 
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
 
/**
 * Excel 相关的错误码
 *
 * <p>统一在 {@link cn.iocoder.yudao.framework.excel.core.util.ExcelUtils} 中抛出,
 * 让所有导入接口在遇到坏文件、格式不对、模板不匹配时都返回可读的中文提示,
 * 而不是含糊的「系统异常」500。</p>
 *
 * <p>错误码区间:1_099_000_000 ~ 1_099_999_999(框架级,避免与业务模块冲突)</p>
 *
 * @author 超级管理员
 */
public interface ExcelErrorCodeConstants {
 
    // ========== Excel 文件本身的问题 ==========
 
    ErrorCode EXCEL_FILE_EMPTY = new ErrorCode(1_099_000_001, "请选择要导入的 Excel 文件");
    ErrorCode EXCEL_FILE_READ_FAILED = new ErrorCode(1_099_000_002, "Excel 文件读取失败,请确认文件未损坏且为 .xls/.xlsx 格式");
    ErrorCode EXCEL_FILE_EMPTY_CONTENT = new ErrorCode(1_099_000_003, "Excel 内容为空,请按照模板填写数据后再导入");
 
    // ========== 模板不匹配 ==========
 
    ErrorCode EXCEL_HEAD_NOT_MATCH = new ErrorCode(1_099_000_010, "Excel 表头与导入模板不一致,请下载最新模板重新填写");
    ErrorCode EXCEL_TEMPLATE_NOT_MATCH = new ErrorCode(1_099_000_011, "Excel 模板版本过旧或不匹配,请下载最新模板重新填写");
 
    // ========== 单元格数据问题 ==========
 
    ErrorCode EXCEL_DATA_CONVERT_FAILED = new ErrorCode(1_099_000_020, "第 %d 行第 %d 列数据格式不正确:%s");
    ErrorCode EXCEL_DATA_ILLEGAL = new ErrorCode(1_099_000_021, "Excel 数据格式不正确,请检查填写内容后重试");
 
}