|
|
@@ -2,8 +2,10 @@ package cn.com.ctop.job.bytedance.controller;
|
|
|
|
|
|
import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
|
|
|
import cn.com.ctop.job.bytedance.data.enums.AccountTypeEnum;
|
|
|
+import cn.com.ctop.job.bytedance.data.mapper.BytedanceCdpProjectMapper;
|
|
|
import cn.com.ctop.job.bytedance.data.service.*;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
|
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -32,6 +34,8 @@ public class BytedanceController {
|
|
|
private ICustomReportService customReportService;
|
|
|
@Autowired
|
|
|
private IBytedanceProductReportService productReportService;
|
|
|
+ @Autowired
|
|
|
+ private BytedanceCdpProjectMapper bytedanceCdpProjectMapper;
|
|
|
|
|
|
private static final ExecutorService executor10Service1 = Executors.newFixedThreadPool(10);
|
|
|
private static final ExecutorService executor10Service2 = Executors.newFixedThreadPool(10);
|
|
|
@@ -210,6 +214,31 @@ public class BytedanceController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/uniFlowDetailsReport")
|
|
|
+ public void uniFlowDetailsReport(@RequestParam(required = false) String startDate,
|
|
|
+ @RequestParam(required = false) String endDate) {
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
|
|
|
+ startDate = startDate == null ? date : startDate;
|
|
|
+ endDate = endDate == null ? nowDate : endDate;
|
|
|
+
|
|
|
+ List<JSONObject> jsonObjects = bytedanceCdpProjectMapper.queryUniCostAdvertiserIds(startDate.replace("-", ""), endDate.replace("-", ""));
|
|
|
+ for (JSONObject jsonObject : jsonObjects) {
|
|
|
+ Long advertiserId = jsonObject.getLong("advertiser_id");
|
|
|
+ String accessToken = jsonObject.getString("access_token");
|
|
|
+ String finalStartDate = startDate;
|
|
|
+ String finalEndDate = endDate;
|
|
|
+ executor10Service1.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (!Check.isNull(accessToken)) {
|
|
|
+ byteDanceFlowDetailsReportService.getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, AccountTypeEnum.AD.getValue(), finalStartDate, finalEndDate, 1, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/generateFlowDetailsReport")
|
|
|
public void generateFlowDetailsReport(String startDate, String endDate) {
|
|
|
List<AdvertiserAccount> adAccount = byteDanceFlowDetailsReportService.getAdAccount();
|