Commit 9cbf52a4 authored by Vijay Akula's avatar Vijay Akula

Enabled scheduled annotation for sending mail

parent dbfd4b25
......@@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.Scheduled;
import javax.mail.MessagingException;
import java.io.IOException;
import java.time.LocalDateTime;
......@@ -58,7 +58,7 @@ public class LeaveNotificationScheduler {
private SubStatusService subStatusService;
// @Scheduled(cron = "${email.leave.notification.shift1.cron}")
@Scheduled(cron = "${email.leave.notification.shift1.cron}")
public void scheduleLeaveMailForShift1Empls() throws IOException, MessagingException, MyTeamException {
//Shift 1(9:00 AM - 6:00 PM)
logger.info(Shifts.SHIFT1.getShiftType() + " :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
......@@ -66,7 +66,7 @@ public class LeaveNotificationScheduler {
}
// @Scheduled(cron = "${email.leave.notification.shift2.cron}")
@Scheduled(cron = "${email.leave.notification.shift2.cron}")
public void scheduleLeaveMailForShift2Empls() throws IOException, MessagingException, MyTeamException {
//Shift-2(2:00 PM - 11:00 PM)--General Shift
logger.info(Shifts.SHIFT2.getShiftType() + " :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
......@@ -74,7 +74,7 @@ public class LeaveNotificationScheduler {
}
// @Scheduled(cron = "${email.leave.notification.shift3.cron}")
@Scheduled(cron = "${email.leave.notification.shift3.cron}")
public void scheduleLeaveMailForShift3Empls() throws IOException, MessagingException, MyTeamException {
//Shift 3(10:00 PM - 6:00 AM)
logger.info(Shifts.SHIFT3.getShiftType() + " :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
......@@ -82,7 +82,7 @@ public class LeaveNotificationScheduler {
}
//@Scheduled(cron = "${email.leave.notification.shift4.cron}")
@Scheduled(cron = "${email.leave.notification.shift4.cron}")
public void scheduleLeaveMailForShift4Empls() throws IOException, MessagingException, MyTeamException {
//Shift 4(7:30 AM - 3:30 PM)
logger.info(Shifts.SHIFT4.getShiftType() + " :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
......@@ -90,7 +90,7 @@ public class LeaveNotificationScheduler {
}
//@Scheduled(cron = "${email.leave.notification.shift5.cron}")
@Scheduled(cron = "${email.leave.notification.shift5.cron}")
public void scheduleLeaveMailForShift5Empls() throws IOException, MessagingException, MyTeamException {
//Shift 5(11:30 AM - 7:30 PM)
logger.info(Shifts.SHIFT5.getShiftType() + " :: Execution Time - {}", dateTimeFormatter.format(LocalDateTime.now()));
......@@ -104,13 +104,13 @@ public class LeaveNotificationScheduler {
Map<String, Object> model = new HashMap<String, Object>();
String currentDate = dateTimeFormatter.format(LocalDateTime.now());
String functionalGroupName;
final String mailSubject = environment.getProperty("email.leave.notification.subject").concat("for the day::").concat(MyTeamDateUtils.FormatTodaysDate());
final String mailSubject = String.valueOf("Date::").concat(MyTeamDateUtils.FormatTodaysDate() + "::").concat(environment.getProperty("email.leave.notification.subject"));
Employee employee;
String empSubStatus;
try {
if (!MyTeamDateUtils.isTodayHoliday(environment.getProperty("email.holidays.list.2019", ""))) {
if (!MyTeamDateUtils.isTodayHoliday(environment.getProperty("email.holidays.list.2019", "14-01-2019,21-03-2019,19-04-2019,05-06-2019,12-08-2019,15-08-2019,02-09-2019,02-10-2019,08-10-2019,25-12-2019"))) {
List<AttendenceData> attendenceList = attendanceService.getAttendanciesReport(currentDate, shift);
List<AttendenceData> absentiesList = attendenceList.stream()
......
......@@ -65,5 +65,5 @@ email.project.notification.subject=Project EndDate Email Notification
email.project.notification.cron=00 00 15 * * 1-5
spring.profiles.active=development
spring.profiles.active=production
message=this is from default configuration
\ 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