|
|
@@ -2111,6 +2111,61 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
xcxPlanMapper.updateByPrimaryKeySelective(plan);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<XcxPlanItemVO> xcxPlanMultiLink(XcxPlanMultiLinkParam param) {
|
|
|
+ ContentPlatformAccount loginUser = LoginUserContext.getUser();
|
|
|
+ if (!Objects.equals(loginUser.getType(), 2) && !Objects.equals(loginUser.getType(), 3)) {
|
|
|
+ throw new CommonException(ExceptionEnum.XCX_PLAN_INTERNAL_ONLY);
|
|
|
+ }
|
|
|
+ if (Objects.isNull(param.getPlanId()) || Objects.isNull(param.getCount())
|
|
|
+ || param.getCount() < 1 || param.getCount() > 200) {
|
|
|
+ throw new CommonException(ExceptionEnum.PARAM_ERROR);
|
|
|
+ }
|
|
|
+ ContentPlatformXcxPlan src = xcxPlanMapper.selectByPrimaryKey(param.getPlanId());
|
|
|
+ if (Objects.isNull(src) || !Objects.equals(src.getCreateAccountId(), loginUser.getId())
|
|
|
+ || !Objects.equals(src.getStatus(), PlanStatusEnum.NORMAL.getVal())) {
|
|
|
+ throw new CommonException(ExceptionEnum.XCX_PLAN_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ ContentPlatformXcxPlanVideoExample videoExample = new ContentPlatformXcxPlanVideoExample();
|
|
|
+ videoExample.createCriteria().andPlanIdEqualTo(src.getId());
|
|
|
+ List<ContentPlatformXcxPlanVideo> srcVideoList = xcxPlanVideoMapper.selectByExample(videoExample);
|
|
|
+ if (CollectionUtils.isEmpty(srcVideoList)) {
|
|
|
+ throw new CommonException(ExceptionEnum.XCX_PLAN_NOT_EXISTS);
|
|
|
+ }
|
|
|
+ ContentPlatformXcxPlanVideo srcVideo = srcVideoList.get(0);
|
|
|
+
|
|
|
+ Long now = System.currentTimeMillis();
|
|
|
+ List<ContentPlatformXcxPlan> created = new ArrayList<>();
|
|
|
+ for (int i = 0; i < param.getCount(); i++) {
|
|
|
+ ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
|
|
|
+ xcxPlan.setAudiencePackage(src.getAudiencePackage());
|
|
|
+ xcxPlan.setRemark(src.getRemark());
|
|
|
+ Staff staff = new Staff();
|
|
|
+ staff.setCarrierId("wxf7261ed54f2e450e");
|
|
|
+ staff.setRemark(src.getRemark());
|
|
|
+ String pageUrl = messageAttachmentService.getPageNoCache("touliu", "tencent", staff,
|
|
|
+ srcVideo.getVideoId(), "小程序", null, null, srcVideo.getExperimentId());
|
|
|
+ String rootSourceId = MessageUtil.getRootSourceId(pageUrl);
|
|
|
+ xcxPlan.setPageUrl(pageUrl);
|
|
|
+ xcxPlan.setRootSourceId(rootSourceId);
|
|
|
+ xcxPlan.setStatus(PlanStatusEnum.NORMAL.getVal());
|
|
|
+ xcxPlan.setCreateAccountId(loginUser.getId());
|
|
|
+ xcxPlan.setCreateTimestamp(now);
|
|
|
+ xcxPlan.setUpdateTimestamp(now);
|
|
|
+ planMapperExt.insertXcxPlanReturnId(xcxPlan);
|
|
|
+ created.add(xcxPlan);
|
|
|
+
|
|
|
+ XcxPlanSaveVideoParam vp = new XcxPlanSaveVideoParam();
|
|
|
+ vp.setVideoId(srcVideo.getVideoId());
|
|
|
+ vp.setTitle(srcVideo.getTitle());
|
|
|
+ vp.setCover(srcVideo.getCover());
|
|
|
+ vp.setVideo(srcVideo.getVideo());
|
|
|
+ vp.setExperimentId(srcVideo.getExperimentId());
|
|
|
+ saveXcxPlanVideo(vp, xcxPlan.getId(), loginUser.getId());
|
|
|
+ }
|
|
|
+ return buildXcxPlanItemVOList(created);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<String> getXcxAudiencePackageList() {
|
|
|
String dt = demandVideoMapperExt.getMaxDt(CHANNEL_NAME_XCX);
|