Skip to content

Commit 58bcc35

Browse files
committed
MNG-22 fix : 미션 관련 스케쥴링 메소드 추가
1 parent f34616d commit 58bcc35

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.moing.backend.domain.mission.application.service;
2+
3+
import lombok.RequiredArgsConstructor;
4+
import lombok.extern.slf4j.Slf4j;
5+
import org.springframework.context.annotation.Profile;
6+
import org.springframework.scheduling.annotation.EnableAsync;
7+
import org.springframework.scheduling.annotation.EnableScheduling;
8+
import org.springframework.scheduling.annotation.Scheduled;
9+
import org.springframework.stereotype.Service;
10+
import org.springframework.transaction.annotation.Transactional;
11+
12+
13+
@Slf4j
14+
@Service
15+
@Transactional
16+
@EnableAsync
17+
@EnableScheduling
18+
@RequiredArgsConstructor
19+
@Profile("prod")
20+
public class MissionScheduleUseCase {
21+
22+
private final MissionRemindAlarmUseCase missionRemindAlarmUseCase;
23+
private final MissionUpdateUseCase missionUpdateUseCase;
24+
25+
/**
26+
* 단일 미션 마감
27+
* 해당 시간 미션 마감
28+
* 한시간 마다 실행
29+
*/
30+
@Scheduled(cron = "0 1 * * * *")
31+
public void singleMissionEndRoutine() {
32+
missionUpdateUseCase.terminateMissionByAdmin();
33+
}
34+
35+
/**
36+
* 리마인드 알림
37+
* 인증하지 않은 미션이 있는 경우 알림
38+
* 매일 오후 8시
39+
*/
40+
@Scheduled(cron = "0 0 20 * * *")
41+
public void MissionRemindAlarm() {
42+
missionRemindAlarmUseCase.sendRemindMissionAlarm();
43+
}
44+
}

0 commit comments

Comments
 (0)