dcs 3 月之前
父节点
当前提交
63532686f8
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      virgo.api/src/main/java/com/bosshand/virgo/api/util/excel/ExcelUtils.java

+ 8 - 3
virgo.api/src/main/java/com/bosshand/virgo/api/util/excel/ExcelUtils.java

@@ -26,7 +26,6 @@ import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.Map.Entry;
-import java.util.regex.Pattern;
 
 /**
  * Excel导入导出工具类
@@ -369,13 +368,19 @@ public class ExcelUtils {
         }
         // 数字类型
         if (cell.getCellTypeEnum() == CellType.NUMERIC) {
-            String s = cell.getNumericCellValue() + "";
+
+            DataFormatter formatter = new DataFormatter();
+            String s = formatter.formatCellValue(cell);
+
+            return s;
+
+            /*String s = cell.getNumericCellValue() + "";
             // 去掉尾巴上的小数点0
             if (Pattern.matches(".*\\.0*", s)) {
                 return s.split("\\.")[0];
             } else {
                 return s;
-            }
+            }*/
         }
         // 布尔值类型
         if (cell.getCellTypeEnum() == CellType.BOOLEAN) {