|
@ -736,10 +736,11 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel, |
|
|
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel, |
|
|
LinkedHashMap<String, String> target2Insert, boolean isPrimaryTable) { |
|
|
LinkedHashMap<String, String> target2Insert, boolean isPrimaryTable) { |
|
|
|
|
|
|
|
|
|
|
|
// 本行中是否有必填但未填,或者填了但填错了系统中找不到的列,那后面的数据可能就没办法通过前面填写的值去关联查询,因此只做必填检查,提示出来就行了,仁至义尽
|
|
|
boolean hasError = false; |
|
|
boolean hasError = false; |
|
|
|
|
|
|
|
|
String notFoundColumnNames = null; |
|
|
String notFoundColumnName = null; |
|
|
String emptyColumnNames = null; |
|
|
List<String> emptyColumnNames = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述
|
|
|
// 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述
|
|
|
target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); |
|
|
target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); |
|
@ -760,9 +761,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
columnWrapper.setColValue(cellContent); |
|
|
columnWrapper.setColValue(cellContent); |
|
|
|
|
|
|
|
|
// 必填检查
|
|
|
// 必填检查
|
|
|
if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { |
|
|
boolean hasEmptyError = requiredButEmptyCheck(isPrimaryTable, columnWrapper); |
|
|
emptyColumnNames = columnWrapper.combinedLabel; |
|
|
if (hasEmptyError) { |
|
|
break; |
|
|
emptyColumnNames.add(columnWrapper.combinedLabel); |
|
|
|
|
|
hasError = true; |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (hasError) { |
|
|
|
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// "select", "radio"
|
|
|
// "select", "radio"
|
|
@ -773,9 +780,15 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
columnWrapper.setCellContent(cellContent); |
|
|
columnWrapper.setCellContent(cellContent); |
|
|
|
|
|
|
|
|
// 必填检查
|
|
|
// 必填检查
|
|
|
if (hasError = requiredButEmptyCheck(isPrimaryTable, columnWrapper)) { |
|
|
boolean hasEmptyError = requiredButEmptyCheck(isPrimaryTable, columnWrapper); |
|
|
emptyColumnNames = columnWrapper.combinedLabel; |
|
|
if (hasEmptyError) { |
|
|
break; |
|
|
emptyColumnNames.add(columnWrapper.combinedLabel); |
|
|
|
|
|
hasError = true; |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (hasError) { |
|
|
|
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ("local".equals(columnWrapper.getOptionSourceType())) { |
|
|
if ("local".equals(columnWrapper.getOptionSourceType())) { |
|
@ -821,36 +834,39 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else if ("checkbox".equals(columnWrapper.getItemType())) { |
|
|
} else if ("checkbox".equals(columnWrapper.getItemType())) { |
|
|
//多选框没有具体的cellContent,因为多选框对应着excel的多列
|
|
|
//多选框没有具体的cellContent,因为多选框对应着excel的多列。并且复选框,为空就是否,所以不需要做必填检查
|
|
|
String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); |
|
|
String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); |
|
|
columnWrapper.setColValue(checkBoxColValue); |
|
|
columnWrapper.setColValue(checkBoxColValue); |
|
|
|
|
|
|
|
|
|
|
|
if (hasError) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 填了,但找不到对应数据的检查
|
|
|
// 填了,但找不到对应数据的检查
|
|
|
if (hasError = notFoundCheck(isPrimaryTable, columnWrapper)) { |
|
|
boolean hasNotFoundError = notFoundCheck(isPrimaryTable, columnWrapper); |
|
|
notFoundColumnNames = columnWrapper.combinedLabel; |
|
|
if (hasNotFoundError) { |
|
|
break; |
|
|
notFoundColumnName = columnWrapper.combinedLabel; |
|
|
|
|
|
hasError = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
target2Insert.put(columnWrapper.columnName, columnWrapper.colValue); |
|
|
target2Insert.put(columnWrapper.columnName, columnWrapper.colValue); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!hasError) { |
|
|
if (hasError) { |
|
|
return; |
|
|
StringBuilder sb = new StringBuilder(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
// 组织报错信息
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(emptyColumnNames)) { |
|
|
|
|
|
sb.append(String.join(",", emptyColumnNames)).append("的值未填写;"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 组织报错信息
|
|
|
if (StringUtils.isNotBlank(notFoundColumnName)) { |
|
|
if (StringUtils.isNotBlank(emptyColumnNames)) { |
|
|
sb.append(notFoundColumnName).append("填写的值在系统中未找到"); |
|
|
sb.append(emptyColumnNames).append("的值未填写"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(notFoundColumnNames)) { |
|
|
throw new EpmetException(sb.toString()); |
|
|
sb.append(notFoundColumnNames).append("填写的值在系统中未找到"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
throw new EpmetException(sb.toString()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|