升级easypoi到v4.1.0,并解决poi包冲突问题
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
<mybatis-plus-boot-starter.version>3.1.2</mybatis-plus-boot-starter.version>
|
||||
<aliyun-sdk-oss>3.4.2</aliyun-sdk-oss>
|
||||
<qiniu-java-sdk>7.2.18</qiniu-java-sdk>
|
||||
<easypoi.version>4.0.0</easypoi.version>
|
||||
<easypoi.version>4.1.0</easypoi.version>
|
||||
<poi.version>4.1.0</poi.version>
|
||||
<spring-boot-admin.version>2.0.6</spring-boot-admin.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<commons-configuration.version>1.10</commons-configuration.version>
|
||||
@@ -225,27 +226,21 @@
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>${qiniu-java-sdk}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi.version}</version>
|
||||
</dependency>
|
||||
<!-- easypoi -->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
<version>${easypoi.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-web</artifactId>
|
||||
<version>${easypoi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-annotation</artifactId>
|
||||
<version>${easypoi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
||||
@@ -63,15 +63,6 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-annotation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -54,6 +54,14 @@
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
<!-- easypoi -->
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
|
||||
+3
-3
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user