|
@@ -4,14 +4,20 @@ import com.alibaba.excel.converters.Converter;
|
|
|
import com.alibaba.excel.converters.ReadConverterContext;
|
|
|
import com.alibaba.excel.converters.WriteConverterContext;
|
|
|
import com.alibaba.excel.enums.CellDataTypeEnum;
|
|
|
-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 org.dromara.common.core.constant.DevelopmentOrderConstants;
|
|
|
|
|
|
/**
|
|
|
* 状态值转换到文本
|
|
|
- * 0=待处理,1=画图,2=确认,3=调色,4=排版,5=打版,6=完成
|
|
|
+ * 0待处理
|
|
|
+ * 1画图中
|
|
|
+ * 2确认中
|
|
|
+ * 3修改中
|
|
|
+ * 4调色中
|
|
|
+ * 5排版中
|
|
|
+ * 6打版中
|
|
|
+ * 7已完成
|
|
|
+ * 99已取消
|
|
|
*/
|
|
|
public class DevelopmentOrderStatusConverter implements Converter<Integer> {
|
|
|
@Override
|
|
@@ -21,47 +27,41 @@ public class DevelopmentOrderStatusConverter implements Converter<Integer> {
|
|
|
|
|
|
@Override
|
|
|
public CellDataTypeEnum supportExcelTypeKey() {
|
|
|
- return CellDataTypeEnum.NUMBER;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
|
|
|
- return Converter.super.convertToJavaData(cellData, contentProperty, globalConfiguration);
|
|
|
+ return CellDataTypeEnum.STRING;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Integer convertToJavaData(ReadConverterContext<?> context) throws Exception {
|
|
|
- //excelFlied convert javaObject
|
|
|
- String cellValue = context.getReadCellData().getStringValue();
|
|
|
- int status = Integer.parseInt(cellValue);
|
|
|
- return switch(cellValue){
|
|
|
- case "画图"->1;
|
|
|
- case "确认"->2;
|
|
|
- case "调色"->3;
|
|
|
- case "排版"->4;
|
|
|
- case "打版"->5;
|
|
|
+ String value = context.getReadCellData().getStringValue();
|
|
|
+ return switch (value) {
|
|
|
+ case "待处理" -> DevelopmentOrderConstants.PENDING_PROCESSING;
|
|
|
+ case "画图中" -> DevelopmentOrderConstants.IN_THE_DRAWING;
|
|
|
+ case "确认中" -> DevelopmentOrderConstants.CONFIRMING_IN_PROGRESS;
|
|
|
+ case "修改中" -> DevelopmentOrderConstants.UNDER_MODIFICATION;
|
|
|
+ case "调色中" -> DevelopmentOrderConstants.IN_COLOR_ADJUSTMENT;
|
|
|
+ case "排版中" -> DevelopmentOrderConstants.IN_TYPESETTING;
|
|
|
+ case "打版中" -> DevelopmentOrderConstants.PRINTING_IN_PROGRESS;
|
|
|
+ case "已完成" -> DevelopmentOrderConstants.COMPLETED;
|
|
|
+ case "已取消" -> DevelopmentOrderConstants.CANCELLED;
|
|
|
default -> -1;
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
|
|
|
- return Converter.super.convertToExcelData(value, contentProperty, globalConfiguration);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public WriteCellData<?> convertToExcelData(WriteConverterContext<Integer> context) throws Exception {
|
|
|
- //javaObject Filed convert excelFlied
|
|
|
- Integer status = context.getValue();
|
|
|
- String mes = switch(status){
|
|
|
- case 0->"待处理";
|
|
|
- case 1->"画图";
|
|
|
- case 2->"确认";
|
|
|
- case 3->"调色";
|
|
|
- case 4->"排版";
|
|
|
- case 5->"打版";
|
|
|
- default -> "非法状态";
|
|
|
+ int value = context.getValue();
|
|
|
+ String status = switch (value) {
|
|
|
+ case DevelopmentOrderConstants.PENDING_PROCESSING -> "待处理";
|
|
|
+ case DevelopmentOrderConstants.IN_THE_DRAWING -> "画图中";
|
|
|
+ case DevelopmentOrderConstants.CONFIRMING_IN_PROGRESS -> "确认中";
|
|
|
+ case DevelopmentOrderConstants.UNDER_MODIFICATION -> "修改中";
|
|
|
+ case DevelopmentOrderConstants.IN_COLOR_ADJUSTMENT -> "调色中";
|
|
|
+ case DevelopmentOrderConstants.IN_TYPESETTING -> "排版中";
|
|
|
+ case DevelopmentOrderConstants.PRINTING_IN_PROGRESS -> "打版中";
|
|
|
+ case DevelopmentOrderConstants.COMPLETED -> "已完成";
|
|
|
+ case DevelopmentOrderConstants.CANCELLED -> "已取消";
|
|
|
+ default -> "未知状态";
|
|
|
};
|
|
|
- return new WriteCellData<String>(mes);
|
|
|
+ return new WriteCellData<String>(status);
|
|
|
}
|
|
|
}
|