public class CarOilingRecordImportVO {
/**
* 油卡号
*/
@ExcelProperty(value = "卡号/客户编号")
@NotNull(message = "卡号/客户编号不能为空")
private String cardCode;
/**
* 车牌号
*/
@ExcelProperty(value = "车辆牌照")
private String carCode;
/**
* 交易日期
*/
@NotNull(message = "交易时间不能为空")
@ExcelProperty(value = "交易时间")
private Date dealDate;
/**
* 金额
*/
@ExcelProperty(value = "金额(元)")
@NotNull(message = "金额(元)不能为空")
private BigDecimal sumMoney;
/**
* 油品
*/
@ExcelProperty(value = "商品种类")
@NotNull(message = "商品种类不能为空")
private String oils;
/**
* 数量
*/
@ExcelProperty(value = "油量(升)")
@NotNull(message = "油量(升)不能为空")
private Double quantity;
/**
* 地点
*/
@ExcelProperty(value = "受理机构")
private String location;
/**
* 交易流水号
*/
@ExcelProperty(value = "交易流水号")
@NotNull(message = "交易流水号不能为空")
private String tradeSerialNum;
/**
* 交易类型
*/
@ExcelProperty(value = "交易类型")
@NotNull(message = "交易类型不能为空")
private String tradeType;
/**
* 交易状态
*/
@ExcelProperty(value = "交易状态")
@NotNull(message = "交易状态不能为空")
private String tradeStatus;
/**
* 折扣
*/
@ExcelProperty(value = "折扣(元)")
@NotNull(message = "折扣不能为空")
private BigDecimal discount;
/**
* 来源类型
*/
private Integer sourceType;
}
sourceType没有@ExcelProperty 导致值赋字段错乱
private static Object doConvertToJavaObject(ReadCellData<?> cellData, Class<?> clazz,ExcelContentProperty contentProperty, Map<ConverterKey, Converter<?>> converterMap, AnalysisContext context,Integer rowIndex, Integer columnIndex) {Converter<?> converter = null;if (contentProperty != null) {converter = contentProperty.getConverter();}boolean canNotConverterEmpty = cellData.getType() == CellDataTypeEnum.EMPTY&& !(converter instanceof NullableObjectConverter);if (canNotConverterEmpty) {return null;}if (converter == null) {converter = converterMap.get(ConverterKeyBuild.buildKey(clazz, cellData.getType()));}if (converter == null) {throw new ExcelDataConvertException(rowIndex, columnIndex, cellData, contentProperty,"Converter not found, convert " + cellData.getType() + " to " + clazz.getName());}try {return converter.convertToJavaData(new ReadConverterContext<>(cellData, contentProperty, context));} catch (Exception e) {throw new ExcelDataConvertException(rowIndex, columnIndex, cellData, contentProperty,"Convert data " + cellData + " to " + clazz + " error ", e);}java.lang.NumberFormatException: For input string: "2024-08-22"