yumeng hace 1 año
padre
commit
ac4186e90f

+ 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);