示例代码
private void validProductUniqueness() {
if (CollectionUtils.isNotEmpty(data)) {
Map<String, List<ProjectSchedule>> results = data.stream()
.collect(Collectors.groupingBy(ProjectSchedule::getNpiProductId));
if (results.size() > 1) {
results.entrySet().stream().skip(1).forEach(entry -> {
entry.getValue().stream().forEach(v -> {
errors.add(ExcelError.of(dataRow.get(v), 1, UNIQUENESS));
});
});
}
}
}