Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void updateStatusToNotCancelable() {
List<Reservation> reservations = reservationRepository.findByCheckin(targetTime);

reservations.stream()
.filter(reservation -> reservation.getStatus() != ReservationStatus.NOTCANCELABLE)
.filter(reservation -> reservation.getStatus() != ReservationStatus.RESERVED)
.forEach(reservation -> reservation.changeStatus(ReservationStatus.NOTCANCELABLE));

reservationRepository.saveAll(reservations);
Expand All @@ -43,14 +43,14 @@ public void updateStatusToNotCancelable() {
@Scheduled(cron = "0 0 15 * * ?")
public void updateStatusToCompleted() {
LocalDateTime now = LocalDateTime.now(ZoneId.of("Asia/Seoul"));
LocalDateTime targetDate = now.toLocalDate().atTime(15, 0);

List<Reservation> reservations = reservationRepository.findByCheckin(targetDate);
for (Reservation reservation : reservations) {
if (reservation.getStatus() != ReservationStatus.COMPLETED) {
reservation.changeStatus(ReservationStatus.COMPLETED);
}
}
LocalDateTime targetTime = now.toLocalDate().atTime(15, 0);

List<Reservation> reservations = reservationRepository.findByCheckin(targetTime);

reservations.stream()
.filter(reservation -> reservation.getStatus() == ReservationStatus.RESERVED)
.forEach(reservation -> reservation.changeStatus(ReservationStatus.COMPLETED));

reservationRepository.saveAll(reservations);

log.debug("체크인완료 업데이트 스케줄러가 실행되었습니다.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void setUp() {
.campResponseDto(mockCampDto)
.campAddrResponseDto(mockCampAddrDto)
.build();

}

@Test
Expand Down
Loading