Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QQYUN-8394]Excel导入时空行校验问题 #106

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ private <T> List<T> importExcel(Collection<T> result, Sheet sheet, Class<?> pojo
if(lastCellNum<maxColumnIndex+1){
lastCellNum = maxColumnIndex+1;
}
//update-begin---author:chenrui ---date:20240306 for:[QQYUN-8394]Excel导入时空行校验问题------------
int noneCellNum = 0;
for (int i = firstCellNum, le = lastCellNum; i < le; i++) {
Cell cell = row.getCell(i);
String titleString = (String) titlemap.get(i);
Expand All @@ -239,7 +241,10 @@ private <T> List<T> importExcel(Collection<T> 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:导入图片
}
Expand All @@ -250,7 +255,8 @@ private <T> List<T> importExcel(Collection<T> 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
Expand Down Expand Up @@ -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<String, ExcelImportEntity> excelParams, String titleString, Row row) throws Exception {
private Object saveFieldValue(ImportParams params, Object object, Cell cell, Map<String, ExcelImportEntity> 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) {
Expand All @@ -545,6 +552,7 @@ private void saveFieldValue(ImportParams params, Object object, Cell cell, Map<S
throw new ExcelImportException(ExcelImportEnum.VERIFY_ERROR);
}
}
return value;
}

/**
Expand Down
8 changes: 7 additions & 1 deletion docs/修改日志.log
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ autopoi/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java
autopoi/src/main/java/org/jeecgframework/poi/excel/ExcelExportUtil.java
---author:chenrui---date:2024/1/3-----for:[issue/#5248]加强继承扩展便利性---


---author:chenrui---date:2024/3/8-----for:[QQYUN-8394]Excel导入时空行校验问题---
autopoi/src/main/java/org/jeecgframework/poi/excel/imports/ExcelImportServer.java
---author:chenrui---date:2024/3/8-----for:[QQYUN-8394]Excel导入时空行校验问题---

---author:chenrui---date:2024/4/3-----for:[issue/#5933]增加清除缓存方法---
autopoi/src/main/java/org/jeecgframework/poi/cache/manager/POICacheManager.java
---author:chenrui---date:2024/4/3-----for:[issue/#5933]增加清除缓存方法---
---author:chenrui---date:2024/4/3-----for:[issue/#5933]增加清除缓存方法---