출퇴근 수정중
This commit is contained in:
parent
e5f73bd852
commit
364991f6b4
@ -44,4 +44,12 @@ public class DateUtils {
|
||||
|
||||
}
|
||||
|
||||
public static String getFormatToStandardDate(String workDt) {
|
||||
|
||||
// LocalDate로 변환
|
||||
LocalDate date = LocalDate.parse(workDt, DateTimeFormatter.ofPattern("yyyy-M-d"));
|
||||
|
||||
// 원하는 형식으로 변환
|
||||
return date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.itn.admin.commute.service;
|
||||
|
||||
import com.itn.admin.commute.mapper.domain.CommuteVO;
|
||||
import com.itn.admin.commute.mapper.domain.ItnCommuteVO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -11,4 +12,6 @@ public interface CommuteService {
|
||||
Map<String, Object> getList(CommuteVO commuteVO);
|
||||
|
||||
Map<String, Object> transfer(CommuteVO commuteVO);
|
||||
|
||||
Map<String, Object> getCommuteList(ItnCommuteVO itnCommuteVO);
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import com.itn.admin.commute.mapper.domain.ItnCommuteGroupVO;
|
||||
import com.itn.admin.commute.mapper.domain.ItnCommuteVO;
|
||||
import com.itn.admin.commute.mapper.domain.UserEnum;
|
||||
import com.itn.admin.commute.service.CommuteService;
|
||||
import com.itn.admin.itn.code.mapper.domain.CodeDetailVO;
|
||||
import com.itn.admin.itn.code.server.CodeDetailService;
|
||||
import com.itn.admin.itn.commute.mapper.ItnCommuteMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -34,6 +36,9 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
@Autowired
|
||||
ItnCommuteMapper itnCommuteMapper;
|
||||
|
||||
@Autowired
|
||||
CodeDetailService codeDetailService;
|
||||
|
||||
|
||||
private static final int PAGE_SIZE = 5;
|
||||
|
||||
@ -50,6 +55,30 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getCommuteList(ItnCommuteVO itnCommuteVO) {
|
||||
// controller에 return
|
||||
|
||||
if(StringUtils.isEmpty(itnCommuteVO.getWorkDt())){
|
||||
Map<String,String> map = DateUtils.getPreviousBusinessDay();
|
||||
itnCommuteVO.setWorkDt(DateUtils.getFormatToStandardDate(map.get("year") +"-"+map.get("month")+"-"+map.get("day")));
|
||||
}
|
||||
|
||||
log.info(":: rsnCode01List :: ");
|
||||
List<CodeDetailVO> codeList = codeDetailService.getDetailsByGroupId("COMMUTE");
|
||||
|
||||
List<ItnCommuteVO> itnCommuteList = itnCommuteMapper.findByWorkDtFromItnCommute(itnCommuteVO.getWorkDt());
|
||||
|
||||
|
||||
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<String, Object>();
|
||||
returnMap.put("itnCommuteList", itnCommuteList);
|
||||
returnMap.put("codeList", codeList);
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> transfer(CommuteVO commuteVO) {
|
||||
List<CommuteVO> commuteList = makeList(commuteVO);
|
||||
@ -59,6 +88,10 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
|
||||
System.out.println("startDate :: "+startDate);
|
||||
String workDt = startDate.split(" ")[0];
|
||||
|
||||
workDt = DateUtils.getFormatToStandardDate(workDt);
|
||||
|
||||
|
||||
Integer groupId = itnCommuteMapper.findByCommuteGroupIdFromItnCommuteWhereWordDt(workDt);
|
||||
|
||||
// groupId가 없으면 groupId insert
|
||||
@ -102,6 +135,7 @@ public class CommuteServiceImpl implements CommuteService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<CommuteVO> makeList(CommuteVO commuteVO){
|
||||
|
||||
|
||||
|
||||
@ -38,20 +38,14 @@ public class CommuteController {
|
||||
@GetMapping(value = "/commute/list_test")
|
||||
public String list_test(@ModelAttribute ItnCommuteVO itnCommuteVO, Model model) {
|
||||
// commuteVO.getWorkDt()를 사용하여 workDt 값에 접근할 수 있습니다.
|
||||
System.out.println("itnCommuteVO.getWorkDt(); : "+ itnCommuteVO.getWorkDt());
|
||||
|
||||
|
||||
// Map<String,String> map = DateUtils.getPreviousBusinessDay();
|
||||
// commuteVO.setSearchYear(map.get("year"));
|
||||
// commuteVO.setSearchMonth(map.get("month"));
|
||||
// commuteVO.setSearchDay(map.get("day"));
|
||||
|
||||
|
||||
|
||||
// Map<String, Object> resultMap = commuteService.getList(itnCommuteVO);
|
||||
|
||||
Map<String, Object> resultMap = commuteService.getCommuteList(itnCommuteVO);
|
||||
//
|
||||
// model.addAttribute("list", resultMap.get("resultList"));
|
||||
// model.addAttribute("commuteVO", resultMap.get("commuteVO"));
|
||||
model.addAttribute("list", resultMap.get("itnCommuteList"));
|
||||
model.addAttribute("codeList", resultMap.get("codeList"));
|
||||
|
||||
return "commute/list";
|
||||
}
|
||||
|
||||
@ -32,4 +32,7 @@ public interface ItnCommuteMapper {
|
||||
void insertCommuteGroup(ItnCommuteGroupVO itnGroupVO);
|
||||
|
||||
void upsertCommuteList(List<ItnCommuteVO> itnCommuteList);
|
||||
|
||||
|
||||
List<ItnCommuteVO> findByWorkDtFromItnCommute(String workDt);
|
||||
}
|
||||
|
||||
@ -139,6 +139,7 @@ public class SpamServiceImpl implements SpamService {
|
||||
}
|
||||
}
|
||||
|
||||
log.info(":: rsnCode01List :: ");
|
||||
List<CodeDetailVO> rsnCode01List = codeDetailService.getDetailsByGroupId("SPAM");
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
@ -35,6 +35,30 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findByWorkDtFromItnCommute" parameterType="String" resultType="itnCommuteVO">
|
||||
|
||||
|
||||
select
|
||||
ic.commute_id
|
||||
,ic.commute_group_id
|
||||
,ic.name
|
||||
,ic.work_dt
|
||||
,ic.start_time
|
||||
,ic.start_rslt
|
||||
,ic.end_time
|
||||
,ic.end_rslt
|
||||
,ic.transfer_dt
|
||||
,ic.approver
|
||||
,ic.approver_dt
|
||||
,ic.pstn
|
||||
from itn_commute ic
|
||||
left join itn_commute_group icg
|
||||
on ic.commute_group_id = icg.commute_group_id
|
||||
where icg.work_dt =#{workDt}
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="upsertCommuteList" parameterType="java.util.List">
|
||||
INSERT INTO itn_commute
|
||||
(commute_group_id, name, pstn, work_dt, start_time, start_rslt, end_time, end_rslt)
|
||||
|
||||
@ -208,37 +208,38 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>박성경</td>
|
||||
<td>2012.11.02 04:38:30</td>
|
||||
<td>미인식</td>
|
||||
<td>2012.11.02 04:38:30</td>
|
||||
<td>미인식</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>박성경</td>
|
||||
<td>2012.11.02 06:47:02</td>
|
||||
<td></td>
|
||||
<td>2012.11.02 07:01:10</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>박성경</td>
|
||||
<td>2012.11.02 07:01:10</td>
|
||||
<td></td>
|
||||
<td>2012.11.02 07:01:10</td>
|
||||
<td>연차(오전)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td>박성경</td>
|
||||
<td>2012.11.02 07:03:21</td>
|
||||
<td></td>
|
||||
<td>2012.11.02 07:05:39</td>
|
||||
<td></td>
|
||||
|
||||
<tr th:each="row, stat : ${list}">
|
||||
<td th:text="${stat.count}"></td>
|
||||
<td th:text="${row.name}"></td>
|
||||
<!-- <td th:text="${row.pstn}"></td>-->
|
||||
<td th:text="${row.startTime}"></td>
|
||||
<!-- startRslt와 파일 업로드 버튼을 같은 <td>에 표시 -->
|
||||
<td>
|
||||
<span th:text="${row.startRslt}"></span>
|
||||
|
||||
<!--[th:if="${row.startRslt} == '지각'"] 버튼이 "지각"일 때만 주석도 함께 렌더링 -->
|
||||
<button type="button"
|
||||
th:if="${row.startRslt} == '지각' or ${row.startRslt} == '미체크'"
|
||||
class="btn btn-warning btn-sm"
|
||||
data-toggle="modal"
|
||||
data-target="#uploadModal"
|
||||
th:attr="data-commute-id=${row.commuteId}, data-name=${row.name}">
|
||||
<i class="fas fa-upload"></i> 파일 업로드
|
||||
</button>
|
||||
</td>
|
||||
<td th:text="${row.endTime}"></td>
|
||||
<td>
|
||||
<span th:text="${row.endRslt}"></span>
|
||||
<button type="button"
|
||||
th:if="${row.endRslt} == '조기퇴근' or ${row.endRslt} == '미체크'"
|
||||
class="btn btn-warning btn-sm"
|
||||
data-toggle="modal"
|
||||
data-target="#uploadModal"
|
||||
th:attr="data-commute-id=${row.commuteId}, data-name=${row.name}">
|
||||
<i class="fas fa-upload"></i> 파일 업로드
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 나머지 행들도 동일한 형식으로 추가 -->
|
||||
</tbody>
|
||||
@ -276,12 +277,73 @@
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
// 모달이 열릴 때 commuteId를 설정하는 이벤트
|
||||
$('#uploadModal').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget); // 파일 업로드 버튼
|
||||
var commuteId = button.data('commute-id'); // 버튼의 data-commute-id 값 읽기
|
||||
var name = button.data('name'); // 버튼의 data-name 값 읽기
|
||||
var modal = $(this);
|
||||
console.log('commuteId : ', commuteId);
|
||||
modal.find('#commuteIdInput').val(commuteId); // 숨겨진 필드에 commuteId 설정
|
||||
modal.find('#modalName').text(name); // 모달 제목의 #modalName 요소에 이름 표시
|
||||
});
|
||||
|
||||
function submitFile() {
|
||||
// 파일 업로드 폼을 제출하는 함수
|
||||
document.getElementById('fileUploadForm').submit();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- 파일 업로드 모달 -->
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="uploadModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="uploadModalLabel"> <span id="modalName"></span> - 수정 </h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="fileUploadForm" method="POST" enctype="multipart/form-data" th:action="@{/uploadFile}">
|
||||
|
||||
<!-- Select 박스 추가 -->
|
||||
<div class="form-group">
|
||||
<label for="fileType">파일 유형 선택</label>
|
||||
<select class="form-control" id="fileType" name="fileType" required>
|
||||
<!-- <option value="">-- 선택 --</option>-->
|
||||
<!-- <option value="type1">유형 1</option>-->
|
||||
<!-- <option value="type2">유형 2</option>-->
|
||||
<!-- <option value="type3">유형 3</option>-->
|
||||
|
||||
<option value="">선택해주세요.</option>
|
||||
<option th:each="code : ${codeList}"
|
||||
th:value="${code.codeId}"
|
||||
th:text="${code.codeName}">
|
||||
<!-- th:selected="${code.codeId} == ${spam.spamRsnCode01}"-->
|
||||
Code
|
||||
</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 파일 선택 -->
|
||||
<div class="form-group">
|
||||
<label for="fileInput">파일 선택</label>
|
||||
<input type="file" class="form-control-file" id="fileInput" name="file" required>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
|
||||
<button type="button" class="btn btn-primary" onclick="submitFile()">업로드(수정)</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user