Resolve "Список периодических событий" #129
25
src/main/java/ru/ulstu/paper/service/PaperMessages.java
Normal file
25
src/main/java/ru/ulstu/paper/service/PaperMessages.java
Normal file
@ -0,0 +1,25 @@
|
||||
package ru.ulstu.paper.service;
|
||||
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.user.model.UserDto;
|
||||
import ru.ulstu.user.service.MailService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PaperMessages {
|
||||
|
||||
public final MailService mailService;
|
||||
|
||||
public PaperMessages(MailService mailService){
|
||||
this.mailService = mailService;
|
||||
}
|
||||
private void sendMessageAboutStatusChange(Paper.PaperStatus oldStatus, PaperDto paper){
|
||||
List<UserDto> users = paper.getAuthors();
|
||||
for (UserDto user: users) {
|
||||
mailService.sendEmail(user.getEmail(), "Обновление статуса статьи",
|
||||
"Статус статьи " + paper.getTitle() + " сменился с " + oldStatus.getName()
|
||||
+ " на " + paper.getStatus().getName());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user