Browse Source

福利人员导入----排除证件号为空的情况

dev
wanggongfeng 3 years ago
parent
commit
46189fce34
  1. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java

23
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeWelfareServiceImpl.java

@ -262,6 +262,7 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl<ChangeWelfareDao,
if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){ if (StringUtils.isBlank(list.get(i).getIdCard()) && !list.get(i).getAddStatus()){
errorInfo.add(getErrorInfo(list.get(i), "证件号不能为空",i+1)); errorInfo.add(getErrorInfo(list.get(i), "证件号不能为空",i+1));
list.get(i).setAddStatus(true); list.get(i).setAddStatus(true);
list.get(i).setIdCard("10110"); // 后面有逻辑用到了证件号,10110代表证件号为空
continue; continue;
} }
// 校验是否为居民 // 校验是否为居民
@ -292,17 +293,17 @@ public class ChangeWelfareServiceImpl extends BaseServiceImpl<ChangeWelfareDao,
} }
if (list.size() > errorInfo.size()){ if (list.size() > errorInfo.size()){
// Map<String, Long> groupByIdCard = list.stream().collect(Collectors.groupingBy(ChangeWelfareImportExcel::getIdCard, Collectors.counting())); Map<String, Long> groupByIdCard = list.stream().collect(Collectors.groupingBy(ChangeWelfareImportExcel::getIdCard, Collectors.counting()));
// groupByIdCard.forEach((idCard,count) -> { groupByIdCard.forEach((idCard,count) -> {
// if (StringUtils.isNotBlank(idCard) && Integer.valueOf(count.toString()).compareTo(1) != 0){ if (!"10110".equals(idCard) && Integer.valueOf(count.toString()).compareTo(1) != 0){
// for (ChangeWelfareImportExcel i : list) { for (ChangeWelfareImportExcel i : list) {
// if (idCard.equals(i.getIdCard()) && !i.getAddStatus()){ if (idCard.equals(i.getIdCard()) && !i.getAddStatus()){
// errorInfo.add(getErrorInfo(i,"数据重复",i.getNum())); errorInfo.add(getErrorInfo(i,"数据重复",i.getNum()));
// i.setAddStatus(true); i.setAddStatus(true);
// } }
// } }
// } }
// }); });
} }
Map<Boolean, List<ChangeWelfareImportExcel>> groupByStatus = list.stream().collect(Collectors.groupingBy(ChangeWelfareImportExcel::getAddStatus)); Map<Boolean, List<ChangeWelfareImportExcel>> groupByStatus = list.stream().collect(Collectors.groupingBy(ChangeWelfareImportExcel::getAddStatus));
List<ChangeWelfareImportExcel> needInsert = groupByStatus.get(false); List<ChangeWelfareImportExcel> needInsert = groupByStatus.get(false);

Loading…
Cancel
Save