From c20d19bb1dff00bdbd24b8737a300402065d9d36 Mon Sep 17 00:00:00 2001 From: jueyue Date: Wed, 23 Oct 2019 14:17:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B04.1.2=E7=89=88?= =?UTF-8?q?=E6=9C=AC,=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easypoi-annotation/pom.xml | 2 +- easypoi-base/pom.xml | 2 +- .../easypoi/excel/entity/ExportParams.java | 17 +++++++++++++++++ .../easypoi/excel/entity/ImportParams.java | 4 ++++ .../excel/entity/result/ExcelImportResult.java | 6 +++--- .../excel/export/ExcelExportService.java | 4 ++-- .../excel/imports/ExcelImportService.java | 10 +++++++--- easypoi-web/pom.xml | 2 +- pom.xml | 4 ++-- 9 files changed, 38 insertions(+), 13 deletions(-) diff --git a/easypoi-annotation/pom.xml b/easypoi-annotation/pom.xml index ec28bb2..11ee216 100644 --- a/easypoi-annotation/pom.xml +++ b/easypoi-annotation/pom.xml @@ -4,7 +4,7 @@ cn.afterturn easypoi - 4.1.1 + 4.1.2 easypoi-annotation 基础注解类,解耦合 diff --git a/easypoi-base/pom.xml b/easypoi-base/pom.xml index 24b6200..35e54c8 100644 --- a/easypoi-base/pom.xml +++ b/easypoi-base/pom.xml @@ -4,7 +4,7 @@ cn.afterturn easypoi - 4.1.1 + 4.1.2 easypoi-base diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java index 5097a20..e76c376 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java @@ -144,4 +144,21 @@ public class ExportParams extends ExcelBaseParams { this.sheetName = sheetName; } + public short getSecondTitleHeight() { + return (short) (secondTitleHeight * 50); + } + + public short getTitleHeight() { + return (short) (titleHeight * 50); + } + + public short getHeight() { + return height == -1 ? -1 : (short) (height * 50); + } + + + public short getHeaderHeight() { + return (short) (titleHeight * 50); + } + } diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ImportParams.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ImportParams.java index 14b8747..1b82a1f 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ImportParams.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ImportParams.java @@ -69,6 +69,10 @@ public class ImportParams extends ExcelBaseParams { * 是否需要校验上传的Excel,默认为false */ private boolean needVerify = false; + /** + * 返回文件是否分割,默认是分割 + */ + private boolean verifyFileSplit = true; /** * 校验处理接口 */ diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/result/ExcelImportResult.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/result/ExcelImportResult.java index f393388..a268584 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/result/ExcelImportResult.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/result/ExcelImportResult.java @@ -42,7 +42,7 @@ public class ExcelImportResult { /** * 是否存在校验失败 */ - private boolean verfiyFail; + private boolean verifyFail; /** * 数据源 @@ -59,9 +59,9 @@ public class ExcelImportResult { } - public ExcelImportResult(List list, boolean verfiyFail, Workbook workbook) { + public ExcelImportResult(List list, boolean verifyFail, Workbook workbook) { this.list = list; - this.verfiyFail = verfiyFail; + this.verifyFail = verifyFail; this.workbook = workbook; } diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java index 2ff9a38..2af12ea 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java @@ -66,13 +66,13 @@ public class ExcelExportService extends BaseExportService { List excelParams, int cellIndex) { Row row = sheet.getRow(index) == null ? sheet.createRow(index) : sheet.getRow(index); int rows = getRowNums(excelParams, true); - row.setHeight((short)title.getHeaderHeight()); + row.setHeight(title.getHeaderHeight()); Row listRow = null; if (rows >= 2) { listRow = sheet.getRow(index + 1); if (listRow == null) { listRow = sheet.createRow(index + 1); - listRow.setHeight((short)(short)title.getHeaderHeight()); + listRow.setHeight(title.getHeaderHeight()); } } diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/ExcelImportService.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/ExcelImportService.java index de5cd69..e7d4594 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/ExcelImportService.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/imports/ExcelImportService.java @@ -478,10 +478,14 @@ public class ExcelImportService extends ImportBaseService { InputStream successIs = new ByteArrayInputStream(baos.toByteArray()); try { Workbook successBook = WorkbookFactory.create(successIs); - importResult.setWorkbook(removeSuperfluousRows(successBook, failRow, params)); - importResult.setFailWorkbook(removeSuperfluousRows(book, successRow, params)); + if (params.isVerifyFileSplit()){ + importResult.setWorkbook(removeSuperfluousRows(successBook, failRow, params)); + importResult.setFailWorkbook(removeSuperfluousRows(book, successRow, params)); + } else { + importResult.setWorkbook(successBook); + } importResult.setFailList(failCollection); - importResult.setVerfiyFail(verifyFail); + importResult.setVerifyFail(verifyFail); } finally { successIs.close(); } diff --git a/easypoi-web/pom.xml b/easypoi-web/pom.xml index f37fe97..183d6f3 100644 --- a/easypoi-web/pom.xml +++ b/easypoi-web/pom.xml @@ -4,7 +4,7 @@ cn.afterturn easypoi - 4.1.1 + 4.1.2 easypoi-web diff --git a/pom.xml b/pom.xml index 7b96e36..0e41bff 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.afterturn easypoi - 4.1.1 + 4.1.2 pom easypoi @@ -45,7 +45,7 @@ - 4.1.1 + 4.1.2 4.1.0 2.9.1 16.0.1