지각 / 조기퇴근 체크

This commit is contained in:
hylee 2024-02-21 10:25:39 +09:00
parent fbcec14177
commit aa5915b4e7
3 changed files with 53 additions and 1 deletions

View File

@ -53,6 +53,10 @@ public class CommuteVO implements Serializable {
private String firstActivityTime; private String firstActivityTime;
private String lastActivityTime; private String lastActivityTime;
private String firstActivityTimeMemo;
private String lastActivityTimeMemo;
private String startDate; private String startDate;
private String endDate; private String endDate;

View File

@ -73,8 +73,14 @@ public class CommuteServiceImpl implements CommuteService {
} }
commuteList.stream().forEach(t->{ commuteList.stream().forEach(t->{
System.out.println(t.getFirstActivityTime());
t.setFirstActivityTimeMemo(this.getLateChk(t.getFirstActivityTime()));
t.setLastActivityTimeMemo(this.getLeaveWorkEarly(t.getLastActivityTime()));
if(StringUtils.isNotEmpty(t.getUsrid())){ if(StringUtils.isNotEmpty(t.getUsrid())){
System.out.println("t.getUsrid() :: "+ t.getUsrid());
try { try {
t.setUsrid(UserEnum.valueOfLabel(t.getUsrid()).userName()); t.setUsrid(UserEnum.valueOfLabel(t.getUsrid()).userName());
}catch (Exception e){ }catch (Exception e){
@ -90,4 +96,40 @@ public class CommuteServiceImpl implements CommuteService {
return map; return map;
} }
private String getLeaveWorkEarly(String p_lastActivityTime) {
// DateTimeFormatter를 사용하여 String을 LocalDateTime으로 파싱
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime firstActivityTime = LocalDateTime.parse(p_lastActivityTime, formatter);
// 체크하고자 하는 시간 설정 (09:30)
LocalTime checkTime = LocalTime.of(18, 30);
// firstActivityTime의 시간 부분만 추출
LocalTime activityTime = firstActivityTime.toLocalTime();
// activityTime이 checkTime보다 이후인지 확인
if (activityTime.isBefore(checkTime)) {
return "조기퇴근";
}
return "";
}
private static String getLateChk(String p_firstActivityTime) {
// DateTimeFormatter를 사용하여 String을 LocalDateTime으로 파싱
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime firstActivityTime = LocalDateTime.parse(p_firstActivityTime, formatter);
// 체크하고자 하는 시간 설정 (09:30)
LocalTime checkTime = LocalTime.of(9, 30);
// firstActivityTime의 시간 부분만 추출
LocalTime activityTime = firstActivityTime.toLocalTime();
// activityTime이 checkTime보다 이후인지 확인
if (activityTime.isAfter(checkTime)) {
return "지각";
}
return "";
}
} }

View File

@ -104,7 +104,9 @@
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>출근</th> <th>출근</th>
<th>비고</th>
<th>퇴근</th> <th>퇴근</th>
<th>비고</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -112,7 +114,9 @@
<td th:text="${stat.count}"></td> <td th:text="${stat.count}"></td>
<td th:text="${row.usrid}"></td> <td th:text="${row.usrid}"></td>
<td th:text="${row.firstActivityTime}"></td> <td th:text="${row.firstActivityTime}"></td>
<td th:text="${row.firstActivityTimeMemo}"></td>
<td th:text="${row.lastActivityTime}"></td> <td th:text="${row.lastActivityTime}"></td>
<td th:text="${row.LastActivityTimeMemo}"></td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>
@ -120,7 +124,9 @@
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>출근</th> <th>출근</th>
<th>비고</th>
<th>퇴근</th> <th>퇴근</th>
<th>비고</th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>