| Line 1111... |
Line 1111... |
| 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));
|
| 1115 |
|
1115 |
|
| 1116 |
List<EmployeeAttendance> employeeAttendances = employeeAttendanceRepository.selectAllByDatesBetween(LocalDate.now().atStartOfDay(), LocalDateTime.now())
|
1116 |
List<EmployeeAttendance> employeeAttendances = employeeAttendanceRepository.selectAllByDatesBetween(LocalDate.now().atStartOfDay(), LocalDateTime.now());
|
| 1117 |
.stream().filter(x->x.getPunchType().equals(PunchType.ONSITE)).collect(Collectors.toList());
|
- |
|
| - |
|
1117 |
|
| 1118 |
Map<Integer, Optional<EmployeeAttendance>> employeeMorningAttendance = employeeAttendances.stream().collect(Collectors.groupingBy(EmployeeAttendance::getUserId,
|
1118 |
Map<Integer, Optional<EmployeeAttendance>> employeeMorningAttendance = employeeAttendances.stream().collect(Collectors.groupingBy(EmployeeAttendance::getUserId,
|
| 1119 |
Collectors.minBy(Comparator.comparing(EmployeeAttendance::getCreateTimestamp)
|
1119 |
Collectors.minBy(Comparator.comparing(EmployeeAttendance::getCreateTimestamp)
|
| 1120 |
)));
|
1120 |
)));
|
| 1121 |
|
1121 |
|
| 1122 |
for(AuthUser authUser: authUsers) {
|
1122 |
for(AuthUser authUser: authUsers) {
|
| 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.orElseGet(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: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());
|
| 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 |
break;
|
1131 |
break;
|