Compare commits
2 Commits
a23833a00b
...
e2e4c075b7
| Author | SHA1 | Date |
|---|---|---|
|
|
e2e4c075b7 | |
|
|
2431425362 |
|
|
@ -28,7 +28,7 @@ const StyledDiv = styled.div`
|
|||
|
||||
`;
|
||||
|
||||
function PopupWriter(props) {
|
||||
function PopupEditor(props) {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
|
@ -373,4 +373,4 @@ function PopupWriter(props) {
|
|||
}
|
||||
|
||||
|
||||
export default PopupWriter;
|
||||
export default PopupEditor;
|
||||
|
|
@ -1,13 +1,85 @@
|
|||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import Switch from '@mui/material/Switch';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
import CODE from 'constants/code';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
import EgovPagingPaginationInfo from 'components/EgovPagingPaginationInfo';
|
||||
|
||||
|
||||
import styled from "styled-components";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
.board_btn_area {
|
||||
margin: 12px 0px;
|
||||
}
|
||||
`;
|
||||
|
||||
const label = { inputProps: { 'aria-label': '사용여부' } };
|
||||
|
||||
function StandardResearch(props) {
|
||||
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [list, setList] = useState([]);
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });
|
||||
const [paginationInfo, setPaginationInfo] = useState({});
|
||||
|
||||
useEffect(function () {
|
||||
getList(searchCondition);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
const getList = (searchCondition) => {
|
||||
|
||||
EgovNet.requestFetch(`/contents/standard-research/list?page=${searchCondition.pageIndex-1}&size=10&sort=rsSeq,desc`,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
console.log('%o', resp);
|
||||
setList(resp.result.list);
|
||||
setPaginationInfo({...resp.result.paginationInfo});
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
const onChangeActivationSwitch = (e, popupId) => {
|
||||
const checked = e.target.checked;
|
||||
const requestURL = `/contents/api/popup-manage/activation-switch/${popupId}?checked=${checked}`;
|
||||
|
||||
const requestOptions = {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(requestURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
console.log("====>>> Schdule delete= ", resp);
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
navigate(URL.ADMIN__CONTENTS__POP_UP ,{ replace: true });
|
||||
} else {
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}});
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const Location = React.memo(function Location() {
|
||||
return (
|
||||
<div className="location">
|
||||
|
|
@ -35,11 +107,51 @@ function StandardResearch(props) {
|
|||
|
||||
<div className="contents " id="contents">
|
||||
{/* <!-- 본문 --> */}
|
||||
<StyledDiv>
|
||||
<div className="top_tit">
|
||||
<h1 className="tit_1">건설기준연구 관리</h1>
|
||||
</div>
|
||||
{/* <!-- 버튼영역 --> */}
|
||||
<div className="board_btn_area">
|
||||
<div className="right_col btn1">
|
||||
<Link to={URL.ADMIN__CONTENTS__POP_UP__CREATE} className="btn btn_blue_h46 w_100">글 작성</Link>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 버튼영역 --> */}
|
||||
|
||||
여기에 구현해주세요.
|
||||
{/* <!-- 게시판목록 --> */}
|
||||
<div className="board_list BRD008">
|
||||
<div className="head">
|
||||
<span>번호</span>
|
||||
<span>연구명</span>
|
||||
<span>연구기간</span>
|
||||
<span>연구책임자</span>
|
||||
</div>
|
||||
<div className="result">
|
||||
{/* <!-- case : 데이터 없을때 --> */}
|
||||
{list.length === 0 &&
|
||||
<p className="no_data" key="0">검색된 결과가 없습니다.</p>
|
||||
}
|
||||
{list.map((it)=>(
|
||||
<div className='list_item' key={it.id}>
|
||||
<div>{it.id}</div>
|
||||
<div className="al"><Link to={URL.ADMIN__CONTENTS__POP_UP__MODIFY} state={{popupId: it.id} } key={it.id}>{it.title}</Link></div>
|
||||
<div>{it.researchStartDate} ~ {it.researchEndDate}</div>
|
||||
<div>{it.director}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 게시판목록 --> */}
|
||||
|
||||
<div className="board_bot">
|
||||
{/* <!-- Paging --> */}
|
||||
<EgovPagingPaginationInfo pagination={paginationInfo} setPaginationInfo={setPaginationInfo} moveToPage={passedPage => {
|
||||
getList({ ...searchCondition, pageIndex: passedPage })
|
||||
}} />
|
||||
{/* <!--/ Paging --> */}
|
||||
</div>
|
||||
</StyledDiv>
|
||||
{/* <!--// 본문 --> */}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,376 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import DatePicker from "react-datepicker";
|
||||
|
||||
import EgovAttachFile from 'components/EgovAttachFile';
|
||||
import RichTextEditor from "../../../../components/editor/RichTextEditor";
|
||||
import AlertDialogSlide from "../../../../components/alert/AlertDialogSlide";
|
||||
import CODE from 'constants/code';
|
||||
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
|
||||
import styled from "styled-components";
|
||||
|
||||
const StyledDiv = styled.div`
|
||||
|
||||
.board_view2 {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.board_btn_area {
|
||||
|
||||
margin-top: 70px;
|
||||
}
|
||||
|
||||
`;
|
||||
|
||||
function StandardResearchEditor(props) {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const [modeInfo, setModeInfo] = useState({ mode: props.mode });
|
||||
const [text, setText] = useState("");
|
||||
const [textOriginal, setTextOriginal] = useState("");
|
||||
const [popupDetail, setPopupDetail] = useState({ startDate: new Date(), endDate: new Date() });
|
||||
|
||||
const [schdulBgndeHH, setSchdulBgndeHH] = useState();
|
||||
const [schdulBgndeMM, setSchdulBgndeMM] = useState();
|
||||
const [schdulEnddeHH, setSchdulEnddeHH] = useState();
|
||||
const [schdulEnddeMM, setSchdulEnddeMM] = useState();
|
||||
const [boardAttachFiles, setBoardAttachFiles] = useState();
|
||||
|
||||
const [confirm, setConfirm] = React.useState();
|
||||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
initMode();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const formValidator = (formData) => {
|
||||
if (formData.get('title') === null || formData.get('title') === "") {
|
||||
alert("제목은 필수 값입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (formData.get('schdulBgnde') > formData.get('schdulEndde')) {
|
||||
alert("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
return false;
|
||||
}
|
||||
if (formData.get('contents') === null || formData.get('contents') === "") {
|
||||
alert("내용은 필수 값입니다.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const initMode = () => {
|
||||
|
||||
// props.mode 값이 없으면 에러가 발생한다.
|
||||
switch (props.mode) {
|
||||
case CODE.MODE_CREATE:
|
||||
setModeInfo({
|
||||
...modeInfo,
|
||||
modeTitle: "등록",
|
||||
method : "POST",
|
||||
editURL: '/contents/api/popup-manage'
|
||||
});
|
||||
break;
|
||||
case CODE.MODE_MODIFY:
|
||||
setModeInfo({
|
||||
...modeInfo,
|
||||
modeTitle: "수정",
|
||||
method : "PUT",
|
||||
editURL: '/contents/api/popup-manage'
|
||||
});
|
||||
break;
|
||||
default:
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : ""}});
|
||||
}
|
||||
retrieveDetail();
|
||||
}
|
||||
|
||||
const retrieveDetail = () => {
|
||||
|
||||
if (modeInfo.mode === CODE.MODE_CREATE) {// 조회/등록이면 조회 안함
|
||||
return;
|
||||
}
|
||||
|
||||
const retrieveDetailURL = `/contents/api/popup-manage/${location.state?.popupId}`;
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
'Content-type': 'application/json'
|
||||
}
|
||||
}
|
||||
EgovNet.requestFetch(retrieveDetailURL,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
let rawDetail = resp.result;
|
||||
//기본값 설정
|
||||
setPopupDetail({
|
||||
...popupDetail,
|
||||
...rawDetail,
|
||||
startDate: convertDate(rawDetail.schdulBgnde),
|
||||
endDate: convertDate(rawDetail.schdulEndde),
|
||||
});
|
||||
setText(rawDetail.contents);
|
||||
setTextOriginal(rawDetail.contents);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const createPopup = () => {
|
||||
const formData = new FormData();
|
||||
|
||||
for (let key in popupDetail) {
|
||||
if ( key === 'startDate' ) {
|
||||
formData.append(key, getDateFourteenDigit( popupDetail[key] ));
|
||||
} else if( key === 'endDate' ) {
|
||||
formData.append(key, getDateFourteenDigit( popupDetail[key] ));
|
||||
} else {
|
||||
formData.append(key, popupDetail[key]);
|
||||
}
|
||||
}
|
||||
|
||||
//게시글 내용
|
||||
formData.delete("contents");
|
||||
formData.append("contents", text);
|
||||
|
||||
if (formValidator(formData)) {
|
||||
const requestOptions = {
|
||||
method: modeInfo.method,
|
||||
body: formData
|
||||
}
|
||||
|
||||
const requestTask = (callbackParams) => {
|
||||
EgovNet.requestFetch(callbackParams.requestUrl,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
if (modeInfo.mode === CODE.MODE_MODIFY) {
|
||||
alert("게시글이 수정 되었습니다.");
|
||||
}
|
||||
navigate({ pathname: URL.ADMIN__CONTENTS__POP_UP });
|
||||
} else {
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}});
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
if (modeInfo.mode === CODE.MODE_CREATE) {
|
||||
setConfirm({...confirm, open: true, body: "추가하시겠습니까?", yesCallback: requestTask, yesCallbackParams: {requestUrl:modeInfo.editURL}});
|
||||
} else if (modeInfo.mode === CODE.MODE_MODIFY) {
|
||||
setConfirm({...confirm, open: true, body: "수정하시겠습니까?", yesCallback: requestTask, yesCallbackParams: {requestUrl:`${modeInfo.editURL}/${location.state?.popupId}`}});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const onClickDelete = (popupId) => {
|
||||
const deleteBoardURL = `/contents/api/popup-manage/${popupId}`;
|
||||
|
||||
const requestOptions = {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
}
|
||||
}
|
||||
|
||||
const requestTask = () => {
|
||||
EgovNet.requestFetch(deleteBoardURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) {
|
||||
alert("삭제 되었습니다.");
|
||||
navigate(URL.ADMIN__CONTENTS__POP_UP ,{ replace: true });
|
||||
} else {
|
||||
navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}});
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
setConfirm({...confirm, open: true, body: "삭제하시겠습니까?", yesCallback: requestTask});
|
||||
}
|
||||
|
||||
const onClickList = (e) => {
|
||||
|
||||
const requestTask = () => {
|
||||
navigate(URL.ADMIN__CONTENTS__POP_UP ,{ replace: true });
|
||||
};
|
||||
if( text !== textOriginal ) {
|
||||
setConfirm({...confirm, open: true, body: "작업 내용을 취소하시겠습니까?", yesCallback: requestTask});
|
||||
} else {
|
||||
requestTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
const convertDate = (str) => {
|
||||
let year = str.substring(0, 4);
|
||||
let month = str.substring(4, 6);
|
||||
let date = str.substring(6, 8);
|
||||
let hour = str.substring(8, 10);
|
||||
let minute = str.substring(10, 12);
|
||||
return new Date(year, month - 1, date, hour, minute)
|
||||
}
|
||||
const getDateFourteenDigit = (date) => {
|
||||
return `${getYYYYMMDD(date).toString()}${makeTwoDigit(date.getHours())}${makeTwoDigit(date.getMinutes())}${makeTwoDigit(date.getSeconds())}`;
|
||||
}
|
||||
const getYYYYMMDD = (date) => {
|
||||
return date.getFullYear().toString() + makeTwoDigit(Number(date.getMonth() + 1)) + makeTwoDigit(date.getDate());
|
||||
}
|
||||
const makeTwoDigit = (number) => {
|
||||
return number < 10 ? "0" + number : number.toString();
|
||||
}
|
||||
|
||||
|
||||
const Location = React.memo(function Location() {
|
||||
return (
|
||||
<div className="location">
|
||||
<ul>
|
||||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||
<li><Link to={URL.ADMIN}>사이트 관리</Link></li>
|
||||
<li>컨텐츠 관리</li>
|
||||
<li>팝업 관리</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="c_wrap">
|
||||
{/* <!-- Location --> */}
|
||||
<Location />
|
||||
{/* <!--// Location --> */}
|
||||
|
||||
<div className="layout">
|
||||
{/* <!-- Navigation --> */}
|
||||
<EgovLeftNav></EgovLeftNav>
|
||||
{/* <!--// Navigation --> */}
|
||||
|
||||
<div className="contents " id="contents">
|
||||
{/* <!-- 본문 --> */}
|
||||
<StyledDiv>
|
||||
<div className="top_tit">
|
||||
<h1 className="tit_1">팝업 추가</h1>
|
||||
</div>
|
||||
{/* <!-- 상단 입력 form --> */}
|
||||
<div className='board_view2'>
|
||||
<dl>
|
||||
<dt><label htmlFor="title">제목</label><span className="req">필수</span></dt>
|
||||
<dd>
|
||||
<input className="f_input2 w_full" type="text" name="title" title="제목" id="title" placeholder="제목을 입력하세요."
|
||||
value={popupDetail.title}
|
||||
onChange={(e) => setPopupDetail({ ...popupDetail, title: e.target.value })}
|
||||
/>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>기간<span className="req">필수</span></dt>
|
||||
<dd className="datetime">
|
||||
<span className="line_break">
|
||||
<DatePicker
|
||||
selected={popupDetail.startDate}
|
||||
name="schdulBgnde"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd HH:mm"
|
||||
showTimeInput
|
||||
onChange={(date) => {
|
||||
console.log("setStartDate : ", date);
|
||||
setPopupDetail({ ...popupDetail, 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={popupDetail.endDate}
|
||||
name="schdulEndde"
|
||||
className="f_input"
|
||||
dateFormat="yyyy-MM-dd HH:mm"
|
||||
showTimeInput
|
||||
minDate={popupDetail.startDate}
|
||||
onChange={(date) => {
|
||||
console.log("setEndDate: ", date);
|
||||
setPopupDetail({ ...popupDetail, 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>
|
||||
<EgovAttachFile
|
||||
fnChangeFile={(attachfile) => {
|
||||
console.log("====>>> Changed attachfile file = ", attachfile);
|
||||
const arrayConcat = { ...popupDetail}; // 기존 단일 파일 업로드에서 다중파일 객체 추가로 변환(아래 for문으로)
|
||||
for ( let i = 0; i < attachfile.length; i++) {
|
||||
arrayConcat[`file_${i}`] = attachfile[i];
|
||||
}
|
||||
setPopupDetail(arrayConcat);
|
||||
}}
|
||||
fnDeleteFile={(deletedFile) => {
|
||||
console.log("====>>> Delete deletedFile = ", deletedFile);
|
||||
setBoardAttachFiles(deletedFile);
|
||||
}}
|
||||
boardFiles={boardAttachFiles}
|
||||
mode={props.mode} />
|
||||
</div>
|
||||
{/* <!--// 상단 입력 form --> */}
|
||||
|
||||
{/* <!-- 게시판 --> */}
|
||||
<RichTextEditor item={text} setText={setText}/>
|
||||
{/* <!--// 게시판 --> */}
|
||||
|
||||
{/* <!-- 버튼영역 --> */}
|
||||
<div className="board_btn_area">
|
||||
<div className="left_col btn1">
|
||||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={() => createPopup()}
|
||||
> 저장</button>
|
||||
{modeInfo.mode === CODE.MODE_MODIFY &&
|
||||
<button className="btn btn_skyblue_h46 w_100"
|
||||
onClick={(e) => {
|
||||
onClickDelete(location.state?.popupId);
|
||||
}}>삭제</button>
|
||||
}
|
||||
</div>
|
||||
<div className="right_col btn1">
|
||||
<button className="btn btn_blue_h46 w_100"
|
||||
onClick={onClickList}>목록</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 버튼영역 --> */}
|
||||
|
||||
<AlertDialogSlide confirm={confirm} setConfirm={setConfirm} />
|
||||
</StyledDiv>
|
||||
{/* <!--// 본문 --> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default StandardResearchEditor;
|
||||
|
|
@ -91,7 +91,7 @@ import AdminStandardsInfoDisclosure from 'pages/admin/standards/InfoDisclosure';
|
|||
// 관리자 - 컨텐츠 관리
|
||||
import AdminContentsSurvey from 'pages/admin/contents/Survey'; // 관리자 - 컨텐츠 관리/설문 관리
|
||||
import AdminContentsPopUp from 'pages/admin/contents/PopUp'; // 관리자 - 컨텐츠 관리/팝업 관리
|
||||
import AdminContentsPopUpWriter from 'pages/admin/contents/PopUp/PopupWriter'; // 관리자 - 컨텐츠 관리/팝업 관리/팝업 추가 또는 수정
|
||||
import AdminContentsPopUpWriter from 'pages/admin/contents/PopUp/PopupEditor'; // 관리자 - 컨텐츠 관리/팝업 관리/팝업 추가 또는 수정
|
||||
import AdminContentsStandardResearch from 'pages/admin/contents/StandardResearch'; // 관리자 - 컨텐츠 관리/건설기준연구 관리
|
||||
import AdminContentsTextMessages from 'pages/admin/contents/TextMessages'; // 관리자 - 컨텐츠 관리/문자 발송
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,240 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.utils.EgovFileMngUtil;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@Api("AdminStandardResearchController")
|
||||
@RestController
|
||||
@Tag(name="AdminStandardResearchController",description = "건설기준연구 관리")
|
||||
public class AdminStandardResearchController {
|
||||
|
||||
@Resource(name = "adminStandardResearchService")
|
||||
private AdminStandardResearchService adminStandardResearchService;
|
||||
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
@Operation(
|
||||
summary = "'건설기준연구 관리' 페이지에서 목록 불러오는 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 목록 불러오는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@GetMapping(value = "/contents/standard-research/list")
|
||||
public ResultVO contentsStandardResearchList(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request,
|
||||
Pageable pageable) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchList(resultVO, request, user, pageable);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 추가 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 추가하는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
@ApiResponse(responseCode = "900", description = "입력값 무결성 오류")
|
||||
})
|
||||
@PostMapping(value = "/contents/standard-research")
|
||||
public ResultVO contentsStandardResearchCreate(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
final MultipartHttpServletRequest multiRequest,
|
||||
CreateStandardResearchVO createStandardResearchVO
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchCreate(resultVO, request, loginVO, multiRequest, createStandardResearchVO);
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 수정 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 수정하는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
})
|
||||
@PutMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchUpdate(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
UpdateStandardResearchVO updateStandardResearchVO,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchUpdate(resultVO, request, loginVO, updateStandardResearchVO, popupId);
|
||||
} 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 비활성화 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 팝업을 비활성화 API. 삭제가 아닌 비활성화 임. 삭제는 없음.",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
||||
})
|
||||
@DeleteMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchDelete
|
||||
(
|
||||
@AuthenticationPrincipal LoginVO user,
|
||||
HttpServletRequest request,
|
||||
@PathVariable("popupId") String strPopupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Long popupId = Long.valueOf(strPopupId);
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchDelete(resultVO, request, user, popupId);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "팝업 내용 불러오기 API",
|
||||
description = "관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 저장된 팝업을 불러오는 API",
|
||||
tags = {"PopUpApiController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공")
|
||||
})
|
||||
@GetMapping(value = "/contents/standard-research/{popupId}")
|
||||
public ResultVO contentsStandardResearchRead(
|
||||
HttpServletRequest request,
|
||||
@AuthenticationPrincipal LoginVO loginVO,
|
||||
@PathVariable("popupId") Long popupId
|
||||
) throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
try {
|
||||
resultVO = adminStandardResearchService.contentsStandardResearchRead(resultVO, request, loginVO, popupId);
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel(value = "CreateStandardResearchVO", description =
|
||||
"관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 글 작성하는 API에 사용된다." + ""
|
||||
)
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class CreateStandardResearchVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 2635889608799075362L;
|
||||
|
||||
@ApiModelProperty(value = "title")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "researchStartDate")
|
||||
private String researchStartDate;
|
||||
@ApiModelProperty(value = "researchEndDate")
|
||||
private String researchEndDate;
|
||||
@ApiModelProperty(value = "director")
|
||||
private String director;
|
||||
@ApiModelProperty(value = "purpose")
|
||||
private String purpose;
|
||||
@ApiModelProperty(value = "content")
|
||||
private String content;
|
||||
@ApiModelProperty(value = "effectContent")
|
||||
private String effectContent;
|
||||
/*
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_research")
|
||||
public class TnResearchLightweight {
|
||||
|
||||
@Id
|
||||
@Column(name = "rs_seq")
|
||||
private Long rsSeq;
|
||||
|
||||
@Column(name = "rs_title")
|
||||
private String rsTitle;
|
||||
|
||||
@Column(name = "rs_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsStartDate;
|
||||
|
||||
@Column(name = "rs_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsEndDate;
|
||||
|
||||
@Column(name = "rs_director")
|
||||
private String rsDirector;
|
||||
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TnResearchId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9042992093269088042L;
|
||||
|
||||
private String rsSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ApiModel(value = "UpdateStandardResearchVO", description =
|
||||
"관리자 단에서 '컨텐츠 관리' > '건설기준연구 관리' 페이지에서 글 수정하는 API에 사용된다." + ""
|
||||
)
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class UpdateStandardResearchVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2518477576804111511L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
@ApiModelProperty(value = "title")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "researchStartDate")
|
||||
private String researchStartDate;
|
||||
@ApiModelProperty(value = "researchEndDate")
|
||||
private String researchEndDate;
|
||||
@ApiModelProperty(value = "director")
|
||||
private String director;
|
||||
@ApiModelProperty(value = "purpose")
|
||||
private String purpose;
|
||||
@ApiModelProperty(value = "content")
|
||||
private String content;
|
||||
@ApiModelProperty(value = "effectContent")
|
||||
private String effectContent;
|
||||
/*
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
files: (binary)
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.TnResearchLightweight;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface TnResearchRepositoryLightweight extends JpaRepository<TnResearchLightweight, Long> {
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.service;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public interface AdminStandardResearchService {
|
||||
public ResultVO contentsStandardResearchList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
|
||||
public ResultVO contentsStandardResearchCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception;
|
||||
public ResultVO contentsStandardResearchRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO contentsStandardResearchUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
||||
public ResultVO contentsStandardResearchDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
package com.dbnt.kcscbackend.admin.standardResearch.service.impl;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.CreatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.FileVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.repository.TnPopupMngRepositoryWithoutPopupContents;
|
||||
import com.dbnt.kcscbackend.admin.contents.popUp.service.PopUpApiService;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.repository.TnResearchRepositoryLightweight;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnResearch;
|
||||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||
import com.dbnt.kcscbackend.commonCode.repository.TnResearchRepository;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("adminStandardResearchService")
|
||||
@RequiredArgsConstructor
|
||||
public class AdminStandardResearchServiceImpl extends EgovAbstractServiceImpl implements AdminStandardResearchService {
|
||||
|
||||
private final TnResearchRepository tnResearchRepository;
|
||||
private final TnResearchRepositoryLightweight tnResearchRepositoryLightweight;
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
long totalRecordCount = tnResearchRepositoryLightweight.count();
|
||||
List<Map<String, Object>> list = tnResearchRepositoryLightweight.findAll(pageable)
|
||||
.stream()
|
||||
.map(item -> {
|
||||
Map<String, Object> codeMap = new HashMap<>();
|
||||
codeMap.put("id", item.getRsSeq());
|
||||
codeMap.put("title", item.getRsTitle());
|
||||
codeMap.put("researchStartDate", item.getRsStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("researchEndDate", item.getRsEndDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
codeMap.put("director", item.getRsDirector());
|
||||
codeMap.put("createDate", item.getFrstCrtDt());
|
||||
codeMap.put("createUserId", item.getFrstCrtId());
|
||||
codeMap.put("updateDate", item.getLastChgDt());
|
||||
codeMap.put("updateUserId", item.getLastChgId());
|
||||
codeMap.put("useYn", item.getUseYn());
|
||||
return codeMap;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(pageable.getPageNumber()+1);
|
||||
paginationInfo.setRecordCountPerPage(pageable.getPageSize());
|
||||
paginationInfo.setPageSize(5);//hard coded
|
||||
paginationInfo.setTotalRecordCount((int) totalRecordCount);
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("list", list);
|
||||
dto.put("paginationInfo", paginationInfo);
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchCreate(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
// 첨부파일 관련 첨부파일ID 생성
|
||||
List<FileVO> _result = null;
|
||||
String _atchFileId = "";
|
||||
|
||||
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
||||
|
||||
if (!files.isEmpty()) {
|
||||
//_atchFileId = fileMngService.insertFileInfs(_result); //파일이 생성되고나면 생성된 첨부파일 ID를 리턴한다.
|
||||
}
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spAddTnResearch(
|
||||
createStandardResearchVO.getTitle(),
|
||||
createStandardResearchVO.getResearchStartDate(),
|
||||
createStandardResearchVO.getResearchEndDate(),
|
||||
createStandardResearchVO.getDirector(),
|
||||
createStandardResearchVO.getPurpose(),
|
||||
createStandardResearchVO.getContent(),
|
||||
createStandardResearchVO.getEffectContent(),
|
||||
"kcsc_admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchRead(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long rsId) throws Exception {
|
||||
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"user.getEmail():" + "\n" +
|
||||
user.getEmail() + "\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
TnResearch tnResearch = tnResearchRepository.findByRsSeq(rsId);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("content", tnResearch.getRsContents());
|
||||
dto.put("createDate", tnResearch.getFrstCrtDt().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 시작 일시 - yyyyMMddHHmmss
|
||||
dto.put("createUserId", tnResearch.getFrstCrtId());
|
||||
dto.put("director", tnResearch.getRsDirector());
|
||||
dto.put("effectContent", tnResearch.getRsEffect());
|
||||
dto.put("id", tnResearch.getRsSeq());
|
||||
dto.put("purpose", tnResearch.getRsPurpose());
|
||||
dto.put("researchEndDate", tnResearch.getRsEndDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 시작 일시 - yyyyMMddHHmmss
|
||||
dto.put("researchStartDate", tnResearch.getRsStartDate().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
dto.put("title", tnResearch.getRsTitle());
|
||||
dto.put("updateDate", tnResearch.getLastChgDt().plusHours(9).format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); // 날짜/시간의 종료 일시 - yyyyMMddHHmmss
|
||||
dto.put("updateUserId", tnResearch.getLastChgId());
|
||||
dto.put("useYn", tnResearch.getUseYn());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchUpdate(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long rsId) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"updateStandardResearchVO:" + "\n" +
|
||||
updateStandardResearchVO.toString() + "\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
if( Long.parseLong(updateStandardResearchVO.getResearchStartDate()) > Long.parseLong(updateStandardResearchVO.getResearchEndDate()) ) {
|
||||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
}
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spUpdateTnResearch(
|
||||
rsId.intValue(),
|
||||
updateStandardResearchVO.getResearchStartDate(),
|
||||
updateStandardResearchVO.getResearchEndDate(),
|
||||
updateStandardResearchVO.getDirector(),
|
||||
updateStandardResearchVO.getPurpose(),
|
||||
updateStandardResearchVO.getContent(),
|
||||
updateStandardResearchVO.getEffectContent(),
|
||||
"kcsc_admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
dto.put("rsId", rsId);
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsStandardResearchDelete(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long rsId) throws Exception {
|
||||
System.out.println(
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
request.getRequestURI() + " IN:" +
|
||||
"\n--------------------------------------------------------------\n" +
|
||||
"rsId:" + "\n" +
|
||||
rsId + "\n" +
|
||||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Map<String, Object> dto = new HashMap<String, Object>();
|
||||
|
||||
Map<String, Object> response = tnResearchRepository.spDeleteTnResearch(
|
||||
rsId.intValue(),
|
||||
"admin",
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
dto.put("errorMessage", response.get("_error_message") );
|
||||
|
||||
|
||||
dto.put("rsId", rsId );
|
||||
|
||||
resultVO.setResult(dto);
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
package com.dbnt.kcscbackend.commonCode.entity;
|
||||
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_research")
|
||||
public class TnResearch {
|
||||
|
||||
@Id
|
||||
@Column(name = "rs_seq")
|
||||
private Long rsSeq;
|
||||
|
||||
@Column(name = "rs_title")
|
||||
private String rsTitle;
|
||||
|
||||
@Column(name = "rs_start_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsStartDate;
|
||||
|
||||
@Column(name = "rs_end_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rsEndDate;
|
||||
|
||||
@Column(name = "rs_director")
|
||||
private String rsDirector;
|
||||
|
||||
@Column(name = "rs_purpose")
|
||||
private String rsPurpose;
|
||||
|
||||
@Column(name = "rs_contents")
|
||||
private String rsContents;
|
||||
|
||||
@Column(name = "rs_effect")
|
||||
private String rsEffect;
|
||||
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class TnResearchId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9042992093269088042L;
|
||||
|
||||
private String rsSeq;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.dbnt.kcscbackend.commonCode.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TnResearch;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.jpa.repository.query.Procedure;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface TnResearchRepository extends JpaRepository<TnResearch, Long> {
|
||||
|
||||
@Query(value = "CALL sp_add_tn_research (" +
|
||||
":_rs_title, " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_start_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_end_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
":_rs_director, " +
|
||||
":_rs_purpose, " +
|
||||
":_rs_contents, " +
|
||||
":_rs_effect, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spAddTnResearch(
|
||||
@Param("_rs_title") String rsTitle,
|
||||
@Param("_rs_start_date") String rsStartDate,
|
||||
@Param("_rs_end_date") String rsEndDate,
|
||||
@Param("_rs_director") String rsDirector,
|
||||
@Param("_rs_purpose") String rsPurpose,
|
||||
@Param("_rs_contents") String rsContents,
|
||||
@Param("_rs_effect") String rsEffect,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
@Query(value = "CALL sp_update_tn_research (" +
|
||||
":_rs_seq, " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_start_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
"TO_TIMESTAMP(" +
|
||||
" :_rs_end_date," +
|
||||
" 'YYYYMMDDHH24MISS'" +
|
||||
")::::timestamptz AT TIME ZONE 'UTC', " +
|
||||
":_rs_director, " +
|
||||
":_rs_purpose, " +
|
||||
":_rs_contents, " +
|
||||
":_rs_effect, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spUpdateTnResearch(
|
||||
@Param("_rs_seq") Integer rsSeq,
|
||||
@Param("_rs_start_date") String rsStartDate,
|
||||
@Param("_rs_end_date") String rsEndDate,
|
||||
@Param("_rs_director") String rsDirector,
|
||||
@Param("_rs_purpose") String rsPurpose,
|
||||
@Param("_rs_contents") String rsContents,
|
||||
@Param("_rs_effect") String rsEffect,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
@Query(value = "CALL sp_delete_tn_research (" +
|
||||
":_rs_seq, " +
|
||||
":_modi_id, " +
|
||||
":_result_count, " +
|
||||
":_result_code, " +
|
||||
":_error_message)",
|
||||
nativeQuery = true)
|
||||
Map<String, Object> spDeleteTnResearch(
|
||||
@Param("_rs_seq") Integer rsSeq,
|
||||
@Param("_modi_id") String modiId,
|
||||
@Param("_result_count") Integer resultCount,
|
||||
@Param("_result_code") String resultCode,
|
||||
@Param("_error_message") String errorMessage
|
||||
);
|
||||
|
||||
|
||||
|
||||
TnResearch findByRsSeq(Long rsSeq);
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue