|
@@ -1443,41 +1443,52 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private KuaiShouGroupTargetMapper groupTargetMapper;
|
|
|
|
+
|
|
private void addGroup(Long advertiserId, JSONArray details) {
|
|
private void addGroup(Long advertiserId, JSONArray details) {
|
|
if (!Check.isNull(details)) {
|
|
if (!Check.isNull(details)) {
|
|
List<KuaiShouGroup> groups = new ArrayList<>();
|
|
List<KuaiShouGroup> groups = new ArrayList<>();
|
|
List<KuaiShouAppInfo> appInfos = new ArrayList<>();
|
|
List<KuaiShouAppInfo> appInfos = new ArrayList<>();
|
|
- List<KuaiShouSchedule> shouSchedules = new ArrayList<>();
|
|
|
|
|
|
+ List<KuaiShouSchedule> schedules = new ArrayList<>();
|
|
|
|
+ List<KuaiShouGroupTarget> targets = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject detail = JSONObject.parseObject(details.get(i).toString());
|
|
JSONObject detail = JSONObject.parseObject(details.get(i).toString());
|
|
if (!Check.isNull(detail)) {
|
|
if (!Check.isNull(detail)) {
|
|
KuaiShouGroup group = new KuaiShouGroup();
|
|
KuaiShouGroup group = new KuaiShouGroup();
|
|
|
|
+ Long unitId = detail.getLong("unit_id");
|
|
|
|
+ group.setId("" + advertiserId + unitId);
|
|
group.setAccountId(advertiserId);
|
|
group.setAccountId(advertiserId);
|
|
- group.setStatus(detail.getInteger("status"));
|
|
|
|
- group.setBid(detail.getLong("bid"));
|
|
|
|
- group.setSpeed(detail.getInteger("speed"));
|
|
|
|
- group.setSchedule(detail.getString("schedule"));
|
|
|
|
- group.setUrl(detail.getString("url"));
|
|
|
|
group.setCampaignId(detail.getLong("campaign_id"));
|
|
group.setCampaignId(detail.getLong("campaign_id"));
|
|
- Long unitId = detail.getLong("unit_id");
|
|
|
|
group.setUnitId(unitId);
|
|
group.setUnitId(unitId);
|
|
- group.setId("" + advertiserId + unitId);
|
|
|
|
group.setUnitName(detail.getString("unit_name"));
|
|
group.setUnitName(detail.getString("unit_name"));
|
|
- group.setBidType(detail.getInteger("bid_type"));
|
|
|
|
|
|
+ group.setStatus(detail.getInteger("status"));
|
|
|
|
+ group.setPutStatus(detail.getInteger("put_status"));
|
|
|
|
+ group.setCreateChannel(detail.getInteger("create_channel"));
|
|
group.setReviewDetail(detail.getString("review_detail"));
|
|
group.setReviewDetail(detail.getString("review_detail"));
|
|
|
|
+ group.setBidType(detail.getInteger("bid_type"));
|
|
|
|
+ group.setBid(detail.getLong("bid"));
|
|
group.setCpaBid(detail.getLong("cpa_bid"));
|
|
group.setCpaBid(detail.getLong("cpa_bid"));
|
|
group.setOcpxActionType(detail.getInteger("ocpx_action_type"));
|
|
group.setOcpxActionType(detail.getInteger("ocpx_action_type"));
|
|
|
|
+ group.setDeepConversionType(detail.getInteger("deep_conversion_type"));
|
|
|
|
+ group.setDeepConversionBid(detail.getLong("deep_conversion_bid"));
|
|
group.setDayBudget(detail.getLong("day_budget"));
|
|
group.setDayBudget(detail.getLong("day_budget"));
|
|
|
|
+ group.setSpeed(detail.getInteger("speed"));
|
|
group.setBeginTime(detail.getString("begin_time"));
|
|
group.setBeginTime(detail.getString("begin_time"));
|
|
group.setEndTime(detail.getString("end_time"));
|
|
group.setEndTime(detail.getString("end_time"));
|
|
|
|
+ group.setScheduleTime(detail.getString("schedule_time"));
|
|
|
|
+ group.setSceneId(detail.getJSONArray("scene_id") + "");
|
|
group.setShowModel(detail.getInteger("show_mode"));
|
|
group.setShowModel(detail.getInteger("show_mode"));
|
|
|
|
+ group.setUnitType(detail.getInteger("unit_type"));
|
|
group.setUrlType(detail.getInteger("url_type"));
|
|
group.setUrlType(detail.getInteger("url_type"));
|
|
|
|
+ group.setUrl(detail.getString("url"));
|
|
group.setAppId(detail.getLong("app_id"));
|
|
group.setAppId(detail.getLong("app_id"));
|
|
group.setAppIconUrl(detail.getString("app_icon_url"));
|
|
group.setAppIconUrl(detail.getString("app_icon_url"));
|
|
group.setCreateTime(new Date());
|
|
group.setCreateTime(new Date());
|
|
group.setUpdateTime(new Date());
|
|
group.setUpdateTime(new Date());
|
|
groups.add(group);
|
|
groups.add(group);
|
|
// 添加应用信息
|
|
// 添加应用信息
|
|
|
|
+
|
|
JSONObject diverseJson = detail.getJSONObject("diverse_data");
|
|
JSONObject diverseJson = detail.getJSONObject("diverse_data");
|
|
if (!Check.isNull(diverseJson)) {
|
|
if (!Check.isNull(diverseJson)) {
|
|
KuaiShouAppInfo appInfo = new KuaiShouAppInfo();
|
|
KuaiShouAppInfo appInfo = new KuaiShouAppInfo();
|
|
@@ -1505,19 +1516,94 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
|
|
schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
|
|
schedule.setCreateTime(new Date());
|
|
schedule.setCreateTime(new Date());
|
|
schedule.setUpdateTime(new Date());
|
|
schedule.setUpdateTime(new Date());
|
|
- shouSchedules.add(schedule);
|
|
|
|
|
|
+ schedules.add(schedule);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONObject targetJson = detail.getJSONObject("target");
|
|
|
|
+ if (!Check.isNull(targetJson)) {
|
|
|
|
+ KuaiShouGroupTarget groupTarget = new KuaiShouGroupTarget();
|
|
|
|
+ groupTarget.setAccountId(advertiserId);
|
|
|
|
+ groupTarget.setUnitId(unitId);
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("region"))) {
|
|
|
|
+ groupTarget.setRegion(targetJson.getJSONArray("region").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONObject age = targetJson.getJSONObject("age");
|
|
|
|
+ if (!Check.isNull(age)) {
|
|
|
|
+ groupTarget.setAgeMin(age.getInteger("min"));
|
|
|
|
+ groupTarget.setAgeMax(age.getInteger("max"));
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("ages_range"))) {
|
|
|
|
+ groupTarget.setAgesRange(targetJson.getJSONArray("ages_range").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ groupTarget.setGender(targetJson.getInteger("gender"));
|
|
|
|
+ groupTarget.setPlatformOs(targetJson.getInteger("platform_os"));
|
|
|
|
+ groupTarget.setAndroidOsv(targetJson.getInteger("android_osv"));
|
|
|
|
+ groupTarget.setIosOsv(targetJson.getInteger("ios_osv"));
|
|
|
|
+ groupTarget.setNetwork(targetJson.getInteger("network"));
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("device_brand"))) {
|
|
|
|
+ groupTarget.setDeviceBrand(targetJson.getJSONArray("device_brand").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("device_price"))) {
|
|
|
|
+ groupTarget.setDevicePrice(targetJson.getJSONArray("device_price").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ groupTarget.setBusinessInterestType(targetJson.getInteger("business_interest_type"));
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("business_interest"))) {
|
|
|
|
+ groupTarget.setBusinessInterest(targetJson.getJSONArray("business_interest").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("fans_star"))) {
|
|
|
|
+ groupTarget.setFansStar(targetJson.getJSONArray("fans_star").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("interest_video"))) {
|
|
|
|
+ groupTarget.setInterestVideo(targetJson.getJSONArray("interest_video").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("app_interest"))) {
|
|
|
|
+ groupTarget.setAppInterest(targetJson.getJSONArray("app_interest").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("app_ids"))) {
|
|
|
|
+ groupTarget.setAppIds(targetJson.getJSONArray("app_ids").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("population"))) {
|
|
|
|
+ groupTarget.setPopulation(targetJson.getJSONArray("population").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(targetJson.getJSONArray("exclude_population"))) {
|
|
|
|
+ groupTarget.setExcludePopulation(targetJson.getJSONArray("exclude_population").toJSONString());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JSONObject intelliExtend = targetJson.getJSONObject("intelli_extend");
|
|
|
|
+ if (!Check.isNull(intelliExtend)) {
|
|
|
|
+ groupTarget.setIsOpen(intelliExtend.getInteger("is_open"));
|
|
|
|
+ groupTarget.setNoAgeBreak(intelliExtend.getInteger("no_age_break"));
|
|
|
|
+ groupTarget.setNoGenderBreak(intelliExtend.getInteger("no_gender_break"));
|
|
|
|
+ groupTarget.setNoAreaBreak(intelliExtend.getInteger("no_area_break"));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ targets.add(groupTarget);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!Check.isNull(groups)) {
|
|
if (!Check.isNull(groups)) {
|
|
groupMapper.replaceBatch(groups);
|
|
groupMapper.replaceBatch(groups);
|
|
}
|
|
}
|
|
- if (!Check.isNull(shouSchedules)) {
|
|
|
|
- shouScheduleMapper.replaceBatch(shouSchedules);
|
|
|
|
|
|
+ if (!Check.isNull(schedules)) {
|
|
|
|
+ shouScheduleMapper.replaceBatch(schedules);
|
|
}
|
|
}
|
|
if (!Check.isNull(appInfos)) {
|
|
if (!Check.isNull(appInfos)) {
|
|
appInfoMapper.replaceBatch(appInfos);
|
|
appInfoMapper.replaceBatch(appInfos);
|
|
}
|
|
}
|
|
|
|
+ if (!Check.isNull(targets)) {
|
|
|
|
+ groupTargetMapper.replaceBatch(targets);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2041,7 +2127,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId,resultJson);
|
|
|
|
|
|
+ log.info("获取视频信息完成,advertiserId:{},返回信息:{}", advertiserId, resultJson);
|
|
} else {
|
|
} else {
|
|
log.error("获取广告视频失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
|
|
log.error("获取广告视频失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);
|
|
}
|
|
}
|