yumeng il y a 5 ans
Parent
commit
1f9304ddeb

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

@@ -130,11 +130,12 @@ public class TestController {
                 @Override
                 public void run() {
                     try {
-                        //  kuaishouInterfaceService.getCreativeList(token, null, null);
+                    /*    //  kuaishouInterfaceService.getCreativeList(token, null, null);
                         kuaishouInterfaceService.getVideoList2(token, null, null,1);
                         //3: 获取图片信息数据
                         kuaishouInterfaceService.getImageList2(token, null, null,1);
-                        Thread.sleep(1 * 1000);
+                        Thread.sleep(1 * 1000);*/
+                        kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
                     } catch (Exception e) {
                         e.printStackTrace();
                     }

+ 10 - 15
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouAppListJob.java

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -16,18 +16,15 @@ import java.util.concurrent.Executors;
 
 /**
  * 获取广告计划分时报表
- *
- * @author syh
  */
 @Slf4j
 public class KuaishouAppListJob implements Job {
     @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private CtopOauthTokenMapper oauthTokenMapper;
 
-    static ExecutorService executorService = null;
-
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -35,23 +32,21 @@ public class KuaishouAppListJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-                executorService = Executors.newFixedThreadPool(3);
-                tokens.forEach(token -> {
+                QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+                oauthTokenQueryWrapper.eq("media_id", 2);
+                List<CtopOauthToken> tokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+                for (CtopOauthToken token : tokens) {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
                             try {
                                 kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
-                                log.info("快手应用信息获取完成完成");
-
                             } catch (Exception e) {
                                 e.printStackTrace();
-                            } finally {
                             }
                         }
                     });
-                });
+                }
 
             }
 

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -3038,6 +3038,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             json.put("advertiser_id", advertiserId);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            System.err.println(resultJson);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
@@ -3065,7 +3066,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         }
                     }
                 } else {
-                    log.error("获取应用列表失败,返回信息:{}", resultJson);
+                    log.error("获取应用列表失败,返回信息:{}",resultJson);
                 }
             } else {
                 log.error("获取地域列表返回结果为空");