wangyunpeng 3 weken geleden
bovenliggende
commit
9f26877efd

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

@@ -812,7 +812,7 @@ public class XxlJobService {
             Map<String, Content> articlesWithHistory = recallService.getArticleWithHistory(paramList, type);
             for (String sourceId : sourceIdList) {
                 Content content = articlesWithHistory.get(sourceId);
-                if (Objects.nonNull(content) && CollectionUtils.isNotEmpty(content.getHisPublishArticleList())) {
+                if (Objects.nonNull(content)) {
                     ArticleTitleHisCache cache = sourceIdToCacheMap.get(sourceId);
                     if (CollectionUtil.isNotEmpty(content.getHisPublishArticleList())) {
                         cache.setHisPublishArticleList(JSONObject.toJSONString(content.getHisPublishArticleList()));

+ 0 - 16
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java

@@ -335,8 +335,6 @@ public class RecallService implements ApplicationContextAware {
         long start = System.currentTimeMillis();
         contentList.forEach(content -> content.setTitleMd5(Md5Util.encoderByMd5(content.getTitle())));
         List<String> sourceIdList = contentList.stream().map(Content::getSourceId).distinct().collect(Collectors.toList());
-        Map<String, Content> sourceIdToContentMap = contentList.stream().collect(
-                Collectors.toMap(Content::getSourceId, Function.identity(), (o1, o2) -> o2));
         // 根据sourceId查询数据库获取数据
         List<ArticleTitleHisCache> articleTitleHisCacheList = new ArrayList<>(sourceIdList.size());
         for (List<String> partition : Lists.partition(sourceIdList, 1000)) {
@@ -350,17 +348,6 @@ public class RecallService implements ApplicationContextAware {
         List<AccountCorrelation> accountCorrelationList = accountCorrelationRepository.findByGhIdAndStatus(ghId, 1);
         Map<String, Double> accountCorrelationMap = accountCorrelationList.stream().collect(
                 Collectors.toMap(AccountCorrelation::getRelGhId, AccountCorrelation::getCorrelation));
-        List<TitleHisCacheParam> paramList = sourceIdList.stream().map(sourceId -> {
-            Content content = sourceIdToContentMap.get(sourceId);
-            TitleHisCacheParam cacheParam = new TitleHisCacheParam();
-            cacheParam.setSourceId(sourceId);
-            cacheParam.setTitleMd5(content.getTitleMd5());
-            cacheParam.setTitle(content.getTitle());
-            cacheParam.setCrawlerTitle(content.getCrawlerTitle());
-            cacheParam.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
-            cacheParam.setCategory(content.getCategory());
-            return cacheParam;
-        }).collect(Collectors.toList());
         List<Content> newCacheSaveList = new ArrayList<>();
         Set<String> newCacheSourceIdSet = new HashSet<>();
         for (Content content : contentList) {
@@ -438,9 +425,6 @@ public class RecallService implements ApplicationContextAware {
         for (List<String> titleMd5s : titleMd5Partition) {
             hisArticleList.addAll(articleMapper.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, type, 1));
         }
-        if (CollectionUtils.isEmpty(hisArticleList)) {
-            return result;
-        }
         Map<String, Map<Integer, List<Article>>> map = hisArticleList.stream()
                 .collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
         Set<String> snList = hisArticleList.stream().map(Article::getWxSn).collect(Collectors.toSet());