Przeglądaj źródła

Merge branch 'wyp/1108-bugFix' of Server/long-article-recommend into master

wangyunpeng 8 miesięcy temu
rodzic
commit
b8c5d644a5

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

@@ -1460,9 +1460,12 @@ public class DataDashboardService {
                 }
             }
             List<PublishContent> hisPublish = hisPublishMap.get(article.getTitle());
-            long hisMinDate = hisPublish.stream().mapToLong(PublishContent::getPublishTimestamp).min().orElse(0);
-            int explorationInterval = (int) ((article.getUpdateTime() - (hisMinDate / 1000)) / 86400);
-            item.setFirstExplorationIntervalAvg(explorationInterval);
+            if (CollectionUtils.isNotEmpty(hisPublish)) {
+                long hisMinDate = hisPublish.stream().filter(o -> Objects.nonNull(o.getPublishTimestamp()))
+                        .mapToLong(PublishContent::getPublishTimestamp).min().orElse(0);
+                int explorationInterval = (int) ((article.getUpdateTime() - (hisMinDate / 1000)) / 86400);
+                item.setFirstExplorationIntervalAvg(explorationInterval);
+            }
             result.add(item);
         }
         saveDatastatScore(dateStrList, result);