대시보드 설정 작업중.

강석 최 2022-10-12 18:22:20 +09:00
parent 7a5c20c02d
commit cbd12550df
8 changed files with 87 additions and 145 deletions

View File

@ -3,9 +3,12 @@ package com.dbnt.faisp.userInfo;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import com.dbnt.faisp.userInfo.service.UserInfoService; import com.dbnt.faisp.userInfo.service.UserInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -18,4 +21,12 @@ public class UserInfoController {
public String insertUserInfo(UserInfo insertReqInfo) { public String insertUserInfo(UserInfo insertReqInfo) {
return userInfoService.insertUserInfo(insertReqInfo); return userInfoService.insertUserInfo(insertReqInfo);
} }
@GetMapping("/myInfo")
public ModelAndView myInfoPage(@AuthenticationPrincipal UserInfo loginUser){
ModelAndView mav = new ModelAndView("user/myInfo");
mav.addObject("userInfo", loginUser);
mav.addObject("dashboardConfig", userInfoService.getDashboardConfigList(loginUser.getUserSeq()));
return mav;
}
} }

View File

@ -0,0 +1,36 @@
package com.dbnt.faisp.userInfo.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "dashboard_config")
@IdClass(DashboardConfig.DashboardConfigId.class)
public class DashboardConfig {
@Id
@Column(name = "menu_key")
private Integer menuKey;
@Id
@Column(name = "user_seq")
private Integer userSeq;
@Column(name = "order_num")
private Integer orderNum;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class DashboardConfigId implements Serializable {
private Integer menuKey;
private Integer userSeq;
}
}

View File

@ -0,0 +1,12 @@
package com.dbnt.faisp.userInfo.repository;
import com.dbnt.faisp.userInfo.model.DashboardConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface DashboardConfigRepository extends JpaRepository<DashboardConfig, DashboardConfig.DashboardConfigId> {
List<DashboardConfig> findByUserSeqOrderByOrderNum(Integer userSeq);
}

View File

@ -2,7 +2,9 @@ package com.dbnt.faisp.userInfo.service;
import com.dbnt.faisp.config.Role; import com.dbnt.faisp.config.Role;
import com.dbnt.faisp.userInfo.mapper.UserInfoMapper; import com.dbnt.faisp.userInfo.mapper.UserInfoMapper;
import com.dbnt.faisp.userInfo.model.DashboardConfig;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import com.dbnt.faisp.userInfo.repository.DashboardConfigRepository;
import com.dbnt.faisp.userInfo.repository.UserInfoRepository; import com.dbnt.faisp.userInfo.repository.UserInfoRepository;
import com.dbnt.faisp.util.ParamMap; import com.dbnt.faisp.util.ParamMap;
@ -22,6 +24,7 @@ import java.util.List;
public class UserInfoService implements UserDetailsService { public class UserInfoService implements UserDetailsService {
private final UserInfoRepository userInfoRepository; private final UserInfoRepository userInfoRepository;
private final DashboardConfigRepository dashboardConfigRepository;
private final UserInfoMapper userInfoMapper; private final UserInfoMapper userInfoMapper;
@Transactional @Transactional
@ -112,4 +115,8 @@ public class UserInfoService implements UserDetailsService {
public List<ParamMap> selectManagerList(ParamMap param) { public List<ParamMap> selectManagerList(ParamMap param) {
return userInfoMapper.selectManagerList(param); return userInfoMapper.selectManagerList(param);
} }
public List<DashboardConfig> getDashboardConfigList(Integer userSeq) {
return dashboardConfigRepository.findByUserSeqOrderByOrderNum(userSeq);
}
} }

View File

@ -1,8 +1,6 @@
package com.dbnt.faisp.userInfo; package com.dbnt.faisp.userInfo;
import com.dbnt.faisp.authMgt.service.AuthMgtService;
import com.dbnt.faisp.codeMgt.service.CodeMgtService; import com.dbnt.faisp.codeMgt.service.CodeMgtService;
import com.dbnt.faisp.menuMgt.service.MenuMgtService;
import com.dbnt.faisp.userInfo.service.UserInfoService; import com.dbnt.faisp.userInfo.service.UserInfoService;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -18,16 +16,14 @@ import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/userMgt") @RequestMapping("/userMgt")
public class userMgtController { public class userMgtController {
private final MenuMgtService menuMgtService;
private final UserInfoService userInfoService; private final UserInfoService userInfoService;
private final AuthMgtService authMgtService;
private final CodeMgtService codeMgtService; private final CodeMgtService codeMgtService;
@GetMapping("/userMgtPage") @GetMapping("/userMgtPage")
public ModelAndView codeMgtPage(UserInfo userInfo) { public ModelAndView codeMgtPage(UserInfo userInfo) {
ModelAndView mav = new ModelAndView("adminPage/userMgt/userMgt"); ModelAndView mav = new ModelAndView("adminPage/userMgt/userMgt");
userInfo.setQueryInfo(); userInfo.setQueryInfo();
if(userInfo.getUserStatus() == "" || userInfo.getUserStatus() == null) { if(userInfo.getUserStatus().equals("") || userInfo.getUserStatus() == null) {
userInfo.setUserStatus("USC003"); userInfo.setUserStatus("USC003");
} }
mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo)); mav.addObject("userInfoList", userInfoService.selectUserInfoList(userInfo));

View File

@ -1,5 +1,5 @@
$(function (){ $(function (){
tableSort();
}) })
$(document).on('click', '#savePasswordBtn', function (){ $(document).on('click', '#savePasswordBtn', function (){
@ -60,27 +60,4 @@ function passwordCheck(){
} }
} }
return returnFlag; return returnFlag;
}
function tableSort(){
$("#categorySelectBody").find("tbody").each(function (idx, tbody){
let lastCategorySeq = 0
$(tbody).find(".depth2Td").each(function (idx, td){
lastCategorySeq = removeInnerText(td, lastCategorySeq);
})
$(tbody).find(".depth3Td").each(function (idx, td){
lastCategorySeq = removeInnerText(td, lastCategorySeq);
})
})
}
function removeInnerText(td, lastCategorySeq){
const categorySeq = Number($(td).attr("data-categoryseq"));
if(lastCategorySeq !== categorySeq){
lastCategorySeq = categorySeq;
}else{
td.innerText = ''
}
return lastCategorySeq;
} }

View File

@ -25,7 +25,7 @@
<button class="nav-link" th:classappend="${page eq 'commit'?' active':''}" id="commitTab" data-bs-toggle="tab" type="button" role="tab">결재처리목록</button> <button class="nav-link" th:classappend="${page eq 'commit'?' active':''}" id="commitTab" data-bs-toggle="tab" type="button" role="tab">결재처리목록</button>
</li> </li>
</ul> </ul>
<div class="tab-content border border-top-0 p-2" id="planContent"> <div class="tab-content border border-top-0 p-2">
<form method="get" th:action="${searchUrl}"> <form method="get" th:action="${searchUrl}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}"> <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row justify-content-between pe-3 py-1"> <div class="row justify-content-between pe-3 py-1">

View File

@ -7,124 +7,27 @@
</th:block> </th:block>
<div layout:fragment="content"> <div layout:fragment="content">
<main class="pt-3"> <main class="pt-3">
<div class="row justify-content-between"> <h4>마이페이지</h4>
<div class="col-auto"><h4>개인정보</h4></div> <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<div class="col-auto"> <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}">
<a class="btn btn-success mb-2" href="/info/modifyRequestList"> 요청 현황</a>
<a class="btn btn-warning mb-2" href="/info/modifyRequestWrite"> 수정 요청</a>
</th:block>
</div>
</div>
<div class="row mx-0"> <div class="row mx-0">
<div class="col-12 card"> <div class="col-12 card text-center">
<div class="card-body"> <div class="card-body">
<div class="row justify-content-start"> <ul class="nav nav-tabs" id="userTab" role="tablist">
<div class="col-4"> <li class="nav-item" role="presentation">
<h5 class="ps-3">계정정보</h5> <button class="nav-link active" id="infoTab" data-bs-toggle="tab" data-bs-target="#infoTabPanel" type="button" role="tab" aria-controls="infoTabPanel" aria-selected="true">개인정보</button>
<div class="card"> </li>
<div class="card-body"> <li class="nav-item" role="presentation">
<div class="p-3"> <button class="nav-link" id="dashboardTab" data-bs-toggle="tab" data-bs-target="#dashboardTabPanel" type="button" role="tab" aria-controls="dashboardTabPanel" aria-selected="false">대시보드</button>
<div class="mb-3 row"> </li>
<label for="userId" class="col-sm-3 col-form-label">아이디</label> </ul>
<div class="col-sm-9"> <div class="tab-content border border-top-0 p-2">
<input type="text" readonly class="form-control-plaintext" id="userId" th:value="${loginUser.userId}"> <div class="tab-pane fade p-2 show active" id="infoTabPanel" role="tabpanel" aria-labelledby="infoTabPanel" tabindex="0">
</div>
</div>
<div class="mb-3 row">
<label for="name" class="col-sm-3 col-form-label">이름</label>
<div class="col-sm-9">
<input type="text" readonly class="form-control-plaintext" id="name" th:value="${loginUser.name}">
</div>
</div>
<div class="mb-3 row">
<label for="staticEmail" class="col-sm-3 col-form-label">권한</label>
<div class="col-sm-9">
<input type="text" readonly class="form-control-plaintext" id="staticEmail" th:value="${#strings.contains(loginUser.userRole, 'ADMIN')?'관리자':'사용자'}">
</div>
</div>
<div class="mb-3 row">
<label for="department" class="col-sm-3 col-form-label">부서</label>
<div class="col-sm-9">
<th:block th:each="department:${session.departmentList}">
<th:block th:if="${department.codeSq==loginUser.department}">
<input type="text" readonly class="form-control-plaintext" id="department" th:value="${department.value}">
</th:block>
</th:block>
</div>
</div>
<div class="mb-3 row">
<label for="position" class="col-sm-3 col-form-label">직책</label>
<div class="col-sm-9">
<th:block th:each="position:${session.positionList}">
<th:block th:if="${position.codeSq==loginUser.position}">
<input type="text" readonly class="form-control-plaintext" id="position" th:value="${position.value}">
</th:block>
</th:block>
</div> </div>
<div class="tab-pane fade p-2" id="dashboardTabPanel" role="tabpanel" aria-labelledby="dashboardTab" tabindex="0">
</div> </div>
<div class="mb-3 row">
<label for="createDate" class="col-sm-3 col-form-label">계정생성일</label>
<div class="col-sm-9">
<input type="text" readonly class="form-control-plaintext" id="createDate" th:value="${#temporals.format(loginUser.createDate, 'yyyy-MM-dd')}">
</div>
</div>
<div class="mb-3 row justify-content-center">
<div class="col-auto">
<button class="btn btn-warning" id="passwordModifyBtn" data-bs-toggle="modal" data-bs-target="#passwordModifyModal">비밀번호 변경</button>
</div>
</div>
</div>
</div>
</div>
</div>
<th:block th:if="${!#strings.contains(loginUser.userRole,'ADMIN')}">
<div class="col-8">
<h5 class="ps-3">작성 권한</h5>
<div class="card">
<div class="card-body">
<div class="p-3">
<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 colspan="3" class="text-center" th:text="${depth1.categoryName}"></th>
</tr>
<tr>
<th>연도</th>
<th>중분류</th>
<th>소분류</th>
</tr>
</thead>
<tbody>
<th:block th:each="depth2:${depth1.childCategoryList}">
<th:block th:each="depth3:${depth2.childCategoryList}">
<th:block th:each="depth4:${depth3.childCategoryList}">
<tr th:class="${#lists.contains(categorySeqList, depth4.categorySeq)}?'bg-success bg-opacity-25':''">
<td class="depth2Td" th:data-categoryseq="${depth2.categorySeq}" th:text="${depth2.categoryName}"></td>
<td class="depth3Td" th:data-categoryseq="${depth3.categorySeq}" th:text="${depth3.categoryName}"></td>
<td class="depth4Td" th:data-categoryseq="${depth4.categorySeq}" th:text="${depth4.categoryName}"></td>
</tr>
</th:block>
</th:block>
</th:block>
</tbody>
</table>
</div>
</th:block>
</div>
</div>
</div>
</div>
</div>
</th:block>
</div> </div>
</div> </div>
</div> </div>
@ -138,7 +41,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body mx-4"> <div class="modal-body mx-4">
<form th:action="@{/info/passwordModify}" method="post" id="modifyPasswordForm"> <form action="#" method="post" id="modifyPasswordForm">
<div class="mb-3 row"> <div class="mb-3 row">
<label for="password" class="col-sm-4 col-form-label text-end">현재 비밀번호</label> <label for="password" class="col-sm-4 col-form-label text-end">현재 비밀번호</label>
<div class="col-sm-7"> <div class="col-sm-7">