|
|
@@ -846,16 +846,16 @@ public class ExternalChannelProcessJob {
|
|
|
int totalCount = 0;
|
|
|
|
|
|
// 初始化所有已支持的渠道
|
|
|
- totalCount += initChannelHistory(ChannelType.MINIAPP_TOULIU, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.GZH_COOPERATE_JIZHUAN, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.QW_COOPERATE, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.GZH_TOULIU, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.FWH_COOPERATE_DAILY, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.FWH_TOULIU_DAILY, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.FWH_TOULIU_REPLY, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.GZH_COOPERATE_DAILY, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.GZH_BUY_ACCOUNT, startDate);
|
|
|
- totalCount += initChannelHistory(ChannelType.GZH_OPERATION_DAILY, startDate);
|
|
|
+ totalCount += initChannelHistory(ChannelType.MINIAPP_TOULIU, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.GZH_COOPERATE_JIZHUAN, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.QW_COOPERATE, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.GZH_TOULIU, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.FWH_COOPERATE_DAILY, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.FWH_TOULIU_DAILY, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.FWH_TOULIU_REPLY, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.GZH_COOPERATE_DAILY, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.GZH_BUY_ACCOUNT, startDate, days);
|
|
|
+ totalCount += initChannelHistory(ChannelType.GZH_OPERATION_DAILY, startDate, days);
|
|
|
|
|
|
log.info("历史数据初始化完成, 共插入{}条记录", totalCount);
|
|
|
return new ReturnT<>(ReturnT.SUCCESS_CODE, "初始化完成,共插入" + totalCount + "条记录");
|
|
|
@@ -872,7 +872,7 @@ public class ExternalChannelProcessJob {
|
|
|
* @param startDate 起始日期
|
|
|
* @return 插入的记录数
|
|
|
*/
|
|
|
- private int initChannelHistory(ChannelType channelType, Date startDate) {
|
|
|
+ private int initChannelHistory(ChannelType channelType, Date startDate, int days) {
|
|
|
log.info("初始化渠道历史数据, channelType={}, startDate={}", channelType, startDate);
|
|
|
|
|
|
List<String> rootSourceIds = new ArrayList<>();
|
|
|
@@ -906,20 +906,20 @@ public class ExternalChannelProcessJob {
|
|
|
rootSourceIds = queryRootSourceIdsFromCgiReply(PREFIX_FWHTOULIU_TENCENTGZH, startDate);
|
|
|
break;
|
|
|
case FWH_TOULIU_DAILY:
|
|
|
- // 服务号投流-Daily:从cgi_reply_bucket_data查询fwhtouliu_开头(非fwhtouliu_tencentgzh)
|
|
|
- // 从aigc查询
|
|
|
+ // 服务号投流-Daily:从aigc getNearDaysRootSourceIds接口查询fwhtouliu_开头
|
|
|
+ rootSourceIds = queryRootSourceIdsFromAigc(PREFIX_FWHTOULIU, days);
|
|
|
break;
|
|
|
case GZH_COOPERATE_DAILY:
|
|
|
// 公众号合作-Daily:从content_platform_gzh_plan_video查询longArticles_开头
|
|
|
rootSourceIds = queryRootSourceIdsFromGzhPlanVideo(PREFIX_LONGARTICLES, startDate);
|
|
|
break;
|
|
|
case GZH_BUY_ACCOUNT:
|
|
|
- // 公众号买号:需确认数据来源
|
|
|
- // 从aigc查询
|
|
|
+ // 公众号买号:从aigc getNearDaysRootSourceIds接口查询longArticles_inner_开头
|
|
|
+ rootSourceIds = queryRootSourceIdsFromAigc(PREFIX_LONGARTICLES, days);
|
|
|
break;
|
|
|
case GZH_OPERATION_DAILY:
|
|
|
- // 公众号代运营-Daily:需确认数据来源
|
|
|
- // 从aigc查询
|
|
|
+ // 公众号代运营-Daily:从aigc getNearDaysRootSourceIds接口查询longArticles_inner_开头
|
|
|
+ rootSourceIds = queryRootSourceIdsFromAigc(PREFIX_LONGARTICLES, days);
|
|
|
break;
|
|
|
default:
|
|
|
return 0;
|
|
|
@@ -958,6 +958,26 @@ public class ExternalChannelProcessJob {
|
|
|
return insertedCount;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 从aigc getNearDaysRootSourceIds接口查询指定前缀的rootSourceId列表
|
|
|
+ *
|
|
|
+ * @param prefix 前缀
|
|
|
+ * @param days 天数
|
|
|
+ * @return rootSourceId列表
|
|
|
+ */
|
|
|
+ private List<String> queryRootSourceIdsFromAigc(String prefix, int days) {
|
|
|
+ List<String> result = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ List<String> list = recommendApiService.getArticleByRootSourceId(prefix, days);
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
+ result = list;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("从aigc查询历史数据失败, prefix={}, days={}", prefix, days, e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 从cgi_reply_bucket_data表查询指定前缀的rootSourceId列表
|
|
|
*
|