From 39ac72688b37ec863d8aa1ea3acd66bc55ba3b81 Mon Sep 17 00:00:00 2001 From: lvxinran Date: Wed, 12 May 2021 09:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E8=A1=A8=E5=B7=A5=E5=85=B7=E6=94=AF?= =?UTF-8?q?=E6=8C=81long=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/src/main/java/ExcelUtils.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/src/main/java/ExcelUtils.java b/test/src/main/java/ExcelUtils.java index cdc3fc337..ff901438b 100644 --- a/test/src/main/java/ExcelUtils.java +++ b/test/src/main/java/ExcelUtils.java @@ -394,10 +394,17 @@ public class ExcelUtils { //判断cell类型 switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: { - if (cellType != null && cellType.toString().contains("float")){ - cellValue = cell.getNumericCellValue(); - }else{ + + if(cellType==null){ cellValue = (int) cell.getNumericCellValue(); + }else{ + if(cellType.toString().contains("float")){ + cellValue = cell.getNumericCellValue(); + }else if(cellType.toString().contains("long")){ + cellValue = (long)cell.getNumericCellValue(); + }else{ + cellValue = (int) cell.getNumericCellValue(); + } } break; }