| Line 1104... |
Line 1104... |
| 1104 |
"PFA", attachment);
|
1104 |
"PFA", attachment);
|
| 1105 |
|
1105 |
|
| 1106 |
}
|
1106 |
}
|
| 1107 |
|
1107 |
|
| 1108 |
public void sendAttendanceMorningAlert() throws Exception {
|
1108 |
public void sendAttendanceMorningAlert() throws Exception {
|
| 1109 |
LocalDateTime moriningTime = LocalDate.now().atTime(10, 45);
|
1109 |
LocalDateTime moriningTime = LocalDate.now().atTime(10, 30);
|
| 1110 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1110 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| 1111 |
Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x->x.isActive()).collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
1111 |
Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x->x.isActive()).collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
| 1112 |
|
1112 |
|
| 1113 |
List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
|
1113 |
List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
|
| 1114 |
Map<String, User> userMap = users.stream().collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
1114 |
Map<String, User> userMap = users.stream().collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
| Line 1123... |
Line 1123... |
| 1123 |
User user = userMap.get(authUser.getEmailId());
|
1123 |
User user = userMap.get(authUser.getEmailId());
|
| 1124 |
Optional<EmployeeAttendance> employeeAttendanceOptional = employeeMorningAttendance.get(user.getId());
|
1124 |
Optional<EmployeeAttendance> employeeAttendanceOptional = employeeMorningAttendance.get(user.getId());
|
| 1125 |
if(employeeAttendanceOptional==null
|
1125 |
if(employeeAttendanceOptional==null
|
| 1126 |
|| employeeAttendanceOptional.orElse(null)==null
|
1126 |
|| employeeAttendanceOptional.orElse(null)==null
|
| 1127 |
|| employeeAttendanceOptional.get().getCreateTimestamp().isAfter(moriningTime)) {
|
1127 |
|| employeeAttendanceOptional.get().getCreateTimestamp().isAfter(moriningTime)) {
|
| 1128 |
String body = String.format("Dear %s,\n Pls note that you haven't punched your attendance by 10:45am. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team", authUser.getFullName());
|
1128 |
String body = String.format("Dear %s,\n Pls note that you haven't punched your attendance by 10:30am. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team", authUser.getFullName());
|
| 1129 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { authUser.getEmailId() }, new String[] { "jyoti.rawat@smartdukaan.com" }, "Attendance Alert",
|
1129 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { authUser.getEmailId() }, new String[] { "jyoti.rawat@smartdukaan.com" }, "Attendance Alert",
|
| 1130 |
body);
|
1130 |
body);
|
| 1131 |
}
|
1131 |
}
|
| 1132 |
}
|
1132 |
}
|
| 1133 |
|
1133 |
|
| 1134 |
}
|
1134 |
}
|
| 1135 |
|
1135 |
|
| 1136 |
public void sendAttendanceEveningAlert() throws Exception {
|
1136 |
public void sendAttendanceEveningAlert() throws Exception {
|
| 1137 |
LocalDateTime eveningTime = LocalDate.now().atTime(18, 0);
|
- |
|
| 1138 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
1137 |
List<AuthUser> authUsers = authRepository.selectAllActiveUser();
|
| 1139 |
Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x->x.isActive()).collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
1138 |
Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x->x.isActive()).collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
| 1140 |
|
1139 |
|
| 1141 |
List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
|
1140 |
List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
|
| 1142 |
Map<String, User> userMap = users.stream().collect(Collectors.toMap(x->x.getEmailId(), x->x));
|
1141 |
Map<String, User> userMap = users.stream().collect(Collectors.toMap(x->x.getEmailId(), x->x));
|