fix
This commit is contained in:
parent
afd854e0cb
commit
92f86e70c9
@ -27,38 +27,37 @@ public class DeadlineScheduler {
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 8 * 1 ?")
|
||||
public void sendMessageDeadlineBeforeWeek() {
|
||||
log.debug("DeadlineSсheduler.sendMessageDeadlineBeforeWeek started");
|
||||
public void checkDeadlineBeforeWeek() {
|
||||
log.debug("DeadlineScheduler.checkDeadlineBeforeWeek started");
|
||||
List<Paper> allPapers = paperRepository.findAll();
|
||||
for (Paper element : allPapers) {
|
||||
for (Paper paper : allPapers) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.DAY_OF_YEAR, 7);
|
||||
if (c.getTime().compareTo(element.getDeadlineDate()) < 0) {
|
||||
List<User> users = element.getAuthors();
|
||||
for (User user : users) {
|
||||
mailService.sendEmail(user.getEmail(), "Приближается срок сдачи статьи",
|
||||
"Срок сдачи статьи " + element.getTitle() + " " + element.getDeadlineDate().toString());
|
||||
}
|
||||
if (c.getTime().compareTo(paper.getDeadlineDate()) < 0) {
|
||||
sendMessageDeadline(paper);
|
||||
}
|
||||
}
|
||||
log.debug("DeadlineSсheduler.sendMessageDeadlineBeforeWeek finished");
|
||||
log.debug("DeadlineScheduler.checkDeadlineBeforeWeek finished");
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 8 * * ?")
|
||||
public void sendMessageDeadlineAfterWeek() {
|
||||
log.debug("DeadlineSсheduler.sendMessageDeadlineAfterWeek started");
|
||||
public void checkDeadlineAfterWeek() {
|
||||
log.debug("DeadlineScheduler.checkDeadlineAfterWeek started");
|
||||
List<Paper> allPapers = paperRepository.findAll();
|
||||
for (Paper element : allPapers) {
|
||||
for (Paper paper : allPapers) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.add(Calendar.DAY_OF_YEAR, 7);
|
||||
if (c.getTime().compareTo(element.getDeadlineDate()) >= 0) {
|
||||
List<User> users = element.getAuthors();
|
||||
for (User user : users) {
|
||||
mailService.sendEmail(user.getEmail(), "Приближается срок сдачи статьи",
|
||||
"Срок сдачи статьи " + element.getTitle() + " " + element.getDeadlineDate().toString());
|
||||
}
|
||||
if (c.getTime().compareTo(paper.getDeadlineDate()) >= 0) {
|
||||
sendMessageDeadline(paper);
|
||||
}
|
||||
}
|
||||
log.debug("DeadlineSсheduler.sendMessageDeadlineAfterWeek finished");
|
||||
log.debug("DeadlineScheduler.checkDeadlineAfterWeek finished");
|
||||
}
|
||||
|
||||
private void sendMessageDeadline(Paper paper){
|
||||
for (User user : paper.getAuthors()) {
|
||||
mailService.sendEmail(user.getEmail(), "Приближается срок сдачи статьи",
|
||||
"Срок сдачи статьи " + paper.getTitle() + " " + paper.getDeadlineDate().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user