class for send messages about update paper
This commit is contained in:
parent
5e7cff8ac6
commit
7f54394b44
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