|
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -88,31 +89,27 @@ public class BytedanceController {
|
|
|
|
|
|
@GetMapping(value = "/testReport")
|
|
|
public String testReport() {
|
|
|
- List<Long> accountIds = tokenService.getAllToutiaoAccountIds();
|
|
|
- for (Long id : accountIds) {
|
|
|
- String token = tokenService.getByAccountId(id);
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ //昨天
|
|
|
+ String yesterda = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+
|
|
|
+// List<Long> accountIds = tokenService.getAllToutiaoAccountIds();
|
|
|
+ List<JSONObject> accountIds = tokenService.getByProjectId(18450885L);
|
|
|
+
|
|
|
+ for (JSONObject obj : accountIds) {
|
|
|
+// String token = tokenService.getByAccountId(id);
|
|
|
OauthToken oauthToken = new OauthToken();
|
|
|
- oauthToken.setAccessToken(token);
|
|
|
- oauthToken.setAccountId(id);
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
- String yesterda = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
- String start = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -8);
|
|
|
- Date getDate = new Date();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
|
|
|
- String hour = simpleDateFormat.format(getDate);
|
|
|
+ oauthToken.setAccessToken(obj.getString("accessToken"));
|
|
|
+ oauthToken.setAccountId(obj.getLong("accountId"));
|
|
|
dailyExecutorService.submit(
|
|
|
new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
try {
|
|
|
Thread.sleep(500);
|
|
|
- // materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, yesterda2, yesterda, 1, 100);
|
|
|
-// listService.getProjectList(oauthToken, start, yesterda, 1);
|
|
|
-// advertiserDataService.getV3AdvertiserReport(oauthToken, start, yesterda, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
|
-// materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, yesterda, yesterda, 1, 100);
|
|
|
-// materialReportDailyService.bytedanceDailyMaterialReportJobV3Image(oauthToken, yesterda2, yesterda, 1, 100);
|
|
|
- advertiserDataService.getV3PromotionProjectReport(oauthToken, "2023-07-01", "2023-07-06", CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
|
- advertiserDataService.getV3PromotionMaterialReport(oauthToken, "2023-07-01", "2023-07-06", CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
|
+// fileVideoService.getFileVideoData(oauthToken, null, null, 1, 100);
|
|
|
+
|
|
|
+ advertiserDataService.getAdvertiserReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -123,10 +120,56 @@ public class BytedanceController {
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping(value = "/testReportHour")
|
|
|
+ public String testReportHour() {
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String yesterda = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+
|
|
|
+ //获取 两个日期之间的所有 日期
|
|
|
+ List<String> dates = DateUtils.getAllDatesOfTwoTimes("2024-05-29", "2024-06-11");
|
|
|
+
|
|
|
+// tokenService.getAllToutiaoAccountIds();
|
|
|
+ List<Long> accountIds = new ArrayList<>();
|
|
|
+ accountIds.add(1799928973572105l);
|
|
|
+ accountIds.add(1800189297615018l);
|
|
|
+ for (String date : dates) {
|
|
|
+ for (Long id : accountIds) {
|
|
|
+ String token = tokenService.getByAccountId(id);
|
|
|
+ OauthToken oauthToken = new OauthToken();
|
|
|
+ oauthToken.setAccessToken(token);
|
|
|
+ oauthToken.setAccountId(id);
|
|
|
+ dailyExecutorService.submit(
|
|
|
+ new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ Thread.sleep(500);
|
|
|
+// materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, yesterda2, yesterda, 1, 100);
|
|
|
+// listService.getProjectList(oauthToken, start, yesterda, 1);
|
|
|
+// advertiserDataService.getV3AdvertiserReport(oauthToken, start, yesterda, CtopAdConstant.BYTEDAN1CE_REPORT_V3_TYPE_DAILY);
|
|
|
+// materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, "2024-01-01", "2024-01-10", 1, 100);
|
|
|
+// materialReportDailyService.bytedanceDailyMaterialReportJobV3Image(oauthToken, yesterda2, yesterda, 1, 100);
|
|
|
+// advertiserDataService.getV3PromotionProjectReport(oauthToken, date, date, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_HOURLY);
|
|
|
+ advertiserDataService.getAdvertiserReport(oauthToken, date, date, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+
|
|
|
+// advertiserDataService.getV3PromotionProjectReport(oauthToken, date, date, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
|
+// advertiserDataService.getV3PromotionMaterialReport(oauthToken, "2023-05-01", "2023-05-31", CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
|
+// advertiserDataServices.getPositionAdvertiserReport(oauthToken, "2023-07-01", "2023-07-18", CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "ok";
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/testOneReport")
|
|
|
public String testOneReport(Long accountId) {
|
|
|
-// String token = tokenService.getByAccountId(accountId);
|
|
|
- String token = tokenService.getAgentToken(accountId);
|
|
|
+ String token = tokenService.getByAccountId(accountId);
|
|
|
+// String token = tokenService.getAgentToken(accountId);
|
|
|
if (Check.isNull(token)) {
|
|
|
log.error("此账户未获取到相关token,accountId:{}", accountId);
|
|
|
return "no";
|
|
@@ -148,6 +191,8 @@ public class BytedanceController {
|
|
|
public void run() {
|
|
|
try {
|
|
|
Thread.sleep(500);
|
|
|
+ advertiserDataService.getAdvertiserReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+
|
|
|
// materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, start, yesterda, 1, 100);
|
|
|
// advertiserDataService.getV3AdvertiserConfig(oauthToken);
|
|
|
// advertiserDataService.getV3PromotionMaterialReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
|
|
@@ -155,7 +200,6 @@ public class BytedanceController {
|
|
|
// listService.getProjectList(oauthToken, start, yesterda, 1);
|
|
|
// materialReportDailyService.bytedanceDailyMaterialReportJobV3Image(oauthToken, yesterda2, yesterda, 1, 100);
|
|
|
// advertiserDataServices.getPositionAdvertiserReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
-// advertiserDataService.getAdvertiserReport(oauthToken, nowDate, nowDate, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_HOURLY);
|
|
|
// advertiserDataService.getAgentReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
|
|
|
} catch (Exception e) {
|