Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

zhaotx 1 yıl önce
ebeveyn
işleme
cc8760494a

+ 8 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceCdpProject.java

@@ -149,6 +149,9 @@ public class BytedanceCdpProject {
      */
      */
     private Long microAppInstanceId;
     private Long microAppInstanceId;
 
 
+    private String deliveryMode;
+    private String bidType;
+
 
 
     /**
     /**
      * 创建时间
      * 创建时间
@@ -201,5 +204,10 @@ public class BytedanceCdpProject {
         if (!Check.isNull(optimizeGoal)) {
         if (!Check.isNull(optimizeGoal)) {
             this.externalAction = optimizeGoal.getString("external_action");
             this.externalAction = optimizeGoal.getString("external_action");
         }
         }
+        this.deliveryMode = o.getString("delivery_mode");
+        JSONObject deliverySetting = o.getJSONObject("delivery_setting");
+        if (!Check.isNull(deliverySetting)) {
+            this.bidType = deliverySetting.getString("bid_type");
+        }
     }
     }
 }
 }

+ 4 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/AdminAdvertiserListServiceImpl.java

@@ -14,12 +14,14 @@ import org.springframework.stereotype.Service;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
+
 @Service
 @Service
 @Slf4j
 @Slf4j
 public class AdminAdvertiserListServiceImpl implements IAdminAdvertiserListService {
 public class AdminAdvertiserListServiceImpl implements IAdminAdvertiserListService {
 
 
     @Autowired
     @Autowired
     private AdminAdvertiserListMapper adminAdvertiserListMapper;
     private AdminAdvertiserListMapper adminAdvertiserListMapper;
+
     @Override
     @Override
     public JSONObject bytedanceAdvertiserThreadPool(Integer totalPage, Integer pageSize, Long adminAdvertiserId, Long ccAccountId, String accessToken) {
     public JSONObject bytedanceAdvertiserThreadPool(Integer totalPage, Integer pageSize, Long adminAdvertiserId, Long ccAccountId, String accessToken) {
         ExecutorService executor = Executors.newFixedThreadPool(5);
         ExecutorService executor = Executors.newFixedThreadPool(5);
@@ -136,7 +138,7 @@ public class AdminAdvertiserListServiceImpl implements IAdminAdvertiserListServi
     }
     }
 
 
 
 
-    private List<String> getBytedanceAccountList(Long adminAdvertiserId, Long ccAccountId, String accessToken, Integer page, Integer pageSize, Integer requestCount) {
+    private List<String> getBytedanceAccountList(Long adminAdvertiserId, Long ccAccountId, String accessToken, Integer page, Integer pageSize, Integer requestCount) throws InterruptedException {
         try {
         try {
             Thread.sleep(100);
             Thread.sleep(100);
         } catch (InterruptedException e) {
         } catch (InterruptedException e) {
@@ -176,6 +178,7 @@ public class AdminAdvertiserListServiceImpl implements IAdminAdvertiserListServi
             }
             }
         } else {
         } else {
             log.error("请求字节账户列表失败,进入重试任务,当前请求次数:{}", requestCount);
             log.error("请求字节账户列表失败,进入重试任务,当前请求次数:{}", requestCount);
+            Thread.sleep(1000);
             getBytedanceAccountList(adminAdvertiserId, ccAccountId, accessToken, page, pageSize, requestCount + 1);
             getBytedanceAccountList(adminAdvertiserId, ccAccountId, accessToken, page, pageSize, requestCount + 1);
         }
         }
         if (!Check.isNull(advertiserLists)) {
         if (!Check.isNull(advertiserLists)) {

+ 1 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/AdminAdvertiserListJob.java

@@ -45,6 +45,7 @@ public class AdminAdvertiserListJob {
                 JSONObject totalJson = adminAdvertiserListService.getBytedanceAccountListTotal(advertiserId, advertiserId, accessToken, 1, pageSize);
                 JSONObject totalJson = adminAdvertiserListService.getBytedanceAccountListTotal(advertiserId, advertiserId, accessToken, 1, pageSize);
                 if (!Check.isNull(totalJson)) {
                 if (!Check.isNull(totalJson)) {
                     Integer totalPage = totalJson.getInteger("totalPage");
                     Integer totalPage = totalJson.getInteger("totalPage");
+                    log.info("管家账户ID:{},账户总数:{}", advertiserId, totalPage);
                     if (totalPage != 0) {
                     if (totalPage != 0) {
                         JSONObject result = adminAdvertiserListService.bytedanceAdvertiserThreadPool(totalPage, pageSize, advertiserId, advertiserId, accessToken);
                         JSONObject result = adminAdvertiserListService.bytedanceAdvertiserThreadPool(totalPage, pageSize, advertiserId, advertiserId, accessToken);
                         log.info("字节多线程获取账户返回结果:{}", result);
                         log.info("字节多线程获取账户返回结果:{}", result);

+ 7 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceCdpProjectJob.java

@@ -44,9 +44,13 @@ public class BytedanceCdpProjectJob {
         if (!Check.isNull(ids)) {
         if (!Check.isNull(ids)) {
             log.info("总数:{}", ids.size());
             log.info("总数:{}", ids.size());
 //            ids.forEach(id -> allService.submit(() -> cdpProjectService.getProjectList(id, null, null, null)));
 //            ids.forEach(id -> allService.submit(() -> cdpProjectService.getProjectList(id, null, null, null)));
-            ids.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, "2025-07-09", "2025-07-09")));
-
+//            ids.forEach(id -> createiveAppsExecutorService.submit(() -> cdpProjectService.getAdqCreatives(id, "2025-07-09", "2025-07-09")));
 
 
+            List<String> days = DateUtils.getDays("2025-06-01", "2025-07-22");
+            for (String day : days) {
+                ids.forEach(id -> projectExecutorService.submit(() -> cdpProjectService.getProjectList(id, null, null, day)));
+                ids.forEach(id -> promExecutorService.submit(() -> cdpProjectService.getpromotionList(id, null, day)));
+            }
         }
         }
     }
     }
 
 
@@ -167,7 +171,7 @@ public class BytedanceCdpProjectJob {
                 for (JSONObject iid : iids) {
                 for (JSONObject iid : iids) {
                     Long pageId = iid.getLong("page_id");
                     Long pageId = iid.getLong("page_id");
                     Long advertiserId = iid.getLong("advertiser_id");
                     Long advertiserId = iid.getLong("advertiser_id");
-                    pageAppsExecutorService.submit(() -> cdpProjectService.getAdqWechatPages(advertiserId,pageId));
+                    pageAppsExecutorService.submit(() -> cdpProjectService.getAdqWechatPages(advertiserId, pageId));
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {

+ 11 - 3
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/doris/sink/SimpleHttpDorisSinkClient.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.utils.doris.sink;
 package cn.com.ctop.job.bytedance.utils.doris.sink;
 
 
 import cn.com.ctop.job.bytedance.data.utils.JsonUtils;
 import cn.com.ctop.job.bytedance.data.utils.JsonUtils;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -44,11 +45,18 @@ public class SimpleHttpDorisSinkClient implements DorisSinkClient {
         String url = String.format("%s/api/%s/%s/_stream_load", feHost, db, table);
         String url = String.format("%s/api/%s/%s/_stream_load", feHost, db, table);
 
 
         // 提取 data
         // 提取 data
-        List<Object> dataList = records.stream()
-                .map(RecordWithMeta::getData)
+        List<String> dataList = records.stream()
+                .map(d->{
+                    Object data = d.getData();
+                    if (data instanceof JSONObject) {
+                        return data.toString();
+                    }else {
+                        return JsonUtils.toFilterJSON(data);
+                    }
+                })
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
 
 
-        String jsonBody = JsonUtils.toFilterJSON(dataList);
+        String jsonBody = dataList.toString();
         //log.info("jsonBody:{}", jsonBody);
         //log.info("jsonBody:{}", jsonBody);
 
 
         HttpPut put = new HttpPut(url);
         HttpPut put = new HttpPut(url);