Browse Source

excel根据身份证去重

master
wanggongfeng 3 years ago
parent
commit
df0c2ac887
  1. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccinePrarmeterServiceImpl.java

@ -225,11 +225,11 @@ public class IcVaccinePrarmeterServiceImpl extends BaseServiceImpl<IcVaccinePrar
checkInfo(list,errorInfo,tokenDto); checkInfo(list,errorInfo,tokenDto);
if (list.size() > errorInfo.size()){ if (list.size() > errorInfo.size()){
Map<String, Long> groupByName = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getName, Collectors.counting())); Map<String, Long> groupByIdCard = list.stream().collect(Collectors.groupingBy(IcVaccinePrarmeterImportExcel::getIdCard, Collectors.counting()));
groupByName.forEach((name,count) -> { groupByIdCard.forEach((idCard,count) -> {
if (Integer.valueOf(count.toString()).compareTo(1) != 0){ if (Integer.valueOf(count.toString()).compareTo(1) != 0){
for (IcVaccinePrarmeterImportExcel i : list) { for (IcVaccinePrarmeterImportExcel i : list) {
if (name.equals(i.getName()) && !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);
} }

Loading…
Cancel
Save