|
@@ -2771,7 +2771,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void getPopulationList(Long accountId, String accessToken) {
|
|
|
|
|
|
+ public void getPopulationList(Long accountId, String accessToken, Integer page) {
|
|
try {
|
|
try {
|
|
log.info("获取人群包列表,accountId:{}", accountId);
|
|
log.info("获取人群包列表,accountId:{}", accountId);
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.POPULATION_LIST;
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.POPULATION_LIST;
|
|
@@ -2781,7 +2781,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
JSONObject requestJson = new JSONObject();
|
|
JSONObject requestJson = new JSONObject();
|
|
requestJson.put("advertiser_id", accountId);
|
|
requestJson.put("advertiser_id", accountId);
|
|
requestJson.put("status", 4);
|
|
requestJson.put("status", 4);
|
|
- requestJson.put("page", 1);
|
|
|
|
|
|
+ requestJson.put("page", page);
|
|
requestJson.put("page_size", 500);
|
|
requestJson.put("page_size", 500);
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
|
|
String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
@@ -2789,37 +2789,37 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
Integer code = resultJson.getInteger("code");
|
|
Integer code = resultJson.getInteger("code");
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
JSONObject dataDetailJson = resultJson.getJSONObject("data");
|
|
JSONObject dataDetailJson = resultJson.getJSONObject("data");
|
|
- if (!Check.isNull(dataDetailJson)) {
|
|
|
|
- Map<String, Object> deleteMap = new HashMap<>();
|
|
|
|
|
|
+ if (Check.isNull(dataDetailJson)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ JSONArray details = dataDetailJson.getJSONArray("details");
|
|
|
|
+ if (Check.isNull(details)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- JSONArray details = dataDetailJson.getJSONArray("details");
|
|
|
|
- if (Check.isNull(details)) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- deleteMap.put("account_id", accountId);
|
|
|
|
- populationService.removeByMap(deleteMap);
|
|
|
|
- for (int i = 0; i < details.size(); i++) {
|
|
|
|
- JSONObject dataJson = details.getJSONObject(i);
|
|
|
|
- if (!Check.isNull(dataJson)) {
|
|
|
|
- KuaishouPopulation population = new KuaishouPopulation();
|
|
|
|
- population.setOrientationId(dataJson.getLong("orientation_id"));
|
|
|
|
- population.setOrientationName(dataJson.getString("orientation_name"));
|
|
|
|
- population.setType(dataJson.getInteger("type"));
|
|
|
|
- population.setPopulationType(dataJson.getInteger("population_type"));
|
|
|
|
- population.setRecordSize(dataJson.getLong("record_size"));
|
|
|
|
- population.setMatchSize(dataJson.getLong("match_size"));
|
|
|
|
- population.setCoverNum(dataJson.getLong("cover_num"));
|
|
|
|
- population.setStatus(dataJson.getInteger("status"));
|
|
|
|
- population.setPutTime(dataJson.getDate("create_time"));
|
|
|
|
- population.setThirdPlatformCode(dataJson.getLong("third_platform_code"));
|
|
|
|
- population.setAccountId(accountId);
|
|
|
|
- populationService.save(population);
|
|
|
|
|
|
+ List<KuaishouPopulation> addList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
|
+ JSONObject dataJson = details.getJSONObject(i);
|
|
|
|
+ if (!Check.isNull(dataJson)) {
|
|
|
|
+ KuaishouPopulation population = new KuaishouPopulation();
|
|
|
|
+ population.setOrientationId(dataJson.getLong("orientation_id"));
|
|
|
|
+ population.setOrientationName(dataJson.getString("orientation_name"));
|
|
|
|
+ population.setType(dataJson.getInteger("type"));
|
|
|
|
+ population.setPopulationType(dataJson.getInteger("population_type"));
|
|
|
|
+ population.setRecordSize(dataJson.getLong("record_size"));
|
|
|
|
+ population.setMatchSize(dataJson.getLong("match_size"));
|
|
|
|
+ population.setCoverNum(dataJson.getLong("cover_num"));
|
|
|
|
+ population.setStatus(dataJson.getInteger("status"));
|
|
|
|
+ population.setPutTime(dataJson.getDate("create_time"));
|
|
|
|
+ population.setThirdPlatformCode(dataJson.getLong("third_platform_code"));
|
|
|
|
+ population.setAccountId(accountId);
|
|
|
|
+ addList.add(population);
|
|
|
|
+ // populationService.save(population);
|
|
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ populationService.replaceBatch(addList);
|
|
|
|
+ getPopulationList(accountId, accessToken, page + 1);
|
|
} else {
|
|
} else {
|
|
log.error("获取人群包管理返回数据为空,accountId:{}", accountId);
|
|
log.error("获取人群包管理返回数据为空,accountId:{}", accountId);
|
|
|
|
|