#119 create scheduler
This commit is contained in:
parent
2d9fd05060
commit
b640dea99a
30
src/main/java/ru/ulstu/grant/service/GrantScheduler.java
Normal file
30
src/main/java/ru/ulstu/grant/service/GrantScheduler.java
Normal file
@ -0,0 +1,30 @@
|
||||
package ru.ulstu.grant.service;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GrantScheduler {
|
||||
private final static boolean IS_DEADLINE_NOTIFICATION_BEFORE_WEEK = true;
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(GrantScheduler.class);
|
||||
|
||||
private final GrantNotificationService grantNotificationService;
|
||||
private final GrantService grantService;
|
||||
|
||||
public GrantScheduler(GrantNotificationService grantNotificationService,
|
||||
GrantService grantService) {
|
||||
this.grantNotificationService = grantNotificationService;
|
||||
this.grantService = grantService;
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0 8 * * MON", zone = "Europe/Samara")
|
||||
public void checkDeadlineBeforeWeek() {
|
||||
log.debug("GrantScheduler.checkDeadlineBeforeWeek started");
|
||||
grantNotificationService.sendDeadlineNotifications(grantService.findAll(), IS_DEADLINE_NOTIFICATION_BEFORE_WEEK);
|
||||
log.debug("GrantScheduler.checkDeadlineBeforeWeek finished");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user