This commit is contained in:
Van0313
2025-06-19 01:21:45 +08:00
parent 3744177e16
commit 1e035a7b41

View File

@@ -2127,16 +2127,18 @@ public class JDUtil {
List<LocalDate> localDates = parseUserDateIfPresent(input);
if (localDates != null) {
userDate = localDates;
logger.info("用户输入的日期 {}", userDate);
} else {
// 2⃣ 获取有效“今天”
LocalDateTime today = getEffectiveToday();
userDate.add(today.toLocalDate());
userDate.add(today.toLocalDate());
logger.info("有效“今天” {}", today);
}
// 3⃣ 构造查询时间范围 - 修正后的代码
LocalDateTime startOfDay = userDate.get(0).atStartOfDay();
LocalDateTime endOfDay = userDate.get(1).atTime(LocalTime.MAX);
logger.info("查询时间范围 {} - {}", startOfDay, endOfDay);
Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());