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 @@ -16,38 +16,38 @@
public class NotificationScheduler {
private final ReservationNotificationService reservationNotificationService;
private final SeatNotificationService seatNotificationService;

/**
* 매일 8시에 당일 예약 알림을 보내는 메서드 호출(매일 8시에 실행되도록 스케줄링)
*/
@Scheduled(cron = "0 0 8 * * ?") // 매일 8시에 실행
public void sendDailyNotification() {

LocalDate today = LocalDate.now();
// 당일 예약 확인 알림 발송
reservationNotificationService.sendDailyNotification(today);
}

/**
* 예약 1시간 전 알림을 보내는 메서드 호출(운영시간(현재 9 ~ 19시) 기준으로 1시간 단위로 실행되도록 스케줄링)
*/
@Scheduled(cron = "0 0 8-18/1 * * ?") // 8 ~ 18시 내에서 1시간 단위로 실행
public void sendHourBeforeNotification() {
// 현재 시간 포멧팅
LocalDateTime now = DateTimeUtil.truncateToMinute(LocalDateTime.now());
// 1시간 전 예약 확인 알림 발송
reservationNotificationService.sendHourBeforeNotification(now);
}

/**
* 예약 가능 시간이 지난 좌석에 해당하는 빈자리 알림 데이터 삭제 메서드 호출(운영시간(현재 9 ~ 19시) 기준으로 1시간 단위로 실행되도록 스케줄링)
*/
@Scheduled(cron = "0 0 9-19/1 * * ?")
public void deleteSeatNotificationMessages() {
// 현재 날짜/시간 포멧팅
LocalDate currentDate = LocalDate.now();
LocalTime currentTime = DateTimeUtil.truncateTimeToMinute(LocalTime.now());
// 주어진 시간 이전의 좌성에 대한 빈자리 알림 삭제
seatNotificationService.deleteSeatNotifications(currentDate, currentTime);
}
//
// /**
// * 매일 8시에 당일 예약 알림을 보내는 메서드 호출(매일 8시에 실행되도록 스케줄링)
// */
// @Scheduled(cron = "0 0 8 * * ?") // 매일 8시에 실행
// public void sendDailyNotification() {
//
// LocalDate today = LocalDate.now();
// // 당일 예약 확인 알림 발송
// reservationNotificationService.sendDailyNotification(today);
// }
//
// /**
// * 예약 1시간 전 알림을 보내는 메서드 호출(운영시간(현재 9 ~ 19시) 기준으로 1시간 단위로 실행되도록 스케줄링)
// */
// @Scheduled(cron = "0 0 8-18/1 * * ?") // 8 ~ 18시 내에서 1시간 단위로 실행
// public void sendHourBeforeNotification() {
// // 현재 시간 포멧팅
// LocalDateTime now = DateTimeUtil.truncateToMinute(LocalDateTime.now());
// // 1시간 전 예약 확인 알림 발송
// reservationNotificationService.sendHourBeforeNotification(now);
// }
//
// /**
// * 예약 가능 시간이 지난 좌석에 해당하는 빈자리 알림 데이터 삭제 메서드 호출(운영시간(현재 9 ~ 19시) 기준으로 1시간 단위로 실행되도록 스케줄링)
// */
// @Scheduled(cron = "0 0 9-19/1 * * ?")
// public void deleteSeatNotificationMessages() {
// // 현재 날짜/시간 포멧팅
// LocalDate currentDate = LocalDate.now();
// LocalTime currentTime = DateTimeUtil.truncateTimeToMinute(LocalTime.now());
// // 주어진 시간 이전의 좌성에 대한 빈자리 알림 삭제
// seatNotificationService.deleteSeatNotifications(currentDate, currentTime);
// }
}
9 changes: 8 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ ai:
---
spring:
jwt:
secret: ${JWT_SECRET}
secret: ${JWT_SECRET}

---
server:
compression:
enabled: true
mime-types: text/html,text/plain,text/css,application/javascript,application/json
min-response-size: 2048