|
@@ -229,15 +229,19 @@ public class ExcelUtil<T>
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- String dateFormat = field.getAnnotation(Excel.class).dateFormat();
|
|
|
- if (Validator.isNotEmpty(dateFormat))
|
|
|
+ if (val instanceof Double)
|
|
|
{
|
|
|
- val = DateUtils.parseDateToStr(dateFormat, (Date) val);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- val = Convert.toStr(val);
|
|
|
+ String dateFormat = field.getAnnotation(Excel.class).dateFormat();
|
|
|
+ if (Validator.isNotEmpty(dateFormat))
|
|
|
+ {
|
|
|
+ val = DateUtils.parseDateToStr(dateFormat, (Date) val);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ val = Convert.toStr(val);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && Validator.isNumber(Convert.toStr(val)))
|
|
@@ -1097,12 +1101,12 @@ public class ExcelUtil<T>
|
|
|
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
|
|
|
{
|
|
|
val = cell.getNumericCellValue();
|
|
|
- System.out.println(val);
|
|
|
if (DateUtil.isCellDateFormatted(cell))
|
|
|
{
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
+ /* SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
Date date = DateUtil.getJavaDate((Double) val);// POI Excel 日期格式转换
|
|
|
- val = sdf.format(date);
|
|
|
+ val = sdf.format(date);*/
|
|
|
+ val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
|
|
|
}
|
|
|
else
|
|
|
{
|