수정요청 작업완료.

master
강석 최 2021-12-28 11:58:33 +09:00
parent 4cdd015726
commit 1ca24e5587
11 changed files with 422 additions and 75 deletions

View File

@ -33,7 +33,7 @@ dependencies {
// implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.4'
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
developmentOnly 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.6'
testImplementation 'org.springframework.security:spring-security-test:5.5.1'

View File

@ -107,10 +107,10 @@ public class InfoController {
public ModelAndView modifyRequestDetail(@AuthenticationPrincipal UserInfo loginUser, ModifyRequest modifyRequest){
ModelAndView mav = new ModelAndView("user/modifyRequestDetail");
ModifyRequest request = modifyRequestService.selectModifyRequestByRequestSeq(modifyRequest.getRequestSeq());
mav.addObject("modifyRequest", request);
UserInfo requestUser = userInfoService.selectUserInfoByUserId(request.getCreateId());
switch (request.getRequestType()){
case "userInfo":
mav.addObject("userInfo", userInfoService.selectUserInfoByUserId(request.getCreateId()));
mav.addObject("userInfo", requestUser);
break;
case "categoryRole":
String[] categoryAry = request.getRequestCategoryAry().split(",");
@ -120,10 +120,11 @@ public class InfoController {
}
request.setRequestCategoryList(requestCategoryList);
CategoryRole categoryRole = new CategoryRole();
categoryRole.setUserSeq(loginUser.getUserSeq());
categoryRole.setUserSeq(requestUser.getUserSeq());
mav.addObject("categorySeqList", categoryRoleService.selectCategorySeqListToUser(categoryRole));
break;
}
mav.addObject("modifyRequest", request);
mav.addObject("loginUser", loginUser);
return mav;
}

View File

@ -79,7 +79,7 @@ public class BoardCategoryService {
public String makeFilePath(Integer categorySeq){
BoardCategory category = boardCategoryRepository.findById(categorySeq).orElse(null);
if(category.getParentSeq()==null){
return "D:\\kcgFileManager\\"+category.getCategoryName();
return "C:\\kcgFileManager\\"+category.getCategoryName();
}
return makeFilePath(category.getParentSeq())+"\\"+category.getCategoryName();
}

View File

@ -4,6 +4,7 @@ import com.dbnt.kcgfilemanager.mapper.ModifyRequestMapper;
import com.dbnt.kcgfilemanager.model.ModifyRequest;
import com.dbnt.kcgfilemanager.model.UserInfo;
import com.dbnt.kcgfilemanager.repository.ModifyRequestRepository;
import com.dbnt.kcgfilemanager.repository.UserInfoRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@ -17,7 +18,7 @@ public class ModifyRequestService {
private final ModifyRequestRepository modifyRequestRepository;
private final ModifyRequestMapper modifyRequestMapper;
private final UserInfoService userInfoService;
private final UserInfoRepository userInfoRepository;
private final CategoryRoleService categoryRoleService;
public Integer saveModifyRequest(ModifyRequest modifyRequest) {
@ -78,14 +79,13 @@ public class ModifyRequestService {
switch (modifyRequest.getStatus()){
case "approval":
ModifyRequest request = modifyRequestRepository.findById(modifyRequest.getRequestSeq()).orElse(null);
UserInfo userInfo = userInfoService.selectUserInfoByUserId(modifyRequest.getCreateId());
UserInfo userInfo = userInfoRepository.findByUserId(request.getCreateId()).orElse(null);
switch (request.getRequestType()) {
case "userInfo":
userInfo.setUserId(request.getCreateId());
userInfo.setName(request.getRequestName());
userInfo.setPosition(request.getRequestPosition());
userInfo.setDepartment(request.getRequestDepartment());
userInfoService.updateUserInfo(userInfo);
userInfoRepository.save(userInfo);
break;
case "categoryRole":
String[] categoryAry = request.getRequestCategoryAry().split(",");

View File

@ -1,6 +1,6 @@
spring.devtools.livereload.enabled=true
#?? ??? ?? ??.
#file upload size
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=100MB
@ -11,7 +11,7 @@ spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.cache=false
#mariaDB
#mariaDB & log4jdbc
spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy
spring.datasource.url=jdbc:log4jdbc:mariadb://cks0504.iptime.org:3306/kcg_fm?characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=root

View File

@ -0,0 +1,29 @@
spring.devtools.livereload.enabled=true
#?? ??? ?? ??.
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=100MB
#thymeleaf
spring.thymeleaf.prefix=classpath:templates/
spring.thymeleaf.check-template-location=true
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
#spring.thymeleaf.cache=false
#mariaDB
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
spring.datasource.url=jdbc:mariadb://cks0504.iptime.org:3306/kcg_fm?characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=mariadb#0524
#jpa
spring.jpa.show-sql=true
spring.jpa.generate-ddl=false
spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
# MyBatis
mybatis.mapper-locations: mybatisMapper/**/*.xml
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.type-aliases-package=com.dbnt.kcgfilemanager.model
logging.level.com.atoz_develop.mybatissample.repository=TRACE

View File

@ -32,12 +32,19 @@ $(document).on('click', '#dinialBtn', function (){
$(document).on('click', '#approvalBtn', function (){
if(confirm("요청을 승인 하시겠습니까?")){
const request = $(this)
let flag = true;
if(request.attr("data-requesttype")==="etc"){
flag = confirm("기타 분류의 요청은 직접 요청 내용을 수정해주셔야 합니다.");
}
if(flag){
modifyRequestStatusChange({
requestSeq: $(this).attr("data-requestseq"),
createId: $(this).attr("data-createid"),
requestSeq: request.attr("data-requestseq"),
createId: request.attr("data-createid"),
status: 'approval'
})
}
}
})
function modifyRequestStatusChange(data){

View File

@ -3,6 +3,21 @@
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<div layout:fragment="content" class="pt-3">
<main class="pt-3">
<h4>관리자 메인 페이지</h4>
<div class="row mx-0">
<div class="col-12 card">
<div class="card-body">
<div class="row justify-content-start">
<div class="col-7">
</div>
<div class="col-5">
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</html>

View File

@ -22,6 +22,7 @@
<div class="row border-bottom py-3" th:if="${modifyRequest.requestType != 'etc'}">
<div class="col-12">
<th:block th:if="${modifyRequest.requestType=='userInfo'}">
<th:block th:if="${modifyRequest.status=='wait'}">
<div class="p-3 border rounded">
<div class="row mb-3">
<label for="requestName" class="col-sm-2 col-form-label">이름</label>
@ -74,8 +75,272 @@
</div>
</div>
</th:block>
<th:block th:unless="${modifyRequest.status=='wait'}">
<div class="p-3 border rounded">
<div class="row mb-3">
<label for="modifiedName" class="col-sm-2 col-form-label">이름</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control" id="modifiedName" th:value="${modifyRequest.requestName}">
</div>
</div>
<div class="row mb-3">
<label for="requestDepartment" class="col-sm-2 col-form-label">부서</label>
<div class="col-sm-10">
<th:block th:each="department:${session.departmentList}">
<th:block th:if="${department.codeSq == modifyRequest.requestDepartment}">
<input type="text" readonly class="form-control" id="modifiedDepartment" th:value="${department.value}">
</th:block>
</th:block>
</div>
</div>
<div class="row mb-3">
<label for="requestPosition" class="col-sm-2 col-form-label">직책</label>
<div class="col-sm-10">
<th:block th:each="position:${session.positionList}">
<th:block th:if="${position.codeSq == modifyRequest.requestPosition}">
<input type="text" readonly class="form-control" id="modifiedPosition" th:value="${position.value}">
</th:block>
</th:block>
</div>
</div>
</div>
</th:block>
</th:block>
<th:block th:if="${modifyRequest.requestType=='categoryRole'}">
<div class="p-3">
<th:block th:if="${modifyRequest.status=='wait'}">
<div class="row justify-content-between mb-2">
<div class="col-auto"><button type="button" class="btn btn-info" id="moveLeftBtn"><i class="bi bi-arrow-left"></i></button></div>
<div class="col-auto"><button type="button" class="btn btn-info" id="moveRightBtn"><i class="bi bi-arrow-right"></i></button></div>
</div>
<div class="row overflow-auto flex-nowrap" id="categorySelectBody">
<th:block th:each="depth1:${session.categoryList}">
<div class="col-auto">
<table class="table table-striped">
<thead>
<th:block th:if="${#lists.contains(categorySeqList, depth1.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
<tr class="bg-primary bg-opacity-25">
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
<th>유지</th>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
<tr class="bg-danger bg-opacity-25">
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
<th>삭제</th>
</tr>
</th:block>
</th:block>
<th:block th:unless="${#lists.contains(categorySeqList, depth1.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
<tr class="bg-success bg-opacity-25">
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
<th>추가</th>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
<tr>
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
<th>-</th>
</tr>
</th:block>
</th:block>
<tr>
<th>연도</th>
<th>중분류</th>
<th>소분류</th>
<th>변동</th>
</tr>
</thead>
<tbody>
<th:block th:each="depth2:${depth1.childCategoryList}">
<th:block th:if="${#lists.contains(categorySeqList, depth2.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
<tr class="bg-primary bg-opacity-25">
<td th:text="${depth2.categoryName}"></td>
<td></td>
<td></td>
<td>유지</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
<tr class="bg-danger bg-opacity-25">
<td th:text="${depth2.categoryName}"></td>
<td></td>
<td></td>
<td>삭제</td>
</tr>
</th:block>
</th:block>
<th:block th:unless="${#lists.contains(categorySeqList, depth2.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
<tr class="bg-success bg-opacity-25">
<td th:text="${depth2.categoryName}"></td>
<td></td>
<td></td>
<td>추가</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
<tr>
<td th:text="${depth2.categoryName}"></td>
<td></td>
<td></td>
<td>-</td>
</tr>
</th:block>
</th:block>
<th:block th:each="depth3:${depth2.childCategoryList}">
<th:block th:if="${#lists.contains(categorySeqList, depth3.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
<tr class="bg-primary bg-opacity-25">
<td></td>
<td th:text="${depth3.categoryName}"></td>
<td></td>
<td>유지</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
<tr class="bg-danger bg-opacity-25">
<td></td>
<td th:text="${depth3.categoryName}"></td>
<td></td>
<td>삭제</td>
</tr>
</th:block>
</th:block>
<th:block th:unless="${#lists.contains(categorySeqList, depth3.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
<tr class="bg-success bg-opacity-25">
<td></td>
<td th:text="${depth3.categoryName}"></td>
<td></td>
<td>추가</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
<tr>
<td></td>
<td th:text="${depth3.categoryName}"></td>
<td></td>
<th>-</th>
</tr>
</th:block>
</th:block>
<th:block th:each="depth4:${depth3.childCategoryList}">
<th:block th:if="${#lists.contains(categorySeqList, depth4.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
<tr class="bg-primary bg-opacity-25">
<td></td>
<td></td>
<td th:text="${depth4.categoryName}"></td>
<td>유지</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
<tr class="bg-danger bg-opacity-25">
<td></td>
<td></td>
<td th:text="${depth4.categoryName}"></td>
<td>삭제</td>
</tr>
</th:block>
</th:block>
<th:block th:unless="${#lists.contains(categorySeqList, depth4.categorySeq)}">
<th:block th:if="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
<tr class="bg-success bg-opacity-25">
<td></td>
<td></td>
<td th:text="${depth4.categoryName}"></td>
<td>추가</td>
</tr>
</th:block>
<th:block th:unless="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
<tr>
<td></td>
<td></td>
<td th:text="${depth4.categoryName}"></td>
<td>-</td>
</tr>
</th:block>
</th:block>
</th:block>
</th:block>
</th:block>
</tbody>
</table>
</div>
</th:block>
</div>
</th:block>
<th:block th:unless="${modifyRequest.status=='wait'}">
<div class="row justify-content-between">
<div class="col-auto"><button type="button" class="btn btn-info" id="moveLeftBtn"><i class="bi bi-arrow-left"></i></button></div>
<div class="col-auto"><button type="button" class="btn btn-info" id="moveRightBtn"><i class="bi bi-arrow-right"></i></button></div>
</div>
<div class="row overflow-auto flex-nowrap" id="categorySelectBody">
<th:block th:each="depth1:${session.categoryList}">
<div class="col-auto">
<table class="table table-striped">
<thead>
<tr>
<th>
<input type="checkbox" class="categoryCheckBox parentSeq" th:data-categoryseq="${depth1.categorySeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
</th>
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
</tr>
<tr>
<th></th>
<th>연도</th>
<th>중분류</th>
<th>소분류</th>
</tr>
</thead>
<tbody>
<th:block th:each="depth2:${depth1.childCategoryList}">
<tr>
<td>
<input type="checkbox" class="categoryCheckBox parentSeq"
th:data-categoryseq="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
</td>
<td th:text="${depth2.categoryName}"></td>
<td></td>
<td></td>
</tr>
<th:block th:each="depth3:${depth2.childCategoryList}">
<tr>
<td>
<input type="checkbox" class="categoryCheckBox parentSeq"
th:data-categoryseq="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
</td>
<td></td>
<td th:text="${depth3.categoryName}"></td>
<td></td>
</tr>
<th:block th:each="depth4:${depth3.childCategoryList}">
<tr>
<td>
<input type="checkbox" class="categoryCheckBox" th:data-categoryseq="${depth4.categorySeq}"
th:data-parentseq="${depth4.parentSeq}" th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
</td>
<td></td>
<td></td>
<td th:text="${depth4.categoryName}"></td>
</tr>
</th:block>
</th:block>
</th:block>
</tbody>
</table>
</div>
</th:block>
</div>
</th:block>
</div>
</th:block>
</div>
</div>
@ -94,14 +359,17 @@
</div>
</th:block>
</th:block>
<th:block th:if="${modifyRequest.status=='wait'}">
<th:block th:if="${loginUser.userRole.contains('ADMIN')}">
<div class="row justify-content-between py-3">
<div class="col-auto">
<button class="btn btn-danger" id="dinialBtn" th:data-requestseq="${modifyRequest.requestSeq}"> 거부</button>
</div>
<div class="col-auto">
<button class="btn btn-success" id="approvalBtn" th:data-requestseq="${modifyRequest.requestSeq}" th:data-createid="${modifyRequest.createId}"> 승인</button>
<button class="btn btn-success" id="approvalBtn" th:data-requesttype="${modifyRequest.requestType}"
th:data-requestseq="${modifyRequest.requestSeq}" th:data-createid="${modifyRequest.createId}"> 승인</button>
</div>
</div>
</th:block>
</th:block>
</div>

View File

@ -70,7 +70,7 @@
</div>
</div>
</div>
<div class="col-auto my-auto">
<div class="col-auto my-auto px-0">
<input type="submit" class="btn btn-primary py-4" id="searchBtn" value="검색">
</div>
</div>
@ -145,7 +145,7 @@
</nav>
</div>
<div class="col-auto">
<a class="btn btn-warning mb-2" href="/info/modifyRequestWrite"> 수정 요청</a>
<a class="btn btn-warning mb-2" href="/info/modifyRequestWrite" th:if="${searchParams.userRole=='USER'}"> 수정 요청</a>
</div>
</div>
</div>

View File

@ -125,8 +125,14 @@
<thead>
<tr>
<th>
<th:block th:if="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth1.categorySeq}" th:checked="${#lists.contains(categorySeqList, depth1.categorySeq)}">
</th:block>
<th:block th:unless="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth1.categorySeq}" th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth1.categorySeq)}">
</th:block>
</th>
<th colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
</tr>
@ -141,9 +147,16 @@
<th:block th:each="depth2:${depth1.childCategoryList}">
<tr>
<td>
<th:block th:if="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth2.categorySeq)}">
</th:block>
<th:block th:unless="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth2.categorySeq}" th:data-parentseq="${depth2.parentSeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth2.categorySeq)}">
</th:block>
</td>
<td th:text="${depth2.categoryName}"></td>
<td></td>
@ -152,9 +165,16 @@
<th:block th:each="depth3:${depth2.childCategoryList}">
<tr>
<td>
<th:block th:if="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth3.categorySeq)}">
</th:block>
<th:block th:unless="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth3.categorySeq}" th:data-parentseq="${depth3.parentSeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth3.categorySeq)}">
</th:block>
</td>
<td></td>
<td th:text="${depth3.categoryName}"></td>
@ -163,9 +183,16 @@
<th:block th:each="depth4:${depth3.childCategoryList}">
<tr>
<td>
<input type="checkbox" class="categoryCheckBox" name="categorySeq"
<th:block th:if="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
th:checked="${#lists.contains(categorySeqList, depth4.categorySeq)}">
</th:block>
<th:block th:unless="${type=='new'}">
<input type="checkbox" class="categoryCheckBox parentSeq" name="categorySeq"
th:value="${depth4.categorySeq}" th:data-parentseq="${depth4.parentSeq}"
th:checked="${#lists.contains(modifyRequest.requestCategoryList, depth4.categorySeq)}">
</th:block>
</td>
<td></td>
<td></td>