前提是根据需求重写SupplierImportDTO对象equals方法
Map<SupplierImportDTO, List<SupplierImportDTO>> collect = passCheckSupplierImportDTOList.stream().collect(Collectors.groupingBy(Function.identity()));
for(Map.Entry<SupplierImportDTO, List<SupplierImportDTO>> entry : collect.entrySet()){
if(entry.getValue().size()>1){
for (SupplierImportDTO supplierImportDTO : entry.getValue()) {
supplierImportDTO.setErrorMsgDetail("存在相同商品编码、供应商编码的数据");
supplierImportDTO.setPassCheck(false);
}
}
}