Compare commits

..

5 Commits

12 changed files with 609 additions and 287 deletions

View File

@ -6,6 +6,7 @@
"@ant-design/colors": "^6.0.0", "@ant-design/colors": "^6.0.0",
"@ant-design/icons": "^4.7.0", "@ant-design/icons": "^4.7.0",
"@babel/runtime": "^7.23.9", "@babel/runtime": "^7.23.9",
"@base2/pretty-print-object": "^1.0.2",
"@emotion/react": "^11.11.3", "@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@material-ui/core": "^4.12.4", "@material-ui/core": "^4.12.4",

View File

@ -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;

View File

@ -7,17 +7,25 @@ import { FileUploader } from "react-drag-drop-files";
* @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"]; * @param {fileTypes} const fileTypes = ["JPG", "PNG", "GIF"];
* @returns * @returns
*/ */
function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle}) { function FileDragDrop({fileTypes, children, multiple, label, onDrop, handleChange, file, setFile, dropMessageStyle, name, maxSize, disabled}) {
const temp = 0;
return ( return (
<FileUploader <FileUploader
hoverTitle="여기에 파일을 놓아주세요"
handleChange={handleChange} handleChange={handleChange}
name="file" name={name}
types={fileTypes ? fileTypes : "*"} types={fileTypes ? fileTypes : "*"}
multiple={multiple && false} multiple={multiple ? multiple : false}
label={label} label={label}
onDrop={onDrop} onDrop={onDrop}
dropMessageStyle={dropMessageStyle} dropMessageStyle={dropMessageStyle}
maxSize={maxSize}
disabled={disabled}
onSelect={(e)=> {
e = e || window.event;
}}
> >
{children && children} {children && children}
</FileUploader> </FileUploader>

View File

@ -213,7 +213,7 @@ function ProgressStatus(props) {
getList({ ...searchCondition, pageIndex: passedPage }) getList({ ...searchCondition, pageIndex: passedPage })
}} /> }} />
<div className="right_col btn1"> <div className="right_col btn1">
<Link to={URL.ADMIN__CONTENTS__POP_UP__CREATE} className="btn btn_blue_h46 w_100">등록</Link> <Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS__CREATE} className="btn btn_blue_h46 w_100">등록</Link>
</div> </div>
</div> </div>

View File

@ -1,17 +1,13 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Link, useLocation, useNavigate } from 'react-router-dom'; import { Link, useLocation, useNavigate } from 'react-router-dom';
import DatePicker from "react-datepicker"; import DatePicker from "react-datepicker";
import AttachFile from "components/file/AttachFile";
import * as EgovNet from 'api/egovFetch'; import * as EgovNet from 'api/egovFetch';
import URL from 'constants/url'; import URL from 'constants/url';
import CODE from 'constants/code'; import CODE from 'constants/code';
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
import 'react-datepicker/dist/react-datepicker.css';
import styled from "styled-components"; import styled from "styled-components";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
@ -31,15 +27,6 @@ const useStyles = makeStyles(() => ({
})); }));
const StyledDiv = styled.div` 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 { .f_select.w_250 {
@media only screen and (max-width: 768px) { @media only screen and (max-width: 768px) {
width: 100%; width: 100%;
@ -51,9 +38,17 @@ const StyledDiv = styled.div`
width: 100%; width: 100%;
} }
} }
.org-group-id-1 {
margin: 0px 29px;
@media only screen and (max-width: 768px) {
margin: 0px;
}
}
`; `;
function SchedulesEdit(props) {
function ProgressStatusEdit(props) {
console.group("EgovAdminScheduleEdit"); console.group("EgovAdminScheduleEdit");
console.log("[Start] EgovAdminScheduleEdit ------------------------------"); console.log("[Start] EgovAdminScheduleEdit ------------------------------");
console.log("EgovAdminScheduleEdit [props] : ", props); console.log("EgovAdminScheduleEdit [props] : ", props);
@ -79,22 +74,19 @@ function SchedulesEdit(props) {
console.log("EgovAdminScheduleEdit [location] : ", location); console.log("EgovAdminScheduleEdit [location] : ", location);
const [modeInfo, setModeInfo] = useState({ mode: props.mode }); const [modeInfo, setModeInfo] = useState({ mode: props.mode });
const [scheduleDetail, setScheduleDetail] = useState const [requestItems, setRequestItems] = useState
( (
{ {
orgGroupId: 1,
startDate: new Date(), startDate: new Date(),
endDate: new Date(),
eventId : 0, eventId : 0,
} }
); );
const [schdulBgndeHH, setSchdulBgndeHH] = useState(); const [drftDatetimeHH, setDrftDatetimeHH] = useState();
const [schdulBgndeMM, setSchdulBgndeMM] = useState(); const [drftDatetimeMM, setDrftDatetimeMM] = useState();
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
const [scheduleInit, setScheduleInit] = useState({}); const [scheduleInit, setScheduleInit] = useState({});
const [scheduleApiOrgApiDepthList, setScheduleApiOrgApiDepthList] = useState({ });
const initMode = () => { const initMode = () => {
@ -120,7 +112,8 @@ function SchedulesEdit(props) {
default: default:
navigate({pathname: URL.ERROR}, {state: {msg : ""}}); navigate({pathname: URL.ERROR}, {state: {msg : ""}});
} }
retrieveDetail();
getList(orgSearchCondition);
} }
const convertDate = (str) => { const convertDate = (str) => {
@ -139,65 +132,120 @@ function SchedulesEdit(props) {
} }
} }
const retrieveDetail = () => {
EgovNet.requestFetch("/schedule/init", const [orgSearchCondition, setOrgSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
requestOptions, const [orgArray, setOrgArray] = useState([]);
function (resp) { const [orgSelectedIndex, setOrgSelectedIndex] = useState([]);
setScheduleInit(
resp
);
if (modeInfo.mode === CODE.MODE_CREATE) {// /
setScheduleDetail({
...scheduleDetail,
schdulBgnde: location.state.iUseDate, useEffect(function () {
schdulEndde: location.state.iUseDate, getList(orgSearchCondition);
startDate: convertDate(location.state.iUseDate), // eslint-disable-next-line react-hooks/exhaustive-deps
endDate: convertDate(location.state.iUseDate), }, [orgSearchCondition]);
});
useEffect(function () {
if ( typeof orgArray[0] === 'undefined' || typeof orgSelectedIndex[0] === 'undefined' ) {
return; return;
} }
const retrieveDetailURL = `/schedule/${location.state?.schdulId}`; if( orgSelectedIndex[0] === 0) {
const requestOptions = { orgArray[1] = undefined;
method: "GET", orgArray[2] = undefined;
headers: { let forChangeObject = [...orgArray];
'Content-type': 'application/json' 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}&paramCodeLevel=${orgSearchCondition.paramCodeLevel}`,
requestOptions, requestOptions,
function (resp) { function (resp) {
const myIndex = Number(String(orgSearchCondition.paramCodeLevel).replace('LV_','')) - 1;
let rawScheduleDetail = resp.result; const forCopy = [...orgArray];
// forCopy[myIndex] = resp.result.list;
setScheduleDetail({ setOrgArray(forCopy);
...scheduleDetail,
...rawScheduleDetail,
startDate: convertDate(rawScheduleDetail.schdulBgnde),
endDate: convertDate(rawScheduleDetail.schdulEndde),
});
} }
); );
} }
);
}
const updateSchedule = () => { const updateSchedule = () => {
const formData = new FormData(); const formData = new FormData();
for (let key in scheduleDetail) { for (let key in requestItems) {
if ( key === 'startDate' ) { if ( key === 'startDate' ) {
formData.append(key, getDateFourteenDigit( scheduleDetail[key] )); formData.append(key, getDateFourteenDigit( requestItems[key] ));
} else if( key === 'endDate' ) { } else if( key === 'endDate' ) {
formData.append(key, getDateFourteenDigit( scheduleDetail[key] )); formData.append(key, getDateFourteenDigit( requestItems[key] ));
} else { } else {
formData.append(key, scheduleDetail[key]); formData.append(key, requestItems[key]);
} }
console.log("scheduleDetail [%s] ", key, scheduleDetail[key]); console.log("requestItems [%s] ", key, requestItems[key]);
} }
if ( formValidator(formData) ) { if ( formValidator(formData) ) {
@ -263,49 +311,28 @@ function SchedulesEdit(props) {
}, []); }, []);
useEffect(function () { useEffect(function () {
console.log("------------------------------EgovAdminScheduleEdit [%o]", scheduleDetail); console.log("------------------------------EgovAdminScheduleEdit [%o]", requestItems);
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [scheduleDetail]); }, [requestItems]);
useEffect(function () { const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"];
//
EgovNet.requestFetch(`/schedule/api/org-api/depth/list?paramCodeGroup=${scheduleDetail.upCommittee}`, const [preDataFile, setPreDataFile] = useState(null);
requestOptions, const [preDataFileName, setPreDataFileName] = useState(null);
function (resp) { //
setScheduleApiOrgApiDepthList( const [preFormFile, setPreFormFile] = useState(null);
resp const [preFormFileName, setPreFormFileName] = useState(null);
); //
} const [partnerFile, setPartnerFile] = useState(null);
); const [partnerFileName, setPartnerFileName] = useState(null);
console.log("------------------------------EgovAdminScheduleEdit [%o]", scheduleDetail); //
// eslint-disable-next-line react-hooks/exhaustive-deps const [actionPlanFile, setActionPlanFile] = useState(null);
}, [scheduleDetail && scheduleDetail.upCommittee]); const [actionPlanFileName, setActionPlanFileName] = useState(null);
//
const [actionResultReportFile, setActionResultReportFile] = useState(null);
const [actionResultReportFileName, setActionResultReportFileName] = useState(null);
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}});
}
}
);
}
console.log("------------------------------EgovAdminScheduleEdit [End]"); console.log("------------------------------EgovAdminScheduleEdit [End]");
console.groupEnd("EgovAdminScheduleEdit"); console.groupEnd("EgovAdminScheduleEdit");
@ -318,7 +345,7 @@ function SchedulesEdit(props) {
<li><Link to={URL.MAIN} className="home">Home</Link></li> <li><Link to={URL.MAIN} className="home">Home</Link></li>
<li><Link to={URL.ADMIN}>사이트 관리</Link></li> <li><Link to={URL.ADMIN}>사이트 관리</Link></li>
<li>위원회 관리</li> <li>위원회 관리</li>
<li>위원회 일정 관리</li> <li>진행현황 관리</li>
</ul> </ul>
</div> </div>
{/* <!--// Location --> */} {/* <!--// Location --> */}
@ -332,20 +359,36 @@ function SchedulesEdit(props) {
{/* <!-- 본문 --> */} {/* <!-- 본문 --> */}
<div className="top_tit"> <div className="top_tit">
<h1 className="tit_1">위원회 일정 관리</h1> <h1 className="tit_1">진행현황 관리</h1>
</div> </div>
{/* <!-- <h2 className="tit_2">위원회 일정 추가</h2> --> */}
{/* <!-- 게시판 상세보기 --> */} {/* <!-- 게시판 상세보기 --> */}
<StyledDiv className="board_view2"> <StyledDiv className="board_view2">
<dl> <dl>
<dt>구분<span className="req">필수</span></dt> <dt><label>안건</label><span className="req">필수</span></dt>
<dd> <dd>
<label className="f_select w_150" htmlFor="div-meet"> <input className="f_input2 w_full" type="text" name="title" title="안건" placeholder="안건을 입력하세요"
<select id="div-meet" name="div-meet" title="일정구분" value={requestItems.title}
value={scheduleDetail.divMeet} onChange={(e) => setRequestItems({ ...requestItems, title: e.target.value })}
onChange={(e) => setScheduleDetail({ ...scheduleDetail, divMeet: e.target.value })}> />
</dd>
</dl>
<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 })}
/>
</dd>
</dl>
<dl>
<dt><label>구분</label><span className="req">필수</span></dt>
<dd>
<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> <option key={"none"} value="">선택</option>
{scheduleInit && scheduleInit.result && scheduleInit.result.listCodes {scheduleInit && scheduleInit.result && scheduleInit.result.listCodes
&& scheduleInit.result.listCodes.map((item) => ( && scheduleInit.result.listCodes.map((item) => (
@ -356,95 +399,129 @@ function SchedulesEdit(props) {
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>심의위원회<span className="req">필수</span></dt> <dt><label>회의일자</label><span className="req">필수</span></dt>
<dd className="datetime">
<span className="line_break">
<DatePicker
selected={requestItems.drftDatetime}
name="drftDatetime"
className="f_input"
dateFormat="yyyy-MM-dd"
onChange={(date) => {
setRequestItems({ ...requestItems, schdulBgnde: getDateFourteenDigit(date), drftDatetimeYYYMMDD: getYYYYMMDD(date), drftDatetime: date });
setDrftDatetimeHH(date.getHours());
setDrftDatetimeMM(date.getMinutes());
}} />
<input type="hidden" name="drftDatetimeMM" defaultValue={drftDatetimeMM} readOnly />
</span>
</dd>
</dl>
<dl>
<dt><label>위원회</label><span className="req">필수</span></dt>
<dd> <dd>
<label className="f_select w_250 up-committe" htmlFor="up-committee"> {/** top org */}
<select id="up-committe" name="up-committe" title="심의위원회-상위" <label className="f_select w_250 org-group-id" htmlFor="org-group-id">
value={scheduleDetail.upCommittee} <select id="org-group-id" name="orgGroupId" title="중앙건설기술심의 선택"
onChange={(e) => setScheduleDetail({ ...scheduleDetail, upCommittee: e.target.value })}> value={requestItems.orgGroupId}
<option value="">선택</option> onChange={(e) => {
{scheduleInit && scheduleInit.result && scheduleInit.result.listTopOrg setRequestItems({ ...requestItems, orgGroupId: e.target.value });
&& scheduleInit.result.listTopOrg.map((item) => ( orgSelectedIndex[0] = e.target.options.selectedIndex;
<option key={item.id} value={item.id}>{item.name}</option> 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> </select>
</label> </label>
<label className="f_select w_250 org-under-id" htmlFor="committee"> <label className="f_select w_250 org-group-id-1" htmlFor="org-group-id-1">
<select id="committee" name="committee" title="심의위원회-하위" <select id="org-group-id-1" name="orgGroupId1" title="총괄건설기준위원회 선택"
value={scheduleDetail.committee} value={requestItems.orgGroupId1}
onChange={(e) => setScheduleDetail({ ...scheduleDetail, committee: e.target.value })}> defaultValue='1'
<option value="">선택</option> onChange={(e) => {
{scheduleApiOrgApiDepthList && scheduleApiOrgApiDepthList.result && scheduleApiOrgApiDepthList.result.list setRequestItems({ ...requestItems, orgGroupId1: e.target.value });
&& scheduleApiOrgApiDepthList.result.list.map((item) => ( orgSelectedIndex[1] = e.target.options.selectedIndex;
<option key={item.id} value={item.id}>{item.name}</option> 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.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> </select>
</label> </label>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt><label htmlFor="title">제목</label><span className="req">필수</span></dt> <dt><label htmlFor="title">사전검토자료</label><span className="req">필수</span></dt>
<dd> <dd>
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요." <AttachFile name="preDataFile" file={preDataFile} setFile={setPreDataFile} fileName={preDataFileName} fileTypes={fileTypes} />
value={scheduleDetail.title} </dd>
onChange={(e) => setScheduleDetail({ ...scheduleDetail, title: e.target.value })} </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>조치결과서</label><span className="req">필수</span></dt>
<dd>
<AttachFile name="actionResultReportFile" file={actionResultReportFile} setFile={setActionResultReportFile} fileName={actionResultReportFileName} fileTypes={fileTypes} />
</dd>
</dl>
<dl>
<dt><label>회의담당자</label><span className="req">필수</span></dt>
<dd>
<input className="f_input2 w_full" type="text" name="drftConfeCharger" title="회의 담당자" placeholder="여기를 눌러 회의담당자를 선택하세요"
value={requestItems.drftConfeCharger}
onChange={(e) => setRequestItems({ ...requestItems, drftConfeCharger: e.target.value })}
/> />
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt><label htmlFor="location">장소</label><span className="req">필수</span></dt> <dt><label>회의실 비밀번호</label><span className="req">필수</span></dt>
<dd> <dd>
<input className="f_input2 w_full" type="text" name="location" title="장소" id="location" placeholder="장소를 입력하세요." <input className="f_input2 w_full" type="text" name="drftConfePw" title="제목" placeholder="회의실 비밀번호를 입력하세요"
defaultValue={scheduleDetail.location} value={requestItems.drftConfePw}
onChange={(e) => setScheduleDetail({ ...scheduleDetail, location: e.target.value })} /> onChange={(e) => setRequestItems({ ...requestItems, drftConfePw: e.target.value })}
/>
</dd> </dd>
</dl> </dl>
<dl> <dl>
<dt>날짜/시간<span className="req">필수</span></dt> <dt><label>회의 안건</label><span className="req">필수</span></dt>
<dd className="datetime">
<span className="line_break">
<DatePicker
selected={scheduleDetail.startDate}
name="schdulBgnde"
className="f_input"
dateFormat="yyyy-MM-dd HH:mm"
showTimeInput
onChange={(date) => {
console.log("setStartDate : ", date);
setScheduleDetail({ ...scheduleDetail, schdulBgnde: getDateFourteenDigit(date), schdulBgndeYYYMMDD: getYYYYMMDD(date), schdulBgndeHH: date.getHours(), schdulBgndeMM: date.getMinutes(), startDate: date });
setSchdulBgndeHH(date.getHours());
setSchdulBgndeMM(date.getMinutes());
}} />
<input type="hidden" name="schdulBgndeHH" defaultValue={schdulBgndeHH} readOnly />
<input type="hidden" name="schdulBgndeMM" defaultValue={schdulBgndeMM} readOnly />
<span className="f_inn_txt">~</span>
</span>
<span className="line_break">
<DatePicker
selected={scheduleDetail.endDate}
name="schdulEndde"
className="f_input"
dateFormat="yyyy-MM-dd HH:mm"
showTimeInput
minDate={scheduleDetail.startDate}
onChange={(date) => {
console.log("setEndDate: ", date);
setScheduleDetail({ ...scheduleDetail, schdulEndde: getDateFourteenDigit(date), schdulEnddeYYYMMDD: getYYYYMMDD(date), schdulEnddeHH: date.getHours(), schdulEnddeMM: date.getMinutes(), endDate: date });
setSchdulEnddeHH(date.getHours());
setSchdulEnddeMM(date.getMinutes());
}
} />
<input type="hidden" name="schdulEnddeHH" defaultValue={schdulEnddeHH} readOnly />
<input type="hidden" name="schdulEnddeMM" defaultValue={schdulEnddeMM} readOnly />
</span>
</dd>
</dl>
<dl>
<dt><label htmlFor="contents">내용</label><span className="req">필수</span></dt>
<dd> <dd>
<textarea className="f_txtar w_full h_100" name="contents" id="contents" cols="30" rows="10" placeholder="일정 내용을 입력하세요." <textarea className="f_txtar w_full h_100" name="drftSummery" cols="30" rows="10" placeholder="회의 안건 내용을 입력하세요."
defaultValue={scheduleDetail.contents} defaultValue={requestItems.drftSummery}
onChange={(e) => setScheduleDetail({ ...scheduleDetail, contents: e.target.value })} onChange={(e) => setRequestItems({ ...requestItems, drftSummery: e.target.value })}
></textarea> ></textarea>
</dd> </dd>
</dl> </dl>
@ -455,17 +532,11 @@ function SchedulesEdit(props) {
<button className="btn btn_skyblue_h46 w_100" <button className="btn btn_skyblue_h46 w_100"
onClick={() => updateSchedule()} onClick={() => updateSchedule()}
> 저장</button> > 저장</button>
{modeInfo.mode === CODE.MODE_MODIFY &&
<button className="btn btn_skyblue_h46 w_100"
onClick={(e) => {
onClickDeleteSchedule(location.state?.schdulId);
}}>삭제</button>
}
</div> </div>
<div className="right_col btn1"> <div className="right_col btn1">
<Link to={URL.ADMIN__COMMITTEE__SCHEDULES} className="btn btn_blue_h46 w_100">목록</Link> <Link to={URL.ADMIN__COMMITTEE__PROGRESS_STATUS} className="btn btn_blue_h46 w_100">목록</Link>
</div> </div>
</div> </div>
{/* <!--// 버튼영역 --> */} {/* <!--// 버튼영역 --> */}
@ -480,4 +551,4 @@ function SchedulesEdit(props) {
); );
} }
export default SchedulesEdit; export default ProgressStatusEdit;

View File

@ -1,10 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Link, useLocation, useNavigate } from 'react-router-dom'; import { Link, useLocation, useNavigate } from 'react-router-dom';
import DatePicker from "react-datepicker"; import DatePicker from "react-datepicker";
import FileDragDrop from "../../../../components/file/FileDragDrop"; import AttachFile from "../../../../components/file/AttachFile";
import AttachFileIcon from '@mui/icons-material/AttachFile';
import EgovAttachFile from 'components/EgovAttachFile';
import RichTextEditor from "../../../../components/editor/RichTextEditor"; import RichTextEditor from "../../../../components/editor/RichTextEditor";
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide"; import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
import CODE from 'constants/code'; import CODE from 'constants/code';
@ -59,7 +56,7 @@ function PopupEditor(props) {
const [schdulBgndeMM, setSchdulBgndeMM] = useState(); const [schdulBgndeMM, setSchdulBgndeMM] = useState();
const [schdulEnddeHH, setSchdulEnddeHH] = useState(); const [schdulEnddeHH, setSchdulEnddeHH] = useState();
const [schdulEnddeMM, setSchdulEnddeMM] = useState(); const [schdulEnddeMM, setSchdulEnddeMM] = useState();
const [fileName, setFileName] = useState();
const [confirm, setConfirm] = React.useState(); const [confirm, setConfirm] = React.useState();
@ -140,8 +137,8 @@ function PopupEditor(props) {
setText(rawDetail.contents); setText(rawDetail.contents);
setTextOriginal(rawDetail.contents); setTextOriginal(rawDetail.contents);
if( rawDetail.fileName ) { if( rawDetail.files ) {
setFileName(rawDetail.fileName); setServerFiles(rawDetail.files);
} }
} }
); );
@ -167,7 +164,14 @@ function PopupEditor(props) {
formData.append("contents", text); 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)) { if (formValidator(formData)) {
const requestOptions = { const requestOptions = {
@ -264,22 +268,15 @@ function PopupEditor(props) {
} }
const fileTypes = ["JPG", "PNG", "GIF", "PDF", "HWP", "HWPX", "ZIP", "JPEG", "MP4", "TXT"]; 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() { const Location = React.memo(function Location() {
@ -367,21 +364,7 @@ function PopupEditor(props) {
<dl className="file-attach-wrapper"> <dl className="file-attach-wrapper">
<dt>첨부파일</dt> <dt>첨부파일</dt>
<dd> <dd>
<span className="file_attach"> <AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} />
<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>
</dd> </dd>
</dl> </dl>

View File

@ -1135,6 +1135,11 @@
resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz" resolved "https://registry.npmjs.org/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz"
integrity sha512-4iri8i1AqYHJE2DstZYkyEprg6Pq6sKx3xn5FpySk9sNhH7qN2LLlHJCfDTZRILNwQNPD7mATWM0TBui7uC1pA== 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": "@bcoe/v8-coverage@^0.2.3":
version "0.2.3" version "0.2.3"
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" 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: react-element-to-jsx-string@^15.0.0:
version "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== integrity sha512-UDg4lXB6BzlobN60P8fHWVPX3Kyw8ORrTeBtClmIlGdkOOE+GYQSFvmEU5iLLpwp/6v42DINwNcwOhOLfQ//FQ==
dependencies: dependencies:
"@base2/pretty-print-object" "1.0.1" "@base2/pretty-print-object" "1.0.1"

View File

@ -88,13 +88,13 @@ public class PopUpApiController {
@AuthenticationPrincipal LoginVO loginVO, @AuthenticationPrincipal LoginVO loginVO,
final MultipartHttpServletRequest multiRequest, final MultipartHttpServletRequest multiRequest,
CreatePopupVO createPopupVO, CreatePopupVO createPopupVO,
@RequestParam(required = false) MultipartFile file @RequestParam(required = false) MultipartFile[] files
) throws Exception { ) throws Exception {
ResultVO resultVO = new ResultVO(); ResultVO resultVO = new ResultVO();
try { try {
resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, file); resultVO = popUpApiService.contentsApiPopUpManageCreate(resultVO, request, loginVO, multiRequest, createPopupVO, files);
} catch (Exception e) { } catch (Exception e) {
resultVO.setResultCode(ResponseCode.FAILED.getCode()); resultVO.setResultCode(ResponseCode.FAILED.getCode());
resultVO.setResultMessage(e.getMessage()); resultVO.setResultMessage(e.getMessage());
@ -129,14 +129,14 @@ public class PopUpApiController {
HttpServletRequest request, HttpServletRequest request,
@AuthenticationPrincipal LoginVO loginVO, @AuthenticationPrincipal LoginVO loginVO,
UpdatePopupVO updatePopupVO, UpdatePopupVO updatePopupVO,
@RequestParam(required = false) MultipartFile file, @RequestParam(required = false) MultipartFile[] files,
@PathVariable("popupId") Long popupId @PathVariable("popupId") Long popupId
) throws Exception { ) throws Exception {
ResultVO resultVO = new ResultVO(); ResultVO resultVO = new ResultVO();
try { try {
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, file, popupId); resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, popupId);
} catch (Exception e) { } catch (Exception e) {
resultVO.setResultCode(ResponseCode.FAILED.getCode()); resultVO.setResultCode(ResponseCode.FAILED.getCode());
resultVO.setResultMessage(e.getMessage()); resultVO.setResultMessage(e.getMessage());

View File

@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
public interface PopUpApiService { public interface PopUpApiService {
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception; 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 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 popupId) 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 file, Long popupId) 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 popupId) 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 popupId) throws Exception; public ResultVO contentsApiPopUpManageUpdateActivationSwitch(ResultVO resultVO, HttpServletRequest request, LoginVO user, String checked, Long popupSeq) throws Exception;
} }

View File

@ -103,7 +103,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
@Override @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( System.out.println(
"\n--------------------------------------------------------------\n" + "\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( Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
createPopupVO.getTitle(), 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 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 ) { if( tnAttachFileList != null ) {
dto.put("fileName", tnAttachFile.getFileOldName()); List<Map<String, Object>> files = new ArrayList<Map<String, Object>>();
} else { for (TnAttachFile item : tnAttachFileList) {
dto.put("fileName", null); 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.setResult(dto);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
@ -189,20 +200,20 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
} }
@Override @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( System.out.println(
"\n--------------------------------------------------------------\n" + "\n--------------------------------------------------------------\n" +
request.getRequestURI() + " IN:" + request.getRequestURI() + " IN:" +
"\n--------------------------------------------------------------\n" + "\n--------------------------------------------------------------\n" +
"updatePopupVO:" + "\n" + "updatePopupVO:" + "\n" +
updatePopupVO.toString() + "\n" + updatePopupVO.toString() + "\n" +
"popupId:" + "\n" + "popupSeq:" + "\n" +
popupId + "\n" + popupSeq + "\n" +
"\n--------------------------------------------------------------\n" "\n--------------------------------------------------------------\n"
); );
// 유효성 검사 실시 // 유효성 검사 실시
int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupId.intValue() ); int isValid = tnPopupMngRepository.spIsValidTnPopupMngId( popupSeq.intValue() );
if( isValid == 0 ) { if( isValid == 0 ) {
throw new Exception("대상이 존재하지 않습니다."); throw new Exception("대상이 존재하지 않습니다.");
@ -212,10 +223,14 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다."); 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( Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
popupId.intValue(), popupSeq.intValue(),
updatePopupVO.getTitle(), updatePopupVO.getTitle(),
updatePopupVO.getStartDate(), updatePopupVO.getStartDate(),
updatePopupVO.getEndDate(), updatePopupVO.getEndDate(),
@ -230,7 +245,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
Map<String, Object> dto = new HashMap<String, Object>(); Map<String, Object> dto = new HashMap<String, Object>();
dto.put("errorMessage", response.get("_error_message") ); dto.put("errorMessage", response.get("_error_message") );
dto.put("popupId", popupId); dto.put("popupId", popupSeq);
resultVO.setResult(dto); resultVO.setResult(dto);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); resultVO.setResultCode(ResponseCode.SUCCESS.getCode());

View File

@ -6,12 +6,13 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.query.Procedure; import org.springframework.data.jpa.repository.query.Procedure;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> { public interface TnAttachFileRepository extends JpaRepository<TnAttachFile, Integer> {
Optional<TnAttachFile> findByFileGrpId(String fileGrpId); Optional<List<TnAttachFile>> findByFileGrpId(String fileGrpId);
@Procedure("make_file_grp_id") @Procedure("make_file_grp_id")
String makeFileGrpId( String modiId ); String makeFileGrpId( String modiId );

View File

@ -13,10 +13,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@ -32,7 +29,7 @@ public class FileService {
if(tnAttachFile.getFileSeq()!=null){ if(tnAttachFile.getFileSeq()!=null){
tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null); tnAttachFile = tnAttachFileRepository.findById(tnAttachFile.getFileSeq()).orElse(null);
}else{ }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(); int downCnt = tnAttachFile.getDownCnt()==null?0: tnAttachFile.getDownCnt();
tnAttachFile.setDownCnt(downCnt+1); tnAttachFile.setDownCnt(downCnt+1);
@ -50,30 +47,54 @@ public class FileService {
* TN_ATTACH_FILE . * TN_ATTACH_FILE .
* @param request * @param request
* @param user * @param user
* @param file * @param files
* @param middlePath . * @param middlePath .
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX . * D:/kcscUploadFiles/XXXX/abc.jpg XXXX .
* D:/kcscUploadFiles application-xxx.properties Globals.fileStorePath . * D:/kcscUploadFiles application-xxx.properties Globals.fileStorePath .
* @return ID * @return ID
* @throws Exception * @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 { 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 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>(); Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
filesMap.put("file", file); filesMap.put("file", file);
//String fileGrpId = UUID.randomUUID().toString(); List<FileVO> fileVoList = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
int nCount = 1; int nCount = 1;
// 업로드된 file을 tnAttachFile에 insert한다. // 업로드된 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(); FileVO item = iter.next();
@ -94,6 +115,9 @@ public class FileService {
} }
} }
}
return fileGrpId; return fileGrpId;
} }