|
@@ -29,6 +29,7 @@ import cn.com.ctop.job.bytedance.data.service.IBytedanceAgentReportHourlyService
|
|
|
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 cn.com.ctop.job.bytedance.data.utils.DateUtils;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
|
|
import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
|
|
|
|
|
+import cn.com.ctop.job.bytedance.data.utils.RateLimitUtil;
|
|
|
import cn.com.ctop.job.bytedance.utils.RedisUtil;
|
|
import cn.com.ctop.job.bytedance.utils.RedisUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -66,7 +67,8 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
private String bytedanceApiUrl;
|
|
private String bytedanceApiUrl;
|
|
|
|
|
|
|
|
private String urlPath = "http://192.168.0.85:8765/webhook/bytedance_account_report";
|
|
private String urlPath = "http://192.168.0.85:8765/webhook/bytedance_account_report";
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RateLimitUtil rateLimitUtil;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IBytedanceAgentReportDailyService agentDailyService;
|
|
private IBytedanceAgentReportDailyService agentDailyService;
|
|
@@ -534,7 +536,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
Integer code = getObject.getInteger("code");
|
|
Integer code = getObject.getInteger("code");
|
|
|
String message = getObject.getString("message");
|
|
String message = getObject.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
if (null == code || code != 0) {
|
|
|
- log.error("----头条广告主数据获取异常(分版位):\n入参:{} \n结果:{}", jsonObject, getObject.toJSONString());
|
|
|
|
|
|
|
+ log.error("----头条广告主数据获取异常(分版位): 结果:{}", getObject.toJSONString());
|
|
|
|
|
|
|
|
//请求过于频繁
|
|
//请求过于频繁
|
|
|
if (40100 == code) {
|
|
if (40100 == code) {
|
|
@@ -635,8 +637,14 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
groupBy.add("STAT_GROUP_BY_FIELD_STAT_TIME");
|
|
groupBy.add("STAT_GROUP_BY_FIELD_STAT_TIME");
|
|
|
groupBy.add("STAT_GROUP_BY_INVENTORY");
|
|
groupBy.add("STAT_GROUP_BY_INVENTORY");
|
|
|
conditions.put("group_by", groupBy);
|
|
conditions.put("group_by", groupBy);
|
|
|
-// System.out.println("入参:" + conditions);
|
|
|
|
|
- return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, conditions);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ if (rateLimitUtil.acquire("1635316529903624", url)) {
|
|
|
|
|
+ jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, conditions);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return jsonObject;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|