|
@@ -141,26 +141,29 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
List<Pair<Long, Double>> result = new ArrayList<>();
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
for (Map.Entry<String, List<String>> entry : FESTIVAL_TIME_MAP.entrySet()) {
|
|
|
String festival = entry.getKey();
|
|
|
List<String> timeRangeList = entry.getValue();
|
|
|
- if (isFestivalTime(timeRangeList)) {
|
|
|
+ if (isFestivalTime(now, timeRangeList)) {
|
|
|
List<Pair<Long, Double>> festivalLists = model.kv.getOrDefault(festival, new ArrayList<>());
|
|
|
if (festivalLists.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
+ festivalLists = festivalLists.subList(0, Math.min(100, festivalLists.size()));
|
|
|
result.addAll(festivalLists);
|
|
|
}
|
|
|
}
|
|
|
// 固定获取常规祝福类的小程序
|
|
|
List<Pair<Long, Double>> festivalLists = model.kv.getOrDefault("祝福", new ArrayList<>());
|
|
|
if (!festivalLists.isEmpty()) {
|
|
|
+ festivalLists = festivalLists.subList(0, Math.min(100, festivalLists.size()));
|
|
|
result.addAll(festivalLists);
|
|
|
}
|
|
|
- return result.subList(0, Math.min(100, result.size()));
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
- public boolean isFestivalTime(List<String> timeRangeList) {
|
|
|
+ public boolean isFestivalTime(LocalDateTime now, List<String> timeRangeList) {
|
|
|
if (timeRangeList == null || timeRangeList.isEmpty()) {
|
|
|
return false;
|
|
|
}
|
|
@@ -175,8 +178,6 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
}
|
|
|
String startTime = split[0];
|
|
|
String endTime = split[1];
|
|
|
- // 获取当前时间
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
// 获取当前时间的小时和分钟
|
|
|
int hour = now.getHour();
|
|
|
int minute = now.getMinute();
|
|
@@ -214,8 +215,6 @@ public class FestivalRecallScore extends AbstractScorer4Recall {
|
|
|
}
|
|
|
String startTime = split[0];
|
|
|
String endTime = split[1];
|
|
|
- // 获取当前时间
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
// 解析 startTime endTime
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
|
|
LocalDateTime startLocalDateTime = LocalDateTime.parse(startTime, dateTimeFormatter);
|