Browse Source

批量 添加调起链接

zhaoxian 2 years ago
parent
commit
fa68e279e2

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

@@ -165,11 +165,18 @@ public class KuaishouBatchGroupPreview {
     @ApiModelProperty(value = "当计划类型为3时(获取电商下单)时有返回。")
     private Integer urlType;
     /**
-     * 落地页链接
+     * 投放链接
      */
-    @Excel(name = "落地页链接", width = 15)
-    @ApiModelProperty(value = "落地页链接")
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
     private String url;
+
+    /**
+     * 调起链接
+     */
+    @Excel(name = "调起链接", width = 15)
+    @ApiModelProperty(value = "调起链接")
+    private String schemaUri;
     /**
      * APP ID
      */

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

@@ -2,7 +2,12 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.enums.SceneIdEnum;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCampaignPreviewMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCreativePreviewMapper;
@@ -231,10 +236,13 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         Integer appId = null;
         Long siteId = null;
         String url = null;
+        String schemaUri = null;
         JSONArray appArr = appList.getJSONArray("appArr");
         JSONArray urlArr = appList.getJSONArray("urlArr");
+        JSONArray schemaUriArr = appList.getJSONArray("schemaUriArr");
         boolean appNoNull = isNotNull(appArr, null, 1);
         boolean urlNoNull = isNotNull(urlArr, null, 1);
+        boolean schUrlNoNull = isNotNull(schemaUriArr, null, 1);
 
         //监测链接分配方式 1 按账户,2按广告计划,3按广告组
         Integer linkAllocation = appList.getInteger("linkAllocation");
@@ -253,6 +261,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
             if (urlNoNull) {
                 url = urlArr.getString(0);
             }
+            if (schUrlNoNull) {
+                schemaUri = schemaUriArr.getString(0);
+            }
         }
         if (linkAllocation == 1) {
             if (tracknotNull) {
@@ -299,6 +310,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     if (urlNoNull) {
                         url = urlArr.getString(i);
                     }
+                    if (schUrlNoNull) {
+                        schemaUri = schemaUriArr.getString(i);
+                    }
                 }
                 if (linkAllocation == 2) {
                     if (tracknotNull) {
@@ -323,6 +337,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         if (urlNoNull) {
                             url = urlArr.getString(appCount);
                         }
+                        if (schUrlNoNull) {
+                            schemaUri = schemaUriArr.getString(appCount);
+                        }
                     }
                     if (linkAllocation == 3) {
                         count--;
@@ -395,6 +412,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     if (urlNoNull) {
                         url = urlArr.getString(i);
                     }
+                    if (schUrlNoNull) {
+                        schemaUri = schemaUriArr.getString(i);
+                    }
                 }
                 if (linkAllocation == 2) {
                     if (tracknotNull) {
@@ -423,6 +443,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                         if (urlNoNull) {
                             url = urlArr.getString(appCount);
                         }
+                        if (schUrlNoNull) {
+                            schemaUri = schemaUriArr.getString(appCount);
+                        }
                     }
                     if (linkAllocation == 3) {
                         count--;
@@ -439,6 +462,7 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
                     groupPreview.setTemplateId(targetIds.getLong(j));
                     groupPreview.setUnitName(getName(groupPreview.getUnitNameFormat(), targetIds.getLong(j), groupPreview.getSceneId(), appId, groupPreview.getUnitType()) + j);
                     groupPreview.setUrl(url);
+                    groupPreview.setSchemaUri(schemaUri);
                     if (!Check.isNull(groupPreview.getBidMax()) && !Check.isNull(groupPreview.getBidMin())) {
                         int bid = getRandom(groupPreview.getBidMax(), groupPreview.getBidMin());
                         if (Check.isNull(groupPreview.getBid())) {
@@ -537,6 +561,9 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         campaignPreview.setTimeStart(campaignJson.getString("timeStart"));
         campaignPreview.setPutStatus(campaignJson.getInteger("campaignStatus"));
         campaignPreview.setIsTime(campaignJson.getInteger("isTime"));
+        campaignPreview.setAdType(campaignJson.getInteger("adType"));
+        campaignPreview.setBidType(campaignJson.getInteger("bidType"));
+        campaignPreview.setIsTime(campaignJson.getInteger("isTime"));
         campaignPreview.setBatchId(batchId);
         return campaignPreview;
     }
@@ -623,6 +650,10 @@ public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<Kuaisho
         creativePreview.setStickerTitle(creativeJson.getString("stickerTitle"));
         creativePreview.setCreativeTag(creativeJson.getString("creativeTag"));
         creativePreview.setCreativeCategory(creativeJson.getInteger("creativeCategory"));
+        creativePreview.setOuterLoopNative(creativeJson.getInteger("loopNative"));
+        creativePreview.setKolUserType(creativeJson.getInteger("kolUserType"));
+        creativePreview.setImageTokens(creativeJson.getString("imageTokens"));
+        creativePreview.setMaterialType(creativeJson.getString("materialType"));
         creativePreview.setBatchId(batchId);
         return creativePreview;
     }

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

@@ -265,6 +265,10 @@ public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<Kuaisho
             if (!Check.isNull(groupPreview.getUrl())) {
                 unitJson.put("url", groupPreview.getUrl());
             }
+            // schema_uri
+            if (!Check.isNull(groupPreview.getSchemaUri())) {
+                unitJson.put("schema_uri", groupPreview.getSchemaUri());
+            }
             // appId
             if (!Check.isNull(groupPreview.getAppId())) {
                 unitJson.put("app_id", groupPreview.getAppId());

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

@@ -205,19 +205,16 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
                                 }
                             }
                         }
-
                         templateTarget.setCreateTime(jsonObject.getDate("create_time"));
                         templateTarget.setUpdateTime(jsonObject.getDate("updateTime"));
                         templateTargetList.add(templateTarget);
                     }
-
                 }
                 if (!Check.isNull(templateList)) {
                     this.deleteOldTemplate(accountId);
                     templateMapper.replaceBatch(templateList);
                     templateTargetMapper.templateTargetList(templateTargetList);
                 }
-
                 getTemplateByAccountId(accountId, accessToken, page + 1);
             } else {
                 log.error("获取模板信息返回信息错误:accountId:{},返回信息:{}", accountId, resultJson);
@@ -229,7 +226,9 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
 
     private void deleteOldTemplate(Long accountId) {
         List<JSONObject> list = templateMapper.getJsonArrByAccountId(accountId, null, null);
-        templateTargetMapper.deleteOldTemplateTarget(list);
+        if (!Check.isNull(list)) {
+            templateTargetMapper.deleteOldTemplateTarget(list);
+        }
         templateMapper.deleteOldTemplate(accountId);
 
     }