|
@@ -147,6 +147,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
var kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
|
|
var kuaishouReportHourlyAccount = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyAccount.class);
|
|
kuaishouReportHourlyAccount.setAccountId(token.getAccountId());
|
|
kuaishouReportHourlyAccount.setAccountId(token.getAccountId());
|
|
kuaishouReportHourlyAccount.setId("" + token.getAccountId() + kuaishouReportHourlyAccount.getStatDate() + kuaishouReportHourlyAccount.getStatHour());
|
|
kuaishouReportHourlyAccount.setId("" + token.getAccountId() + kuaishouReportHourlyAccount.getStatDate() + kuaishouReportHourlyAccount.getStatHour());
|
|
|
|
+ kuaishouReportHourlyAccount.setCreateTime(new Date());
|
|
|
|
+ kuaishouReportHourlyAccount.setUpdateTime(new Date());
|
|
hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
|
|
hourlyAccountService.saveOrUpdate(kuaishouReportHourlyAccount);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -232,13 +234,17 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
|
|
log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ List<KuaiShouVideoGet> videoGets = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
var detailJson = details.getJSONObject(i);
|
|
var detailJson = details.getJSONObject(i);
|
|
var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
|
|
kuaiShouVideoGet.setAccountId(token.getAccountId());
|
|
kuaiShouVideoGet.setAccountId(token.getAccountId());
|
|
kuaiShouVideoGet.setId("" + token.getAccountId() + kuaiShouVideoGet.getPhotoId());
|
|
kuaiShouVideoGet.setId("" + token.getAccountId() + kuaiShouVideoGet.getPhotoId());
|
|
- kuaiShouVideoGetService.saveOrUpdate(kuaiShouVideoGet);
|
|
|
|
|
|
+ kuaiShouVideoGet.setCreateTime(new Date());
|
|
|
|
+ kuaiShouVideoGet.setUpdateTime(new Date());
|
|
|
|
+ videoGets.add(kuaiShouVideoGet);
|
|
}
|
|
}
|
|
|
|
+ kuaiShouVideoGetService.replaceBatch(videoGets);
|
|
getVideoListByPage(token, page + 1);
|
|
getVideoListByPage(token, page + 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -442,6 +448,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
log.info("快手广告计划时报表信息为空=》accountId:{}", token.getAccountId());
|
|
log.info("快手广告计划时报表信息为空=》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ List<KuaishouReportHourlyCampaign> campaigns = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
var show = detailJson.getLong("show");
|
|
var show = detailJson.getLong("show");
|
|
@@ -451,8 +458,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
var hourlyCampaign = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyCampaign.class);
|
|
var hourlyCampaign = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyCampaign.class);
|
|
hourlyCampaign.setAccountId(token.getAccountId());
|
|
hourlyCampaign.setAccountId(token.getAccountId());
|
|
hourlyCampaign.setId("" + hourlyCampaign.getAccountId() + hourlyCampaign.getCampaignId() + hourlyCampaign.getStatDate() + hourlyCampaign.getStatHour());
|
|
hourlyCampaign.setId("" + hourlyCampaign.getAccountId() + hourlyCampaign.getCampaignId() + hourlyCampaign.getStatDate() + hourlyCampaign.getStatHour());
|
|
- hourlyCampaignService.saveOrUpdate(hourlyCampaign);
|
|
|
|
|
|
+ hourlyCampaign.setCreateTime(new Date());
|
|
|
|
+ hourlyCampaign.setUpdateTime(new Date());
|
|
|
|
+ campaigns.add(hourlyCampaign);
|
|
}
|
|
}
|
|
|
|
+ hourlyCampaignService.replaceBatch(campaigns);
|
|
getAdvertiserReportHourlyByPage(token, startDate, endDate, page + 1);
|
|
getAdvertiserReportHourlyByPage(token, startDate, endDate, page + 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -610,6 +620,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
log.info("快手广告组时报表信息为空=》accountId:{}", token.getAccountId());
|
|
log.info("快手广告组时报表信息为空=》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ List<KuaishouReportHourlyGroup> groups = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
var show = detailJson.getLong("show");
|
|
var show = detailJson.getLong("show");
|
|
@@ -619,8 +630,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
var hourlyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyGroup.class);
|
|
var hourlyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyGroup.class);
|
|
hourlyGroup.setAccountId(token.getAccountId());
|
|
hourlyGroup.setAccountId(token.getAccountId());
|
|
hourlyGroup.setId("" + hourlyGroup.getAccountId() + hourlyGroup.getUnitId() + hourlyGroup.getStatDate() + hourlyGroup.getStatHour());
|
|
hourlyGroup.setId("" + hourlyGroup.getAccountId() + hourlyGroup.getUnitId() + hourlyGroup.getStatDate() + hourlyGroup.getStatHour());
|
|
- hourlyGroupService.saveOrUpdate(hourlyGroup);
|
|
|
|
|
|
+ hourlyGroup.setCreateTime(new Date());
|
|
|
|
+ hourlyGroup.setUpdateTime(new Date());
|
|
|
|
+ groups.add(hourlyGroup);
|
|
|
|
+// hourlyGroupService.saveOrUpdate(hourlyGroup);
|
|
}
|
|
}
|
|
|
|
+ hourlyGroupService.replaceBatch(groups);
|
|
|
|
+
|
|
|
|
+
|
|
getGroupHourlyReportByPage(token, startDate, endDate, page + 1);
|
|
getGroupHourlyReportByPage(token, startDate, endDate, page + 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -795,6 +812,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
log.info("快手广告创意时报表信息为空=》accountId:{}", token.getAccountId());
|
|
log.info("快手广告创意时报表信息为空=》accountId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ List<KuaishouReportHourlyCreative> creatives = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
JSONObject detailJson = details.getJSONObject(i);
|
|
var show = detailJson.getLong("show");
|
|
var show = detailJson.getLong("show");
|
|
@@ -804,10 +822,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
var creative = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyCreative.class);
|
|
var creative = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyCreative.class);
|
|
creative.setAccountId(token.getAccountId());
|
|
creative.setAccountId(token.getAccountId());
|
|
creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate() + creative.getStatHour());
|
|
creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate() + creative.getStatHour());
|
|
-// KuaishouReportHourlyCreativeStatistic statistic = setHourlyStatistic(creative, token);
|
|
|
|
-// hourlyCreativeStatisticService.saveOrUpdate(statistic);
|
|
|
|
- hourlyCreativeService.saveOrUpdate(creative);
|
|
|
|
|
|
+ creative.setCreateTime(new Date());
|
|
|
|
+ creative.setUpdateTime(new Date());
|
|
|
|
+ creatives.add(creative);
|
|
}
|
|
}
|
|
|
|
+ hourlyCreativeService.replaceBatch(creatives);
|
|
getAdvertiserCreativeReportHourlyByPage(token, startDate, endDate, page + 1);
|
|
getAdvertiserCreativeReportHourlyByPage(token, startDate, endDate, page + 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1080,7 +1099,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONObject dataJson = resultJson.getJSONObject("data");
|
|
JSONArray details = dataJson.getJSONArray("details");
|
|
JSONArray details = dataJson.getJSONArray("details");
|
|
if (Check.isNull(details)) {
|
|
if (Check.isNull(details)) {
|
|
- log.info("获取广告计划信息返回结果为空,advertiserId:{}", accountId);
|
|
|
|
|
|
+// log.info("获取广告计划信息返回结果为空,advertiserId:{}", accountId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
addCampaign(accountId, details);
|
|
addCampaign(accountId, details);
|
|
@@ -1166,6 +1185,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
|
|
|
|
private void addCampaign(Long advertiserId, JSONArray details) {
|
|
private void addCampaign(Long advertiserId, JSONArray details) {
|
|
|
|
+ List<KuaiShouCampaign> campaigns = 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)) {
|
|
@@ -1176,9 +1196,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
campaign.setCampaignName(detail.getString("campaign_name"));
|
|
campaign.setCampaignName(detail.getString("campaign_name"));
|
|
campaign.setDayBudget(detail.getLong("day_budget"));
|
|
campaign.setDayBudget(detail.getLong("day_budget"));
|
|
campaign.setStatus(detail.getInteger("status"));
|
|
campaign.setStatus(detail.getInteger("status"));
|
|
- kuaiShouCampaignService.saveOrUpdate(campaign);
|
|
|
|
|
|
+ campaigns.add(campaign);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ kuaiShouCampaignService.replaceBatch(campaigns);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1239,6 +1260,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
executorService.shutdown();
|
|
executorService.shutdown();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void updateCreativeReportHourlyStatistic(CtopOauthToken token, Date getDate) {
|
|
|
|
+ hourlyCreativeStatisticService.updateCreativeReportHourlyStatistic(token, getDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
private void getGroupListByPage(CtopOauthToken token, int page) {
|
|
private void getGroupListByPage(CtopOauthToken token, int page) {
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
|
|
String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
|
|
JSONObject param = new JSONObject();
|
|
JSONObject param = new JSONObject();
|
|
@@ -1262,7 +1288,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
if (Check.isNull(details)) {
|
|
if (Check.isNull(details)) {
|
|
- log.info("获取广告组返回结果为空,advertiserId:{}", token.getAccountId());
|
|
|
|
|
|
+// log.info("获取广告组返回结果为空,advertiserId:{}", token.getAccountId());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
addGroup(token.getAccountId(), details);
|
|
addGroup(token.getAccountId(), details);
|
|
@@ -1367,6 +1393,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
|
|
|
|
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<KuaiShouAppInfo> appInfos = new ArrayList<>();
|
|
|
|
+ List<KuaiShouSchedule> shouSchedules = 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)) {
|
|
@@ -1393,7 +1422,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
group.setUrlType(detail.getInteger("url_type"));
|
|
group.setUrlType(detail.getInteger("url_type"));
|
|
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"));
|
|
- kuaiShouGroupService.saveOrUpdate(group);
|
|
|
|
|
|
+ group.setCreateTime(new Date());
|
|
|
|
+ group.setUpdateTime(new Date());
|
|
|
|
+ groups.add(group);
|
|
// 添加应用信息
|
|
// 添加应用信息
|
|
JSONObject diverseJson = detail.getJSONObject("diverse_data");
|
|
JSONObject diverseJson = detail.getJSONObject("diverse_data");
|
|
if (!Check.isNull(diverseJson)) {
|
|
if (!Check.isNull(diverseJson)) {
|
|
@@ -1403,7 +1434,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
appInfo.setAppPackageName(diverseJson.getString("app_package_name"));
|
|
appInfo.setAppPackageName(diverseJson.getString("app_package_name"));
|
|
appInfo.setDeviceOsType(diverseJson.getInteger("device_os_type"));
|
|
appInfo.setDeviceOsType(diverseJson.getInteger("device_os_type"));
|
|
appInfo.setUnitId(unitId);
|
|
appInfo.setUnitId(unitId);
|
|
- appInfoMapper.insert(appInfo);
|
|
|
|
|
|
+ appInfo.setCreateTime(new Date());
|
|
|
|
+ appInfo.setUpdateTime(new Date());
|
|
|
|
+ appInfos.add(appInfo);
|
|
}
|
|
}
|
|
//时间段信息
|
|
//时间段信息
|
|
JSONObject scheduleJson = detail.getJSONObject("schedule");
|
|
JSONObject scheduleJson = detail.getJSONObject("schedule");
|
|
@@ -1418,10 +1451,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
schedule.setFri(scheduleJson.getJSONArray("fri").toJSONString());
|
|
schedule.setFri(scheduleJson.getJSONArray("fri").toJSONString());
|
|
schedule.setSat(scheduleJson.getJSONArray("sat").toJSONString());
|
|
schedule.setSat(scheduleJson.getJSONArray("sat").toJSONString());
|
|
schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
|
|
schedule.setSun(scheduleJson.getJSONArray("sun").toJSONString());
|
|
- shouScheduleMapper.insert(schedule);
|
|
|
|
|
|
+ schedule.setCreateTime(new Date());
|
|
|
|
+ schedule.setUpdateTime(new Date());
|
|
|
|
+ shouSchedules.add(schedule);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(groups)) {
|
|
|
|
+ groupMapper.replaceBatch(groups);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(shouSchedules)) {
|
|
|
|
+ shouScheduleMapper.replaceBatch(shouSchedules);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(appInfos)) {
|
|
|
|
+ appInfoMapper.replaceBatch(appInfos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1455,9 +1498,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
}
|
|
}
|
|
JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
|
|
if (null == details || details.size() <= 0) {
|
|
if (null == details || details.size() <= 0) {
|
|
- log.error("获取广告创意返回结果数据为空,advertiserId:{}", advertiserId);
|
|
|
|
|
|
+// log.error("获取广告创意返回结果数据为空,advertiserId:{}", advertiserId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ List<KuaiShouCreative> creatives = new ArrayList<>();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
|
|
JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
|
|
if (!Check.isNull(detailJson)) {
|
|
if (!Check.isNull(detailJson)) {
|
|
@@ -1480,10 +1524,13 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
creative.setDescription(displayInfoJson.getString("description"));
|
|
creative.setDescription(displayInfoJson.getString("description"));
|
|
creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
|
|
creative.setActionBarText(displayInfoJson.getString("action_bar_text"));
|
|
}
|
|
}
|
|
- creativeService.saveOrUpdate(creative);
|
|
|
|
|
|
+ creative.setCreateTime(new Date());
|
|
|
|
+ creative.setUpdateTime(new Date());
|
|
|
|
+ creatives.add(creative);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- getCreativeList(accessToken, advertiserId, page + 1);
|
|
|
|
|
|
+ creativeService.replaceBatch(creatives);
|
|
|
|
+ getCreativeListByPage(accessToken, advertiserId, page + 1);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1523,7 +1570,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
|
|
videoGet.setUrl(detailJson.getString("url"));
|
|
videoGet.setUrl(detailJson.getString("url"));
|
|
videoGet.setCoverUrl(detailJson.getString("creative_name"));
|
|
videoGet.setCoverUrl(detailJson.getString("creative_name"));
|
|
videoGet.setPhotoId(detailJson.getString("photo_id"));
|
|
videoGet.setPhotoId(detailJson.getString("photo_id"));
|
|
- //videoGet.setSignature(UUID.randomUUID().toString());
|
|
|
|
kuaiShouVideoGetService.saveOrUpdate(videoGet);
|
|
kuaiShouVideoGetService.saveOrUpdate(videoGet);
|
|
}
|
|
}
|
|
}
|
|
}
|