디폴트 날짜 : 전날
- 수정: 전날이 주말일 경우 전주 금요일로 수정 연차 반차 리스트에 안나옴 - 리스트 나오게 수정 출근 퇴근 시간은 -로 입력함
This commit is contained in:
parent
aa5915b4e7
commit
2e5c30b930
@ -7,7 +7,7 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum UserEnum {
|
||||
user1("&@~PYfUBsF+m99kduT53j1Stw==","조용준")
|
||||
user1("&@~PYfUBsF+m99kduT53j1Stw==","조용준(개발BB)")
|
||||
,user2("&@~C33DuWpcSL7Krvh2zAByUQ==","박진순")
|
||||
,user3("&@~9+BQUtRi1cuWOaIqeCYdAA==","우영두")
|
||||
,user4("&@~peUfyxpLvs6RN9X4waktzQ==","원영현")
|
||||
|
||||
@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
@ -36,6 +37,12 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
// 현재 날짜 구하기
|
||||
LocalDate now = LocalDate.now().minusDays(1);
|
||||
|
||||
// 만약 전날이 토요일(7) 또는 일요일(1)이면 금요일로 설정
|
||||
if (now.getDayOfWeek() == DayOfWeek.SATURDAY) {
|
||||
now = now.minusDays(1); // 토요일이면 금요일로
|
||||
} else if (now.getDayOfWeek() == DayOfWeek.SUNDAY) {
|
||||
now = now.minusDays(2); // 일요일이면 금요일로
|
||||
}
|
||||
// 년도 구하기
|
||||
String year = String.valueOf(now.getYear());
|
||||
|
||||
@ -73,10 +80,11 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
}
|
||||
|
||||
commuteList.stream().forEach(t->{
|
||||
System.out.println(t.getFirstActivityTime());
|
||||
|
||||
|
||||
// 지각 체크
|
||||
t.setFirstActivityTimeMemo(this.getLateChk(t.getFirstActivityTime()));
|
||||
// 조기퇴근 체크
|
||||
t.setLastActivityTimeMemo(this.getLeaveWorkEarly(t.getLastActivityTime()));
|
||||
|
||||
|
||||
@ -88,6 +96,28 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 출근안한사람 체크하기
|
||||
for (UserEnum user : UserEnum.values()) {
|
||||
// commuteList에서 해당 userName을 가진 CommuteVO 객체가 있는지 검사
|
||||
boolean found = false; // userName을 가진 객체의 존재 여부
|
||||
for (CommuteVO commuteTempVO : commuteList) {
|
||||
if (commuteTempVO.getUsrid().equals(user.userName())) {
|
||||
found = true;
|
||||
break; // 해당 userName을 가진 객체를 찾으면 반복 중단
|
||||
}
|
||||
}
|
||||
|
||||
// 해당 userName을 가진 객체가 리스트에 없으면 새로운 CommuteVO 객체를 추가
|
||||
if (!found) {
|
||||
CommuteVO commuteTempVO = new CommuteVO();
|
||||
commuteTempVO.setUsrid(user.userName()); // UserEnum에서 가져온 userName 설정
|
||||
commuteTempVO.setFirstActivityTime("-"); // 기본값 설정
|
||||
commuteTempVO.setLastActivityTime("-"); // 기본값 설정
|
||||
commuteList.add(commuteTempVO); // 수정된 리스트에 추가
|
||||
}
|
||||
}
|
||||
|
||||
// controller에 return
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user