|
@@ -2,13 +2,17 @@ package cn.com.ctop.job.bytedance.data.service.impl;
|
|
|
|
|
|
|
|
import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
|
|
import cn.com.ctop.job.bytedance.data.entity.AdvertiserAccount;
|
|
|
import cn.com.ctop.job.bytedance.data.entity.ByteDanceFlowDetailsReportDaily;
|
|
import cn.com.ctop.job.bytedance.data.entity.ByteDanceFlowDetailsReportDaily;
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog;
|
|
|
import cn.com.ctop.job.bytedance.data.mapper.ByteDanceFlowDetailsReportMapper;
|
|
import cn.com.ctop.job.bytedance.data.mapper.ByteDanceFlowDetailsReportMapper;
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.mapper.BytedancePromoterReportMapper;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IByteDanceFlowDetailsReportService;
|
|
import cn.com.ctop.job.bytedance.data.service.IByteDanceFlowDetailsReportService;
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.utils.AlertUtils;
|
|
|
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.HttpUtils;
|
|
import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -32,6 +36,9 @@ public class ByteDanceFlowDetailsReportServiceImpl implements IByteDanceFlowDeta
|
|
|
@Resource
|
|
@Resource
|
|
|
private ByteDanceFlowDetailsReportMapper byteDanceFlowDetailsReportMapper;
|
|
private ByteDanceFlowDetailsReportMapper byteDanceFlowDetailsReportMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private BytedancePromoterReportMapper promoterReportMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public List<AdvertiserAccount> getAdAccount() {
|
|
public List<AdvertiserAccount> getAdAccount() {
|
|
|
return byteDanceFlowDetailsReportMapper.getAdAccount();
|
|
return byteDanceFlowDetailsReportMapper.getAdAccount();
|
|
@@ -116,6 +123,11 @@ public class ByteDanceFlowDetailsReportServiceImpl implements IByteDanceFlowDeta
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //增加错误日志保存
|
|
|
|
|
+ log.info("账户id:{},日期:{}流水日报请求结果失败,返回数据:{}", advertiserId, startDate, result);
|
|
|
|
|
+ insertErrorLog(advertiserId, startDate, endDate);
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (page < totalPage) {
|
|
if (page < totalPage) {
|
|
@@ -125,6 +137,20 @@ public class ByteDanceFlowDetailsReportServiceImpl implements IByteDanceFlowDeta
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, accountType, startDate, endDate, page + 1);
|
|
getBytedanceFlowDetailsDailyReport(advertiserId, accessToken, accountType, startDate, endDate, page + 1);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ log.info("账户ID:{},日期:{},流水日报详情数据日报请求成功", advertiserId, startDate);
|
|
|
|
|
+ //send message to feishu
|
|
|
|
|
+// AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "flow_details_daily", 1,null);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void insertErrorLog(Long advertiserId, String startDate, String endDate) {
|
|
|
|
|
+ BytedanceErrorLog errorInfo = new BytedanceErrorLog();
|
|
|
|
|
+ errorInfo.setAdvertiserId(advertiserId);
|
|
|
|
|
+ errorInfo.setStartDate(startDate);
|
|
|
|
|
+ errorInfo.setEndDate(endDate);
|
|
|
|
|
+ errorInfo.setDataDimension("flow_details");
|
|
|
|
|
+ errorInfo.setDataType("daily");
|
|
|
|
|
+ promoterReportMapper.replaceErrorInfo(errorInfo);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|