Browse Source

修复导入数字类型时,小数位只有四位的问题

欧阳劲驰 1 tháng trước cách đây
mục cha
commit
dd7d6ede24

+ 1 - 3
src/main/java/com/shkpr/service/alambizplugin/commtools/ExcelUtils.java

@@ -17,7 +17,6 @@ import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -380,8 +379,7 @@ public class ExcelUtils {
                     if (DateUtil.isCellDateFormatted(cell)) {
                         value = TimeTool.convertDateObj2DateStr(cell.getDateCellValue(), cell.getCellStyle().getDataFormatString());
                     } else if (String.valueOf(cell.getNumericCellValue()).contains(".")) {
-                        DecimalFormat df = new DecimalFormat("#.####");
-                        value = df.format(cell.getNumericCellValue());
+                        value = String.format("%f", cell.getNumericCellValue());
                     } else
                         value = String.valueOf(cell.getNumericCellValue());
                 }