|
@@ -119,6 +119,9 @@ public class CoreServiceImpl implements CoreService {
|
|
|
@ApolloJsonValue("${recall.publish.miniprogram.accounts:[]}")
|
|
@ApolloJsonValue("${recall.publish.miniprogram.accounts:[]}")
|
|
|
private List<String> recallPublishMiniprogramAccounts;
|
|
private List<String> recallPublishMiniprogramAccounts;
|
|
|
|
|
|
|
|
|
|
+ @Value("${recall.replace.title.cover.switch:true}")
|
|
|
|
|
+ private Boolean replaceRecallTitleCoverSwitch;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public void initAccountSpecialSettings() {
|
|
public void initAccountSpecialSettings() {
|
|
|
List<SpecialSettingVO> specialSettings = aigcService.getSpecialSetting();
|
|
List<SpecialSettingVO> specialSettings = aigcService.getSpecialSetting();
|
|
@@ -864,35 +867,19 @@ public class CoreServiceImpl implements CoreService {
|
|
|
// 优先尝试 recallWithScore 召回的视频(仅配置的账号或配置为ALL时生效)
|
|
// 优先尝试 recallWithScore 召回的视频(仅配置的账号或配置为ALL时生效)
|
|
|
if (isRecallPublishMiniprogramAccount(planAccount.getAccountName())) {
|
|
if (isRecallPublishMiniprogramAccount(planAccount.getAccountName())) {
|
|
|
publishMiniprogramList = getRecallPublishMiniprograms(publishContent, planAccount);
|
|
publishMiniprogramList = getRecallPublishMiniprograms(publishContent, planAccount);
|
|
|
|
|
+ // 开关打开时,同时执行匹配流程获取小程序信息,将标题和封面替换至召回视频
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(publishMiniprogramList)
|
|
|
|
|
+ && replaceRecallTitleCoverSwitch != null && replaceRecallTitleCoverSwitch) {
|
|
|
|
|
+ List<PublishMiniprogram> matchedList = getDefaultPublishMiniprograms(publishContent, planAccount, false);
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(matchedList)) {
|
|
|
|
|
+ replaceRecallTitleAndCover(publishMiniprogramList, matchedList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
|
- // 回退到现有流程
|
|
|
|
|
- if (Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
|
|
|
|
|
- List<VideoDetail> videoDetails = contentService.getOnlyMiniPublishVideoDetail(publishContent);
|
|
|
|
|
- log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
|
|
|
|
|
- if (CollectionUtils.isEmpty(videoDetails)) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- publishMiniprogramList = getPublishMiniprogramList(videoDetails, planAccount, publishContent);
|
|
|
|
|
- if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- MatchVideo matchVideo = contentService.getMatchVideo(publishContent, planAccount);
|
|
|
|
|
- if (matchVideo == null) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- List<VideoDetail> videoDetails = contentService.
|
|
|
|
|
- getPublishVideoDetail(matchVideo, PublicFlagEnum.NOT_PUBLIC.getStatusCode(), planAccount, publishContent);
|
|
|
|
|
- log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
|
|
|
|
|
- if (CollectionUtils.isEmpty(videoDetails)) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- publishMiniprogramList = getPublishMiniprogramList(videoDetails, planAccount, publishContent);
|
|
|
|
|
- if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- contentService.updateMatchContent(publishContent, publishMiniprogramList, matchVideo);
|
|
|
|
|
|
|
+ publishMiniprogramList = getDefaultPublishMiniprograms(publishContent, planAccount, true);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -914,6 +901,55 @@ public class CoreServiceImpl implements CoreService {
|
|
|
return recallPublishMiniprogramAccounts.contains(accountName);
|
|
return recallPublishMiniprogramAccounts.contains(accountName);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * default流程:通过视频池或匹配视频获取小程序卡片
|
|
|
|
|
+ * @param updateMatch 是否更新匹配内容(仅回退流程需要,替换标题封面场景不需要)
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<PublishMiniprogram> getDefaultPublishMiniprograms(PublishContent publishContent, PlanAccount planAccount, boolean updateMatch) {
|
|
|
|
|
+ if (Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
|
|
|
|
|
+ List<VideoDetail> videoDetails = contentService.getOnlyMiniPublishVideoDetail(publishContent);
|
|
|
|
|
+ log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(videoDetails)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return getPublishMiniprogramList(videoDetails, planAccount, publishContent);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ MatchVideo matchVideo = contentService.getMatchVideo(publishContent, planAccount);
|
|
|
|
|
+ if (matchVideo == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<VideoDetail> videoDetails = contentService.
|
|
|
|
|
+ getPublishVideoDetail(matchVideo, PublicFlagEnum.NOT_PUBLIC.getStatusCode(), planAccount, publishContent);
|
|
|
|
|
+ log.info("publishContentId={}, videoDetails={}", publishContent.getId(), videoDetails);
|
|
|
|
|
+ if (CollectionUtils.isEmpty(videoDetails)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<PublishMiniprogram> result = getPublishMiniprogramList(videoDetails, planAccount, publishContent);
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(result) && updateMatch) {
|
|
|
|
|
+ contentService.updateMatchContent(publishContent, result, matchVideo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用匹配流程获取的小程序标题和封面替换召回视频的标题和封面
|
|
|
|
|
+ */
|
|
|
|
|
+ private void replaceRecallTitleAndCover(List<PublishMiniprogram> recallList, List<PublishMiniprogram> matchedList) {
|
|
|
|
|
+ int minSize = Math.min(recallList.size(), matchedList.size());
|
|
|
|
|
+ for (int i = 0; i < minSize; i++) {
|
|
|
|
|
+ PublishMiniprogram recall = recallList.get(i);
|
|
|
|
|
+ PublishMiniprogram matched = matchedList.get(i);
|
|
|
|
|
+ if (StringUtils.isNotEmpty(matched.getVideoTitle())) {
|
|
|
|
|
+ recall.setVideoTitle(matched.getVideoTitle());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotEmpty(matched.getVideoCover())) {
|
|
|
|
|
+ recall.setVideoCover(matched.getVideoCover());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("replaceRecallTitleAndCover done, replaced {} items", minSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 优先从 recallWithScore 召回结果中获取小程序视频,发布后生成小程序卡片
|
|
* 优先从 recallWithScore 召回结果中获取小程序视频,发布后生成小程序卡片
|
|
|
* 返回空列表时表示无召回结果,调用方应回退到现有流程
|
|
* 返回空列表时表示无召回结果,调用方应回退到现有流程
|