Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

songyinghao vor 5 Jahren
Ursprung
Commit
0e1c5db4b9

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

@@ -32,6 +32,9 @@ public class TestController {
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
 
+    @Autowired
+    private CtopOauthTokenMapper oauthTokenMapper;
+
     @PostMapping(value = "/create")
     public Map<String, Object> authorization(@RequestBody JSONObject jsonObject) {
         return createInternalService.createInternal(jsonObject);
@@ -122,8 +125,7 @@ public class TestController {
         return "Success";
     }
 
-    @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
+
 
 
     @GetMapping(value = "/gerCreative")
@@ -136,7 +138,7 @@ public class TestController {
                 @Override
                 public void run() {
                     try {
-                        System.err.println("获取创意,accountId:" +token.getAccountId() );
+                        System.err.println("获取创意,accountId:" + token.getAccountId());
                         kuaishouInterfaceService.getCreativeList(token, null, null);
                         //  kuaishouInterfaceService.getVideoList2(token, null, null,1);
                         //3: 获取图片信息数据
@@ -182,4 +184,63 @@ public class TestController {
         };
         thread.start();
     }
+
+
+
+
+
+
+    @GetMapping(value = "/gerCreativeByAccount")
+    public void gerCreative(Long accountId) {
+        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+        oauthTokenQueryWrapper.eq("media_id", 2);
+        oauthTokenQueryWrapper.eq("account_id", accountId);
+        oauthTokenQueryWrapper.last("limit 1");
+        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        System.err.println("获取创意,accountId:" + token.getAccountId());
+                        kuaishouInterfaceService.getCreativeList(token, null, null);
+                        //  kuaishouInterfaceService.getVideoList2(token, null, null,1);
+                        //3: 获取图片信息数据
+                        // kuaishouInterfaceService.getImageList2(token, null, null,1);
+                        Thread.sleep(1 * 200);
+                        //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+
+
+    }
+
+
+
+    @GetMapping(value = "/gerCreativeReportByAccount")
+    public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr, QueryWrapper<CtopOauthToken> account_id) {
+        Thread thread = new Thread() {
+            @SneakyThrows
+            @Override
+            public void run() {
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                Date startDate = sim.parse(startDateStr);
+                Date endDate = sim.parse(endDateStr);
+                //1:查询当日数据
+                //executorService = Executors.newFixedThreadPool(3);
+                QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+                oauthTokenQueryWrapper.eq("media_id", 2);
+                oauthTokenQueryWrapper.eq("account_id", accountId);
+                CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+                System.err.println("创意报表accountId:" + ctopOauthToken.getAccountId());
+                kuaishouInterfaceService.getAdvertiserCreativeReportDaily(ctopOauthToken, startDate, endDate);
+
+
+            }
+        };
+        thread.start();
+    }
+
 }