fix bug 41165 导入--导入的文件中‘机构名称’必填项为空,导入失败后无明确提示。
This commit is contained in:
+22
@@ -677,4 +677,26 @@ public class oConvertUtils {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断对象中的属性值是否都为null
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkObjAllFieldsIsNull(Object object) {
|
||||
if (null == object) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
if (f.get(object) != null && StringUtils.isNotBlank(f.get(object).toString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -3,6 +3,7 @@ package com.jero.modules.system.controller;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -409,6 +410,7 @@ public class SysDepartController {
|
||||
// orgCode编码长度
|
||||
int codeLength = YouBianCodeUtil.zhanweiLength;
|
||||
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepartExcel.class, params);
|
||||
listSysDeparts = listSysDeparts.stream().filter(i -> !oConvertUtils.checkObjAllFieldsIsNull(i)).collect(Collectors.toList());
|
||||
//按长度排序
|
||||
Collections.sort(listSysDeparts, new Comparator<SysDepartExcel>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user