Преглед на файлове

批量 功能优化,添加试玩

zhaoxian преди 2 години
родител
ревизия
2a8fa0b276

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

@@ -576,6 +576,9 @@ public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupT
         if (!Check.isNull(templateTarget.getAppInterest())) {
             target.put("app_interest", JSONArray.parseArray(templateTarget.getAppInterest()));
         }
+        if (!Check.isNull(templateTarget.getFilterConvertedLevel())) {
+            target.put("filter_converted_level", templateTarget.getFilterConvertedLevel());
+        }
 
         JSONArray appIds = JSONArray.parseArray(templateTarget.getAppIds());
         if (!Check.isNull(appIds) && !appIds.isEmpty()) {

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

@@ -246,6 +246,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         boolean urlNoNull = isNotNull(urlArr, null, 1);
         boolean schUrlNoNull = isNotNull(schemaUriArr, null, 1);
 
+        //试玩分配方式 1 按账户,2按广告计划,3按广告组
+        Integer playableAllocation = appList.getInteger("playableAllocation");
+        JSONArray playableIds = appList.getJSONArray("playableIds");
+
         //监测链接分配方式 1 按账户,2按广告计划,3按广告组
         Integer linkAllocation = appList.getInteger("linkAllocation");
         JSONArray clickTrackUrlList = appList.getJSONArray("clickUrlList");
@@ -276,6 +280,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
             }
         }
 
+        if (playableAllocation == 1 && !Check.isNull(playableIds)) {
+            groupPreview.setPlayableId(playableIds.getLong(0));
+        }
+
         //素材数据
         JSONObject materialArray = data.getJSONObject("materialArray");
         //创意组
@@ -324,6 +332,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         actionbarClickUrl = actionbarClickUrlList.getString(i);
                     }
                 }
+                if (playableAllocation == 2 && !Check.isNull(playableIds)) {
+                    groupPreview.setPlayableId(getPlayableId(playableIds, i + 1));
+                }
                 if (Check.isNull(campaignId)) {
                     campaignPreview.setId(null);
                     campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), targetIds.getLong(i), null, appId, null) + i);
@@ -352,6 +363,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             actionbarClickUrl = actionbarClickUrlList.getString(count);
                         }
                     }
+                    if (playableAllocation == 3 && !Check.isNull(playableIds)) {
+                        groupPreview.setPlayableId(getPlayableId(playableIds, j + 1));
+                    }
                     groupPreview.setId(null);
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
@@ -367,7 +381,6 @@ 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);
@@ -470,6 +483,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         actionbarClickUrl = actionbarClickUrlList.getString(i);
                     }
                 }
+                if (playableAllocation == 2 && !Check.isNull(playableIds)) {
+                    groupPreview.setPlayableId(getPlayableId(playableIds, i + 1));
+                }
+
                 campaignPreview.setId(null);
                 campaignPreview.setCampaignName(getName(campaignPreview.getCampaignNameFormat(), null, null, appId, null) + i);
                 campaignPreviewMapper.insert(campaignPreview);
@@ -502,6 +519,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                             actionbarClickUrl = actionbarClickUrlList.getString(count);
                         }
                     }
+                    if (playableAllocation == 3 && !Check.isNull(playableIds)) {
+                        groupPreview.setPlayableId(getPlayableId(playableIds, j + 1));
+                    }
                     groupPreview.setId(null);
                     groupPreview.setAppId(appId);
                     groupPreview.setPlanId(campaignPreview.getId());
@@ -517,7 +537,6 @@ 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) {
@@ -625,11 +644,6 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     /**
      * 判断非空
-     *
-     * @param
-     * @return boolean
-     * @throws
-     * @author ZHAOXA
      */
     private boolean isNotNull(JSONArray arr, JSONArray arr2, Integer num) {
         if (num == 2) {
@@ -641,11 +655,6 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
 
     /**
      * 广告语整理
-     *
-     * @param
-     * @return com.alibaba.fastjson.JSONArray
-     * @throws
-     * @author ZHAOXA
      */
     private static JSONArray advertisingSlogan(JSONArray descriptionList, JSONArray materialList) {
         if (materialList.size() <= descriptionList.size()) {