|
@@ -692,10 +692,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
}
|
|
}
|
|
|
String ghName = param.getGhName();
|
|
String ghName = param.getGhName();
|
|
|
if (StringUtils.hasText(ghName)) {
|
|
if (StringUtils.hasText(ghName)) {
|
|
|
- String dt = demandVideoMapperExt.getMaxDt(null);
|
|
|
|
|
- if (StringUtils.hasText(dt)) {
|
|
|
|
|
- return DemandChannelEnum.fromValue(demandVideoMapperExt.selectChannelNameByGh(dt, ghName));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return DemandChannelEnum.fromValue(demandVideoMapperExt.selectChannelNameByGh(ghName));
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
@@ -768,6 +765,9 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
if (VideoContentSource.HOT == source) {
|
|
if (VideoContentSource.HOT == source) {
|
|
|
return getHotSourcePaged(param, user);
|
|
return getHotSourcePaged(param, user);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 杠杆1: channel + dt 每请求只解析一次,传入各池,避免 fan-out 各池重复查 channel/dt
|
|
|
|
|
+ DemandChannelEnum channel = resolveChannelName(param);
|
|
|
|
|
+ String dt = demandVideoMapperExt.getMaxDt(channel == null ? null : channel.getValue());
|
|
|
List<VideoContentItemVO> list;
|
|
List<VideoContentItemVO> list;
|
|
|
if (VideoContentSource.PRIOR == source) {
|
|
if (VideoContentSource.PRIOR == source) {
|
|
|
// 人群需求池并行拉取, 按 PRIOR_POOL_CONFIGS 配置
|
|
// 人群需求池并行拉取, 按 PRIOR_POOL_CONFIGS 配置
|
|
@@ -777,8 +777,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
List<Future<List<VideoContentItemVO>>> futures = new ArrayList<>(poolCount);
|
|
List<Future<List<VideoContentItemVO>>> futures = new ArrayList<>(poolCount);
|
|
|
for (PriorPoolConfig cfg : PRIOR_POOL_CONFIGS) {
|
|
for (PriorPoolConfig cfg : PRIOR_POOL_CONFIGS) {
|
|
|
futures.add(executor.submit(cfg.scene
|
|
futures.add(executor.submit(cfg.scene
|
|
|
- ? () -> fetchPriorSceneCandidates(param, user, DEMAND_CANDIDATE_LIMIT, cfg.dimension, cfg.demandType, cfg.matchMethod)
|
|
|
|
|
- : () -> fetchPriorPool(param, user, DEMAND_CANDIDATE_LIMIT, cfg.dimension, cfg.demandType, cfg.matchMethod)));
|
|
|
|
|
|
|
+ ? () -> fetchPriorSceneCandidates(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt, cfg.dimension, cfg.demandType, cfg.matchMethod)
|
|
|
|
|
+ : () -> fetchPriorPool(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt, cfg.dimension, cfg.demandType, cfg.matchMethod)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int timeoutSeconds = 30;
|
|
int timeoutSeconds = 30;
|
|
@@ -795,7 +795,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
executor.shutdown();
|
|
executor.shutdown();
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- list = fetchPosteriorCandidates(param, user, DEMAND_CANDIDATE_LIMIT);
|
|
|
|
|
|
|
+ list = fetchPosteriorCandidates(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt);
|
|
|
}
|
|
}
|
|
|
for (VideoContentItemVO v : list) {
|
|
for (VideoContentItemVO v : list) {
|
|
|
v.setSource(source.getValue());
|
|
v.setSource(source.getValue());
|
|
@@ -927,18 +927,21 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
private Page<VideoContentItemVO> getInterleavedPage(VideoContentListParam param, ContentPlatformAccount user) {
|
|
private Page<VideoContentItemVO> getInterleavedPage(VideoContentListParam param, ContentPlatformAccount user) {
|
|
|
int priorCount = PRIOR_POOL_CONFIGS.size();
|
|
int priorCount = PRIOR_POOL_CONFIGS.size();
|
|
|
int totalCount = priorCount + 2; // + posterior + hot
|
|
int totalCount = priorCount + 2; // + posterior + hot
|
|
|
|
|
+ // 杠杆1: channel + dt 每请求只解析一次,传入各 demand 池(hot 池用自己的 dt,不受影响)
|
|
|
|
|
+ DemandChannelEnum channel = resolveChannelName(param);
|
|
|
|
|
+ String dt = demandVideoMapperExt.getMaxDt(channel == null ? null : channel.getValue());
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(totalCount);
|
|
ExecutorService executor = Executors.newFixedThreadPool(totalCount);
|
|
|
try {
|
|
try {
|
|
|
// prior 池并行拉取
|
|
// prior 池并行拉取
|
|
|
List<Future<List<VideoContentItemVO>>> futures = new ArrayList<>(totalCount);
|
|
List<Future<List<VideoContentItemVO>>> futures = new ArrayList<>(totalCount);
|
|
|
for (PriorPoolConfig cfg : PRIOR_POOL_CONFIGS) {
|
|
for (PriorPoolConfig cfg : PRIOR_POOL_CONFIGS) {
|
|
|
futures.add(executor.submit(cfg.scene
|
|
futures.add(executor.submit(cfg.scene
|
|
|
- ? () -> fetchPriorSceneCandidates(param, user, DEMAND_CANDIDATE_LIMIT, cfg.dimension, cfg.demandType, cfg.matchMethod)
|
|
|
|
|
- : () -> fetchPriorPool(param, user, DEMAND_CANDIDATE_LIMIT, cfg.dimension, cfg.demandType, cfg.matchMethod)));
|
|
|
|
|
|
|
+ ? () -> fetchPriorSceneCandidates(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt, cfg.dimension, cfg.demandType, cfg.matchMethod)
|
|
|
|
|
+ : () -> fetchPriorPool(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt, cfg.dimension, cfg.demandType, cfg.matchMethod)));
|
|
|
}
|
|
}
|
|
|
// posterior + hot
|
|
// posterior + hot
|
|
|
Future<List<VideoContentItemVO>> fPosterior = executor.submit(
|
|
Future<List<VideoContentItemVO>> fPosterior = executor.submit(
|
|
|
- () -> fetchPosteriorCandidates(param, user, DEMAND_CANDIDATE_LIMIT));
|
|
|
|
|
|
|
+ () -> fetchPosteriorCandidates(param, user, DEMAND_CANDIDATE_LIMIT, channel, dt));
|
|
|
Future<List<VideoContentItemVO>> fHot = executor.submit(
|
|
Future<List<VideoContentItemVO>> fHot = executor.submit(
|
|
|
() -> fetchHotCandidates(param, user, HOT_CANDIDATE_LIMIT));
|
|
() -> fetchHotCandidates(param, user, HOT_CANDIDATE_LIMIT));
|
|
|
futures.add(fPosterior);
|
|
futures.add(fPosterior);
|
|
@@ -987,9 +990,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
* 3. 输出顺序按 sceneSumRov DESC,相同再按 total_rov DESC 兜底
|
|
* 3. 输出顺序按 sceneSumRov DESC,相同再按 total_rov DESC 兜底
|
|
|
*/
|
|
*/
|
|
|
private List<VideoContentItemVO> fetchPriorSceneCandidates(VideoContentListParam param, ContentPlatformAccount user, int limit,
|
|
private List<VideoContentItemVO> fetchPriorSceneCandidates(VideoContentListParam param, ContentPlatformAccount user, int limit,
|
|
|
|
|
+ DemandChannelEnum channel, String dt,
|
|
|
PriorDimensionEnum dimension, DemandTypeEnum demandType, DemandMatchMethodEnum matchMethod) {
|
|
PriorDimensionEnum dimension, DemandTypeEnum demandType, DemandMatchMethodEnum matchMethod) {
|
|
|
- DemandChannelEnum channel = resolveChannelName(param);
|
|
|
|
|
- String dt = demandVideoMapperExt.getMaxDt(channel == null ? null : channel.getValue());
|
|
|
|
|
if (!StringUtils.hasText(dt)) {
|
|
if (!StringUtils.hasText(dt)) {
|
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
|
}
|
|
}
|
|
@@ -1050,9 +1052,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
* 6. 截断到 limit
|
|
* 6. 截断到 limit
|
|
|
*/
|
|
*/
|
|
|
private List<VideoContentItemVO> fetchPriorPool(VideoContentListParam param, ContentPlatformAccount user, int limit,
|
|
private List<VideoContentItemVO> fetchPriorPool(VideoContentListParam param, ContentPlatformAccount user, int limit,
|
|
|
|
|
+ DemandChannelEnum channel, String dt,
|
|
|
PriorDimensionEnum dimension, DemandTypeEnum demandType, DemandMatchMethodEnum matchMethod) {
|
|
PriorDimensionEnum dimension, DemandTypeEnum demandType, DemandMatchMethodEnum matchMethod) {
|
|
|
- DemandChannelEnum channel = resolveChannelName(param);
|
|
|
|
|
- String dt = demandVideoMapperExt.getMaxDt(channel == null ? null : channel.getValue());
|
|
|
|
|
if (!StringUtils.hasText(dt)) {
|
|
if (!StringUtils.hasText(dt)) {
|
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
|
}
|
|
}
|
|
@@ -1135,9 +1136,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
|
|
|
* 按 demand_content_id 分组,组按 total_rov DESC、组内 score DESC 取前 K;
|
|
* 按 demand_content_id 分组,组按 total_rov DESC、组内 score DESC 取前 K;
|
|
|
* 跨组用 video_id + 归一化标题去重,截到 limit。
|
|
* 跨组用 video_id + 归一化标题去重,截到 limit。
|
|
|
*/
|
|
*/
|
|
|
- private List<VideoContentItemVO> fetchPosteriorCandidates(VideoContentListParam param, ContentPlatformAccount user, int limit) {
|
|
|
|
|
- DemandChannelEnum channel = resolveChannelName(param);
|
|
|
|
|
- String dt = demandVideoMapperExt.getMaxDt(channel == null ? null : channel.getValue());
|
|
|
|
|
|
|
+ private List<VideoContentItemVO> fetchPosteriorCandidates(VideoContentListParam param, ContentPlatformAccount user, int limit,
|
|
|
|
|
+ DemandChannelEnum channel, String dt) {
|
|
|
if (!StringUtils.hasText(dt)) {
|
|
if (!StringUtils.hasText(dt)) {
|
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
|
}
|
|
}
|