Przeglądaj źródła

监测链接,链接名称

yumeng 4 lat temu
rodzic
commit
272d223477

+ 4 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -1721,7 +1721,7 @@ public class BatchController {
                     unitName = unitNameStr;
                 }
                 group.setUnitName(unitName + RandomUtil.verifyCode());
-                JSONObject unitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
+                JSONObject unitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken, null);
                 if (!Check.isNull(unitJson)) {
                     Integer code = unitJson.getInteger("code");
                     if (code != 0) {
@@ -1797,11 +1797,12 @@ public class BatchController {
                 }
 
                 Integer createType = requestJson.getInteger("createType");
+                JSONObject otherJson = requestJson.getJSONObject("otherJson");
                 if (createType == 1) { // 系统生成
                     for (int i = 0; i < createCount; i++) {
                         String randomName = unitName + RandomUtil.verifyCode();
                         group.setUnitName(randomName);
-                        JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
+                        JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken, otherJson);
                         if (copyUnitJson.getInteger("code") != 0) {
                             JSONObject errJson = new JSONObject();
                             errJson.put("message", copyUnitJson.getString("message"));
@@ -1822,7 +1823,7 @@ public class BatchController {
                                 continue;
                             }
                             group.setUnitName(copyUnitName);
-                            JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken);
+                            JSONObject copyUnitJson = batchService.copyUnit(group, copyToCampaignId, oauthToken, otherJson);
                             if (copyUnitJson.getInteger("code") != 0) {
                                 JSONObject errJson = new JSONObject();
                                 errJson.put("message", copyUnitJson.getString("message"));

+ 9 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouTrackUrlCollectionController.java

@@ -66,7 +66,15 @@ public class KuaiShouTrackUrlCollectionController {
                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                    HttpServletRequest req) {
         Result<IPage<KuaiShouTrackUrlCollection>> result = new Result<>();
+        String trackName = kuaiShouTrackUrlCollection.getTrackName();
+        kuaiShouTrackUrlCollection.setTrackName(null);
+
+
         QueryWrapper<KuaiShouTrackUrlCollection> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouTrackUrlCollection, req.getParameterMap());
+        if (!Check.isNull(trackName)) {
+            queryWrapper.like("track_name", trackName);
+        }
+
         Page<KuaiShouTrackUrlCollection> page = new Page<KuaiShouTrackUrlCollection>(pageNo, pageSize);
         IPage<KuaiShouTrackUrlCollection> pageList = kuaiShouTrackUrlCollectionService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -76,7 +84,7 @@ public class KuaiShouTrackUrlCollectionController {
 
 
     @GetMapping(value = "/checkTrackName")
-    public Result<Boolean> checkTrackName(Long accountId, String trackName,String userId) {
+    public Result<Boolean> checkTrackName(Long accountId, String trackName, String userId) {
         Result<Boolean> result = new Result<>();
         QueryWrapper<KuaiShouTrackUrlCollection> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId);

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java

@@ -58,7 +58,7 @@ public interface IBatchService {
      * @param requestJson
      * @return
      */
-    JSONObject createUnit(JSONObject requestJson,CtopOauthToken oauthToken) throws Exception;
+    JSONObject createUnit(JSONObject requestJson, CtopOauthToken oauthToken) throws Exception;
 
 
     /**
@@ -75,7 +75,7 @@ public interface IBatchService {
      * @param copyToCampaignId
      * @return
      */
-    JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken);
+    JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken, JSONObject otherJson);
 
 
     /**
@@ -137,5 +137,5 @@ public interface IBatchService {
      * @param unitId
      * @param copyUnitId
      */
-    void copyCreative(Long accountId, Long unitId, Long copyUnitId,JSONObject appJson) throws Exception;
+    void copyCreative(Long accountId, Long unitId, Long copyUnitId, JSONObject appJson) throws Exception;
 }

+ 101 - 37
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -404,7 +404,6 @@ public class BatchServiceImpl implements IBatchService {
                     if (code == 0) {
                         JSONObject successJson = new JSONObject();
                         Long unitId = (Long) returnUnitMap.get("unitId");
-
                         successJson.put("unitId", unitId);
                         successJson.put("unitName", unitName);
                         successJson.put("sceneId", scene_id);
@@ -418,8 +417,8 @@ public class BatchServiceImpl implements IBatchService {
                                     @Override
                                     public void run() {
                                         try {
-                                            JSONObject appJson = requestJson.getJSONObject("appJson"); // 是否修改应用
-                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId, appJson);
+                                            JSONObject otherJson = requestJson.getJSONObject("otherJson"); // 是否修改应用
+                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId, otherJson);
                                         } catch (Exception e) {
                                             e.printStackTrace();
                                         }
@@ -654,7 +653,7 @@ public class BatchServiceImpl implements IBatchService {
             }
 
             // 是否修改应用
-            JSONObject appJson = requestJson.getJSONObject("appJson");
+            JSONObject otherJson = requestJson.getJSONObject("otherJson");
 
             if (!Check.isNull(groupJson)) {
 
@@ -706,7 +705,7 @@ public class BatchServiceImpl implements IBatchService {
                                     @Override
                                     public void run() {
                                         try {
-                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId, appJson);
+                                            copyCreative(oauthToken.getAccountId(), unitId, copyUnitId, otherJson);
                                         } catch (Exception e) {
                                             e.printStackTrace();
                                         }
@@ -744,7 +743,7 @@ public class BatchServiceImpl implements IBatchService {
 
 
     @Override
-    public JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken) {
+    public JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId, CtopOauthToken oauthToken, JSONObject otherJson) {
         JSONObject returnJson = new JSONObject();
         try {
             JSONObject unitJson = new JSONObject();
@@ -985,7 +984,7 @@ public class BatchServiceImpl implements IBatchService {
                             @Override
                             public void run() {
                                 try {
-                                    copyCreative(group.getAccountId(), copyUnitId, group.getUnitId(), null);
+                                    copyCreative(group.getAccountId(), copyUnitId, group.getUnitId(), otherJson);
                                 } catch (Exception e) {
                                     e.printStackTrace();
                                 }
@@ -1021,7 +1020,7 @@ public class BatchServiceImpl implements IBatchService {
      * @param unitId
      */
     @Override
-    public void copyCreative(Long accountId, Long unitId, Long copyUnitId, JSONObject appJson) throws Exception {
+    public void copyCreative(Long accountId, Long unitId, Long copyUnitId, JSONObject otherJson) throws Exception {
         // 查询当前复制组下的所有非程序化创意
 
         QueryWrapper<KuaiShouCreative> queryWrapper = new QueryWrapper<>();
@@ -1041,33 +1040,12 @@ public class BatchServiceImpl implements IBatchService {
                 creativeJson.put("advertiser_id", accountId);
                 creativeJson.put("unit_id", unitId);
 
-
-                if (Check.isNull(creative.getCreativeMaterialType())) {
+                Integer creativeMaterialType = creative.getCreativeMaterialType();
+                if (Check.isNull(creativeMaterialType)) {
                     continue;
                 }
-                creativeJson.put("creative_material_type", creative.getCreativeMaterialType());
+                creativeJson.put("creative_material_type", creativeMaterialType);
                 String click_track_url = creative.getClickTrackUrl();
-                if (creative.getCreativeMaterialType() == 4) {
-                    creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
-                    creativeJson.put("short_slogan", creative.getShortSlogan());
-                    // 第三方开始播放监测链接
-                    if (!Check.isNull(click_track_url)) {
-                        creativeJson.put("impression_url", click_track_url);
-                    }
-
-                    if (!Check.isNull(creative.getImpressionUrl())) {
-                        creativeJson.put("impression_url", creative.getImpressionUrl());
-                    }
-
-                } else {
-                    String photo_id = creative.getPhotoId();
-                    creativeJson.put("photo_id", photo_id);
-                    String image = creative.getImageToken();
-                    creativeJson.put("image_token", image);
-                    if (!Check.isNull(click_track_url)) {
-                        creativeJson.put("click_track_url", click_track_url);
-                    }
-                }
 
 
                 String action_bar_text = creative.getActionBarText();
@@ -1098,22 +1076,108 @@ public class BatchServiceImpl implements IBatchService {
                     creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
                 }
 
-                // 是否修改应用
-                if (!Check.isNull(appJson)) {
-                    Boolean isUpdate = appJson.getBoolean("isUpdate");
+
+                if (!Check.isNull(otherJson)) {
+                    Boolean isUpdate = otherJson.getBoolean("isUpdate"); // 是否修改落地页
                     if (isUpdate) {
-                        if (!Check.isNull(appJson.getLong("siteId"))) {
-                            creativeJson.put("site_id", appJson.getLong("siteId"));
+                        if (!Check.isNull(otherJson.getLong("siteId"))) {
+                            creativeJson.put("site_id", otherJson.getLong("siteId"));
                         }
                     } else {
                         if (!Check.isNull(creative.getSiteId())) {
                             creativeJson.put("site_id", creative.getSiteId());
                         }
                     }
+
+                    Boolean isUpdateTrackUrl = otherJson.getBoolean("isUpdateTrackUrl"); // 是否修改监测链接
+                    if (isUpdateTrackUrl) {
+                        String clickTrackUrl = otherJson.getString("clickTrackUrl");
+                        if (!Check.isNull(clickTrackUrl)) {
+                            if (creativeMaterialType == 4) {
+                                creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
+                                creativeJson.put("short_slogan", creative.getShortSlogan());
+                                // 第三方开始播放监测链接
+                                creativeJson.put("impression_url", clickTrackUrl);
+                            } else {
+                                String photo_id = creative.getPhotoId();
+                                creativeJson.put("photo_id", photo_id);
+                                String image = creative.getImageToken();
+                                creativeJson.put("image_token", image);
+                                creativeJson.put("click_track_url", clickTrackUrl);
+
+                            }
+                        } else {
+                            if (creativeMaterialType == 4) {
+                                creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
+                                creativeJson.put("short_slogan", creative.getShortSlogan());
+                                // 第三方开始播放监测链接
+                                if (!Check.isNull(click_track_url)) {
+                                    creativeJson.put("impression_url", click_track_url);
+                                }
+
+                                if (!Check.isNull(creative.getImpressionUrl())) {
+                                    creativeJson.put("impression_url", creative.getImpressionUrl());
+                                }
+                            } else {
+                                String photo_id = creative.getPhotoId();
+                                creativeJson.put("photo_id", photo_id);
+                                String image = creative.getImageToken();
+                                creativeJson.put("image_token", image);
+                                if (!Check.isNull(click_track_url)) {
+                                    creativeJson.put("click_track_url", click_track_url);
+                                }
+                            }
+                        }
+                    } else {
+                        if (creativeMaterialType == 4) {
+                            creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
+                            creativeJson.put("short_slogan", creative.getShortSlogan());
+                            // 第三方开始播放监测链接
+                            if (!Check.isNull(click_track_url)) {
+                                creativeJson.put("impression_url", click_track_url);
+                            }
+
+                            if (!Check.isNull(creative.getImpressionUrl())) {
+                                creativeJson.put("impression_url", creative.getImpressionUrl());
+                            }
+                        } else {
+                            String photo_id = creative.getPhotoId();
+                            creativeJson.put("photo_id", photo_id);
+                            String image = creative.getImageToken();
+                            creativeJson.put("image_token", image);
+                            if (!Check.isNull(click_track_url)) {
+                                creativeJson.put("click_track_url", click_track_url);
+                            }
+                        }
+                    }
                 } else {
                     if (!Check.isNull(creative.getSiteId())) {
                         creativeJson.put("site_id", creative.getSiteId());
                     }
+
+
+                    if (creativeMaterialType == 4) {
+                        creativeJson.put("image_tokens", JSONArray.parseArray(creative.getImageTokens()));
+                        creativeJson.put("short_slogan", creative.getShortSlogan());
+                        // 第三方开始播放监测链接
+                        if (!Check.isNull(click_track_url)) {
+                            creativeJson.put("impression_url", click_track_url);
+                        }
+
+                        if (!Check.isNull(creative.getImpressionUrl())) {
+                            creativeJson.put("impression_url", creative.getImpressionUrl());
+                        }
+                    } else {
+                        String photo_id = creative.getPhotoId();
+                        creativeJson.put("photo_id", photo_id);
+                        String image = creative.getImageToken();
+                        creativeJson.put("image_token", image);
+                        if (!Check.isNull(click_track_url)) {
+                            creativeJson.put("click_track_url", click_track_url);
+                        }
+                    }
+
+
                 }
                 // 安卓下载中间页
                 Map<String, Object> returnCreativeMap = kuaishouInterfaceService.creativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1);