| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.scheduled;
|
1 |
package com.smartdukaan.cron.scheduled;
|
| 2 |
|
2 |
|
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.io.Serializable;
|
4 |
import java.io.Serializable;
|
| 5 |
import java.sql.Timestamp;
|
5 |
import java.sql.Timestamp;
|
| - |
|
6 |
import java.time.Duration;
|
| 6 |
import java.time.LocalDate;
|
7 |
import java.time.LocalDate;
|
| 7 |
import java.time.LocalDateTime;
|
8 |
import java.time.LocalDateTime;
|
| 8 |
import java.time.LocalTime;
|
9 |
import java.time.LocalTime;
|
| 9 |
import java.time.Month;
|
10 |
import java.time.Month;
|
| - |
|
11 |
import java.time.Period;
|
| 10 |
import java.time.format.DateTimeFormatter;
|
12 |
import java.time.format.DateTimeFormatter;
|
| 11 |
import java.time.temporal.ChronoUnit;
|
13 |
import java.time.temporal.ChronoUnit;
|
| 12 |
import java.util.ArrayList;
|
14 |
import java.util.ArrayList;
|
| 13 |
import java.util.Arrays;
|
15 |
import java.util.Arrays;
|
| 14 |
import java.util.Base64;
|
16 |
import java.util.Base64;
|
| Line 1167... |
Line 1169... |
| 1167 |
// You have been marked absent for half the day. You may contact your manager
|
1169 |
// You have been marked absent for half the day. You may contact your manager
|
| 1168 |
// and get it regularise.\n\nRegards\nHR Team", authUser.getFullName());
|
1170 |
// and get it regularise.\n\nRegards\nHR Team", authUser.getFullName());
|
| 1169 |
} else {
|
1171 |
} else {
|
| 1170 |
LocalDateTime firstPunch = punchTimes.get(0);
|
1172 |
LocalDateTime firstPunch = punchTimes.get(0);
|
| 1171 |
LocalDateTime lastPunch = punchTimes.get(punchTimes.size() - 1);
|
1173 |
LocalDateTime lastPunch = punchTimes.get(punchTimes.size() - 1);
|
| - |
|
1174 |
Duration duration = Duration.between(firstPunch, lastPunch);
|
| 1172 |
boolean hoursCompleted = lastPunch.isAfter(firstPunch.plusHours(8).plusMinutes(30));
|
1175 |
boolean hoursCompleted = lastPunch.isAfter(firstPunch.plusHours(8).plusMinutes(30));
|
| 1173 |
if (!hoursCompleted) {
|
1176 |
if (!hoursCompleted) {
|
| 1174 |
body = String.format(
|
1177 |
body = String.format(
|
| 1175 |
"Dear %s,\n Pls note that you have punched your attendance before 6pm. You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team",
|
1178 |
"Dear %s,\n Pls note that you haven't completed 8.30 Hrs (%d.%d Hrs). You have been marked absent for half the day. You may contact your manager and get it regularise.\n\nRegards\nHR Team",
|
| 1176 |
authUser.getFullName());
|
1179 |
authUser.getFullName(), duration.toHours(), duration.toMinutes() - duration.toHours()*60);
|
| 1177 |
}
|
1180 |
}
|
| 1178 |
}
|
1181 |
}
|
| 1179 |
|
1182 |
|
| 1180 |
}
|
1183 |
}
|
| 1181 |
if (body != null) {
|
1184 |
if (body != null) {
|