Commit 6205a8e9 authored by Stefan Oppl's avatar Stefan Oppl
Browse files

Merge remote-tracking branch 'origin/master' into terminFilter

parents 4d93b7b5 e2bf71a9
Pipeline #347 failed with stages
in 10 minutes and 3 seconds
......@@ -26,10 +26,4 @@ public interface PruefungsTerminRepository extends JpaRepository<PruefungsTermin
@Query("select pruefungs_termin from PruefungsTermin pruefungs_termin left join fetch pruefungs_termin.raums left join fetch pruefungs_termin.lvas where pruefungs_termin.id =:id")
Optional<PruefungsTermin> findOneWithEagerRelationships(@Param("id") Long id);
/* @Query(value = "SELECT pruefungs_termin FROM PruefungsTermin pruefungs_termin, Modul modul, PruefungsTyp pruefungs_typ WHERE modul.id=pruefungs_termin.modul_id AND modul.pruefung_id=pruefungs_typ.id AND pruefungs_typ.art='Muendlich'")
List<PruefungsTermin> findType();
@Query(value= "select pruefungs_termin from pruefungs_termin left join fetch modul on pruefungs_termin.modul_id = modul.id left join fetch pruefungs_typ on modul.pruefung_id=pruefungs_typ.id WHERE pruefungs_typ.art='Muendlich'")
List<PruefungsTermin> findType();*/
}
......@@ -102,4 +102,10 @@ public class MailService {
log.debug("Sending password reset email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title");
}
@Async
public void sendReminderMail(User user) {
log.debug("Sending reminder email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "mail/reminderEmail", "email.reminder.title");
}
}
package at.jku.ce.zml.service;
import at.jku.ce.zml.domain.MailRecipient;
import at.jku.ce.zml.domain.Pruefung;
import at.jku.ce.zml.domain.PruefungsTermin;
import at.jku.ce.zml.domain.User;
import at.jku.ce.zml.domain.enumeration.PruefungArt;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,10 +32,12 @@ public class NotificationService {
private MailService mailService = null;
private PruefungsTerminService pruefungsTerminService = null;
private MailRecipientService mailRecipientService = null;
public NotificationService(MailService mailService, PruefungsTerminService pruefungsTerminService) {
public NotificationService(MailService mailService, PruefungsTerminService pruefungsTerminService, MailRecipientService mailRecipientService) {
this.mailService = mailService;
this.pruefungsTerminService = pruefungsTerminService;
this.mailRecipientService=mailRecipientService;
}
/**
......@@ -46,7 +50,6 @@ public class NotificationService {
public void sendNotification() {
Page<PruefungsTermin> results = pruefungsTerminService.findAll(Pageable.unpaged());
List<PruefungsTermin> resultList=results.getContent();
// List<PruefungsTermin> resultList = pruefungsTerminService.findType("Muendlich");
//Listen Schriftliche Prüfungen vor Klausur
List<PruefungsTermin> sTermin12W = filterDates(resultList, 84);
......@@ -109,7 +112,14 @@ public class NotificationService {
log.debug(b.toString());
// mailService.sendEmail("stefan.oppl@jku.at", "Terminerinnerung", b.toString(), false,false);
//mailService.sendEmail("muehlburger.florian@gmail.com", "Terminerinnerung", b.toString(), false,false);
List<MailRecipient> mailRecipients=mailRecipientService.findAll();
log.debug("groesse: "+mailRecipients.size());
for(MailRecipient mailRecipient: mailRecipients){
log.debug("User: "+mailRecipient.getUser().getEmail());
mailService.sendReminderMail(mailRecipient.getUser());
}
}
private List<PruefungsTermin> filterDates(List<PruefungsTermin> allDates, int offsetInDays) {
......
......@@ -29,16 +29,7 @@ public interface PruefungsTerminService {
*/
Page<PruefungsTermin> findAll(Pageable pageable);
/**
* Get all pruefungsTermins with Type.
*
* @param type the Type of the Prüfung
* @return the list of entities
*/
// List<PruefungsTermin> findType(String type);
/**
/**
* Get all the PruefungsTermin with eager load of many-to-many relationships.
*
* @return the list of entities
......
......@@ -54,12 +54,6 @@ public class PruefungsTerminServiceImpl implements PruefungsTerminService {
return pruefungsTerminRepository.findAll(pageable);
}
/* @Override
public List<PruefungsTermin> findType(String type) {
log.debug("Request to get all PruefungsTermine with Type "+type);
return pruefungsTerminRepository.findType();
}*/
/**
* Get all the PruefungsTermin with eager load of many-to-many relationships.
*
......
......@@ -19,3 +19,9 @@ email.reset.title=zml password reset
email.reset.greeting=Dear {0}
email.reset.text1=For your zml account a password reset was requested, please click on the URL below to reset it:
email.reset.text2=Regards,
# Reminder Email
email.reminder.title=Erinnerungsemail
email.reminder.greeting=Sehr geehrte/r
email.reminder.signature=ZML-Erinnerungsservice
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="#{email.reminder.title}">Errinerungsemail</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" th:href="@{|${baseUrl}/favicon.ico|}" />
</head>
<body>
<h1 th:text="#{greeting(${name})}"></h1>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment