|
|
@@ -390,13 +390,10 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
ContentPlatformGzhAccount account, ContentPlatformAccount loginAccount) {
|
|
|
List<ContentPlatformGzhPlanVideo> existsVideo = getGzhVideoByPlanId(planId);
|
|
|
List<Long> existsVideoIds = existsVideo.stream().map(ContentPlatformGzhPlanVideo::getVideoId).collect(Collectors.toList());
|
|
|
- Map<Long, ContentPlatformGzhPlanVideo> existsVideoMap = existsVideo.stream()
|
|
|
- .collect(Collectors.toMap(ContentPlatformGzhPlanVideo::getVideoId, item -> item));
|
|
|
- for (ContentPlatformGzhPlanVideo item : existsVideo) {
|
|
|
- if (!videoIds.contains(item.getVideoId())) {
|
|
|
- gzhPlanVideoMapper.deleteByPrimaryKey(item.getId());
|
|
|
- }
|
|
|
- }
|
|
|
+ // 删除该计划下所有已有视频,后续统一重新插入
|
|
|
+ ContentPlatformGzhPlanVideoExample deleteExample = new ContentPlatformGzhPlanVideoExample();
|
|
|
+ deleteExample.createCriteria().andPlanIdEqualTo(planId);
|
|
|
+ gzhPlanVideoMapper.deleteByExample(deleteExample);
|
|
|
for (GzhPlanVideoContentItemParam vo : param.getVideoList()) {
|
|
|
if (!StringUtils.hasText(vo.getCustomTitle())) {
|
|
|
vo.setCustomTitle(null);
|
|
|
@@ -404,59 +401,40 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
if (!StringUtils.hasText(vo.getCustomCover())) {
|
|
|
vo.setCustomCover(null);
|
|
|
}
|
|
|
- if (existsVideoIds.contains(vo.getVideoId())) {
|
|
|
- ContentPlatformGzhPlanVideo item = existsVideoMap.get(vo.getVideoId());
|
|
|
- item.setTitle(vo.getTitle());
|
|
|
- setCustomTitle(item, vo);
|
|
|
- item.setCover(vo.getCover());
|
|
|
- setCustomCover(item, vo);
|
|
|
- item.setCustomCoverType(vo.getCustomCoverType());
|
|
|
- // 上报多标题封面
|
|
|
- item.setPageUrl(setMultiTitleCoverPagePath(item));
|
|
|
- item.setExperimentId(vo.getExperimentId());
|
|
|
- if (StringUtils.hasText(item.getPageUrl())) {
|
|
|
- String rootSourceId = MessageUtil.getRootSourceId(item.getPageUrl());
|
|
|
- if (StringUtils.hasText(rootSourceId)) {
|
|
|
- item.setRootSourceId(rootSourceId);
|
|
|
- }
|
|
|
- }
|
|
|
- gzhPlanVideoMapper.updateByPrimaryKey(item);
|
|
|
- } else {
|
|
|
- ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
|
|
|
- item.setPlanId(planId);
|
|
|
- item.setVideoId(vo.getVideoId());
|
|
|
- item.setTitle(vo.getTitle());
|
|
|
- setCustomTitle(item, vo);
|
|
|
- item.setCover(vo.getCover());
|
|
|
- setCustomCover(item, vo);
|
|
|
- item.setCustomCoverType(vo.getCustomCoverType());
|
|
|
- item.setVideo(vo.getVideo());
|
|
|
- if (param.getType() == ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal()) {
|
|
|
- String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "fwhdyy",
|
|
|
- loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "文字和小程序", account.getGhId(), vo.getExperimentId());
|
|
|
- JSONObject json = JSONObject.parseObject(response);
|
|
|
- SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
|
- item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
|
- } else if (param.getType() == ContentPlatformGzhPlanTypeEnum.GZH_PUSH.getVal()) {
|
|
|
- String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "longArticles_outer",
|
|
|
- loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "小程序", account.getGhId(), vo.getExperimentId());
|
|
|
- JSONObject json = JSONObject.parseObject(response);
|
|
|
- SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
|
- item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
|
- }
|
|
|
- // 上报多标题封面
|
|
|
- item.setPageUrl(setMultiTitleCoverPagePath(item));
|
|
|
- item.setExperimentId(vo.getExperimentId());
|
|
|
- if (StringUtils.hasText(item.getPageUrl())) {
|
|
|
- String rootSourceId = MessageUtil.getRootSourceId(item.getPageUrl());
|
|
|
- if (StringUtils.hasText(rootSourceId)) {
|
|
|
- item.setRootSourceId(rootSourceId);
|
|
|
- }
|
|
|
+ ContentPlatformGzhPlanVideo item = new ContentPlatformGzhPlanVideo();
|
|
|
+ item.setPlanId(planId);
|
|
|
+ item.setVideoId(vo.getVideoId());
|
|
|
+ item.setTitle(vo.getTitle());
|
|
|
+ setCustomTitle(item, vo);
|
|
|
+ item.setCover(vo.getCover());
|
|
|
+ setCustomCover(item, vo);
|
|
|
+ item.setCustomCoverType(vo.getCustomCoverType());
|
|
|
+ item.setVideo(vo.getVideo());
|
|
|
+ if (param.getType() == ContentPlatformGzhPlanTypeEnum.FWH_PUSH.getVal()) {
|
|
|
+ String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "fwhdyy",
|
|
|
+ loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "文字和小程序", account.getGhId(), vo.getExperimentId());
|
|
|
+ JSONObject json = JSONObject.parseObject(response);
|
|
|
+ SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
|
+ item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
|
+ } else if (param.getType() == ContentPlatformGzhPlanTypeEnum.GZH_PUSH.getVal()) {
|
|
|
+ String response = touLiuHttpClient.sendAdFlowAddRequest(GET_SMALL_PAGE_URL, String.valueOf(vo.getVideoId()), "longArticles_outer",
|
|
|
+ loginAccount.getChannel(), "自动", "公众号", "文章插小程序", "小程序", account.getGhId(), vo.getExperimentId());
|
|
|
+ JSONObject json = JSONObject.parseObject(response);
|
|
|
+ SmallPageUrlDetail smallPageUrlDetail = json.getJSONObject("data").toJavaObject(SmallPageUrlDetail.class);
|
|
|
+ item.setPageUrl(smallPageUrlDetail.getUrl());
|
|
|
+ }
|
|
|
+ // 上报多标题封面
|
|
|
+ item.setPageUrl(setMultiTitleCoverPagePath(item));
|
|
|
+ item.setExperimentId(vo.getExperimentId());
|
|
|
+ if (StringUtils.hasText(item.getPageUrl())) {
|
|
|
+ String rootSourceId = MessageUtil.getRootSourceId(item.getPageUrl());
|
|
|
+ if (StringUtils.hasText(rootSourceId)) {
|
|
|
+ item.setRootSourceId(rootSourceId);
|
|
|
}
|
|
|
- item.setCreateAccountId(loginAccount.getId());
|
|
|
- item.setCreateTimestamp(System.currentTimeMillis());
|
|
|
- gzhPlanVideoMapper.insert(item);
|
|
|
}
|
|
|
+ item.setCreateAccountId(loginAccount.getId());
|
|
|
+ item.setCreateTimestamp(System.currentTimeMillis());
|
|
|
+ gzhPlanVideoMapper.insert(item);
|
|
|
}
|
|
|
if (CollectionUtils.isNotEmpty(param.getVideoList())) {
|
|
|
saveChangeVideoLog(planId, existsVideoIds, param.getVideoList());
|