회원가입 양식 수정.

- 인사시스템 연동정보 수정불가로 변경.
 - 직별 코드 경과 코드와 연동되도록 수정.
master
강석 최 2023-01-27 11:18:24 +09:00
parent 6fc5e1f053
commit ee3c6c2fb6
5 changed files with 120 additions and 112 deletions

View File

@ -5,6 +5,7 @@ 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.model.UserInfo; import com.dbnt.faisp.main.userInfo.model.UserInfo;
import com.dbnt.faisp.main.userInfo.service.UserInfoService; import com.dbnt.faisp.main.userInfo.service.UserInfoService;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -23,26 +24,32 @@ public class KwmsController {
@GetMapping("/getEmpInfoToJoinForm") @GetMapping("/getEmpInfoToJoinForm")
public ModelAndView getEmpInfo(VEmployee empInfo){ public ModelAndView getEmpInfo(VEmployee empInfo){
ModelAndView mav = new ModelAndView("login/joinForm"); ModelAndView mav = new ModelAndView("login/joinForm");
if(userInfoService.selectUserInfoToDicCode(empInfo.getDic()) == null){ if(Utils.isEmpty(empInfo.getDic())){
UserInfo userInfo = kwmsService.selectEmpInfo(empInfo.getDic());
if(userInfo==null){
mav.addObject("joinFlag", "F");
mav.addObject("userInfo", empInfo);
mav.addObject("msg", "검색 결과가 없습니다.");
}else{
mav.addObject("joinFlag", "T");
mav.addObject("userInfo", userInfo);
mav.addObject("ogList", codeMgtService.selectCodeMgtList("OG"));
mav.addObject("ofcList", codeMgtService.selectCodeMgtList("OFC"));
mav.addObject("titleList", codeMgtService.selectCodeMgtList("JT"));
mav.addObject("outturnList", codeMgtService.selectCodeMgtList("OTC"));
mav.addObject("seriesList", codeMgtService.selectCodeMgtList("SRC"));
mav.addObject("languageList", codeMgtService.selectCodeMgtList("LNG"));
}
}else{
mav.addObject("joinFlag", "F"); mav.addObject("joinFlag", "F");
mav.addObject("userInfo", empInfo); mav.addObject("userInfo", empInfo);
mav.addObject("msg", "이미 가입된 식별번호입니다."); mav.addObject("msg", "-포함 입력 ex) M00-00000");
}else{
if(userInfoService.selectUserInfoToDicCode(empInfo.getDic()) == null){
UserInfo userInfo = kwmsService.selectEmpInfo(empInfo.getDic());
if(userInfo==null){
mav.addObject("joinFlag", "F");
mav.addObject("userInfo", empInfo);
mav.addObject("msg", "검색 결과가 없습니다.");
}else{
mav.addObject("joinFlag", "T");
mav.addObject("userInfo", userInfo);
mav.addObject("ogList", codeMgtService.selectCodeMgtList("OG"));
mav.addObject("ofcList", codeMgtService.selectCodeMgtList("OFC"));
mav.addObject("titleList", codeMgtService.selectCodeMgtList("JT"));
mav.addObject("outturnList", codeMgtService.selectCodeMgtList("OTC"));
mav.addObject("seriesList", codeMgtService.selectCodeMgtList(userInfo.getOutturnCd()));
mav.addObject("languageList", codeMgtService.selectCodeMgtList("LNG"));
}
}else{
mav.addObject("joinFlag", "F");
mav.addObject("userInfo", empInfo);
mav.addObject("msg", "이미 가입된 식별번호입니다.");
}
} }
return mav; return mav;
} }

View File

@ -11,7 +11,7 @@
user_status = #{userStatus} user_status = #{userStatus}
</when> </when>
<otherwise> <otherwise>
user_status != 'D' user_status = 'USC003'
</otherwise> </otherwise>
</choose> </choose>
<if test='userId != null and userId != ""'> <if test='userId != null and userId != ""'>

View File

@ -1,23 +1,12 @@
$(document).on('click', '#joinModalBtn', function (){
getJoinForm(null);
$("#userInsertModal").modal('show')
})
$(document).on('click', '#dicCodeSearchBtn', function (){ $(document).on('click', '#dicCodeSearchBtn', function (){
const dicCode = $("#dicCode").val(); const dicCode = $("#dicCode").val();
if(dicCode!==''){ if(dicCode!==''){
$.ajax({ getJoinForm(dicCode);
url: '/kwms/getEmpInfoToJoinForm',
data: {dic: dicCode},
type: 'GET',
dataType:"html",
success: function(html){
$("#userInsertModalContent").empty().append(html)
$(".dateSelector").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
},
error:function(e){
}
});
}else{ }else{
alert("공무원식별번호를 입력해주세요.") alert("공무원식별번호를 입력해주세요.")
} }
@ -27,7 +16,9 @@ $(document).on('click', '#saveBtn', function (){
if(valueCheck()){ if(valueCheck()){
if(confirm("저장하시겠습니까?")){ if(confirm("저장하시겠습니까?")){
contentFade("in"); contentFade("in");
const formData = new FormData($("#userInfoInsert")[0]); const userForm = $("#userInfoInsert")
userForm.find('input, select').removeAttr('disabled')
const formData = new FormData(userForm[0]);
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
data : formData, data : formData,
@ -40,7 +31,6 @@ $(document).on('click', '#saveBtn', function (){
}else{ }else{
alert("저장되었습니다.\n담당자 승인 후 로그인 가능합니다.") alert("저장되었습니다.\n담당자 승인 후 로그인 가능합니다.")
$("#closeModalBtn").click(); $("#closeModalBtn").click();
$("#searchBtn").click();
} }
contentFade("out"); contentFade("out");
}, },
@ -53,19 +43,30 @@ $(document).on('click', '#saveBtn', function (){
} }
}) })
function getJoinForm(dicCode){
$.ajax({
url: '/kwms/getEmpInfoToJoinForm',
data: {dic: dicCode},
type: 'GET',
dataType:"html",
success: function(html){
$("#userInsertModalContent").empty().append(html)
$(".dateSelector").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
},
error:function(e){
}
});
}
function valueCheck(){ function valueCheck(){
const targetForm = $("#userInfoInsert"); const targetForm = $("#userInfoInsert");
const userId = targetForm.find("#userId").val();
const password = targetForm.find("#modalPassword");
const passwordConfirm = targetForm.find("#passwordConfirm");
const userNm = targetForm.find("#userNm").val();
const phoneNo = targetForm.find("#phoneNo").val();
const email = targetForm.find("#email").val();
const ogCd = targetForm.find("#ogCd").val();
const titleCd = targetForm.find("#titleCd").val();
let returnFlag = true;
if(!userId){ /*if(!userId){
alert("아이디를 입력해주세요."); alert("아이디를 입력해주세요.");
returnFlag = false; returnFlag = false;
}else{ }else{
@ -74,48 +75,57 @@ function valueCheck(){
returnFlag = false; returnFlag = false;
alert("아이디 조건이 맞지 않습니다.") alert("아이디 조건이 맞지 않습니다.")
} }
} }*/
const password = targetForm.find("#modalPassword");
const passwordConfirm = targetForm.find("#passwordConfirm");
if(!password[0].disabled && !password.val()){ if(!password[0].disabled && !password.val()){
alert("비밀번호를 입력해주세요."); alert("비밀번호를 입력해주세요.");
returnFlag = false; return false;
} }
if(!password[0].disabled && !passwordConfirm.val()){ if(!password[0].disabled && !passwordConfirm.val()){
alert("비밀번호 확인을 입력해주세요."); alert("비밀번호 확인을 입력해주세요.");
returnFlag = false; return false;
} }
if(!userNm){ const passwordReg = /^(?=.*[a-zA-z])(?=.*[0-9])(?=.*[$`~!@$!%*#^?&\\(\\)\-_=+]).{8,16}$/;
alert("이름을 입력해주세요."); if(!password[0].disabled){
returnFlag = false; if(!passwordReg.test(password.val())){
} alert("비밀번호 조건이 맞지 않습니다.")
if(!phoneNo){ return false;
alert("휴대전화를 입력해주세요."); }else{
returnFlag = false; if(password.val() !== passwordConfirm.val()){
} alert("비밀번호가 같지 않습니다.");
if(!email){ return false;
alert("이메일을 입력해주세요.");
returnFlag = false;
}
if(returnFlag){
const passwordReg = /^(?=.*[a-zA-z])(?=.*[0-9])(?=.*[$`~!@$!%*#^?&\\(\\)\-_=+]).{8,16}$/;
if(!password[0].disabled){
if(!passwordReg.test(password.val())){
alert("비밀번호 조건이 맞지 않습니다.")
returnFlag = false;
}else{
if(password.val() !== passwordConfirm.val()){
alert("비밀번호가 같지 않습니다.");
returnFlag = false;
}
} }
} }
} }
if(!ogCd){ const phoneNo = targetForm.find("#phoneNo").val();
alert("관서를 선택해주세요."); if(!phoneNo){
returnFlag = false; alert("휴대전화를 입력해주세요.");
return false;
}else{
const phoneReg = /^(\d{10,11}|\d{3}-\d{3,4}-\d{4})$/;
if(!phoneReg.test(phoneNo)){
alert("휴대전화 입력 양식에 맞지 않습니다.")
return false;
}
} }
if(!titleCd){ const email = targetForm.find("#email").val();
alert("계급을 선택해주세요."); if(!email){
returnFlag = false; alert("이메일을 입력해주세요.");
return false;
} }
return returnFlag; const organInDate = targetForm.find("#organInDate").val();
if(!organInDate){
alert("현관서전입일을 입력해주세요.");
return false;
}
const seriesCd = targetForm.find("#seriesCd").val();
if(!seriesCd){
alert("직별을 선택해주세요.");
return false;
}
return true;
} }

View File

@ -7,7 +7,7 @@
</div> </div>
<div class="modal-body" th:if="${joinFlag eq 'F'}"> <div class="modal-body" th:if="${joinFlag eq 'F'}">
<div class="mb-3 mt-3 row"> <div class="mb-3 mt-3 row">
<label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">공무원식별번호</label> <label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">디지털 식별코드</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off" th:value="${userInfo.dic}"> <input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off" th:value="${userInfo.dic}">
<label for="dicCode" style="font-size: 12px" th:text="${msg}"></label> <label for="dicCode" style="font-size: 12px" th:text="${msg}"></label>
@ -17,22 +17,22 @@
</div> </div>
<div class="modal-body" th:if="${joinFlag eq 'T'}"> <div class="modal-body" th:if="${joinFlag eq 'T'}">
<form id="userInfoInsert" action="#" th:action="@{/admin/insertUserInfo}" method="post"> <form id="userInfoInsert" action="#" th:action="@{/admin/insertUserInfo}" method="post">
<div class="mb-3 mt-3 row"> <div class="mt-3 mb-1 row">
<label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">공무원식별번호</label> <label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">디지털 식별코드</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off" th:value="${userInfo.dicCode}"> <input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off" th:value="${userInfo.dicCode}" disabled>
</div> </div>
<button type="button" class="btn btn-sm btn-outline-primary col-sm-1" id="dicCodeSearchBtn">검색</button> <!--<button type="button" class="btn btn-sm btn-outline-primary col-sm-1" id="dicCodeSearchBtn">검색</button>-->
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<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="new-password" th:value="${userInfo.userId}"> <input type="text" class="form-control form-control-sm" id="userId" name="userId" autocomplete="new-password" th:value="${userInfo.userId}" disabled>
<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>
<div class="col-sm-4"> <div class="col-sm-4">
<input type="text" class=" form-control form-control-sm" id="userNm" name="userNm" autocomplete="off" th:value="${userInfo.userNm}"> <input type="text" class=" form-control form-control-sm" id="userNm" name="userNm" autocomplete="off" th:value="${userInfo.userNm}" disabled>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
@ -50,16 +50,18 @@
<label for="phoneNo" class="col-sm-2 col-form-label col-form-label-sm text-center">휴대전화</label> <label for="phoneNo" 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="tel" class="form-control form-control-sm" id="phoneNo" name="phoneNo"> <input type="tel" class="form-control form-control-sm" id="phoneNo" name="phoneNo">
<label for="userId" style="font-size: 12px">-없이 숫자만 입력</label>
</div> </div>
<label for="email" class="col-sm-2 col-form-label col-form-label-sm text-center">이메일</label> <label for="email" 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="email" class="form-control form-control-sm" id="email" name="email"> <input type="email" class="form-control form-control-sm" id="email" name="email">
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="sex" class="col-sm-2 col-form-label col-form-label-sm text-center">성별</label> <label for="sex" class="col-sm-2 col-form-label col-form-label-sm text-center">성별</label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="sex" name="sex"> <select class="form-select form-select-sm" id="sex" name="sex" disabled>
<option value="SEX002" th:selected="${userInfo.sex eq 'M'}"></option> <option value="SEX002" th:selected="${userInfo.sex eq 'M'}"></option>
<option value="SEX001" th:selected="${userInfo.sex eq 'F'}"></option> <option value="SEX001" th:selected="${userInfo.sex eq 'F'}"></option>
</select> </select>
@ -68,17 +70,17 @@
<div class="row mb-1"> <div class="row mb-1">
<label for="birthDate" class="col-sm-2 col-form-label col-form-label-sm text-center">생년월일</label> <label for="birthDate" 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 dateSelector" id="birthDate" name="birthDate" th:value="${userInfo.birthDate}" readonly> <input type="text" class="form-control form-control-sm dateSelector" id="birthDate" name="birthDate" th:value="${userInfo.birthDate}" disabled>
</div> </div>
<label for="policeInDate" class="col-sm-2 col-form-label col-form-label-sm text-center">해양경찰배명일</label> <label for="policeInDate" 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 dateSelector" id="policeInDate" name="policeInDate" th:value="${userInfo.policeInDate}" readonly> <input type="text" class="form-control form-control-sm dateSelector" id="policeInDate" name="policeInDate" th:value="${userInfo.policeInDate}" disabled>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="ogCd" class="col-sm-2 col-form-label col-form-label-sm text-center">관서</label> <label for="ogCd" class="col-sm-2 col-form-label col-form-label-sm text-center">관서</label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="ogCd" name="ogCd"> <select class="form-select form-select-sm" id="ogCd" name="ogCd" disabled>
<option value="">--선택--</option> <option value="">--선택--</option>
<th:block th:each="code:${ogList}"> <th:block th:each="code:${ogList}">
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.ogCd}"></option> <option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.ogCd}"></option>
@ -93,7 +95,7 @@
<div class="row mb-1"> <div class="row mb-1">
<label for="ofcCd" class="col-sm-2 col-form-label col-form-label-sm text-center">부서</label> <label for="ofcCd" class="col-sm-2 col-form-label col-form-label-sm text-center">부서</label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="ofcCd" name="ofcCd"> <select class="form-select form-select-sm" id="ofcCd" name="ofcCd" disabled>
<option value="">--선택--</option> <option value="">--선택--</option>
<th:block th:each="code:${ofcList}"> <th:block th:each="code:${ofcList}">
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.ofcCd}"></option> <option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.ofcCd}"></option>
@ -102,13 +104,13 @@
</div> </div>
<label for="ofcInDate" class="col-sm-2 col-form-label col-form-label-sm text-center">현부서임용일</label> <label for="ofcInDate" 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 dateSelector" id="ofcInDate" name="ofcInDate" th:value="${userInfo.ofcInDate}" readonly> <input type="text" class="form-control form-control-sm dateSelector" id="ofcInDate" name="ofcInDate" th:value="${userInfo.ofcInDate}" disabled>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="ogCd" class="col-sm-2 col-form-label col-form-label-sm text-center">계급</label> <label for="ogCd" class="col-sm-2 col-form-label col-form-label-sm text-center">계급</label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="titleCd" name="titleCd"> <select class="form-select form-select-sm" id="titleCd" name="titleCd" disabled>
<option value="">--선택--</option> <option value="">--선택--</option>
<th:block th:each="code:${titleList}"> <th:block th:each="code:${titleList}">
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.titleCd}"></option> <option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.titleCd}"></option>
@ -117,13 +119,13 @@
</div> </div>
<label for="titleInDate" class="col-sm-2 col-form-label col-form-label-sm text-center">현계급임용일</label> <label for="titleInDate" 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 dateSelector" id="titleInDate" name="titleInDate" th:value="${userInfo.titleInDate}" readonly> <input type="text" class="form-control form-control-sm dateSelector" id="titleInDate" name="titleInDate" th:value="${userInfo.titleInDate}" disabled>
</div> </div>
</div> </div>
<div class="row mb-1"> <div class="row mb-1">
<label for="outturnCd" class="col-sm-2 col-form-label col-form-label-sm text-center">경과</label> <label for="outturnCd" class="col-sm-2 col-form-label col-form-label-sm text-center">경과</label>
<div class="col-sm-4"> <div class="col-sm-4">
<select class="form-select form-select-sm" id="outturnCd" name="outturnCd"> <select class="form-select form-select-sm" id="outturnCd" name="outturnCd" disabled>
<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.outturnCd}"></option> <option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq userInfo.outturnCd}"></option>

View File

@ -43,7 +43,8 @@
<input type="submit" name="login" id="login" value="로그인" class="btn_login"> <input type="submit" name="login" id="login" value="로그인" class="btn_login">
<div class="join"> <div class="join">
<a href="#" data-bs-toggle="modal" data-bs-target="#userInsertModal">회원가입</a> <!--<a href="#" data-bs-toggle="modal" data-bs-target="#userInsertModal">회원가입</a>-->
<a href="#" id="joinModalBtn">회원가입</a>
</div> </div>
<a href="#"> <a href="#">
@ -58,19 +59,7 @@
aria-labelledby="userInsertModalLabel" aria-hidden="true"> aria-labelledby="userInsertModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content " id="userInsertModalContent"> <div class="modal-content " id="userInsertModalContent">
<div class="modal-header bg-dark">
<h5 class="modal-title text-white" id="userInsertModalLabel">사용자 신청</h5>
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3 mt-3 row">
<label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">공무원식별번호</label>
<div class="col-sm-3">
<input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off">
</div>
<button type="button" class="btn btn-sm btn-outline-primary col-sm-1" id="dicCodeSearchBtn">검색</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>