|
@@ -3,6 +3,7 @@ package com.tzld.piaoquan.recommend.server.service.score4recall.strategy;
|
|
|
import com.tzld.piaoquan.recommend.server.service.score.ScorerConfigInfo;
|
|
|
import com.tzld.piaoquan.recommend.server.service.score4recall.AbstractScorer4Recall;
|
|
|
import com.tzld.piaoquan.recommend.server.service.score4recall.model4recall.Model4RecallKeyValue;
|
|
|
+import com.tzld.piaoquan.recommend.server.util.ListMerger;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
|
@@ -146,9 +147,9 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
if (model == null || model.kv == null) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
- List<Pair<Long, Double>> result = new ArrayList<>();
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
// 节日祝福-每年
|
|
|
+ List<Pair<Long, Double>> yearResult = new ArrayList<>();
|
|
|
for (Map.Entry<String, List<String>> entry : YEARLY_FESTIVAL_TIME_MAP.entrySet()) {
|
|
|
String festival = entry.getKey();
|
|
|
List<String> timeRangeList = entry.getValue();
|
|
@@ -168,9 +169,10 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
festivalLists = festivalLists.stream().map(pair -> Pair.of(pair.getLeft(), weight))
|
|
|
.limit(Math.min(50, festivalLists.size()))
|
|
|
.collect(Collectors.toList());
|
|
|
- result.addAll(festivalLists);
|
|
|
+ yearResult.addAll(festivalLists);
|
|
|
}
|
|
|
}
|
|
|
+ List<Pair<Long, Double>> dayResult = new ArrayList<>();
|
|
|
// 每日祝福-每天固定时间段
|
|
|
for (Map.Entry<String, String> entry : DAILY_BLESSING_TIME_MAP.entrySet()) {
|
|
|
String festival = entry.getKey();
|
|
@@ -183,18 +185,19 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
festivalLists = festivalLists.stream().map(pair -> Pair.of(pair.getLeft(), 0.0))
|
|
|
.limit(Math.min(50, festivalLists.size()))
|
|
|
.collect(Collectors.toList());
|
|
|
- result.addAll(festivalLists);
|
|
|
+ dayResult.addAll(festivalLists);
|
|
|
}
|
|
|
}
|
|
|
// 常规祝福类的小程序-任意时间
|
|
|
+ List<Pair<Long, Double>> anyResult = new ArrayList<>();
|
|
|
List<Pair<Long, Double>> festivalLists = model.kv.getOrDefault("祝福", new ArrayList<>());
|
|
|
if (!festivalLists.isEmpty()) {
|
|
|
festivalLists = festivalLists.stream().map(pair -> Pair.of(pair.getLeft(), 0.0))
|
|
|
.limit(Math.min(50, festivalLists.size()))
|
|
|
.collect(Collectors.toList());
|
|
|
- result.addAll(festivalLists);
|
|
|
+ anyResult.addAll(festivalLists);
|
|
|
}
|
|
|
- return result;
|
|
|
+ return ListMerger.mergeLists(yearResult, dayResult, anyResult);
|
|
|
}
|
|
|
|
|
|
public Pair<LocalDateTime, LocalDateTime> getStartTimeAndEndTime(String timeRangeList) {
|