diff --git a/pom.xml b/pom.xml index 1aed98d065d55613585eb123a42996c74041d596..f7420c950bf2941ff606a2efebff84a2620a8c79 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,8 @@ 3.1.2 3.4.2 7.2.18 - 4.0.0 + 4.1.0 + 4.1.0 2.0.6 1.7 1.10 @@ -225,26 +226,20 @@ qiniu-java-sdk ${qiniu-java-sdk} - - cn.afterturn - easypoi-base - ${easypoi.version} - - - com.google.guava - guava - - + org.apache.poi + poi + ${poi.version} - cn.afterturn - easypoi-web - ${easypoi.version} + org.apache.poi + poi-ooxml + ${poi.version} + cn.afterturn - easypoi-annotation + easypoi-base ${easypoi.version} diff --git a/zlt-business/user-center/pom.xml b/zlt-business/user-center/pom.xml index edbef366e88f18f9886070f7580a47f1a333cc1f..e6361cc01f6045c32d5923891957e29ffd0ba0f3 100644 --- a/zlt-business/user-center/pom.xml +++ b/zlt-business/user-center/pom.xml @@ -63,15 +63,6 @@ mysql-connector-java - - cn.afterturn - easypoi-web - - - cn.afterturn - easypoi-annotation - - io.micrometer micrometer-registry-prometheus diff --git a/zlt-business/user-center/src/main/java/com/central/user/model/SysUserExcel.java b/zlt-business/user-center/src/main/java/com/central/user/model/SysUserExcel.java index d406fdd9917708267f5a8506447f4c7326cb4e96..aae7e28601ea83bf98e354df939cb8794142f787 100644 --- a/zlt-business/user-center/src/main/java/com/central/user/model/SysUserExcel.java +++ b/zlt-business/user-center/src/main/java/com/central/user/model/SysUserExcel.java @@ -24,7 +24,7 @@ public class SysUserExcel implements Serializable { @Excel(name = "手机号码", height = 20, width = 30, isImportField = "true_st") private String mobile; - @Excel(name = "学生性别", replace = { "男_0", "女_1" }, suffix = "生", isImportField = "true_st") + @Excel(name = "性别", replace = { "男_0", "女_1" }, isImportField = "true_st") private Integer sex; @Excel(name = "创建时间", format = CommonConstant.DATETIME_FORMAT, isImportField = "true_st", width = 20) diff --git a/zlt-commons/zlt-common-spring-boot-starter/pom.xml b/zlt-commons/zlt-common-spring-boot-starter/pom.xml index 2f20cb2c57ebbccff5d5b0ee7db00b6f7feeb371..71a3e87f4eab1607ef09da54fe4bc085fa926399 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/pom.xml +++ b/zlt-commons/zlt-common-spring-boot-starter/pom.xml @@ -54,6 +54,14 @@ spring-cloud-starter-openfeign true + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + cn.afterturn diff --git a/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java index 210a66ab19b2cc116645fcc9bf9030b7f17e3d80..6c89841a59906ec1a683dc6ab1b87bd64c535f56 100644 --- a/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java +++ b/zlt-commons/zlt-common-spring-boot-starter/src/main/java/com/central/common/utils/ExcelUtil.java @@ -42,7 +42,7 @@ public class ExcelUtil { */ public static void exportExcel(List list, String title, String sheetName, Class pojoClass, String fileName , boolean isCreateHeader, HttpServletResponse response) throws IOException { - ExportParams exportParams = new ExportParams(title, sheetName); + ExportParams exportParams = new ExportParams(title, sheetName, ExcelType.XSSF); exportParams.setCreateHeadRows(isCreateHeader); defaultExport(list, pojoClass, fileName, response, exportParams); @@ -61,7 +61,7 @@ public class ExcelUtil { */ public static void exportExcel(List list, String title, String sheetName, Class pojoClass, String fileName , HttpServletResponse response) throws IOException { - defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName)); + defaultExport(list, pojoClass, fileName, response, new ExportParams(title, sheetName, ExcelType.XSSF)); } /** @@ -93,7 +93,7 @@ public class ExcelUtil { private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { response.setCharacterEncoding("UTF-8"); - response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); workbook.write(response.getOutputStream()); } diff --git a/zlt-web/back-web/src/main/resources/static/pages/system/user.html b/zlt-web/back-web/src/main/resources/static/pages/system/user.html index 1cab1160bf71629d00017f3e03f89b76ff5c31f5..91886db0de3ec70e89cf8a125df06c6f9f8cb0a1 100644 --- a/zlt-web/back-web/src/main/resources/static/pages/system/user.html +++ b/zlt-web/back-web/src/main/resources/static/pages/system/user.html @@ -150,12 +150,12 @@ $('#user-btn-export').click(function () { var url = config.base_server + 'api-user/users/export?access_token='+config.getToken().access_token; var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); + xhr.open('POST', url, true); xhr.responseType = "blob"; xhr.setRequestHeader("client_type", "DESKTOP_WEB"); xhr.onload = function() { if (this.status == 200) { - var fileName = "user.xls"; + var fileName = "user.xlsx"; var blob = this.response; var a = document.createElement('a'); a.innerHTML = fileName;