Compare commits
No commits in common. "67d1b3d8279826e193b49257ff49d0e003aa771d" and "b8136827fd49f753f2bbda459f943ef14cc7daaf" have entirely different histories.
67d1b3d827
...
b8136827fd
|
|
@ -13,12 +13,8 @@ export default function FormDialog( {open, setOpen, title, contentText, children
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = (event, reason) => {
|
const handleClose = () => {
|
||||||
// background를 click해도 dialog가 사라지지 않도록 한다.
|
|
||||||
if(reason !== 'backdropClick' && reason !== 'escapeKeyDown') {
|
|
||||||
// Set 'open' to false, however you would do that with your particular code.
|
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ import AddIcon from '@mui/icons-material/Add';
|
||||||
|
|
||||||
import styledComponent from "styled-components";
|
import styledComponent from "styled-components";
|
||||||
|
|
||||||
|
import * as EgovNet from 'api/egovFetch';
|
||||||
import CODE from 'constants/code';
|
|
||||||
|
|
||||||
|
|
||||||
const StyledDiv = styledComponent.div`
|
const StyledDiv = styledComponent.div`
|
||||||
|
|
@ -68,39 +67,18 @@ const Item = styled(Paper)(({ theme }) => ({
|
||||||
|
|
||||||
function ListCreateUpdateDelete(props) {
|
function ListCreateUpdateDelete(props) {
|
||||||
|
|
||||||
const handleClickCreate = (e) => {
|
const handleClickOpen = () => {
|
||||||
|
|
||||||
const mode = CODE.MODE_CREATE;
|
|
||||||
|
|
||||||
let paramOrgId = props.itemIndex[props.depthSelectedArrayIndex-1];
|
|
||||||
if( props.depthSelectedArrayIndex === 0 ) {
|
if( props.depthSelectedArrayIndex === 0 ) {
|
||||||
paramOrgId = "00";
|
props.setCreateCondition({...props.createCondition, paramCodeLevel : props.paramCodeLevel, paramOrgId : "00"});
|
||||||
}
|
} else {
|
||||||
if( props.depthSelectedArrayIndex !== 0 && props.itemIndex[props.depthSelectedArrayIndex-1] === undefined ) {
|
if( props.itemIndex[props.depthSelectedArrayIndex-1] === undefined ) {
|
||||||
alert('상위 코드를 선택해주세요.');
|
alert('상위 코드를 선택해주세요.');
|
||||||
props.setIsPopupOpen(false);
|
props.setIsPopupOpen(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
props.setCreateCondition({...props.createCondition, paramCodeLevel : props.paramCodeLevel, paramOrgId : props.itemIndex[props.depthSelectedArrayIndex-1]});
|
||||||
props.setCreateOrModifyCondition({mode, paramCodeLevel : props.paramCodeLevel, paramOrgId});
|
|
||||||
props.setIsPopupOpen(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleClickModify = (e) => {
|
|
||||||
|
|
||||||
const mode = CODE.MODE_MODIFY;
|
|
||||||
|
|
||||||
let paramOrgId = props.itemIndex[props.depthSelectedArrayIndex-1];
|
|
||||||
if( props.depthSelectedArrayIndex === 0 ) {
|
|
||||||
paramOrgId = "00";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataKey = e.currentTarget.parentNode.parentNode.parentNode.getAttribute('data-key');
|
|
||||||
const target = props.items[dataKey];
|
|
||||||
|
|
||||||
props.setCreateOrModifyCondition({mode, paramCodeLevel : props.paramCodeLevel, paramOrgId, target });
|
|
||||||
props.setIsPopupOpen(true);
|
props.setIsPopupOpen(true);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickItem = (e, index) => {
|
const onClickItem = (e, index) => {
|
||||||
|
|
@ -129,7 +107,7 @@ function ListCreateUpdateDelete(props) {
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={0} md={2} sx={{ pl: 0, '&': {backgroundColor: 'transparent' }}}>
|
<Grid item xs={0} md={2} sx={{ pl: 0, '&': {backgroundColor: 'transparent' }}}>
|
||||||
<Item sx={{ p: 0, '&': { boxShadow: 'none', backgroundColor: '#169bd5', borderRadius: '0px'} }}>
|
<Item sx={{ p: 0, '&': { boxShadow: 'none', backgroundColor: '#169bd5', borderRadius: '0px'} }}>
|
||||||
<IconButton aria-label="add" sx={{ px: 0, borderRadius: '0px', width: '100%', height: '56px'}} onClick={handleClickCreate}>
|
<IconButton aria-label="add" sx={{ px: 0, borderRadius: '0px', width: '100%', height: '56px'}} onClick={handleClickOpen}>
|
||||||
<AddIcon sx={{ px: 0, '&': {color: '#ffffff', width: '30px', height: '30px' }}} />
|
<AddIcon sx={{ px: 0, '&': {color: '#ffffff', width: '30px', height: '30px' }}} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
@ -143,7 +121,9 @@ function ListCreateUpdateDelete(props) {
|
||||||
<ListItem
|
<ListItem
|
||||||
secondaryAction={
|
secondaryAction={
|
||||||
<div>
|
<div>
|
||||||
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit" onClick={handleClickModify}>
|
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit" onClick={(e)=> {
|
||||||
|
props.setIsPopupOpen(true);
|
||||||
|
}}>
|
||||||
<EditIcon />
|
<EditIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton edge="end" aria-label="delete" onClick={(e)=> {
|
<IconButton edge="end" aria-label="delete" onClick={(e)=> {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||||
function CommitteeCodeMgt(props) {
|
function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
||||||
const [createOrModifyCondition, setCreateOrModifyCondition] = useState();
|
const [createCondition, setCreateCondition] = useState();
|
||||||
|
|
||||||
const [depth01List, setDepth01List] = useState({});
|
const [depth01List, setDepth01List] = useState({});
|
||||||
const [depth02List, setDepth02List] = useState({});
|
const [depth02List, setDepth02List] = useState({});
|
||||||
|
|
@ -30,6 +30,7 @@ function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
const [confirm, setConfirm] = React.useState();
|
const [confirm, setConfirm] = React.useState();
|
||||||
|
|
||||||
|
const [editCreateMode, setEditCreateMode] = React.useState(); // 생성 or 수정 여부
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -91,6 +92,14 @@ function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(function () {
|
||||||
|
if( typeof createCondition !== 'undefined' ) {
|
||||||
|
console.log('%o', createCondition);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [createCondition]);
|
||||||
|
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -173,7 +182,7 @@ function CommitteeCodeMgt(props) {
|
||||||
if( Number(depthSelectedIndex[depthSelectedArrayIndex]) === Number(deleteItem.orgId) ) {
|
if( Number(depthSelectedIndex[depthSelectedArrayIndex]) === Number(deleteItem.orgId) ) {
|
||||||
|
|
||||||
for( let i = depthSelectedArrayIndex + 1; i<4; i++ ) {
|
for( let i = depthSelectedArrayIndex + 1; i<4; i++ ) {
|
||||||
//setSearchCondition({...searchCondition, paramCodeLevel : createOrModifyCondition.paramCodeLevel});
|
//setSearchCondition({...searchCondition, paramCodeLevel : createCondition.paramCodeLevel});
|
||||||
depthSelectedIndex[i] = undefined;
|
depthSelectedIndex[i] = undefined;
|
||||||
}
|
}
|
||||||
let forChangeObject = [...depthSelectedIndex];
|
let forChangeObject = [...depthSelectedIndex];
|
||||||
|
|
@ -190,6 +199,11 @@ function CommitteeCodeMgt(props) {
|
||||||
case 2:
|
case 2:
|
||||||
setDepth04List({});
|
setDepth04List({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -229,18 +243,16 @@ function CommitteeCodeMgt(props) {
|
||||||
|
|
||||||
<div className="contents " id="contents">
|
<div className="contents " id="contents">
|
||||||
{/* <!-- 본문 --> */}
|
{/* <!-- 본문 --> */}
|
||||||
|
|
||||||
<div className="top_tit">
|
<div className="top_tit">
|
||||||
<h1 className="tit_1">위원회 코드 관리</h1>
|
<h1 className="tit_1">위원회 코드 관리</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
'& > :not(style)': {
|
'& > :not(style)': {
|
||||||
mt: 0,
|
mt: 4,
|
||||||
width: 245,
|
width: 245,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
|
@ -252,8 +264,8 @@ function CommitteeCodeMgt(props) {
|
||||||
itemIndex={depthSelectedIndex}
|
itemIndex={depthSelectedIndex}
|
||||||
setItemIndex={setDepthSelectedIndex}
|
setItemIndex={setDepthSelectedIndex}
|
||||||
depthSelectedArrayIndex={0}
|
depthSelectedArrayIndex={0}
|
||||||
createOrModifyCondition={createOrModifyCondition}
|
createCondition={createCondition}
|
||||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
paramCodeLevel="LV_01"
|
paramCodeLevel="LV_01"
|
||||||
upParamOrgId="00"
|
upParamOrgId="00"
|
||||||
nameKey="orgNm"
|
nameKey="orgNm"
|
||||||
|
|
@ -268,8 +280,8 @@ function CommitteeCodeMgt(props) {
|
||||||
itemIndex={depthSelectedIndex}
|
itemIndex={depthSelectedIndex}
|
||||||
setItemIndex={setDepthSelectedIndex}
|
setItemIndex={setDepthSelectedIndex}
|
||||||
depthSelectedArrayIndex={1}
|
depthSelectedArrayIndex={1}
|
||||||
createOrModifyCondition={createOrModifyCondition}
|
createCondition={createCondition}
|
||||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
searchCondition={searchCondition}
|
searchCondition={searchCondition}
|
||||||
setSearchCondition={setSearchCondition}
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_02"
|
paramCodeLevel="LV_02"
|
||||||
|
|
@ -285,8 +297,8 @@ function CommitteeCodeMgt(props) {
|
||||||
itemIndex={depthSelectedIndex}
|
itemIndex={depthSelectedIndex}
|
||||||
setItemIndex={setDepthSelectedIndex}
|
setItemIndex={setDepthSelectedIndex}
|
||||||
depthSelectedArrayIndex={2}
|
depthSelectedArrayIndex={2}
|
||||||
createOrModifyCondition={createOrModifyCondition}
|
createCondition={createCondition}
|
||||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
searchCondition={searchCondition}
|
searchCondition={searchCondition}
|
||||||
setSearchCondition={setSearchCondition}
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_03"
|
paramCodeLevel="LV_03"
|
||||||
|
|
@ -302,8 +314,8 @@ function CommitteeCodeMgt(props) {
|
||||||
itemIndex={depthSelectedIndex}
|
itemIndex={depthSelectedIndex}
|
||||||
setItemIndex={setDepthSelectedIndex}
|
setItemIndex={setDepthSelectedIndex}
|
||||||
depthSelectedArrayIndex={3}
|
depthSelectedArrayIndex={3}
|
||||||
createOrModifyCondition={createOrModifyCondition}
|
createCondition={createCondition}
|
||||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
setCreateCondition={setCreateCondition}
|
||||||
searchCondition={searchCondition}
|
searchCondition={searchCondition}
|
||||||
setSearchCondition={setSearchCondition}
|
setSearchCondition={setSearchCondition}
|
||||||
paramCodeLevel="LV_04"
|
paramCodeLevel="LV_04"
|
||||||
|
|
@ -333,7 +345,8 @@ function CommitteeCodeMgt(props) {
|
||||||
<CommitteeCodeRegistrationPopup
|
<CommitteeCodeRegistrationPopup
|
||||||
open={isCommitteeCodeRegistrationPopupOpen}
|
open={isCommitteeCodeRegistrationPopupOpen}
|
||||||
setOpen={setIsCommitteeCodeRegistrationPopupOpen}
|
setOpen={setIsCommitteeCodeRegistrationPopupOpen}
|
||||||
createOrModifyCondition={createOrModifyCondition}
|
createCondition={createCondition}
|
||||||
|
setCreateCondition={setCreateCondition}
|
||||||
searchCondition={searchCondition}
|
searchCondition={searchCondition}
|
||||||
setSearchCondition={setSearchCondition}
|
setSearchCondition={setSearchCondition}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,125 +1,53 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React from 'react';
|
||||||
import TextField from '@mui/material/TextField';
|
import TextField from '@mui/material/TextField';
|
||||||
|
|
||||||
import * as EgovNet from 'api/egovFetch';
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
import CODE from 'constants/code';
|
|
||||||
|
|
||||||
import FormDialog from '../../../../components/alert/FormDialog';
|
import FormDialog from '../../../../components/alert/FormDialog';
|
||||||
|
|
||||||
function CommitteeCodeRegistrationPopup(props) {
|
function CommitteeCodeRegistrationPopup(props) {
|
||||||
|
|
||||||
const [inputValues, setInputValues] = useState({});
|
|
||||||
|
|
||||||
const [mode, setMode] = useState("등록");
|
const handleClickCreateCommitteeCodeManagement = (createCondition) => {
|
||||||
|
|
||||||
useEffect(function () {
|
if( createCondition.paramOrgId === undefined ) {
|
||||||
|
|
||||||
if( typeof props.createOrModifyCondition === "undefined" ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( typeof props.createOrModifyCondition.mode === "undefined" ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//모드가 변경 되면 값을 초기화 한다.
|
|
||||||
setInputValues({});
|
|
||||||
|
|
||||||
if( props.createOrModifyCondition.mode === CODE.MODE_MODIFY ) {
|
|
||||||
setMode("수정");
|
|
||||||
} else if( props.createOrModifyCondition.mode === CODE.MODE_CREATE ) {
|
|
||||||
setMode("등록");
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [props.createOrModifyCondition && props.createOrModifyCondition.mode]);
|
|
||||||
|
|
||||||
useEffect(function () {
|
|
||||||
|
|
||||||
if( typeof props.createOrModifyCondition === "undefined" ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( typeof props.createOrModifyCondition.mode === "undefined" ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( props.createOrModifyCondition.mode === CODE.MODE_CREATE ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( typeof props.createOrModifyCondition.target === "undefined" ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setInputValues({
|
|
||||||
...inputValues,
|
|
||||||
paramOrgNm : props.createOrModifyCondition.target.orgNm,
|
|
||||||
paramOrgDesc : props.createOrModifyCondition.target.orgDesc,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [props.createOrModifyCondition && props.createOrModifyCondition.target]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleClickCreateCommitteeCodeManagement = (createOrModifyCondition) => {
|
|
||||||
|
|
||||||
if( createOrModifyCondition.paramOrgId === undefined ) {
|
|
||||||
alert('상위 코드를 선택해주세요.');
|
alert('상위 코드를 선택해주세요.');
|
||||||
props.setOpen(false);
|
props.setOpen(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
for (let key in createOrModifyCondition) {
|
for (let key in createCondition) {
|
||||||
formData.append(key, createOrModifyCondition[key]);
|
formData.append(key, createCondition[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.keys(inputValues).forEach(function(key){
|
|
||||||
formData.append(key, inputValues[key]);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: props.createOrModifyCondition.mode === CODE.MODE_CREATE ? "POST" : props.createOrModifyCondition.mode === CODE.MODE_MODIFY ? "PUT" : "",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
};
|
};
|
||||||
|
|
||||||
let appendRequestURL = "";
|
EgovNet.requestFetch(`/admin/config/committee-code-management`,
|
||||||
if( props.createOrModifyCondition.mode === CODE.MODE_MODIFY ) {
|
|
||||||
appendRequestURL = `/${props.createOrModifyCondition.target.orgId}`;
|
|
||||||
}
|
|
||||||
const requestURL = "/admin/config/committee-code-management" + appendRequestURL;
|
|
||||||
EgovNet.requestFetch(requestURL,
|
|
||||||
requestOptions,
|
requestOptions,
|
||||||
function (resp) {
|
function (resp) {
|
||||||
//새로 읽어 드린다.
|
//방금 추가한 것만 새로 읽어 드린다.
|
||||||
let paramCodeGroup = props.createOrModifyCondition.paramOrgId;
|
let paramCodeGroup = props.createCondition.paramOrgId;
|
||||||
if( paramCodeGroup === "00" ) {
|
if( paramCodeGroup === "00" ) {
|
||||||
paramCodeGroup = null;
|
paramCodeGroup = null;
|
||||||
}
|
}
|
||||||
props.setSearchCondition({...props.searchCondition, paramCodeGroup, paramCodeLevel : props.createOrModifyCondition.paramCodeLevel});
|
props.setSearchCondition({...props.searchCondition, paramCodeGroup, paramCodeLevel : props.createCondition.paramCodeLevel});
|
||||||
|
|
||||||
props.setOpen(false);
|
props.setOpen(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTextFieldChange = (e) => {
|
const handleTextFieldChange = (event) => {
|
||||||
setInputValues({
|
const elName = event.target.getAttribute('name');
|
||||||
...inputValues,
|
const elValue = event.target.value;
|
||||||
[e.target.name]: e.target.value,
|
props.setCreateCondition({...props.createCondition, [elName]:elValue});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (// handleClickCreateCommitteeCodeManagement create or modiofy 로 분기처리해야 한다. thkim 20240305 1500
|
return (
|
||||||
<FormDialog open={props.open} setOpen={props.setOpen} title={`위원회 코드 ${mode}`} contentText="위원회 코드 항목을 입력해주세요." handleOk={(e) => {handleClickCreateCommitteeCodeManagement(props.createOrModifyCondition);}} >
|
<FormDialog open={props.open} setOpen={props.setOpen} title="위원회 코드 등록" contentText="위원회 코드 항목을 입력해주세요." handleOk={(e) => {handleClickCreateCommitteeCodeManagement(props.createCondition);}} >
|
||||||
<TextField
|
<TextField
|
||||||
autoFocus
|
autoFocus
|
||||||
required
|
required
|
||||||
|
|
@ -130,7 +58,6 @@ function CommitteeCodeRegistrationPopup(props) {
|
||||||
type="text"
|
type="text"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="standard"
|
variant="standard"
|
||||||
value={inputValues.paramOrgNm ? inputValues.paramOrgNm : "" }
|
|
||||||
onChange={handleTextFieldChange}
|
onChange={handleTextFieldChange}
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
|
|
@ -142,7 +69,6 @@ function CommitteeCodeRegistrationPopup(props) {
|
||||||
type="text"
|
type="text"
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="standard"
|
variant="standard"
|
||||||
value={inputValues.paramOrgDesc ? inputValues.paramOrgDesc : ""}
|
|
||||||
onChange={handleTextFieldChange}
|
onChange={handleTextFieldChange}
|
||||||
/>
|
/>
|
||||||
</FormDialog>
|
</FormDialog>
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
||||||
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
||||||
import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite;
|
import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite;
|
||||||
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.config.model.SetCommitteeCodeManagementVO;
|
|
||||||
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.UpdatePopupVO;
|
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
|
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
|
||||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
|
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
|
||||||
|
|
@ -28,7 +26,6 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
@ -569,43 +566,4 @@ public class AdminConfigController extends BaseController {
|
||||||
return resultVO;
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(
|
|
||||||
summary = "'위원회 코드 관리' 페이지에서 위원회 코드 수정하는 API",
|
|
||||||
description = "관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 연필 모양 수정 버튼으로 항목 수정하는 API",
|
|
||||||
tags = {"AdminConfigController"}
|
|
||||||
)
|
|
||||||
@ApiResponses(value = {
|
|
||||||
@ApiResponse(responseCode = "200", description = "등록 성공"),
|
|
||||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님"),
|
|
||||||
})
|
|
||||||
@PutMapping(value = "/committee-code-management/{orgId}")
|
|
||||||
public ResultVO setCommitteeCodeManagement(
|
|
||||||
HttpServletRequest request,
|
|
||||||
@AuthenticationPrincipal LoginVO loginVO,
|
|
||||||
SetCommitteeCodeManagementVO setCommitteeCodeManagementVO,
|
|
||||||
@PathVariable("orgId") Long orgId
|
|
||||||
) throws Exception {
|
|
||||||
ResultVO resultVO = new ResultVO();
|
|
||||||
|
|
||||||
try {
|
|
||||||
resultVO = adminCommitteeCodeManagementService.setCommitteeCodeManagement(resultVO, request, loginVO, setCommitteeCodeManagementVO, orgId);
|
|
||||||
} 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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.dbnt.kcscbackend.admin.config.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 = "SetCommitteeCodeManagementVO", description =
|
|
||||||
"관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 수정 버튼으로 항목 수정하는 API에 사용된다."
|
|
||||||
)
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString
|
|
||||||
public class SetCommitteeCodeManagementVO extends CreateCommitteeCodeManagementVO implements Serializable {
|
|
||||||
private static final long serialVersionUID = -603047540959527181L;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "cmtSeq")
|
|
||||||
private Long orgId;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.config.service;
|
package com.dbnt.kcscbackend.admin.config.service;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.config.model.SetCommitteeCodeManagementVO;
|
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
|
|
@ -16,8 +15,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
public interface AdminCommitteeCodeManagementService {
|
public interface AdminCommitteeCodeManagementService {
|
||||||
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, CreateCommitteeCodeManagementVO createCommitteeCodeManagementVO) throws Exception;
|
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, CreateCommitteeCodeManagementVO createCommitteeCodeManagementVO) throws Exception;
|
||||||
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception;
|
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception;
|
||||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, SetCommitteeCodeManagementVO setCommitteeCodeManagementVO, Long cmtSeq) throws Exception;
|
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
||||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long cmtSeq) throws Exception;
|
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.admin.config.service.impl;
|
package com.dbnt.kcscbackend.admin.config.service.impl;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
import com.dbnt.kcscbackend.admin.config.model.CreateCommitteeCodeManagementVO;
|
||||||
import com.dbnt.kcscbackend.admin.config.model.SetCommitteeCodeManagementVO;
|
|
||||||
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.CreateStandardResearchVO;
|
||||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||||
|
|
@ -14,7 +13,6 @@ import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
|
||||||
|
|
@ -109,48 +107,8 @@ public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, SetCommitteeCodeManagementVO setCommitteeCodeManagementVO, Long cmtSeq) throws Exception {
|
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception {
|
||||||
System.out.println(
|
return null;
|
||||||
"\n--------------------------------------------------------------\n" +
|
|
||||||
request.getRequestURI() + " IN:" +
|
|
||||||
"\n--------------------------------------------------------------\n" +
|
|
||||||
"setCommitteeCodeManagementVO:" + "\n" +
|
|
||||||
setCommitteeCodeManagementVO.toString() + "\n" +
|
|
||||||
"cmtSeq:" + "\n" +
|
|
||||||
cmtSeq + "\n" +
|
|
||||||
"\n--------------------------------------------------------------\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
// 유효성 검사 실시
|
|
||||||
int isValid = tnCmtOrgRepository.spIsValidTnCmtOrgId(cmtSeq.intValue());
|
|
||||||
|
|
||||||
if( isValid == 0 ) {
|
|
||||||
throw new Exception("대상이 존재하지 않습니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
TnCmtOrg tnCmtOrg = tnCmtOrgRepository.findByCmtSeq(cmtSeq);
|
|
||||||
|
|
||||||
Map<String, Object> response = tnCmtOrgRepository.spUpdateTnCmtOrg(
|
|
||||||
cmtSeq.intValue(),
|
|
||||||
setCommitteeCodeManagementVO.getParamOrgNm(),
|
|
||||||
setCommitteeCodeManagementVO.getParamOrgDesc(),
|
|
||||||
tnCmtOrg.getCmtOrder(),
|
|
||||||
user.getId(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> dto = new HashMap<String, Object>();
|
|
||||||
dto.put("errorMessage", response.get("_error_message") );
|
|
||||||
dto.put("orgId", cmtSeq);
|
|
||||||
|
|
||||||
resultVO.setResult(dto);
|
|
||||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
|
||||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
|
||||||
|
|
||||||
return resultVO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
||||||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||||
import com.dbnt.kcscbackend.file.service.FileService;
|
|
||||||
import com.dbnt.kcscbackend.util.NetworkUtil;
|
import com.dbnt.kcscbackend.util.NetworkUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
|
|
@ -42,8 +41,8 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
|
|
||||||
private final TnAttachFileRepository tnAttachFileRepository;
|
private final TnAttachFileRepository tnAttachFileRepository;
|
||||||
|
|
||||||
private final FileService fileService;
|
@Resource(name = "EgovFileMngUtil")
|
||||||
|
private EgovFileMngUtil fileUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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 {
|
||||||
|
|
@ -114,8 +113,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
"\n--------------------------------------------------------------\n"
|
"\n--------------------------------------------------------------\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
String fileGrpId = this.addTnAttachFile(request, user, file);
|
||||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
|
||||||
|
|
||||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||||
createPopupVO.getTitle(),
|
createPopupVO.getTitle(),
|
||||||
|
|
@ -212,7 +210,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
String fileGrpId = this.addTnAttachFile(request, user, file);
|
||||||
|
|
||||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||||
popupId.intValue(),
|
popupId.intValue(),
|
||||||
|
|
@ -326,7 +324,6 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 파일이 저장될 중간 경로를 생성한다.
|
* 파일이 저장될 중간 경로를 생성한다.
|
||||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
|
||||||
* @return 중간 경로
|
* @return 중간 경로
|
||||||
*/
|
*/
|
||||||
private String getMiddlePath() {
|
private String getMiddlePath() {
|
||||||
|
|
@ -341,7 +338,48 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String addTnAttachFile(HttpServletRequest request, LoginVO user, MultipartFile file) throws Exception {
|
||||||
|
String ipAddress = NetworkUtil.getClientIpAddress(request);
|
||||||
|
|
||||||
|
String fileGrpId = null;
|
||||||
|
if( file != null && !file.isEmpty()) {
|
||||||
|
//파일이 저장될 중간 경로를 생성한다.
|
||||||
|
String middlePath = this.getMiddlePath();
|
||||||
|
|
||||||
|
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
||||||
|
filesMap.put("file", file);
|
||||||
|
|
||||||
|
//String fileGrpId = UUID.randomUUID().toString();
|
||||||
|
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
||||||
|
|
||||||
|
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
||||||
|
|
||||||
|
|
||||||
|
// 업로드된 file을 tnAttachFile에 insert한다.
|
||||||
|
for (Iterator<FileVO> iter = files.iterator(); iter.hasNext(); ) {
|
||||||
|
|
||||||
|
FileVO item = iter.next();
|
||||||
|
|
||||||
|
tnAttachFileRepository.spAddTnAttachFile(
|
||||||
|
fileGrpId,
|
||||||
|
1,
|
||||||
|
item.getOrignlFileNm(),
|
||||||
|
item.getStreFileNm() + "." + item.getFileExtsn(),
|
||||||
|
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
||||||
|
Long.parseLong(item.getFileMg()),
|
||||||
|
item.getFileExtsn(),
|
||||||
|
ipAddress,
|
||||||
|
user.getId(),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileGrpId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,26 +41,6 @@ public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnC
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@Query(value = "CALL sp_update_tn_cmt_org (" +
|
|
||||||
":_cmt_seq, " +
|
|
||||||
":_cmt_nm, " +
|
|
||||||
":_cmt_desc, " +
|
|
||||||
":_cmt_order, " +
|
|
||||||
":_modi_id, " +
|
|
||||||
":_result_count, " +
|
|
||||||
":_result_code, " +
|
|
||||||
":_error_message)",
|
|
||||||
nativeQuery = true)
|
|
||||||
Map<String, Object> spUpdateTnCmtOrg(
|
|
||||||
@Param("_cmt_seq") Integer cmtSeq,
|
|
||||||
@Param("_cmt_nm") String cmtNm,
|
|
||||||
@Param("_cmt_desc") String cmtDesc,
|
|
||||||
@Param("_cmt_order") Integer cmtOrder,
|
|
||||||
@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_cmt_org (" +
|
@Query(value = "CALL sp_delete_tn_cmt_org (" +
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,10 @@
|
||||||
package com.dbnt.kcscbackend.file.service;
|
package com.dbnt.kcscbackend.file.service;
|
||||||
|
|
||||||
import com.dbnt.kcscbackend.admin.contents.popUp.model.FileVO;
|
|
||||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
|
||||||
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
||||||
import com.dbnt.kcscbackend.file.repository.TnAttachFileRepository;
|
import com.dbnt.kcscbackend.file.repository.TnAttachFileRepository;
|
||||||
import com.dbnt.kcscbackend.util.NetworkUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -24,9 +12,6 @@ public class FileService {
|
||||||
|
|
||||||
private final TnAttachFileRepository tnAttachFileRepository;
|
private final TnAttachFileRepository tnAttachFileRepository;
|
||||||
|
|
||||||
@Resource(name = "EgovFileMngUtil")
|
|
||||||
private EgovFileMngUtil fileUtil;
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public TnAttachFile selectTnAttachFile(TnAttachFile tnAttachFile) {
|
public TnAttachFile selectTnAttachFile(TnAttachFile tnAttachFile) {
|
||||||
if(tnAttachFile.getFileSeq()!=null){
|
if(tnAttachFile.getFileSeq()!=null){
|
||||||
|
|
@ -39,63 +24,4 @@ public class FileService {
|
||||||
tnAttachFileRepository.save(tnAttachFile);
|
tnAttachFileRepository.save(tnAttachFile);
|
||||||
return tnAttachFile;
|
return tnAttachFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TN_ATTACH_FILE table에 insert 후, 파일 그룹 ID를 return 한다.
|
|
||||||
* TN_ATTACH_FILE 참고.
|
|
||||||
* @param request
|
|
||||||
* @param user
|
|
||||||
* @param file
|
|
||||||
* @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 file, String middlePath) throws Exception {
|
|
||||||
String ipAddress = NetworkUtil.getClientIpAddress(request);
|
|
||||||
|
|
||||||
String fileGrpId = null;
|
|
||||||
if( file != null && !file.isEmpty()) {
|
|
||||||
|
|
||||||
Map<String, MultipartFile> filesMap = new HashMap<String, MultipartFile>();
|
|
||||||
filesMap.put("file", file);
|
|
||||||
|
|
||||||
//String fileGrpId = UUID.randomUUID().toString();
|
|
||||||
fileGrpId = tnAttachFileRepository.makeFileGrpId(user.getId());
|
|
||||||
|
|
||||||
List<FileVO> files = fileUtil.parseFileInf(filesMap, "", 0, middlePath, null);
|
|
||||||
|
|
||||||
int nCount = 1;
|
|
||||||
// 업로드된 file을 tnAttachFile에 insert한다.
|
|
||||||
for (Iterator<FileVO> iter = files.iterator(); iter.hasNext(); nCount++) {
|
|
||||||
|
|
||||||
FileVO item = iter.next();
|
|
||||||
|
|
||||||
tnAttachFileRepository.spAddTnAttachFile(
|
|
||||||
fileGrpId,
|
|
||||||
nCount,
|
|
||||||
item.getOrignlFileNm(),
|
|
||||||
item.getStreFileNm() + "." + item.getFileExtsn(),
|
|
||||||
(item.getFileStreCours() + File.separator + item.getAtchFileId()).replaceAll("\\\\", "/"),
|
|
||||||
Long.parseLong(item.getFileMg()),
|
|
||||||
item.getFileExtsn(),
|
|
||||||
ipAddress,
|
|
||||||
user.getId(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fileGrpId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue