|
@@ -10,11 +10,13 @@ import cn.com.ctop.job.bytedance.data.service.IBytedanceMaterialReportDailyServi
|
|
|
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 com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
@@ -44,7 +46,8 @@ public class BytedanceMaterialReportDailyServiceImpl implements IBytedanceMateri
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private BytedanceNewMaterialReportMapper bytedanceNewMaterialReportMapper;
|
|
private BytedanceNewMaterialReportMapper bytedanceNewMaterialReportMapper;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RateLimitUtil rateLimitUtil;
|
|
|
private static final ObjectMapper mapper = new ObjectMapper();
|
|
private static final ObjectMapper mapper = new ObjectMapper();
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -155,8 +158,13 @@ public class BytedanceMaterialReportDailyServiceImpl implements IBytedanceMateri
|
|
|
ord.put("type", "ASC");
|
|
ord.put("type", "ASC");
|
|
|
orderBy.add(ord);
|
|
orderBy.add(ord);
|
|
|
param.put("order_by", mapper.writeValueAsString(orderBy));
|
|
param.put("order_by", mapper.writeValueAsString(orderBy));
|
|
|
- String result = HttpUtils.httpGet(url, param, header);
|
|
|
|
|
- JSONObject resultObject = JSONObject.parseObject(result);
|
|
|
|
|
|
|
+ String s = null;
|
|
|
|
|
+ if (rateLimitUtil.acquire("1635316529903624", url)) {
|
|
|
|
|
+ s = HttpUtils.httpGet(url, param, header);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject resultObject = JSONObject.parseObject(s);
|
|
|
Integer code = resultObject.getInteger("code");
|
|
Integer code = resultObject.getInteger("code");
|
|
|
if (null == code || !code.equals(0)) {
|
|
if (null == code || !code.equals(0)) {
|
|
|
log.error("获取体验版-视频-素材日报接口异常==》accountId:{},message:{}", oauthToken.getAccountId(), resultObject.getString("message"));
|
|
log.error("获取体验版-视频-素材日报接口异常==》accountId:{},message:{}", oauthToken.getAccountId(), resultObject.getString("message"));
|
|
@@ -232,7 +240,13 @@ public class BytedanceMaterialReportDailyServiceImpl implements IBytedanceMateri
|
|
|
filtering.put("image_material", image_material);
|
|
filtering.put("image_material", image_material);
|
|
|
|
|
|
|
|
param.put("filtering", filtering);
|
|
param.put("filtering", filtering);
|
|
|
- JSONObject resultObject = JSONObject.parseObject(HttpUtils.httpGet(url, param, header));
|
|
|
|
|
|
|
+ String s = null;
|
|
|
|
|
+ if (rateLimitUtil.acquire("1635316529903624", url)) {
|
|
|
|
|
+ s = HttpUtils.httpGet(url, param, header);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject resultObject = JSONObject.parseObject(s);
|
|
|
|
|
|
|
|
Integer code = resultObject.getInteger("code");
|
|
Integer code = resultObject.getInteger("code");
|
|
|
if (null == code || !code.equals(0)) {
|
|
if (null == code || !code.equals(0)) {
|