|
@@ -247,16 +247,19 @@ public class DeptConfigFacade {
|
|
|
|
|
|
//1、数据完整性校验
|
|
|
//2、去除前后空格
|
|
|
- Boolean isEmpty = true;
|
|
|
+ //过滤空数据,保留重复数据,方便计行
|
|
|
+ deptConfigList = deptConfigList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHisName())
|
|
|
+ || StringUtil.isNotBlank(i.getHisCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(deptConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
List<String> emptyNumList = Lists.newLinkedList();
|
|
|
for (int i = 0; i < deptConfigList.size(); i++) {
|
|
|
- if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getHisCode())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getUniqueName())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getUniqueCode())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- isEmpty = false;
|
|
|
if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
|
|
|
|| StringUtil.isBlank(deptConfigList.get(i).getUniqueName())) {
|
|
|
emptyNumList.add(String.valueOf(i + 2));
|
|
@@ -264,6 +267,9 @@ public class DeptConfigFacade {
|
|
|
if (StringUtil.isNotBlank(deptConfigList.get(i).getHisName())) {
|
|
|
deptConfigList.get(i).setHisName(deptConfigList.get(i).getHisName().trim());
|
|
|
}
|
|
|
+ if (StringUtil.isNotBlank(deptConfigList.get(i).getHisCode())) {
|
|
|
+ deptConfigList.get(i).setHisCode(deptConfigList.get(i).getHisCode().trim());
|
|
|
+ }
|
|
|
if (StringUtil.isNotBlank(deptConfigList.get(i).getUniqueName())) {
|
|
|
deptConfigList.get(i).setUniqueName(deptConfigList.get(i).getUniqueName().trim());
|
|
|
}
|
|
@@ -273,11 +279,9 @@ public class DeptConfigFacade {
|
|
|
deptConfigList.get(i).setUniqueCode(null);
|
|
|
}
|
|
|
}
|
|
|
- if (isEmpty == true) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
|
|
|
- }
|
|
|
+
|
|
|
if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数存在不完整数据:"
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
|
|
|
+ emptyNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ "。导入取消,请修改后再试。\n");
|
|
|
}
|
|
@@ -316,24 +320,17 @@ public class DeptConfigFacade {
|
|
|
RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
List<String> names = respDTO.data;
|
|
|
for (int i = 0; i < deptConfigList.size(); i++) {
|
|
|
- if (StringUtil.isBlank(deptConfigList.get(i).getHisName())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getHisCode())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getUniqueName())
|
|
|
- && StringUtil.isBlank(deptConfigList.get(i).getUniqueCode())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
if (!names.contains(deptConfigList.get(i).getUniqueName())) {
|
|
|
errorNumList.add(String.valueOf(i + 2));
|
|
|
}
|
|
|
}
|
|
|
if (ListUtil.isNotEmpty(errorNumList)) {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
|
|
|
- "以下行数标准术语与数据库术语不匹配:"
|
|
|
+ "以下行数(不计入空行)标准术语与数据库术语不匹配:"
|
|
|
+ errorNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ "。导入取消,请修改后再试。");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//重复数据过滤
|
|
|
deptConfigList = deptConfigList
|
|
|
.stream()
|