Browse Source

Merge branch 'wyp/1031-articlePublishTimestamp' of Server/long-article-recommend into master

wangyunpeng 8 months ago
parent
commit
255a2beb2f

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/model/dto/ContentHisPublishArticle.java

@@ -17,6 +17,7 @@ public class ContentHisPublishArticle {
     private Integer itemIndex;
     private Integer viewCount;
     private Long updateTime;
+    private Long publishTimestamp;
     private Integer avgViewCount;
     private Double viewCountRate;
     private Integer firstViewCount;

+ 4 - 4
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/repository/crawler/ArticleRepository.java

@@ -19,13 +19,13 @@ public interface ArticleRepository extends JpaRepository<Article, String> {
     List<Article> getByGhIdInAndAppMsgIdInAndItemIndexAndTypeEqualsAndStatusEquals(Set<String> ghIds, Set<String> appMsgIds,
                                                                                    Integer itemIndex, String type, Integer status);
 
-    List<Article> getByGhIdInAndUpdateTimeBetweenAndTypeEquals(List<String> ghIds, Long updateTimeStart, Long updateTimeEnd, String type);
+    List<Article> getByGhIdInAndPublishTimestampBetweenAndTypeEquals(List<String> ghIds, Long publishTimestampStart, Long publishTimestampEnd, String type);
 
-    List<Article> getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(List<String> ghIds, Long updateTime, String type);
+    List<Article> getByGhIdInAndPublishTimestampGreaterThanAndTypeEquals(List<String> ghIds, Long publishTimestamp, String type);
 
-    List<Article> getByGhIdInAndUpdateTimeLessThanAndTypeEquals(List<String> ghIds, Long updateTIme, String type);
+    List<Article> getByGhIdInAndPublishTimestampLessThanAndTypeEquals(List<String> ghIds, Long publishTimestamp, String type);
 
-    List<Article> getByUpdateTimeGreaterThanAndTypeEquals(Long updateTIme, String type);
+    List<Article> getByPublishTimestampGreaterThanAndTypeEquals(Long publishTimestamp, String type);
 
     List<Article> getByGhIdAndItemIndexAndTypeEqualsAndStatusEquals(String ghId, Integer itemIndex, String type, Integer status);
 

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

@@ -100,14 +100,14 @@ public class ArticleService {
             syncAigcIdByWxSn(param.getWxSn());
             return;
         }
-        long minUpdateTimestamp;
+        long minTimestamp;
         if (StringUtils.hasText(param.getDateStr())) {
-            minUpdateTimestamp = DateUtils.dateStrToTimestamp(param.getDateStr(), "yyyyMMdd") - 86400 * 7;
+            minTimestamp = DateUtils.dateStrToTimestamp(param.getDateStr(), "yyyyMMdd") - 86400 * 7;
         } else {
-            minUpdateTimestamp = DateUtils.getTodayStart() - 86400 * 7;
+            minTimestamp = DateUtils.getTodayStart() - 86400 * 7;
         }
         while (true) {
-            List<Article> articleList = crawlerBaseMapper.getWaitingFindArticle(minUpdateTimestamp);
+            List<Article> articleList = crawlerBaseMapper.getWaitingFindArticle(minTimestamp);
             if (CollectionUtils.isEmpty(articleList)) {
                 return;
             }
@@ -120,14 +120,14 @@ public class ArticleService {
                         cdl.countDown();
                     }
                 });
-                minUpdateTimestamp = minUpdateTimestamp > article.getUpdateTime() ? minUpdateTimestamp : article.getUpdateTime();
+                minTimestamp = minTimestamp > article.getPublishTimestamp() ? minTimestamp : article.getPublishTimestamp();
             }
             try {
                 cdl.await();
             } catch (Exception e) {
                 log.error("cdl error", e);
             }
-            log.info("findSource timestamp:{}", minUpdateTimestamp);
+            log.info("findSource timestamp:{}", minTimestamp);
         }
     }
 
@@ -135,7 +135,7 @@ public class ArticleService {
         Article article = articleRepository.getByWxSn(wxSn);
         String ghId = article.getGhId();
         String title = article.getTitle();
-        Long publishTimestamp = article.getUpdateTime() * 1000;
+        Long publishTimestamp = article.getPublishTimestamp() * 1000;
         PublishAccount publishAccount = publishAccountRepository.getByGhId(ghId);
         List<PublishContent> publishContentList = aigcBaseMapper.getNearestPublishContent(publishAccount.getId(), publishTimestamp, 100);
         if (CollectionUtils.isEmpty(publishContentList)) {

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

@@ -150,7 +150,7 @@ public class DataDashboardService {
         log.info("newSortStrategyData accountAvgInfoList finish");
         List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
 
-        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeBetweenAndTypeEquals(ghIds,
+        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampBetweenAndTypeEquals(ghIds,
                 beginTimestamp, endTimestamp, ArticleTypeEnum.QUNFA.getVal());
         Map<String, Map<String, Map<Integer, Article>>> articleMap = articleList.stream().collect(Collectors.groupingBy(Article::getGhId,
                 Collectors.groupingBy(Article::getAppMsgId, Collectors.toMap(Article::getItemIndex, o -> o))));
@@ -307,10 +307,10 @@ public class DataDashboardService {
             Article firstArticle = articleMap.get(article.getGhId()).get(article.getAppMsgId()).get(1);
             Map<String, String> dateStrategy = sortStrategyMap.get(article.getGhId());
             AccountAvgInfo avgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
-                    article.getUpdateTime(), article.getItemIndex());
+                    article.getPublishTimestamp(), article.getItemIndex());
             AccountAvgInfo firstAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
-                    article.getUpdateTime(), 1);
-            String date = DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyyMMdd");
+                    article.getPublishTimestamp(), 1);
+            String date = DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd");
             setObjBaseInfo(article, obj, date);
             if (Objects.nonNull(firstArticle)) {
                 obj.setFirstViewCount(firstArticle.getShowViewCount());
@@ -438,9 +438,9 @@ public class DataDashboardService {
                                    Map<String, Map<String, Map<String, AccountAvgInfo>>> accountAvgInfoIndexMap,
                                    Map<String, List<ArticleDetailInfo>> hisArticleDetailInfoMap) {
         List<Article> hisArticles = hisArticleMap.getOrDefault(article.getTitle(), new ArrayList<>());
-        hisArticles = hisArticles.stream().filter(o -> o.getUpdateTime() < (article.getUpdateTime() - 3600 * 8)
+        hisArticles = hisArticles.stream().filter(o -> o.getPublishTimestamp() < (article.getPublishTimestamp() - 3600 * 8)
                 && (1 == o.getItemIndex() || 2 == o.getItemIndex())
-                && !ScoreStrategy.hisContentLateFilter(o.getUpdateTime())).collect(Collectors.toList());
+                && !ScoreStrategy.hisContentLateFilter(o.getPublishTimestamp())).collect(Collectors.toList());
         Integer readCount = 0;
         Double readAvgCount = 0.0;
         int firstCount = 0;
@@ -448,7 +448,7 @@ public class DataDashboardService {
         for (Article hisArticle : hisArticles) {
             readCount += hisArticle.getShowViewCount();
             AccountAvgInfo accountAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, hisArticle.getGhId(),
-                    hisArticle.getUpdateTime(), hisArticle.getItemIndex());
+                    hisArticle.getPublishTimestamp(), hisArticle.getItemIndex());
             if (Objects.nonNull(accountAvgInfo)) {
                 readAvgCount += accountAvgInfo.getReadAvg();
             }
@@ -486,13 +486,13 @@ public class DataDashboardService {
         obj.setPosition(article.getItemIndex());
         obj.setViewCount(article.getShowViewCount());
         obj.setDateStr(date);
-        obj.setPublishTime(DateUtils.timestampToYMDStr(article.getUpdateTime(), "HH:mm:ss"));
+        obj.setPublishTime(DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "HH:mm:ss"));
         obj.setWxSn(article.getWxSn());
     }
 
     private void setObjArticleDetailInfo(Article article, NewSortStrategyExport obj, List<ArticleDetailInfo> articleDetailInfos) {
         if (CollectionUtils.isNotEmpty(articleDetailInfos)) {
-            Date publishDate = DateUtils.getStartDateOfDay(article.getUpdateTime());
+            Date publishDate = DateUtils.getStartDateOfDay(article.getPublishTimestamp());
             articleDetailInfos = articleDetailInfos.stream().filter(o -> !o.getRecallDt().before(publishDate))
                     .collect(Collectors.toList());
             Date minDate = articleDetailInfos.stream().map(ArticleDetailInfo::getRecallDt).min(Date::compareTo).orElse(new Date());
@@ -835,9 +835,9 @@ public class DataDashboardService {
                 .collect(Collectors.groupingBy(AccountAvgInfo::getGhId, Collectors.groupingBy(AccountAvgInfo::getUpdateTime,
                         Collectors.toMap(AccountAvgInfo::getPosition, o -> o))));
         List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
-        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeLessThanAndTypeEquals(ghIds, dateEnd, ArticleTypeEnum.QUNFA.getVal());
+        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampLessThanAndTypeEquals(ghIds, dateEnd, ArticleTypeEnum.QUNFA.getVal());
         Map<String, Article> articleMap = articleList.stream().collect(Collectors.toMap(Article::getWxSn, o -> o));
-        List<Article> todayPublish = articleList.stream().filter(o -> o.getUpdateTime() > dateStart).collect(Collectors.toList());
+        List<Article> todayPublish = articleList.stream().filter(o -> o.getPublishTimestamp() > dateStart).collect(Collectors.toList());
         if (CollectionUtils.isEmpty(todayPublish)) {
             return new ArrayList<>();
         }
@@ -859,7 +859,7 @@ public class DataDashboardService {
         List<NewSortStrategyExport> newSortStrategyExportList = getNewSortStrategyExportList(todayPublish,
                 articleDetailInfoMap, accountAvgInfoIndexMap);
 
-        List<Article> futurePublishList = articleRepository.getByUpdateTimeGreaterThanAndTypeEquals(dateEnd, ArticleTypeEnum.QUNFA.getVal());
+        List<Article> futurePublishList = articleRepository.getByPublishTimestampGreaterThanAndTypeEquals(dateEnd, ArticleTypeEnum.QUNFA.getVal());
         Map<String, List<Article>> futurePublishMap = futurePublishList.stream().collect(Collectors.groupingBy(Article::getTitle));
 
         Map<String, List<String>> titleTypeMap = new HashMap<>();
@@ -875,7 +875,7 @@ public class DataDashboardService {
             }
             IntermediateIndicatorsExport item = resultMap.get(type);
             List<Article> list = hisPublishMap.get(data.getTitle());
-            list = list.stream().filter(publish -> publish.getUpdateTime() < (article.getUpdateTime() - 3600 * 8))
+            list = list.stream().filter(publish -> publish.getPublishTimestamp() < (article.getPublishTimestamp() - 3600 * 8))
                     .collect(Collectors.toList());
             Integer poolLevel = getArticlePoolLevel(data.getGhId(), list, small);
             // L1层仅统计历史发布在3-8位置文章
@@ -887,7 +887,7 @@ public class DataDashboardService {
             List<String> poolTitles = titlePoolMap.computeIfAbsent(poolLevel, k -> new ArrayList<>());
 
             AccountAvgInfo accountAvgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
-                    article.getUpdateTime(), article.getItemIndex());
+                    article.getPublishTimestamp(), article.getItemIndex());
 //            // L4层仅统计 稳定-大和稳定
 //            if ("L4".equals(item.getType()) && (Objects.isNull(accountAvgInfo)
 //                    || !StringUtils.hasText(accountAvgInfo.getAccountStatus())
@@ -1065,8 +1065,8 @@ public class DataDashboardService {
             List<ArticleDetailInfo> articleDetailInfos = articleDetailInfoMap.get(article.getWxSn());
             setObjArticleDetailInfo(article, obj, articleDetailInfos);
             AccountAvgInfo avgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, article.getGhId(),
-                    article.getUpdateTime(), article.getItemIndex());
-            String date = DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyyMMdd");
+                    article.getPublishTimestamp(), article.getItemIndex());
+            String date = DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd");
             setObjBaseInfo(article, obj, date);
             setObjAvgInfo(article, obj, avgInfo);
             result.add(obj);
@@ -1085,13 +1085,13 @@ public class DataDashboardService {
                                              Integer poolLevel,
                                              List<String> small,
                                              Map<String, List<Article>> hisPublishMap) {
-        Long hisMinDate = hisPublish.stream().mapToLong(Article::getUpdateTime).min().orElse(0);
+        Long hisMinDate = hisPublish.stream().mapToLong(Article::getPublishTimestamp).min().orElse(0);
         int scorePublishTime = scoreHisPublishTimeMap.computeIfAbsent(type, k -> 0);
         Set<String> wxsnHisDistinctSet = wxsnHisDistinctSetMap.computeIfAbsent(type, k -> new HashSet<>());
         for (Article publish : hisPublish) {
             if (poolLevel == 1) {
                 List<Article> list = hisPublishMap.get(publish.getTitle());
-                list = list.stream().filter(o -> o.getUpdateTime() < (publish.getUpdateTime() - 3600 * 8))
+                list = list.stream().filter(o -> o.getPublishTimestamp() < (publish.getPublishTimestamp() - 3600 * 8))
                         .collect(Collectors.toList());
                 Integer hisPublishPoolLevel = getArticlePoolLevel(publish.getGhId(), list, small);
                 if (hisPublishPoolLevel > poolLevel) {
@@ -1099,7 +1099,7 @@ public class DataDashboardService {
                 }
             }
             AccountAvgInfo avgInfo = getAccountAvgInfo(accountAvgInfoIndexMap, publish.getGhId(),
-                    publish.getUpdateTime(), publish.getItemIndex());
+                    publish.getPublishTimestamp(), publish.getItemIndex());
             if (wxsnHisDistinctSet.contains(publish.getWxSn())) {
                 continue;
             }
@@ -1151,7 +1151,7 @@ public class DataDashboardService {
             item.setAverageFirstLayerFissionToViewBaseRatio(averageFirstLayerFissionToViewBaseRatio);
             Map<String, Map<Integer, PublishSortLog>> dateSortMap = publishSortLogMap.get(publish.getGhId());
             if (Objects.nonNull(dateSortMap)) {
-                String publishDateStr = DateUtils.timestampToYMDStr(publish.getUpdateTime(), "yyyyMMdd");
+                String publishDateStr = DateUtils.timestampToYMDStr(publish.getPublishTimestamp(), "yyyyMMdd");
                 Map<Integer, PublishSortLog> indexMap = dateSortMap.get(publishDateStr);
                 if (Objects.nonNull(indexMap)) {
                     PublishSortLog log = indexMap.get(publish.getItemIndex());
@@ -1169,7 +1169,7 @@ public class DataDashboardService {
                 }
             }
             double firstExplorationIntervalAvg = Double.isNaN(item.getFirstExplorationIntervalAvg()) ? 0.0 : item.getFirstExplorationIntervalAvg();
-            double explorationInterval = (publish.getUpdateTime() - hisMinDate) / 86400.0;
+            double explorationInterval = (publish.getPublishTimestamp() - hisMinDate) / 86400.0;
             firstExplorationIntervalAvg = (firstExplorationIntervalAvg * (item.getTotalArticleReleaseCountNonInfinite() - 1)
                     + explorationInterval) / item.getTotalArticleReleaseCountNonInfinite();
             item.setFirstExplorationIntervalAvg(firstExplorationIntervalAvg);
@@ -1386,10 +1386,10 @@ public class DataDashboardService {
         sortLogList.sort(Comparator.comparing(PublishSortLog::getGhId).thenComparing(PublishSortLog::getDateStr));
         List<String> ghIds = sortLogList.stream().map(PublishSortLog::getGhId).distinct().collect(Collectors.toList());
         long minTimestamp = DateUtils.dateStrToTimestamp(dateStrList.get(0), "yyyyMMdd");
-        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(ghIds, minTimestamp, ArticleTypeEnum.QUNFA.getVal());
+        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampGreaterThanAndTypeEquals(ghIds, minTimestamp, ArticleTypeEnum.QUNFA.getVal());
         articleList = articleList.stream().filter(o -> o.getItemIndex() == 1 || o.getItemIndex() == 2).collect(Collectors.toList());
         Map<String, Map<String, Map<Integer, Article>>> articleMap = articleList.stream().collect(
-                Collectors.groupingBy(Article::getGhId, Collectors.groupingBy(o -> DateUtils.timestampToYMDStr(o.getUpdateTime(), "yyyyMMdd"),
+                Collectors.groupingBy(Article::getGhId, Collectors.groupingBy(o -> DateUtils.timestampToYMDStr(o.getPublishTimestamp(), "yyyyMMdd"),
                         Collectors.toMap(Article::getItemIndex, o -> o,
                                 (existing, replacement) -> replacement))));
         List<String> titleList = articleList.stream().map(Article::getTitle).distinct().collect(Collectors.toList());
@@ -1449,7 +1449,7 @@ public class DataDashboardService {
             if (Objects.nonNull(map)) {
                 List<String> avgMapDateList = new ArrayList<>(map.keySet());
                 String publishDate = DateUtils.findNearestDate(avgMapDateList,
-                        DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyy-MM-dd"), "yyyy-MM-dd");
+                        DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyy-MM-dd"), "yyyy-MM-dd");
                 Map<String, AccountAvgInfo> avgIndexMap = map.get(publishDate);
                 if (Objects.nonNull(avgIndexMap)) {
                     AccountAvgInfo accountAvgInfo = avgIndexMap.get(String.valueOf(publishSortLog.getIndex()));
@@ -1463,7 +1463,7 @@ public class DataDashboardService {
             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);
+                int explorationInterval = (int) ((article.getPublishTimestamp() - (hisMinDate / 1000)) / 86400);
                 item.setFirstExplorationIntervalAvg(explorationInterval);
             }
             result.add(item);

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

@@ -307,7 +307,7 @@ public class RecallService implements ApplicationContextAware {
             }
             content.setHisPublishArticleList(new ArrayList<>());
             for (Article hisArticle : hisArticles) {
-                if (ScoreStrategy.hisContentLateFilter(hisArticle.getUpdateTime())) {
+                if (ScoreStrategy.hisContentLateFilter(hisArticle.getPublishTimestamp())) {
                     continue;
                 }
                 ContentHisPublishArticle article = new ContentHisPublishArticle();
@@ -318,7 +318,7 @@ public class RecallService implements ApplicationContextAware {
                 // 设置账号位置阅读均值
                 int avgViewCount = 0;
                 Map<String, Map<String, AccountAvgInfo>> dateAvgMap = accountAvgInfoIndexMap.get(hisArticle.getGhId());
-                String hisPublishDate = DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyy-MM-dd");
+                String hisPublishDate = DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyy-MM-dd");
                 if (Objects.nonNull(dateAvgMap)) {
                     List<String> avgMapDateList = new ArrayList<>(dateAvgMap.keySet());
                     hisPublishDate = DateUtils.findNearestDate(avgMapDateList, hisPublishDate, "yyyy-MM-dd");
@@ -388,14 +388,14 @@ public class RecallService implements ApplicationContextAware {
             }
             if (CollectionUtils.isEmpty(article.getArticleDetailInfoList())) {
                 // 仅判断7.12以后发布文章
-                if (article.getUpdateTime() > 1720713600 && contentHisFeishuEnable) {
+                if (article.getPublishTimestamp() > 1720713600 && contentHisFeishuEnable) {
                     FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
                             "历史表现裂变特征获取失败\n"
                                     + "ghId: " + article.getGhId() + "\n"
                                     + "账号名称: " + article.getAccountName() + "\n"
                                     + "位置: " + article.getItemIndex() + "\n"
                                     + "标题: " + article.getTitle() + "\n"
-                                    + "发布时间: " + DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyyMMdd") + "\n"
+                                    + "发布时间: " + DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyyMMdd") + "\n"
                                     + "wxsn: " + article.getWxSn());
                 }
                 continue;
@@ -424,7 +424,7 @@ public class RecallService implements ApplicationContextAware {
                 t0FissionByReadAvgCorrelationSum += article.getT0FissionByReadAvg() * correlation;
             }
             fissionSum += sumFission0;
-            int hour = DateUtils.getHourByTimestamp(article.getUpdateTime());
+            int hour = DateUtils.getHourByTimestamp(article.getPublishTimestamp());
             if (hour >= 12) {
                 fissionWeightSum += sumFission0 / morningNoonFissionRate;
             } else {

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

@@ -69,7 +69,7 @@ public class ViewCountRateCorrelationStrategy implements ScoreStrategy {
                 double maxAvgViewCount = 0D;
                 for (ContentHisPublishArticle hisItem : content.getHisPublishArticleList()) {
                     // 过滤掉发布时间晚于19点数据
-                    if (ScoreStrategy.hisContentLateFilter(hisItem.getUpdateTime())) {
+                    if (ScoreStrategy.hisContentLateFilter(hisItem.getPublishTimestamp())) {
                         continue;
                     }
                     if (hisItem.isInnerAccount() && Objects.nonNull(hisItem.getViewCount())

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

@@ -69,7 +69,7 @@ public class ViewCountRateStrategy implements ScoreStrategy {
                 double maxAvgViewCount = 0D;
                 for (ContentHisPublishArticle hisItem : content.getHisPublishArticleList()) {
                     // 过滤掉发布时间晚于19点数据
-                    if (ScoreStrategy.hisContentLateFilter(hisItem.getUpdateTime())) {
+                    if (ScoreStrategy.hisContentLateFilter(hisItem.getPublishTimestamp())) {
                         continue;
                     }
                     if (hisItem.isInnerAccount() && Objects.nonNull(hisItem.getViewCount())

+ 1 - 1
long-article-recommend-service/src/main/resources/mapper/crawler/CrawlerBaseMapper.xml

@@ -56,7 +56,7 @@
 
     <select id="getWaitingFindArticle"
             resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
-        select * from official_articles_v2 where updateTime > #{timestamp} order by updateTime limit 100
+        select * from official_articles_v2 where publish_timestamp > #{timestamp} order by publish_timestamp limit 100
     </select>
 
 </mapper>

+ 8 - 8
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/RecommendTest.java

@@ -67,7 +67,7 @@ public class RecommendTest {
 //    @Test
 //    void exportData() {
 //        Set<String> ghIds = new HashSet<>(Arrays.asList("gh_adca24a8f429", "gh_e0eb490115f5", "gh_51e4ad40466d", "gh_95ed5ecf9363"));
-//        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(ghIds, 1722441600L, ArticleTypeEnum.qunfa.getVal());
+//        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampGreaterThanAndTypeEquals(ghIds, 1722441600L, ArticleTypeEnum.qunfa.getVal());
 //
 //        Map<String, Map<Integer, List<Article>>> map = articleList.stream()
 //                .collect(Collectors.groupingBy(Article::getTitle, Collectors.groupingBy(Article::getItemIndex)));
@@ -101,7 +101,7 @@ public class RecommendTest {
 //            Map<String, AccountAvgInfo> accountAvgInfoMap = accountAvgInfoIndexMap.get(article.getGhId());
 //            AccountAvgInfo avgInfo = accountAvgInfoMap.get(article.getItemIndex().toString());
 //            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-//            String date = sdf.format(new Date(article.getUpdateTime() * 1000));
+//            String date = sdf.format(new Date(article.getPublishTimestamp() * 1000));
 //            JSONObject obj = new JSONObject();
 //            obj.put("ghId", article.getGhId());
 //            obj.put("accountName", article.getAccountName());
@@ -188,8 +188,8 @@ public class RecommendTest {
         List<String> morning = Lists.newArrayList("gh_084a485e859a", "gh_183d80deffb8", "gh_5ff48e9fb9ef", "gh_6d9f36e3a7be", "gh_9f8dc5b0c74e", "gh_e0eb490115f5", "gh_e24da99dc899");
         List<String> noon = Lists.newArrayList("gh_080bb43aa0dc", "gh_0c89e11f8bf3", "gh_192c9cf58b13", "gh_1b27dd1beeca", "gh_1d887d61088c", "gh_29074b51f2b7", "gh_3ed305b5817f", "gh_5ae65db96cb7", "gh_6b7c2a257263", "gh_6cfd1132df94", "gh_6d205db62f04", "gh_72bace6b3059", "gh_7e5818b2dd83", "gh_7f5075624a50", "gh_89ef4798d3ea", "gh_9877c8541764", "gh_9eef14ad6c16", "gh_a2901d34f75b", "gh_b15de7c99912", "gh_b676b7ad9b74", "gh_b6f2c5332c72", "gh_bfe5b705324a", "gh_bff0bcb0694a", "gh_c5cdf60d9ab4", "gh_c69776baf2cd", "gh_d49df5e974ca", "gh_d4dffc34ac39", "gh_dd4c857bbb36", "gh_ee78360d06f5", "gh_f25b5fb01977", "gh_f902cea89e48", "gh_ff487cb5dab3");
         String dateStr = "2024-09-12";
-        List<Article> articleList = articleRepository.getByUpdateTimeGreaterThanAndTypeEquals(1725120000L, ArticleTypeEnum.QUNFA.getVal());
-        articleList = articleList.stream().filter(o -> o.getItemIndex() == 1 && o.getUpdateTime() < 1726675200).collect(Collectors.toList());
+        List<Article> articleList = articleRepository.getByPublishTimestampGreaterThanAndTypeEquals(1725120000L, ArticleTypeEnum.QUNFA.getVal());
+        articleList = articleList.stream().filter(o -> o.getItemIndex() == 1 && o.getPublishTimestamp() < 1726675200).collect(Collectors.toList());
         Map<String, List<Article>> map = articleList.stream().collect(Collectors.groupingBy(Article::getTitle));
         List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.getAllByUpdateTime(dateStr);
         accountAvgInfoList = accountAvgInfoList.stream().filter(o -> o.getPosition().equals("1")).collect(Collectors.toList());
@@ -269,10 +269,10 @@ public class RecommendTest {
         sortLogList = sortLogList.stream().filter(o -> o.getIndex() == 1).collect(Collectors.toList());
         sortLogList.sort(Comparator.comparing(PublishSortLog::getGhId).thenComparing(PublishSortLog::getDateStr));
         List<String> ghIds = sortLogList.stream().map(PublishSortLog::getGhId).distinct().collect(Collectors.toList());
-        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeGreaterThanAndTypeEquals(ghIds, 1727452800L, ArticleTypeEnum.QUNFA.getVal());
+        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampGreaterThanAndTypeEquals(ghIds, 1727452800L, ArticleTypeEnum.QUNFA.getVal());
         articleList = articleList.stream().filter(o -> o.getItemIndex() == 1).collect(Collectors.toList());
         Map<String, Map<String, Article>> articleMap = articleList.stream().collect(Collectors.groupingBy(Article::getGhId, Collectors.toMap(
-                o -> DateUtils.timestampToYMDStr(o.getUpdateTime(),"yyyyMMdd"), o -> o,
+                o -> DateUtils.timestampToYMDStr(o.getPublishTimestamp(),"yyyyMMdd"), o -> o,
                 (existing, replacement) -> replacement)));
         List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.getAllByGhIdIn(new HashSet<>(ghIds));
         Map<String, Map<String, AccountAvgInfo>> accountAvgInfoMap = accountAvgInfoList.stream()
@@ -380,7 +380,7 @@ public class RecommendTest {
             if (Objects.nonNull(map)) {
                 List<String> avgMapDateList = new ArrayList<>(map.keySet());
                 String publishDate = DateUtils.findNearestDate(avgMapDateList,
-                        DateUtils.timestampToYMDStr(article.getUpdateTime(), "yyyy-MM-dd"), "yyyy-MM-dd");
+                        DateUtils.timestampToYMDStr(article.getPublishTimestamp(), "yyyy-MM-dd"), "yyyy-MM-dd");
                 AccountAvgInfo accountAvgInfo = map.get(publishDate);
                 if (Objects.nonNull(accountAvgInfo)) {
                     cell.setCellValue(accountAvgInfo.getReadAvg());
@@ -530,7 +530,7 @@ public class RecommendTest {
         List<String> ghIds = Arrays.asList("gh_d7fa1998b4e1","gh_52100b6803fb","gh_8d7fc54d5026");
         List<String> accountNames = Arrays.asList("生活超读","灵读生活","生活情感读");
         List<Integer> fans = Arrays.asList(85759,103083,79214);
-        List<Article> articleList = articleRepository.getByGhIdInAndUpdateTimeLessThanAndTypeEquals(
+        List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampLessThanAndTypeEquals(
                 Arrays.asList("gh_02f5bca5b5d9"), 1729353600L, ArticleTypeEnum.QUNFA.getVal());
         for (int i = 0; i < ghIds.size(); i++) {
             String ghId = ghIds.get(i);

+ 1 - 1
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/ScoreStrategyTest.java

@@ -56,7 +56,7 @@ public class ScoreStrategyTest {
         System.out.println(JSONObject.toJSONString(param.getContents().get(0).getHisPublishArticleList()));
         List<Score> result = viewCountRateStrategy.score(param);
         System.out.println(JSONObject.toJSONString(result));
-        //hisArticleList = hisArticleList.stream().filter(o -> o.getUpdateTime() < 1729267200).collect(Collectors.toList());
+        //hisArticleList = hisArticleList.stream().filter(o -> o.getPublishTimestamp() < 1729267200).collect(Collectors.toList());
     }
 
 }