Compare commits
9 Commits
4642e5d820
...
a4a33196cf
| Author | SHA1 | Date |
|---|---|---|
|
|
a4a33196cf | |
|
|
3744b08f9a | |
|
|
4468bd78a9 | |
|
|
788b1910ed | |
|
|
5b18827bb5 | |
|
|
f454a5900f | |
|
|
2530a3e847 | |
|
|
c3cd079a8f | |
|
|
3c00f5101b |
|
|
@ -4,7 +4,7 @@
|
|||
NODE_PATH=src/
|
||||
|
||||
## 절대경로 지정
|
||||
REACT_APP_EGOV_CONTEXT_URL=118.219.150.34:50688
|
||||
REACT_APP_EGOV_CONTEXT_URL=https://back.kcsc.dbnt.co.kr
|
||||
|
||||
## [보안] 소스맵 삭제
|
||||
GENERATE_SOURCEMAP=false
|
||||
|
|
|
|||
|
|
@ -23,6 +23,6 @@ function App() {
|
|||
}
|
||||
|
||||
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
|
||||
console.log("process.env.REACT_APP_EGOV_CONTEXT_URL", process.env.REACT_APP_EGOV_CONTEXT_URL);
|
||||
console.log("process.env.REACT_APP_EGOV_CONTEXT_URL", "[" + process.env.REACT_APP_EGOV_CONTEXT_URL + "]");
|
||||
|
||||
export default App;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ SimpleDialog.propTypes = {
|
|||
};
|
||||
|
||||
export default function LoadingProgress({open, setOpen}) {
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SimpleDialog
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const SERVER_URL = "http://"+process.env.REACT_APP_EGOV_CONTEXT_URL; // REST API 서버 Domain URL
|
||||
export const SERVER_URL = String(process.env.REACT_APP_EGOV_CONTEXT_URL).indexOf('http') !== -1 ? process.env.REACT_APP_EGOV_CONTEXT_URL : "http://"+process.env.REACT_APP_EGOV_CONTEXT_URL; // REST API 서버 Domain URL
|
||||
export const DEFAULT_BBS_ID = "BBSMSTR_AAAAAAAAAAAA"; // default = 공지사항 게시판 아이디
|
||||
export const NOTICE_BBS_ID = "BBSMSTR_AAAAAAAAAAAA"; // 공지사항 게시판 아이디
|
||||
export const GALLERY_BBS_ID = "BBSMSTR_BBBBBBBBBBBB"; // 갤러리 게시판 아이디
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {default as EgovLeftNav} from 'components/leftmenu/EgovLeftNavAdmin';
|
|||
import EgovRadioButtonGroup from 'components/EgovRadioButtonGroup';
|
||||
import {Form} from "react-bootstrap";
|
||||
import RichTextEditor from "../../../components/editor/RichTextEditor";
|
||||
import AttachFile from "../../../components/file/AttachFile";
|
||||
|
||||
|
||||
function AdminPostMgtEdit({props, reloadFunction}) {
|
||||
|
|
@ -34,27 +35,31 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
const [categoryList, setCategoryList] = useState([]);
|
||||
|
||||
const retrieveList = useCallback(() => {
|
||||
const retrieveListURL = '/admin/boards/get-category-list';
|
||||
const retrieveListURL = '/admin/boards/get-category-and-file-list';
|
||||
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify()
|
||||
body: JSON.stringify(item ? item : {})
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(retrieveListURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
setCategoryList(resp.result.categoryList);
|
||||
if (resp.result.files) {
|
||||
setServerFiles(resp.result.files);
|
||||
console.log("@@@ files : " + JSON.stringify(resp.result.files));
|
||||
}
|
||||
console.log("@@@ categoryList : " + JSON.stringify(resp.result.categoryList));
|
||||
},
|
||||
function (resp) {
|
||||
console.log("err response : ", resp);
|
||||
}
|
||||
);
|
||||
},[]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
retrieveList();
|
||||
|
|
@ -65,33 +70,40 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
const initMode = () => {
|
||||
if (modeInfo.mode === CODE.MODE_MODIFY) {
|
||||
setBoardDetail(item);
|
||||
setSelectedBbsSeq(props?.bbsSeq);
|
||||
}
|
||||
}
|
||||
|
||||
function editPost(e) {
|
||||
const formData = new FormData();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const form = e.target;
|
||||
const info = {
|
||||
fixedYn: defaultFixedYn,
|
||||
secretYn: defaultSecretYn,
|
||||
bbsId: form.bbsId.value,
|
||||
bbsSeq: selectedBbsSeq,
|
||||
bbsContTitle: form.bbsContTitle.value,
|
||||
fileGrpId: form.fileGrpId.value,
|
||||
bbsContents: text
|
||||
formData.append('fixedYn', defaultFixedYn);
|
||||
formData.append('secretYn', defaultSecretYn);
|
||||
formData.append('bbsId', form.bbsId.value);
|
||||
formData.append('bbsSeq', selectedBbsSeq);
|
||||
formData.append('bbsContTitle', form.bbsContTitle.value);
|
||||
formData.append('bbsContents', text);
|
||||
//첨부파일
|
||||
if (files) {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
if (files[i].seq) {
|
||||
// 살아남은 file의 seq 목록 서버로 보내면 서버가 알아서 기존파일을 정리해준다.
|
||||
formData.append("survivingFiles", files[i].seq);
|
||||
continue;
|
||||
}
|
||||
formData.append("files", files[i]);
|
||||
}
|
||||
}
|
||||
if (modeInfo.mode === CODE.MODE_MODIFY) {
|
||||
info.bbsContSeq = props.bbsContSeq;
|
||||
formData.append('bbsContSeq', props.bbsContSeq);
|
||||
}
|
||||
EgovNet.requestFetch(
|
||||
'/admin/boards/post-mgt',
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(info)
|
||||
body: formData
|
||||
},
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
|
|
@ -106,8 +118,8 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
)
|
||||
}
|
||||
|
||||
function deletePost(post){
|
||||
if(window.confirm("삭제하시겠습니까?")) {
|
||||
function deletePost(post) {
|
||||
if (window.confirm("삭제하시겠습니까?")) {
|
||||
EgovNet.requestFetch(
|
||||
'/admin/boards/post-mgt',
|
||||
{
|
||||
|
|
@ -145,6 +157,28 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
setSelectedBbsSeq(selectedOption.bbsSeq);
|
||||
}
|
||||
|
||||
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
|
||||
const [serverFiles, setServerFiles] = useState([]);
|
||||
const [files, setFiles] = useState([]);
|
||||
|
||||
// 첨부된 file을 삭제하는 요청
|
||||
const deleteFile = (fileSeq) => {
|
||||
const deleteFileURL = `/contents/api/popup-manage/file/${fileSeq}`;
|
||||
|
||||
const requestOptions = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(deleteFileURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<style>
|
||||
|
|
@ -164,7 +198,9 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
|
||||
<Modal.Body>
|
||||
<div className="board_view2">
|
||||
<Form onSubmit={(e) => {editPost(e)}} noValidate>
|
||||
<Form onSubmit={(e) => {
|
||||
editPost(e)
|
||||
}} noValidate>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteTitle">상단고정</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
|
|
@ -208,14 +244,13 @@ function AdminPostMgtEdit({props, reloadFunction}) {
|
|||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="siteUrl">파일</label><span className="req">필수</span></dt>
|
||||
<dt><label htmlFor="fileGrpId">파일</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<Form.Control className="f_input2 w_full" type="text" name="fileGrpId" placeholder="파일" required
|
||||
defaultValue={props?.fileGrpId}/>
|
||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} deleteFile={deleteFile}/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label htmlFor="fileGrpId">내용</label><span className="req">필수</span></dt>
|
||||
<dt><label htmlFor="contents">내용</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<RichTextEditor item={text} setText={setText}/>
|
||||
</dd>
|
||||
|
|
@ -227,12 +262,17 @@ 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={()=>{deletePost(props)}}>삭제</button>
|
||||
<button type={"button"} className="btn btn_skyblue_h46 w_100" onClick={() => {
|
||||
deletePost(props)
|
||||
}}>삭제</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className="right_col btn1">
|
||||
<button type={"button"} className="btn btn_blue_h46 w_100" onClick={()=>{reloadFunction()}}>목록</button>
|
||||
<button type={"button"} className="btn btn_blue_h46 w_100" onClick={() => {
|
||||
reloadFunction()
|
||||
}}>목록
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 버튼영역 --> */}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import AboutSiteModal from "../config/aboutSiteMgt/AboutSiteModal";
|
|||
import AdminPostMgtEdit from "./AdminPostMgtEdit";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import {format} from "date-fns";
|
||||
import {Form} from "react-bootstrap";
|
||||
|
||||
function AdminPostMgtList(props) {
|
||||
console.group("EgovAdminPostList");
|
||||
|
|
@ -30,6 +31,7 @@ function AdminPostMgtList(props) {
|
|||
const wrdRef = useRef();
|
||||
|
||||
const [listTag, setListTag] = useState([]);
|
||||
const [categoryList, setCategoryList] = useState([]);
|
||||
|
||||
const [show, setShow] = useState(false);
|
||||
const [modalBody, setModalBody] = useState();
|
||||
|
|
@ -55,6 +57,7 @@ function AdminPostMgtList(props) {
|
|||
requestOptions,
|
||||
(resp) => {
|
||||
setPaginationInfo(resp.result.paginationInfo);
|
||||
setCategoryList(resp.result.categoryList);
|
||||
|
||||
let mutListTag = [];
|
||||
listTag.push(<p className="no_data" key="0">검색된 결과가 없습니다.</p>); // 게시판 목록 초기값
|
||||
|
|
@ -92,6 +95,10 @@ function AdminPostMgtList(props) {
|
|||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const handleSelectChange = (e) => {
|
||||
|
||||
}
|
||||
|
||||
function editPost(item){
|
||||
handleShow();
|
||||
if(item != undefined) {
|
||||
|
|
@ -134,14 +141,12 @@ function AdminPostMgtList(props) {
|
|||
<li className="third_1 L">
|
||||
<span className="lb">검색유형선택</span>
|
||||
<label className="f_select" htmlFor="searchCnd">
|
||||
<select id="searchCnd" name="searchCnd" title="검색유형선택" ref={cndRef}
|
||||
onChange={e => {
|
||||
cndRef.current.value = e.target.value;
|
||||
}}
|
||||
>
|
||||
<option value="0">게시판명</option>
|
||||
<option value="1">게시판유형</option>
|
||||
</select>
|
||||
<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>
|
||||
</label>
|
||||
</li>
|
||||
<li className="third_2 R">
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
||||
|
|
@ -27,13 +28,13 @@ const StyledDiv = styled.div`
|
|||
width: 300px;
|
||||
}
|
||||
&:nth-child(4) {
|
||||
width: 120px;
|
||||
width: 110px;
|
||||
}
|
||||
&:nth-child(5) {
|
||||
width: 80px;
|
||||
width: 70px;
|
||||
}
|
||||
&:nth-child(6) {
|
||||
width: 70px;
|
||||
width: 60px;
|
||||
}
|
||||
&:nth-child(7) {
|
||||
width: 50px;
|
||||
|
|
@ -60,13 +61,13 @@ const StyledDiv = styled.div`
|
|||
width: 300px;
|
||||
}
|
||||
&:nth-child(4) {
|
||||
width: 120px;
|
||||
width: 110px;
|
||||
}
|
||||
&:nth-child(5) {
|
||||
width: 80px;
|
||||
width: 70px;
|
||||
}
|
||||
&:nth-child(6) {
|
||||
width: 70px;
|
||||
width: 60px;
|
||||
}
|
||||
&:nth-child(7) {
|
||||
width: 50px;
|
||||
|
|
@ -77,6 +78,18 @@ const StyledDiv = styled.div`
|
|||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.code-name {
|
||||
color: #001574;
|
||||
padding: 0px 0px 3px 0px;
|
||||
border-bottom: 0px solid #e8e8e8;
|
||||
&:hover {
|
||||
border-bottom: 1px solid #001574;
|
||||
}
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +121,7 @@ function ProgressStatus(props) {
|
|||
|
||||
const location = useLocation();
|
||||
|
||||
const [listItem, setListItem] = useState([]);
|
||||
const [listItem, setListItem] = useState();
|
||||
const [paginationInfo, setPaginationInfo] = useState({});
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });
|
||||
|
||||
|
|
@ -181,16 +194,21 @@ function ProgressStatus(props) {
|
|||
<span>수정</span>
|
||||
<span>삭제</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="result">
|
||||
{/* <!-- case : 데이터 없을때 --> */}
|
||||
{listItem.length === 0 &&
|
||||
{typeof listItem === 'undefined' &&
|
||||
<p className="no_data" key="0"><LinearProgress /></p>
|
||||
}
|
||||
{listItem && listItem.length === 0 &&
|
||||
<p className="no_data" key="0">검색된 결과가 없습니다.</p>
|
||||
}
|
||||
{listItem.map((it)=>(
|
||||
}
|
||||
{listItem && listItem.map((it)=>(
|
||||
<div className='list_item' key={it.seq}>
|
||||
<div>{it.number}</div>
|
||||
<div>{it.drftTypeNm}</div>
|
||||
<div>{it.categoryNm}<br /><Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS__DETAIL} state={{drftSeq: it.seq}} className="home">{it.title}</Link></div>
|
||||
<div>{it.categoryNm}<br /><Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS__DETAIL} state={{drftSeq: it.seq}} className="code-name">{it.title}</Link></div>
|
||||
<div>{it.orgNm}</div>
|
||||
<div>진행단계표시</div>
|
||||
<div>{it.regDate}</div>
|
||||
|
|
@ -199,6 +217,8 @@ function ProgressStatus(props) {
|
|||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{/* <!--// 게시판목록 --> */}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ import CODE from 'constants/code';
|
|||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
|
||||
import ReferenceCodePopupInput from './ReferenceCodePopupInput';
|
||||
|
||||
|
||||
import styled from "styled-components";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
|
||||
|
|
@ -376,9 +379,9 @@ function ProgressStatusEdit(props) {
|
|||
<dl>
|
||||
<dt><label>기준코드</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="categoryId" title="기준코드" placeholder="여기를 눌러 기준코드를 선택하세요"
|
||||
value={requestItems.categoryId}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, categoryId: e.target.value })}
|
||||
<ReferenceCodePopupInput
|
||||
requestItems={requestItems}
|
||||
setRequestItems={setRequestItems}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Box from '@mui/material/Box';
|
||||
import { Dialog, DialogContent, makeStyles, Theme, Typography } from "@material-ui/core";
|
||||
|
||||
import ReferenceCodePopupDialogCotents from './ReferenceCodePopupDialogCotents';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
backDrop: {
|
||||
backdropFilter: "blur(3px)",
|
||||
backgroundColor:'rgba(0,0,30,0.4)'
|
||||
},
|
||||
}));
|
||||
|
||||
function SimpleDialog(props) {
|
||||
|
||||
const classes = useStyles();
|
||||
|
||||
const { onClose, open } = props;
|
||||
|
||||
|
||||
const handleClose = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
disableEscapeKeyDown={false}
|
||||
BackdropProps={{
|
||||
classes: {
|
||||
root: classes.backDrop,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<DialogContent style={{ textAlign: "center", background: 'rgba(0,0,0,0)' }}>
|
||||
<Box sx={{ display: 'flex', width: '100%', padding: '0px' }}>
|
||||
<ReferenceCodePopupDialogCotents />
|
||||
</Box>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
SimpleDialog.propTypes = {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
open: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
export default function ReferenceCodePopupDialog({open, setOpen}) {
|
||||
|
||||
const handleClose = () => {
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SimpleDialog
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import { styled, ThemeProvider, createTheme } from '@mui/material/styles';
|
||||
import List from '@mui/material/List';
|
||||
import ListItemButton from '@mui/material/ListItemButton';
|
||||
import ListItemText from '@mui/material/ListItemText';
|
||||
import Paper from '@mui/material/Paper';
|
||||
|
||||
import ListSubheader from '@mui/material/ListSubheader';
|
||||
|
||||
import ReferenceCodePopupDialogCotentsHeader from './ReferenceCodePopupDialogCotentsHeader';
|
||||
import ReferenceCodePopupDialogCotentsListItem from './ReferenceCodePopupDialogCotentsListItem';
|
||||
|
||||
|
||||
|
||||
|
||||
const data = [
|
||||
{
|
||||
codeTitle: "KDS 10 00 00",
|
||||
codeName: '설계기준',
|
||||
depth: 1,
|
||||
children: [
|
||||
{
|
||||
codeTitle: "KDS 10 10 00",
|
||||
codeName: '공통편',
|
||||
depth: 2,
|
||||
children: [
|
||||
{
|
||||
codeTitle: "KDS 10 10 00",
|
||||
codeName: '공통편',
|
||||
depth: 3,
|
||||
children: [
|
||||
{
|
||||
codeTitle: "KDS 10 00 00",
|
||||
codeName: '공통 설계기준',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 10 20 00",
|
||||
codeName: '지반 설계 기준',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 12 00 00",
|
||||
codeName: '건설측량 설계기준',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 14 00 00",
|
||||
codeName: '구조 설계기준',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 17 00 00",
|
||||
codeName: '내진 설계기준',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 10 20 00",
|
||||
codeName: '시설물편',
|
||||
depth: 3,
|
||||
children: [
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "TEST 17 00 00",
|
||||
codeName: 'test',
|
||||
depth: 4,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
codeTitle: "KDS 10 20 00",
|
||||
codeName: '시설물편',
|
||||
depth: 2,
|
||||
children: [
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
{ codeTitle: "KCS 20 00 00", codeName: '표준시방서', depth: 1, },
|
||||
{ codeTitle: "SMCS 40 00 00", codeName: '서울시 전문시방서', depth: 1, },
|
||||
{ codeTitle: "EXCS 50 00 00", codeName: '고속도로공사 전문시방서', depth: 1, },
|
||||
{ codeTitle: "KRCCS 60 00 00", codeName: '농업생산기반시설 전문시방서', depth: 1, },
|
||||
];
|
||||
|
||||
|
||||
const FireNav = styled(List)({
|
||||
'& .MuiListItemButton-root': {
|
||||
paddingLeft: 0,
|
||||
paddingRight: 0,
|
||||
background: '#fafafa',
|
||||
},
|
||||
'& .MuiListItemIcon-root': {
|
||||
minWidth: 0,
|
||||
marginRight: 16,
|
||||
},
|
||||
'& .MuiSvgIcon-root': {
|
||||
fontSize: 20,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
export default function ReferenceCodePopupDialogCotents() {
|
||||
|
||||
const [selectedValue, setSelectedValue] = React.useState('a');
|
||||
|
||||
const handleChange = (event) => {
|
||||
setSelectedValue(event.target.value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex' }}>
|
||||
<ThemeProvider
|
||||
theme={createTheme({
|
||||
components: {
|
||||
MuiListItemButton: {
|
||||
defaultProps: {
|
||||
disableTouchRipple: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
palette: {
|
||||
mode: 'dark',
|
||||
primary: { main: 'rgb(102, 157, 246)' },
|
||||
background: { paper: 'rgb(5, 30, 52)' },
|
||||
},
|
||||
})}
|
||||
>
|
||||
<Paper elevation={0} sx={{ maxWidth: 520 }}>
|
||||
<FireNav component="nav" disablePadding>
|
||||
<ListItemButton component="a" href="#customized-list">
|
||||
<ListItemText
|
||||
sx={{ my: 0 }}
|
||||
primary="문서번호 또는 코드명을 선택 하시면 하위 문서를 검색 하실 수 있습니다"
|
||||
primaryTypographyProps={{
|
||||
backgroundColor: '#001e4f',
|
||||
color: '#ffffff',
|
||||
fontSize: 15,
|
||||
fontWeight: 'medium',
|
||||
letterSpacing: 0,
|
||||
padding: '10px',
|
||||
borderRadius: '6px',
|
||||
}}
|
||||
/>
|
||||
</ListItemButton>
|
||||
|
||||
<List
|
||||
sx={{ width: '100%', bgcolor: 'background.paper' }}
|
||||
component="nav"
|
||||
aria-labelledby="nested-list-subheader"
|
||||
subheader={
|
||||
<ListSubheader component="div" id="nested-list-subheader">
|
||||
<ReferenceCodePopupDialogCotentsHeader />
|
||||
</ListSubheader>
|
||||
}
|
||||
>
|
||||
<ListItemButton>
|
||||
<ReferenceCodePopupDialogCotentsListItem
|
||||
data={data}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</List>
|
||||
|
||||
</FireNav>
|
||||
</Paper>
|
||||
</ThemeProvider>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import { styled, } from '@mui/material/styles';
|
||||
|
||||
|
||||
|
||||
const ItemHeader = styled('div')(({ theme }) => ({
|
||||
padding: theme.spacing(1),
|
||||
borderRadius: '4px',
|
||||
textAlign: 'left',
|
||||
}));
|
||||
|
||||
export default function ReferenceCodePopupDialogCotentsHeader() {
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
display: 'grid',
|
||||
gridAutoFlow: 'row',
|
||||
gridTemplateColumns: 'auto 120px 90px',
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<ItemHeader>문서번호</ItemHeader>
|
||||
<ItemHeader>코드명</ItemHeader>
|
||||
<ItemHeader sx={{textAlign: 'center'}}>선택</ItemHeader>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
import * as React from 'react';
|
||||
import List from '@mui/material/List';
|
||||
import ListItem from '@mui/material/ListItem';
|
||||
import ListItemButton from '@mui/material/ListItemButton';
|
||||
import Divider from '@mui/material/Divider';
|
||||
|
||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import RemoveIcon from '@mui/icons-material/Remove';
|
||||
|
||||
|
||||
import Box from '@mui/material/Box';
|
||||
import Collapse from '@mui/material/Collapse';
|
||||
|
||||
|
||||
|
||||
import { styled } from '@mui/material/styles';
|
||||
|
||||
|
||||
const Item = styled('div')(({ theme }) => ({
|
||||
padding: '0px',
|
||||
borderRadius: '4px',
|
||||
textAlign: 'left',
|
||||
}));
|
||||
|
||||
|
||||
|
||||
const ItemComponent = (props) => {
|
||||
const {item, index, openSelf} = props;
|
||||
|
||||
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const handleClick = () => {
|
||||
setOpen(!open);
|
||||
};
|
||||
|
||||
return (
|
||||
<Collapse in={openSelf} timeout="auto" unmountOnExit sx={{width: '100%'}}>
|
||||
<ListItem disablePadding sx={{ width: '100%'}}>
|
||||
<List sx={{ paddingTop: '0px', paddingBottom: '0px', width: '100%'}}>
|
||||
<ListItem disablePadding sx={{ width: '100%'}}>
|
||||
<ListItemButton onClick={handleClick} sx={{width: '100%'}}>
|
||||
<Box
|
||||
sx={{
|
||||
display: 'grid',
|
||||
gridAutoFlow: 'row',
|
||||
gridTemplateColumns: 'auto 120px 90px',
|
||||
gap: 1,
|
||||
width: '100%'
|
||||
}}
|
||||
>
|
||||
<Item
|
||||
sx={{paddingLeft: `${Number(Number(item.depth)-1) * 20}px`,}}
|
||||
>
|
||||
{
|
||||
item.children && item.children.length > 0
|
||||
?
|
||||
<span>
|
||||
{
|
||||
open
|
||||
?
|
||||
<RemoveIcon sx={{ color: '#777777', height: '30px;'}} />
|
||||
:
|
||||
<AddIcon sx={{ color: '#777777', height: '30px;'}} />
|
||||
}
|
||||
</span>
|
||||
:
|
||||
<span> </span>
|
||||
}
|
||||
{item.codeTitle}
|
||||
</Item>
|
||||
<Item>{item.codeName}</Item>
|
||||
<Item sx={{textAlign: 'center'}}>
|
||||
<button type="button" class="btn btn_blue_h31 px-1">선택</button>
|
||||
</Item>
|
||||
</Box>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
{
|
||||
item.children &&
|
||||
item.children.map(function(item, index) {
|
||||
//<div>item.codeTitle</div>
|
||||
console.log('thkim 2024-03-21 11:29 %o', item);
|
||||
return (
|
||||
<ItemComponent item={item} index={index} openSelf={open} />
|
||||
);
|
||||
})
|
||||
}
|
||||
</List>
|
||||
</ListItem>
|
||||
</Collapse>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export default function ReferenceCodePopupDialogCotentsListItem(props) {
|
||||
const {data} = props;
|
||||
const [selectedValue, setSelectedValue] = React.useState('a');
|
||||
|
||||
const handleChange = (event) => {
|
||||
setSelectedValue(event.target.value);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<List sx={{ paddingTop: '0px', paddingBottom: '0px', width: '100%'}}>
|
||||
{
|
||||
data &&
|
||||
data.map(function(item, index) {
|
||||
return (
|
||||
<ItemComponent item={item} index={index} openSelf={true} />
|
||||
);
|
||||
})
|
||||
}
|
||||
</List>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import ReferenceCodePopupDialog from './ReferenceCodePopupDialog'
|
||||
|
||||
|
||||
import styled from "styled-components";
|
||||
const StyledDiv = styled.div`
|
||||
input {
|
||||
background: #fafafa;
|
||||
cursor: pointer;
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
function ReferenceCodePopupInput(props) {
|
||||
const {requestItems,setRequestItems} = props;
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<StyledDiv>
|
||||
<input className="f_input2 w_full" type="text" name="categoryId" title="기준코드 선택" placeholder="여기를 눌러 기준코드를 선택하세요"
|
||||
|
||||
value={requestItems.categoryId}
|
||||
onChange={(e) => setRequestItems({ ...requestItems, categoryId: e.target.value })}
|
||||
onClick={(e) => {
|
||||
setOpen(true);
|
||||
}}
|
||||
/>
|
||||
<ReferenceCodePopupDialog open={open} setOpen={setOpen}/>
|
||||
</StyledDiv>
|
||||
);
|
||||
}
|
||||
|
||||
export default ReferenceCodePopupInput;
|
||||
|
|
@ -19,9 +19,17 @@ const StyledDiv = styled.div`
|
|||
.head > span:nth-child(3) {
|
||||
width: 180px;
|
||||
}
|
||||
.result .list_item > div:nth-child(3) {
|
||||
width: 180px;
|
||||
.result .list_item {
|
||||
& > div {
|
||||
&:nth-child(3) {
|
||||
width: 180px;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
color: #001574;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.board-bot {
|
||||
|
|
@ -162,7 +170,7 @@ function PopUp(props) {
|
|||
{listPopup && listPopup.map((it)=>(
|
||||
<div className='list_item' key={it.seq}>
|
||||
<div>{it.number}</div>
|
||||
<div className="al"><Link to={URL.ADMIN__CONTENTS__POP_UP__MODIFY} state={{popupId: it.seq} } key={it.seq}>{it.popupTitle}</Link></div>
|
||||
<div className="al"><Link to={URL.ADMIN__CONTENTS__POP_UP__MODIFY} state={{popupId: it.seq} } key={it.seq} className='title'>{it.popupTitle}</Link></div>
|
||||
<div>{it.startDate} ~ {it.endDate}</div>
|
||||
<div>{it.useYn === 'Y' ? <Switch {...label} key={it.seq} onChange={(e) => onChangeActivationSwitch(e, it.seq)} defaultChecked /> : <Switch key={it.seq} onChange={(e) => onChangeActivationSwitch(e, it.seq)} {...label} />}</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ const StyledDiv = styled.div`
|
|||
width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #001574;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -176,7 +180,7 @@ function StandardResearch(props) {
|
|||
{list && list.map((it)=>(
|
||||
<div className='list_item' key={it.id}>
|
||||
<div>{it.number}</div>
|
||||
<div className="al"><Link to={URL.ADMIN__CONTENTS__STANDARDS_RESEARCH__MODIFY} state={{rsId: it.id} } key={it.id}>{it.title}</Link></div>
|
||||
<div className="al"><Link to={URL.ADMIN__CONTENTS__STANDARDS_RESEARCH__MODIFY} state={{rsId: it.id} } key={it.id} className='title' >{it.title}</Link></div>
|
||||
<div>{it.researchStartDate} ~ {it.researchEndDate}</div>
|
||||
<div>{it.director}</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ 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 com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
||||
import com.dbnt.kcscbackend.file.service.FileService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
|
|
@ -20,15 +22,15 @@ import org.springframework.http.MediaType;
|
|||
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 org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
|
@ -39,6 +41,7 @@ public class AdminBoardsController extends BaseController {
|
|||
|
||||
private final AdminBoardsService adminBoardsService;
|
||||
private final CommonCodeService commonCodeService;
|
||||
private final FileService fileService;
|
||||
|
||||
/* ---- 게시판관리 ----- */
|
||||
@Operation(
|
||||
|
|
@ -152,27 +155,44 @@ public class AdminBoardsController extends BaseController {
|
|||
public ResultVO getPostList() throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
resultMap.put("categoryList", adminBoardsService.selectBoardList());
|
||||
resultMap.put("postList", adminBoardsService.selectPostList());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "게시물 카테고리 셀렉트박스 옵션 조회",
|
||||
description = "게시물 카테고리 셀렉트박스 옵션 조회",
|
||||
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 {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/get-category-and-file-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO getCategoryList(@RequestBody TnBbsContents tnBbsContents) throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
resultMap.put("categoryList", adminBoardsService.selectBoardList());
|
||||
//첨부파일명을 가져온다.
|
||||
List<TnAttachFile> tnAttachFileList = fileService.findByFileGrpId(tnBbsContents.getFileGrpId());
|
||||
System.out.println("@@@ fileGrpId : " + tnBbsContents.getFileGrpId());
|
||||
|
||||
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);
|
||||
}
|
||||
resultMap.put("files", files);
|
||||
System.out.println("@@@ files : " + files);
|
||||
} else {
|
||||
resultMap.put("files", null);
|
||||
}
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
|
@ -187,7 +207,13 @@ public class AdminBoardsController extends BaseController {
|
|||
@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) {
|
||||
public ResultVO savePostMgt(
|
||||
@Valid TnBbsContents contents,
|
||||
HttpServletRequest request,
|
||||
Errors errors,
|
||||
@RequestParam(required = false) long[] survivingFiles,
|
||||
@RequestParam(required = false) MultipartFile[] files,
|
||||
@AuthenticationPrincipal LoginVO user) throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
if (user == null) {
|
||||
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
|
||||
|
|
@ -201,9 +227,9 @@ public class AdminBoardsController extends BaseController {
|
|||
resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode());
|
||||
resultVO.setResultMessage(msg.toString());
|
||||
} else {
|
||||
System.out.println("@@@ contents.getBbsSeq() : " + contents.getBbsContSeq());
|
||||
System.out.println("@@@ contents.getBbsSeq() : " + contents.getBbsSeq());
|
||||
contents.setIpAddress(ClientUtils.getRemoteIP(request));
|
||||
adminBoardsService.savePost(contents, user.getId());
|
||||
adminBoardsService.savePost(contents, request, user, files, survivingFiles);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,19 @@ import com.dbnt.kcscbackend.admin.boards.entity.TnBbsContents;
|
|||
import com.dbnt.kcscbackend.admin.boards.repository.TnBbsContentsRepository;
|
||||
import com.dbnt.kcscbackend.admin.boards.repository.TnBbsRepository;
|
||||
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
||||
import com.dbnt.kcscbackend.file.service.FileService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -20,6 +27,7 @@ public class AdminBoardsService extends EgovAbstractServiceImpl {
|
|||
|
||||
private final TnBbsRepository tnBbsRepository;
|
||||
private final TnBbsContentsRepository tnBbsContentsRepository;
|
||||
private final FileService fileService;
|
||||
|
||||
public List<TnBbs> selectBoardList() {
|
||||
return tnBbsRepository.findAllByOrderByBbsSeqDesc();
|
||||
|
|
@ -66,28 +74,82 @@ public class AdminBoardsService extends EgovAbstractServiceImpl {
|
|||
return tnBbsContentsRepository.findAll();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void savePost(TnBbsContents contents, String userId) {
|
||||
/**
|
||||
* 파일이 저장될 중간 경로를 생성한다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
*
|
||||
* @return 중간 경로
|
||||
*/
|
||||
private String getMiddlePath() {
|
||||
//파일이 저장될 경로를 생성한다.
|
||||
String domainPath = "post";
|
||||
Date nowDate = new Date();
|
||||
String strNowYyyy = new SimpleDateFormat("yyyy").format(nowDate);
|
||||
String strNowYyyyMmdd = new SimpleDateFormat("yyyyMMdd").format(nowDate);
|
||||
String middlePath = domainPath + "/" + strNowYyyy + "/" + strNowYyyyMmdd + "/";
|
||||
|
||||
return middlePath;
|
||||
}
|
||||
|
||||
public void savePost(TnBbsContents contents, HttpServletRequest request, LoginVO user, MultipartFile[] files, long[] survivingFiles) throws Exception {
|
||||
if (contents.getBbsContSeq() == null) {
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath());
|
||||
// TODO 하드코딩
|
||||
contents.setBbsContLevel(1L);
|
||||
contents.setBbsReadCnt(0L);
|
||||
contents.setUseYn("Y");
|
||||
contents.setFrstCrtDt(LocalDateTime.now());
|
||||
contents.setFrstCrtId(userId);
|
||||
contents.setFrstCrtId(user.getId());
|
||||
contents.setFileGrpId(fileGrpId);
|
||||
tnBbsContentsRepository.save(contents);
|
||||
} else {
|
||||
TnBbsContents savedPost = tnBbsContentsRepository.findById(contents.getBbsContSeq()).orElse(null);
|
||||
|
||||
String fileGrpId = savedPost.getFileGrpId();
|
||||
List<TnAttachFile> tnAttachFileList = fileService.findByFileGrpId(fileGrpId);
|
||||
if (survivingFiles == null) {
|
||||
//기존 file을 모두 삭제한다.
|
||||
if (fileGrpId != null) {
|
||||
if (tnAttachFileList != null) {
|
||||
for (TnAttachFile item : tnAttachFileList) {
|
||||
fileService.deleteTnAttachFile(request, user, item.getFileSeq().longValue());
|
||||
}
|
||||
}
|
||||
fileGrpId = null;
|
||||
}
|
||||
} else {
|
||||
// 살아남은 file을 제외한 나머지 file을 삭제한다.
|
||||
if (tnAttachFileList != null) {
|
||||
boolean isFound = false;
|
||||
for (TnAttachFile item : tnAttachFileList) {
|
||||
for (long oldFileSeq : survivingFiles) {
|
||||
if (oldFileSeq == item.getFileSeq()) {
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isFound) {
|
||||
fileService.deleteTnAttachFile(request, user, item.getFileSeq().longValue());
|
||||
}
|
||||
isFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("@@@ files : " + files);
|
||||
fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath(), fileGrpId);
|
||||
savedPost.setFixedYn(contents.getFixedYn());
|
||||
savedPost.setSecretYn(contents.getSecretYn());
|
||||
savedPost.setBbsId(contents.getBbsId());
|
||||
savedPost.setBbsSeq(contents.getBbsSeq());
|
||||
savedPost.setBbsContTitle(contents.getBbsContTitle());
|
||||
savedPost.setFileGrpId(contents.getFileGrpId());
|
||||
savedPost.setBbsContents(contents.getBbsContents());
|
||||
savedPost.setIpAddress(contents.getIpAddress());
|
||||
savedPost.setUseYn("Y");
|
||||
savedPost.setLastChgId(userId);
|
||||
savedPost.setLastChgId(user.getId());
|
||||
savedPost.setLastChgDt(LocalDateTime.now());
|
||||
savedPost.setFileGrpId(fileGrpId);
|
||||
tnBbsContentsRepository.save(savedPost);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Access-Control-Allow-Origin
|
||||
Globals.Allow.Origin = http://118.219.150.34:50680/
|
||||
Globals.Allow.Origin = https://back.dbnt.co.kr
|
||||
|
||||
server.port=50688
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue