Compare commits
12 Commits
4d60a15104
...
ac4625a174
| Author | SHA1 | Date |
|---|---|---|
|
|
ac4625a174 | |
|
|
cbefc9f74f | |
|
|
44b2507d99 | |
|
|
100656b50f | |
|
|
33da2b2129 | |
|
|
7933c125d5 | |
|
|
57d669cbdc | |
|
|
11ca97d87c | |
|
|
bfef1ce1a8 | |
|
|
efd35230c1 | |
|
|
a18f373701 | |
|
|
8ee3517f6b |
|
|
@ -6,6 +6,7 @@
|
|||
"@ant-design/colors": "^6.0.0",
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
"@babel/runtime": "^7.23.9",
|
||||
"@base2/pretty-print-object": "^1.0.2",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@material-ui/core": "^4.12.4",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useState} from 'react';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import { Link, NavLink, useNavigate } from 'react-router-dom';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
|
@ -64,6 +64,9 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
console.log("------------------------------EgovHeader [End]");
|
||||
console.groupEnd("EgovHeader");
|
||||
|
||||
useEffect(() => {
|
||||
setMenuDiv(false);
|
||||
}, [navigate]);
|
||||
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,214 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import DeleteIcon from '@mui/icons-material/Delete';
|
||||
import styled from "styled-components";
|
||||
import FileDragDrop from "./FileDragDrop";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
label {
|
||||
//background: red;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 2px dashed #888;
|
||||
border-radius: 6px;
|
||||
& > div {
|
||||
height: 100%;
|
||||
line-height: 37px;
|
||||
padding: 20px;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
function AttachFile(props) {
|
||||
|
||||
const multiple = props.multiple ? props.multiple : false;
|
||||
|
||||
// 삭제 버튼 눌렀을 때 파일선택 dialog가 뜨는 것을 방지
|
||||
let oldTagName;
|
||||
useEffect(function () {
|
||||
|
||||
const labelEle = document.querySelectorAll("label[for='preDataFile']")[0];
|
||||
console.log(labelEle); // NodeList(3) [li, li, li]
|
||||
// event
|
||||
const onClickLabel = (e) => {
|
||||
|
||||
const tagName = String(e.target.tagName).toLowerCase();
|
||||
|
||||
if( tagName !== 'input' ) {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
oldTagName = tagName;
|
||||
e.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
if(
|
||||
oldTagName === 'path' ||
|
||||
oldTagName === 'svg' ||
|
||||
oldTagName === 'button'
|
||||
) {
|
||||
oldTagName = undefined;
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// remove Event
|
||||
labelEle.removeEventListener("click", onClickLabel);
|
||||
labelEle.addEventListener("click", onClickLabel);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
|
||||
//기존 server에 upload된 file인 props.serverFiles file들을 렌더링 초기에 넣어 놓기
|
||||
useEffect(function () {
|
||||
|
||||
|
||||
if( !props.serverFiles ) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
for( let idx in props.serverFiles ) {
|
||||
props.serverFiles[idx].index=nNewIndex++;
|
||||
items.push( props.serverFiles[idx] );
|
||||
}
|
||||
setFileItem(items);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.serverFiles]);
|
||||
|
||||
|
||||
|
||||
|
||||
const [disabled, setDisabled] = useState( props.disabled ? props.disabled : false );
|
||||
useEffect(function () {
|
||||
if( !props.disabled ) {
|
||||
return;
|
||||
}
|
||||
setDisabled(props.disabled);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.disabled]);
|
||||
|
||||
|
||||
const [maxSize, setMaxSize] = useState(props.maxSize ? props.maxSize : 100);
|
||||
useEffect(function () {
|
||||
if( !props.maxSize ) {
|
||||
return;
|
||||
}
|
||||
setMaxSize(props.maxSize);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [props.maxSize]);
|
||||
|
||||
|
||||
const [fileItem, setFileItem] = useState();
|
||||
|
||||
const onDrop = (e) => {
|
||||
//alert('ddd');
|
||||
};
|
||||
|
||||
|
||||
const handleChange = (files) => {
|
||||
|
||||
|
||||
if( !files ) {
|
||||
return;
|
||||
}
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
|
||||
//파일이 이미 첨부되어 있는 상태에서 추가로 첨부한 경우 기존 것을 먼저 추가 후 새로운 항목을 추가한다.
|
||||
for( let idx in fileItem ) {
|
||||
fileItem[idx].index=nNewIndex++;
|
||||
items.push( fileItem[idx] );
|
||||
}
|
||||
|
||||
Object.keys(files).forEach(function(key, index) {
|
||||
//console.log(key, props.files[key]);
|
||||
if( typeof files[key].name === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
files[key].index=nNewIndex++;
|
||||
items.push( files[key] );
|
||||
});
|
||||
console.log('%o\n%o', files, items);
|
||||
setFileItem(items);
|
||||
props.setFiles(items);
|
||||
};
|
||||
|
||||
|
||||
const onClickDeleteItem = (e, targetEle) => {
|
||||
|
||||
const dataIndex = Number(targetEle.getAttribute('data-index'));
|
||||
|
||||
let items = [];
|
||||
let nNewIndex = 0;
|
||||
Object.keys(fileItem).forEach(function(key, index) {
|
||||
if( dataIndex !== index ) {
|
||||
fileItem[key].index=nNewIndex++;
|
||||
items.push( fileItem[key] );
|
||||
}
|
||||
});
|
||||
|
||||
setFileItem(items);
|
||||
props.setFiles(items);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledDiv>
|
||||
<FileDragDrop
|
||||
className="file-drag-drop"
|
||||
multiple={multiple}
|
||||
name={props.name}
|
||||
fileTypes={props.fileTypes}
|
||||
onDrop={onDrop}
|
||||
handleChange={handleChange}
|
||||
dropMessageStyle={{backgroundColor: '#cfe2ff'}}
|
||||
maxSize={maxSize}
|
||||
disabled={disabled}
|
||||
>
|
||||
<div>
|
||||
|
||||
{fileItem && fileItem.length > 0
|
||||
?
|
||||
fileItem.map((item) => (
|
||||
<span key={item.index} data-index={item.index}>
|
||||
<IconButton aria-label="delete" size="small"
|
||||
onClick={(e)=> {
|
||||
e = e || window.event;
|
||||
const target = e.target || e.srcElement;
|
||||
|
||||
console.log('%o', target);
|
||||
const tagName = String(target.tagName).toLowerCase();
|
||||
|
||||
// target 보정
|
||||
let targetEle = target.parentNode.parentNode.parentNode;
|
||||
if( tagName === 'svg' ) {
|
||||
targetEle = target.parentNode.parentNode;
|
||||
} else if( tagName === 'button' ) {
|
||||
targetEle = target.parentNode;
|
||||
}
|
||||
|
||||
onClickDeleteItem(e, targetEle);
|
||||
}}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
{item.name}<br />
|
||||
</span>
|
||||
))
|
||||
:
|
||||
<span><AttachFileIcon /> 파일을 마우스로 끌어놓으세요.</span>
|
||||
}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
</StyledDiv>
|
||||
);
|
||||
|
||||
}
|
||||
export default AttachFile;
|
||||
|
|
@ -7,17 +7,25 @@ import { FileUploader } from "react-drag-drop-files";
|
|||
* @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"];
|
||||
* @returns
|
||||
*/
|
||||
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle, name}) {
|
||||
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle, name, maxSize, disabled}) {
|
||||
|
||||
const temp = 0;
|
||||
|
||||
return (
|
||||
<FileUploader
|
||||
hoverTitle="여기에 파일을 놓아주세요"
|
||||
handleChange={handleChange}
|
||||
name={name}
|
||||
types={fileTypes ? fileTypes : "*"}
|
||||
multiple={multiple && false}
|
||||
multiple={multiple ? multiple : false}
|
||||
label={label}
|
||||
onDrop={onDrop}
|
||||
dropMessageStyle={dropMessageStyle}
|
||||
maxSize={maxSize}
|
||||
disabled={disabled}
|
||||
onSelect={(e)=> {
|
||||
e = e || window.event;
|
||||
}}
|
||||
>
|
||||
{children && children}
|
||||
</FileUploader>
|
||||
|
|
|
|||
|
|
@ -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;}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, {useState, useEffect, useRef} from 'react';
|
||||
import React, {useState, useEffect, useRef, useCallback} from 'react';
|
||||
import {Link, useNavigate, useLocation, useParams} from 'react-router-dom';
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
|
||||
|
|
@ -9,6 +9,7 @@ import CODE from 'constants/code';
|
|||
import {default as EgovLeftNav} from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
import EgovRadioButtonGroup from 'components/EgovRadioButtonGroup';
|
||||
import {Form} from "react-bootstrap";
|
||||
import RichTextEditor from "../../../components/editor/RichTextEditor";
|
||||
|
||||
|
||||
function AdminPostMgtEdit({props, reloadFunction}) {
|
||||
|
|
@ -30,7 +31,33 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
const [boardDetail, setBoardDetail] = useState({});
|
||||
console.log("@@@ mode : " + modeInfo.mode);
|
||||
|
||||
const [categoryList, setCategoryList] = useState([]);
|
||||
|
||||
const retrieveList = useCallback(() => {
|
||||
const retrieveListURL = '/admin/boards/get-category-list';
|
||||
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify()
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(retrieveListURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
setCategoryList(resp.result.categoryList);
|
||||
console.log("@@@ categoryList : " + JSON.stringify(resp.result.categoryList));
|
||||
},
|
||||
function (resp) {
|
||||
console.log("err response : ", resp);
|
||||
}
|
||||
);
|
||||
},[]);
|
||||
|
||||
useEffect(() => {
|
||||
retrieveList();
|
||||
initMode();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
|
@ -41,22 +68,24 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
}
|
||||
}
|
||||
|
||||
function editPartnerSite(e) {
|
||||
function editPost(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const form = e.target;
|
||||
const info = {
|
||||
siteTitle: form.siteTitle.value,
|
||||
siteUrl: form.siteUrl.value,
|
||||
fixedYn: defaultFixedYn,
|
||||
secretYn: defaultSecretYn,
|
||||
bbsId: form.bbsId.value,
|
||||
bbsSeq: selectedBbsSeq,
|
||||
bbsContTitle: form.bbsContTitle.value,
|
||||
fileGrpId: form.fileGrpId.value,
|
||||
siteOrder: form.siteOrder.value,
|
||||
useYn: form.useYn.value
|
||||
bbsContents: text
|
||||
}
|
||||
if (modeInfo.mode === CODE.MODE_MODIFY) {
|
||||
info.siteSeq = props.siteSeq;
|
||||
info.bbsContSeq = props.bbsContSeq;
|
||||
}
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/partner-site-mgt',
|
||||
'/admin/boards/post-mgt',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
|
@ -77,16 +106,16 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
)
|
||||
}
|
||||
|
||||
function deletePartnerSite(partnerSite){
|
||||
function deletePost(post){
|
||||
if(window.confirm("삭제하시겠습니까?")) {
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/partner-site-mgt',
|
||||
'/admin/boards/post-mgt',
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(partnerSite)
|
||||
body: JSON.stringify(post)
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
|
|
@ -106,9 +135,25 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
console.groupEnd("AdminPostMgtEdit");
|
||||
|
||||
const [defaultFixedYn, setDefaultFixedYn] = useState(props?.fixedYn || "N");
|
||||
const [defaultSecretYn, setDefaultSecretYn] = useState(props?.secretYn || "N");
|
||||
const [text, setText] = useState(props?.bbsContents);
|
||||
const [selectedBbsSeq, setSelectedBbsSeq] = useState(null);
|
||||
|
||||
const handleSelectChange = (e) => {
|
||||
const selectedBbsId = e.target.value;
|
||||
const selectedOption = categoryList.find((item) => item.bbsId === selectedBbsId);
|
||||
setSelectedBbsSeq(selectedOption.bbsSeq);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<style>
|
||||
{`
|
||||
.modal-dialog {
|
||||
max-width: 50%;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
{/* <!-- 본문 --> */}
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>
|
||||
|
|
@ -119,13 +164,13 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
|
||||
<Modal.Body>
|
||||
<div className="board_view2">
|
||||
<Form onSubmit={(e) => {editPartnerSite(e)}} noValidate>
|
||||
<Form onSubmit={(e) => {editPost(e)}} noValidate>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteTitle">상단고정</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
id="siteTitleCheckbox"
|
||||
id="fixedYnCheckbox"
|
||||
label="상단고정"
|
||||
checked={defaultFixedYn === 'Y'}
|
||||
onChange={(e) => setDefaultFixedYn(e.target.checked ? 'Y' : 'N')}
|
||||
|
|
@ -135,29 +180,44 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
<dl>
|
||||
<dt><label htmlFor="siteTitle">비밀글</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="siteTitle" placeholder="비밀글" required
|
||||
defaultValue={props?.siteTitle} readOnly={props!==undefined}/>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
id="secretYnCheckbox"
|
||||
label="비밀글"
|
||||
checked={defaultSecretYn === 'Y'}
|
||||
onChange={(e) => setDefaultSecretYn(e.target.checked ? 'Y' : 'N')}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteTitle">카테고리</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Select id="select1" name="bbsId" onChange={handleSelectChange}>
|
||||
<option value="">선택</option>
|
||||
{categoryList.map((item) => (
|
||||
<option key={item.bbsSeq} value={item.bbsId} selected={props?.bbsId === item.bbsId}>{item.bbsTitle}</option>
|
||||
))}
|
||||
</Form.Select>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteTitle">제목</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="siteTitle" placeholder="제목" required
|
||||
defaultValue={props?.siteTitle} readOnly={props!==undefined}/>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="bbsContTitle" placeholder="제목" required
|
||||
defaultValue={props?.bbsContTitle}/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteUrl">파일</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="siteUrl" placeholder="파일" required
|
||||
defaultValue={props?.siteUrl}/>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="fileGrpId" placeholder="파일" required
|
||||
defaultValue={props?.fileGrpId}/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="fileGrpId">내용</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Control className="f_txtar w_full" type="text" name="fileGrpId" placeholder="내용" required
|
||||
defaultValue={props?.fileGrpId}/>
|
||||
<RichTextEditor item={text} setText={setText}/>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
|
@ -167,7 +227,7 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
<button type="submit" className="btn btn_skyblue_h46 w_100">저장
|
||||
</button>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY &&
|
||||
<button type={"button"} className="btn btn_skyblue_h46 w_100" onClick={()=>{deletePartnerSite(props)}}>삭제</button>
|
||||
<button type={"button"} className="btn btn_skyblue_h46 w_100" onClick={()=>{deletePost(props)}}>삭제</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import CODE from "../../../constants/code";
|
|||
import AboutSiteModal from "../config/aboutSiteMgt/AboutSiteModal";
|
||||
import AdminPostMgtEdit from "./AdminPostMgtEdit";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import {format} from "date-fns";
|
||||
|
||||
function AdminPostMgtList(props) {
|
||||
console.group("EgovAdminPostList");
|
||||
|
|
@ -36,6 +37,7 @@ function AdminPostMgtList(props) {
|
|||
const handleShow = () => setShow(true);
|
||||
|
||||
const retrieveList = useCallback(() => {
|
||||
handleClose();
|
||||
console.groupCollapsed("EgovAdminPostList.retrieveList()");
|
||||
|
||||
const retrieveListURL = '/admin/boards/post-list';
|
||||
|
|
@ -60,15 +62,18 @@ function AdminPostMgtList(props) {
|
|||
// 리스트 항목 구성
|
||||
resp.result.postList.forEach(function (item, index) {
|
||||
if (index === 0) mutListTag = []; // 목록 초기화
|
||||
const finalModifiedDate = item.lastChgDt ? item.lastChgDt : item.frstCrtDt;
|
||||
const formattedDate = finalModifiedDate ? format(finalModifiedDate, "yyyy-MM-dd HH:mm") : "";
|
||||
|
||||
mutListTag.push(
|
||||
<div className="list_item">
|
||||
<div>{item.bbsContSeq}</div>
|
||||
<div>{item.bbsSeq}</div>
|
||||
<div></div>
|
||||
<div>{item.bbsContTitle}</div>
|
||||
<div>{item.bbsContents}</div>
|
||||
<div>{item.frstCrtId}</div>
|
||||
<div>{formattedDate}</div>
|
||||
<div>{item.bbsReadCnt}</div>
|
||||
<div>{item.bbsContLevel}</div>
|
||||
<div>{item.fileGrpId}</div>
|
||||
<div><button className={"btn btn_blue_h31 px-1"} onClick={()=>{editPost(item)}}>수정</button></div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
@ -153,9 +158,6 @@ function AdminPostMgtList(props) {
|
|||
}}>조회</button>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<Link to={URL.ADMIN_BOARD_CREATE} className="btn btn_blue_h46 pd35">등록</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* <!--// 검색조건 --> */}
|
||||
|
|
@ -166,7 +168,7 @@ function AdminPostMgtList(props) {
|
|||
<span></span>
|
||||
<span>제목</span>
|
||||
<span>작성자</span>
|
||||
<span>작성일</span>
|
||||
<span>최종수정일</span>
|
||||
<span>조회수</span>
|
||||
<span>파일</span>
|
||||
<span><button className={"btn btn_blue_h31 px-1"} onClick={()=>{editPost(undefined)}}>추가</button></span>
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ function EgovAdminBoardEdit({props, reloadFunction}) {
|
|||
<dd>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
id="siteTitleCheckbox"
|
||||
id="bbsAnsYnCheckbox"
|
||||
label="사용"
|
||||
checked={bbsAnsYn === 'Y'}
|
||||
onChange={(e) => setBbsAnsYn(e.target.checked ? 'Y' : 'N')}
|
||||
|
|
@ -203,7 +203,7 @@ function EgovAdminBoardEdit({props, reloadFunction}) {
|
|||
<dd>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
id="siteTitleCheckbox"
|
||||
id="bbsReplYnCheckbox"
|
||||
label="사용"
|
||||
checked={bbsReplYn === 'Y'}
|
||||
onChange={(e) => setBbsReplYn(e.target.checked ? 'Y' : 'N')}
|
||||
|
|
@ -215,7 +215,7 @@ function EgovAdminBoardEdit({props, reloadFunction}) {
|
|||
<dd>
|
||||
<Form.Check
|
||||
type="checkbox"
|
||||
id="siteTitleCheckbox"
|
||||
id="useYnCheckbox"
|
||||
label="사용"
|
||||
checked={useYn === 'Y'}
|
||||
onChange={(e) => setUseYn(e.target.checked ? 'Y' : 'N')}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,13 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||
|
||||
|
||||
import FileDragDrop from "components/file/FileDragDrop";
|
||||
|
||||
|
||||
|
||||
import AttachFile from "components/file/AttachFile";
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
import CODE from 'constants/code';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
|
||||
import 'react-datepicker/dist/react-datepicker.css';
|
||||
|
||||
import styled from "styled-components";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
|
||||
|
|
@ -35,15 +27,6 @@ const useStyles = makeStyles(() => ({
|
|||
}));
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
.org-under-id {
|
||||
margin-left: 20px;
|
||||
@media only screen and (max-width: 768px) {
|
||||
display: block;
|
||||
margin-left: 0px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.f_select.w_250 {
|
||||
@media only screen and (max-width: 768px) {
|
||||
width: 100%;
|
||||
|
|
@ -55,40 +38,17 @@ const StyledDiv = styled.div`
|
|||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.org-group-id-1 {
|
||||
margin: 0px 29px;
|
||||
@media only screen and (max-width: 768px) {
|
||||
margin: 0px;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
function AttachFile(props) {
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
const onDrop = (e) => {
|
||||
//alert('ddd');
|
||||
};
|
||||
|
||||
const handleChange = (file) => {
|
||||
props.setFile(file);
|
||||
};
|
||||
|
||||
return (
|
||||
<FileDragDrop
|
||||
className="file-drag-drop"
|
||||
multiple={false}
|
||||
name={props.name}
|
||||
fileTypes={fileTypes}
|
||||
onDrop={onDrop}
|
||||
handleChange={handleChange}
|
||||
dropMessageStyle={{backgroundColor: '#cfe2ff'}}
|
||||
>
|
||||
<div>
|
||||
<AttachFileIcon />
|
||||
{props.file ? props.file.name : props.fileName ? props.fileName : "파일을 마우스로 끌어놓으세요."}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function SchedulesEdit(props) {
|
||||
function ProgressStatusEdit(props) {
|
||||
console.group("EgovAdminScheduleEdit");
|
||||
console.log("[Start] EgovAdminScheduleEdit ------------------------------");
|
||||
console.log("EgovAdminScheduleEdit [props] : ", props);
|
||||
|
|
@ -117,16 +77,16 @@ function SchedulesEdit(props) {
|
|||
const [requestItems, setRequestItems] = useState
|
||||
(
|
||||
{
|
||||
orgGroupId: 1,
|
||||
startDate: new Date(),
|
||||
eventId : 0,
|
||||
}
|
||||
);
|
||||
|
||||
const [schdulBgndeHH, setSchdulBgndeHH] = useState();
|
||||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||
const [drftDatetimeHH, setDrftDatetimeHH] = useState();
|
||||
const [drftDatetimeMM, setDrftDatetimeMM] = useState();
|
||||
|
||||
const [scheduleInit, setScheduleInit] = useState({});
|
||||
const [scheduleApiOrgApiDepthList, setScheduleApiOrgApiDepthList] = useState({ });
|
||||
|
||||
|
||||
const initMode = () => {
|
||||
|
|
@ -152,7 +112,8 @@ function SchedulesEdit(props) {
|
|||
default:
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : ""}});
|
||||
}
|
||||
retrieveDetail();
|
||||
|
||||
getList(orgSearchCondition);
|
||||
}
|
||||
|
||||
const convertDate = (str) => {
|
||||
|
|
@ -171,35 +132,106 @@ function SchedulesEdit(props) {
|
|||
}
|
||||
}
|
||||
|
||||
const retrieveDetail = () => {
|
||||
|
||||
EgovNet.requestFetch("/schedule/init",
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
setScheduleInit(
|
||||
resp
|
||||
);
|
||||
const [orgSearchCondition, setOrgSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
||||
const [orgArray, setOrgArray] = useState([]);
|
||||
const [orgSelectedIndex, setOrgSelectedIndex] = useState([]);
|
||||
|
||||
if (modeInfo.mode === CODE.MODE_CREATE) {
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
getList(orgSearchCondition);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSearchCondition]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if ( typeof orgArray[0] === 'undefined' || typeof orgSelectedIndex[0] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const retrieveDetailURL = `/schedule/${location.state?.schdulId}`;
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
if( orgSelectedIndex[0] === 0) {
|
||||
orgArray[1] = undefined;
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], undefined, undefined]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof orgArray[0][orgSelectedIndex[0]-1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
EgovNet.requestFetch(retrieveDetailURL,
|
||||
|
||||
const paramCodeLevel = 'LV_02';
|
||||
const paramCodeGroup = orgArray[0][orgSelectedIndex[0]-1].orgId;
|
||||
setOrgSearchCondition({ paramCodeGroup, paramCodeLevel });
|
||||
orgArray[1] = undefined;
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], undefined, undefined]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[0]]);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if ( typeof orgArray[1] === 'undefined' || typeof orgSelectedIndex[1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( orgSelectedIndex[1] === 0) {
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], orgSelectedIndex[1], undefined]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof orgArray[0][orgSelectedIndex[1]-1] === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const paramCodeLevel = 'LV_03';
|
||||
const paramCodeGroup = orgArray[1][orgSelectedIndex[1]-1].orgId;
|
||||
setOrgSearchCondition({ paramCodeGroup, paramCodeLevel });
|
||||
|
||||
orgArray[2] = undefined;
|
||||
let forChangeObject = [...orgArray];
|
||||
setOrgArray(forChangeObject);
|
||||
setOrgSelectedIndex([orgSelectedIndex[0], orgSelectedIndex[1], undefined]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[1]]);
|
||||
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [orgSelectedIndex[2]]);
|
||||
|
||||
|
||||
|
||||
|
||||
const getList = (orgSearchCondition) => {
|
||||
|
||||
EgovNet.requestFetch(`/admin/config/committee-code-management?paramCodeGroup=${orgSearchCondition.paramCodeGroup}¶mCodeLevel=${orgSearchCondition.paramCodeLevel}`,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
const myIndex = Number(String(orgSearchCondition.paramCodeLevel).replace('LV_','')) - 1;
|
||||
const forCopy = [...orgArray];
|
||||
forCopy[myIndex] = resp.result.list;
|
||||
setOrgArray(forCopy);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
const updateSchedule = () => {
|
||||
const formData = new FormData();
|
||||
|
|
@ -283,46 +315,7 @@ function SchedulesEdit(props) {
|
|||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [requestItems]);
|
||||
|
||||
useEffect(function () {
|
||||
|
||||
EgovNet.requestFetch(`/schedule/api/org-api/depth/list?paramCodeGroup=${requestItems.upCommittee}`,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
setScheduleApiOrgApiDepthList(
|
||||
resp
|
||||
);
|
||||
}
|
||||
);
|
||||
console.log("------------------------------EgovAdminScheduleEdit [%o]", requestItems);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [requestItems && requestItems.upCommittee]);
|
||||
|
||||
|
||||
const onClickDeleteSchedule = (schdulId) => {
|
||||
const deleteBoardURL = `/schedule/${schdulId}`;
|
||||
|
||||
const requestOptions = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(deleteBoardURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
console.log("====>>> Schdule delete= ", resp);
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("게시글이 삭제되었습니다.")
|
||||
navigate(URL.ADMIN__COMMITTEE__SCHEDULES ,{ replace: true });
|
||||
} else {
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}});
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
//사전검토자료
|
||||
const [preDataFile, setPreDataFile] = useState(null);
|
||||
const [preDataFileName, setPreDataFileName] = useState(null);
|
||||
|
|
@ -333,11 +326,11 @@ function SchedulesEdit(props) {
|
|||
const [partnerFile, setPartnerFile] = useState(null);
|
||||
const [partnerFileName, setPartnerFileName] = useState(null);
|
||||
//조치계획서
|
||||
//const [preDataFile, setPreDataFile] = useState(null);
|
||||
//const [preDataFileName, setPreDataFileName] = useState(null);
|
||||
const [actionPlanFile, setActionPlanFile] = useState(null);
|
||||
const [actionPlanFileName, setActionPlanFileName] = useState(null);
|
||||
//조치결과서
|
||||
//const [preDataFile, setPreDataFile] = useState(null);
|
||||
//const [preDataFileName, setPreDataFileName] = useState(null);
|
||||
const [actionResultReportFile, setActionResultReportFile] = useState(null);
|
||||
const [actionResultReportFileName, setActionResultReportFileName] = useState(null);
|
||||
|
||||
|
||||
|
||||
|
|
@ -372,30 +365,30 @@ function SchedulesEdit(props) {
|
|||
{/* <!-- 게시판 상세보기 --> */}
|
||||
<StyledDiv className="board_view2">
|
||||
<dl>
|
||||
<dt><label htmlFor="title">안건</label><span className="req">필수</span></dt>
|
||||
<dt><label>안건</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="안건" id="title" placeholder="안건을 입력하세요."
|
||||
<input className="f_input2 w_full" type="text" name="title" title="안건" placeholder="안건을 입력하세요"
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">기준코드</label><span className="req">필수</span></dt>
|
||||
<dt><label>기준코드</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
<input className="f_input2 w_full" type="text" name="categoryId" title="기준코드" placeholder="여기를 눌러 기준코드를 선택하세요"
|
||||
value={requestItems.categoryId}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, categoryId: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">구분</label><span className="req">필수</span></dt>
|
||||
<dt><label>구분</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<label className="f_select w_150" htmlFor="div-meet">
|
||||
<select id="div-meet" name="div-meet" title="일정구분"
|
||||
value={requestItems.divMeet}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, divMeet: e.target.value })}>
|
||||
<label className="f_select w_150" >
|
||||
<select name="div-meet" title="재정 개정 재개정 선택"
|
||||
value={requestItems.drftTypeCode}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftTypeCode: e.target.value })}>
|
||||
<option key={"none"} value="">선택</option>
|
||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listCodes
|
||||
&& scheduleInit.result.listCodes.map((item) => (
|
||||
|
|
@ -406,60 +399,70 @@ function SchedulesEdit(props) {
|
|||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">회의일자</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의일자</label><span className="req">필수</span></dt>
|
||||
<dd className="datetime">
|
||||
<span className="line_break">
|
||||
<DatePicker
|
||||
selected={requestItems.startDate}
|
||||
name="schdulBgnde"
|
||||
selected={requestItems.drftDatetime}
|
||||
name="drftDatetime"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd HH:mm"
|
||||
showTimeInput
|
||||
dateFormat="yyyy-MM-dd"
|
||||
onChange={(date) => {
|
||||
console.log("setStartDate : ", date);
|
||||
setRequestItems({ ...requestItems, schdulBgnde: getDateFourteenDigit(date), schdulBgndeYYYMMDD: getYYYYMMDD(date), schdulBgndeHH: date.getHours(), schdulBgndeMM: date.getMinutes(), startDate: date });
|
||||
setSchdulBgndeHH(date.getHours());
|
||||
setSchdulBgndeMM(date.getMinutes());
|
||||
setRequestItems({ ...requestItems, schdulBgnde: getDateFourteenDigit(date), drftDatetimeYYYMMDD: getYYYYMMDD(date), drftDatetime: date });
|
||||
setDrftDatetimeHH(date.getHours());
|
||||
setDrftDatetimeMM(date.getMinutes());
|
||||
}} />
|
||||
<input type="hidden" name="schdulBgndeHH" defaultValue={schdulBgndeHH} readOnly />
|
||||
<input type="hidden" name="schdulBgndeMM" defaultValue={schdulBgndeMM} readOnly />
|
||||
<input type="hidden" name="drftDatetimeMM" defaultValue={drftDatetimeMM} readOnly />
|
||||
</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">위원회</label><span className="req">필수</span></dt>
|
||||
<dt><label>위원회</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
{/** top org */}
|
||||
<label className="f_select w_250 org-group-id" htmlFor="org-group-id">
|
||||
<select id="org-group-id" name="orgGroupId" title="심의위원회-상위"
|
||||
value={requestItems.upCommittee}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, upCommittee: e.target.value })}>
|
||||
<option value="">선택</option>
|
||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listTopOrg
|
||||
&& scheduleInit.result.listTopOrg.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.name}</option>
|
||||
<select id="org-group-id" name="orgGroupId" title="중앙건설기술심의 선택"
|
||||
value={requestItems.orgGroupId}
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId: e.target.value });
|
||||
orgSelectedIndex[0] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">중앙건설기술심의 선택</option>
|
||||
{orgArray && orgArray[0] && orgArray[0].map && orgArray[0].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="f_select w_250 org-group-id-1" htmlFor="org-group-id-1">
|
||||
<select id="org-group-id-1" name="orgGroupId1" title="심의위원회-상위"
|
||||
value={requestItems.upCommittee}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, upCommittee: e.target.value })}>
|
||||
<option value="">선택</option>
|
||||
{scheduleInit && scheduleInit.result && scheduleInit.result.listTopOrg
|
||||
&& scheduleInit.result.listTopOrg.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.name}</option>
|
||||
<select id="org-group-id-1" name="orgGroupId1" title="총괄건설기준위원회 선택"
|
||||
value={requestItems.orgGroupId1}
|
||||
defaultValue='1'
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId1: e.target.value });
|
||||
orgSelectedIndex[1] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">총괄건설기준위원회 선택</option>
|
||||
{orgArray && orgArray[1] && orgArray[1].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="f_select w_250 org-group-id-2" htmlFor="org-group-id-2">
|
||||
<select id="org-group-id-2" name="orgGroupId2" title="심의위원회-하위"
|
||||
value={requestItems.committee}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, committee: e.target.value })}>
|
||||
<option value="">선택</option>
|
||||
{scheduleApiOrgApiDepthList && scheduleApiOrgApiDepthList.result && scheduleApiOrgApiDepthList.result.list
|
||||
&& scheduleApiOrgApiDepthList.result.list.map((item) => (
|
||||
<option key={item.id} value={item.id}>{item.name}</option>
|
||||
<select id="org-group-id-2" name="orgGroupId2" title="기준위원회 선택"
|
||||
value={requestItems.orgGroupId2}
|
||||
onChange={(e) => {
|
||||
setRequestItems({ ...requestItems, orgGroupId2: e.target.value });
|
||||
orgSelectedIndex[2] = e.target.options.selectedIndex;
|
||||
let forChangeObject = [...orgSelectedIndex];
|
||||
setOrgSelectedIndex(forChangeObject);
|
||||
}}>
|
||||
<option value="">기준위원회 선택</option>
|
||||
{orgArray && orgArray[2] && orgArray[2].map((item, index) => (
|
||||
<option key={item.orgId} value={item.orgId} data-index={index}>{item.orgNm}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
|
|
@ -468,81 +471,57 @@ function SchedulesEdit(props) {
|
|||
<dl>
|
||||
<dt><label htmlFor="title">사전검토자료</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="preDataFile" file={preDataFile} setFile={setPreDataFile} fileName={preDataFileName} />
|
||||
<AttachFile name="preDataFile" file={preDataFile} setFile={setPreDataFile} fileName={preDataFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">사전검토양식</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="preFormFile" file={preFormFile} setFile={setPreFormFile} fileName={preFormFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">관계기관의견</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="partnerFile" file={partnerFile} setFile={setPartnerFile} fileName={partnerFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">조치계획서</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="actionPlanFile" file={actionPlanFile} setFile={setActionPlanFile} fileName={actionPlanFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">조치결과서</label><span className="req">필수</span></dt>
|
||||
<dt><label>조치결과서</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<AttachFile name="actionResultReportFile" file={actionResultReportFile} setFile={setActionResultReportFile} fileName={actionResultReportFileName} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">회의담당자</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의담당자</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
<input className="f_input2 w_full" type="text" name="drftConfeCharger" title="회의 담당자" placeholder="여기를 눌러 회의담당자를 선택하세요"
|
||||
value={requestItems.drftConfeCharger}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftConfeCharger: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">회의실 비밀번호</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의실 비밀번호</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
<input className="f_input2 w_full" type="text" name="drftConfePw" title="제목" placeholder="회의실 비밀번호를 입력하세요"
|
||||
value={requestItems.drftConfePw}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftConfePw: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">회의 안건</label><span className="req">필수</span></dt>
|
||||
<dt><label>회의 안건</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<dl>
|
||||
<dt><label htmlFor="title">제목</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={requestItems.title}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="location">장소</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="location" title="장소" id="location" placeholder="장소를 입력하세요."
|
||||
defaultValue={requestItems.location}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, location: e.target.value })} />
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="contents">내용</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<textarea className="f_txtar w_full h_100" name="contents" id="contents" cols="30" rows="10" placeholder="일정 내용을 입력하세요."
|
||||
defaultValue={requestItems.contents}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, contents: e.target.value })}
|
||||
<textarea className="f_txtar w_full h_100" name="drftSummery" cols="30" rows="10" placeholder="회의 안건 내용을 입력하세요."
|
||||
defaultValue={requestItems.drftSummery}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, drftSummery: e.target.value })}
|
||||
></textarea>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -553,12 +532,6 @@ function SchedulesEdit(props) {
|
|||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={() => updateSchedule()}
|
||||
> 저장</button>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY &&
|
||||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={(e) => {
|
||||
onClickDeleteSchedule(location.state?.schdulId);
|
||||
}}>삭제</button>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -578,4 +551,4 @@ function SchedulesEdit(props) {
|
|||
);
|
||||
}
|
||||
|
||||
export default SchedulesEdit;
|
||||
export default ProgressStatusEdit;
|
||||
|
|
@ -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,7 +81,6 @@ function MenuAuthMgt(props) {
|
|||
},[]);
|
||||
|
||||
function editMenu(menu){
|
||||
if(window.confirm("수정하시겠습니까?")) {
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/menu-auth-mgt',
|
||||
{
|
||||
|
|
@ -94,7 +101,6 @@ function MenuAuthMgt(props) {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
retrieveList();
|
||||
|
|
@ -126,7 +132,6 @@ function MenuAuthMgt(props) {
|
|||
<div className="head">
|
||||
<span>메뉴 코드</span>
|
||||
<span>메뉴 이름</span>
|
||||
<span>부모 메뉴</span>
|
||||
{roleHeader}
|
||||
<span className={"saveBtnDiv"}></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
import FileDragDrop from "../../../../components/file/FileDragDrop";
|
||||
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
||||
|
||||
import EgovAttachFile from 'components/EgovAttachFile';
|
||||
import AttachFile from "../../../../components/file/AttachFile";
|
||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
||||
import CODE from 'constants/code';
|
||||
|
|
@ -59,7 +56,7 @@ function PopupEditor(props) {
|
|||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||
const [fileName, setFileName] = useState();
|
||||
|
||||
|
||||
const [confirm, setConfirm] = React.useState();
|
||||
|
||||
|
|
@ -140,8 +137,8 @@ function PopupEditor(props) {
|
|||
setText(rawDetail.contents);
|
||||
setTextOriginal(rawDetail.contents);
|
||||
|
||||
if( rawDetail.fileName ) {
|
||||
setFileName(rawDetail.fileName);
|
||||
if( rawDetail.files ) {
|
||||
setServerFiles(rawDetail.files);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -167,7 +164,14 @@ function PopupEditor(props) {
|
|||
formData.append("contents", text);
|
||||
|
||||
//첨부파일
|
||||
formData.append("file", file);
|
||||
//formData.append("files", files);
|
||||
for(let i=0; i<files.length; i++) {
|
||||
// seq 항목을 가지고 있다면 그건 server에 이미 upload된 file이므로 continue
|
||||
if( files[i].seq ) {
|
||||
continue;
|
||||
}
|
||||
formData.append("files", files[i]);
|
||||
}
|
||||
|
||||
if (formValidator(formData)) {
|
||||
const requestOptions = {
|
||||
|
|
@ -264,22 +268,15 @@ function PopupEditor(props) {
|
|||
}
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
const onDrop = (e) => {
|
||||
//alert('ddd');
|
||||
|
||||
const [serverFiles, setServerFiles] = useState();
|
||||
const [files, setFiles] = useState();
|
||||
/*
|
||||
let files = null;
|
||||
const setFiles = (myFiles) => {
|
||||
files = myFiles;
|
||||
};
|
||||
|
||||
const [file, setFile] = useState(null);
|
||||
const handleChange = (file) => {
|
||||
setFile(file);
|
||||
};
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if( file ) {
|
||||
console.log('%o', file);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [file]);
|
||||
*/
|
||||
|
||||
|
||||
const Location = React.memo(function Location() {
|
||||
|
|
@ -367,21 +364,7 @@ function PopupEditor(props) {
|
|||
<dl className="file-attach-wrapper">
|
||||
<dt>첨부파일</dt>
|
||||
<dd>
|
||||
<span className="file_attach">
|
||||
<FileDragDrop
|
||||
className="file-drag-drop"
|
||||
multiple={false}
|
||||
fileTypes={fileTypes}
|
||||
onDrop={onDrop}
|
||||
handleChange={handleChange}
|
||||
dropMessageStyle={{backgroundColor: '#cfe2ff'}}
|
||||
>
|
||||
<div>
|
||||
<AttachFileIcon />
|
||||
{file ? file.name : fileName ? fileName : "파일을 마우스로 끌어놓으세요."}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
</span>
|
||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import React, {useCallback, useEffect, useState} from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import URL from 'constants/url';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
import * as EgovNet from "../../../api/egovFetch";
|
||||
import * as EgovNet from "api/egovFetch";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import Form from "react-bootstrap/Form";
|
||||
import SurveyModal from "./survey/SurveyModal";
|
||||
import QuestionModal from "./survey/QuestionModal";
|
||||
import CODE from "../../../constants/code";
|
||||
|
||||
|
||||
function Survey({}) {
|
||||
|
|
@ -38,15 +38,12 @@ function Survey({}) {
|
|||
<div>{item.svyTitle}</div>
|
||||
<div>{item.svyStartDt}~{item.svyEndDt}</div>
|
||||
<div><button className={"btn btn_blue_h31 px-1"} onClick={()=>{editSurveyQt(item)}}>질문관리</button></div>
|
||||
<div></div>
|
||||
<div><Form.Check type={"switch"} defaultChecked={item.useYn==="Y"} onChange={()=>editUseYn(item.svySeq)}/></div>
|
||||
<div><button className={"btn btn_blue_h31 px-1"}>설문지 보기</button></div>
|
||||
<div><button className={"btn btn_blue_h31 px-1"}>통계 보기</button></div>
|
||||
<div>
|
||||
<button className={"btn btn_blue_h31 px-1"} onClick={()=>{editSurvey(item)}}>수정</button>
|
||||
</div>
|
||||
<div>
|
||||
<button className={"btn btn_red_h31 px-1"} onClick={()=>{editSurvey(item)}}>삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
@ -59,6 +56,29 @@ function Survey({}) {
|
|||
);
|
||||
},[]);
|
||||
|
||||
function editUseYn(svySeq){
|
||||
EgovNet.requestFetch(
|
||||
'/admin/survey/info-use-yn',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({svySeq:svySeq})
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("저장되었습니다.")
|
||||
retrieveList();
|
||||
}else{
|
||||
alert(resp.resultMessage)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function editSurvey(item){
|
||||
handleShow();
|
||||
setModalSize("md")
|
||||
|
|
@ -103,7 +123,6 @@ function Survey({}) {
|
|||
<span>사용여부</span>
|
||||
<span>설문지 보기</span>
|
||||
<span>통계 보기</span>
|
||||
<span></span>
|
||||
<span><button className={"btn btn_blue_h31 px-1"} onClick={()=>{editSurvey(undefined)}}>추가</button></span>
|
||||
</div>
|
||||
<div className="result">
|
||||
|
|
|
|||
|
|
@ -5,15 +5,17 @@ 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}){
|
||||
|
||||
const [qtList, setQtList] = useState([]);
|
||||
const [selectedQt, setSelectedQt] = useState(null);
|
||||
const [tempSeq, setTempSeq] = useState(1);
|
||||
|
||||
function getSurveyQt(){
|
||||
EgovNet.requestFetch(
|
||||
'/admin/survey/edit-qt?svySeq='+svySeq,
|
||||
'/admin/survey/info-qt?svySeq='+svySeq,
|
||||
{
|
||||
method: "GET"
|
||||
},
|
||||
|
|
@ -27,21 +29,94 @@ function QuestionModal({svySeq}){
|
|||
}
|
||||
|
||||
function addQt(){
|
||||
const temp = [...qtList]
|
||||
temp.push({
|
||||
qtSeq: null,
|
||||
tempSeq: tempSeq,
|
||||
svySeq: svySeq,
|
||||
qtTitle: '',
|
||||
qtDesc: '',
|
||||
qtType: '',
|
||||
maxNo: '',
|
||||
etcYn: '',
|
||||
itemList:[]
|
||||
})
|
||||
setQtList(temp);
|
||||
setTempSeq(tempSeq+1);
|
||||
}
|
||||
|
||||
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(() => {
|
||||
getSurveyQt()
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const tempQt = [...qtList];
|
||||
tempQt.forEach(function (qt, index){
|
||||
if(qt.qtSeq === null){
|
||||
if(qt.tempSeq === selectedQt?.tempSeq){
|
||||
tempQt[index] = selectedQt;
|
||||
}
|
||||
}else if(qt.qtSeq === selectedQt?.qtSeq){
|
||||
tempQt[index] = selectedQt;
|
||||
}
|
||||
})
|
||||
setQtList(tempQt);
|
||||
}, [selectedQt]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
}, [qtList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal.Header closeButton>
|
||||
|
|
@ -51,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>
|
||||
);
|
||||
|
|
@ -69,23 +156,51 @@ function QuestionModal({svySeq}){
|
|||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<td colSpan={2}>
|
||||
<button className={"btn btn_blue_h31"} onClick={addQt}>추가</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</Table>
|
||||
</Col>
|
||||
<Col xs={7}>
|
||||
<Col xs={7} className={selectedQt?"":"d-none"}>
|
||||
<Form.Group as={Row} className="mb-3">
|
||||
<Form.Label column sm={3}>
|
||||
질문유형
|
||||
</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':''}`}>
|
||||
|
|
@ -93,27 +208,59 @@ function QuestionModal({svySeq}){
|
|||
최대 선택 개수
|
||||
</Form.Label>
|
||||
<Col sm={3}>
|
||||
<Form.Control type="text" name="maxNo" defaultValue={selectedQt?.maxNo}/>
|
||||
<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="mandatoryYn" checked={selectedQt?.mandatoryYn==='Y'}/>
|
||||
<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>
|
||||
{selectedQt?.itemList.map(item=>{
|
||||
{selectedQt?.itemList.map((item, index)=>{
|
||||
return (
|
||||
<tr>
|
||||
<td>
|
||||
<Form.Control type={"text"} defaultValue={item.itemNm}/>
|
||||
<Form.Control type={"text"} defaultValue={item.itemNm} value={item.itemNm}
|
||||
onChange={(e)=>{
|
||||
const qt = {...selectedQt}
|
||||
qt.itemList[index].itemNm = e.target.value
|
||||
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>
|
||||
);
|
||||
|
|
@ -121,7 +268,7 @@ function QuestionModal({svySeq}){
|
|||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<td colSpan={2}>
|
||||
<button className={"btn btn_blue_h31"} onClick={addItem}>추가</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -131,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,41 +1,61 @@
|
|||
import React from "react";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import Form from "react-bootstrap/Form";
|
||||
import Row from "react-bootstrap/Row";
|
||||
import Col from "react-bootstrap/Col";
|
||||
import * as EgovNet from "api/egovFetch";
|
||||
import CODE from "constants/code";
|
||||
import DatePicker from "react-datepicker";
|
||||
|
||||
function SurveyModal({savedInfo, reloadFunction}){
|
||||
|
||||
const [survey, setSurvey] = useState({
|
||||
svySeq: savedInfo?savedInfo.svySeq:null,
|
||||
svyTitle: savedInfo?savedInfo.svyTitle:'',
|
||||
svyDesc: savedInfo?savedInfo.svyDesc:'',
|
||||
svyStartDt: savedInfo?new Date(savedInfo.svyStartDt):new Date(),
|
||||
svyEndDt: savedInfo?new Date(savedInfo.svyEndDt):new Date(),
|
||||
})
|
||||
|
||||
function editSurvey(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const form = e.target;
|
||||
const info = {
|
||||
menuId: form.menuId.value,
|
||||
menuTitle: form.menuTitle.value,
|
||||
menuGroup: form.menuGroup.value,
|
||||
menuLevel: form.menuLevel.value,
|
||||
menuSort: form.menuSort.value,
|
||||
menuUrl: form.menuUrl.value,
|
||||
menuTypeCd: form.menuTypeCd.value,
|
||||
}
|
||||
EgovNet.requestFetch(
|
||||
'/admin/config/menu-mgt',
|
||||
'/admin/survey/info',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(info)
|
||||
body: JSON.stringify(survey)
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("저장되었습니다.")
|
||||
reloadFunction();
|
||||
}else if(Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)){
|
||||
console.log("토큰 갱신중.")
|
||||
}else{
|
||||
alert(resp.resultMessage)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function deleteSurvey(e,svySeq){
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
EgovNet.requestFetch(
|
||||
'/admin/survey/info',
|
||||
{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({svySeq:svySeq})
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("삭제되었습니다.")
|
||||
reloadFunction();
|
||||
}else{
|
||||
alert(resp.resultMessage)
|
||||
}
|
||||
|
|
@ -57,7 +77,8 @@ function SurveyModal({savedInfo, reloadFunction}){
|
|||
제목
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control type="email" name="svyTitle" required defaultValue={savedInfo?.svyTitle} />
|
||||
<Form.Control type="email" name="svyTitle" required defaultValue={survey.svyTitle}
|
||||
onChange={(e)=>{setSurvey({...survey, svyTitle:e.target.value})}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row} className="mb-3">
|
||||
|
|
@ -65,37 +86,38 @@ function SurveyModal({savedInfo, reloadFunction}){
|
|||
설명
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control as={"textarea"} name="svyDesc" rows={3} defaultValue={savedInfo?.svyDesc}/>
|
||||
<Form.Control as={"textarea"} name="svyDesc" rows={3} defaultValue={survey.svyDesc}
|
||||
onChange={(e)=>{setSurvey({...survey, svyDesc:e.target.value})}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row} className="mb-3">
|
||||
<Form.Label column sm={3}>
|
||||
시작일
|
||||
설문기간
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control type="text" name="svyStartDt" required defaultValue={savedInfo?.svyStartDt} />
|
||||
<DatePicker selectsRange inline format={"yyyy-MM-dd"}
|
||||
selected={survey.svyEndDt} minDate={new Date()}
|
||||
startDate={survey.svyStartDt} endDate={survey.svyEndDt}
|
||||
onChange={(dates)=>{
|
||||
const [start, end] = dates;
|
||||
setSurvey({...survey, svyStartDt:start, svyEndDt: end})
|
||||
}}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row} className="mb-3">
|
||||
<Form.Label column sm={3}>
|
||||
종료일
|
||||
<Form.Label column sm={12}>
|
||||
* 목록에서 사용 여부를 변경해야 설문이 노출됩니다.
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control type="text" name="svyEndDt" required defaultValue={savedInfo?.svyEndDt} />
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Form.Group as={Row} className="mb-3">
|
||||
<Form.Label column sm={3}>
|
||||
첨부파일
|
||||
</Form.Label>
|
||||
<Col sm={9}>
|
||||
<Form.Control type="text" name="fileGrpId" selectedValue={savedInfo?.fileGrpId}/>
|
||||
</Col>
|
||||
</Form.Group>
|
||||
<Row className="mb-3">
|
||||
<Col xs={10}></Col>
|
||||
{survey.svySeq?
|
||||
<Col xs={2}>
|
||||
<button type="submit" className={"btn btn_blue_h31 px-3"}>저장</button>
|
||||
<button className={"btn btn_red_h31"} onClick={(e)=>{deleteSurvey(e, survey.svySeq)}}>삭제</button>
|
||||
</Col>
|
||||
:''}
|
||||
<Col xs={survey.svySeq?8:10}></Col>
|
||||
<Col xs={2}>
|
||||
<button type="submit" className={"btn btn_blue_h31"}>저장</button>
|
||||
</Col>
|
||||
</Row>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -1135,6 +1135,11 @@
|
|||
resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz"
|
||||
integrity sha512-4iri8i1AqYHJE2DstZYkyEprg6Pq6sKx3xn5FpySk9sNhH7qN2LLlHJCfDTZRILNwQNPD7mATWM0TBui7uC1pA==
|
||||
|
||||
"@base2/pretty-print-object@^1.0.2":
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.2.tgz#e30192222fd13e3c1e97040163d6628a95f70844"
|
||||
integrity sha512-rBha0UDfV7EmBRjWrGG7Cpwxg8WomPlo0q+R2so47ZFf9wy4YKJzLuHcVa0UGFjdcLZj/4F/1FNC46GIQhe7sA==
|
||||
|
||||
"@bcoe/v8-coverage@^0.2.3":
|
||||
version "0.2.3"
|
||||
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
|
||||
|
|
@ -8623,7 +8628,7 @@ react-drag-drop-files@^2.3.10:
|
|||
|
||||
react-element-to-jsx-string@^15.0.0:
|
||||
version "15.0.0"
|
||||
resolved "https://registry.npmjs.org/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz"
|
||||
resolved "https://registry.yarnpkg.com/react-element-to-jsx-string/-/react-element-to-jsx-string-15.0.0.tgz#1cafd5b6ad41946ffc8755e254da3fc752a01ac6"
|
||||
integrity sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==
|
||||
dependencies:
|
||||
"@base2/pretty-print-object" "1.0.1"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.dbnt.kcscbackend.admin.boards;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
||||
import com.dbnt.kcscbackend.admin.boards.entity.TnBbsContents;
|
||||
import com.dbnt.kcscbackend.admin.boards.service.AdminBoardsService;
|
||||
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
|
|
@ -9,6 +10,7 @@ import com.dbnt.kcscbackend.commonCode.service.CommonCodeService;
|
|||
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
|
|
@ -23,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -118,7 +122,7 @@ public class AdminBoardsController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/board-mgt")
|
||||
public ResultVO removeBoardMgt(@RequestBody TnBbs bbs, @AuthenticationPrincipal LoginVO user) {
|
||||
public ResultVO deleteBoardMgt(@RequestBody TnBbs bbs, @AuthenticationPrincipal LoginVO user) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
if (user == null) {
|
||||
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
|
||||
|
|
@ -154,4 +158,83 @@ public class AdminBoardsController extends BaseController {
|
|||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "게시물 카테고리 셀렉트박스 옵션 조회",
|
||||
description = "게시물 카테고리 셀렉트박스 옵션 조회",
|
||||
tags = {"AdminBoardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/get-category-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO getCategoryList() throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
resultMap.put("categoryList", adminBoardsService.selectBoardList());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "게시물 저장",
|
||||
description = "게시물 저장",
|
||||
tags = {"AdminBoardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "저장 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/post-mgt")
|
||||
public ResultVO savePostMgt(@RequestBody @Valid TnBbsContents contents, HttpServletRequest request, Errors errors, @AuthenticationPrincipal LoginVO user) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
if (user == null) {
|
||||
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
|
||||
} else {
|
||||
if (errors.hasErrors()) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for (FieldError error : errors.getFieldErrors()) {
|
||||
msg.append(error.getDefaultMessage());
|
||||
msg.append("\n");
|
||||
}
|
||||
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
|
||||
resultVO.setResultMessage(msg.toString());
|
||||
} else {
|
||||
System.out.println("@@@ contents.getBbsSeq() : " + contents.getBbsContSeq());
|
||||
contents.setIpAddress(ClientUtils.getRemoteIP(request));
|
||||
adminBoardsService.savePost(contents, user.getId());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
}
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "게시물 삭제",
|
||||
description = "게시물 삭제",
|
||||
tags = {"AdminBoardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "삭제 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/post-mgt")
|
||||
public ResultVO deletePostMgt(@RequestBody TnBbsContents contents, HttpServletRequest request, @AuthenticationPrincipal LoginVO user) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
if (user == null) {
|
||||
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
|
||||
} else {
|
||||
contents.setIpAddress(ClientUtils.getRemoteIP(request));
|
||||
String result = adminBoardsService.deletePost(contents, user.getId());
|
||||
if (result == null) {
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
} else if (result.equals("notFind")) {
|
||||
resultVO.setResultCode(ResponseCode.SAVE_ERROR.getCode());
|
||||
resultVO.setResultMessage("대상이 존재하지 않습니다.");
|
||||
}
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ public class TnBbsContents {
|
|||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "bbs_cont_seq")
|
||||
private Integer bbsContSeq;
|
||||
private Long bbsContSeq;
|
||||
|
||||
@Column(name = "bbs_seq", nullable = false)
|
||||
private Integer bbsSeq;
|
||||
private Long bbsSeq;
|
||||
|
||||
@Column(name = "bbs_cont_title")
|
||||
private String bbsContTitle;
|
||||
|
|
@ -31,22 +31,22 @@ public class TnBbsContents {
|
|||
private String bbsContents;
|
||||
|
||||
@Column(name = "bbs_cont_seq_group")
|
||||
private Integer bbsContSeqGroup;
|
||||
private Long bbsContSeqGroup;
|
||||
|
||||
@Column(name = "bbs_cont_seq_parent")
|
||||
private Integer bbsContSeqParent;
|
||||
private Long bbsContSeqParent;
|
||||
|
||||
@Column(name = "bbs_cont_level", nullable = false)
|
||||
private Integer bbsContLevel;
|
||||
private Long bbsContLevel;
|
||||
|
||||
@Column(name = "bbs_cont_sort")
|
||||
private Integer bbsContSort;
|
||||
private Long bbsContSort;
|
||||
|
||||
@Column(name = "file_grp_id")
|
||||
private String fileGrpId;
|
||||
|
||||
@Column(name = "bbs_read_cnt", nullable = false)
|
||||
private Integer bbsReadCnt;
|
||||
private Long bbsReadCnt;
|
||||
|
||||
@Column(name = "fixed_yn", nullable = false)
|
||||
private String fixedYn;
|
||||
|
|
@ -58,7 +58,7 @@ public class TnBbsContents {
|
|||
private String secretPwd;
|
||||
|
||||
@Column(name = "doc_info_seq")
|
||||
private Integer docInfoSeq;
|
||||
private Long docInfoSeq;
|
||||
|
||||
@Column(name = "ip_address", nullable = false)
|
||||
private String ipAddress;
|
||||
|
|
@ -79,5 +79,8 @@ public class TnBbsContents {
|
|||
private String useYn;
|
||||
|
||||
@Column(name = "old_seq")
|
||||
private Integer oldSeq;
|
||||
private Long oldSeq;
|
||||
|
||||
@Column(name = "bbs_id")
|
||||
private String bbsId;
|
||||
}
|
||||
|
|
@ -2,7 +2,17 @@ package com.dbnt.kcscbackend.admin.boards.repository;
|
|||
|
||||
import com.dbnt.kcscbackend.admin.boards.entity.TnBbsContents;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TnBbsContentsRepository extends JpaRepository<TnBbsContents, Long> {
|
||||
|
||||
@Query(value = "SELECT entity FROM TnBbsContents entity " +
|
||||
"WHERE entity.useYn = 'Y' " +
|
||||
"AND entity.bbsId = :bbsId " +
|
||||
"ORDER BY entity.bbsContSeq DESC")
|
||||
List<TnBbsContents> findByBbsId(@Param("bbsId") String bbsId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ package com.dbnt.kcscbackend.admin.boards.repository;
|
|||
|
||||
import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TnBbsRepository extends JpaRepository<TnBbs, Long> {
|
||||
|
||||
@Query(value = "SELECT * FROM tn_bbs ORDER BY bbs_seq DESC", nativeQuery = true)
|
||||
List<TnBbs> findAllByOrderByBbsSeqDesc();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,6 @@ public class AdminBoardsService extends EgovAbstractServiceImpl {
|
|||
return tnBbsRepository.findAllByOrderByBbsSeqDesc();
|
||||
}
|
||||
|
||||
public Optional<TnBbs> selectBoard(Long bbsSeq) {
|
||||
return tnBbsRepository.findById(bbsSeq);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveBoard(TnBbs bbs, String userId) {
|
||||
if (bbs.getBbsSeq() == null) {
|
||||
|
|
@ -70,4 +66,45 @@ public class AdminBoardsService extends EgovAbstractServiceImpl {
|
|||
return tnBbsContentsRepository.findAll();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void savePost(TnBbsContents contents, String userId) {
|
||||
if (contents.getBbsContSeq() == null) {
|
||||
// TODO 하드코딩
|
||||
contents.setBbsContLevel(1L);
|
||||
contents.setBbsReadCnt(0L);
|
||||
contents.setUseYn("Y");
|
||||
contents.setFrstCrtDt(LocalDateTime.now());
|
||||
contents.setFrstCrtId(userId);
|
||||
tnBbsContentsRepository.save(contents);
|
||||
} else {
|
||||
TnBbsContents savedPost = tnBbsContentsRepository.findById(contents.getBbsContSeq()).orElse(null);
|
||||
savedPost.setFixedYn(contents.getFixedYn());
|
||||
savedPost.setSecretYn(contents.getSecretYn());
|
||||
savedPost.setBbsId(contents.getBbsId());
|
||||
savedPost.setBbsContTitle(contents.getBbsContTitle());
|
||||
savedPost.setFileGrpId(contents.getFileGrpId());
|
||||
savedPost.setBbsContents(contents.getBbsContents());
|
||||
savedPost.setIpAddress(contents.getIpAddress());
|
||||
savedPost.setUseYn("Y");
|
||||
savedPost.setLastChgId(userId);
|
||||
savedPost.setLastChgDt(LocalDateTime.now());
|
||||
tnBbsContentsRepository.save(savedPost);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public String deletePost(TnBbsContents contents, String userId) {
|
||||
TnBbsContents savedPost = tnBbsContentsRepository.findById(contents.getBbsContSeq()).orElse(null);
|
||||
if (savedPost == null) {
|
||||
return "notFind";
|
||||
} else {
|
||||
savedPost.setIpAddress(contents.getIpAddress());
|
||||
savedPost.setUseYn("N");
|
||||
savedPost.setLastChgDt(LocalDateTime.now());
|
||||
savedPost.setLastChgId(userId);
|
||||
tnBbsContentsRepository.save(savedPost);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,13 +88,13 @@ public class PopUpApiController {
|
|||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
final MultipartHttpServletRequest multiRequest,
|
||||
CreatePopupVO createPopupVO,
|
||||
@RequestParam(required = false) MultipartFile file
|
||||
@RequestParam(required = false) MultipartFile[] files
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, file);
|
||||
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, files);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
|
|
@ -129,14 +129,14 @@ public class PopUpApiController {
|
|||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
UpdatePopupVO updatePopupVO,
|
||||
@RequestParam(required = false) MultipartFile file,
|
||||
@RequestParam(required = false) MultipartFile[] files,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, file, popupId);
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
|
|||
|
||||
public interface PopUpApiService {
|
||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile file) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile file, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupId) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile[] files) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupSeq) throws Exception;
|
||||
public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupSeq) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile file) throws Exception {
|
||||
public ResultVO contentsApiPopUpManageCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreatePopupVO createPopupVO, MultipartFile[] files) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
|
|
@ -115,7 +115,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
);
|
||||
|
||||
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath());
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||
createPopupVO.getTitle(),
|
||||
|
|
@ -173,13 +173,24 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
dto.put("schdulEndde", tnPopupMng.getPopupEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
|
||||
//첨부파일명을 가져온다.
|
||||
TnAttachFile tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||
List<TnAttachFile> tnAttachFileList = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||
|
||||
if( tnAttachFile != null ) {
|
||||
dto.put("fileName", tnAttachFile.getFileOldName());
|
||||
} else {
|
||||
dto.put("fileName", null);
|
||||
if( tnAttachFileList != null ) {
|
||||
List<Map<String, Object>> files = new ArrayList<Map<String, Object>>();
|
||||
for (TnAttachFile item : tnAttachFileList) {
|
||||
Map<String, Object> fileDto = new HashMap<String, Object>();
|
||||
fileDto.put("seq", item.getFileSeq());
|
||||
fileDto.put("name", item.getFileOldName());
|
||||
files.add(fileDto);
|
||||
}
|
||||
dto.put("files", files);
|
||||
} else {
|
||||
dto.put("files", null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
|
|
@ -189,20 +200,20 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile file, Long popupId) throws Exception {
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, Long popupSeq) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"updatePopupVO:" + "\n" +
|
||||
updatePopupVO.toString() + "\n" +
|
||||
"popupId:" + "\n" +
|
||||
popupId + "\n" +
|
||||
"popupSeq:" + "\n" +
|
||||
popupSeq + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
// 유효성 검사 실시
|
||||
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() );
|
||||
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupSeq.intValue() );
|
||||
|
||||
if( isValid == 0 ) {
|
||||
throw new Exception("대상이 존재하지 않습니다.");
|
||||
|
|
@ -212,10 +223,14 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
}
|
||||
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
// 기존 첨부된 file이 있다면 기존 fileGrpId을 활용한다.
|
||||
TnPopupMng tnPopupMng = tnPopupMngRepository.findByPopupSeq(popupSeq);
|
||||
|
||||
String fileGrpId = tnPopupMng.getFileGrpId();
|
||||
fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath(), fileGrpId);
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||
popupId.intValue(),
|
||||
popupSeq.intValue(),
|
||||
updatePopupVO.getTitle(),
|
||||
updatePopupVO.getStartDate(),
|
||||
updatePopupVO.getEndDate(),
|
||||
|
|
@ -230,7 +245,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
dto.put("popupId", popupId);
|
||||
dto.put("popupId", popupSeq);
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
|
|
|
|||
|
|
@ -1,18 +1,25 @@
|
|||
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;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
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
|
||||
|
|
@ -32,18 +39,45 @@ public class AdminSurveyController {
|
|||
return resultVO;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/edit")
|
||||
public ResultVO surveyEdit(TnSurvey survey) throws Exception{
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/info")
|
||||
public ResultVO surveyEdit(@RequestBody @Valid TnSurvey survey, Errors errors, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("survey", adminSurveyService.selectSurvey(survey));
|
||||
resultVO.setResult(resultMap);
|
||||
if(errors.hasErrors()){
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for(FieldError error: errors.getFieldErrors()){
|
||||
msg.append(error.getDefaultMessage());
|
||||
msg.append("\n");
|
||||
}
|
||||
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
|
||||
resultVO.setResultMessage(msg.toString());
|
||||
}else {
|
||||
adminSurveyService.insertSurvey(survey, user.getId());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage("저장 되었습니다.");
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/edit-qt")
|
||||
public ResultVO surveyEditQt(TnSurvey survey) throws Exception{
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/info")
|
||||
public ResultVO surveyDelete(@RequestBody TnSurvey survey, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
adminSurveyService.deleteSurvey(survey.getSvySeq());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage("저장 되었습니다.");
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/info-use-yn")
|
||||
public ResultVO surveyUseYn(@RequestBody TnSurvey survey, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
adminSurveyService.updateSurveyUseYn(survey.getSvySeq(), user.getId());
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage("저장 되었습니다.");
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/info-qt")
|
||||
public ResultVO surveyQt(TnSurvey survey) throws Exception{
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
|
@ -51,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
@ -22,16 +21,20 @@ import java.time.LocalDateTime;
|
|||
@Table(name = "tn_survey")
|
||||
public class TnSurvey {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "svy_seq")
|
||||
private Integer svySeq;
|
||||
|
||||
@Column(name = "svy_title")
|
||||
@NotBlank(message = "설문 제목을 입력해주세요.")
|
||||
private String svyTitle;
|
||||
@Column(name = "svy_desc")
|
||||
private String svyDesc;
|
||||
@Column(name = "svy_start_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate svyStartDt;
|
||||
@Column(name = "svy_end_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate svyEndDt;
|
||||
@Column(name = "file_grp_id")
|
||||
private String fileGrpId;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
@Table(name = "tn_survey_qt")
|
||||
public class TnSurveyQt {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "qt_seq")
|
||||
private Integer qtSeq;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ import lombok.Setter;
|
|||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
|
@ -20,6 +17,7 @@ import javax.persistence.Table;
|
|||
@Table(name = "tn_survey_qt_item")
|
||||
public class TnSurveyQtItem {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "qt_item_seq")
|
||||
private Integer qtItemSeq;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ import com.dbnt.kcscbackend.admin.contents.survey.repository.TnSurveyQtRepositor
|
|||
import com.dbnt.kcscbackend.admin.contents.survey.repository.TnSurveyRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -43,4 +45,52 @@ public class AdminSurveyService {
|
|||
}
|
||||
return qtList;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void insertSurvey(TnSurvey survey, String insertUser) {
|
||||
if(survey.getSvySeq()==null){
|
||||
survey.setFrstCrtId(insertUser);
|
||||
survey.setFrstCrtDt(LocalDateTime.now());
|
||||
survey.setUseYn("N");
|
||||
surveyRepository.save(survey);
|
||||
}else{
|
||||
TnSurvey savedInfo = surveyRepository.findById(survey.getSvySeq()).orElse(null);
|
||||
savedInfo.setSvyTitle(survey.getSvyTitle());
|
||||
savedInfo.setSvyDesc(survey.getSvyDesc());
|
||||
savedInfo.setSvyStartDt(survey.getSvyStartDt());
|
||||
savedInfo.setSvyEndDt(survey.getSvyEndDt());
|
||||
savedInfo.setLastChgId(insertUser);
|
||||
savedInfo.setLastChgDt(LocalDateTime.now());
|
||||
surveyRepository.save(savedInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateSurveyUseYn(Integer svySeq, String updateUser) {
|
||||
TnSurvey savedInfo = surveyRepository.findById(svySeq).orElse(null);
|
||||
savedInfo.setUseYn(savedInfo.getUseYn().equals("Y")?"N":"Y");
|
||||
savedInfo.setLastChgId(updateUser);
|
||||
savedInfo.setLastChgDt(LocalDateTime.now());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ import org.springframework.data.jpa.repository.Query;
|
|||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> {
|
||||
|
||||
Optional<TnAttachFile> findByFileGrpId(String fileGrpId);
|
||||
Optional<List<TnAttachFile>> findByFileGrpId(String fileGrpId);
|
||||
|
||||
@Procedure("make_file_grp_id")
|
||||
String makeFileGrpId( String modiId );
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -32,7 +29,7 @@ public class FileService {
|
|||
if(tnAttachFile.getFileSeq()!=null){
|
||||
tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null);
|
||||
}else{
|
||||
tnAttachFile = tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null);
|
||||
tnAttachFile = Objects.requireNonNull(tnAttachFileRepository.findByFileGrpId(tnAttachFile.getFileGrpId()).orElse(null)).get(0);
|
||||
}
|
||||
int downCnt = tnAttachFile.getDownCnt()==null?0: tnAttachFile.getDownCnt();
|
||||
tnAttachFile.setDownCnt(downCnt+1);
|
||||
|
|
@ -50,30 +47,54 @@ public class FileService {
|
|||
* TN_ATTACH_FILE 참고.
|
||||
* @param request
|
||||
* @param user
|
||||
* @param file
|
||||
* @param files
|
||||
* @param middlePath 파일이 저장될 중간 경로다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
||||
* @return 파일 그룹 ID
|
||||
* @throws Exception
|
||||
*/
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile[] files, String middlePath) throws Exception {
|
||||
return this.addTnAttachFile(request, user, files, middlePath, null);
|
||||
}
|
||||
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile file, String middlePath) throws Exception {
|
||||
MultipartFile[] files = new MultipartFile[1];
|
||||
return this.addTnAttachFile(request, user, files, middlePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* TN_ATTACH_FILE table에 insert 후, 파일 그룹 ID를 return 한다.
|
||||
* TN_ATTACH_FILE 참고.
|
||||
* @param request
|
||||
* @param user
|
||||
* @param files
|
||||
* @param middlePath 파일이 저장될 중간 경로다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
* 참고로 D:/kcscUploadFiles 값은 application-xxx.properties에 있는 Globals.fileStorePath를 통해 얻는다.
|
||||
* @return 파일 그룹 ID
|
||||
* @throws Exception
|
||||
*/
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile[] files, String middlePath, String fileGrpId) throws Exception {
|
||||
String ipAddress = NetworkUtil.getClientIpAddress(request);
|
||||
|
||||
String fileGrpId = null;
|
||||
if( file != null && !file.isEmpty()) {
|
||||
|
||||
if( fileGrpId == null || fileGrpId.trim().isEmpty()) {
|
||||
//String fileGrpId = UUID.randomUUID().toString();
|
||||
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||
}
|
||||
|
||||
|
||||
for (MultipartFile file : files) {if( file != null && !file.isEmpty()) {
|
||||
|
||||
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
||||
filesMap.put("file", file);
|
||||
|
||||
//String fileGrpId = UUID.randomUUID().toString();
|
||||
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||
|
||||
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||
List<FileVO> fileVoList = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||
|
||||
int nCount = 1;
|
||||
// 업로드된 file을 tnAttachFile에 insert한다.
|
||||
for (Iterator<FileVO> iter = files.iterator(); iter.hasNext(); nCount++) {
|
||||
for (Iterator<FileVO> iter = fileVoList.iterator(); iter.hasNext(); nCount++) {
|
||||
|
||||
FileVO item = iter.next();
|
||||
|
||||
|
|
@ -94,6 +115,9 @@ public class FileService {
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return fileGrpId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue