Subversion Repositories SmartDukaan

Rev

Rev 28792 | Rev 28794 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28792 Rev 28793
Line 1105... Line 1105...
1105
				"PFA", attachment);
1105
				"PFA", attachment);
1106
 
1106
 
1107
	}
1107
	}
1108
 
1108
 
1109
	public void sendAttendanceMorningAlert() throws Exception {
1109
	public void sendAttendanceMorningAlert() throws Exception {
1110
		LocalDateTime moriningTime = LocalDate.now().atTime(10, 30);
1110
		LocalDateTime moriningTime = LocalDate.now().atTime(10, 31);
1111
		List<AuthUser> authUsers = authRepository.selectAllActiveUser();
1111
		List<AuthUser> authUsers = authRepository.selectAllActiveUser();
1112
		Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x -> x.isActive())
1112
		Map<String, AuthUser> authUserEmailMap = authUsers.stream().filter(x -> x.isActive())
1113
				.collect(Collectors.toMap(x -> x.getEmailId(), x -> x));
1113
				.collect(Collectors.toMap(x -> x.getEmailId(), x -> x));
1114
 
1114
 
1115
		List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
1115
		List<User> users = dtrUserRepository.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.keySet()));
Line 1129... Line 1129...
1129
					|| employeeAttendanceOptional.get().getCreateTimestamp().isAfter(moriningTime)) {
1129
					|| employeeAttendanceOptional.get().getCreateTimestamp().isAfter(moriningTime)) {
1130
				String body = String.format(
1130
				String body = String.format(
1131
						"Dear %s,\n Pls note that you haven't punched your attendance by 10:30am%s. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team",
1131
						"Dear %s,\n Pls note that you haven't punched your attendance by 10:30am%s. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team",
1132
						authUser.getFullName(), (employeeAttendanceOptional == null || employeeAttendanceOptional.orElse(null) == null) ? "" 
1132
						authUser.getFullName(), (employeeAttendanceOptional == null || employeeAttendanceOptional.orElse(null) == null) ? "" 
1133
								: "(Punched at " + FormattingUtils.format(employeeAttendanceOptional.get().getCreateTimestamp()) +")" );
1133
								: "(Punched at " + FormattingUtils.format(employeeAttendanceOptional.get().getCreateTimestamp()) +")" );
1134
				// Utils.sendMailWithAttachments(googleMailSender, new String[] {
1134
				Utils.sendMailWithAttachments(googleMailSender, new String[] {
1135
				// authUser.getEmailId() }, new String[] { "jyoti.rawat@smartdukaan.com" },
1135
				authUser.getEmailId() }, new String[] { "jyoti.rawat@smartdukaan.com" },
1136
				// "Attendance Alert",
1136
				"Attendance Alert", body);
1137
				Utils.sendMailWithAttachments(googleMailSender, new String[] { "amit.gupta@shop2020.in" },
-
 
1138
						new String[] { "jyoti.rawat@smartdukaan.com" }, "Attendance Alert", body);
-
 
1139
				i++;
-
 
1140
				if (i == 5)
-
 
1141
					break;
-
 
1142
			}
1137
			}
1143
		}
1138
		}
1144
 
1139
 
1145
	}
1140
	}
1146
 
1141