|
@@ -41,6 +41,10 @@ import java.util.ArrayList;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.function.Predicate;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
@Slf4j
|
|
@@ -284,7 +288,16 @@ public class CarChaoBaoImportService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return list;
|
|
|
+ // 去重
|
|
|
+ return list.stream().filter(distinctByKey(map -> map.get("che_pai_hao"))).toList();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 去重
|
|
|
+ */
|
|
|
+ private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
|
|
+ Set<Object> set = ConcurrentHashMap.newKeySet();
|
|
|
+ return t -> set.add(keyExtractor.apply(t));
|
|
|
}
|
|
|
|
|
|
/**
|