Просмотр исходного кода

Merge branch 'cooperation_video_candidate_pool_improved_lld_0509' of Server/growth-manager into master

liulidong 10 часов назад
Родитель
Сommit
70b6792197

+ 3 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/XcxPlanSaveVideoParam.java

@@ -21,4 +21,7 @@ public class XcxPlanSaveVideoParam {
     @ApiModelProperty(value = "匹配实验id")
     private String experimentId;
 
+    @ApiModelProperty(value = "该 video 生成份数 1-200,空/null/<=0 视为 1")
+    private Integer count;
+
 }

+ 34 - 24
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -2257,29 +2257,38 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 && !Objects.equals(loginUser.getType(), ContentPlatformAccountTypeEnum.AGENT.getVal())) {
             throw new CommonException(ExceptionEnum.XCX_PLAN_INTERNAL_ONLY);
         }
-        Long now = System.currentTimeMillis();
+        long baseNow = System.currentTimeMillis();
+        long offset = 0L;
         List<ContentPlatformXcxPlan> list = new ArrayList<>();
         for (XcxPlanSaveVideoParam videoParam : param.getVideoList()) {
-            ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
-            xcxPlan.setAudiencePackage(param.getAudiencePackage());
-            xcxPlan.setRemark(param.getRemark());
-
-            Staff staff = new Staff();
-            staff.setCarrierId("wxf7261ed54f2e450e");
-            staff.setRemark(param.getRemark());
-            String pageUrl = messageAttachmentService.getPageNoCache("pages/category", "touliu", "tencent", staff,
-                    videoParam.getVideoId(), "小程序", null, null, videoParam.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);
-            list.add(xcxPlan);
-            // 保存视频内容
-            saveXcxPlanVideo(videoParam, xcxPlan.getId(), loginUser.getId());
+            int count = (videoParam.getCount() == null || videoParam.getCount() <= 0)
+                    ? 1 : videoParam.getCount();
+            if (count > 200) {
+                throw new CommonException(ExceptionEnum.PARAM_ERROR);
+            }
+            for (int i = 0; i < count; i++) {
+                long ts = baseNow + offset++;
+                ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
+                xcxPlan.setAudiencePackage(param.getAudiencePackage());
+                xcxPlan.setRemark(param.getRemark());
+
+                Staff staff = new Staff();
+                staff.setCarrierId("wxf7261ed54f2e450e");
+                staff.setRemark(param.getRemark());
+                String pageUrl = messageAttachmentService.getPageNoCache("pages/category", "touliu", "tencent", staff,
+                        videoParam.getVideoId(), "小程序", null, null, videoParam.getExperimentId());
+                String rootSourceId = MessageUtil.getRootSourceId(pageUrl);
+                xcxPlan.setPageUrl(pageUrl);
+                xcxPlan.setRootSourceId(rootSourceId);
+                xcxPlan.setStatus(PlanStatusEnum.NORMAL.getVal());
+                xcxPlan.setCreateAccountId(loginUser.getId());
+                xcxPlan.setCreateTimestamp(ts);
+                xcxPlan.setUpdateTimestamp(ts);
+                planMapperExt.insertXcxPlanReturnId(xcxPlan);
+                list.add(xcxPlan);
+                // 保存视频内容
+                saveXcxPlanVideo(videoParam, xcxPlan.getId(), loginUser.getId());
+            }
         }
         return buildXcxPlanItemVOList(list);
     }
@@ -2324,10 +2333,11 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         }
         ContentPlatformXcxPlanVideo srcVideo = srcVideoList.get(0);
 
-        Long now = System.currentTimeMillis();
+        long baseNow = System.currentTimeMillis();
         List<ContentPlatformXcxPlan> created = new ArrayList<>();
         try {
             for (int i = 0; i < param.getCount(); i++) {
+                long ts = baseNow + i;
                 ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
                 xcxPlan.setAudiencePackage(src.getAudiencePackage());
                 xcxPlan.setRemark(src.getRemark());
@@ -2341,8 +2351,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 xcxPlan.setRootSourceId(rootSourceId);
                 xcxPlan.setStatus(PlanStatusEnum.NORMAL.getVal());
                 xcxPlan.setCreateAccountId(loginUser.getId());
-                xcxPlan.setCreateTimestamp(now);
-                xcxPlan.setUpdateTimestamp(now);
+                xcxPlan.setCreateTimestamp(ts);
+                xcxPlan.setUpdateTimestamp(ts);
                 planMapperExt.insertXcxPlanReturnId(xcxPlan);
                 created.add(xcxPlan);