|
@@ -5,8 +5,9 @@ import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
|
|
import com.alibaba.excel.converters.Converter;
|
|
|
import com.alibaba.excel.enums.CellDataTypeEnum;
|
|
|
-import com.alibaba.excel.metadata.CellData;
|
|
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
|
|
+import com.alibaba.excel.metadata.data.ReadCellData;
|
|
|
+import com.alibaba.excel.metadata.data.WriteCellData;
|
|
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
@@ -29,11 +30,11 @@ public class DictConvert implements Converter<Object> {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
|
|
|
+ public Object convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty,
|
|
|
GlobalConfiguration globalConfiguration) {
|
|
|
// 使用字典解析
|
|
|
String type = getType(contentProperty);
|
|
|
- String label = cellData.getStringValue();
|
|
|
+ String label = readCellData.getStringValue();
|
|
|
String value = DictFrameworkUtils.parseDictDataValue(type, label);
|
|
|
if (value == null) {
|
|
|
log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label);
|
|
@@ -45,11 +46,11 @@ public class DictConvert implements Converter<Object> {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty,
|
|
|
- GlobalConfiguration globalConfiguration) {
|
|
|
+ public WriteCellData<String> convertToExcelData(Object object, ExcelContentProperty contentProperty,
|
|
|
+ GlobalConfiguration globalConfiguration) {
|
|
|
// 空时,返回空
|
|
|
if (object == null) {
|
|
|
- return new CellData<>("");
|
|
|
+ return new WriteCellData<>("");
|
|
|
}
|
|
|
|
|
|
// 使用字典格式化
|
|
@@ -58,10 +59,10 @@ public class DictConvert implements Converter<Object> {
|
|
|
String label = DictFrameworkUtils.getDictDataLabel(type, value);
|
|
|
if (label == null) {
|
|
|
log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value);
|
|
|
- return new CellData<>("");
|
|
|
+ return new WriteCellData<>("");
|
|
|
}
|
|
|
// 生成 Excel 小表格
|
|
|
- return new CellData<>(label);
|
|
|
+ return new WriteCellData<>(label);
|
|
|
}
|
|
|
|
|
|
private static String getType(ExcelContentProperty contentProperty) {
|