|
|
|
@ -16,15 +16,14 @@ public class ConferenceNotificationService {
|
|
|
|
|
|
|
|
|
|
private final static int DAYS_TO_DEADLINE_NOTIFICATION = 7;
|
|
|
|
|
private final static String TEMPLATE_DEADLINE = "conferenceDeadlineNotification";
|
|
|
|
|
private final static String TEMPLATE_CREATE_CONFERENCE = "conferenceCreateNotification";
|
|
|
|
|
private final static String TEMPLATE_STATUS_CHANGED = "conferenceChangeNotification";
|
|
|
|
|
private final static String TEMPLATE_FAILED = "conferenceFailedNotification";
|
|
|
|
|
private final static String TEMPLATE_CREATE = "conferenceCreateNotification";
|
|
|
|
|
private final static String TEMPLATE_UPDATE_DEADLINES = "conferenceUpdateDeadlinesNotification";
|
|
|
|
|
private final static String TEMPLATE_UPDATE_DATES = "conferenceUpdateDatesNotification";
|
|
|
|
|
|
|
|
|
|
private final static String TITLE_DEADLINE = "Приближается дедлайн конференции";
|
|
|
|
|
private final static String TITLE_CREATE = "Создана новая конференция: %s";
|
|
|
|
|
private final static String TITLE_STATUS_CHANGED = "Изменения в конференции";
|
|
|
|
|
private final static String TITLE_FAILED = "Статья провалена";
|
|
|
|
|
|
|
|
|
|
private final static String TITLE_UPDATE_DEADLINES = "Изменения дедлайнов в конференции: %s";
|
|
|
|
|
private final static String TITLE_UPDATE_DATES = "Изменение дат проведения конференции: %s";
|
|
|
|
|
|
|
|
|
|
private final MailService mailService;
|
|
|
|
|
private final UserService userService;
|
|
|
|
@ -57,7 +56,17 @@ public class ConferenceNotificationService {
|
|
|
|
|
|
|
|
|
|
public void sendCreateNotification(Conference conference) {
|
|
|
|
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
|
|
|
|
sendForAllUsers(variables, TEMPLATE_CREATE_CONFERENCE, String.format(TITLE_CREATE, conference.getTitle()));
|
|
|
|
|
sendForAllUsers(variables, TEMPLATE_CREATE, String.format(TITLE_CREATE, conference.getTitle()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateDeadlineNotification(Conference conference) {
|
|
|
|
|
Map<String, Object> variables = ImmutableMap.of("conference", conference);
|
|
|
|
|
sendForAllParticipals(variables, conference, TEMPLATE_UPDATE_DEADLINES, String.format(TITLE_UPDATE_DEADLINES, conference.getTitle()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateConferencesDatesNotification(Conference conference, Date oldBeginDate, Date oldEndDate) {
|
|
|
|
|
Map<String, Object> variables = ImmutableMap.of("conference", conference, "oldBeginDate", oldBeginDate, "oldEndDate", oldEndDate);
|
|
|
|
|
sendForAllParticipals(variables, conference, TEMPLATE_UPDATE_DATES, String.format(TITLE_UPDATE_DATES, conference.getTitle()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public void statusChangeNotification(Paper paper, Paper.PaperStatus oldStatus) {
|
|
|
|
@ -77,4 +86,6 @@ public class ConferenceNotificationService {
|
|
|
|
|
private void sendForAllParticipals(Map<String, Object> variables, Conference conference, String template, String title) {
|
|
|
|
|
conference.getUsers().forEach(conferenceUser -> mailService.sendEmailFromTemplate(variables, conferenceUser.getUser(), template, title));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|