|
@@ -352,65 +352,78 @@ public class CoreServiceImpl implements CoreService {
|
|
|
List<Long> sendIds = new ArrayList<>();
|
|
|
for (PublishArticleData publishArticleData : rankList) {
|
|
|
LongArticleSystemPushContentParam contentParam = new LongArticleSystemPushContentParam();
|
|
|
- String publishContentId = publishArticleData.getId();
|
|
|
- PublishContent publishContent = new PublishContent();
|
|
|
- publishContent.setPlanAccountId(planAccount.getId());
|
|
|
- publishContent.setPublishContentId(publishArticleData.getId());
|
|
|
- publishContent.setSourceId(publishArticleData.getSourceId());
|
|
|
- publishContent.setScore(publishArticleData.getScore());
|
|
|
- publishContent.setContentPoolType(publishArticleData.getContentPoolType());
|
|
|
- publishContentMapper.insertSelective(publishContent);
|
|
|
+ PublishContent publishContent = publicContentService.getPublishContent(planAccount, publishArticleData);
|
|
|
sendIds.add(publishContent.getId());
|
|
|
//获取小程序
|
|
|
- List<CrawlerVideo> contentVideos =
|
|
|
- contentService.getContentMiniVideo(publishArticleData.getSourceId(), publishArticleData.getContentPoolType(), planAccount.getGhId());
|
|
|
- List<VideoDetail> videoDetails = new ArrayList<>();
|
|
|
- //发布小程序
|
|
|
- for (CrawlerVideo crawlerVideo : contentVideos) {
|
|
|
- String videoOssPath = crawlerVideo.getVideoOssPath();
|
|
|
- String platform = crawlerVideo.getPlatform();
|
|
|
- String userId = crawlerVideo.getUserId();
|
|
|
- String traceId = crawlerVideo.getTraceId();
|
|
|
- String kimiTitle;
|
|
|
- LongArticlesText kimiText = kimiService.getKimiText(crawlerVideo.getContentId());
|
|
|
- if (kimiText != null && StringUtils.isNotEmpty(kimiText.getKimiTitle())) {
|
|
|
- kimiTitle = kimiText.getKimiTitle();
|
|
|
- } else {
|
|
|
- kimiTitle = crawlerVideo.getVideoTitle();
|
|
|
+ List<PublishMiniprogram> publishMiniprogramList = contentService.getPublishMiniprograms(publishArticleData);
|
|
|
+ if (CollectionUtils.isEmpty(publishMiniprogramList)) {
|
|
|
+ List<CrawlerVideo> contentVideos =
|
|
|
+ contentService.getContentMiniVideo(publishArticleData, planAccount);
|
|
|
+ List<VideoDetail> videoDetails = new ArrayList<>();
|
|
|
+ //发布小程序
|
|
|
+ for (CrawlerVideo crawlerVideo : contentVideos) {
|
|
|
+ String videoOssPath = crawlerVideo.getVideoOssPath();
|
|
|
+ String platform = crawlerVideo.getPlatform();
|
|
|
+ String userId = crawlerVideo.getUserId();
|
|
|
+ String traceId = crawlerVideo.getTraceId();
|
|
|
+ String kimiTitle;
|
|
|
+ LongArticlesText kimiText = kimiService.getKimiText(crawlerVideo.getContentId());
|
|
|
+ if (kimiText != null && StringUtils.isNotEmpty(kimiText.getKimiTitle())) {
|
|
|
+ kimiTitle = kimiText.getKimiTitle();
|
|
|
+ } else {
|
|
|
+ kimiTitle = crawlerVideo.getVideoTitle();
|
|
|
+ }
|
|
|
+ VideoDetail publish = videoService.publish(videoOssPath, userId, kimiTitle, platform, traceId);
|
|
|
+ if (publish == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ videoDetails.add(publish);
|
|
|
+ }
|
|
|
+ if (videoDetails.size() < 2) {
|
|
|
+ MatchMiniprogramStatusParam statusParam = new MatchMiniprogramStatusParam();
|
|
|
+ statusParam.setStatus(3);
|
|
|
+ statusParam.setPublishContentId(publishContent.getPublishContentId());
|
|
|
+ statusParam.setErrorMsg("小程序视频数量不足");
|
|
|
+ aigcService.updateMatchMiniprogramStatus(statusParam);
|
|
|
+
|
|
|
+ PublishContent update = new PublishContent();
|
|
|
+ update.setId(publishContent.getId());
|
|
|
+ update.setStatus(3);
|
|
|
+ update.setReason("小程序数量不足");
|
|
|
+ publishContentMapper.updateByPrimaryKeySelective(update);
|
|
|
+ continue;
|
|
|
}
|
|
|
- VideoDetail publish = videoService.publish(videoOssPath, userId, kimiTitle, platform, traceId);
|
|
|
- if (publish == null) {
|
|
|
+ String ghId = planAccount.getGhId();
|
|
|
+ Long planAccountId = planAccount.getId();
|
|
|
+ publishMiniprogramList = cardService.generateCards(planAccountId, ghId, videoDetails,
|
|
|
+ planAccount.getMiniprogramUseType(), publishContent.getPublishContentId());
|
|
|
+ if (CollectionUtils.isEmpty(publishMiniprogramList) && publishMiniprogramList.size() < 2) {
|
|
|
continue;
|
|
|
}
|
|
|
- videoDetails.add(publish);
|
|
|
+ for (PublishMiniprogram publishMiniprogram : publishMiniprogramList) {
|
|
|
+ String videoCover = publishMiniprogram.getVideoCover();
|
|
|
+ String wxUrl = aigcService.pushCover(videoCover, publishMiniprogram.getPublishContentId());
|
|
|
+ if (StringUtils.isEmpty(wxUrl)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ publishMiniprogram.setWxUrl(wxUrl);
|
|
|
+ publishMiniprogram.setContentId(publishContent.getId());
|
|
|
+ RootSource rootSource = new RootSource();
|
|
|
+ rootSource.setAccountName(planAccount.getAccountName());
|
|
|
+ rootSource.setRootSourceId(publishMiniprogram.getRootSourceId());
|
|
|
+ rootSource.setGhId(planAccount.getGhId());
|
|
|
+ rootSource.setRequestTime(Integer.valueOf(String.valueOf(System.currentTimeMillis() / 1000)));
|
|
|
+ rootSource.setTraceId(publishMiniprogram.getTraceId());
|
|
|
+ rootSource.setPushType(planAccount.getPushType());
|
|
|
+ rootSource.setVideoId(publishMiniprogram.getVideoId());
|
|
|
+ rootSource.setContentId(publishArticleData.getSourceId());
|
|
|
+ rootSourceMapper.insertSelective(rootSource);
|
|
|
+ publishMiniprogramMapper.insertSelective(publishMiniprogram);
|
|
|
+ }
|
|
|
}
|
|
|
- if (videoDetails.size() < 2) {
|
|
|
- MatchMiniprogramStatusParam statusParam = new MatchMiniprogramStatusParam();
|
|
|
- statusParam.setStatus(3);
|
|
|
- statusParam.setPublishContentId(publishContentId);
|
|
|
- statusParam.setErrorMsg("小程序视频数量不足");
|
|
|
- aigcService.updateMatchMiniprogramStatus(statusParam);
|
|
|
|
|
|
- PublishContent update = new PublishContent();
|
|
|
- update.setId(publishContent.getId());
|
|
|
- update.setStatus(3);
|
|
|
- update.setReason("小程序数量不足");
|
|
|
- publishContentMapper.updateByPrimaryKeySelective(update);
|
|
|
- continue;
|
|
|
- }
|
|
|
- String ghId = planAccount.getGhId();
|
|
|
- Long planAccountId = planAccount.getId();
|
|
|
- List<PublishMiniprogram> cardList = cardService.generateCards(planAccountId, ghId, videoDetails, planAccount.getMiniprogramUseType(), publishContentId);
|
|
|
- if (CollectionUtils.isEmpty(cardList) && cardList.size() < 2) {
|
|
|
- continue;
|
|
|
- }
|
|
|
List<PublishMiniprogramParam> publishCardList = new ArrayList<>();
|
|
|
- for (PublishMiniprogram publishMiniprogram : cardList) {
|
|
|
- String videoCover = publishMiniprogram.getVideoCover();
|
|
|
- String wxUrl = aigcService.pushCover(videoCover, publishMiniprogram.getPublishContentId());
|
|
|
- if (StringUtils.isEmpty(wxUrl)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ for (PublishMiniprogram publishMiniprogram : publishMiniprogramList) {
|
|
|
PublishMiniprogramParam param = new PublishMiniprogramParam();
|
|
|
param.setProgramId(publishMiniprogram.getAppId());
|
|
|
param.setProgramName(publishMiniprogram.getAppName());
|
|
@@ -425,7 +438,16 @@ public class CoreServiceImpl implements CoreService {
|
|
|
}
|
|
|
param.setProductionName(videoTitle);
|
|
|
}
|
|
|
- param.setProductionCover(wxUrl);
|
|
|
+ String wxUrl = null;
|
|
|
+ if (StringUtils.isNotEmpty(publishMiniprogram.getWxUrl())) {
|
|
|
+ wxUrl = publishMiniprogram.getWxUrl();
|
|
|
+ } else {
|
|
|
+ aigcService.pushCover(publishMiniprogram.getVideoCover(), publishMiniprogram.getPublishContentId());
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(wxUrl)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ param.setProductionCover(publishMiniprogram.getVideoCover());
|
|
|
param.setProductionPath(publishMiniprogram.getProductionPath());
|
|
|
param.setRootShareId(publishMiniprogram.getRootShareId());
|
|
|
param.setSource(publishMiniprogram.getSource());
|
|
@@ -436,24 +458,11 @@ public class CoreServiceImpl implements CoreService {
|
|
|
}
|
|
|
param.setTraceId(publishMiniprogram.getTraceId());
|
|
|
publishCardList.add(param);
|
|
|
- publishMiniprogram.setContentId(publishContent.getId());
|
|
|
- RootSource rootSource = new RootSource();
|
|
|
- rootSource.setAccountName(planAccount.getAccountName());
|
|
|
- rootSource.setRootSourceId(publishMiniprogram.getRootSourceId());
|
|
|
- rootSource.setGhId(planAccount.getGhId());
|
|
|
- rootSource.setRequestTime(Integer.valueOf(String.valueOf(System.currentTimeMillis() / 1000)));
|
|
|
- rootSource.setTraceId(publishMiniprogram.getTraceId());
|
|
|
- rootSource.setPushType(planAccount.getPushType());
|
|
|
- rootSource.setVideoId(publishMiniprogram.getVideoId());
|
|
|
- rootSource.setContentId(publishArticleData.getSourceId());
|
|
|
- rootSourceMapper.insertSelective(rootSource);
|
|
|
- publishMiniprogramMapper.insertSelective(publishMiniprogram);
|
|
|
}
|
|
|
-
|
|
|
if (publishCardList.size() < 2) {
|
|
|
MatchMiniprogramStatusParam statusParam = new MatchMiniprogramStatusParam();
|
|
|
statusParam.setStatus(3);
|
|
|
- statusParam.setPublishContentId(publishContentId);
|
|
|
+ statusParam.setPublishContentId(publishContent.getPublishContentId());
|
|
|
statusParam.setErrorMsg("小程序视频数量不足");
|
|
|
aigcService.updateMatchMiniprogramStatus(statusParam);
|
|
|
|
|
@@ -464,7 +473,7 @@ public class CoreServiceImpl implements CoreService {
|
|
|
publishContentMapper.updateByPrimaryKeySelective(update);
|
|
|
continue;
|
|
|
}
|
|
|
- contentParam.setPublishContentId(publishContentId);
|
|
|
+ contentParam.setPublishContentId(publishContent.getPublishContentId());
|
|
|
contentParam.setMiniprogramCardList(publishCardList);
|
|
|
pushContentList.add(contentParam);
|
|
|
}
|