update ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java.

替换已过时的方法以及类
This commit is contained in:
Hacker 2020-07-07 13:05:57 +08:00 committed by Gitee
parent 23b98a3ef8
commit 4309b6cfe0
1 changed files with 7 additions and 6 deletions

View File

@ -905,12 +905,13 @@ public class ExcelUtil<T>
Cell cell = row.getCell(column); Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell)) if (StringUtils.isNotNull(cell))
{ {
if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA) if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
{ {
val = cell.getNumericCellValue(); val = cell.getNumericCellValue();
if (HSSFDateUtil.isCellDateFormatted(cell)) if (DateUtil.isCellDateFormatted(cell))
{ {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 // POI Excel 日期格式转换
val = DateUtil.getJavaDate((Double) val);
} }
else else
{ {
@ -924,15 +925,15 @@ public class ExcelUtil<T>
} }
} }
} }
else if (cell.getCellTypeEnum() == CellType.STRING) else if (cell.getCellType() == CellType.STRING)
{ {
val = cell.getStringCellValue(); val = cell.getStringCellValue();
} }
else if (cell.getCellTypeEnum() == CellType.BOOLEAN) else if (cell.getCellType() == CellType.BOOLEAN)
{ {
val = cell.getBooleanCellValue(); val = cell.getBooleanCellValue();
} }
else if (cell.getCellTypeEnum() == CellType.ERROR) else if (cell.getCellType() == CellType.ERROR)
{ {
val = cell.getErrorCellValue(); val = cell.getErrorCellValue();
} }