From bfba5fd50979acdaf2f8f62b5dfd37a47db25ccc Mon Sep 17 00:00:00 2001 From: wuy <1311695042@qq.com> Date: Wed, 15 Jul 2020 18:26:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20excel=E5=AF=BC=E5=85=A5=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=97=B6=E5=85=9C=E5=BA=95=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../diboot/file/controller/BaseExcelFileController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java index a6b30ad..c728763 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java @@ -178,6 +178,10 @@ public abstract class BaseExcelFileController extends BaseFileController { } throw e; } + //最后拦截,如果数据异常在listener中未被拦截抛出异常,此处进行处理 + if (V.notEmpty(listener.getErrorMsgs())) { + throw new BusinessException(Status.FAIL_VALIDATION, S.join(listener.getErrorMsgs(), "; ")); + } // 绑定属性到model dataMap.put("header", listener.getFieldHeaders()); dataMap.put(ORIGIN_FILE_NAME, originFileName); @@ -209,6 +213,10 @@ public abstract class BaseExcelFileController extends BaseFileController { } throw e; } + //最后拦截,如果数据异常在listener中未被拦截抛出异常,此处进行处理 + if (V.notEmpty(listener.getErrorMsgs())) { + throw new BusinessException(Status.FAIL_VALIDATION, S.join(listener.getErrorMsgs(), "; ")); + } return listener.getDataList().size(); }