출퇴근 관리 템플릿 정보 수정 (+화면, 직위 추가)

This commit is contained in:
hylee 2024-08-29 11:22:57 +09:00
parent 1c3e25eee4
commit bb47656bb8
4 changed files with 51 additions and 29 deletions

View File

@ -48,6 +48,7 @@ public class CommuteVO implements Serializable {
private int tmznNegtv; private int tmznNegtv;
private String usrudtbydev; private String usrudtbydev;
private String hint; private String hint;
private String pstn;
private int temper; private int temper;
private String firstActivityTime; private String firstActivityTime;

View File

@ -6,38 +6,40 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
public enum UserEnum { public enum UserEnum {
user1("&@~PYfUBsF+m99kduT53j1Stw==","조용준(개발BB)") user1("&@~PYfUBsF+m99kduT53j1Stw==","조용준", "본부장")
,user2("&@~C33DuWpcSL7Krvh2zAByUQ==","박진순") ,user2("&@~C33DuWpcSL7Krvh2zAByUQ==","박진순", "팀장")
,user3("&@~9+BQUtRi1cuWOaIqeCYdAA==","우영두") ,user3("&@~9+BQUtRi1cuWOaIqeCYdAA==","우영두", "팀장")
,user4("&@~peUfyxpLvs6RN9X4waktzQ==","원영현") ,user4("&@~peUfyxpLvs6RN9X4waktzQ==","원영현", "과장")
,user5("&@~tBRefZ81JCbrXNyRkjZNGQ==","이호영") ,user5("&@~tBRefZ81JCbrXNyRkjZNGQ==","이호영", "대리")
,user6("&@~X0eEqUF71/pD/Z0KPKysrA==","이지우") ,user6("&@~X0eEqUF71/pD/Z0KPKysrA==","이지우", "대리")
,user7("&@~vYMXghVqtoDFuflcGxm5TA==","이준호") ,user7("&@~vYMXghVqtoDFuflcGxm5TA==","이준호", "대리")
,user8("&@~Z/Uti3tzksl96ByRRZT7AQ==","유인식") ,user8("&@~Z/Uti3tzksl96ByRRZT7AQ==","유인식", "대표")
,user9("&@~zO4oUG4dNtiVfnDdfCWM2A==","장영익") ,user9("&@~zO4oUG4dNtiVfnDdfCWM2A==","장영익", "실장")
,user10("&@~O+736xoPn0FzMuPQufff1w==","김상훈") ,user10("&@~O+736xoPn0FzMuPQufff1w==","김상훈", "본부장")
,user11("&@~E8RB3p27IfRVEhNefMu2Vw==","김보미") ,user11("&@~E8RB3p27IfRVEhNefMu2Vw==","김보미", "대리")
,user12("&@~47amAycYJ4ZT8BZDi6a2sA==","이설희") ,user12("&@~47amAycYJ4ZT8BZDi6a2sA==","이설희", "주임")
,user13("&@~KPBL+GIy7i2agV7V57MZWg==","정다은") ,user13("&@~KPBL+GIy7i2agV7V57MZWg==","정다은", "대리")
,user14("&@~HM2dbaHcmk8bIMYKO2uIRg==","장건영") ,user15("&@~S6vaRrMJmeRjp0T8z+/ybg==","강민경", "팀장")
,user15("&@~S6vaRrMJmeRjp0T8z+/ybg==","강민경") ,user16("&@~7mpJXFU+euFUNEdHmHLQVQ==","정수빈", "대리")
,user16("&@~7mpJXFU+euFUNEdHmHLQVQ==","정수빈") ,user17("&@~+BL2FKvmIQc/jIyHvz0jew==","박은지", "주임")
,user17("&@~+BL2FKvmIQc/jIyHvz0jew==","박은지") ,user18("&@~6MWcZ9FnikUCQ8NTFDqHHQ==","itn6", "")
,user18("&@~6MWcZ9FnikUCQ8NTFDqHHQ==","itn6") // ,user19("&@~8v+/5tt7+aiF/GuAhT37Xw==","S고수빈")
,user19("&@~8v+/5tt7+aiF/GuAhT37Xw==","S고수빈") // ,user20("&@~CQiMHkwkUohlvmCXqtzFLA==","S나은총")
,user20("&@~CQiMHkwkUohlvmCXqtzFLA==","S나은총") // ,user21("&@~l+Zs/I7piSIFu9WBQaI1eg==","S최보빈")
,user21("&@~l+Zs/I7piSIFu9WBQaI1eg==","S최보빈") // ,user22("&@~a3gLGVKYRjCon1hss1TQtQ==","S이윤서")
,user22("&@~a3gLGVKYRjCon1hss1TQtQ==","S이윤서") // ,user23("&@~1M3p31Kvc+zVi2IMgvazHw==","S한승아")
,user23("&@~1M3p31Kvc+zVi2IMgvazHw==","S한승아") // ,user24("&@~/GE8OIrOSbOevc+sViEvbg==","S장수진")
,user24("&@~/GE8OIrOSbOevc+sViEvbg==","S장수진") // ,user14("&@~HM2dbaHcmk8bIMYKO2uIRg==","장건영")
; ;
private final String label; private final String label;
private final String userName; private final String userName;
private final String pstn;
UserEnum(String label, String userName){ UserEnum(String label, String userName, String pstn){
this.label = label; this.label = label;
this.userName = userName; this.userName = userName;
this.pstn = pstn;
} }
public String label() { public String label() {
@ -46,6 +48,9 @@ public enum UserEnum {
public String userName() { public String userName() {
return userName; return userName;
} }
public String pstn() {
return pstn;
}
private static final Map<String, UserEnum> BY_LABEL = private static final Map<String, UserEnum> BY_LABEL =
Stream.of(values()).collect(Collectors.toMap(UserEnum::label, Function.identity())); Stream.of(values()).collect(Collectors.toMap(UserEnum::label, Function.identity()));

View File

@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.Collator;
import java.time.DayOfWeek; import java.time.DayOfWeek;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -72,7 +73,8 @@ public class CommuteServiceImpl implements CommuteService {
List<CommuteVO> commuteList = new ArrayList<>(); List<CommuteVO> commuteList = new ArrayList<>();
try { try {
commuteList = commuteMapper.findAll(commuteVO); // commuteList = commuteMapper.findAll(commuteVO);
commuteList = new ArrayList<>(commuteMapper.findAll(commuteVO));
}catch (Exception e){ }catch (Exception e){
// 월별로 테이블이 생성되는데 // 월별로 테이블이 생성되는데
// 없는 테이블을 select하면 Exception이 발생함 // 없는 테이블을 select하면 Exception이 발생함
@ -90,13 +92,18 @@ public class CommuteServiceImpl implements CommuteService {
if(StringUtils.isNotEmpty(t.getUsrid())){ if(StringUtils.isNotEmpty(t.getUsrid())){
try { try {
t.setUsrid(UserEnum.valueOfLabel(t.getUsrid()).userName()); UserEnum userEnum = UserEnum.valueOfLabel(t.getUsrid());
t.setUsrid(userEnum.userName());
t.setPstn(userEnum.pstn());
}catch (Exception e){ }catch (Exception e){
t.setUsrid("등록해야함"); t.setUsrid("등록해야함");
} }
} }
}); });
// 출근안한사람 체크하기 // 출근안한사람 체크하기
for (UserEnum user : UserEnum.values()) { for (UserEnum user : UserEnum.values()) {
// commuteList에서 해당 userName을 가진 CommuteVO 객체가 있는지 검사 // commuteList에서 해당 userName을 가진 CommuteVO 객체가 있는지 검사
@ -112,12 +119,18 @@ public class CommuteServiceImpl implements CommuteService {
if (!found) { if (!found) {
CommuteVO commuteTempVO = new CommuteVO(); CommuteVO commuteTempVO = new CommuteVO();
commuteTempVO.setUsrid(user.userName()); // UserEnum에서 가져온 userName 설정 commuteTempVO.setUsrid(user.userName()); // UserEnum에서 가져온 userName 설정
commuteTempVO.setPstn(user.pstn()); // UserEnum에서 가져온 직위 설정
commuteTempVO.setFirstActivityTime("-"); // 기본값 설정 commuteTempVO.setFirstActivityTime("-"); // 기본값 설정
commuteTempVO.setLastActivityTime("-"); // 기본값 설정 commuteTempVO.setLastActivityTime("-"); // 기본값 설정
commuteList.add(commuteTempVO); // 수정된 리스트에 추가 commuteList.add(commuteTempVO); // 수정된 리스트에 추가
} }
} }
commuteList.removeIf(t -> "유인식".equals(t.getUsrid())
|| "itn6".equals(t.getUsrid())
);
// controller에 return // controller에 return
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();

View File

@ -103,6 +103,7 @@
<tr> <tr>
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>직위</th>
<th>출근</th> <th>출근</th>
<th>비고</th> <th>비고</th>
<th>퇴근</th> <th>퇴근</th>
@ -111,8 +112,9 @@
</thead> </thead>
<tbody> <tbody>
<tr th:each="row, stat : ${list}"> <tr th:each="row, stat : ${list}">
<td th:text="${stat.count}"></td> <td th:text="${commuteVO.searchYear + '-' + commuteVO.searchMonth + '-' + commuteVO.searchDay}"></td>
<td th:text="${row.usrid}"></td> <td th:text="${row.usrid}"></td>
<td th:text="${row.pstn}"></td>
<td th:text="${row.firstActivityTime}"></td> <td th:text="${row.firstActivityTime}"></td>
<td th:text="${row.firstActivityTimeMemo}"></td> <td th:text="${row.firstActivityTimeMemo}"></td>
<td th:text="${row.lastActivityTime}"></td> <td th:text="${row.lastActivityTime}"></td>
@ -124,6 +126,7 @@
<th></th> <th></th>
<th>Name</th> <th>Name</th>
<th>출근</th> <th>출근</th>
<th>직위</th>
<th>비고</th> <th>비고</th>
<th>퇴근</th> <th>퇴근</th>
<th>비고</th> <th>비고</th>