Compare commits
No commits in common. "52cfa4a2572d27947fbe91592b061d57518b4dc3" and "ac4625a1746d22802fcce1801b812a1d3cb9a32c" have entirely different histories.
52cfa4a257
...
ac4625a174
|
|
@ -1,11 +1,9 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import Button from '@mui/material/Button';
|
||||
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";
|
||||
import * as File from "utils/file";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
label {
|
||||
|
|
@ -16,7 +14,7 @@ const StyledDiv = styled.div`
|
|||
border-radius: 6px;
|
||||
& > div {
|
||||
height: 100%;
|
||||
line-height: auto;
|
||||
line-height: 37px;
|
||||
padding: 20px;
|
||||
color: #999999;
|
||||
}
|
||||
|
|
@ -33,6 +31,7 @@ function AttachFile(props) {
|
|||
useEffect(function () {
|
||||
|
||||
const labelEle = document.querySelectorAll("label[for='preDataFile']")[0];
|
||||
console.log(labelEle); // NodeList(3) [li, li, li]
|
||||
// event
|
||||
const onClickLabel = (e) => {
|
||||
|
||||
|
|
@ -44,7 +43,6 @@ function AttachFile(props) {
|
|||
e.preventDefault();
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if(
|
||||
oldTagName === 'path' ||
|
||||
oldTagName === 'svg' ||
|
||||
|
|
@ -131,12 +129,14 @@ function AttachFile(props) {
|
|||
}
|
||||
|
||||
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);
|
||||
};
|
||||
|
|
@ -144,7 +144,6 @@ function AttachFile(props) {
|
|||
|
||||
const onClickDeleteItem = (e, targetEle) => {
|
||||
|
||||
|
||||
const dataIndex = Number(targetEle.getAttribute('data-index'));
|
||||
|
||||
let items = [];
|
||||
|
|
@ -158,39 +157,7 @@ function AttachFile(props) {
|
|||
|
||||
setFileItem(items);
|
||||
props.setFiles(items);
|
||||
};
|
||||
|
||||
const onClickFile = (e, item) => {
|
||||
e = e || window.event;
|
||||
const target = e.target || e.srcElement;
|
||||
const dataSeq = target.getAttribute('data-seq');
|
||||
if( dataSeq ) {
|
||||
// server로 부터 download 요청
|
||||
const fileSeq = Number(dataSeq);
|
||||
File.download(fileSeq);
|
||||
} else {
|
||||
//현재 첨부된 file 다운로드
|
||||
const file = item;
|
||||
let fr = new FileReader();
|
||||
fr.readAsDataURL(file);
|
||||
|
||||
var blob = new Blob([file], { type: "application/pdf" });
|
||||
|
||||
var objectURL = window.URL.createObjectURL(blob);
|
||||
|
||||
if (navigator.appVersion.toString().indexOf('.NET') > 0) {
|
||||
window.navigator.msSaveOrOpenBlob(blob, item.name);
|
||||
} else {
|
||||
var link = document.createElement('a');
|
||||
link.href = objectURL;
|
||||
link.download = item.name;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledDiv>
|
||||
|
|
@ -212,11 +179,11 @@ function AttachFile(props) {
|
|||
fileItem.map((item) => (
|
||||
<span key={item.index} data-index={item.index}>
|
||||
<IconButton aria-label="delete" size="small"
|
||||
sx={{color: '#094c72', padding: '2px 4px'}}
|
||||
onClick={(e)=> {
|
||||
e = e || window.event;
|
||||
const target = e.target || e.srcElement;
|
||||
|
||||
console.log('%o', target);
|
||||
const tagName = String(target.tagName).toLowerCase();
|
||||
|
||||
// target 보정
|
||||
|
|
@ -232,20 +199,11 @@ function AttachFile(props) {
|
|||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
</IconButton>
|
||||
<Button
|
||||
variant="text"
|
||||
sx={{textTransform: 'none', color: '#032b77', fontSize: '14px', padding: '2px 5px 4px 5px'}}
|
||||
onClick={(e)=> {
|
||||
onClickFile(e, item);
|
||||
}}
|
||||
key={item.index}
|
||||
data-seq={item.seq}
|
||||
>{item.name}</Button>
|
||||
<br />
|
||||
{item.name}<br />
|
||||
</span>
|
||||
))
|
||||
:
|
||||
<span>여기를 누르시거나 파일을 마우스로 끌어놓으세요.</span>
|
||||
<span><AttachFileIcon /> 파일을 마우스로 끌어놓으세요.</span>
|
||||
}
|
||||
</div>
|
||||
</FileDragDrop>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|||
import { Link, useLocation } from 'react-router-dom';
|
||||
|
||||
import styled from "styled-components";
|
||||
import CircularProgress from '@mui/material/CircularProgress';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
|
@ -64,7 +62,7 @@ function Schedules(props) {
|
|||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { schdulSe: '', year: TODAY.getFullYear(), month: TODAY.getMonth(), date: TODAY.getDate() });
|
||||
const [calendarTag, setCalendarTag] = useState([]);
|
||||
|
||||
const [scheduleList, setScheduleList] = useState();
|
||||
const [scheduleList, setScheduleList] = useState([]);
|
||||
|
||||
const innerConsole = (...args) => {
|
||||
console.log(...args);
|
||||
|
|
@ -191,7 +189,7 @@ function Schedules(props) {
|
|||
if (day !== 0) {//당월 일별 구현
|
||||
let sDate = day.toString().length === 1 ? "0" + day.toString() : day.toString();
|
||||
let iUseDate = Number(mutsUseYearMonth + sDate);
|
||||
if (scheduleList && scheduleList.length > 0) {//일정 있는 경우
|
||||
if (scheduleList.length > 0) {//일정 있는 경우
|
||||
return (
|
||||
<td key={keyIdx++}>
|
||||
<Link to={{pathname: URL.ADMIN__COMMITTEE__SCHEDULES__CREATE}} state={{ iUseDate: mutsUseYearMonth + sDate + "000000"}} className="day"
|
||||
|
|
@ -349,23 +347,9 @@ function Schedules(props) {
|
|||
<th>토</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{
|
||||
typeof scheduleList === 'undefined'
|
||||
?
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colSpan="7">
|
||||
<Box sx={{ display: 'flex', width: '100%', padding: '250px 0px' }}>
|
||||
<CircularProgress sx={{ margin: '0px auto', }}/>
|
||||
</Box>
|
||||
</td>
|
||||
</tr>
|
||||
{true && calendarTag}
|
||||
</tbody>
|
||||
:
|
||||
<tbody>
|
||||
{calendarTag}
|
||||
</tbody>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</StyledDiv>
|
||||
|
|
|
|||
|
|
@ -36,25 +36,6 @@ function SchedulesDetail(props) {
|
|||
}
|
||||
|
||||
|
||||
const convertDate = (str) => {
|
||||
if( !str ) {
|
||||
return null;
|
||||
}
|
||||
let year = str.substring(0, 4);
|
||||
let month = str.substring(5, 7);
|
||||
let date = str.substring(8, 10);
|
||||
let hour = str.substring(11, 13);
|
||||
let minute = str.substring(14, 16);
|
||||
return {
|
||||
year: year,
|
||||
month: month,
|
||||
date: date,
|
||||
hour: hour,
|
||||
minute: minute,
|
||||
dateForm: year + "-" + month + "-" + date + " " + hour + ":" + minute + ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const onClickDeleteSchedule = (schdulId) => {
|
||||
const deleteBoardURL = `/schedule/${schdulId}`;
|
||||
|
|
@ -134,8 +115,8 @@ function SchedulesDetail(props) {
|
|||
<dd>{scheduleDetail.location}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>날짜/시간 </dt>
|
||||
<dd> { convertDate(scheduleDetail?.startDate)?.dateForm} ~ {convertDate(scheduleDetail?.endDate)?.dateForm} </dd>
|
||||
<dt>날짜/시간</dt>
|
||||
<dd> {scheduleDetail.startDate} ~ {scheduleDetail.endDate}</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>내용</dt>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import Switch from '@mui/material/Switch';
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
|
|
@ -55,7 +54,7 @@ function PopUp(props) {
|
|||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [listPopup, setListPopup] = useState();
|
||||
const [listPopup, setListPopup] = useState([]);
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });
|
||||
const [paginationInfo, setPaginationInfo] = useState({});
|
||||
|
||||
|
|
@ -153,13 +152,10 @@ function PopUp(props) {
|
|||
</div>
|
||||
<div className="result">
|
||||
{/* <!-- case : 데이터 없을때 --> */}
|
||||
{typeof listPopup === 'undefined' &&
|
||||
<p className="no_data" key="0"><LinearProgress /></p>
|
||||
}
|
||||
{listPopup && listPopup.length === 0 &&
|
||||
{listPopup.length === 0 &&
|
||||
<p className="no_data" key="0">검색된 결과가 없습니다.</p>
|
||||
}
|
||||
{listPopup && listPopup.map((it)=>(
|
||||
{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>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
import AttachFile from "../../../../components/file/AttachFile";
|
||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
||||
|
|
@ -165,16 +164,14 @@ function PopupEditor(props) {
|
|||
formData.append("contents", text);
|
||||
|
||||
//첨부파일
|
||||
if( files ) {
|
||||
//formData.append("files", files);
|
||||
for(let i=0; i<files.length; i++) {
|
||||
// seq 항목을 가지고 있다면 그건 server에 이미 upload된 file이므로 continue
|
||||
if( files[i].seq ) {
|
||||
// 살아남은 file의 seq 목록 서버로 보내면 서버가 알아서 기존파일을 정리해준다.
|
||||
formData.append("survivingFiles", files[i].seq);
|
||||
continue;
|
||||
}
|
||||
formData.append("files", files[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (formValidator(formData)) {
|
||||
const requestOptions = {
|
||||
|
|
@ -238,27 +235,6 @@ function PopupEditor(props) {
|
|||
setConfirm({...confirm, open: true, body: "삭제하시겠습니까?", yesCallback: requestTask});
|
||||
}
|
||||
|
||||
|
||||
// 첨부된 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) => {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const onClickList = (e) => {
|
||||
|
||||
const requestTask = () => {
|
||||
|
|
@ -339,7 +315,6 @@ function PopupEditor(props) {
|
|||
<dl>
|
||||
<dt><label htmlFor="title">제목</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY && typeof popupDetail.title === 'undefined' && <LinearProgress /> }
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={popupDetail.title}
|
||||
onChange={(e) => setPopupDetail({ ...popupDetail, title: e.target.value })}
|
||||
|
|
@ -389,7 +364,7 @@ function PopupEditor(props) {
|
|||
<dl className="file-attach-wrapper">
|
||||
<dt>첨부파일</dt>
|
||||
<dd>
|
||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} deleteFile={deleteFile} />
|
||||
<AttachFile name="preDataFile" multiple={true} files={files} setFiles={setFiles} serverFiles={serverFiles} fileTypes={fileTypes} />
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
|
@ -397,13 +372,7 @@ function PopupEditor(props) {
|
|||
{/* <!--// 상단 입력 form --> */}
|
||||
|
||||
{/* <!-- 게시판 --> */}
|
||||
{modeInfo.mode === CODE.MODE_MODIFY && typeof text === 'undefined'
|
||||
?
|
||||
<LinearProgress />
|
||||
:
|
||||
<RichTextEditor item={text} setText={setText}/>
|
||||
}
|
||||
|
||||
{/* <!--// 게시판 --> */}
|
||||
|
||||
{/* <!-- 버튼영역 --> */}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
import Switch from '@mui/material/Switch';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
|
|
@ -67,7 +67,7 @@ function StandardResearch(props) {
|
|||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [list, setList] = useState();
|
||||
const [list, setList] = useState([]);
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });
|
||||
const [paginationInfo, setPaginationInfo] = useState({});
|
||||
|
||||
|
|
@ -167,13 +167,10 @@ function StandardResearch(props) {
|
|||
</div>
|
||||
<div className="result">
|
||||
{/* <!-- case : 데이터 없을때 --> */}
|
||||
{typeof list === 'undefined' &&
|
||||
<p className="no_data" key="0"><LinearProgress /></p>
|
||||
}
|
||||
{list && list.length === 0 &&
|
||||
{list.length === 0 &&
|
||||
<p className="no_data" key="0">검색된 결과가 없습니다.</p>
|
||||
}
|
||||
{list && list.map((it)=>(
|
||||
{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>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
import LinearProgress from '@mui/material/LinearProgress';
|
||||
|
||||
import EgovAttachFile from 'components/EgovAttachFile';
|
||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||
|
|
@ -46,12 +45,12 @@ function StandardResearchEditor(props) {
|
|||
const location = useLocation();
|
||||
|
||||
const [modeInfo, setModeInfo] = useState({ mode: props.mode });
|
||||
const [purpose, setPurpose] = useState();
|
||||
const [purposeOriginal, setPurposeOriginal] = useState();
|
||||
const [purpose, setPurpose] = useState("");
|
||||
const [purposeOriginal, setPurposeOriginal] = useState("");
|
||||
const [content, setContent] = useState("");
|
||||
const [contentOriginal, setContentOriginal] = useState();
|
||||
const [contentOriginal, setContentOriginal] = useState("");
|
||||
const [effectContent, setEffectContent] = useState("");
|
||||
const [effectContentOriginal, setEffectContentOriginal] = useState();
|
||||
const [effectContentOriginal, setEffectContentOriginal] = useState("");
|
||||
|
||||
|
||||
|
||||
|
|
@ -320,7 +319,6 @@ function StandardResearchEditor(props) {
|
|||
<dl>
|
||||
<dt><label htmlFor="title">연구명</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY && typeof standardResearchDetail.title === 'undefined' && <LinearProgress /> }
|
||||
<input className="f_input2 w_full" type="text" name="title" title="연구명" id="title" placeholder="연구명을 입력하세요."
|
||||
value={standardResearchDetail.title}
|
||||
onChange={(e) => setStandardResearchDetail({ ...standardResearchDetail, title: e.target.value })}
|
||||
|
|
@ -360,7 +358,6 @@ function StandardResearchEditor(props) {
|
|||
<dl>
|
||||
<dt><label htmlFor="director">연구 책임자</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY && typeof standardResearchDetail.director === 'undefined' && <LinearProgress /> }
|
||||
<input className="f_input2 w_full" type="text" name="director" title="연구 책임자" id="director" placeholder="연구 책임자를 입력하세요."
|
||||
value={standardResearchDetail.director}
|
||||
onChange={(e) => setStandardResearchDetail({ ...standardResearchDetail, director: e.target.value })}
|
||||
|
|
@ -372,34 +369,13 @@ function StandardResearchEditor(props) {
|
|||
|
||||
{/* <!-- 게시판 --> */}
|
||||
<label className="label-text-editor">연구 목적<span className="req">필수</span></label>
|
||||
{
|
||||
modeInfo.mode === CODE.MODE_MODIFY && typeof purpose === 'undefined'
|
||||
?
|
||||
<LinearProgress />
|
||||
:
|
||||
<RichTextEditor item={purpose} setText={setPurpose}/>
|
||||
}
|
||||
|
||||
|
||||
<label className="label-text-editor">연구 내용<span className="req">필수</span></label>
|
||||
{
|
||||
modeInfo.mode === CODE.MODE_MODIFY && typeof content === 'undefined'
|
||||
?
|
||||
<LinearProgress />
|
||||
:
|
||||
<RichTextEditor item={content} setText={setContent}/>
|
||||
}
|
||||
|
||||
|
||||
<label className="label-text-editor">기대 효과<span className="req">필수</span></label>
|
||||
{
|
||||
modeInfo.mode === CODE.MODE_MODIFY && typeof effectContent === 'undefined'
|
||||
?
|
||||
<LinearProgress />
|
||||
:
|
||||
<RichTextEditor item={effectContent} setText={setEffectContent}/>
|
||||
}
|
||||
|
||||
{/* <!--// 게시판 --> */}
|
||||
|
||||
{/* <!-- 버튼영역 --> */}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@ public class PopUpApiController {
|
|||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
UpdatePopupVO updatePopupVO,
|
||||
@RequestParam(required = false) long[] survivingFiles,
|
||||
@RequestParam(required = false) MultipartFile[] files,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
|
@ -137,7 +136,7 @@ public class PopUpApiController {
|
|||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, survivingFiles, popupId);
|
||||
resultVO = popUpApiService.contentsApiPopUpManageUpdate(resultVO, request, loginVO, updatePopupVO, files, popupId);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
|
|
@ -234,6 +233,7 @@ public class PopUpApiController {
|
|||
);
|
||||
|
||||
return resultVO;
|
||||
|
||||
}
|
||||
|
||||
@Operation(
|
||||
|
|
@ -273,43 +273,6 @@ public class PopUpApiController {
|
|||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 관리에서 특정 첨부 파일을 삭제하는 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '팝업 관리' 페이지에서 특정 팝업 수정 후 첨부된 file 삭제하는 API.",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
})
|
||||
@DeleteMapping(value = "/contents/api/popup-manage/file/{fileSeq}")
|
||||
public ResultVO deleteFileContentsApiPopUpManage
|
||||
(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request,
|
||||
@PathVariable("fileSeq") Long fileSeq
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
try {
|
||||
resultVO = popUpApiService.deleteFileContentsApiPopUpManage(resultVO, request, user, fileSeq);
|
||||
} catch (Exception e) {
|
||||
resultVO.setResultCode(ResponseCode.FAILED.getCode());
|
||||
resultVO.setResultMessage(e.getMessage());
|
||||
}
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " OUT:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"resultVO.toString():" + "\n" +
|
||||
resultVO.toString() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ 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[] 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[] survivingFiles, 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;
|
||||
public ResultVO deleteFileContentsApiPopUpManage(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long fileSeq) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -40,6 +40,8 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
private final TnPopupMngRepository tnPopupMngRepository;
|
||||
private final TnPopupMngRepositoryWithoutPopupContents tnPopupMngRepositoryWithoutPopupContents;
|
||||
|
||||
private final TnAttachFileRepository tnAttachFileRepository;
|
||||
|
||||
private final FileService fileService;
|
||||
|
||||
|
||||
|
|
@ -171,7 +173,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
dto.put("schdulEndde", tnPopupMng.getPopupEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
|
||||
//첨부파일명을 가져온다.
|
||||
List<TnAttachFile> tnAttachFileList = fileService.findByFileGrpId(tnPopupMng.getFileGrpId());
|
||||
List<TnAttachFile> tnAttachFileList = tnAttachFileRepository.findByFileGrpId(tnPopupMng.getFileGrpId()).orElse(null);
|
||||
|
||||
if( tnAttachFileList != null ) {
|
||||
List<Map<String, Object>> files = new ArrayList<Map<String, Object>>();
|
||||
|
|
@ -198,7 +200,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdatePopupVO updatePopupVO, MultipartFile[] files, long[] survivingFiles, Long popupSeq) 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:" +
|
||||
|
|
@ -225,42 +227,8 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
TnPopupMng tnPopupMng = tnPopupMngRepository.findByPopupSeq(popupSeq);
|
||||
|
||||
String fileGrpId = tnPopupMng.getFileGrpId();
|
||||
List<TnAttachFile> tnAttachFileList = fileService.findByFileGrpId(tnPopupMng.getFileGrpId());
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fileGrpId = fileService.addTnAttachFile(request, user, files, this.getMiddlePath(), fileGrpId);
|
||||
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||
popupSeq.intValue(),
|
||||
updatePopupVO.getTitle(),
|
||||
|
|
@ -370,28 +338,6 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
return resultVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO deleteFileContentsApiPopUpManage(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long fileSeq) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"fileSeq:" + "\n" +
|
||||
fileSeq + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
|
||||
fileService.deleteTnAttachFile(request, user, fileSeq);
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 파일이 저장될 중간 경로를 생성한다.
|
||||
|
|
|
|||
|
|
@ -42,6 +42,18 @@ public class FileService {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 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) throws Exception {
|
||||
return this.addTnAttachFile(request, user, files, middlePath, null);
|
||||
}
|
||||
|
|
@ -64,10 +76,6 @@ public class FileService {
|
|||
* @throws Exception
|
||||
*/
|
||||
public String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile[] files, String middlePath, String fileGrpId) throws Exception {
|
||||
|
||||
if( files == null ) {
|
||||
return fileGrpId;
|
||||
}
|
||||
String ipAddress = NetworkUtil.getClientIpAddress(request);
|
||||
|
||||
|
||||
|
|
@ -77,8 +85,7 @@ public class FileService {
|
|||
}
|
||||
|
||||
|
||||
for (MultipartFile file : files) {
|
||||
if( file != null && !file.isEmpty()) {
|
||||
for (MultipartFile file : files) {if( file != null && !file.isEmpty()) {
|
||||
|
||||
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
||||
filesMap.put("file", file);
|
||||
|
|
@ -91,14 +98,12 @@ public class FileService {
|
|||
|
||||
FileVO item = iter.next();
|
||||
|
||||
String fileNewName = item.getStreFileNm() + "." + item.getFileExtsn();
|
||||
String filePath = (item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/") + fileNewName;
|
||||
tnAttachFileRepository.spAddTnAttachFile(
|
||||
fileGrpId,
|
||||
nCount,
|
||||
item.getOrignlFileNm(),
|
||||
fileNewName,
|
||||
filePath,
|
||||
item.getStreFileNm() + "." + item.getFileExtsn(),
|
||||
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
||||
Long.parseLong(item.getFileMg()),
|
||||
item.getFileExtsn(),
|
||||
ipAddress,
|
||||
|
|
@ -113,39 +118,8 @@ public class FileService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
return fileGrpId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 특정 파일 하나를 삭제한다.
|
||||
* @param request
|
||||
* @param user
|
||||
* @param fileSeq
|
||||
* @return 삭제 성공 시, true. 실패 시, 예외
|
||||
* @throws Exception 예외
|
||||
*/
|
||||
public boolean deleteTnAttachFile(HttpServletRequest request, LoginVO user, Long fileSeq) throws Exception {
|
||||
|
||||
//파일을 삭제한다.
|
||||
|
||||
TnAttachFile tnAttachFile = tnAttachFileRepository.findById(fileSeq.intValue()).orElse(null);
|
||||
|
||||
if( tnAttachFile == null ) {
|
||||
throw new Exception("대상이 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
String fileFullPath = tnAttachFile.getFilePath();
|
||||
|
||||
File file = new File(fileFullPath);
|
||||
file.delete();
|
||||
|
||||
tnAttachFileRepository.deleteById(fileSeq.intValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<TnAttachFile> findByFileGrpId(String fileGrpId) throws Exception {
|
||||
return tnAttachFileRepository.findByFileGrpId(fileGrpId).orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue