Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
57d20a53
Commit
57d20a53
authored
Jun 04, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configured cron expresions from the properties file
parent
508ac6d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
20 deletions
+14
-20
LeaveNotificationScheduler.java
...om/nisum/myteam/schedular/LeaveNotificationScheduler.java
+5
-13
ProjectEndDateScheduler.java
...a/com/nisum/myteam/schedular/ProjectEndDateScheduler.java
+2
-2
application.properties
src/main/resources/application.properties
+7
-5
No files found.
src/main/java/com/nisum/myteam/schedular/LeaveNotificationScheduler.java
View file @
57d20a53
...
@@ -52,15 +52,7 @@ public class LeaveNotificationScheduler {
...
@@ -52,15 +52,7 @@ public class LeaveNotificationScheduler {
private
IFunctionalGroupService
functionalGroupService
;
private
IFunctionalGroupService
functionalGroupService
;
// private final String SHIFT1_CRON_EXP=environment.getProperty("email.leave.notification.shift1.cron");
@Scheduled
(
cron
=
"${email.leave.notification.shift1.cron}"
)
// private final String SHIFT2_CRON_EXP=environment.getProperty("email.leave.notification.shift2.cron");
// private final String SHIFT3_CRON_EXP=environment.getProperty("email.leave.notification.shift3.cron");
// private final String SHIFT4_CRON_EXP=environment.getProperty("email.leave.notification.shift4.cron");
// private final String SHIFT5_CRON_EXP=environment.getProperty("email.leave.notification.shift5.cron");
// @Scheduled(cron = "0 * * * * ?")
@Scheduled
(
cron
=
"00 00 16 * * 1-5"
)
public
void
scheduleLeaveMailForShift1Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
public
void
scheduleLeaveMailForShift1Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
//Shift 1(9:00 AM - 6:00 PM)
//Shift 1(9:00 AM - 6:00 PM)
logger
.
info
(
Shifts
.
SHIFT1
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
logger
.
info
(
Shifts
.
SHIFT1
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
...
@@ -68,7 +60,7 @@ public class LeaveNotificationScheduler {
...
@@ -68,7 +60,7 @@ public class LeaveNotificationScheduler {
}
}
@Scheduled
(
cron
=
"
00 00 18 * * 1-5
"
)
@Scheduled
(
cron
=
"
${email.leave.notification.shift2.cron}
"
)
public
void
scheduleLeaveMailForShift2Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
public
void
scheduleLeaveMailForShift2Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
//Shift-2(2:00 PM - 11:00 PM)--General Shift
//Shift-2(2:00 PM - 11:00 PM)--General Shift
logger
.
info
(
Shifts
.
SHIFT2
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
logger
.
info
(
Shifts
.
SHIFT2
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
...
@@ -76,7 +68,7 @@ public class LeaveNotificationScheduler {
...
@@ -76,7 +68,7 @@ public class LeaveNotificationScheduler {
}
}
@Scheduled
(
cron
=
"
00 00 02 * * 2-6
"
)
@Scheduled
(
cron
=
"
${email.leave.notification.shift3.cron}
"
)
public
void
scheduleLeaveMailForShift3Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
public
void
scheduleLeaveMailForShift3Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
//Shift 3(10:00 PM - 6:00 AM)
//Shift 3(10:00 PM - 6:00 AM)
logger
.
info
(
Shifts
.
SHIFT3
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
logger
.
info
(
Shifts
.
SHIFT3
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
...
@@ -84,7 +76,7 @@ public class LeaveNotificationScheduler {
...
@@ -84,7 +76,7 @@ public class LeaveNotificationScheduler {
}
}
@Scheduled
(
cron
=
"
00 30 11 * * 1-5
"
)
@Scheduled
(
cron
=
"
${email.leave.notification.shift4.cron}
"
)
public
void
scheduleLeaveMailForShift4Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
public
void
scheduleLeaveMailForShift4Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
//Shift 4(7:30 AM - 3:30 PM)
//Shift 4(7:30 AM - 3:30 PM)
logger
.
info
(
Shifts
.
SHIFT4
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
logger
.
info
(
Shifts
.
SHIFT4
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
...
@@ -92,7 +84,7 @@ public class LeaveNotificationScheduler {
...
@@ -92,7 +84,7 @@ public class LeaveNotificationScheduler {
}
}
@Scheduled
(
cron
=
"
00 30 15 * * 1-5
"
)
@Scheduled
(
cron
=
"
${email.leave.notification.shift5.cron}
"
)
public
void
scheduleLeaveMailForShift5Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
public
void
scheduleLeaveMailForShift5Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
//Shift 5(11:30 AM - 7:30 PM)
//Shift 5(11:30 AM - 7:30 PM)
logger
.
info
(
Shifts
.
SHIFT5
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
logger
.
info
(
Shifts
.
SHIFT5
.
getShiftType
()
+
" :: Execution Time - {}"
,
dateTimeFormatter
.
format
(
LocalDateTime
.
now
()));
...
...
src/main/java/com/nisum/myteam/schedular/ProjectEndDateScheduler.java
View file @
57d20a53
...
@@ -40,7 +40,7 @@ public class ProjectEndDateScheduler {
...
@@ -40,7 +40,7 @@ public class ProjectEndDateScheduler {
private
Environment
environment
;
private
Environment
environment
;
@Scheduled
(
cron
=
"
00 00 15 * * 1-5
"
)
@Scheduled
(
cron
=
"
${email.project.notification.cron}
"
)
//@Scheduled(cron = "0 * * * * ?")
//@Scheduled(cron = "0 * * * * ?")
private
void
sendMailToDls
()
throws
IOException
,
MessagingException
{
private
void
sendMailToDls
()
throws
IOException
,
MessagingException
{
...
@@ -66,7 +66,7 @@ public class ProjectEndDateScheduler {
...
@@ -66,7 +66,7 @@ public class ProjectEndDateScheduler {
List
<
String
>
dlIds
=
activeProject
.
getDeliveryLeadIds
();
List
<
String
>
dlIds
=
activeProject
.
getDeliveryLeadIds
();
for
(
String
dlId
:
dlIds
)
{
for
(
String
dlId
:
dlIds
)
{
Employee
employee
=
empService
.
getEmployeeById
(
dlId
);
Employee
employee
=
empService
.
getEmployeeById
(
dlId
);
mail
.
setEmpName
(
employee
.
getEmployeeName
());
mail
.
setEmpName
(
employee
.
getEmployeeName
());
mail
.
setTo
(
employee
.
getEmailId
());
mail
.
setTo
(
employee
.
getEmailId
());
//mail.setEmpName("Vijay");
//mail.setEmpName("Vijay");
...
...
src/main/resources/application.properties
View file @
57d20a53
...
@@ -49,11 +49,12 @@ email.leave.notification.template.file.path=email/absentMailTemplate.html
...
@@ -49,11 +49,12 @@ email.leave.notification.template.file.path=email/absentMailTemplate.html
email.leave.notification.from
=
mytime.nisum@gmail.com
email.leave.notification.from
=
mytime.nisum@gmail.com
email.leave.notification.subject
=
Employee Leave Email Notification
email.leave.notification.subject
=
Employee Leave Email Notification
#email.leave.notification.shift1.cron=00 14 * * 1-5
#0 * * * * ?===>for every minute
#email.leave.notification.shift2.cron=00 18 * * 1-5
email.leave.notification.shift1.cron
=
00 00 16 * * 1-5
#email.leave.notification.shift3.cron=00 02 * * 2-6
email.leave.notification.shift2.cron
=
00 00 18 * * 1-5
#email.leave.notification.shift4.cron=30 11 * * 1-5
email.leave.notification.shift3.cron
=
00 00 02 * * 2-6
#email.leave.notification.shift5.cron=30 15 * * 1-5
email.leave.notification.shift4.cron
=
00 30 11 * * 1-5
email.leave.notification.shift5.cron
=
00 30 15 * * 1-5
#spring.thymeleaf.suffix=/WEB-INF/thymeleaf/templates/
#spring.thymeleaf.suffix=/WEB-INF/thymeleaf/templates/
...
@@ -65,3 +66,4 @@ spring.thymeleaf.view-names:thymeleaf/*
...
@@ -65,3 +66,4 @@ spring.thymeleaf.view-names:thymeleaf/*
email.project.notification.template.file.path
=
email/projectMailTemplate.html
email.project.notification.template.file.path
=
email/projectMailTemplate.html
email.project.notification.from
=
mytime.nisum@gmail.com
email.project.notification.from
=
mytime.nisum@gmail.com
email.project.notification.subject
=
Project EndDate Email Notification
email.project.notification.subject
=
Project EndDate Email Notification
email.project.notification.cron
=
00 00 15 * * 1-5
\ No newline at end of file
Write
Preview
Markdown
is supported
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