Explorar el Código

Merge branch 'wyp/0306-cachePlanId' of Server/long-article-recommend into master

wangyunpeng hace 4 meses
padre
commit
f26dbaf816

+ 1 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/enums/longArticle/VideoPoolPlatformEnum.java

@@ -10,6 +10,7 @@ public enum VideoPoolPlatformEnum {
     GZH("gzh", "公众号视频"),
     HkSP("hksp", "好看视频"),
     SPH("sph", "视频号视频"),
+    TOUTIAO("toutiao", "头条视频"),
     ;
 
     private final String platform;

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

@@ -389,6 +389,10 @@ public class ArticleVideoAuditService {
     }
 
     public void addAudit(ArticleVideoAuditAddAuditParam param) {
+        LongArticleTitleAudit exists = titleAuditRepository.getByContentId(param.getContentId());
+        if (Objects.nonNull(exists)) {
+            return;
+        }
         ProducePlanExeRecord exeRecord = producePlanExeRecordRepository.getByPlanExeId(param.getContentId());
         List<String> auditUser = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j");
         Random random = new Random();

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

@@ -20,6 +20,7 @@ import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseM
 import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.dto.ContentHisPublishArticle;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerMetaArticle;
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProducePlanExeRecord;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom;
 import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent;
 import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
@@ -30,6 +31,7 @@ import com.tzld.longarticle.recommend.server.model.entity.longArticle.*;
 import com.tzld.longarticle.recommend.server.model.param.TitleHisCacheParam;
 import com.tzld.longarticle.recommend.server.remote.aigc.AIGCWaitingPublishContentService;
 import com.tzld.longarticle.recommend.server.repository.aigc.CrawlerMetaArticleRepository;
+import com.tzld.longarticle.recommend.server.repository.aigc.ProducePlanExeRecordRepository;
 import com.tzld.longarticle.recommend.server.repository.aigc.PublishContentRepository;
 import com.tzld.longarticle.recommend.server.repository.aigc.PublishPlanRepository;
 import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
@@ -112,6 +114,8 @@ public class RecallService implements ApplicationContextAware {
     AigcBaseMapper aigcBaseMapper;
     @Autowired
     PublishPlanRepository publishPlanRepository;
+    @Autowired
+    ProducePlanExeRecordRepository producePlanExeRecordRepository;
 
     private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
     private ApplicationContext applicationContext;
@@ -380,6 +384,7 @@ public class RecallService implements ApplicationContextAware {
                 if (CollectionUtils.isNotEmpty(articleWithHistory.getCategory())) {
                     content.setCategory(articleWithHistory.getCategory());
                 }
+                content.setProducePlanId(articleWithHistory.getProducePlanId());
                 content.setKimiSafeScore(articleWithHistory.getKimiSafeScore());
                 content.setRootPublishTimestamp(articleWithHistory.getRootPublishTimestamp());
                 for (ContentHisPublishArticle article : content.getHisPublishArticleList()) {
@@ -507,6 +512,10 @@ public class RecallService implements ApplicationContextAware {
                 .collect(Collectors.toMap(ArticleCategory::getChannelContentId, Function.identity(), (a, b) -> a));
         Map<String, ArticleCategory> titleCategoryMap = articleCategoryList.stream()
                 .collect(Collectors.toMap(ArticleCategory::getTitleMd5, Function.identity(), (a, b) -> a));
+        // 获取生成计划
+        List<ProducePlanExeRecord> planExeRecordList = producePlanExeRecordRepository.findByPlanExeIdIn(sourceIds);
+        Map<String, ProducePlanExeRecord> planExeRecordMap = planExeRecordList.stream()
+               .collect(Collectors.toMap(ProducePlanExeRecord::getPlanExeId, Function.identity()));
         // 根据sourceId查询kimiSafeScore
         List<ProduceTaskAtom> safeScoreList = aigcBaseMapper.getProduceScoreByContentId(sourceIds);
         Map<String, ProduceTaskAtom> safeScoreMap = safeScoreList.stream().filter(o -> StringUtils.hasText(o.getOutput()))
@@ -535,7 +544,11 @@ public class RecallService implements ApplicationContextAware {
                         res.setKimiSafeScore(safeScore);
                     }
                 }
-                res.setProducePlanId(atom.getPlanId());
+            }
+            // 设置生成计划
+            ProducePlanExeRecord exeRecord = planExeRecordMap.get(cacheParam.getSourceId());
+            if (Objects.nonNull(exeRecord)) {
+                res.setProducePlanId(exeRecord.getPlanId());
             }
             // 溯源查找源发布时间
             ArticlePoolPromotionSource source = sourceMap.get(cacheParam.getCrawlerChannelContentId());

+ 1 - 1
long-article-recommend-service/src/main/resources/mapper/aigc/AigcBaseMapper.xml

@@ -114,7 +114,7 @@
 
     <select id="getProduceScoreByContentId"
             resultType="com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom">
-        select atom.plan_exe_id, atom.plan_id, atom.input, atom.output, record.audit_timestamp as createTimestamp
+        select atom.plan_exe_id, atom.input, atom.output, record.audit_timestamp as createTimestamp
         from produce_task_atom atom
         join produce_plan_exe_record record on atom.plan_exe_id = record.plan_exe_id
         join produce_plan_module_task task on task.task_id = atom.task_id

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

@@ -236,12 +236,12 @@
     <insert id="batchInsertArticleTitleHisCache">
         insert into article_title_his_cache
         (source_id, type, title, title_md5, kimi_safe_score, channel_content_id, root_publish_timestamp, crawler_title,
-         category, his_publish_article_list, create_timestamp)
+         category, his_publish_article_list, create_timestamp, plan_id)
         values
         <foreach collection="list" item="item" separator=",">
             (#{item.sourceId}, #{item.type}, #{item.title}, #{item.titleMd5}, #{item.kimiSafeScore},
              #{item.channelContentId}, #{item.rootPublishTimestamp}, #{item.crawlerTitle}, #{item.category},
-             #{item.hisPublishArticleList}, #{item.createTimestamp})
+             #{item.hisPublishArticleList}, #{item.createTimestamp}, #{item.planId})
         </foreach>
     </insert>