Commit 57d20a53 authored by Vijay Akula's avatar Vijay Akula

Configured cron expresions from the properties file

parent 508ac6d9
...@@ -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()));
......
...@@ -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");
......
...@@ -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
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