Merge branch 'main' of http://119.3.218.156:3000/GTsoft/mps-platform
This commit is contained in:
commit
2f0a10d5e7
@ -0,0 +1,32 @@
|
||||
package org.dromara.common.excel.convert;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import cn.idev.excel.converters.Converter;
|
||||
import cn.idev.excel.enums.CellDataTypeEnum;
|
||||
import cn.idev.excel.metadata.GlobalConfiguration;
|
||||
import cn.idev.excel.metadata.data.ReadCellData;
|
||||
import cn.idev.excel.metadata.data.WriteCellData;
|
||||
import cn.idev.excel.metadata.property.ExcelContentProperty;
|
||||
public class ExcelDateConvert implements Converter<Date> {
|
||||
|
||||
@Override
|
||||
public Class<Date> supportJavaTypeKey() {
|
||||
return Date.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WriteCellData<?> convertToExcelData(Date value,
|
||||
ExcelContentProperty contentProperty,
|
||||
GlobalConfiguration globalConfig) {
|
||||
String pattern = "yyyy-MM-dd"; // 默认格式
|
||||
if(contentProperty != null &&
|
||||
contentProperty.getDateTimeFormatProperty() != null){
|
||||
pattern = contentProperty.getDateTimeFormatProperty().getFormat();
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
return new WriteCellData<>(sdf.format(value));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDateConvert;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.mps.domain.MpsDetailEntry;
|
||||
|
||||
@ -79,7 +80,8 @@ public class MpsDetailEntryExportVo implements Serializable {
|
||||
/**
|
||||
* 数据日期
|
||||
*/
|
||||
@ExcelProperty(value = "数据日期")
|
||||
@ExcelProperty(value = "数据日期", converter = ExcelDateConvert.class)
|
||||
// @DateTimeFormat("yyyy/MM/dd") //指定格式
|
||||
private Date date;
|
||||
|
||||
// /**
|
||||
@ -98,7 +100,7 @@ public class MpsDetailEntryExportVo implements Serializable {
|
||||
* 客户类型(1-个人,2-对公)
|
||||
*/
|
||||
@ExcelProperty(value = "客户类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=个人,2=对公")
|
||||
@ExcelDictFormat(dictType = "mps_cust_type")
|
||||
private String custType;
|
||||
|
||||
/**
|
||||
|
@ -71,8 +71,7 @@ public class OriginalHntSgmxImportVo implements Serializable {
|
||||
/**
|
||||
* 实际金额(元)
|
||||
*/
|
||||
@ExcelProperty(value = "实际金额", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "元=")
|
||||
@ExcelProperty(value = "实际金额(元)")
|
||||
private String actualAmount;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user