소스 검색

支持前缀

4.2.0.A
Stormeye Wu 5 년 전
부모
커밋
09f323cc30
10개의 변경된 파일44개의 추가작업 그리고 4개의 파일을 삭제
  1. +1
    -1
      easypoi-annotation/pom.xml
  2. +5
    -0
      easypoi-annotation/src/main/java/cn/afterturn/easypoi/excel/annotation/Excel.java
  3. +1
    -1
      easypoi-base/pom.xml
  4. +4
    -0
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/params/ExcelExportEntity.java
  5. +4
    -0
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/params/ExcelImportEntity.java
  6. +4
    -0
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/base/ExportCommonService.java
  7. +18
    -0
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/CellValueService.java
  8. +1
    -0
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/base/ImportBaseService.java
  9. +1
    -1
      easypoi-web/pom.xml
  10. +5
    -1
      pom.xml

+ 1
- 1
easypoi-annotation/pom.xml 파일 보기

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi</artifactId> <artifactId>easypoi</artifactId>
<version>4.2.0</version>
<version>4.2.0.A</version>
</parent> </parent>
<artifactId>easypoi-annotation</artifactId> <artifactId>easypoi-annotation</artifactId>
<description>base annotation</description> <description>base annotation</description>

+ 5
- 0
easypoi-annotation/src/main/java/cn/afterturn/easypoi/excel/annotation/Excel.java 파일 보기

@@ -67,6 +67,11 @@ public @interface Excel {
*/ */
public int imageType() default 1; public int imageType() default 1;
/**
* 文字前缀,如1234567890112242335 变成`1234567890112242335
*/
public String prefix() default "";
/** /**
* 文字后缀,如% 90 变成90% * 文字后缀,如% 90 变成90%
*/ */


+ 1
- 1
easypoi-base/pom.xml 파일 보기

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi</artifactId> <artifactId>easypoi</artifactId>
<version>4.2.0</version>
<version>4.2.0.A</version>
</parent> </parent>
<artifactId>easypoi-base</artifactId> <artifactId>easypoi-base</artifactId>
<dependencies> <dependencies>


+ 4
- 0
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/params/ExcelExportEntity.java 파일 보기

@@ -84,6 +84,10 @@ public class ExcelExportEntity extends ExcelBaseEntity implements Comparable<Exc
* 合并依赖` * 合并依赖`
*/ */
private int[] mergeRely; private int[] mergeRely;
/**
* 前缀
*/
private String prefix;
/** /**
* 后缀 * 后缀
*/ */


+ 4
- 0
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/params/ExcelImportEntity.java 파일 보기

@@ -44,6 +44,10 @@ public class ExcelImportEntity extends ExcelBaseEntity {
* 对应exportType * 对应exportType
*/ */
private String classType; private String classType;
/**
* 前缀
*/
private String prefix;
/** /**
* 后缀 * 后缀
*/ */


+ 4
- 0
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/base/ExportCommonService.java 파일 보기

@@ -223,6 +223,9 @@ public class ExportCommonService {
if (needHandlerList != null && needHandlerList.contains(entity.getName())) { if (needHandlerList != null && needHandlerList.contains(entity.getName())) {
value = dataHandler.exportHandler(obj, entity.getName(), value); value = dataHandler.exportHandler(obj, entity.getName(), value);
} }
if (StringUtils.isNotBlank(entity.getPrefix()) && value != null) {
value = entity.getPrefix() + value;
}
if (StringUtils.isNotEmpty(entity.getSuffix()) && value != null) { if (StringUtils.isNotEmpty(entity.getSuffix()) && value != null) {
value = value + entity.getSuffix(); value = value + entity.getSuffix();
} }
@@ -262,6 +265,7 @@ public class ExportCommonService {
Integer.valueOf(PoiPublicUtil.getValueByTargetId(excel.orderNum(), targetId, "0"))); Integer.valueOf(PoiPublicUtil.getValueByTargetId(excel.orderNum(), targetId, "0")));
excelEntity.setWrap(excel.isWrap()); excelEntity.setWrap(excel.isWrap());
excelEntity.setExportImageType(excel.imageType()); excelEntity.setExportImageType(excel.imageType());
excelEntity.setPrefix(excel.prefix());
excelEntity.setSuffix(excel.suffix()); excelEntity.setSuffix(excel.suffix());
excelEntity.setDatabaseFormat(excel.databaseFormat()); excelEntity.setDatabaseFormat(excel.databaseFormat());
excelEntity.setFormat( excelEntity.setFormat(


+ 18
- 0
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/CellValueService.java 파일 보기

@@ -227,6 +227,7 @@ public class CellValueService {
result = cell; result = cell;
} }
if (entity != null) { if (entity != null) {
result = handlerPrefix(entity.getPrefix(), result);
result = handlerSuffix(entity.getSuffix(), result); result = handlerSuffix(entity.getSuffix(), result);
result = replaceValue(entity.getReplace(), result); result = replaceValue(entity.getReplace(), result);
result = replaceValue(entity.getReplace(), result); result = replaceValue(entity.getReplace(), result);
@@ -257,12 +258,29 @@ public class CellValueService {
Type[] ts = setMethod.getGenericParameterTypes(); Type[] ts = setMethod.getGenericParameterTypes();
String classFullName = ts[0].toString(); String classFullName = ts[0].toString();
Object result = cellEntity.getValue(); Object result = cellEntity.getValue();
result = handlerPrefix(entity.getPrefix(), result);
result = handlerSuffix(entity.getSuffix(), result); result = handlerSuffix(entity.getSuffix(), result);
result = replaceValue(entity.getReplace(), result); result = replaceValue(entity.getReplace(), result);
result = handlerValue(dataHandler, object, result, titleString); result = handlerValue(dataHandler, object, result, titleString);
return getValueByType(classFullName, result, entity, (Class) ts[0]); return getValueByType(classFullName, result, entity, (Class) ts[0]);
} }


/**
* 把前缀删除掉
*
* @param result
* @param prefix
* @return
*/
private Object handlerPrefix(String prefix, Object result) {
if (StringUtils.isNotEmpty(prefix) && result != null
&& result.toString().startsWith(prefix)) {
String temp = result.toString();
return temp.substring(prefix.length(), temp.length());
}
return result;
}

/** /**
* 把后缀删除掉 * 把后缀删除掉
* *


+ 1
- 0
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/base/ImportBaseService.java 파일 보기

@@ -70,6 +70,7 @@ public class ImportBaseService {
excelEntity.setSaveType(excel.imageType()); excelEntity.setSaveType(excel.imageType());
excelEntity.setReplace(excel.replace()); excelEntity.setReplace(excel.replace());
excelEntity.setDatabaseFormat(excel.databaseFormat()); excelEntity.setDatabaseFormat(excel.databaseFormat());
excelEntity.setPrefix(excel.prefix());
excelEntity.setSuffix(excel.suffix()); excelEntity.setSuffix(excel.suffix());
excelEntity.setImportField(Boolean excelEntity.setImportField(Boolean
.valueOf(PoiPublicUtil.getValueByTargetId(excel.isImportField(), targetId, "false"))); .valueOf(PoiPublicUtil.getValueByTargetId(excel.isImportField(), targetId, "false")));


+ 1
- 1
easypoi-web/pom.xml 파일 보기

@@ -4,7 +4,7 @@
<parent> <parent>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi</artifactId> <artifactId>easypoi</artifactId>
<version>4.2.0</version>
<version>4.2.0.A</version>
</parent> </parent>
<artifactId>easypoi-web</artifactId> <artifactId>easypoi-web</artifactId>
<dependencies> <dependencies>


+ 5
- 1
pom.xml 파일 보기

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi</artifactId> <artifactId>easypoi</artifactId>
<version>4.2.0</version>
<version>4.2.0.A</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>easypoi</name> <name>easypoi</name>
<modules> <modules>
@@ -46,7 +46,11 @@
</organization> </organization>


<properties> <properties>
<<<<<<< HEAD
<sub.version>4.2.0</sub.version> <sub.version>4.2.0</sub.version>
=======
<sub.version>4.1.3.A</sub.version>
>>>>>>> 支持前缀
<poi.version>4.1.1</poi.version> <poi.version>4.1.1</poi.version>
<xerces.version>2.9.1</xerces.version> <xerces.version>2.9.1</xerces.version>
<guava.version>16.0.1</guava.version> <guava.version>16.0.1</guava.version>


불러오는 중...
취소
저장