浏览代码

修改监测链接

yumeng 4 年之前
父节点
当前提交
7709d2fff7

+ 24 - 23
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -79,7 +79,7 @@ public class TestController {
 
     @Autowired
     private IBatchService batchService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(15);
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
 
@@ -126,7 +126,6 @@ public class TestController {
         list.add(7607727L);
         list.add(7421671L);
         list.add(7421646L);
-        list.add(7421646L);
         list.add(7607849L);
         for (int i = 0; i < list.size(); i++) {
             Long accountId = list.get(i);
@@ -143,7 +142,7 @@ public class TestController {
                     }
                 });
                 try {
-                    Thread.sleep(500L);
+                    Thread.sleep(1000L);
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
@@ -297,21 +296,21 @@ public class TestController {
                     QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
                     creativeQueryWrapper.eq("account_id", accountId);
                     creativeQueryWrapper.eq("campaign_id", campaign.getCampaignId());
-               //     creativeQueryWrapper.notLike("click_track_url", "&ua=__UA__&oaid=__OAID__");
+                    creativeQueryWrapper.like("click_track_url", "&csite=__CSITE__&csite=__CSITE__");
                     List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
                     for (KuaiShouCreative creative : creativeList) {
                         executorService.submit(new Runnable() {
                             @Override
                             public void run() {
-                        try {
-                            JSONObject json = new JSONObject();
-                            json.put("creativeId", creative.getCreativeId());
-                            String a = "";
-                            String b = "";
+                                try {
+                                    JSONObject json = new JSONObject();
+                                    json.put("creativeId", creative.getCreativeId());
+                                    String a = "";
+                                    String b = "";
 
 
-                            String clickTrackUrl = creative.getClickTrackUrl();
-                            if (!Check.isNull(clickTrackUrl)) {
+                                    String clickTrackUrl = creative.getClickTrackUrl();
+                          /*  if (!Check.isNull(clickTrackUrl)) {
                                 b = clickTrackUrl;
                             } else {
                                 b = creative.getImpressionUrl();
@@ -322,19 +321,21 @@ public class TestController {
 
                             } else {
                                 a = b + "&csite=__CSITE__";
-                            }
-                            if (creative.getCreativeMaterialType() == 1) {
-                                json.put("clickTrackUrl", a);
-                            } else if (creative.getCreativeMaterialType() == 4) {
-                                json.put("impressionUrl", a);
-                                json.put("clickTrackUrl", a);
-                            }
+                            }*/
+                                    a = clickTrackUrl.replace("&csite=__CSITE__&csite=__CSITE__", "&csite=__CSITE__");
+
+                                    if (creative.getCreativeMaterialType() == 1) {
+                                        json.put("clickTrackUrl", a);
+                                    } else if (creative.getCreativeMaterialType() == 4) {
+                                        json.put("impressionUrl", a);
+                                        json.put("clickTrackUrl", a);
+                                    }
 
-                            batchService.updateCreative(json, oauthToken);
-                            Thread.sleep(1000);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
+                                    batchService.updateCreative(json, oauthToken);
+                                    Thread.sleep(1000);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
                             }
                         });
                     }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -359,7 +359,7 @@ public class HttpUtils {
         String strReturn = "";
         try {
             HttpPost httppost = new HttpPost(url);
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(120000).setConnectTimeout(120000).build();
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(1200000).setConnectTimeout(1200000).build();
             httppost.setConfig(requestConfig);
             if (!Check.isNullMap(headers)) {
                 for (String key : headers.keySet()) {

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

@@ -40,6 +40,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
     @Autowired
     private KuaiShouCampaignStatusMapper campaignStatusMapper;
 
+
     @Override
     public Map<String, Object> updateCampaign(String token, Long advertiserId, Long campaignId, Long dayBudget, String loginId) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -116,6 +117,7 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
      */
     @Autowired
     private IKuaiShouGroupService groupService;
+
     @Override
     public Map<String, Object> updateUnitDayBudget(String token, Long advertiserId, Long unitId, Long dayBudget, String loginId) {
         Map<String, Object> returnMap = new HashMap<>();
@@ -591,11 +593,11 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
-                   log.info("修改成功,accountId:{},unitId:{}",unitJson.getLong("advertiser_id"),unitJson.getLong("unit_id"));
+                    log.info("修改成功,accountId:{},unitId:{}", unitJson.getLong("advertiser_id"), unitJson.getLong("unit_id"));
 
                 } else {
-                    log.info("修改失败,accountId:{},unitId:{}",unitJson.getLong("advertiser_id"),unitJson.getLong("unit_id"));
-                    log.info("失败原因:{}",resultJson);
+                    log.info("修改失败,accountId:{},unitId:{}", unitJson.getLong("advertiser_id"), unitJson.getLong("unit_id"));
+                    log.info("失败原因:{}", resultJson);
 
                     returnJson.put("code", -1);
                     returnJson.put("message", resultJson.getString("message"));
@@ -633,6 +635,11 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
                     log.info("修改成功,accountId:{},creativeId:{}", creativeJson.getLong("advertiser_id"), creativeJson.getLong("creative_id"));
+
+                    Map<String, Object> deleteMap = new HashMap<>();
+
+                    deleteMap.put("creative_id", creativeJson.getLong("creative_id"));
+                    creativeMapper.deleteByMap(deleteMap);
                 } else {
                     log.info("修改失败,accountId:{},creativeId:{},原因:{}", creativeJson.getLong("advertiser_id"), creativeJson.getLong("creative_id"), resultJson.getString("message"));