Commit 36ccdb2c by 张祺

修改easyexcel的版本,并修改导入excel数据的处理

parent b4dcd4d2
......@@ -22,7 +22,7 @@
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
<akka.version>2.6.0-M4</akka.version>
<poi.version>4.1.1</poi.version>
<easyExcel.version>2.1.1</easyExcel.version>
<easyExcel.version>2.2.6</easyExcel.version>
<fastjson.version>1.2.70</fastjson.version>
</properties>
......
......@@ -4,6 +4,7 @@ import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.NumberFormat;
/**
......@@ -12,6 +13,7 @@ import java.text.NumberFormat;
public class ExcelUtil {
private static NumberFormat numberFormat = NumberFormat.getNumberInstance();
private static DecimalFormat df = new DecimalFormat("#.##########");
static {
numberFormat.setRoundingMode(RoundingMode.HALF_UP);
......@@ -31,7 +33,7 @@ public class ExcelUtil {
cellValue = xssfCell.getStringCellValue();
} else if (CellType.NUMERIC.equals(cellType)) {
double d = xssfCell.getNumericCellValue();
cellValue = String.valueOf(numberFormat.format(d));
cellValue = df.format(d);
} else if (CellType.BOOLEAN.equals(cellType)) {
cellValue = String.valueOf(xssfCell.getBooleanCellValue());
} else if (CellType.FORMULA.equals(cellType)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment