Compare commits
2 Commits
b8136827fd
...
67d1b3d827
| Author | SHA1 | Date |
|---|---|---|
|
|
67d1b3d827 | |
|
|
6e0548c233 |
|
|
@ -13,8 +13,12 @@ export default function FormDialog( {open, setOpen, title, contentText, children
|
|||
setOpen(true);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
const handleClose = (event, reason) => {
|
||||
// background를 click해도 dialog가 사라지지 않도록 한다.
|
||||
if(reason !== 'backdropClick' && reason !== 'escapeKeyDown') {
|
||||
// Set 'open' to false, however you would do that with your particular code.
|
||||
setOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ import AddIcon from '@mui/icons-material/Add';
|
|||
|
||||
import styledComponent from "styled-components";
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
||||
import CODE from 'constants/code';
|
||||
|
||||
|
||||
const StyledDiv = styledComponent.div`
|
||||
|
|
@ -67,20 +68,41 @@ const Item = styled(Paper)(({ theme }) => ({
|
|||
|
||||
function ListCreateUpdateDelete(props) {
|
||||
|
||||
const handleClickOpen = () => {
|
||||
const handleClickCreate = (e) => {
|
||||
|
||||
const mode = CODE.MODE_CREATE;
|
||||
|
||||
let paramOrgId = props.itemIndex[props.depthSelectedArrayIndex-1];
|
||||
if( props.depthSelectedArrayIndex === 0 ) {
|
||||
props.setCreateCondition({...props.createCondition, paramCodeLevel : props.paramCodeLevel, paramOrgId : "00"});
|
||||
} else {
|
||||
if( props.itemIndex[props.depthSelectedArrayIndex-1] === undefined ) {
|
||||
paramOrgId = "00";
|
||||
}
|
||||
if( props.depthSelectedArrayIndex !== 0 && props.itemIndex[props.depthSelectedArrayIndex-1] === undefined ) {
|
||||
alert('상위 코드를 선택해주세요.');
|
||||
props.setIsPopupOpen(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);
|
||||
|
||||
};
|
||||
|
||||
const onClickItem = (e, index) => {
|
||||
index = Number(index);
|
||||
// 기존 active를 모두 해제 한다.
|
||||
|
|
@ -107,7 +129,7 @@ function ListCreateUpdateDelete(props) {
|
|||
</Grid>
|
||||
<Grid item xs={0} md={2} sx={{ pl: 0, '&': {backgroundColor: 'transparent' }}}>
|
||||
<Item sx={{ p: 0, '&': { boxShadow: 'none', backgroundColor: '#169bd5', borderRadius: '0px'} }}>
|
||||
<IconButton aria-label="add" sx={{ px: 0, borderRadius: '0px', width: '100%', height: '56px'}} onClick={handleClickOpen}>
|
||||
<IconButton aria-label="add" sx={{ px: 0, borderRadius: '0px', width: '100%', height: '56px'}} onClick={handleClickCreate}>
|
||||
<AddIcon sx={{ px: 0, '&': {color: '#ffffff', width: '30px', height: '30px' }}} />
|
||||
</IconButton>
|
||||
</Item>
|
||||
|
|
@ -121,9 +143,7 @@ function ListCreateUpdateDelete(props) {
|
|||
<ListItem
|
||||
secondaryAction={
|
||||
<div>
|
||||
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit" onClick={(e)=> {
|
||||
props.setIsPopupOpen(true);
|
||||
}}>
|
||||
<IconButton sx={{ mx: 0 }} edge="start" aria-label="edit" onClick={handleClickModify}>
|
||||
<EditIcon />
|
||||
</IconButton>
|
||||
<IconButton edge="end" aria-label="delete" onClick={(e)=> {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
|||
function CommitteeCodeMgt(props) {
|
||||
|
||||
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
|
||||
const [createCondition, setCreateCondition] = useState();
|
||||
const [createOrModifyCondition, setCreateOrModifyCondition] = useState();
|
||||
|
||||
const [depth01List, setDepth01List] = useState({});
|
||||
const [depth02List, setDepth02List] = useState({});
|
||||
|
|
@ -30,7 +30,6 @@ function CommitteeCodeMgt(props) {
|
|||
|
||||
const [confirm, setConfirm] = React.useState();
|
||||
|
||||
const [editCreateMode, setEditCreateMode] = React.useState(); // 생성 or 수정 여부
|
||||
|
||||
|
||||
|
||||
|
|
@ -92,14 +91,6 @@ function CommitteeCodeMgt(props) {
|
|||
|
||||
|
||||
|
||||
useEffect(function () {
|
||||
if( typeof createCondition !== 'undefined' ) {
|
||||
console.log('%o', createCondition);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [createCondition]);
|
||||
|
||||
|
||||
const requestOptions = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
|
@ -182,7 +173,7 @@ function CommitteeCodeMgt(props) {
|
|||
if( Number(depthSelectedIndex[depthSelectedArrayIndex]) === Number(deleteItem.orgId) ) {
|
||||
|
||||
for( let i = depthSelectedArrayIndex + 1; i<4; i++ ) {
|
||||
//setSearchCondition({...searchCondition, paramCodeLevel : createCondition.paramCodeLevel});
|
||||
//setSearchCondition({...searchCondition, paramCodeLevel : createOrModifyCondition.paramCodeLevel});
|
||||
depthSelectedIndex[i] = undefined;
|
||||
}
|
||||
let forChangeObject = [...depthSelectedIndex];
|
||||
|
|
@ -199,11 +190,6 @@ function CommitteeCodeMgt(props) {
|
|||
case 2:
|
||||
setDepth04List({});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -243,16 +229,18 @@ function CommitteeCodeMgt(props) {
|
|||
|
||||
<div className="contents " id="contents">
|
||||
{/* <!-- 본문 --> */}
|
||||
|
||||
<div className="top_tit">
|
||||
<h1 className="tit_1">위원회 코드 관리</h1>
|
||||
</div>
|
||||
|
||||
<Box
|
||||
sx={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'space-between',
|
||||
'& > :not(style)': {
|
||||
mt: 4,
|
||||
mt: 0,
|
||||
width: 245,
|
||||
},
|
||||
}}
|
||||
|
|
@ -264,8 +252,8 @@ function CommitteeCodeMgt(props) {
|
|||
itemIndex={depthSelectedIndex}
|
||||
setItemIndex={setDepthSelectedIndex}
|
||||
depthSelectedArrayIndex={0}
|
||||
createCondition={createCondition}
|
||||
setCreateCondition={setCreateCondition}
|
||||
createOrModifyCondition={createOrModifyCondition}
|
||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
||||
paramCodeLevel="LV_01"
|
||||
upParamOrgId="00"
|
||||
nameKey="orgNm"
|
||||
|
|
@ -280,8 +268,8 @@ function CommitteeCodeMgt(props) {
|
|||
itemIndex={depthSelectedIndex}
|
||||
setItemIndex={setDepthSelectedIndex}
|
||||
depthSelectedArrayIndex={1}
|
||||
createCondition={createCondition}
|
||||
setCreateCondition={setCreateCondition}
|
||||
createOrModifyCondition={createOrModifyCondition}
|
||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
||||
searchCondition={searchCondition}
|
||||
setSearchCondition={setSearchCondition}
|
||||
paramCodeLevel="LV_02"
|
||||
|
|
@ -297,8 +285,8 @@ function CommitteeCodeMgt(props) {
|
|||
itemIndex={depthSelectedIndex}
|
||||
setItemIndex={setDepthSelectedIndex}
|
||||
depthSelectedArrayIndex={2}
|
||||
createCondition={createCondition}
|
||||
setCreateCondition={setCreateCondition}
|
||||
createOrModifyCondition={createOrModifyCondition}
|
||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
||||
searchCondition={searchCondition}
|
||||
setSearchCondition={setSearchCondition}
|
||||
paramCodeLevel="LV_03"
|
||||
|
|
@ -314,8 +302,8 @@ function CommitteeCodeMgt(props) {
|
|||
itemIndex={depthSelectedIndex}
|
||||
setItemIndex={setDepthSelectedIndex}
|
||||
depthSelectedArrayIndex={3}
|
||||
createCondition={createCondition}
|
||||
setCreateCondition={setCreateCondition}
|
||||
createOrModifyCondition={createOrModifyCondition}
|
||||
setCreateOrModifyCondition={setCreateOrModifyCondition}
|
||||
searchCondition={searchCondition}
|
||||
setSearchCondition={setSearchCondition}
|
||||
paramCodeLevel="LV_04"
|
||||
|
|
@ -345,8 +333,7 @@ function CommitteeCodeMgt(props) {
|
|||
<CommitteeCodeRegistrationPopup
|
||||
open={isCommitteeCodeRegistrationPopupOpen}
|
||||
setOpen={setIsCommitteeCodeRegistrationPopupOpen}
|
||||
createCondition={createCondition}
|
||||
setCreateCondition={setCreateCondition}
|
||||
createOrModifyCondition={createOrModifyCondition}
|
||||
searchCondition={searchCondition}
|
||||
setSearchCondition={setSearchCondition}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,53 +1,125 @@
|
|||
import React from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import TextField from '@mui/material/TextField';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
||||
import CODE from 'constants/code';
|
||||
|
||||
import FormDialog from '../../../../components/alert/FormDialog';
|
||||
|
||||
function CommitteeCodeRegistrationPopup(props) {
|
||||
|
||||
const [inputValues, setInputValues] = useState({});
|
||||
|
||||
const handleClickCreateCommitteeCodeManagement = (createCondition) => {
|
||||
const [mode, setMode] = useState("등록");
|
||||
|
||||
if( createCondition.paramOrgId === undefined ) {
|
||||
useEffect(function () {
|
||||
|
||||
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('상위 코드를 선택해주세요.');
|
||||
props.setOpen(false);
|
||||
return false;
|
||||
}
|
||||
const formData = new FormData();
|
||||
|
||||
for (let key in createCondition) {
|
||||
formData.append(key, createCondition[key]);
|
||||
for (let key in createOrModifyCondition) {
|
||||
formData.append(key, createOrModifyCondition[key]);
|
||||
}
|
||||
|
||||
Object.keys(inputValues).forEach(function(key){
|
||||
formData.append(key, inputValues[key]);
|
||||
});
|
||||
|
||||
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
method: props.createOrModifyCondition.mode === CODE.MODE_CREATE ? "POST" : props.createOrModifyCondition.mode === CODE.MODE_MODIFY ? "PUT" : "",
|
||||
body: formData,
|
||||
};
|
||||
|
||||
EgovNet.requestFetch(`/admin/config/committee-code-management`,
|
||||
let appendRequestURL = "";
|
||||
if( props.createOrModifyCondition.mode === CODE.MODE_MODIFY ) {
|
||||
appendRequestURL = `/${props.createOrModifyCondition.target.orgId}`;
|
||||
}
|
||||
const requestURL = "/admin/config/committee-code-management" + appendRequestURL;
|
||||
EgovNet.requestFetch(requestURL,
|
||||
requestOptions,
|
||||
function (resp) {
|
||||
//방금 추가한 것만 새로 읽어 드린다.
|
||||
let paramCodeGroup = props.createCondition.paramOrgId;
|
||||
//새로 읽어 드린다.
|
||||
let paramCodeGroup = props.createOrModifyCondition.paramOrgId;
|
||||
if( paramCodeGroup === "00" ) {
|
||||
paramCodeGroup = null;
|
||||
}
|
||||
props.setSearchCondition({...props.searchCondition, paramCodeGroup, paramCodeLevel : props.createCondition.paramCodeLevel});
|
||||
props.setSearchCondition({...props.searchCondition, paramCodeGroup, paramCodeLevel : props.createOrModifyCondition.paramCodeLevel});
|
||||
|
||||
props.setOpen(false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const handleTextFieldChange = (event) => {
|
||||
const elName = event.target.getAttribute('name');
|
||||
const elValue = event.target.value;
|
||||
props.setCreateCondition({...props.createCondition, [elName]:elValue});
|
||||
const handleTextFieldChange = (e) => {
|
||||
setInputValues({
|
||||
...inputValues,
|
||||
[e.target.name]: e.target.value,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<FormDialog open={props.open} setOpen={props.setOpen} title="위원회 코드 등록" contentText="위원회 코드 항목을 입력해주세요." handleOk={(e) => {handleClickCreateCommitteeCodeManagement(props.createCondition);}} >
|
||||
return (// handleClickCreateCommitteeCodeManagement create or modiofy 로 분기처리해야 한다. thkim 20240305 1500
|
||||
<FormDialog open={props.open} setOpen={props.setOpen} title={`위원회 코드 ${mode}`} contentText="위원회 코드 항목을 입력해주세요." handleOk={(e) => {handleClickCreateCommitteeCodeManagement(props.createOrModifyCondition);}} >
|
||||
<TextField
|
||||
autoFocus
|
||||
required
|
||||
|
|
@ -58,6 +130,7 @@ function CommitteeCodeRegistrationPopup(props) {
|
|||
type="text"
|
||||
fullWidth
|
||||
variant="standard"
|
||||
value={inputValues.paramOrgNm ? inputValues.paramOrgNm : "" }
|
||||
onChange={handleTextFieldChange}
|
||||
/>
|
||||
<TextField
|
||||
|
|
@ -69,6 +142,7 @@ function CommitteeCodeRegistrationPopup(props) {
|
|||
type="text"
|
||||
fullWidth
|
||||
variant="standard"
|
||||
value={inputValues.paramOrgDesc ? inputValues.paramOrgDesc : ""}
|
||||
onChange={handleTextFieldChange}
|
||||
/>
|
||||
</FormDialog>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import com.dbnt.kcscbackend.admin.boards.entity.TnBbs;
|
|||
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
|
||||
import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite;
|
||||
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.contents.popUp.model.UpdatePopupVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
|
||||
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
|
||||
|
|
@ -26,6 +28,7 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
@ -566,4 +569,43 @@ public class AdminConfigController extends BaseController {
|
|||
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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
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,6 +1,7 @@
|
|||
package com.dbnt.kcscbackend.admin.config.service;
|
||||
|
||||
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.UpdateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
|
|
@ -15,7 +16,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
public interface AdminCommitteeCodeManagementService {
|
||||
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 setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception;
|
||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception;
|
||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, SetCommitteeCodeManagementVO setCommitteeCodeManagementVO, Long cmtSeq) throws Exception;
|
||||
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long cmtSeq) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.dbnt.kcscbackend.admin.config.service.impl;
|
||||
|
||||
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.standardResearch.model.CreateStandardResearchVO;
|
||||
import com.dbnt.kcscbackend.admin.standardResearch.model.UpdateStandardResearchVO;
|
||||
|
|
@ -13,6 +14,7 @@ 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.MultipartHttpServletRequest;
|
||||
|
||||
|
|
@ -107,8 +109,48 @@ public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractService
|
|||
}
|
||||
|
||||
@Override
|
||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception {
|
||||
return null;
|
||||
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, SetCommitteeCodeManagementVO setCommitteeCodeManagementVO, Long cmtSeq) throws Exception {
|
||||
System.out.println(
|
||||
"\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
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.dbnt.kcscbackend.commonCode.entity.TnPopupMng;
|
|||
import com.dbnt.kcscbackend.commonCode.repository.TnPopupMngRepository;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import com.dbnt.kcscbackend.file.service.FileService;
|
||||
import com.dbnt.kcscbackend.util.NetworkUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
|
@ -41,8 +42,8 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
private final TnAttachFileRepository tnAttachFileRepository;
|
||||
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
private final FileService fileService;
|
||||
|
||||
|
||||
@Override
|
||||
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception {
|
||||
|
|
@ -113,7 +114,8 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
"\n--------------------------------------------------------------\n"
|
||||
);
|
||||
|
||||
String fileGrpId = this.addTnAttachFile(request, user, file);
|
||||
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spAddTnPopupMng(
|
||||
createPopupVO.getTitle(),
|
||||
|
|
@ -210,7 +212,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
throw new Exception("종료일시는 시작일시보다 앞 설 수 없습니다.");
|
||||
}
|
||||
|
||||
String fileGrpId = this.addTnAttachFile(request, user, file);
|
||||
String fileGrpId = fileService.addTnAttachFile(request, user, file, this.getMiddlePath());
|
||||
|
||||
Map<String, Object> response = tnPopupMngRepository.spUpdateTnPopupMng(
|
||||
popupId.intValue(),
|
||||
|
|
@ -324,6 +326,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
|
|||
|
||||
/**
|
||||
* 파일이 저장될 중간 경로를 생성한다.
|
||||
* D:/kcscUploadFiles/XXXX/abc.jpg XXXX에 해당하는 경로다.
|
||||
* @return 중간 경로
|
||||
*/
|
||||
private String getMiddlePath() {
|
||||
|
|
@ -338,48 +341,7 @@ 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,6 +41,26 @@ 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 (" +
|
||||
|
|
|
|||
|
|
@ -1,10 +1,22 @@
|
|||
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.repository.TnAttachFileRepository;
|
||||
import com.dbnt.kcscbackend.util.NetworkUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
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
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -12,6 +24,9 @@ public class FileService {
|
|||
|
||||
private final TnAttachFileRepository tnAttachFileRepository;
|
||||
|
||||
@Resource(name = "EgovFileMngUtil")
|
||||
private EgovFileMngUtil fileUtil;
|
||||
|
||||
@Transactional
|
||||
public TnAttachFile selectTnAttachFile(TnAttachFile tnAttachFile) {
|
||||
if(tnAttachFile.getFileSeq()!=null){
|
||||
|
|
@ -24,4 +39,63 @@ public class FileService {
|
|||
tnAttachFileRepository.save(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