|
|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.ctop.job.bytedance.data.service.impl;
|
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.constant.CtopAdConstant;
|
|
|
import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportDaily;
|
|
|
import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportHourly;
|
|
|
import cn.com.ctop.job.bytedance.data.mapper.AccountReportNewMapper;
|
|
|
@@ -13,17 +14,14 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService {
|
|
|
@Autowired
|
|
|
private AccountReportNewMapper accountReportNewMapper;
|
|
|
-
|
|
|
+ private String urlPath = "http://192.168.0.85:8765/webhook/bytedance_account_report";
|
|
|
private static JSONArray metrics = new JSONArray();
|
|
|
|
|
|
@Override
|
|
|
@@ -116,6 +114,13 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
getBytedanceAccountHour(advertiserId, accessToken, startDate, endDate, page + 1);
|
|
|
} else {
|
|
|
log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
|
|
|
+ log.info("账户ID:{},开始日期:{},结束日期:{},广告日报(账户粒度)数据请求成功", advertiserId, startDate, endDate);
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("advertiser_id", advertiserId);
|
|
|
+ param.put("start_date", startDate);
|
|
|
+ param.put("end_date", endDate);
|
|
|
+ param.put("date_type", "hourly");
|
|
|
+ HttpUtils.httpPostRequest(urlPath, param, null);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -210,6 +215,12 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
getAdvertiserDailyReport(advertiserId, oauthToken, startDate, endDate, page + 1);
|
|
|
} else {
|
|
|
log.info("账户ID:{},开始日期:{},结束日期:{},广告日报(账户粒度)数据请求成功", advertiserId, startDate, endDate);
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("advertiser_id", advertiserId);
|
|
|
+ param.put("start_date", startDate);
|
|
|
+ param.put("end_date", endDate);
|
|
|
+ param.put("date_type", "daily");
|
|
|
+ HttpUtils.httpPostRequest(urlPath, param, null);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -266,4 +277,9 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
public JSONObject getTokenInfo() {
|
|
|
return accountReportNewMapper.getTokenInfo();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Long> getAccountIds(Long projectId) {
|
|
|
+ return accountReportNewMapper.getAccountIds(projectId);
|
|
|
+ }
|
|
|
}
|