Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stefan Oppl
zml
Commits
ddb89343
Commit
ddb89343
authored
Jun 11, 2019
by
Florian Mühlburger
Browse files
Reminder Active Flag wird bei Email gecheckt
parent
27307af9
Pipeline
#385
failed with stages
in 9 minutes and 31 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/at/jku/ce/zml/service/NotificationService.java
View file @
ddb89343
...
...
@@ -16,8 +16,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.thymeleaf.TemplateEngine
;
import
org.thymeleaf.context.Context
;
import
java.text.SimpleDateFormat
;
import
java.time.Instant
;
import
java.time.ZoneId
;
...
...
@@ -55,13 +53,12 @@ public class NotificationService {
* This is scheduled to get fired every night, at 04:00 (am).
*/
@Scheduled
(
cron
=
"0 0 4 * * ?"
)
// @Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above
// @Scheduled(cron = "0 * * * * ?") // for testing purposes, this line triggers the method every minute, during operation use the line above
public
void
sendNotification
()
{
Page
<
PruefungsTermin
>
results
=
pruefungsTerminService
.
findAll
(
Pageable
.
unpaged
());
List
<
PruefungsTermin
>
resultList
=
results
.
getContent
();
//Listen Schriftliche Prüfungen vor Klausur
List
<
PruefungsTermin
>
sTermin12W
=
filterDates
(
resultList
,
84
);
List
<
PruefungsTermin
>
sTermin6W
=
filterDates
(
resultList
,
42
);
...
...
@@ -101,9 +98,10 @@ public class NotificationService {
Stream
.
of
(
sTerminAllb
,
sTerminAlla
,
mTerminAll
).
forEach
(
terminAll:
:
addAll
);
StringBuffer
b
=
new
StringBuffer
();
if
(!
terminAll
.
isEmpty
()){
// Schriftliche Prüfungen vor Klausur
// Schriftliche Prüfungen vor Klausur
b
.
append
(
"<h1>Prüfungserinnerung</h1> "
);
if
(!
sTerminAllb
.
isEmpty
())
{
b
.
append
(
"<h2>Schriftliche Prüfungen vor Klausur</h2> "
+
...
...
@@ -241,7 +239,7 @@ public class NotificationService {
DateTimeFormatter
.
ofLocalizedDateTime
(
FormatStyle
.
SHORT
).
withLocale
(
Locale
.
getDefault
()).
withZone
(
ZoneId
.
systemDefault
());
b
.
append
(
"<ul>"
);
for
(
PruefungsTermin
pruefungsTermin:
filteredDates
)
{
if
(
pruefungsTermin
.
getModul
().
getPruefung
().
getArt
().
equals
(
p
))
{
if
(
pruefungsTermin
.
getModul
().
getPruefung
().
getArt
().
equals
(
p
)
&&
pruefungsTermin
.
isReminderActive
()
)
{
b
.
append
(
"<li>"
+
formatter
.
format
(
pruefungsTermin
.
getStartZeitpunkt
())
+
": "
+
pruefungsTermin
.
getModul
().
getBezeichnung
()
+
"</li>"
);
log
.
debug
(
"adding "
+
pruefungsTermin
.
getStartZeitpunkt
().
toString
());
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment