Explorar o código

加入测试接口

yumeng %!s(int64=5) %!d(string=hai) anos
pai
achega
461145791f

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

@@ -90,7 +90,6 @@ public class TestController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
 
 
 
-
     @GetMapping(value = "/getHistoryData")
     @GetMapping(value = "/getHistoryData")
     public String getHistoryData() {
     public String getHistoryData() {
         Result<String> result = new Result<String>();
         Result<String> result = new Result<String>();
@@ -448,50 +447,51 @@ public class TestController {
 
 
         //清洗关于作业帮数据
         //清洗关于作业帮数据
         //1:查询作业帮相关的用户数据
         //1:查询作业帮相关的用户数据
-            allocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> reportQueryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                        .eq("stat_datetime", dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String materialName = tags[3];
-                        report.setMaterialName(materialName);
-                        if (materialName.contains("其他")) {
-                            report.setMaterialType("其他");
-                        } else if (materialName.contains("图片轮播")) {
-                            report.setMaterialType("图片轮播");
-                        } else if (materialName.contains("大字报")) {
-                            report.setMaterialType("大字报");
-                        } else if (materialName.contains("文字动画")) {
-                            report.setMaterialType("文字动画");
-                        } else if (materialName.contains("采访形式")) {
-                            report.setMaterialType("采访形式");
-                        } else if (materialName.contains("剧情")) {
-                            report.setMaterialType("剧情");
-                        } else if (materialName.contains("口播")) {
-                            report.setMaterialType("口播");
-                        } else {
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
+        allocations.forEach(allocation -> {
+            //根据accountId和时间,查询相关的日报表信息
+            QueryWrapper<BytedancePlanDailyReport> reportQueryWrapper = new QueryWrapper<>();
+            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
+            queryWrapper.eq("advertiser_id", allocation.getAccountId())
+                    .eq("stat_datetime", dateString)
+            ;
+            List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
+            if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                bytedancePlanDailyReports.forEach(report -> {
+                    String adName = report.getAdName();
+                    String[] tags = adName.split("-");
+                    report.setAdsense(tags[1]);
+                    report.setPlanCode(tags[2]);
+                    String materialName = tags[3];
+                    report.setMaterialName(materialName);
+                    if (materialName.contains("其他")) {
+                        report.setMaterialType("其他");
+                    } else if (materialName.contains("图片轮播")) {
+                        report.setMaterialType("图片轮播");
+                    } else if (materialName.contains("大字报")) {
+                        report.setMaterialType("大字报");
+                    } else if (materialName.contains("文字动画")) {
+                        report.setMaterialType("文字动画");
+                    } else if (materialName.contains("采访形式")) {
+                        report.setMaterialType("采访形式");
+                    } else if (materialName.contains("剧情")) {
+                        report.setMaterialType("剧情");
+                    } else if (materialName.contains("口播")) {
+                        report.setMaterialType("口播");
+                    } else {
+                        report.setMaterialType("其他");
+                    }
+                    planDailyReportService.updateById(report);
+                });
+            }
+        });
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
         return result;
     }
     }
 
 
     @Autowired
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
     private IByteDanceAdvertiserDataService advertiserDataService;
+
     @GetMapping("getBytedanceData")
     @GetMapping("getBytedanceData")
     public Map<String, Object> getBytedanceData() {
     public Map<String, Object> getBytedanceData() {
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
@@ -814,4 +814,36 @@ public class TestController {
             }
             }
         });
         });
     }
     }
+
+
+    @GetMapping(value = "/getAllCreativeList")
+    public void getAllCreativeList() {
+
+        try {
+
+            QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+            oauthTokenQueryWrapper.eq("media_id", 2);
+            List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(oauthTokenQueryWrapper);
+
+            if (!Check.isNull(ctopOauthTokens)) {
+                for (CtopOauthToken token : ctopOauthTokens) {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (!Check.isNull(token)) {
+                                log.info("获取创意,账号id:{}", token.getAccountId());
+                                kuaishouInterfaceService.getCreativeList(token, null, null);
+                            }
+                        }
+                    });
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+
 }
 }