|
@@ -1,15 +1,11 @@
|
|
package cn.com.ctop.toutiao.modules.report.service.impl;
|
|
package cn.com.ctop.toutiao.modules.report.service.impl;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
-import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
import cn.com.ctop.common.module.mapper.UserAllocationMapper;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.common.module.utils.LoadFileUtil;
|
|
import cn.com.ctop.common.module.utils.LoadFileUtil;
|
|
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
|
|
|
|
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceAdvertiserDailyReport;
|
|
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceDailyReportTask;
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceDailyReportTask;
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
|
|
import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
|
|
@@ -51,8 +47,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
@Autowired
|
|
@Autowired
|
|
private BytedanceReportMapper reportMapper;
|
|
private BytedanceReportMapper reportMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private KuaishouReportDailyAccountMapper kuaishouReportDailyAccountMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private BytedanceDailyReportTaskMapper bytedanceDailyReportTaskMapper;
|
|
private BytedanceDailyReportTaskMapper bytedanceDailyReportTaskMapper;
|
|
@@ -67,169 +61,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 媒体昨日总消耗
|
|
|
|
- *
|
|
|
|
- * @param loginId
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public JSONObject getAccountReport(String loginId) {
|
|
|
|
- JSONObject returnJson = new JSONObject();
|
|
|
|
- QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.eq("user_id", loginId);
|
|
|
|
- queryWrapper.isNotNull("account_id");
|
|
|
|
- queryWrapper.groupBy("account_id");
|
|
|
|
- List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
|
|
|
|
- if (!Check.isNull(userAllocations)) {
|
|
|
|
- // 头条相关
|
|
|
|
- JSONObject bytedanceJson = new JSONObject();
|
|
|
|
- BigDecimal byteDanceCost = new BigDecimal(0);
|
|
|
|
- Long byteDanceClick = 0L;
|
|
|
|
- Long byteDanceShow = 0L;
|
|
|
|
- Long byteDanceConvert = 0L;
|
|
|
|
- Long byteDanceForm = 0L;
|
|
|
|
- Long byteDanceNextDayOpen = 0L;
|
|
|
|
- Long byteDanceActive = 0L;
|
|
|
|
- JSONArray bytedanceDetail = new JSONArray();
|
|
|
|
-
|
|
|
|
- // 快手相关
|
|
|
|
- JSONArray kuaishouDetail = new JSONArray();
|
|
|
|
- JSONObject kuaishouJson = new JSONObject();
|
|
|
|
- BigDecimal kuaishouCost = new BigDecimal(0);
|
|
|
|
-
|
|
|
|
- Long kuaishouClick = 0L;
|
|
|
|
- Long kuaishouShow = 0L;
|
|
|
|
- Long kuaishouConvert = 0L;
|
|
|
|
- Long kuaishouForm = 0L;
|
|
|
|
- Long kuaishouNextDayOpen = 0L;
|
|
|
|
- Long kuaishouActive = 0L;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- for (UserAllocation userAllocation : userAllocations) {
|
|
|
|
- if ("1".equals(userAllocation.getMediaId())) {
|
|
|
|
- QueryWrapper<BytedanceAdvertiserDailyReport> bytedanceAdvertiserDailyReportQueryWrapper = new QueryWrapper<>();
|
|
|
|
- bytedanceAdvertiserDailyReportQueryWrapper.eq("advertiser_id", userAllocation.getAccountId());
|
|
|
|
- bytedanceAdvertiserDailyReportQueryWrapper.between("stat_datetime", "2019-07-01 00:00:00", "2019-07-01 23:59:59");
|
|
|
|
- bytedanceAdvertiserDailyReportQueryWrapper.orderByDesc("create_time");
|
|
|
|
- bytedanceAdvertiserDailyReportQueryWrapper.last("limit 1");
|
|
|
|
- BytedanceAdvertiserDailyReport bytedanceAdvertiserDailyReport = bytedanceAdvertiserDailyReportMapper.selectOne(bytedanceAdvertiserDailyReportQueryWrapper);
|
|
|
|
- if (!Check.isNull(bytedanceAdvertiserDailyReport)) {
|
|
|
|
- JSONObject bytedanceDetailJson = new JSONObject();
|
|
|
|
- BigDecimal cost = bytedanceAdvertiserDailyReport.getCost();
|
|
|
|
- // 账号总消耗
|
|
|
|
- bytedanceDetailJson.put("cost", cost);
|
|
|
|
- byteDanceCost = byteDanceCost.add(cost);
|
|
|
|
- Long click = bytedanceAdvertiserDailyReport.getClick();
|
|
|
|
- // 账号总点击
|
|
|
|
- bytedanceDetailJson.put("click", click);
|
|
|
|
- byteDanceClick += click;
|
|
|
|
- Long showNum = bytedanceAdvertiserDailyReport.getShowNum();
|
|
|
|
- // 账号总展示
|
|
|
|
- bytedanceDetailJson.put("show", showNum);
|
|
|
|
- byteDanceShow += showNum;
|
|
|
|
- Long convertNum = bytedanceAdvertiserDailyReport.getConvertNum();
|
|
|
|
- // 账号总转化
|
|
|
|
- bytedanceDetailJson.put("convert", convertNum);
|
|
|
|
- byteDanceConvert += convertNum;
|
|
|
|
- Long form = bytedanceAdvertiserDailyReport.getForm();
|
|
|
|
- // 账号总表单提交
|
|
|
|
- bytedanceDetailJson.put("form", form);
|
|
|
|
- byteDanceForm += form;
|
|
|
|
- Long nextDayOpen = bytedanceAdvertiserDailyReport.getNextDayOpen();
|
|
|
|
- // 账号总次日留存
|
|
|
|
- bytedanceDetailJson.put("nextDayOpen", nextDayOpen);
|
|
|
|
- byteDanceNextDayOpen += nextDayOpen;
|
|
|
|
- Long active = bytedanceAdvertiserDailyReport.getActive();
|
|
|
|
- // 账号总激活
|
|
|
|
- bytedanceDetailJson.put("active", active);
|
|
|
|
- byteDanceActive += active;
|
|
|
|
- // 账号
|
|
|
|
- bytedanceDetailJson.put("accountId", userAllocation.getAccountId());
|
|
|
|
- // 账号 名称
|
|
|
|
- bytedanceDetailJson.put("accountName", userAllocation.getAuthName());
|
|
|
|
- bytedanceDetail.add(bytedanceDetailJson);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if ("2".equals(userAllocation.getMediaId())) {
|
|
|
|
- // 查询快手相关报表数据
|
|
|
|
- QueryWrapper<KuaishouReportDailyAccount> kuaishouReportDailyAccountQueryWrapper = new QueryWrapper<>();
|
|
|
|
- kuaishouReportDailyAccountQueryWrapper.eq("account_id", userAllocation.getAccountId());
|
|
|
|
- kuaishouReportDailyAccountQueryWrapper.between("stat_date", "2019-10-08 00:00:00", "2019-10-08 23:59:59");
|
|
|
|
- kuaishouReportDailyAccountQueryWrapper.orderByDesc("create_time");
|
|
|
|
- kuaishouReportDailyAccountQueryWrapper.last("limit 1");
|
|
|
|
- KuaishouReportDailyAccount reportDailyAccount = kuaishouReportDailyAccountMapper.selectOne(kuaishouReportDailyAccountQueryWrapper);
|
|
|
|
- if (!Check.isNull(reportDailyAccount)) {
|
|
|
|
- JSONObject kuaishouDetailJson = new JSONObject();
|
|
|
|
- kuaishouDetailJson.put("accountId", userAllocation.getAccountId());
|
|
|
|
- kuaishouDetailJson.put("accountName", userAllocation.getAuthName());
|
|
|
|
-
|
|
|
|
- // 花费
|
|
|
|
- BigDecimal cost = reportDailyAccount.getCharge();
|
|
|
|
- kuaishouDetailJson.put("cost", cost);
|
|
|
|
- kuaishouCost = kuaishouCost.add(cost);
|
|
|
|
-
|
|
|
|
- Long click = reportDailyAccount.getAclick();
|
|
|
|
- kuaishouDetailJson.put("click", click);
|
|
|
|
- kuaishouClick += click;
|
|
|
|
-
|
|
|
|
- Long show = reportDailyAccount.getPhotoShow();
|
|
|
|
- kuaishouDetailJson.put("show", show);
|
|
|
|
- kuaishouShow += show;
|
|
|
|
-
|
|
|
|
- Long convert = reportDailyAccount.getBclick();
|
|
|
|
- kuaishouDetailJson.put("convert", convert);
|
|
|
|
- kuaishouConvert += convert;
|
|
|
|
-
|
|
|
|
- Long form = reportDailyAccount.getSubmit();
|
|
|
|
- kuaishouDetailJson.put("form", form);
|
|
|
|
- kuaishouForm += form;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- Long active = reportDailyAccount.getActivation();
|
|
|
|
- kuaishouDetailJson.put("active", active);
|
|
|
|
- kuaishouActive += active;
|
|
|
|
-
|
|
|
|
- kuaishouDetail.add(kuaishouDetailJson);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 总消耗
|
|
|
|
- bytedanceJson.put("cost", byteDanceCost);
|
|
|
|
- // 总点击
|
|
|
|
- bytedanceJson.put("click", byteDanceClick);
|
|
|
|
- // 总展示
|
|
|
|
- bytedanceJson.put("show", byteDanceShow);
|
|
|
|
- // 总转化
|
|
|
|
- bytedanceJson.put("convert", byteDanceConvert);
|
|
|
|
- // 总表单提交
|
|
|
|
- bytedanceJson.put("form", byteDanceForm);
|
|
|
|
- // 总次留数
|
|
|
|
- bytedanceJson.put("nextDayOpen", byteDanceNextDayOpen);
|
|
|
|
- // 总激活
|
|
|
|
- bytedanceJson.put("active", byteDanceActive);
|
|
|
|
-
|
|
|
|
- returnJson.put("bytedance", bytedanceJson);
|
|
|
|
- returnJson.put("bytedanceDetail", bytedanceDetail);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- kuaishouJson.put("cost", kuaishouCost);
|
|
|
|
- kuaishouJson.put("click", kuaishouClick);
|
|
|
|
- kuaishouJson.put("show", kuaishouShow);
|
|
|
|
- kuaishouJson.put("convert", kuaishouConvert);
|
|
|
|
- kuaishouJson.put("form", kuaishouForm);
|
|
|
|
- kuaishouJson.put("nextDayOpen", 0);
|
|
|
|
- kuaishouJson.put("active", kuaishouActive);
|
|
|
|
- returnJson.put("kuaishou", kuaishouJson);
|
|
|
|
- returnJson.put("kuaishouDetail", kuaishouDetail);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return returnJson;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 快手-大盘报表
|
|
* 快手-大盘报表
|
|
*
|
|
*
|
|
* @param requestJson
|
|
* @param requestJson
|
|
@@ -670,19 +501,19 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
int diffMonths = DateUtils.calDiffMonth(DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"));
|
|
int diffMonths = DateUtils.calDiffMonth(DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"));
|
|
if (diffMonths == 0) {
|
|
if (diffMonths == 0) {
|
|
bytedanceAsyncTaskCreateByMonth(startDate, endDate, token, type);
|
|
bytedanceAsyncTaskCreateByMonth(startDate, endDate, token, type);
|
|
- }else{
|
|
|
|
- for(int i=0; i<=diffMonths ; i++){
|
|
|
|
- if (i == 0){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ for (int i = 0; i <= diffMonths; i++) {
|
|
|
|
+ if (i == 0) {
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
String end = dateMap.get("endDate");
|
|
String end = dateMap.get("endDate");
|
|
//System.out.println(startDate + " ----- " + end);
|
|
//System.out.println(startDate + " ----- " + end);
|
|
bytedanceAsyncTaskCreateByMonth(startDate, end, token, type);
|
|
bytedanceAsyncTaskCreateByMonth(startDate, end, token, type);
|
|
- }else if(i == diffMonths){
|
|
|
|
|
|
+ } else if (i == diffMonths) {
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
String start = dateMap.get("startDate");
|
|
String start = dateMap.get("startDate");
|
|
//System.out.println(start + " ----- " + endDate);
|
|
//System.out.println(start + " ----- " + endDate);
|
|
bytedanceAsyncTaskCreateByMonth(start, endDate, token, type);
|
|
bytedanceAsyncTaskCreateByMonth(start, endDate, token, type);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
Map<String, String> dateMap = DateUtils.getMaxMinDaysOfAddMonth(startDate, "yyyy-MM-dd", i);
|
|
String start = dateMap.get("startDate");
|
|
String start = dateMap.get("startDate");
|
|
String end = dateMap.get("endDate");
|
|
String end = dateMap.get("endDate");
|
|
@@ -699,7 +530,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
* @param endDate
|
|
* @param endDate
|
|
* @param token
|
|
* @param token
|
|
*/
|
|
*/
|
|
- private void bytedanceAsyncTaskCreateByMonth(String startDate, String endDate, CtopOauthToken token, Integer type){
|
|
|
|
|
|
+ private void bytedanceAsyncTaskCreateByMonth(String startDate, String endDate, CtopOauthToken token, Integer type) {
|
|
String access_token = token.getAccessToken();
|
|
String access_token = token.getAccessToken();
|
|
Long accountId = token.getAccountId();
|
|
Long accountId = token.getAccountId();
|
|
|
|
|
|
@@ -767,10 +598,10 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
|
|
|
//获取任务列表
|
|
//获取任务列表
|
|
@Override
|
|
@Override
|
|
- public void bytedanceAsyncTaskGet(){
|
|
|
|
|
|
+ public void bytedanceAsyncTaskGet() {
|
|
QueryWrapper<BytedanceDailyReportTask> taskQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<BytedanceDailyReportTask> taskQueryWrapper = new QueryWrapper<>();
|
|
//查询三种状态的信息--任务已创建、任务执行中、任务处理中
|
|
//查询三种状态的信息--任务已创建、任务执行中、任务处理中
|
|
- taskQueryWrapper.eq("is_download",0);
|
|
|
|
|
|
+ taskQueryWrapper.eq("is_download", 0);
|
|
//taskQueryWrapper.in("task_status", "ASYNC_TASK_STATUS_CREATED","ASYNC_TASK_STATUS_EXECUTING","ASYNC_TASK_STATUS_EXECUTING_STAGE2");
|
|
//taskQueryWrapper.in("task_status", "ASYNC_TASK_STATUS_CREATED","ASYNC_TASK_STATUS_EXECUTING","ASYNC_TASK_STATUS_EXECUTING_STAGE2");
|
|
taskQueryWrapper.notIn("task_status", "ASYNC_TASK_STATUS_FAILED");
|
|
taskQueryWrapper.notIn("task_status", "ASYNC_TASK_STATUS_FAILED");
|
|
taskQueryWrapper.orderByDesc("create_time");
|
|
taskQueryWrapper.orderByDesc("create_time");
|
|
@@ -792,11 +623,11 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
// 请求参数
|
|
// 请求参数
|
|
final Map filtering = new HashMap() {
|
|
final Map filtering = new HashMap() {
|
|
{
|
|
{
|
|
- put("task_ids",new Long[]{task.getTaskId()});
|
|
|
|
|
|
+ put("task_ids", new Long[]{task.getTaskId()});
|
|
put("task_name", task.getTaskName());
|
|
put("task_name", task.getTaskName());
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- Map data = new HashMap(){
|
|
|
|
|
|
+ Map data = new HashMap() {
|
|
{
|
|
{
|
|
put("advertiser_id", advertiser_id);
|
|
put("advertiser_id", advertiser_id);
|
|
put("filtering", filtering);
|
|
put("filtering", filtering);
|
|
@@ -848,7 +679,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
}
|
|
}
|
|
|
|
|
|
//下载任务结果 type 1.creative 2.account 3.campaign 4.plan
|
|
//下载任务结果 type 1.creative 2.account 3.campaign 4.plan
|
|
- private void bytedanceAsyncTaskDownload(BytedanceDailyReportTask task, CtopOauthToken token, Integer type){
|
|
|
|
|
|
+ private void bytedanceAsyncTaskDownload(BytedanceDailyReportTask task, CtopOauthToken token, Integer type) {
|
|
// 请求地址
|
|
// 请求地址
|
|
String open_api_domain = "https://ad.toutiao.com";
|
|
String open_api_domain = "https://ad.toutiao.com";
|
|
String path = "/open_api/2/async_task/download/";
|
|
String path = "/open_api/2/async_task/download/";
|
|
@@ -859,19 +690,19 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
requestMap.put("advertiser_id", task.getAccountId());
|
|
requestMap.put("advertiser_id", task.getAccountId());
|
|
requestMap.put("task_id", task.getTaskId());
|
|
requestMap.put("task_id", task.getTaskId());
|
|
String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token.getAccessToken(), fileName);
|
|
String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token.getAccessToken(), fileName);
|
|
- if(type == 1){
|
|
|
|
|
|
+ if (type == 1) {
|
|
//素材异步报表
|
|
//素材异步报表
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyCreativeFileAsync(localPath);
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyCreativeFileAsync(localPath);
|
|
- }else if(type == 2){
|
|
|
|
|
|
+ } else if (type == 2) {
|
|
//账户异步报表
|
|
//账户异步报表
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyAccountFileAsync(localPath);
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyAccountFileAsync(localPath);
|
|
- }else if(type == 3){
|
|
|
|
|
|
+ } else if (type == 3) {
|
|
//campaign异步报表
|
|
//campaign异步报表
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyCampaignFileAsync(localPath);
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyCampaignFileAsync(localPath);
|
|
- }else if(type == 4){
|
|
|
|
|
|
+ } else if (type == 4) {
|
|
//plan异步报表
|
|
//plan异步报表
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyPlanFileAsync(localPath);
|
|
bytedanceDailyReportTaskMapper.loadBytedanceDailyPlanFileAsync(localPath);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
log.error("异步报表类型传入错误,task_id:" + task.getTaskId() + ";类型:" + type);
|
|
log.error("异步报表类型传入错误,task_id:" + task.getTaskId() + ";类型:" + type);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -879,7 +710,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
/////////////////////////////////////////////////////////\
|
|
/////////////////////////////////////////////////////////\
|
|
//素材报表
|
|
//素材报表
|
|
@Override
|
|
@Override
|
|
- public void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate){
|
|
|
|
|
|
+ public void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate) {
|
|
Long accountId = token.getAccountId();
|
|
Long accountId = token.getAccountId();
|
|
// log.info("头条素材报表当前accountId为:" + accountId);
|
|
// log.info("头条素材报表当前accountId为:" + accountId);
|
|
Integer page = 1;
|
|
Integer page = 1;
|
|
@@ -891,23 +722,23 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
retry.setStartDate(startDate);
|
|
retry.setStartDate(startDate);
|
|
retry.setEndDate(endDate);
|
|
retry.setEndDate(endDate);
|
|
retry.setStatusCode(code);
|
|
retry.setStatusCode(code);
|
|
- if (code != 200 && code != 1){
|
|
|
|
|
|
+ if (code != 200 && code != 1) {
|
|
retry.setStatus(0);
|
|
retry.setStatus(0);
|
|
bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
|
|
bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
retry.setStatus(1);
|
|
retry.setStatus(1);
|
|
bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
|
|
bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
|
|
|
|
|
|
+ public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate) {
|
|
Long accountId = token.getAccountId();
|
|
Long accountId = token.getAccountId();
|
|
// log.info("头条素材报表当前accountId为:" + accountId);
|
|
// log.info("头条素材报表当前accountId为:" + accountId);
|
|
Integer page = 1;
|
|
Integer page = 1;
|
|
Integer pageSize = 100;
|
|
Integer pageSize = 100;
|
|
int code = bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
|
|
int code = bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
|
|
- if (code != 200 && code != 1){
|
|
|
|
|
|
+ if (code != 200 && code != 1) {
|
|
BytedanceReportMaterialRetry retry = new BytedanceReportMaterialRetry();
|
|
BytedanceReportMaterialRetry retry = new BytedanceReportMaterialRetry();
|
|
retry.setAccountId(accountId);
|
|
retry.setAccountId(accountId);
|
|
retry.setStatus(0);
|
|
retry.setStatus(0);
|
|
@@ -918,7 +749,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private int bytedanceMaterialReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate){
|
|
|
|
|
|
+ private int bytedanceMaterialReportByPage(Integer page, Integer pageSize, CtopOauthToken token, Long accountId, String startDate, String endDate) {
|
|
//log.info("当前页数:"+ page);
|
|
//log.info("当前页数:"+ page);
|
|
String access_token = token.getAccessToken();
|
|
String access_token = token.getAccessToken();
|
|
|
|
|
|
@@ -947,153 +778,153 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
|
|
|
|
int returnCode = 200;
|
|
int returnCode = 200;
|
|
try {
|
|
try {
|
|
- if(!Check.isNull(json)){
|
|
|
|
- Integer code = json.getInteger("code");
|
|
|
|
- if(code != 0){
|
|
|
|
- log.error("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
|
|
+ if (!Check.isNull(json)) {
|
|
|
|
+ Integer code = json.getInteger("code");
|
|
|
|
+ if (code != 0) {
|
|
|
|
+ log.error("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
|
|
- JSONObject jsonData = json.getJSONObject("data");
|
|
|
|
- if (Check.isNull(jsonData)){
|
|
|
|
- log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
|
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
- JSONObject pageInfo = jsonData.getJSONObject("page_info");
|
|
|
|
- Integer totalPage = pageInfo.getInteger("total_page");
|
|
|
|
- Integer currentPage = pageInfo.getInteger("page");
|
|
|
|
-
|
|
|
|
- JSONArray jsonArrayay = jsonData.getJSONArray("list");
|
|
|
|
- if(jsonArrayay.size() == 0){
|
|
|
|
- log.info("accountId:" + accountId + ";没有数据。总页数为:" + totalPage + "当前页数为:" + currentPage);
|
|
|
|
- //returnCode = 1;
|
|
|
|
- return 1;
|
|
|
|
- }
|
|
|
|
|
|
+ JSONObject jsonData = json.getJSONObject("data");
|
|
|
|
+ if (Check.isNull(jsonData)) {
|
|
|
|
+ log.error("获取任务列表返回信息data内容为空,头条accountId:" + accountId + ";返回json为:" + JSONObject.toJSONString(data));
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ JSONObject pageInfo = jsonData.getJSONObject("page_info");
|
|
|
|
+ Integer totalPage = pageInfo.getInteger("total_page");
|
|
|
|
+ Integer currentPage = pageInfo.getInteger("page");
|
|
|
|
+
|
|
|
|
+ JSONArray jsonArrayay = jsonData.getJSONArray("list");
|
|
|
|
+ if (jsonArrayay.size() == 0) {
|
|
|
|
+ log.info("accountId:" + accountId + ";没有数据。总页数为:" + totalPage + "当前页数为:" + currentPage);
|
|
|
|
+ //returnCode = 1;
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
|
|
- List<BytedanceReportMaterialDaily> bytedanceReportMaterialDailyList = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < jsonArrayay.size(); i++) {
|
|
|
|
- BytedanceReportMaterialDaily daily = new BytedanceReportMaterialDaily();
|
|
|
|
- daily.setAccountId(accountId);
|
|
|
|
- JSONObject detailJson = jsonArrayay.getJSONObject(i);
|
|
|
|
- if (!Check.isNull(detailJson)) {
|
|
|
|
- JSONObject dimensions = detailJson.getJSONObject("dimensions");
|
|
|
|
- daily.setImageMode(dimensions.getString("image_mode"));
|
|
|
|
- daily.setMaterialId(dimensions.getLong("material_id"));
|
|
|
|
- daily.setInventory(dimensions.getString("inventory"));
|
|
|
|
- daily.setStatDatetime(dimensions.getDate("stat_datetime")==null?null:DateUtils.formatDate(dimensions.getDate("stat_datetime"),"yyyy-MM-dd"));
|
|
|
|
-
|
|
|
|
- JSONObject metrics = detailJson.getJSONObject("metrics");
|
|
|
|
- daily.setActivePayAmount(metrics.getInteger("active_pay_amount"));
|
|
|
|
- daily.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
|
|
|
|
- daily.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
|
|
|
|
- daily.setNextDayOpen(metrics.getInteger("next_day_open"));
|
|
|
|
- daily.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
|
|
|
|
- daily.setConvertMaterial(metrics.getInteger("convert"));
|
|
|
|
- daily.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
|
|
|
|
- daily.setInAppCart(metrics.getInteger("in_app_cart"));
|
|
|
|
- daily.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
|
|
|
|
- daily.setConsultEffective(metrics.getInteger("consult_effective"));
|
|
|
|
- daily.setViewMaterial(metrics.getInteger("view"));
|
|
|
|
- daily.setDownload(metrics.getInteger("download"));
|
|
|
|
- daily.setCpa(metrics.getBigDecimal("cpa"));
|
|
|
|
- daily.setCpc(metrics.getBigDecimal("cpc"));
|
|
|
|
- daily.setLocationClick(metrics.getInteger("location_click"));
|
|
|
|
- daily.setPhoneConfirm(metrics.getInteger("phone_confirm"));
|
|
|
|
- daily.setIesMusicClick(metrics.getInteger("ies_music_click"));
|
|
|
|
- daily.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
|
|
|
|
- daily.setWifiPlay(metrics.getInteger("wifi_play"));
|
|
|
|
- daily.setShopping(metrics.getInteger("shopping"));
|
|
|
|
- daily.setQq(metrics.getInteger("qq"));
|
|
|
|
- daily.setCtr(metrics.getBigDecimal("ctr"));
|
|
|
|
- daily.setCpm(metrics.getBigDecimal("cpm"));
|
|
|
|
- daily.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
|
|
|
|
- daily.setLikeMaterial(metrics.getInteger("like"));
|
|
|
|
- daily.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
|
|
|
|
- daily.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
|
|
|
|
- daily.setActiveCost(metrics.getBigDecimal("active_cost"));
|
|
|
|
- daily.setActive(metrics.getInteger("active"));
|
|
|
|
- daily.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
|
|
|
|
- daily.setGameAddiction(metrics.getInteger("game_addiction"));
|
|
|
|
- daily.setActiveRate(metrics.getBigDecimal("active_rate"));
|
|
|
|
- daily.setClick(metrics.getInteger("click"));
|
|
|
|
- daily.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
|
|
|
|
- daily.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
|
|
|
|
- daily.setDownloadStart(metrics.getInteger("download_start"));
|
|
|
|
- daily.setHomeVisited(metrics.getInteger("home_visited"));
|
|
|
|
- daily.setPhone(metrics.getInteger("phone"));
|
|
|
|
- daily.setPhoneEffective(metrics.getInteger("phone_effective"));
|
|
|
|
- daily.setInAppPay(metrics.getInteger("in_app_pay"));
|
|
|
|
- daily.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
|
|
|
|
- daily.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
|
|
|
|
- daily.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
|
|
|
|
- daily.setTotalPlay(metrics.getInteger("total_play"));
|
|
|
|
- daily.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
|
|
|
|
- daily.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
|
|
|
|
- daily.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
|
|
|
|
- daily.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
|
|
|
|
- daily.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
|
|
|
|
- daily.setShowMaterial(metrics.getInteger("show"));
|
|
|
|
- daily.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
|
|
|
|
- daily.setMapSearch(metrics.getInteger("map_search"));
|
|
|
|
- daily.setButton(metrics.getInteger("button"));
|
|
|
|
- daily.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
|
|
|
|
- daily.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
|
|
|
|
- daily.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
|
|
|
|
- daily.setConvertRate(metrics.getBigDecimal("convert_rate"));
|
|
|
|
- daily.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
|
|
|
|
- daily.setConsult(metrics.getInteger("consult"));
|
|
|
|
- daily.setShareMaterial(metrics.getInteger("share"));
|
|
|
|
- daily.setVote(metrics.getInteger("vote"));
|
|
|
|
- daily.setValidPlay(metrics.getInteger("valid_play"));
|
|
|
|
- daily.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
|
|
|
|
- daily.setRedirect(metrics.getInteger("redirect"));
|
|
|
|
- daily.setPayCount(metrics.getInteger("pay_count"));
|
|
|
|
- daily.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
|
|
|
|
- daily.setCost(metrics.getBigDecimal("cost"));
|
|
|
|
- daily.setPhoneConnect(metrics.getInteger("phone_connect"));
|
|
|
|
- daily.setCoupon(metrics.getInteger("coupon"));
|
|
|
|
- daily.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
|
|
|
|
- daily.setDownloadFinish(metrics.getInteger("download_finish"));
|
|
|
|
- daily.setWechat(metrics.getInteger("wechat"));
|
|
|
|
- daily.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
|
|
|
|
- daily.setInstallFinish(metrics.getInteger("install_finish"));
|
|
|
|
- daily.setLottery(metrics.getInteger("lottery"));
|
|
|
|
- daily.setPlayOver(metrics.getInteger("play_over"));
|
|
|
|
- daily.setInAppOrder(metrics.getInteger("in_app_order"));
|
|
|
|
- daily.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
|
|
|
|
- daily.setFollow(metrics.getInteger("follow"));
|
|
|
|
- daily.setMessage(metrics.getInteger("message"));
|
|
|
|
- daily.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
|
|
|
|
- daily.setPlayDuration(metrics.getInteger("play_duration"));
|
|
|
|
- daily.setForm(metrics.getInteger("form"));
|
|
|
|
- daily.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
|
|
|
|
- daily.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
|
|
|
|
- daily.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
|
|
|
|
- daily.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
|
|
|
|
- daily.setCommentMaterial(metrics.getInteger("comment"));
|
|
|
|
- daily.setInAppUv(metrics.getInteger("in_app_uv"));
|
|
|
|
- daily.setRegister(metrics.getInteger("register"));
|
|
|
|
- daily.setConvertCost(metrics.getBigDecimal("convert_cost"));
|
|
|
|
-
|
|
|
|
- bytedanceReportMaterialDailyList.add(daily);
|
|
|
|
- }
|
|
|
|
|
|
+ List<BytedanceReportMaterialDaily> bytedanceReportMaterialDailyList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < jsonArrayay.size(); i++) {
|
|
|
|
+ BytedanceReportMaterialDaily daily = new BytedanceReportMaterialDaily();
|
|
|
|
+ daily.setAccountId(accountId);
|
|
|
|
+ JSONObject detailJson = jsonArrayay.getJSONObject(i);
|
|
|
|
+ if (!Check.isNull(detailJson)) {
|
|
|
|
+ JSONObject dimensions = detailJson.getJSONObject("dimensions");
|
|
|
|
+ daily.setImageMode(dimensions.getString("image_mode"));
|
|
|
|
+ daily.setMaterialId(dimensions.getLong("material_id"));
|
|
|
|
+ daily.setInventory(dimensions.getString("inventory"));
|
|
|
|
+ daily.setStatDatetime(dimensions.getDate("stat_datetime") == null ? null : DateUtils.formatDate(dimensions.getDate("stat_datetime"), "yyyy-MM-dd"));
|
|
|
|
+
|
|
|
|
+ JSONObject metrics = detailJson.getJSONObject("metrics");
|
|
|
|
+ daily.setActivePayAmount(metrics.getInteger("active_pay_amount"));
|
|
|
|
+ daily.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
|
|
|
|
+ daily.setPlay75FeedBreak(metrics.getInteger("play_75_feed_break"));
|
|
|
|
+ daily.setNextDayOpen(metrics.getInteger("next_day_open"));
|
|
|
|
+ daily.setAdvancedCreativeCouponAddition(metrics.getInteger("advanced_creative_coupon_addition"));
|
|
|
|
+ daily.setConvertMaterial(metrics.getInteger("convert"));
|
|
|
|
+ daily.setActivePayCost(metrics.getBigDecimal("active_pay_cost"));
|
|
|
|
+ daily.setInAppCart(metrics.getInteger("in_app_cart"));
|
|
|
|
+ daily.setPlay25FeedBreak(metrics.getInteger("play_25_feed_break"));
|
|
|
|
+ daily.setConsultEffective(metrics.getInteger("consult_effective"));
|
|
|
|
+ daily.setViewMaterial(metrics.getInteger("view"));
|
|
|
|
+ daily.setDownload(metrics.getInteger("download"));
|
|
|
|
+ daily.setCpa(metrics.getBigDecimal("cpa"));
|
|
|
|
+ daily.setCpc(metrics.getBigDecimal("cpc"));
|
|
|
|
+ daily.setLocationClick(metrics.getInteger("location_click"));
|
|
|
|
+ daily.setPhoneConfirm(metrics.getInteger("phone_confirm"));
|
|
|
|
+ daily.setIesMusicClick(metrics.getInteger("ies_music_click"));
|
|
|
|
+ daily.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
|
|
|
|
+ daily.setWifiPlay(metrics.getInteger("wifi_play"));
|
|
|
|
+ daily.setShopping(metrics.getInteger("shopping"));
|
|
|
|
+ daily.setQq(metrics.getInteger("qq"));
|
|
|
|
+ daily.setCtr(metrics.getBigDecimal("ctr"));
|
|
|
|
+ daily.setCpm(metrics.getBigDecimal("cpm"));
|
|
|
|
+ daily.setWifiPlayRate(metrics.getBigDecimal("wifi_play_rate"));
|
|
|
|
+ daily.setLikeMaterial(metrics.getInteger("like"));
|
|
|
|
+ daily.setPlay50FeedBreak(metrics.getInteger("play_50_feed_break"));
|
|
|
|
+ daily.setActivePayRate(metrics.getBigDecimal("active_pay_rate"));
|
|
|
|
+ daily.setActiveCost(metrics.getBigDecimal("active_cost"));
|
|
|
|
+ daily.setActive(metrics.getInteger("active"));
|
|
|
|
+ daily.setGameAddictionCost(metrics.getBigDecimal("game_addiction_cost"));
|
|
|
|
+ daily.setGameAddiction(metrics.getInteger("game_addiction"));
|
|
|
|
+ daily.setActiveRate(metrics.getBigDecimal("active_rate"));
|
|
|
|
+ daily.setClick(metrics.getInteger("click"));
|
|
|
|
+ daily.setPlayDuration_10s(metrics.getInteger("play_duration_10s"));
|
|
|
|
+ daily.setAdvancedCreativePhoneClick(metrics.getInteger("advanced_creative_phone_click"));
|
|
|
|
+ daily.setDownloadStart(metrics.getInteger("download_start"));
|
|
|
|
+ daily.setHomeVisited(metrics.getInteger("home_visited"));
|
|
|
|
+ daily.setPhone(metrics.getInteger("phone"));
|
|
|
|
+ daily.setPhoneEffective(metrics.getInteger("phone_effective"));
|
|
|
|
+ daily.setInAppPay(metrics.getInteger("in_app_pay"));
|
|
|
|
+ daily.setGameAddictionRate(metrics.getBigDecimal("game_addiction_rate"));
|
|
|
|
+ daily.setNextDayOpenCost(metrics.getBigDecimal("next_day_open_cost"));
|
|
|
|
+ daily.setIesChallengeClick(metrics.getInteger("ies_challenge_click"));
|
|
|
|
+ daily.setTotalPlay(metrics.getInteger("total_play"));
|
|
|
|
+ daily.setActiveRegisterRate(metrics.getBigDecimal("active_register_rate"));
|
|
|
|
+ daily.setAverageVideoPlay(metrics.getBigDecimal("average_video_play"));
|
|
|
|
+ daily.setDownloadFinishCost(metrics.getBigDecimal("download_finish_cost"));
|
|
|
|
+ daily.setPlayDuration_3s(metrics.getInteger("play_duration_3s"));
|
|
|
|
+ daily.setActiveRegisterCost(metrics.getBigDecimal("active_register_cost"));
|
|
|
|
+ daily.setShowMaterial(metrics.getInteger("show"));
|
|
|
|
+ daily.setNextDayOpenRate(metrics.getBigDecimal("next_day_open_rate"));
|
|
|
|
+ daily.setMapSearch(metrics.getInteger("map_search"));
|
|
|
|
+ daily.setButton(metrics.getInteger("button"));
|
|
|
|
+ daily.setPlayDurationSum(metrics.getInteger("play_duration_sum"));
|
|
|
|
+ daily.setPlay100FeedBreak(metrics.getInteger("play_100_feed_break"));
|
|
|
|
+ daily.setAdvancedCreativeCounselClick(metrics.getInteger("advanced_creative_counsel_click"));
|
|
|
|
+ daily.setConvertRate(metrics.getBigDecimal("convert_rate"));
|
|
|
|
+ daily.setDownloadFinishRate(metrics.getBigDecimal("download_finish_rate"));
|
|
|
|
+ daily.setConsult(metrics.getInteger("consult"));
|
|
|
|
+ daily.setShareMaterial(metrics.getInteger("share"));
|
|
|
|
+ daily.setVote(metrics.getInteger("vote"));
|
|
|
|
+ daily.setValidPlay(metrics.getInteger("valid_play"));
|
|
|
|
+ daily.setInstallFinishRate(metrics.getBigDecimal("install_finish_rate"));
|
|
|
|
+ daily.setRedirect(metrics.getInteger("redirect"));
|
|
|
|
+ daily.setPayCount(metrics.getInteger("pay_count"));
|
|
|
|
+ daily.setAdvancedCreativeFormClick(metrics.getInteger("advanced_creative_form_click"));
|
|
|
|
+ daily.setCost(metrics.getBigDecimal("cost"));
|
|
|
|
+ daily.setPhoneConnect(metrics.getInteger("phone_connect"));
|
|
|
|
+ daily.setCoupon(metrics.getInteger("coupon"));
|
|
|
|
+ daily.setDownloadStartRate(metrics.getBigDecimal("download_start_rate"));
|
|
|
|
+ daily.setDownloadFinish(metrics.getInteger("download_finish"));
|
|
|
|
+ daily.setWechat(metrics.getInteger("wechat"));
|
|
|
|
+ daily.setCouponSinglePage(metrics.getInteger("coupon_single_page"));
|
|
|
|
+ daily.setInstallFinish(metrics.getInteger("install_finish"));
|
|
|
|
+ daily.setLottery(metrics.getInteger("lottery"));
|
|
|
|
+ daily.setPlayOver(metrics.getInteger("play_over"));
|
|
|
|
+ daily.setInAppOrder(metrics.getInteger("in_app_order"));
|
|
|
|
+ daily.setDownloadStartCost(metrics.getBigDecimal("download_start_cost"));
|
|
|
|
+ daily.setFollow(metrics.getInteger("follow"));
|
|
|
|
+ daily.setMessage(metrics.getInteger("message"));
|
|
|
|
+ daily.setInAppDetailUv(metrics.getInteger("in_app_detail_uv"));
|
|
|
|
+ daily.setPlayDuration(metrics.getInteger("play_duration"));
|
|
|
|
+ daily.setForm(metrics.getInteger("form"));
|
|
|
|
+ daily.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
|
|
|
|
+ daily.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
|
|
|
|
+ daily.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
|
|
|
|
+ daily.setInstallFinishCost(metrics.getBigDecimal("install_finish_cost"));
|
|
|
|
+ daily.setCommentMaterial(metrics.getInteger("comment"));
|
|
|
|
+ daily.setInAppUv(metrics.getInteger("in_app_uv"));
|
|
|
|
+ daily.setRegister(metrics.getInteger("register"));
|
|
|
|
+ daily.setConvertCost(metrics.getBigDecimal("convert_cost"));
|
|
|
|
+
|
|
|
|
+ bytedanceReportMaterialDailyList.add(daily);
|
|
}
|
|
}
|
|
- //Long insertStartTime = System.currentTimeMillis();
|
|
|
|
- bytedanceReportMaterialDailyMapper.replaceIntoBatch(bytedanceReportMaterialDailyList);
|
|
|
|
- //Long insertEndTime = System.currentTimeMillis();
|
|
|
|
- //log.info("头条获取素材报表插入数据结束,执行耗时:{}秒", (insertEndTime - insertStartTime) / 1000);
|
|
|
|
- if(currentPage >= totalPage){
|
|
|
|
- //log.info("accountId:" + accountId + "数据同步完成,开始时间:" + startDate + ",结束时间:"+ endDate);
|
|
|
|
- return 1;
|
|
|
|
- }else{
|
|
|
|
- int pageCode = bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
|
|
|
|
- return pageCode;
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- //returnCode = -1;
|
|
|
|
- log.error("服务器返回为空,json:" + JSONObject.toJSONString(data));
|
|
|
|
- return -1;
|
|
|
|
}
|
|
}
|
|
|
|
+ //Long insertStartTime = System.currentTimeMillis();
|
|
|
|
+ bytedanceReportMaterialDailyMapper.replaceIntoBatch(bytedanceReportMaterialDailyList);
|
|
|
|
+ //Long insertEndTime = System.currentTimeMillis();
|
|
|
|
+ //log.info("头条获取素材报表插入数据结束,执行耗时:{}秒", (insertEndTime - insertStartTime) / 1000);
|
|
|
|
+ if (currentPage >= totalPage) {
|
|
|
|
+ //log.info("accountId:" + accountId + "数据同步完成,开始时间:" + startDate + ",结束时间:"+ endDate);
|
|
|
|
+ return 1;
|
|
|
|
+ } else {
|
|
|
|
+ int pageCode = bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);
|
|
|
|
+ return pageCode;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //returnCode = -1;
|
|
|
|
+ log.error("服务器返回为空,json:" + JSONObject.toJSONString(data));
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.error("头条报表其他错误,accountId:" + accountId + ",json:" + JSONObject.toJSONString(data));
|
|
log.error("头条报表其他错误,accountId:" + accountId + ",json:" + JSONObject.toJSONString(data));
|
|
@@ -1103,7 +934,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<BytedanceReportMaterialRetry> getRetryList(){
|
|
|
|
|
|
+ public List<BytedanceReportMaterialRetry> getRetryList() {
|
|
return bytedanceReportMaterialDailyMapper.getRetryList();
|
|
return bytedanceReportMaterialDailyMapper.getRetryList();
|
|
}
|
|
}
|
|
|
|
|