获取公共字段

 

public interface SalaryAccountingStatementImportBaseVO {
    String getIdCard();
}

@Data
public class SalaryAccountingStatementImportVO  implements SalaryAccountingStatementImportBaseVO{}
@Data
public class SalaryAccountingStatementImportOutsourceVO implements  SalaryAccountingStatementImportBaseVO{}
   private void checkImport(List<? extends SalaryAccountingStatementImportBaseVO> data) {
        Map<String, Boolean> idCardPresenceMap = data.stream()
                .collect(Collectors.toMap(
                        SalaryAccountingStatementImportBaseVO::getIdCard,
                        idCard -> true,
                        (existing, replacement) -> true // 当键冲突时,我们不需要合并值,因为只关心键的存在
                ));
        if (idCardPresenceMap.size() != data.size()) {
            throw new BusinessException("导入失败,身份证不匹配");
        }
    }

 

posted @ 2024-09-29 11:39  八英里  阅读(3)  评论(0编辑  收藏  举报