From 10ae5381fc9fe52914e6e73e862ae0fc46181fd5 Mon Sep 17 00:00:00 2001 From: chenrui Date: Fri, 8 Mar 2024 13:35:57 +0800 Subject: [PATCH] =?UTF-8?q?---author:chenrui---date:2024/3/8-----for:[QQYU?= =?UTF-8?q?N-8394]Excel=E5=AF=BC=E5=85=A5=E6=97=B6=E7=A9=BA=E8=A1=8C?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=97=AE=E9=A2=98---?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../poi/excel/imports/ExcelImportServer.java | 14 +++++++++++--- ...77\256\346\224\271\346\227\245\345\277\227.log" | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java b/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java index ee1456f..99af5a3 100644 --- a/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java +++ b/autopoi/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java @@ -221,6 +221,8 @@ private List importExcel(Collection result, Sheet sheet, Class pojo if(lastCellNum List importExcel(Collection result, Sheet sheet, Class pojo } } }else{ - saveFieldValue(params, object, cell, excelParams, titleString, row); + Object value = saveFieldValue(params, object, cell, excelParams, titleString, row); + if(null == value){ + noneCellNum++; + } } //update-end-author:taoyan date:20200303 for:导入图片 } @@ -250,7 +255,8 @@ private List importExcel(Collection result, Sheet sheet, Class pojo addListContinue(object, param, row, titlemap, targetId, pictures, params); } //update-begin-author:taoyan date:20210526 for:autopoi导入excel 如果单元格被设置边框,即使没有内容也会被当做是一条数据导入 #2484 - if(isNotNullObject(pojoClass, object)){ + if (isNotNullObject(pojoClass, object) && noneCellNum < (lastCellNum - firstCellNum)) { + //update-end---author:chenrui ---date:20240306 for:[QQYUN-8394]Excel导入时空行校验问题------------ collection.add(object); } //update-end-author:taoyan date:20210526 for:autopoi导入excel 如果单元格被设置边框,即使没有内容也会被当做是一条数据导入 #2484 @@ -524,8 +530,9 @@ public static byte[] getBytes(InputStream is) throws IOException { * @param titleString * @param row * @throws Exception + * @return */ - private void saveFieldValue(ImportParams params, Object object, Cell cell, Map excelParams, String titleString, Row row) throws Exception { + private Object saveFieldValue(ImportParams params, Object object, Cell cell, Map excelParams, String titleString, Row row) throws Exception { Object value = cellValueServer.getValue(params.getDataHanlder(), object, cell, excelParams, titleString); if (object instanceof Map) { if (params.getDataHanlder() != null) { @@ -545,6 +552,7 @@ private void saveFieldValue(ImportParams params, Object object, Cell cell, Map