|
@@ -361,7 +361,6 @@ public class RecallService implements ApplicationContextAware {
|
|
|
cacheParam.setCategory(content.getCategory());
|
|
|
return cacheParam;
|
|
|
}).collect(Collectors.toList());
|
|
|
- Map<String, Content> articlesWithHistory = getArticleWithHistory(paramList, type);
|
|
|
List<Content> newCacheSaveList = new ArrayList<>();
|
|
|
Set<String> newCacheSourceIdSet = new HashSet<>();
|
|
|
for (Content content : contentList) {
|
|
@@ -380,21 +379,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
content.setRootPublishTimestamp(cache.getRootPublishTimestamp());
|
|
|
content.setHisPublishArticleList(hisPublishArticleList);
|
|
|
setT0Data(content, ghId);
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (articlesWithHistory.containsKey(content.getSourceId())) {
|
|
|
- Content articleWithHistory = articlesWithHistory.get(content.getSourceId());
|
|
|
- content.setHisPublishArticleList(articleWithHistory.getHisPublishArticleList());
|
|
|
- if (CollectionUtils.isNotEmpty(articleWithHistory.getCategory())) {
|
|
|
- content.setCategory(articleWithHistory.getCategory());
|
|
|
- }
|
|
|
- content.setProducePlanId(articleWithHistory.getProducePlanId());
|
|
|
- content.setKimiSafeScore(articleWithHistory.getKimiSafeScore());
|
|
|
- content.setRootPublishTimestamp(articleWithHistory.getRootPublishTimestamp());
|
|
|
- for (ContentHisPublishArticle article : content.getHisPublishArticleList()) {
|
|
|
- article.setCorrelation(Optional.ofNullable(accountCorrelationMap.get(article.getGhId())).orElse(0.0));
|
|
|
- }
|
|
|
- setT0Data(content, ghId);
|
|
|
+ } else {
|
|
|
if (!newCacheSourceIdSet.contains(content.getSourceId())) {
|
|
|
newCacheSaveList.add(content);
|
|
|
newCacheSourceIdSet.add(content.getSourceId());
|
|
@@ -413,9 +398,6 @@ public class RecallService implements ApplicationContextAware {
|
|
|
List<ArticleTitleHisCache> cacheList = new ArrayList<>();
|
|
|
try {
|
|
|
for (Content content : saveList) {
|
|
|
- if (CollectionUtils.isEmpty(content.getHisPublishArticleList())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
ArticleTitleHisCache cache = new ArticleTitleHisCache();
|
|
|
BeanUtils.copyProperties(content, cache);
|
|
|
cache.setType(type);
|
|
@@ -425,13 +407,12 @@ public class RecallService implements ApplicationContextAware {
|
|
|
cache.setCategory(JSONObject.toJSONString(content.getCategory()));
|
|
|
}
|
|
|
cache.setRootPublishTimestamp(content.getRootPublishTimestamp());
|
|
|
- cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
|
|
|
+ if (CollectionUtils.isNotEmpty(content.getHisPublishArticleList())) {
|
|
|
+ cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));
|
|
|
+ }
|
|
|
cache.setCreateTimestamp(System.currentTimeMillis());
|
|
|
cacheList.add(cache);
|
|
|
}
|
|
|
- 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());
|