Commit 0e2b97a886f403d6e42f3e4195b592902529c49f

Authored by RuoYi
1 parent 1c7a5faa

升级poi到最新版本4.1.2

... ... @@ -28,7 +28,7 @@
28 28 <jna.version>5.6.0</jna.version>
29 29 <commons.io.version>2.5</commons.io.version>
30 30 <commons.fileupload.version>1.3.3</commons.fileupload.version>
31   - <poi.version>3.17</poi.version>
  31 + <poi.version>4.1.2</poi.version>
32 32 <velocity.version>1.7</velocity.version>
33 33 <jwt.version>0.9.1</jwt.version>
34 34 </properties>
... ...
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
... ... @@ -18,7 +18,6 @@ import java.util.Map;
18 18 import java.util.Set;
19 19 import java.util.UUID;
20 20 import java.util.stream.Collectors;
21   -import org.apache.poi.hssf.usermodel.HSSFDateUtil;
22 21 import org.apache.poi.ss.usermodel.BorderStyle;
23 22 import org.apache.poi.ss.usermodel.Cell;
24 23 import org.apache.poi.ss.usermodel.CellStyle;
... ... @@ -516,12 +515,10 @@ public class ExcelUtil&lt;T&gt;
516 515 {
517 516 if (ColumnType.STRING == attr.cellType())
518 517 {
519   - cell.setCellType(CellType.STRING);
520 518 cell.setCellValue(StringUtils.isNull(value) ? attr.defaultValue() : value + attr.suffix());
521 519 }
522 520 else if (ColumnType.NUMERIC == attr.cellType())
523 521 {
524   - cell.setCellType(CellType.NUMERIC);
525 522 cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
526 523 }
527 524 }
... ... @@ -980,10 +977,10 @@ public class ExcelUtil&lt;T&gt;
980 977 Cell cell = row.getCell(column);
981 978 if (StringUtils.isNotNull(cell))
982 979 {
983   - if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
  980 + if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA)
984 981 {
985 982 val = cell.getNumericCellValue();
986   - if (HSSFDateUtil.isCellDateFormatted(cell))
  983 + if (DateUtil.isCellDateFormatted(cell))
987 984 {
988 985 val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
989 986 }
... ... @@ -999,15 +996,15 @@ public class ExcelUtil&lt;T&gt;
999 996 }
1000 997 }
1001 998 }
1002   - else if (cell.getCellTypeEnum() == CellType.STRING)
  999 + else if (cell.getCellType() == CellType.STRING)
1003 1000 {
1004 1001 val = cell.getStringCellValue();
1005 1002 }
1006   - else if (cell.getCellTypeEnum() == CellType.BOOLEAN)
  1003 + else if (cell.getCellType() == CellType.BOOLEAN)
1007 1004 {
1008 1005 val = cell.getBooleanCellValue();
1009 1006 }
1010   - else if (cell.getCellTypeEnum() == CellType.ERROR)
  1007 + else if (cell.getCellType() == CellType.ERROR)
1011 1008 {
1012 1009 val = cell.getErrorCellValue();
1013 1010 }
... ...