org.dromara.x-file-storage
diff --git a/continew-starter-excel/continew-starter-excel-core/pom.xml b/continew-starter-excel/continew-starter-excel-core/pom.xml
new file mode 100644
index 00000000..a4fc1652
--- /dev/null
+++ b/continew-starter-excel/continew-starter-excel-core/pom.xml
@@ -0,0 +1,17 @@
+
+
+ 4.0.0
+
+ top.continew
+ continew-starter-excel
+ ${revision}
+
+
+ continew-starter-excel-core
+ jar
+
+ ${project.artifactId}
+ ContiNew Starter Excel 文件处理模块 - 核心模块
+
\ No newline at end of file
diff --git a/continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelExport.java b/continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelExport.java
new file mode 100644
index 00000000..e1246881
--- /dev/null
+++ b/continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelExport.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package top.continew.excel.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Excel导出注解
+ *
+ * @author jiang4yu
+ * @since 2.13.0
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ExcelExport {
+
+ /**
+ * 字段名称
+ */
+ String value();
+
+ /**
+ * 导出排序先后: 数字越小越靠前(默认按Java类字段顺序导出)
+ */
+ int sort() default 0;
+
+ /**
+ * 导出映射,格式如:0-未知;1-男;2-女
+ */
+ String kv() default "";
+
+ /**
+ * 导出模板示例值(有值的话,直接取该值,不做映射)
+ */
+ String example() default "";
+
+}
\ No newline at end of file
diff --git a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelImport.java b/continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelImport.java
similarity index 51%
rename from continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelImport.java
rename to continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelImport.java
index 6f137c18..00497fa3 100644
--- a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelImport.java
+++ b/continew-starter-excel/continew-starter-excel-core/src/main/java/top/continew/excel/annotation/ExcelImport.java
@@ -1,4 +1,20 @@
-package top.continew.starter.file.poi.annotation;
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package top.continew.excel.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -6,7 +22,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
+ * Excel 导入注解
+ *
* @author jiang4yu
+ * @since 2.13.0
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
diff --git a/continew-starter-file/continew-starter-file-excel/pom.xml b/continew-starter-excel/continew-starter-excel-fastexcel/pom.xml
similarity index 55%
rename from continew-starter-file/continew-starter-file-excel/pom.xml
rename to continew-starter-excel/continew-starter-excel-fastexcel/pom.xml
index 567c8b04..7932290f 100644
--- a/continew-starter-file/continew-starter-file-excel/pom.xml
+++ b/continew-starter-excel/continew-starter-excel-fastexcel/pom.xml
@@ -5,18 +5,24 @@
4.0.0
top.continew
- continew-starter-file
+ continew-starter-excel
${revision}
- continew-starter-file-excel
+ continew-starter-excel-fastexcel
jar
${project.artifactId}
- ContiNew Starter 文件处理模块 - Excel
+ ContiNew Starter Excel 文件处理模块 - FastExcel
-
+
+
+ top.continew
+ continew-starter-excel-core
+
+
+
cn.idev.excel
fastexcel
diff --git a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBaseEnumConverter.java b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBaseEnumConverter.java
similarity index 97%
rename from continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBaseEnumConverter.java
rename to continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBaseEnumConverter.java
index c4dadc65..181a76c9 100644
--- a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBaseEnumConverter.java
+++ b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBaseEnumConverter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.file.excel.converter;
+package top.continew.starter.excel.converter;
import cn.idev.excel.converters.Converter;
import cn.idev.excel.enums.CellDataTypeEnum;
diff --git a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBigNumberConverter.java b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBigNumberConverter.java
similarity index 98%
rename from continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBigNumberConverter.java
rename to continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBigNumberConverter.java
index 855ecbf9..7a8d5df3 100644
--- a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelBigNumberConverter.java
+++ b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelBigNumberConverter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.file.excel.converter;
+package top.continew.starter.excel.converter;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
diff --git a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelListConverter.java b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelListConverter.java
similarity index 97%
rename from continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelListConverter.java
rename to continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelListConverter.java
index f86e2e8c..6b9ac40d 100644
--- a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/converter/ExcelListConverter.java
+++ b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/converter/ExcelListConverter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.file.excel.converter;
+package top.continew.starter.excel.converter;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
diff --git a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/util/ExcelUtils.java b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
similarity index 96%
rename from continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/util/ExcelUtils.java
rename to continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
index 7937cd09..7750794a 100644
--- a/continew-starter-file/continew-starter-file-excel/src/main/java/top/continew/starter/file/excel/util/ExcelUtils.java
+++ b/continew-starter-excel/continew-starter-excel-fastexcel/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package top.continew.starter.file.excel.util;
+package top.continew.starter.excel.util;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
@@ -25,7 +25,7 @@ import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.continew.starter.core.exception.BaseException;
-import top.continew.starter.file.excel.converter.ExcelBigNumberConverter;
+import top.continew.starter.excel.converter.ExcelBigNumberConverter;
import java.util.Collections;
import java.util.Date;
diff --git a/continew-starter-file/continew-starter-file-poi/pom.xml b/continew-starter-excel/continew-starter-excel-poi/pom.xml
similarity index 54%
rename from continew-starter-file/continew-starter-file-poi/pom.xml
rename to continew-starter-excel/continew-starter-excel-poi/pom.xml
index fad6c450..e8d2a2b3 100644
--- a/continew-starter-file/continew-starter-file-poi/pom.xml
+++ b/continew-starter-excel/continew-starter-excel-poi/pom.xml
@@ -3,37 +3,33 @@
4.0.0
top.continew
- continew-starter-file
+ continew-starter-excel
${revision}
- continew-starter-file-poi
- ContiNew Starter 文件处理模块 - POI
+ continew-starter-excel-poi
+ jar
+
+ ${project.artifactId}
+ ContiNew Starter Excel 文件处理模块 - POI
+
+
+ top.continew
+ continew-starter-excel-core
+
+
+
+
+ org.apache.poi
+ poi-ooxml
+
+
org.apache.httpcomponents.client5
httpclient5
-
-
- com.alibaba
- fastjson
-
-
- org.springframework
- spring-webmvc
-
-
- jakarta.servlet
- jakarta.servlet-api
-
-
-
- org.apache.poi
- poi-ooxml
- 5.4.1
-
diff --git a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/model/ExcelClassField.java b/continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/model/ExcelClassField.java
similarity index 66%
rename from continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/model/ExcelClassField.java
rename to continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/model/ExcelClassField.java
index 59dc0651..bc86a99d 100644
--- a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/model/ExcelClassField.java
+++ b/continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/model/ExcelClassField.java
@@ -1,9 +1,28 @@
-package top.continew.starter.file.poi.model;
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package top.continew.starter.excel.model;
import java.util.LinkedHashMap;
/**
+ * Excel 字段信息
+ *
* @author jiang4yu
+ * @since 2.13.0
*/
public class ExcelClassField {
diff --git a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/util/ExcelUtils.java b/continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
similarity index 91%
rename from continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/util/ExcelUtils.java
rename to continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
index 0a7592f7..d74e1204 100644
--- a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/util/ExcelUtils.java
+++ b/continew-starter-excel/continew-starter-excel-poi/src/main/java/top/continew/starter/excel/util/ExcelUtils.java
@@ -1,7 +1,23 @@
-package top.continew.starter.file.poi.util;
+/*
+ * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+package top.continew.starter.excel.util;
+
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
@@ -15,9 +31,9 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
-import top.continew.starter.file.poi.annotation.ExcelExport;
-import top.continew.starter.file.poi.annotation.ExcelImport;
-import top.continew.starter.file.poi.model.ExcelClassField;
+import top.continew.excel.annotation.ExcelExport;
+import top.continew.excel.annotation.ExcelImport;
+import top.continew.starter.excel.model.ExcelClassField;
import java.io.*;
import java.lang.reflect.Field;
@@ -30,11 +46,11 @@ import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Pattern;
-
/**
* Excel导入导出工具类
*
* @author jiang4yu
+ * @since 2.13.0
*/
@SuppressWarnings("unused")
public class ExcelUtils {
@@ -56,7 +72,6 @@ public class ExcelUtils {
private static final int BYTES_DEFAULT_LENGTH = 10240;
private static final NumberFormat NUMBER_FORMAT = NumberFormat.getNumberInstance();
-
public static List readFile(File file, Class clazz) throws Exception {
JSONArray array = readFile(file);
return getBeanList(array, clazz);
@@ -105,7 +120,7 @@ public class ExcelUtils {
for (Field field : fields) {
// 行号
if (field.getName().equals(ROW_NUM)) {
- rowNum = obj.getInteger(ROW_NUM);
+ rowNum = obj.getInt(ROW_NUM);
field.setAccessible(true);
field.set(t, rowNum);
continue;
@@ -125,11 +140,11 @@ public class ExcelUtils {
setFieldValue(t, field, obj, uniqueBuilder, errMsgList);
}
// 数据唯一性校验
- if (uniqueBuilder.length() > 0) {
+ if (!uniqueBuilder.isEmpty()) {
if (uniqueMap.containsValue(uniqueBuilder.toString())) {
Set rowNumKeys = uniqueMap.keySet();
for (Integer num : rowNumKeys) {
- if (uniqueMap.get(num).equals(uniqueBuilder.toString())) {
+ if (uniqueMap.get(num).contentEquals(uniqueBuilder)) {
errMsgList.add(String.format("数据唯一性校验失败,(%s)与第%s行重复)", uniqueBuilder, num));
}
}
@@ -160,20 +175,24 @@ public class ExcelUtils {
return t;
}
- private static void setFieldValue(T t, Field field, JSONObject obj, StringBuilder uniqueBuilder, List errMsgList) {
+ private static void setFieldValue(T t,
+ Field field,
+ JSONObject obj,
+ StringBuilder uniqueBuilder,
+ List errMsgList) {
// 获取 ExcelImport 注解属性
ExcelImport annotation = field.getAnnotation(ExcelImport.class);
if (annotation == null) {
return;
}
String cname = annotation.value();
- if (cname.trim().length() == 0) {
+ if (cname.trim().isEmpty()) {
return;
}
// 获取具体值
String val = null;
if (obj.containsKey(cname)) {
- val = getString(obj.getString(cname));
+ val = getString(obj.getStr(cname));
}
if (val == null) {
return;
@@ -188,7 +207,7 @@ public class ExcelUtils {
// 数据唯一性获取
boolean unique = annotation.unique();
if (unique) {
- if (uniqueBuilder.length() > 0) {
+ if (!uniqueBuilder.isEmpty()) {
uniqueBuilder.append("--").append(val);
} else {
uniqueBuilder.append(val);
@@ -323,7 +342,7 @@ public class ExcelUtils {
}
// 如果表头没有数据则不进行解析
if (keyMap.isEmpty()) {
- return (JSONArray) Collections.emptyList();
+ return (JSONArray)Collections.emptyList();
}
// 获取每行JSON对象的值
JSONArray array = new JSONArray();
@@ -331,9 +350,9 @@ public class ExcelUtils {
if (rowStart == rowEnd) {
JSONObject obj = new JSONObject();
// 添加行号
- obj.put(ROW_NUM, 1);
+ obj.putOnce(ROW_NUM, 1);
for (int i : keyMap.keySet()) {
- obj.put(keyMap.get(i), "");
+ obj.set(keyMap.get(i), "");
}
array.add(obj);
return array;
@@ -342,14 +361,14 @@ public class ExcelUtils {
Row eachRow = sheet.getRow(i);
JSONObject obj = new JSONObject();
// 添加行号
- obj.put(ROW_NUM, i + 1);
+ obj.set(ROW_NUM, i + 1);
StringBuilder sb = new StringBuilder();
for (int k = cellStart; k < cellEnd; k++) {
if (eachRow != null) {
String val = getCellValue(eachRow.getCell(k));
// 所有数据添加到里面,用于判断该行是否为空
sb.append(val);
- obj.put(keyMap.get(k), val);
+ obj.set(keyMap.get(k), val);
}
}
if (!sb.isEmpty()) {
@@ -394,18 +413,25 @@ public class ExcelUtils {
exportTemplate(response, fileName, fileName, clazz, false);
}
- public static void exportTemplate(HttpServletResponse response, String fileName, String sheetName,
+ public static void exportTemplate(HttpServletResponse response,
+ String fileName,
+ String sheetName,
Class clazz) {
exportTemplate(response, fileName, sheetName, clazz, false);
}
- public static void exportTemplate(HttpServletResponse response, String fileName, Class clazz,
+ public static void exportTemplate(HttpServletResponse response,
+ String fileName,
+ Class clazz,
boolean isContainExample) {
exportTemplate(response, fileName, fileName, clazz, isContainExample);
}
- public static void exportTemplate(HttpServletResponse response, String fileName, String sheetName,
- Class clazz, boolean isContainExample) {
+ public static void exportTemplate(HttpServletResponse response,
+ String fileName,
+ String sheetName,
+ Class clazz,
+ boolean isContainExample) {
// 获取表头字段
List headFieldList = getExcelClassFieldList(clazz);
// 获取表头数据和示例数据
@@ -671,18 +697,24 @@ public class ExcelUtils {
export(response, fileName, fileName, sheetDataList, null);
}
- public static void exportManySheet(HttpServletResponse response, String fileName, Map>> sheetMap) {
+ public static void exportManySheet(HttpServletResponse response,
+ String fileName,
+ Map>> sheetMap) {
export(response, null, fileName, sheetMap, null);
}
-
- public static void export(HttpServletResponse response, String fileName, String sheetName,
+ public static void export(HttpServletResponse response,
+ String fileName,
+ String sheetName,
List> sheetDataList) {
export(response, fileName, sheetName, sheetDataList, null);
}
- public static void export(HttpServletResponse response, String fileName, String sheetName,
- List> sheetDataList, Map> selectMap) {
+ public static void export(HttpServletResponse response,
+ String fileName,
+ String sheetName,
+ List> sheetDataList,
+ Map> selectMap) {
Map>> map = new HashMap<>();
map.put(sheetName, sheetDataList);
@@ -707,12 +739,18 @@ public class ExcelUtils {
export(response, fileName, sheetDataList);
}
- public static void export(HttpServletResponse response, String fileName, List> sheetDataList, Map> selectMap) {
+ public static void export(HttpServletResponse response,
+ String fileName,
+ List> sheetDataList,
+ Map> selectMap) {
export(response, fileName, fileName, sheetDataList, selectMap);
}
- private static void export(HttpServletResponse response, File file, String fileName,
- Map>> sheetMap, Map> selectMap) {
+ private static void export(HttpServletResponse response,
+ File file,
+ String fileName,
+ Map>> sheetMap,
+ Map> selectMap) {
// 整个 Excel 表格 book 对象
SXSSFWorkbook book = new SXSSFWorkbook();
// 每个 Sheet 页
@@ -747,7 +785,7 @@ public class ExcelUtils {
int v = 0;
if (o instanceof URL) {
// 如果要导出图片的话, 链接需要传递 URL 对象
- setCellPicture(book, row, patriarch, i, j, (URL) o);
+ setCellPicture(book, row, patriarch, i, j, (URL)o);
} else {
Cell cell = row.createCell(j);
if (i == 0) {
@@ -902,19 +940,19 @@ public class ExcelUtils {
// 是否为Boolean
if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
- cell.setCellValue((Boolean) o);
+ cell.setCellValue((Boolean)o);
return CELL_OTHER;
}
// 如果是BigDecimal,则默认3位小数
if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
- cell.setCellValue(((BigDecimal) o).setScale(3, RoundingMode.HALF_UP).doubleValue());
+ cell.setCellValue(((BigDecimal)o).setScale(3, RoundingMode.HALF_UP).doubleValue());
return CELL_OTHER;
}
// 如果是Date数据,则显示格式化数据
if (o instanceof Date) {
cell.setCellType(CellType.STRING);
- cell.setCellValue(formatDate((Date) o));
+ cell.setCellValue(formatDate((Date)o));
return CELL_OTHER;
}
// 如果是其他,则默认字符串类型
@@ -925,7 +963,7 @@ public class ExcelUtils {
private static void setCellPicture(SXSSFWorkbook wb, Row sr, Drawing> patriarch, int x, int y, URL url) {
// 设置图片宽高
- sr.setHeight((short) (IMG_WIDTH * IMG_HEIGHT));
+ sr.setHeight((short)(IMG_WIDTH * IMG_HEIGHT));
// (jdk1.7版本try中定义流可自动关闭)
try (InputStream is = url.openStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
byte[] buff = new byte[BYTES_DEFAULT_LENGTH];
@@ -984,7 +1022,7 @@ public class ExcelUtils {
if (Objects.nonNull(str) && "0.0".equals(str)) {
return true;
}
- for (int i = str.length(); --i >= 0; ) {
+ for (int i = str.length(); --i >= 0;) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
diff --git a/continew-starter-file/pom.xml b/continew-starter-excel/pom.xml
similarity index 73%
rename from continew-starter-file/pom.xml
rename to continew-starter-excel/pom.xml
index 71b8b326..cc419dd4 100644
--- a/continew-starter-file/pom.xml
+++ b/continew-starter-excel/pom.xml
@@ -9,15 +9,16 @@
${revision}
- continew-starter-file
+ continew-starter-excel
pom
${project.artifactId}
- ContiNew Starter 文件处理模块
+ ContiNew Starter Excel 文件处理模块
- continew-starter-file-excel
- continew-starter-file-poi
+ continew-starter-excel-core
+ continew-starter-excel-fastexcel
+ continew-starter-excel-poi
diff --git a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/pom.xml b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/pom.xml
index bcc0dbb6..89bac6ce 100644
--- a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/pom.xml
+++ b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/pom.xml
@@ -34,10 +34,10 @@
continew-starter-data-core
-
+
top.continew
- continew-starter-file-excel
+ continew-starter-excel-fastexcel
diff --git a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mf/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mf/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
index 0fb63f91..e3d0f70e 100644
--- a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mf/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
+++ b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mf/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
@@ -44,7 +44,7 @@ import top.continew.starter.extension.crud.model.entity.BaseIdDO;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.query.SortQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
-import top.continew.starter.file.excel.util.ExcelUtils;
+import top.continew.starter.excel.util.ExcelUtils;
import java.lang.reflect.Field;
import java.util.ArrayList;
diff --git a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mp/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mp/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
index 077a0d7c..a637cb37 100644
--- a/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mp/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
+++ b/continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-mp/src/main/java/top/continew/starter/extension/crud/service/CrudServiceImpl.java
@@ -51,7 +51,7 @@ import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.query.SortQuery;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
import top.continew.starter.extension.crud.model.resp.PageResp;
-import top.continew.starter.file.excel.util.ExcelUtils;
+import top.continew.starter.excel.util.ExcelUtils;
import java.lang.reflect.Field;
import java.util.*;
diff --git a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelExport.java b/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelExport.java
deleted file mode 100644
index ede420f9..00000000
--- a/continew-starter-file/continew-starter-file-poi/src/main/java/top/continew/starter/file/poi/annotation/ExcelExport.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package top.continew.starter.file.poi.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @author jiang4yu
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ExcelExport {
-
- /**
- * 字段名称
- */
- String value();
-
- /**
- * 导出排序先后: 数字越小越靠前(默认按Java类字段顺序导出)
- */
- int sort() default 0;
-
- /**
- * 导出映射,格式如:0-未知;1-男;2-女
- */
- String kv() default "";
-
- /**
- * 导出模板示例值(有值的话,直接取该值,不做映射)
- */
- String example() default "";
-
-}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4420b615..0526d59b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
continew-starter-captcha
continew-starter-messaging
continew-starter-log
- continew-starter-file
+ continew-starter-excel
continew-starter-storage
continew-starter-license
continew-starter-extension