#119 create scheduler

merge-requests/84/head
T-Midnight 5 years ago
parent 2d9fd05060
commit b640dea99a

@ -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…
Cancel
Save