Reapply "fix: UTC 时间"

This reverts commit 86ef6f9ce7.
This commit is contained in:
tim
2025-08-11 10:55:37 +08:00
parent 86ef6f9ce7
commit 2280a16a83

View File

@@ -110,7 +110,7 @@ public class PostService {
for (LotteryPost lp : lotteryPostRepository.findByEndTimeAfterAndWinnersIsEmpty(now)) {
ScheduledFuture<?> future = taskScheduler.schedule(
() -> finalizeLottery(lp.getId()),
java.util.Date.from(java.sql.Timestamp.valueOf(lp.getEndTime()).toInstant()));
java.util.Date.from(lp.getEndTime().atZone(java.time.ZoneOffset.UTC).toInstant()));
scheduledFinalizations.put(lp.getId(), future);
}
for (LotteryPost lp : lotteryPostRepository.findByEndTimeBeforeAndWinnersIsEmpty(now)) {
@@ -210,8 +210,7 @@ public class PostService {
if (post instanceof LotteryPost lp && lp.getEndTime() != null) {
ScheduledFuture<?> future = taskScheduler.schedule(
() -> finalizeLottery(lp.getId()),
java.util.Date.from(java.sql.Timestamp.valueOf(lp.getEndTime()).toInstant()));
scheduledFinalizations.put(lp.getId(), future);
java.util.Date.from(lp.getEndTime().atZone(java.time.ZoneOffset.UTC).toInstant())); scheduledFinalizations.put(lp.getId(), future);
}
return post;
}