|
@@ -2,6 +2,7 @@ package cn.com.ctop.job.kuaishou.data.service.impl;
|
|
|
|
|
|
|
|
import cn.com.ctop.job.kuaishou.data.constant.KuaishouLinkConstants;
|
|
import cn.com.ctop.job.kuaishou.data.constant.KuaishouLinkConstants;
|
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaAdReportDetail;
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaAdReportDetail;
|
|
|
|
|
+import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaEpisodeInfo;
|
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaOrder;
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaOrder;
|
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaSalerCopyRightData;
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaSalerCopyRightData;
|
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaSeriesInfo;
|
|
import cn.com.ctop.job.kuaishou.data.entity.KuaiShouDramaSeriesInfo;
|
|
@@ -267,7 +268,7 @@ public class KuaiShouDramaServiceImpl implements IKuaiShouDramaService {
|
|
|
if (isLog != null && isLog == 1 && (null == code || code != 3)) {
|
|
if (isLog != null && isLog == 1 && (null == code || code != 3)) {
|
|
|
errorLogService.addError(advertiserId, startDate, endDate, "drama_saler_cr_data", "daily", new JSONObject().fluentPut("msg", message).fluentPut("seriesType", seriesType).toJSONString(), 2);
|
|
errorLogService.addError(advertiserId, startDate, endDate, "drama_saler_cr_data", "daily", new JSONObject().fluentPut("msg", message).fluentPut("seriesType", seriesType).toJSONString(), 2);
|
|
|
}
|
|
}
|
|
|
- if (code != null && code == 3 && errId != null){
|
|
|
|
|
|
|
+ if (code != null && code == 3 && errId != null) {
|
|
|
errorLogService.deleteInfoByErrorId(errId);
|
|
errorLogService.deleteInfoByErrorId(errId);
|
|
|
}
|
|
}
|
|
|
return;
|
|
return;
|
|
@@ -437,7 +438,7 @@ public class KuaiShouDramaServiceImpl implements IKuaiShouDramaService {
|
|
|
if (!Check.isNull(seriesIds)) {
|
|
if (!Check.isNull(seriesIds)) {
|
|
|
updateSeriesEpisodeNum(advertiserId, accessToken, seriesIds);
|
|
updateSeriesEpisodeNum(advertiserId, accessToken, seriesIds);
|
|
|
}
|
|
}
|
|
|
- log.error("批量获取快手短剧剧集信息完成 accountId:{}", advertiserId);
|
|
|
|
|
|
|
+ log.info("批量获取快手短剧剧集信息完成 accountId:{}", advertiserId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -456,31 +457,49 @@ public class KuaiShouDramaServiceImpl implements IKuaiShouDramaService {
|
|
|
Integer code = resultJson.getInteger("code");
|
|
Integer code = resultJson.getInteger("code");
|
|
|
String message = resultJson.getString("message");
|
|
String message = resultJson.getString("message");
|
|
|
if (null == code || code != 0) {
|
|
if (null == code || code != 0) {
|
|
|
- log.error("批量获取快手短剧剧集信息查询接口异常:{},accountId:{}", message, advertiserId);
|
|
|
|
|
- }
|
|
|
|
|
- JSONArray data = resultJson.getJSONArray("data");
|
|
|
|
|
- List<KuaiShouDramaSeriesInfo> seriesInfos = new ArrayList<>();
|
|
|
|
|
- for (Object datum : data) {
|
|
|
|
|
- JSONObject seriesInfo = JSONObject.parseObject(datum.toString());
|
|
|
|
|
- JSONArray episodeList = seriesInfo.getJSONArray("episode_list");
|
|
|
|
|
- String seriesName = seriesInfo.getString("mini_series_name");
|
|
|
|
|
- Long seriesId = seriesInfo.getLong("mini_series_id");
|
|
|
|
|
- Integer episodeNum = null;
|
|
|
|
|
- if (!Check.isNull(episodeList)) {
|
|
|
|
|
- episodeNum = episodeList.size();
|
|
|
|
|
|
|
+ log.error("批量获取快手短剧剧集信息查询接口异常:{},accountId:{},seriesIds:{}", message, advertiserId, param.get("mini_series_ids"));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ JSONArray data = resultJson.getJSONArray("data");
|
|
|
|
|
+ List<KuaiShouDramaSeriesInfo> seriesInfos = new ArrayList<>();
|
|
|
|
|
+ List<KuaiShouDramaEpisodeInfo> episodeInfos = new ArrayList<>();
|
|
|
|
|
+ for (Object datum : data) {
|
|
|
|
|
+ JSONObject seriesInfo = JSONObject.parseObject(datum.toString());
|
|
|
|
|
+ JSONArray episodeList = seriesInfo.getJSONArray("episode_list");
|
|
|
|
|
+ String seriesName = seriesInfo.getString("mini_series_name");
|
|
|
|
|
+ Long seriesId = seriesInfo.getLong("mini_series_id");
|
|
|
|
|
+ Integer episodeNum = null;
|
|
|
|
|
+ if (!Check.isNull(episodeList)) {
|
|
|
|
|
+ episodeNum = episodeList.size();
|
|
|
|
|
+ for (int i = 0; i < episodeList.size(); i++) {
|
|
|
|
|
+ JSONObject episodeJson = episodeList.getJSONObject(i);
|
|
|
|
|
+ KuaiShouDramaEpisodeInfo episodeInfo = new KuaiShouDramaEpisodeInfo();
|
|
|
|
|
+ episodeInfo.setAdminAdvertiserId(advertiserId);
|
|
|
|
|
+ episodeInfo.setSeriesId(seriesId);
|
|
|
|
|
+ episodeInfo.setSeriesName(seriesName);
|
|
|
|
|
+ episodeInfo.setEpisodeId(episodeJson.getLong("episode_id"));
|
|
|
|
|
+ episodeInfo.setEpisodeName(episodeJson.getString("episode_name"));
|
|
|
|
|
+ episodeInfo.setOrderNo(episodeJson.getInteger("order_no"));
|
|
|
|
|
+ episodeInfo.setFreeEpisode(episodeJson.getBoolean("free_episode"));
|
|
|
|
|
+ episodeInfos.add(episodeInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ KuaiShouDramaSeriesInfo kuaiShouDramaSeriesInfo = new KuaiShouDramaSeriesInfo(advertiserId, seriesId, seriesName, null, null, episodeNum);
|
|
|
|
|
+ seriesInfos.add(kuaiShouDramaSeriesInfo);
|
|
|
}
|
|
}
|
|
|
- KuaiShouDramaSeriesInfo kuaiShouDramaSeriesInfo = new KuaiShouDramaSeriesInfo(advertiserId, seriesId, seriesName, null, null, episodeNum);
|
|
|
|
|
- seriesInfos.add(kuaiShouDramaSeriesInfo);
|
|
|
|
|
- }
|
|
|
|
|
- if (!Check.isNull(seriesInfos)) {
|
|
|
|
|
- kuaiShouDramaMapper.insertSeriesInfo(seriesInfos);
|
|
|
|
|
|
|
+ if (!Check.isNull(seriesInfos)) {
|
|
|
|
|
+ kuaiShouDramaMapper.insertSeriesInfo(seriesInfos);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!Check.isNull(episodeInfos)) {
|
|
|
|
|
+ kuaiShouDramaMapper.insertEpisodeInfo(episodeInfos);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("批量获取快手短剧剧集信息查询接口成功:{},accountId:{},seriesIds:{}", message, advertiserId, param.get("mini_series_ids"));
|
|
|
}
|
|
}
|
|
|
if (size > 20) {
|
|
if (size > 20) {
|
|
|
List<Long> longs = new ArrayList<>(seriesIds.subList(20, size));
|
|
List<Long> longs = new ArrayList<>(seriesIds.subList(20, size));
|
|
|
updateSeriesEpisodeNum(advertiserId, accessToken, longs);
|
|
updateSeriesEpisodeNum(advertiserId, accessToken, longs);
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ log.error("updateSeriesEpisodeNum error, advertiserId:{}", advertiserId, e);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|