|
@@ -3,15 +3,16 @@ package cn.com.ctop.job.bytedance.controller;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IAdminAdvertiserListService;
|
|
import cn.com.ctop.job.bytedance.data.service.IAdminAdvertiserListService;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
|
|
import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
|
-import cn.com.ctop.job.bytedance.data.utils.DateUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
|
@@ -53,13 +54,21 @@ public class BytedanceController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/productData")
|
|
@GetMapping("/productData")
|
|
|
- public void productData(String param) {
|
|
|
|
|
- String[] s = param.split("_");
|
|
|
|
|
- Long advertiserId = Long.valueOf(s[0]);
|
|
|
|
|
- String accessToken = s[1];
|
|
|
|
|
- String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
|
|
- String data = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
|
|
- productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, data, data, 1, null, 1, null);
|
|
|
|
|
|
|
+ public void productData(@RequestParam(required = false) Long advertiserId, String startDate, String endDate) {
|
|
|
|
|
+ List<JSONObject> costAccount = productReportService.getCostAccount(advertiserId, startDate, endDate);
|
|
|
|
|
+ for (JSONObject jsonObject : costAccount) {
|
|
|
|
|
+ Long adverId = jsonObject.getLong("advertiserId");
|
|
|
|
|
+ String accessToken = jsonObject.getString("accessToken");
|
|
|
|
|
+
|
|
|
|
|
+ dailyRetrExecutorService.submit(new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ if (!Check.isNull(accessToken)) {
|
|
|
|
|
+ productReportService.getBytedanceProductDailyReport(adverId, accessToken, startDate, endDate, 1, null, 1, null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|