|
@@ -341,6 +341,13 @@ public class RecallService implements ApplicationContextAware {
|
|
|
if (CollectionUtils.isEmpty(cacheList)) {
|
|
|
return;
|
|
|
}
|
|
|
+ List<String> sourceIds = cacheList.stream().map(ArticleTitleHisCache::getSourceId).collect(Collectors.toList());
|
|
|
+ List<ArticleTitleHisCache> existsList = articleTitleHisCacheRepository.getBySourceIdInAndType(sourceIds, type);
|
|
|
+ Set<String> existsIds = existsList.stream().map(ArticleTitleHisCache::getSourceId).collect(Collectors.toSet());
|
|
|
+ cacheList = cacheList.stream().filter(o -> !existsIds.contains(o.getSourceId())).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isEmpty(cacheList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
longArticleBaseMapper.batchInsertArticleTitleHisCache(cacheList);
|
|
|
} catch (Exception e) {
|
|
|
log.error("saveArticleTitleHisCache error:{}", e.getMessage());
|