Browse Source

Merge branch 'master' into wyp/1220-articleDeleteByOssPath

# Conflicts:
#	long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java
#	long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java
#	long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml
wangyunpeng 6 months ago
parent
commit
a0cbbf176b

+ 2 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/mapper/longArticle/LongArticleBaseMapper.java

@@ -79,5 +79,7 @@ public interface LongArticleBaseMapper {
 
     void updateDatastatScoreCategory(String title, String category);
 
+    void updateVideoPoolContentBad(String contentTraceId);
+
     void batchInsertArticleReMatchRecord(List<ArticleReMatchRecord> list);
 }

+ 10 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.google.common.collect.Lists;
 import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishContentStatusEnum;
+import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
 import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum;
 import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoAuditResultEnum;
 import com.tzld.longarticle.recommend.server.common.enums.cgi.PQVideoSensitiveLevelEnum;
@@ -427,6 +428,15 @@ public class ArticleAuditService {
         if (CollectionUtils.isEmpty(publishContents)) {
             return;
         }
+        // 处理视频内容池内容
+        List<PublishContentDTO> videoPoolContents = publishContents.stream()
+               .filter(o -> Objects.equals(o.getSourceType(), PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal()))
+               .collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(videoPoolContents)) {
+            for (PublishContentDTO videoPoolContent : videoPoolContents) {
+                longArticleBaseMapper.updateVideoPoolContentBad(videoPoolContent.getSourceId());
+            }
+        }
         // 查找该生成内容下所有已发布内容
         List<String> sourceIds = publishContents.stream().map(PublishContentDTO::getSourceId).distinct().collect(Collectors.toList());
         publishContents = aigcBaseMapper.getPublishContentBySourceIdIn(sourceIds);

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

@@ -173,8 +173,8 @@ public class DataDashboardService {
         doSendFeishuSheet(dateStrList, sheetToken, sheetId, rowNum, rows, 2, styles, delDateStrList);
     }
 
-    private List<NewSortStrategyExport> newSortStrategyData(String beginDate, String endDate,
-                                                            String articleType, Integer filter) {
+    public List<NewSortStrategyExport> newSortStrategyData(String beginDate, String endDate,
+                                                           String articleType, Integer filter) {
         long beginTimestamp = DateUtils.dateStrToTimestamp(beginDate, "yyyyMMdd");
         long endTimestamp = DateUtils.dateStrToTimestamp(endDate, "yyyyMMdd") + 86400;
         List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.findAll();
@@ -378,6 +378,7 @@ public class DataDashboardService {
                     Objects.equals(articleType, ArticleTypeEnum.WUXIANLIU.getVal())) {
                 obj.setStrategy(RankStrategyEnum.INFINITE_STRATEGY.getStrategy());
             }
+            setObjSortInfo(article, obj, date);
             setObjAvgInfo(article, obj, indexAvgInfoMap);
             setObjHisRateInfo(article, obj, hisArticleMap, accountAvgInfoIndexMap, hisArticleDetailInfoMap);
             // aigc 数据
@@ -404,6 +405,27 @@ public class DataDashboardService {
         return NewSortStrategyExport.dbObjToExportObj(saveList);
     }
 
+    private void setObjSortInfo(Article article, DatastatSortStrategy obj, String date) {
+        if (StringUtils.hasText(obj.getStrategy())) {
+            return;
+        }
+        List<String> dateStrList = DateUtils.getBeforeDays(date, date, 7);
+        List<PublishSortLog> sortLogList = publishSortLogRepository.getByGhIdInAndDateStrIn(
+                Collections.singletonList(article.getGhId()), dateStrList);
+        if (CollectionUtils.isEmpty(sortLogList)) {
+            return;
+        }
+        for (PublishSortLog sortLog : sortLogList) {
+            if (sortLog.getTitle().equals(article.getTitle())
+                    && Objects.equals(sortLog.getIndex(), article.getItemIndex())) {
+                obj.setSourceType(sortLog.getSourceType());
+                obj.setSourceId(sortLog.getSourceId());
+                obj.setStrategy(sortLog.getStrategy());
+                break;
+            }
+        }
+    }
+
     private void setObjAigcInfo(Article article, DatastatSortStrategy obj, String date,
                                 Map<String, PublishAccount> publishAccountMap,
                                 Map<String, Map<String, Map<Long, PublishContentDTO>>> publishContentMap,

+ 8 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/RankService.java

@@ -144,12 +144,17 @@ public class RankService implements InitializingBean {
     public static List<Content> contentSourceTypeFilter(String strategy, List<Content> pool, Integer index) {
         Integer sourceType = getStrategyPoolSourceType(strategy, index);
         Integer videoSourceType = PublishPlanInputSourceTypesEnum.longArticleVideoPoolSource.getVal();
+        List<Content> videoPool = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+        List<Content> otherPool = pool.stream().filter(o ->!Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
         if (Objects.nonNull(sourceType) && sourceType.equals(videoSourceType)) {
-            pool = pool.stream().filter(o -> Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(videoPool)) {
+                return videoPool;
+            } else {
+                return otherPool;
+            }
         } else {
-            pool = pool.stream().filter(o -> !Objects.equals(o.getSourceType(), videoSourceType)).collect(Collectors.toList());
+            return otherPool;
         }
-        return pool;
     }
 
     public static void commonAdd38Content(RankParam param, List<Content> result, String[] contentPools,

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/rank/strategy/RankV15Strategy.java

@@ -121,6 +121,7 @@ public class RankV15Strategy implements RankStrategy {
             RankStrategy.sendFeishuFirstPoolEmpty(param, contentPools[0]);
             return new RankResult(result);
         }
+
         // 次
         RankService.commonAddSecondContent(param, result, publishPool, contentPools, contentMap,
                 indexReplacePoolConfigMap, param.getStrategy());

+ 1 - 0
long-article-recommend-service/src/main/resources/application.yml

@@ -28,6 +28,7 @@ spring:
 #      negotiationType: PLAINTEXT
 
 server:
+  internal-port: 30081
   tomcat:
     threads:
       max: 1000

+ 4 - 0
long-article-recommend-service/src/main/resources/mapper/longArticle/LongArticleBaseMapper.xml

@@ -292,6 +292,10 @@
         where title = #{title} and category != #{category};
     </update>
 
+    <update id="updateVideoPoolContentBad">
+        update publish_single_video_source set bad_status = 1 where content_trace_id = #{contentTraceId};
+    </update>
+
     <insert id="batchInsertArticleReMatchRecord">
         insert into article_re_match_record
         (trace_id, content_id, oss_path, status, old_response, create_timestamp)

+ 9 - 0
long-article-recommend-service/src/test/java/com/tzld/longarticle/recommend/server/DataDashboardTest.java

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.model.vo.IntermediateIndicatorsExport;
+import com.tzld.longarticle.recommend.server.model.vo.NewSortStrategyExport;
 import com.tzld.longarticle.recommend.server.service.recommend.DataDashboardService;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
@@ -22,4 +23,12 @@ public class DataDashboardTest {
         List<IntermediateIndicatorsExport> result = dataDashboardService.intermediateIndicatorsData("20241129");
         log.info(JSONObject.toJSONString(result));
     }
+
+    @Test
+    public void newSortStrategyData() {
+        List<NewSortStrategyExport> result = dataDashboardService.newSortStrategyData("20241222",
+                "20241223", "9", 0);
+        log.info(JSONObject.toJSONString(result));
+    }
+
 }