|
@@ -85,12 +85,15 @@ public class RankProcessorBoost {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static void boostByFestive(RankParam param, List<Video> rovList, Set<String> festiveRootSessionIdTails) {
|
|
|
+ public static void boostByFestive(RankParam param, List<Video> rovList, Map<String, String> rankReduceByFestiveConfig) {
|
|
|
|
|
|
- if (CollectionUtils.isEmpty(param.getAbExpCodes()) || !param.getAbExpCodes().contains("747")){
|
|
|
+ String abCode = rankReduceByFestiveConfig.getOrDefault("abCode", "747");
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(param.getAbExpCodes()) || StringUtils.isEmpty(abCode) || !param.getAbExpCodes().contains(abCode)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ Set<String> festiveRootSessionIdTails = new HashSet<>(Arrays.asList(rankReduceByFestiveConfig.getOrDefault("festiveRootSessionIdTails", "0,1,2,3,4,a,b,c").split(",")));
|
|
|
String rootSessionId = param.getRootSessionId();
|
|
|
if (StringUtils.isBlank(rootSessionId) || CollectionUtils.isEmpty(festiveRootSessionIdTails)) {
|
|
|
return;
|
|
@@ -101,6 +104,7 @@ public class RankProcessorBoost {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ double reduceCoefficient = Double.parseDouble(rankReduceByFestiveConfig.getOrDefault("reduceCoefficient", "0.2"));
|
|
|
String format = "yyyy-MM-dd";
|
|
|
int nowHour = LocalDateTime.now().getHour();
|
|
|
LocalDate now = LocalDate.now();
|
|
@@ -119,15 +123,9 @@ public class RankProcessorBoost {
|
|
|
LocalDate festiveDate = DateUtils.convertStrToLocalDate(festiveDateStr, format);
|
|
|
// 计算今天与节日相差的天数,如果节日时间在之后,返回负数
|
|
|
long diffDay = ChronoUnit.DAYS.between(festiveDate, now);
|
|
|
- if (diffDay == 0 && nowHour >= 10) {
|
|
|
- double reduceCoefficient = 0.2;
|
|
|
- double originScore = video.getScore();
|
|
|
- video.setScore(originScore * reduceCoefficient);
|
|
|
- video.setSortScore(originScore * reduceCoefficient);
|
|
|
- video.getScoresMap().put("festiveReduceCoefficient", reduceCoefficient);
|
|
|
- break;
|
|
|
- } else if (diffDay >= 1 && diffDay <= 2) {
|
|
|
- double reduceCoefficient = 0.2;
|
|
|
+ boolean flag = (diffDay == 0 && nowHour >= 10) || (diffDay >= 1 && diffDay <= 2);
|
|
|
+ if (flag) {
|
|
|
+ log.info("[FestiveVideoReduce] video: {}, festiveName: {}, festiveDate: {}, reduceCoefficient: {}", video.getVideoId(), festiveName, festiveDateStr, reduceCoefficient);
|
|
|
double originScore = video.getScore();
|
|
|
video.setScore(originScore * reduceCoefficient);
|
|
|
video.setSortScore(originScore * reduceCoefficient);
|