|
@@ -59,7 +59,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
@Override
|
|
@Override
|
|
|
public void getProjectList(Long advertiserId, String date) {
|
|
public void getProjectList(Long advertiserId, String date) {
|
|
|
this.getProjectListVo(advertiserId, null, date, 1, 1);
|
|
this.getProjectListVo(advertiserId, null, date, 1, 1);
|
|
|
- this.getProjectListVo(advertiserId, "del", date, 1, 1);
|
|
|
|
|
|
|
+// this.getProjectListVo(advertiserId, "del", date, 1, 1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void getProjectListVo(Long advertiserId, String type, String date, Integer page, int count) {
|
|
private void getProjectListVo(Long advertiserId, String type, String date, Integer page, int count) {
|
|
@@ -78,36 +78,37 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
filtering.put("status_first", "PROJECT_STATUS_DELETE");
|
|
filtering.put("status_first", "PROJECT_STATUS_DELETE");
|
|
|
}
|
|
}
|
|
|
filtering.put("project_modify_time", date);
|
|
filtering.put("project_modify_time", date);
|
|
|
-
|
|
|
|
|
params.put("filtering", filtering);
|
|
params.put("filtering", filtering);
|
|
|
params.put("page", page);
|
|
params.put("page", page);
|
|
|
params.put("page_size", 100);//最大100
|
|
params.put("page_size", 100);//最大100
|
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/project/list/";
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/project/list/";
|
|
|
String results = HttpUtils.httpGet(url, params, HttpUtils.postMHeaders(accessToken));
|
|
String results = HttpUtils.httpGet(url, params, HttpUtils.postMHeaders(accessToken));
|
|
|
JSONObject obj = JSONObject.parseObject(results);
|
|
JSONObject obj = JSONObject.parseObject(results);
|
|
|
- Integer code = obj.getInteger("code");
|
|
|
|
|
- if (code == 0) {
|
|
|
|
|
- log.info("---账户({})获取项目成功", advertiserId);
|
|
|
|
|
- JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
- Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
- if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
- nextPage = true;
|
|
|
|
|
- }
|
|
|
|
|
- List<BytedanceCdpProject> projectList = new ArrayList<>();
|
|
|
|
|
- JSONArray array = data.getJSONArray("list");
|
|
|
|
|
- for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
- BytedanceCdpProject advertiserToolsSite = new BytedanceCdpProject(array.getJSONObject(i));
|
|
|
|
|
- projectList.add(advertiserToolsSite);
|
|
|
|
|
- }
|
|
|
|
|
- if (!Check.isNull(projectList))
|
|
|
|
|
- bytedanceCdpProjectMapper.replaceBytedanceCdpProjectList(projectList);
|
|
|
|
|
- } else {
|
|
|
|
|
- //40100请求超频
|
|
|
|
|
- if (40100 == code && count <= 3) {
|
|
|
|
|
- Thread.sleep(500);
|
|
|
|
|
- getProjectListVo(advertiserId, type, date, page, count + 1);
|
|
|
|
|
|
|
+ if (!Check.isNull(obj)) {
|
|
|
|
|
+ Integer code = obj.getInteger("code");
|
|
|
|
|
+ if (code == 0) {
|
|
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
+ Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
+ if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
+ nextPage = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<BytedanceCdpProject> projectList = new ArrayList<>();
|
|
|
|
|
+ JSONArray array = data.getJSONArray("list");
|
|
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
|
|
+ BytedanceCdpProject advertiserToolsSite = new BytedanceCdpProject(array.getJSONObject(i));
|
|
|
|
|
+ projectList.add(advertiserToolsSite);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Check.isNull(projectList))
|
|
|
|
|
+ if (bytedanceCdpProjectMapper.replaceBytedanceCdpProjectList(projectList) > 0)
|
|
|
|
|
+ log.info("---账户({})项目信息更新成功", advertiserId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //40100请求超频
|
|
|
|
|
+ if (40100 == code && count <= 5) {
|
|
|
|
|
+ Thread.sleep(800);
|
|
|
|
|
+ getProjectListVo(advertiserId, type, date, page, count + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.error("获取项目列表失败(url:{}),入参:{}\n结果:{}", url, JSONObject.toJSONString(params), obj);
|
|
|
}
|
|
}
|
|
|
- log.error("获取项目列表失败(url:{}),入参:{}\n结果:{}", url, JSONObject.toJSONString(params), obj);
|
|
|
|
|
}
|
|
}
|
|
|
if (nextPage) {
|
|
if (nextPage) {
|
|
|
getProjectListVo(advertiserId, type, date, page + 1, 1);
|
|
getProjectListVo(advertiserId, type, date, page + 1, 1);
|
|
@@ -145,26 +146,27 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
//获取微信小程序列表
|
|
//获取微信小程序列表
|
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/tools/micro_app/list/";
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/tools/micro_app/list/";
|
|
|
JSONObject obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
|
|
JSONObject obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
|
|
|
- Integer code = obj.getInteger("code");
|
|
|
|
|
- if (code == 0) {
|
|
|
|
|
- log.info("---账户({})获取抖小信息成功", advertiserId);
|
|
|
|
|
- JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
- Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
- if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
- nextPage = true;
|
|
|
|
|
- }
|
|
|
|
|
- JSONArray list = data.getJSONArray("list");
|
|
|
|
|
- if (!Check.isNull(list)) {
|
|
|
|
|
- bytedanceCdpProjectMapper.replaceBytedanceByteAppInfo(list, advertiserId);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- //40110请求超频
|
|
|
|
|
- if (40110 == code && count <= 3) {
|
|
|
|
|
- Thread.sleep(500);
|
|
|
|
|
- getByteAppInfoVo(advertiserId, searchType, page, count + 1);
|
|
|
|
|
|
|
+ if (!Check.isNull(obj)) {
|
|
|
|
|
+ Integer code = obj.getInteger("code");
|
|
|
|
|
+ if (code == 0) {
|
|
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
+ Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
+ if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
+ nextPage = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONArray list = data.getJSONArray("list");
|
|
|
|
|
+ if (!Check.isNull(list))
|
|
|
|
|
+ if (bytedanceCdpProjectMapper.replaceBytedanceByteAppInfo(list, advertiserId) > 0)
|
|
|
|
|
+ log.info("---账户({})抖小信息更新成功", advertiserId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //40110请求超频
|
|
|
|
|
+ if (40110 == code && count <= 3) {
|
|
|
|
|
+ Thread.sleep(700);
|
|
|
|
|
+ getByteAppInfoVo(advertiserId, searchType, page, count + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.error("账户({})获取抖小列表失败,入参:{}\n结果:{}", advertiserId, JSONObject.toJSONString(params), obj);
|
|
|
|
|
+ bytedanceCdpProjectMapper.insertErrorAdvertiserId(advertiserId, "tt");
|
|
|
}
|
|
}
|
|
|
- log.error("账户({})获取抖小列表失败,入参:{}\n结果:{}", advertiserId, JSONObject.toJSONString(params), obj);
|
|
|
|
|
- bytedanceCdpProjectMapper.insertErrorAdvertiserId(advertiserId, "tt");
|
|
|
|
|
}
|
|
}
|
|
|
if (nextPage) {
|
|
if (nextPage) {
|
|
|
getByteAppInfoVo(advertiserId, searchType, page + 1, 1);
|
|
getByteAppInfoVo(advertiserId, searchType, page + 1, 1);
|
|
@@ -204,26 +206,27 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
//获取微信小程序列表
|
|
//获取微信小程序列表
|
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/tools/wechat_applet/list/";
|
|
String url = "https://api.oceanengine.com/open_api/v3.0/tools/wechat_applet/list/";
|
|
|
JSONObject obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
|
|
JSONObject obj = Okhttp3Utils.bytedanceGetRequest(accessToken, url, params);
|
|
|
- Integer code = obj.getInteger("code");
|
|
|
|
|
- if (code == 0) {
|
|
|
|
|
- log.info("---账户({})获取微小信息成功", advertiserId);
|
|
|
|
|
- JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
- Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
- if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
- nextPage = true;
|
|
|
|
|
- }
|
|
|
|
|
- JSONArray list = data.getJSONArray("list");
|
|
|
|
|
- if (!Check.isNull(list)) {
|
|
|
|
|
- bytedanceCdpProjectMapper.replaceBytedanceWxAppInfo(list, advertiserId);
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- //40110请求超频
|
|
|
|
|
- if (40110 == code && count <= 3) {
|
|
|
|
|
- Thread.sleep(500);
|
|
|
|
|
- getWxAppInfoVo(advertiserId, searchType, page, count + 1);
|
|
|
|
|
|
|
+ if (!Check.isNull(obj)) {
|
|
|
|
|
+ Integer code = obj.getInteger("code");
|
|
|
|
|
+ if (code == 0) {
|
|
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
|
|
+ Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
|
|
|
|
|
+ if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
|
|
|
|
|
+ nextPage = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONArray list = data.getJSONArray("list");
|
|
|
|
|
+ if (!Check.isNull(list))
|
|
|
|
|
+ if (bytedanceCdpProjectMapper.replaceBytedanceWxAppInfo(list, advertiserId) > 0)
|
|
|
|
|
+ log.info("---账户({})微小更新信息成功", advertiserId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //40110请求超频
|
|
|
|
|
+ if (40110 == code && count <= 3) {
|
|
|
|
|
+ Thread.sleep(600);
|
|
|
|
|
+ getWxAppInfoVo(advertiserId, searchType, page, count + 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.error("账户({})获取微小列表失败,入参:{}\n结果:{}", advertiserId, JSONObject.toJSONString(params), obj);
|
|
|
|
|
+ bytedanceCdpProjectMapper.insertErrorAdvertiserId(advertiserId, "wx");
|
|
|
}
|
|
}
|
|
|
- log.error("账户({})获取微小列表失败,入参:{}\n结果:{}", advertiserId, JSONObject.toJSONString(params), obj);
|
|
|
|
|
- bytedanceCdpProjectMapper.insertErrorAdvertiserId(advertiserId, "wx");
|
|
|
|
|
}
|
|
}
|
|
|
if (nextPage) {
|
|
if (nextPage) {
|
|
|
getWxAppInfoVo(advertiserId, searchType, page + 1, 1);
|
|
getWxAppInfoVo(advertiserId, searchType, page + 1, 1);
|
|
@@ -300,7 +303,6 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
JSONObject obj = JSONObject.parseObject(result);
|
|
JSONObject obj = JSONObject.parseObject(result);
|
|
|
if (!Check.isNull(obj)) {
|
|
if (!Check.isNull(obj)) {
|
|
|
if (0 == obj.getInteger("code")) {
|
|
if (0 == obj.getInteger("code")) {
|
|
|
- log.info("---账户({})获取动态创意成功", accountId);
|
|
|
|
|
JSONObject data = obj.getJSONObject("data");
|
|
JSONObject data = obj.getJSONObject("data");
|
|
|
if (!Check.isNull(data)) {
|
|
if (!Check.isNull(data)) {
|
|
|
JSONObject pageInfo = data.getJSONObject("page_info");
|
|
JSONObject pageInfo = data.getJSONObject("page_info");
|
|
@@ -313,12 +315,12 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
JSONObject object = array.getJSONObject(i);
|
|
JSONObject object = array.getJSONObject(i);
|
|
|
getAppId(object);
|
|
getAppId(object);
|
|
|
}
|
|
}
|
|
|
- if (!Check.isNull(array)) {
|
|
|
|
|
- bytedanceCdpProjectMapper.replaceAdqDynamicCreateives(array, accountId);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (!Check.isNull(array))
|
|
|
|
|
+ if (bytedanceCdpProjectMapper.replaceAdqDynamicCreateives(array, accountId) > 0)
|
|
|
|
|
+ log.info("---账户({})广点通创意更新成功", accountId);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (count <= 3) {
|
|
|
|
|
|
|
+ if (count <= 4) {
|
|
|
Thread.sleep(500);
|
|
Thread.sleep(500);
|
|
|
rebackadqCreativesVo(accountId, accessToken, date, page, isDeleted, count + 1);
|
|
rebackadqCreativesVo(accountId, accessToken, date, page, isDeleted, count + 1);
|
|
|
}
|
|
}
|
|
@@ -339,6 +341,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
if (!Check.isNull(value)) {
|
|
if (!Check.isNull(value)) {
|
|
|
JSONObject jumpInfo = value.getJSONObject("jump_info");
|
|
JSONObject jumpInfo = value.getJSONObject("jump_info");
|
|
|
if (!Check.isNull(jumpInfo)) {
|
|
if (!Check.isNull(jumpInfo)) {
|
|
|
|
|
+ object.put("page_type", jumpInfo.getString("page_type"));
|
|
|
JSONObject pageSpec = jumpInfo.getJSONObject("page_spec");
|
|
JSONObject pageSpec = jumpInfo.getJSONObject("page_spec");
|
|
|
if (!Check.isNull(pageSpec)) {
|
|
if (!Check.isNull(pageSpec)) {
|
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|
|
@@ -356,6 +359,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
if (!Check.isNull(jumpInfo)) {
|
|
if (!Check.isNull(jumpInfo)) {
|
|
|
JSONObject value = jumpInfo.getJSONObject(0).getJSONObject("value");
|
|
JSONObject value = jumpInfo.getJSONObject(0).getJSONObject("value");
|
|
|
if (!Check.isNull(value)) {
|
|
if (!Check.isNull(value)) {
|
|
|
|
|
+ object.put("page_type", value.getString("page_type"));
|
|
|
JSONObject pageSpec = value.getJSONObject("page_spec");
|
|
JSONObject pageSpec = value.getJSONObject("page_spec");
|
|
|
if (!Check.isNull(pageSpec)) {
|
|
if (!Check.isNull(pageSpec)) {
|
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|
|
@@ -372,6 +376,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
if (!Check.isNull(mainJumpInfo)) {
|
|
if (!Check.isNull(mainJumpInfo)) {
|
|
|
JSONObject value = mainJumpInfo.getJSONObject(0).getJSONObject("value");
|
|
JSONObject value = mainJumpInfo.getJSONObject(0).getJSONObject("value");
|
|
|
if (!Check.isNull(value)) {
|
|
if (!Check.isNull(value)) {
|
|
|
|
|
+ object.put("page_type", value.getString("page_type"));
|
|
|
JSONObject pageSpec = value.getJSONObject("page_spec");
|
|
JSONObject pageSpec = value.getJSONObject("page_spec");
|
|
|
if (!Check.isNull(pageSpec)) {
|
|
if (!Check.isNull(pageSpec)) {
|
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|
|
JSONObject wechatMiniProgramSpec = pageSpec.getJSONObject("wechat_mini_program_spec");
|