Merge branch 'master' of http://118.219.150.34:50501/DBNT/kcscDev into thkim
commit
ac4625a174
|
|
@ -182,14 +182,12 @@
|
|||
.menuList .result .list_item > div:nth-child(5) {width: 100px;}
|
||||
|
||||
/* 사이트관리 > 환경설정 > 메뉴권한관리 */
|
||||
.roleList .head > span:nth-child(1) {width: 120px;}
|
||||
.roleList .head > span:nth-child(2) {width: 180px;}
|
||||
.roleList .head > span:nth-child(3) {width: 120px;}
|
||||
.roleList .head > span:nth-child(1) {width: 180px;}
|
||||
.roleList .head > span:nth-child(2) {width: 120px;}
|
||||
.roleList .head .checkboxDiv {width: 60px;}
|
||||
.roleList .head .saveBtnDiv {width: 100px;}
|
||||
.roleList .result .list_item > div:nth-child(1) {width: 120px;}
|
||||
.roleList .result .list_item > div:nth-child(2) {width: 180px;}
|
||||
.roleList .result .list_item > div:nth-child(3) {width: 120px;}
|
||||
.roleList .result .list_item > div:nth-child(1) {width: 180px;}
|
||||
.roleList .result .list_item > div:nth-child(2) {width: 120px;}
|
||||
.roleList .result .list_item .checkboxDiv {width: 60px;}
|
||||
.roleList .result .list_item .saveBtnDiv {width: 100px;}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ function MenuAuthMgt(props) {
|
|||
// 리스트 항목 구성
|
||||
menuList.forEach(function (item, index) {
|
||||
const checkboxs = [];
|
||||
|
||||
roleList.forEach(function (role) {
|
||||
checkboxs.push(
|
||||
<div className={"checkboxDiv"}>
|
||||
|
|
@ -44,12 +45,19 @@ function MenuAuthMgt(props) {
|
|||
defaultChecked={item.menuAuth.includes(role.itemCd)}/>
|
||||
</div>
|
||||
)
|
||||
/*if(item.menuGroup){
|
||||
|
||||
}else{
|
||||
checkboxs.push(
|
||||
<div className={"checkboxDiv"}></div>
|
||||
)
|
||||
}*/
|
||||
});
|
||||
|
||||
mutListTag.push(
|
||||
<div className={"list_item"} key={"userListDiv_"+index}>
|
||||
<div>{item.menuId}</div>
|
||||
<div>{item.menuGroup?'└ ':''}{item.menuId}</div>
|
||||
<div>{item.menuTitle}</div>
|
||||
<div>{item.menuGroup}</div>
|
||||
{checkboxs}
|
||||
<div className={"saveBtnDiv"}>
|
||||
<button className={"btn btn_blue_h31 px-1"} onClick={()=>{editMenu(item)}}>저장</button>
|
||||
|
|
@ -73,27 +81,25 @@ function MenuAuthMgt(props) {
|
|||
},[]);
|
||||
|
||||
function editMenu(menu){
|
||||
if(window.confirm("수정하시겠습니까?")) {
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/menu-auth-mgt',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(menu)
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/menu-auth-mgt',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("수정되었습니다.")
|
||||
} else if (Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)) {
|
||||
console.log("토큰 갱신중.")
|
||||
} else {
|
||||
alert(resp.result.resultMessage)
|
||||
}
|
||||
body: JSON.stringify(menu)
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("수정되었습니다.")
|
||||
} else if (Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)) {
|
||||
console.log("토큰 갱신중.")
|
||||
} else {
|
||||
alert(resp.result.resultMessage)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -126,7 +132,6 @@ function MenuAuthMgt(props) {
|
|||
<div className="head">
|
||||
<span>메뉴 코드</span>
|
||||
<span>메뉴 이름</span>
|
||||
<span>부모 메뉴</span>
|
||||
{roleHeader}
|
||||
<span className={"saveBtnDiv"}></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Col from "react-bootstrap/Col";
|
|||
import Form from "react-bootstrap/Form";
|
||||
import Table from "react-bootstrap/Table";
|
||||
import * as EgovNet from "api/egovFetch";
|
||||
import CODE from "../../../../constants/code";
|
||||
|
||||
function QuestionModal({svySeq}){
|
||||
|
||||
|
|
@ -44,12 +45,54 @@ function QuestionModal({svySeq}){
|
|||
setTempSeq(tempSeq+1);
|
||||
}
|
||||
|
||||
function addItem(){
|
||||
function qtOptionChange(target, value){
|
||||
const temp = {...selectedQt}
|
||||
temp[target] = value;
|
||||
setSelectedQt(temp);
|
||||
}
|
||||
|
||||
function addItem(){
|
||||
const temp = {...selectedQt}
|
||||
temp.itemList.push({
|
||||
qtItemSeq: null,
|
||||
qtSeq:null,
|
||||
itemNm: null,
|
||||
questionYn:'Y'
|
||||
})
|
||||
setSelectedQt(temp);
|
||||
}
|
||||
|
||||
function removeQt(index){
|
||||
const temp = [...qtList]
|
||||
temp.splice(index, 1);
|
||||
setQtList(temp);
|
||||
setSelectedQt(null)
|
||||
}
|
||||
|
||||
function removeItem(index){
|
||||
const temp = {...selectedQt}
|
||||
temp.itemList.splice(index, 1)
|
||||
setSelectedQt(temp)
|
||||
}
|
||||
|
||||
function editSurveyQt(e){
|
||||
|
||||
EgovNet.requestFetch(
|
||||
'/admin/survey/info-qt',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(qtList)
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("저장되었습니다.")
|
||||
}else{
|
||||
alert(resp.resultMessage)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -60,16 +103,20 @@ function QuestionModal({svySeq}){
|
|||
const tempQt = [...qtList];
|
||||
tempQt.forEach(function (qt, index){
|
||||
if(qt.qtSeq === null){
|
||||
if(qt.tempSeq === selectedQt.tempSeq){
|
||||
qt = selectedQt;
|
||||
if(qt.tempSeq === selectedQt?.tempSeq){
|
||||
tempQt[index] = selectedQt;
|
||||
}
|
||||
}else if(qt.qtSeq === selectedQt.qtSeq){
|
||||
qt = selectedQt;
|
||||
}else if(qt.qtSeq === selectedQt?.qtSeq){
|
||||
tempQt[index] = selectedQt;
|
||||
}
|
||||
})
|
||||
setQtList(tempQt);
|
||||
}, [selectedQt]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
}, [qtList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal.Header closeButton>
|
||||
|
|
@ -79,17 +126,29 @@ function QuestionModal({svySeq}){
|
|||
<Row>
|
||||
<Col xs={5}>
|
||||
<Table>
|
||||
<colgroup>
|
||||
<col/>
|
||||
<col className={"w_100"}/>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>질문</th>
|
||||
<th>삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{qtList.map(qt=>{
|
||||
{qtList.map((qt, index)=>{
|
||||
return (
|
||||
<tr>
|
||||
<tr onClick={()=>setSelectedQt({...qt})}>
|
||||
<td>
|
||||
<Form.Control type={"text"} defaultValue={qt.qtTitle} onClick={()=>{setSelectedQt(qt)}}/>
|
||||
<Form.Control type={"text"} defaultValue={qt.qtTitle} value={qt.qtTitle}
|
||||
onChange={(e)=>{
|
||||
qt.qtTitle = e.target.value
|
||||
setSelectedQt({...qt})
|
||||
}} />
|
||||
</td>
|
||||
<td>
|
||||
<button className={"btn btn_red_h31"} onClick={()=>removeQt(index)}>삭제</button>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
|
@ -97,7 +156,7 @@ function QuestionModal({svySeq}){
|
|||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<td colSpan={2}>
|
||||
<button className={"btn btn_blue_h31"} onClick={addQt}>추가</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -110,10 +169,38 @@ function QuestionModal({svySeq}){
|
|||
질문유형
|
||||
</Form.Label>
|
||||
<Col sm={9} key={`inline-radio`} className={'my-auto'}>
|
||||
<Form.Check inline label="체크박스" name="qtType" type={'radio'} value={1} checked={selectedQt?.qtType === 1} onClick={()=>{setSelectedQt({...selectedQt, qtType:1})}}/>
|
||||
<Form.Check inline label="라디오버튼" name="qtType" type={'radio'} value={2} checked={selectedQt?.qtType === 2} onClick={()=>{setSelectedQt({...selectedQt, qtType:2})}}/>
|
||||
<Form.Check inline label="직접입력" name="qtType" type={'radio'} value={3} checked={selectedQt?.qtType === 3} onClick={()=>{setSelectedQt({...selectedQt, qtType:3})}}/>
|
||||
<Form.Check inline label="이용자만족도" name="qtType" type={'radio'} value={4} checked={selectedQt?.qtType === 4} onClick={()=>{setSelectedQt({...selectedQt, qtType:4})}}/>
|
||||
<Form.Check inline label="체크박스" name="qtType" type={'radio'} value={1}
|
||||
checked={selectedQt?.qtType === 1} defaultChecked={selectedQt?.qtType === 1}
|
||||
onClick={(e)=>{
|
||||
qtOptionChange("qtType", Number(e.target.value));
|
||||
}}/>
|
||||
<Form.Check inline label="라디오버튼" name="qtType" type={'radio'} value={2}
|
||||
checked={selectedQt?.qtType === 2} defaultChecked={selectedQt?.qtType === 2}
|
||||
onClick={(e)=>{
|
||||
qtOptionChange("qtType", Number(e.target.value));
|
||||
}}/>
|
||||
<Form.Check inline label="직접입력" name="qtType" type={'radio'} value={3}
|
||||
checked={selectedQt?.qtType === 3} defaultChecked={selectedQt?.qtType === 3}
|
||||
onClick={(e)=>{
|
||||
qtOptionChange("qtType", Number(e.target.value));
|
||||
}}/>
|
||||
<Form.Check inline label="이용자만족도" name="qtType" type={'radio'} value={4}
|
||||
checked={selectedQt?.qtType === 4} defaultChecked={selectedQt?.qtType === 4}
|
||||
onClick={(e)=>{
|
||||
qtOptionChange("qtType", Number(e.target.value));
|
||||
}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row}>
|
||||
<Form.Label column sm={3}>
|
||||
설명
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control as={"textarea"} rows={3} name="qtDesc"
|
||||
defaultValue={selectedQt?.qtDesc?selectedQt?.qtDesc:''} value={selectedQt?.qtDesc?selectedQt?.qtDesc:''}
|
||||
onChange={(e)=>{
|
||||
qtOptionChange("qtDesc", e.target.value);
|
||||
}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row} className={`mb-3 ${selectedQt?.qtType!==1?'d-none':''}`}>
|
||||
|
|
@ -121,19 +208,34 @@ function QuestionModal({svySeq}){
|
|||
최대 선택 개수
|
||||
</Form.Label>
|
||||
<Col sm={3}>
|
||||
<Form.Control type="text" name="maxNo" defaultValue={selectedQt?.maxNo} onChange={(e)=>{setSelectedQt({...selectedQt, maxNo:e.target.value})}}/>
|
||||
<Form.Control type="text" name="maxNo"
|
||||
defaultValue={selectedQt?.maxNo} value={selectedQt?.maxNo}
|
||||
onChange={(e)=>{
|
||||
qtOptionChange("maxNo", e.target.value);
|
||||
}}/>
|
||||
</Col>
|
||||
<Form.Label column sm={'auto'}>
|
||||
기타 여부
|
||||
</Form.Label>
|
||||
<Col sm={3} className={'my-auto'}>
|
||||
<Form.Check type="checkbox" name="etcYn" checked={selectedQt?.etcYn==='Y'} onClick={(e)=>{setSelectedQt({...selectedQt, etcYn:e.target.checked?'Y':'N'})}}/>
|
||||
<Form.Check type="checkbox" name="etcYn"
|
||||
defaultChecked={selectedQt?.etcYn==='Y'} checked={selectedQt?.etcYn==='Y'}
|
||||
onClick={(e)=>{
|
||||
qtOptionChange("etcYn", e.target.checked?'Y':'N');
|
||||
}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Table>
|
||||
<Table className={`mb-3 ${selectedQt?.qtType===3?'d-none':''}`}>
|
||||
<colgroup>
|
||||
<col/>
|
||||
<col className={"w_50"}/>
|
||||
<col className={"w_100"}/>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>보기</th>
|
||||
<th>응답</th>
|
||||
<th>삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -148,13 +250,25 @@ function QuestionModal({svySeq}){
|
|||
setSelectedQt(qt);
|
||||
}}/>
|
||||
</td>
|
||||
<td>
|
||||
<Form.Check type="checkbox" name="questionYn"
|
||||
defaultChecked={item.questionYn==='Y'} checked={item.questionYn==='Y'}
|
||||
onClick={(e)=>{
|
||||
const qt = {...selectedQt}
|
||||
qt.itemList[index].questionYn = e.target.checked?'Y':'N'
|
||||
setSelectedQt(qt);
|
||||
}}/>
|
||||
</td>
|
||||
<td>
|
||||
<button className={"btn btn_red_h31"} onClick={()=>removeItem(index)}>삭제</button>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<td colSpan={2}>
|
||||
<button className={"btn btn_blue_h31"} onClick={addItem}>추가</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -164,7 +278,7 @@ function QuestionModal({svySeq}){
|
|||
</Row>
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<button type="button" className={"btn btn_blue_h31 px-3"}>저장</button>
|
||||
<button type="button" className={"btn btn_blue_h31 px-3"} onClick={editSurveyQt}>저장</button>
|
||||
</Modal.Footer>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.dbnt.kcscbackend.admin.contents.survey;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurvey;
|
||||
import com.dbnt.kcscbackend.admin.contents.survey.entity.TnSurveyQt;
|
||||
import com.dbnt.kcscbackend.admin.contents.survey.service.AdminSurveyService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
|
|
@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
|
@ -75,7 +77,7 @@ public class AdminSurveyController {
|
|||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/info-qt")
|
||||
public ResultVO surveyEditQt(TnSurvey survey) throws Exception{
|
||||
public ResultVO surveyQt(TnSurvey survey) throws Exception{
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
|
@ -83,4 +85,15 @@ public class AdminSurveyController {
|
|||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/info-qt")
|
||||
public ResultVO surveyQtEdit(@RequestBody List<TnSurveyQt> qtList, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
adminSurveyService.insertSurveyQt(qtList, user.getId());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage("저장 되었습니다.");
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ import java.util.List;
|
|||
|
||||
public interface TnSurveyQtItemRepository extends JpaRepository<TnSurveyQtItem, Integer> {
|
||||
List<TnSurveyQtItem> findByQtSeqInOrderByQtItemSeq(List<Integer> qtSeqList);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,6 @@ import java.util.List;
|
|||
|
||||
public interface TnSurveyQtRepository extends JpaRepository<TnSurveyQt, Integer> {
|
||||
List<TnSurveyQt> findBySvySeqOrderByQtSeq(Integer svySeq);
|
||||
|
||||
void deleteBySvySeq(Integer svySeq);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,20 @@ public class AdminSurveyService {
|
|||
public void deleteSurvey(Integer svySeq) {
|
||||
surveyRepository.deleteById(svySeq);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void insertSurveyQt(List<TnSurveyQt> qtList, String id) {
|
||||
qtRepository.deleteBySvySeq(qtList.get(0).getSvySeq());
|
||||
for(TnSurveyQt qt: qtList){
|
||||
qt.setQtSeq(null);
|
||||
}
|
||||
qtRepository.saveAll(qtList);
|
||||
for(TnSurveyQt qt: qtList){
|
||||
for(TnSurveyQtItem item: qt.getItemList()){
|
||||
item.setQtSeq(qt.getQtSeq());
|
||||
}
|
||||
itemRepository.saveAll(qt.getItemList());
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
|||
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
|
||||
HashMap<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
/*
|
||||
// 관리자 계정 로그인 제한 if문
|
||||
if(securityUser.getUserId().equals("admin") && !adminIpList.contains(accessIp)){
|
||||
resultMap.put("resultCode", ResponseCode.FAILED.getCode());
|
||||
resultMap.put("resultMessage", "관리자 계정은 지정된 아이피에서만 접속할 수 있습니다.\n필요한 경우 관리자에게 요청하십시오.\n접속자 아이피: "+ClientUtils.getRemoteIP(request));
|
||||
|
|
@ -74,16 +76,16 @@ public class CustomUrlAuthenticationSuccessHandler extends SimpleUrlAuthenticati
|
|||
resultMap.put("refreshToken", refreshToken);
|
||||
//로그인 로그 기록
|
||||
adminLogsService.insertLoginLog(securityUser.getUserId(), accessIp, accessToken, "Y", ClientUtils.getWebType(request));
|
||||
}
|
||||
/*
|
||||
// 로그인 제한 해제시 주석 해제 및 위 if문 주석처리 할 것.
|
||||
}*/
|
||||
|
||||
// 관리자 로그인 제한 해제 위 if문 주석처리 할 것.
|
||||
String accessToken = jwtTokenUtil.generateAccessToken(securityUser, request.getRemoteAddr());
|
||||
String refreshToken = jwtTokenUtil.generateRefreshTokenToken(securityUser, request.getRemoteAddr());
|
||||
resultMap.put("resultCode", ResponseCode.SUCCESS.getCode());
|
||||
resultMap.put("accessToken", accessToken);
|
||||
resultMap.put("refreshToken", refreshToken);
|
||||
adminLogsService.insertLoginLog(securityUser.getUserId(), accessIp, accessToken, "Y", ClientUtils.getWebType(request));
|
||||
*/
|
||||
|
||||
|
||||
if (jsonConverter.canWrite(resultMap.getClass(), jsonMimeType)) {
|
||||
jsonConverter.write(resultMap, jsonMimeType, new ServletServerHttpResponse(response));
|
||||
|
|
|
|||
Loading…
Reference in New Issue