Browse Source

Merge branch 'wyp/1016-null' of Server/long-article-recommend into master

wangyunpeng 9 months ago
parent
commit
3ed04921b7

+ 7 - 6
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/DataDashboardService.java

@@ -181,9 +181,10 @@ public class DataDashboardService {
         }
         Map<String, Map<String, Map<Long, PublishContent>>> publishContentMap = publishContents.stream()
                 .sorted(Comparator.comparingLong(PublishContent::getPublishTimestamp)).collect(
-                Collectors.groupingBy(PublishContent::getPublishAccountId,
-                Collectors.groupingBy(PublishContent::getTitle,
-                        Collectors.toMap(PublishContent::getPublishTimestamp, o -> o, (existing, replacement) -> replacement))));
+                        Collectors.groupingBy(PublishContent::getPublishAccountId,
+                                Collectors.groupingBy(PublishContent::getTitle,
+                                        Collectors.toMap(PublishContent::getPublishTimestamp, o -> o,
+                                                (existing, replacement) -> replacement))));
         // 获取发布内容排版
         List<String> publishContentIds = publishContents.stream().map(PublishContent::getId).collect(Collectors.toList());
         List<PublishContentLayout> publishContentLayoutList = new ArrayList<>();
@@ -456,7 +457,7 @@ public class DataDashboardService {
             if (Objects.nonNull(sourceProducePlan)) {
                 obj.setSourceProducePlanName(sourceProducePlan.getName());
             }
-            List<Article> hisArticles = hisArticleMap.get(article.getTitle());
+            List<Article> hisArticles = hisArticleMap.getOrDefault(article.getTitle(), new ArrayList<>());
             hisArticles = hisArticles.stream().filter(o -> o.getUpdateTime() < (article.getUpdateTime() - 3600 * 8)
                             && (1 == o.getItemIndex() || 2 == o.getItemIndex())
                             && !ScoreStrategy.hisContentLateFilter(o.getUpdateTime())).collect(Collectors.toList());
@@ -518,7 +519,7 @@ public class DataDashboardService {
         for (List<String> partitions : Lists.partition(titleList, 1000)) {
             sourceProduceContentList.addAll(aigcBaseMapper.getSourceProduceContentByTitles(partitions));
         }
-        Map<String, List<ProduceContentDTO>> sourceProduceContentMap =  sourceProduceContentList.stream()
+        Map<String, List<ProduceContentDTO>> sourceProduceContentMap = sourceProduceContentList.stream()
                 .collect(Collectors.groupingBy(ProduceContentDTO::getTitle));
         Map<String, String> sourceTitlePlanIdMap = new HashMap<>();
         List<String> sourceProducePlanIds = new ArrayList<>();
@@ -613,7 +614,7 @@ public class DataDashboardService {
                             sheetToken),
                     HttpMethod.POST, postEntity, String.class);
             JSONObject responseJSON = JSONObject.parseObject(response.getBody());
-            if(0 != responseJSON.getInteger("code")) {
+            if (0 != responseJSON.getInteger("code")) {
                 log.error("doSendFeishuSheet write error :{}", responseJSON.getString("msg"));
             }
             startRow += partition.size();