Просмотр исходного кода

不用type 4 了,可以屏蔽科学记数法的问题了

4.1.3.A
jueyue 10 лет назад
Родитель
Сommit
14b81c5936
9 измененных файлов: 27 добавлений и 11 удалений
  1. +1
    -1
      deploy.bat
  2. +1
    -1
      easypoi-annotation/pom.xml
  3. +1
    -1
      easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java
  4. +1
    -1
      easypoi-base/pom.xml
  5. +1
    -1
      easypoi-base/src/main/java/org/jeecgframework/poi/excel/html/ExcelToHtmlServer.java
  6. +4
    -3
      easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java
  7. +15
    -0
      easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java
  8. +1
    -1
      easypoi-web/pom.xml
  9. +2
    -2
      pom.xml

+ 1
- 1
deploy.bat Просмотреть файл

@@ -1 +1 @@
cmd /k mvn clean deploy -D skipTest
cmd /k mvn clean deploy -Dmaven.test.skip=true -Dgpg.passphrase=jeecg123456

+ 1
- 1
easypoi-annotation/pom.xml Просмотреть файл

@@ -4,7 +4,7 @@
<parent>
<groupId>org.jeecg</groupId>
<artifactId>easypoi</artifactId>
<version>2.1.2</version>
<version>2.1.3-SNAPSHOT</version>
</parent>
<artifactId>easypoi-annotation</artifactId>
<description>基础注解类,解耦合</description>

+ 1
- 1
easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java Просмотреть файл

@@ -107,7 +107,7 @@ public @interface Excel {
public String savePath() default "upload";
/**
* 导出类型 1 是文本 2 是图片,3是函数 默认是文本 ,4 String-Long型
* 导出类型 1 是文本 2 是图片,3是函数 默认是文本
*/
public int type() default 1;


+ 1
- 1
easypoi-base/pom.xml Просмотреть файл

@@ -4,7 +4,7 @@
<parent>
<groupId>org.jeecg</groupId>
<artifactId>easypoi</artifactId>
<version>2.1.2</version>
<version>2.1.3-SNAPSHOT</version>
</parent>
<artifactId>easypoi-base</artifactId>
<dependencies>


+ 1
- 1
easypoi-base/src/main/java/org/jeecgframework/poi/excel/html/ExcelToHtmlServer.java Просмотреть файл

@@ -31,7 +31,7 @@ public class ExcelToHtmlServer {
private int firstColumn;
private int endColumn;
private static final String COL_HEAD_CLASS = "colHeader";
private static final String ROW_HEAD_CLASS = "rowHeader";
//private static final String ROW_HEAD_CLASS = "rowHeader";
private static final String DEFAULTS_CLASS = "excelDefaults";


+ 4
- 3
easypoi-base/src/main/java/org/jeecgframework/poi/excel/imports/CellValueServer.java Просмотреть файл

@@ -33,6 +33,7 @@ import org.jeecgframework.poi.excel.entity.sax.SaxReadCellEntity;
import org.jeecgframework.poi.exception.excel.ExcelImportException;
import org.jeecgframework.poi.exception.excel.enums.ExcelImportEnum;
import org.jeecgframework.poi.handler.inter.IExcelDataHandler;
import org.jeecgframework.poi.util.PoiPublicUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -208,9 +209,9 @@ public class CellValueServer {
if (result instanceof String) {
return result;
}
// 想要的结果是long
if (entity.getType() == 4 && result instanceof Double) {
result = String.valueOf(((Double) result).longValue());
// double类型防止科学计数法
if (result instanceof Double) {
return PoiPublicUtil.doubleToString((Double) result);
}
return String.valueOf(result);
}


+ 15
- 0
easypoi-base/src/main/java/org/jeecgframework/poi/util/PoiPublicUtil.java Просмотреть файл

@@ -20,6 +20,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
@@ -460,4 +461,18 @@ public final class PoiPublicUtil {
object, paramsArr, ++index);
}
/**
* double to String 防止科学计数法
* @param value
* @return
*/
public static String doubleToString(Double value) {
String temp = value.toString();
if (temp.contains("E")) {
BigDecimal bigDecimal = new BigDecimal(temp);
temp = bigDecimal.toPlainString();
}
return temp;
}
}

+ 1
- 1
easypoi-web/pom.xml Просмотреть файл

@@ -4,7 +4,7 @@
<parent>
<groupId>org.jeecg</groupId>
<artifactId>easypoi</artifactId>
<version>2.1.2</version>
<version>2.1.3-SNAPSHOT</version>
</parent>
<artifactId>easypoi-web</artifactId>
<dependencies>


+ 2
- 2
pom.xml Просмотреть файл

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jeecg</groupId>
<artifactId>easypoi</artifactId>
<version>2.1.2</version>
<version>2.1.3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>easypoi</name>
<modules>
@@ -38,7 +38,7 @@
</developers>
<properties>
<sub.version>2.1.2</sub.version>
<sub.version>2.1.3-SNAPSHOT</sub.version>
<poi.version>3.9</poi.version>
<xerces.version>2.9.1</xerces.version>
<guava.version>16.0.1</guava.version>


Загрузка…
Отмена
Сохранить