관리자메뉴 > 외사경찰관리 인사시스템 연동 기능 추가.
parent
6706d51e52
commit
ac9978fd0f
|
|
@ -39,9 +39,67 @@ public class UserInfoService implements UserDetailsService {
|
||||||
return userInfoRepository.save(userInfo).getUserId();
|
return userInfoRepository.save(userInfo).getUserId();
|
||||||
}
|
}
|
||||||
@Transactional
|
@Transactional
|
||||||
public String updateUserInfo(UserInfo userInfo){
|
public void updateUserInfo(UserInfo userInfo){
|
||||||
userInfo.setPassword(convertPassword(userInfo.getPassword()));
|
UserInfo savedInfo = userInfoRepository.findById(userInfo.getUserSeq()).orElse(null);
|
||||||
return userInfoRepository.save(userInfo).getUserId();
|
if(savedInfo!=null){
|
||||||
|
if(userInfo.getUserNm()!=null){
|
||||||
|
savedInfo.setUserNm(userInfo.getUserNm());
|
||||||
|
}
|
||||||
|
if(userInfo.getPassword()!=null){
|
||||||
|
savedInfo.setPassword(convertPassword(userInfo.getPassword()));
|
||||||
|
}
|
||||||
|
if(userInfo.getPhoneNo()!=null){
|
||||||
|
savedInfo.setPhoneNo(userInfo.getPhoneNo());
|
||||||
|
}
|
||||||
|
if(userInfo.getEmail()!=null){
|
||||||
|
savedInfo.setEmail(userInfo.getEmail());
|
||||||
|
}
|
||||||
|
if(userInfo.getSex()!=null){
|
||||||
|
savedInfo.setSex(userInfo.getSex());
|
||||||
|
}
|
||||||
|
if(userInfo.getOgCd()!=null){
|
||||||
|
savedInfo.setOgCd(userInfo.getOgCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getOfcCd()!=null){
|
||||||
|
savedInfo.setOfcCd(userInfo.getOfcCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getTitleCd()!=null){
|
||||||
|
savedInfo.setTitleCd(userInfo.getTitleCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getOutturnCd()!=null){
|
||||||
|
savedInfo.setOutturnCd(userInfo.getOutturnCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getSeriesCd()!=null){
|
||||||
|
savedInfo.setSeriesCd(userInfo.getSeriesCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getBirthDate()!=null){
|
||||||
|
savedInfo.setBirthDate(userInfo.getBirthDate());
|
||||||
|
}
|
||||||
|
if(userInfo.getPoliceInDate()!=null){
|
||||||
|
savedInfo.setPoliceInDate(userInfo.getPoliceInDate());
|
||||||
|
}
|
||||||
|
if(userInfo.getOrganInDate()!=null){
|
||||||
|
savedInfo.setOrganInDate(userInfo.getOrganInDate());
|
||||||
|
}
|
||||||
|
if(userInfo.getOfcInDate()!=null){
|
||||||
|
savedInfo.setOfcInDate(userInfo.getOfcInDate());
|
||||||
|
}
|
||||||
|
if(userInfo.getTitleInDate()!=null){
|
||||||
|
savedInfo.setTitleInDate(userInfo.getTitleInDate());
|
||||||
|
}
|
||||||
|
if(userInfo.getLanguageCd()!=null){
|
||||||
|
savedInfo.setLanguageCd(userInfo.getLanguageCd());
|
||||||
|
}
|
||||||
|
if(userInfo.getOfcHeadYn()!=null){
|
||||||
|
savedInfo.setOfcHeadYn(userInfo.getOfcHeadYn());
|
||||||
|
}
|
||||||
|
if(userInfo.getUserRole()!=null){
|
||||||
|
savedInfo.setUserRole(userInfo.getUserRole());
|
||||||
|
}
|
||||||
|
if(userInfo.getUserStatus()!=null){
|
||||||
|
savedInfo.setUserStatus(userInfo.getUserStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String updatePassword(UserInfo loginUser, UserInfo modifyInfo){
|
public String updatePassword(UserInfo loginUser, UserInfo modifyInfo){
|
||||||
|
|
@ -107,12 +165,6 @@ public class UserInfoService implements UserDetailsService {
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
@Transactional
|
|
||||||
public void updateUser(UserInfo userInfo) {
|
|
||||||
UserInfo dbUserInfo = userInfoRepository.findById(userInfo.getUserSeq()).orElse(null);
|
|
||||||
dbUserInfo.setUserRole(userInfo.getUserRole());
|
|
||||||
userInfoRepository.save(dbUserInfo);
|
|
||||||
}
|
|
||||||
public void userDelete(List<UserInfo> userInfo) {
|
public void userDelete(List<UserInfo> userInfo) {
|
||||||
userInfoRepository.deleteAll(userInfo);
|
userInfoRepository.deleteAll(userInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.dbnt.faisp.main.userInfo;
|
package com.dbnt.faisp.main.userInfo;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.kwms.service.KwmsService;
|
||||||
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
|
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
|
||||||
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||||
|
|
@ -18,6 +19,7 @@ public class userMgtController {
|
||||||
|
|
||||||
private final UserInfoService userInfoService;
|
private final UserInfoService userInfoService;
|
||||||
private final CodeMgtService codeMgtService;
|
private final CodeMgtService codeMgtService;
|
||||||
|
private final KwmsService kwmsService;
|
||||||
|
|
||||||
@GetMapping("/userMgtPage")
|
@GetMapping("/userMgtPage")
|
||||||
public ModelAndView codeMgtPage(UserInfo userInfo) {
|
public ModelAndView codeMgtPage(UserInfo userInfo) {
|
||||||
|
|
@ -62,7 +64,7 @@ public class userMgtController {
|
||||||
|
|
||||||
@PostMapping("/updateUserInfo")
|
@PostMapping("/updateUserInfo")
|
||||||
public void updateUserInfo(UserInfo userInfo) {
|
public void updateUserInfo(UserInfo userInfo) {
|
||||||
userInfoService.updateUser(userInfo);
|
userInfoService.updateUserInfo(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/userDelete")
|
@PostMapping("/userDelete")
|
||||||
|
|
@ -71,4 +73,17 @@ public class userMgtController {
|
||||||
userInfoService.userDelete(userInfo);
|
userInfoService.userDelete(userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/syncUserInfoToKwms")
|
||||||
|
@ResponseBody
|
||||||
|
public String syncUserInfoToKwms(@RequestBody List<UserInfo> infoList){
|
||||||
|
for(UserInfo info: infoList){
|
||||||
|
UserInfo kwmsInfo = kwmsService.selectEmpInfo(info.getDicCode());
|
||||||
|
if(kwmsInfo!=null){
|
||||||
|
kwmsInfo.setUserSeq(info.getUserSeq());
|
||||||
|
userInfoService.updateUserInfo(kwmsInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectUserInfoList" resultType="UserInfo" parameterType="UserInfo">
|
<select id="selectUserInfoList" resultType="UserInfo" parameterType="UserInfo">
|
||||||
select user_seq,
|
select user_seq,
|
||||||
|
dic_code,
|
||||||
user_id,
|
user_id,
|
||||||
user_nm,
|
user_nm,
|
||||||
user_role,
|
user_role,
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,30 @@ $(document).on('click', '#deleteBtn', function (){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
$(document).on('click', '#syncToKwmsBtn', function (){
|
$(document).on('click', '#syncToKwmsBtn', function (){
|
||||||
syncUserInfoToKwms({userSeq: $("#userSeq").val()});
|
const dicCode = $("#dicCode").val();
|
||||||
|
if(!dicCode){
|
||||||
|
alert("공무원식별번호가 없습니다.")
|
||||||
|
}else{
|
||||||
|
syncUserInfoToKwms([{
|
||||||
|
userSeq: $("#userSeq").val(),
|
||||||
|
dicCode: dicCode
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$(document).on('click', '#syncToKwmsAllBtn', function (){
|
||||||
|
const userList = [];
|
||||||
|
$.each($(".userInfoCheckBox:checked"), function (idx, chkBox){
|
||||||
|
const tr = $(chkBox).parents(".userInfoTr");
|
||||||
|
if(tr.find(".dicCode").val()!==""){
|
||||||
|
userList.push({
|
||||||
|
userSeq: tr.find(".userSeq").val(),
|
||||||
|
dicCode: tr.find(".dicCode").val()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(confirm(userList.length+"건의 정보를 갱신하시겠습니까?")){
|
||||||
|
syncUserInfoToKwms(userList);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on('click', '#companionBtn', function (){
|
$(document).on('click', '#companionBtn', function (){
|
||||||
|
|
@ -77,11 +100,11 @@ $(document).on('click', '#companionBtn', function (){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function syncUserInfoToKwms(userInfo){
|
function syncUserInfoToKwms(userList){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
url : "/userMgt/syncUserInfoToKwms",
|
url : "/userMgt/syncUserInfoToKwms",
|
||||||
data : JSON.stringify(userInfo),
|
data : JSON.stringify(userList),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
beforeSend: function (xhr){
|
beforeSend: function (xhr){
|
||||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form id="userInfoUpdate" action="#" th:action="@{/admin/insertUserInfo}" method="post">
|
<form id="userInfoUpdate" action="#" th:action="@{/admin/insertUserInfo}" method="post">
|
||||||
<input type="hidden" name="userSeq" id="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
<input type="hidden" name="userSeq" id="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
||||||
<input type="hidden" id="userStatus" name="userStatus" th:value="${userInfo.userStatus}">
|
<input type="hidden" name="userStatus" th:value="${userInfo.userStatus}">
|
||||||
<div class="mb-3 mt-3 row">
|
<div class="mb-3 mt-3 row">
|
||||||
<label for="userRole" class="col-sm-2 col-form-label col-form-label-sm text-center ">시스템권한</label>
|
<label for="userRole" class="col-sm-2 col-form-label col-form-label-sm text-center ">시스템권한</label>
|
||||||
<div class="col-sm-4" id="userRole">
|
<div class="col-sm-4" id="userRole">
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label for="userId" class="col-sm-2 col-form-label col-form-label-sm text-center ">아이디</label>
|
<label for="userId" class="col-sm-2 col-form-label col-form-label-sm text-center ">아이디</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input type="text" class="form-control form-control-sm" id="userId" name="userId" autocomplete="off" th:value="${userInfo.userId}">
|
<input type="text" class="form-control form-control-sm" id="userId" name="userId" autocomplete="off" th:value="${userInfo.userId}" readonly>
|
||||||
<label for="userId" style="font-size: 12px">6~20자 사이의 알파벳, 숫자를 입력하세요</label>
|
<label for="userId" style="font-size: 12px">6~20자 사이의 알파벳, 숫자를 입력하세요</label>
|
||||||
</div>
|
</div>
|
||||||
<label for="userNm" class="col-sm-2 col-form-label col-form-label-sm text-center">이름</label>
|
<label for="userNm" class="col-sm-2 col-form-label col-form-label-sm text-center">이름</label>
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
<select class="form-select form-select-sm" id="outturnCd" name="outturnCd">
|
<select class="form-select form-select-sm" id="outturnCd" name="outturnCd">
|
||||||
<option value="">--선택--</option>
|
<option value="">--선택--</option>
|
||||||
<th:block th:each="code:${outturnList}">
|
<th:block th:each="code:${outturnList}">
|
||||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.groupCd}"></option>
|
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.outturnCd}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -150,7 +150,7 @@
|
||||||
<select class="form-select form-select-sm" id="languageCd" name="languageCd">
|
<select class="form-select form-select-sm" id="languageCd" name="languageCd">
|
||||||
<option value="">--선택--</option>
|
<option value="">--선택--</option>
|
||||||
<th:block th:each="code:${languageList}">
|
<th:block th:each="code:${languageList}">
|
||||||
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.groupCd}"></option>
|
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.languageCd}"></option>
|
||||||
</th:block>
|
</th:block>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -82,12 +82,14 @@
|
||||||
<th>계급</th>
|
<th>계급</th>
|
||||||
<th>성명</th>
|
<th>성명</th>
|
||||||
<th>아이디</th>
|
<th>아이디</th>
|
||||||
|
<th>식별번호</th>
|
||||||
<th>등록일</th>
|
<th>등록일</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="userInfoTr" th:each="userInfo:${userInfoList}">
|
<tr class="userInfoTr" th:each="userInfo:${userInfoList}">
|
||||||
<input type="hidden" name="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
<input type="hidden" name="userSeq" class="userSeq" th:value="${userInfo.userSeq}">
|
||||||
|
<input type="hidden" name="dicCode" class="dicCode" th:value="${userInfo.dicCode}">
|
||||||
<td class="checkBoxTd">
|
<td class="checkBoxTd">
|
||||||
<input type="checkbox" id="userChk" name="userChk" class="userInfoCheckBox" th:value="${userInfo.userSeq}">
|
<input type="checkbox" id="userChk" name="userChk" class="userInfoCheckBox" th:value="${userInfo.userSeq}">
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -123,6 +125,7 @@
|
||||||
</th:block>
|
</th:block>
|
||||||
<td th:text="${userInfo.userNm}"></td>
|
<td th:text="${userInfo.userNm}"></td>
|
||||||
<td th:text="${userInfo.userId}"></td>
|
<td th:text="${userInfo.userId}"></td>
|
||||||
|
<td th:text="${userInfo.dicCode}"></td>
|
||||||
<td th:text="${#temporals.format(userInfo.wrtDt, 'yyyy-MM-dd HH:mm:ss')}"></td>
|
<td th:text="${#temporals.format(userInfo.wrtDt, 'yyyy-MM-dd HH:mm:ss')}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue