Browse Source

批量 功能优化,添加试玩

zhaoxian 2 năm trước cách đây
mục cha
commit
27b770ac2b

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouVideoGetController.java

@@ -110,6 +110,7 @@ public class KuaiShouVideoGetController {
                                                              String channelType,
                                                              String signatures,
                                                              String orderBy,
+                                                             String photoName,
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                              HttpServletRequest req) {
@@ -145,6 +146,7 @@ public class KuaiShouVideoGetController {
                     requestMap.put("startDate", startDate);
                     requestMap.put("endDate", endDate);
                 }
+                requestMap.put("photoName", photoName);
                 list = kuaiShouVideoGetService.getVideoList(requestMap);
             } else if ("cost".equals(orderBy)) {
                 if (!Check.isNull(startDate) && !Check.isNull(endDate)) {

+ 12 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java

@@ -228,6 +228,18 @@ public class KuaishouBatchGroupPreview {
     @ApiModelProperty(value = "媒体定向排除包")
     private String excludeMedia;
     /**
+     * 试玩 ID集
+     */
+    @Excel(name = "试玩 ID", width = 15)
+    @ApiModelProperty(value = "试玩 ID")
+    private Long playableId;
+    /**
+     * 1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩”
+     */
+    @Excel(name = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩", width = 15)
+    @ApiModelProperty(value = "1:立即试玩;2:试玩一下;3:立即体验;4:免装试玩;5:免装体验。启用试玩时:默认“立即试玩")
+    private String playButton;
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

+ 5 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml

@@ -46,12 +46,16 @@
         url as 'url',
         cover_url as 'coverUrl',
         signature as 'signature',
-        material_type as 'materialType'
+        material_type as 'materialType',
+        photo_name as 'photoName'
         from ctop_kuaishou_video_get
         where account_id = #{accountId}
         and channel_type = #{channelType}
         and material_type = #{materialType}
         and status = 0
+        <if test="photoName != null and photoName != '' ">
+            and photo_name like CONCAT('%',#{photoName},'%')
+        </if>
         <if test="startDate != null and startDate != '' ">
             and stat_date &gt;= #{startDate}
         </if>

+ 17 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -367,6 +367,8 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             groupPreview.setBid(bid);
                         }
                     }
+                    groupPreview.setPlayableId(getPlayableId(appList.getJSONArray("playableIds"), j+1));
+                    groupPreview.setPlayButton(appList.getString("playButton"));
                     groupPreviewMapper.insert(groupPreview);
                     JSONObject material = materialList.getJSONObject(j);
                     JSONArray photoArr = material.getJSONArray("photoArr");
@@ -515,6 +517,8 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             groupPreview.setBid(bid);
                         }
                     }
+                    groupPreview.setPlayableId(getPlayableId(appList.getJSONArray("playableIds"), j+1));
+                    groupPreview.setPlayButton(appList.getString("playButton"));
                     groupPreviewMapper.insert(groupPreview);
                     if (groupPreview.getUnitType() == 4) {
                         for (int k = 0; k < photoArr.size(); k++) {
@@ -589,6 +593,19 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     }
 
+
+    private Long getPlayableId(JSONArray ids, Integer num) {
+        int size = ids.size();
+        if (size > 0) {
+            if (size >= num) {
+                return ids.getLong(num-1);
+            } else {
+                return ids.getLong(num % size ==0?(size-1):((num % size)-1));
+            }
+        }
+        return null;
+    }
+
     //从集合里随机获取不重复的3个值
     private String getRandomFromList(JSONArray arr) {
         List<String> ids = JSONArray.parseArray(arr.toJSONString(), String.class);

+ 11 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java

@@ -312,6 +312,17 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
                     }
                 }
             }
+
+            // 试玩 ID
+            Long playableId = groupPreview.getPlayableId();
+            if (!Check.isNull(playableId)) {
+                unitJson.put("playable_id", playableId);
+            }
+            // 试玩按钮文字内容
+            String playButton = groupPreview.getPlayButton();
+            if (!Check.isNull(playButton)) {
+                unitJson.put("play_button", playButton);
+            }
             // 出价
             Integer bid = groupPreview.getBid();
             if (!Check.isNull(bid)) {