|
@@ -68,6 +68,9 @@ public class ArticleCategoryService {
|
|
|
@Value("${kimiCategoryPrompt:}")
|
|
|
private String kimiCategoryPrompt;
|
|
|
|
|
|
+ @Value("${category.active.version:1}")
|
|
|
+ private Integer activeVersion;
|
|
|
+
|
|
|
@ApolloJsonValue("${articlePromotionProduceConfig:{}}")
|
|
|
private Map<String, Map<String, Map<String, String>>> produceConfig;
|
|
|
|
|
@@ -101,7 +104,7 @@ public class ArticleCategoryService {
|
|
|
}
|
|
|
|
|
|
private void dealArticleCategory() {
|
|
|
- List<ArticleCategory> dealList = articleCategoryRepository.getByStatus(ArticleCategoryStatusEnum.WAITING.getCode());
|
|
|
+ List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.WAITING.getCode(), activeVersion);
|
|
|
List<List<ArticleCategory>> partitionList = Lists.partition(dealList, 20);
|
|
|
for (List<ArticleCategory> partition : partitionList) {
|
|
|
List<String> partitionTitles = partition.stream().map(ArticleCategory::getTitle).distinct().collect(Collectors.toList());
|
|
@@ -148,7 +151,7 @@ public class ArticleCategoryService {
|
|
|
for (ArticleCrawlerPlan crawlerPlan : articleCrawlerPlanList) {
|
|
|
List<ProduceContentCrawlerVO> list = crawlerContentByPlanService.getCrawlerContentByPlan(crawlerPlan.getCrawlerPlanId(), producePlanIds);
|
|
|
List<String> produceContentIds = list.stream().map(ProduceContentCrawlerVO::getProduceContentId).collect(Collectors.toList());
|
|
|
- List<ArticleCategory> exists = articleCategoryRepository.getByProduceContentIdIn(produceContentIds);
|
|
|
+ List<ArticleCategory> exists = articleCategoryRepository.getByProduceContentIdInAndVersion(produceContentIds, activeVersion);
|
|
|
List<String> existsIds = exists.stream().map(ArticleCategory::getProduceContentId).collect(Collectors.toList());
|
|
|
list = list.stream().filter(o -> !existsIds.contains(o.getProduceContentId())).collect(Collectors.toList());
|
|
|
long now = System.currentTimeMillis();
|
|
@@ -207,7 +210,7 @@ public class ArticleCategoryService {
|
|
|
Map<String, ArticlePoolPromotionSource> sourceMap = sourceList.stream()
|
|
|
.collect(Collectors.toMap(ArticlePoolPromotionSource::getChannelContentId, Function.identity()));
|
|
|
// 根据produceContentId查询category
|
|
|
- List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatus(ArticleCategoryStatusEnum.SUCCESS.getCode());
|
|
|
+ List<ArticleCategory> articleCategoryList = articleCategoryRepository.getByStatusAndVersion(ArticleCategoryStatusEnum.SUCCESS.getCode(), activeVersion);
|
|
|
Map<String, ArticleCategory> categoryMap = articleCategoryList.stream()
|
|
|
.collect(Collectors.toMap(ArticleCategory::getProduceContentId, Function.identity()));
|
|
|
Map<String, ArticleCategory> coldStartCategoryMap = articleCategoryList.stream()
|
|
@@ -239,7 +242,7 @@ public class ArticleCategoryService {
|
|
|
private void addVideoPoolArticleCategory() {
|
|
|
List<ArticleCategory> saveList = new ArrayList<>();
|
|
|
// 查找所有待处理视频内容池内容
|
|
|
- List<PublishSingleVideoSource> dealList = articleCategoryMapper.getVideoPoolArticleCategoryDealList();
|
|
|
+ List<PublishSingleVideoSource> dealList = articleCategoryMapper.getVideoPoolArticleCategoryDealList(activeVersion);
|
|
|
if (CollectionUtils.isEmpty(dealList)) {
|
|
|
return;
|
|
|
}
|
|
@@ -261,7 +264,7 @@ public class ArticleCategoryService {
|
|
|
private List<ArticleCategory> addArticleCategoryByProducePlan(List<String> producePlanIds) {
|
|
|
List<ProducePlanExeRecord> produceContentList = aigcBaseMapper.getAllByProducePlanId(producePlanIds);
|
|
|
List<String> channelContentIds = produceContentList.stream().map(ProducePlanExeRecord::getChannelContentId).distinct().collect(Collectors.toList());
|
|
|
- List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdIn(channelContentIds);
|
|
|
+ List<ArticleCategory> articleCategoryList = articleCategoryRepository.getAllByChannelContentIdInAndVersion(channelContentIds, activeVersion);
|
|
|
List<String> articleCategoryIds = articleCategoryList.stream().map(ArticleCategory::getChannelContentId).collect(Collectors.toList());
|
|
|
List<ProduceContentCrawlerVO> list = produceContentList.stream().filter(o -> !articleCategoryIds.contains(o.getChannelContentId())).map(o -> {
|
|
|
ProduceContentCrawlerVO item = new ProduceContentCrawlerVO();
|
|
@@ -304,7 +307,7 @@ public class ArticleCategoryService {
|
|
|
}
|
|
|
|
|
|
public void articleCategoryJobRetry() {
|
|
|
- List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndRetryTimesLessThan(ArticleCategoryStatusEnum.FAIL.getCode(), 3);
|
|
|
+ List<ArticleCategory> dealList = articleCategoryRepository.getByStatusAndRetryTimesLessThanAndVersion(ArticleCategoryStatusEnum.FAIL.getCode(), 3, activeVersion);
|
|
|
for (ArticleCategory articleCategory : dealList) {
|
|
|
List<String> partitionTitles = Collections.singletonList(articleCategory.getTitle());
|
|
|
String prompt = buildKimiPrompt(partitionTitles);
|