yumeng 5 lat temu
rodzic
commit
9701f67db2

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

@@ -100,37 +100,31 @@ public class TestController {
 
     @GetMapping(value = "/getSuZhao")
     public void getSuZhao() throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-                try {
 
-                    //1:查询当日数据
-                    List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                    if (null == tokens || tokens.size() <= 0) {
-                        log.info("定时获取快手数据异常:未获取到可用的token");
-                        return;
-                    }
+        try {
 
-                    executorService = Executors.newFixedThreadPool(8);
-                    tokens.forEach(token -> {
-                        executorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                //1: 获取广告主信息数据
-                                kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
-                            }
-                        });
-                    });
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+            //1:查询当日数据
+            List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+            if (null == tokens || tokens.size() <= 0) {
+                log.info("定时获取快手数据异常:未获取到可用的token");
+                return;
+            }
 
+            executorService = Executors.newFixedThreadPool(8);
+            tokens.forEach(token -> {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        //1: 获取广告主信息数据
+                        log.info("获取素造素材:accountId:{}", token.getAccountId());
+                        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, null, null);
+                    }
+                });
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
-            }
-        };
-        thread.start();
 
     }