diff --git a/epmet-commons/epmet-commons-extapp-auth/pom.xml b/epmet-commons/epmet-commons-extapp-auth/pom.xml
index 8ff0d46ada..bf2e9a71c7 100644
--- a/epmet-commons/epmet-commons-extapp-auth/pom.xml
+++ b/epmet-commons/epmet-commons-extapp-auth/pom.xml
@@ -18,7 +18,7 @@
1.3.3
2.6
4.6.1
- 4.4.0
+ 4.3.0
2.9.9
1.2.79
2.8.6
diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml
index e516c5fba7..867fcf47c7 100644
--- a/epmet-commons/epmet-commons-tools/pom.xml
+++ b/epmet-commons/epmet-commons-tools/pom.xml
@@ -18,7 +18,7 @@
1.3.3
2.6
4.6.1
- 4.4.0
+ 4.3.0
2.9.9
1.2.79
2.8.6
diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
index 9bc34d0a39..378ea5a725 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
@@ -11,12 +11,13 @@ package com.epmet.commons.tools.utils;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
-import com.epmet.commons.tools.utils.excel.ExportMultiView;
+import com.epmet.commons.tools.utils.poi.excel.EasyPoiExcelExportStylerImpl;
+import com.epmet.commons.tools.utils.poi.excel.ExportMultiView;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
-import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@@ -30,6 +31,7 @@ import java.util.*;
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
+@Slf4j
public class ExcelUtils {
/**
@@ -47,15 +49,16 @@ public class ExcelUtils {
fileName = DateUtils.format(new Date());
}
- Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), pojoClass, list);
+ ExportParams exportParams = new ExportParams();
+ //设置导出的样式
+ exportParams.setStyle(EasyPoiExcelExportStylerImpl.class);
+ //设置sheet名称
+ exportParams.setSheetName("Sheet1");
+ Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
Sheet sheet1 = workbook.getSheetAt(0);
sheet1.setDefaultColumnWidth(50*256);
- sheet1.setDefaultRowHeight((short)(2*256));
- response.setCharacterEncoding("UTF-8");
- response.setHeader("content-Type", "application/vnd.ms-excel");
- response.setHeader("Content-Disposition",
- "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xls");
- ServletOutputStream out = response.getOutputStream();
+ //sheet1.setDefaultRowHeight((short)(2*256));
+ ServletOutputStream out = ExcelUtils.getOutputStreamForExcel(fileName,response);
workbook.write(out);
out.flush();
out.close();
@@ -81,45 +84,7 @@ public class ExcelUtils {
exportExcel(response, fileName, targetList, targetClass);
}
- public static void exportExcelToTargetDisposeAll(HttpServletResponse response, String fileName, Collection> sourceList,
- Class> targetClass) throws Exception {
- if (!CollectionUtils.isEmpty(sourceList)){
- List