feat: 관리자 - 환경설정 - 위원회 코드관리 목록 구현 - 총괄위원회 목록 가져오기 구현 건

thkim
thkim 2024-02-23 14:20:23 +09:00
parent a357df161d
commit 432cad27ab
8 changed files with 250 additions and 66 deletions

View File

@ -18,15 +18,16 @@ import FormDialog from '../../components/alert/FormDialog';
function generate(items, element, onClickListner) {
function generate(items, element, onClickListner,nameKey,
idKey) {
return items.map((value, index) =>
React.cloneElement(element, {
key: value,
key: value[nameKey],
},
<Card fullWidth sx={{ '&': { boxShadow: 'none' } }}>
<CardActionArea fullWidth sx={{ px: 1 }}>
<ListItemText
primary={value}
primary={value[nameKey]}
key={index}
data-index={index}
onClick={(e) => {onClickListner(e, index);}}
@ -99,7 +100,9 @@ function ListCreateUpdateDelete(props) {
}
>
</ListItem>,
onClickItem
onClickItem,
props.nameKey,
props.idKey
)}
</List>
</Demo>

View File

@ -28,12 +28,10 @@ function ListLabelInputs(props) {
useEffect(function () {
setItems(props.items);
console.log( props.items );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props]);
useEffect(function () {
console.log( items );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [items]);

View File

@ -1,25 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import EditIcon from '@mui/icons-material/Edit';
import ListItemAvatar from '@mui/material/ListItemAvatar';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import Avatar from '@mui/material/Avatar';
import IconButton from '@mui/material/IconButton';
import FormGroup from '@mui/material/FormGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import FolderIcon from '@mui/icons-material/Folder';
import DeleteIcon from '@mui/icons-material/Delete';
import AddIcon from '@mui/icons-material/Add';
import AddBoxOutlinedIcon from '@mui/icons-material/AddBoxOutlined';
import * as EgovNet from 'api/egovFetch';
@ -35,13 +18,12 @@ import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
function CommitteeCodeMgt(props) {
const [dense, setDense] = useState(false);
const [secondary, setSecondary] = useState(false);
const [searchCondition, setSearchCondition] = useState({ paramCodeGroup: null, paramCodeLevel: 'LV_01' });
const [depth01List, setDepth01List] = useState(["중앙건설기술심의", "테스트2"]);
const [depth02List, setDepth02List] = useState(["123", "테스트2"]);
const [depth03List, setDepth03List] = useState(["다람쥐", "쳇바퀴"]);
const [depth04List, setDepth04List] = useState(["임시 텍스트", "text"]);
const [depth01List, setDepth01List] = useState([]);
const [depth02List, setDepth02List] = useState([]);
const [depth03List, setDepth03List] = useState([]);
const [depth04List, setDepth04List] = useState([]);
const [summaryArray, setSummaryArray] = useState({});
const [depth01SelectedIndex, setDepth01SelectedIndex] = React.useState();
@ -49,13 +31,70 @@ function CommitteeCodeMgt(props) {
const [depth03SelectedIndex, setDepth03SelectedIndex] = React.useState();
const [depth04SelectedIndex, setDepth04SelectedIndex] = React.useState();
// '' item , '' .
useEffect(function () {
// 2 .
if( typeof depth01SelectedIndex !== 'undefined' ) {
setSearchCondition({ paramCodeGroup: depth01List[depth01SelectedIndex].orgId, paramCodeLevel: 'LV_02' });
//setDepth02List([]);
}
if( typeof depth02SelectedIndex !== 'undefined' ) {
setSearchCondition({ paramCodeGroup: depth02List[depth02SelectedIndex].orgId, paramCodeLevel: 'LV_03' });
//setDepth03List([]);
}
if( typeof depth03SelectedIndex !== 'undefined' ) {
setSearchCondition({ paramCodeGroup: depth03List[depth03SelectedIndex].orgId, paramCodeLevel: 'LV_04' });
//setDepth04List([]);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [depth01SelectedIndex, depth02SelectedIndex, depth03SelectedIndex]);
// .
useEffect(function () {
if( typeof searchCondition !== 'undefined' ) {
getList(searchCondition);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchCondition]);
const requestOptions = {
method: "GET",
headers: {
'Content-type': 'application/json'
}
}
const getList = (searchCondition) => {
EgovNet.requestFetch(`/admin/config/committee-code-management?paramCodeGroup=${searchCondition.paramCodeGroup}&paramCodeLevel=${searchCondition.paramCodeLevel}`,
requestOptions,
function (resp) {
if( searchCondition.paramCodeLevel === 'LV_01' ) {
setDepth01List(resp.result.list);
} else if( searchCondition.paramCodeLevel === 'LV_02' ) {
setDepth02List(resp.result.list);
} else if( searchCondition.paramCodeLevel === 'LV_03' ) {
setDepth03List(resp.result.list);
} else if( searchCondition.paramCodeLevel === 'LV_04' ) {
setDepth04List(resp.result.list);
}
}
);
}
useEffect(function () {
setSummaryArray(
{
"중앙건설기술심의" : depth01List[depth01SelectedIndex],
"총괄위원회" : depth02List[depth02SelectedIndex],
"건설기준위원회" : depth03List[depth03SelectedIndex],
"실무위원회" : depth04List[depth04SelectedIndex],
"중앙건설기술심의" : depth01List[depth01SelectedIndex] && depth01List[depth01SelectedIndex].orgNm ? depth01List[depth01SelectedIndex].orgNm : "",
"총괄위원회" : depth02List[depth02SelectedIndex] && depth02List[depth02SelectedIndex].orgNm ? depth02List[depth02SelectedIndex].orgNm : "",
"건설기준위원회" : depth03List[depth03SelectedIndex] && depth03List[depth03SelectedIndex].orgNm ? depth03List[depth03SelectedIndex].orgNm : "",
"실무위원회" : depth04List[depth04SelectedIndex] && depth04List[depth04SelectedIndex].orgNm ? depth04List[depth04SelectedIndex].orgNm : "",
}
);
console.log(`${depth01List[depth01SelectedIndex]}[${depth01SelectedIndex}]`);
@ -68,13 +107,7 @@ function CommitteeCodeMgt(props) {
depth01SelectedIndex,
depth02SelectedIndex,
depth03SelectedIndex,
depth04SelectedIndex]);
useEffect(function () {
console.log( summaryArray );
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [summaryArray]);
depth04SelectedIndex]);
const Location = React.memo(function Location() {
@ -90,6 +123,8 @@ function CommitteeCodeMgt(props) {
)
});
return (
<div className="container">
<div className="c_wrap">
@ -107,7 +142,6 @@ function CommitteeCodeMgt(props) {
<div className="top_tit">
<h1 className="tit_1">위원회 코드 관리</h1>
</div>
<Box
sx={{
display: 'flex',
@ -119,23 +153,27 @@ function CommitteeCodeMgt(props) {
},
}}
>
<ListCreateUpdateDelete title="중앙건설기술심의" items={depth01List} setItemIndex={setDepth01SelectedIndex}/>
<ListCreateUpdateDelete title="총괄위원회" items={depth02List} setItemIndex={setDepth02SelectedIndex}/>
<ListCreateUpdateDelete title="건설기준위원회" items={depth03List} setItemIndex={setDepth03SelectedIndex}/>
<ListCreateUpdateDelete title="실무위원회" items={depth04List} setItemIndex={setDepth04SelectedIndex}/>
</Box>
<Box
sx={{
display: 'flex',
flexWrap: 'wrap',
'& > :not(style)': {
mt: 4,
width: 245,
},
}}
>
<ListLabelInputs title="위원회 코드정보" items={summaryArray} />
<ListCreateUpdateDelete title="중앙건설기술심의" items={depth01List} setItemIndex={setDepth01SelectedIndex} nameKey="orgNm" idKey="orgId" />
<ListCreateUpdateDelete title="총괄위원회" items={depth02List} setItemIndex={setDepth02SelectedIndex} nameKey="orgNm" idKey="orgId" />
<ListCreateUpdateDelete title="건설기준위원회" items={depth03List} setItemIndex={setDepth03SelectedIndex} nameKey="orgNm" idKey="orgId" />
<ListCreateUpdateDelete title="실무위원회" items={depth04List} setItemIndex={setDepth04SelectedIndex} nameKey="orgNm" idKey="orgId" />
</Box>
{ true &&
<Box
sx={{
display: 'flex',
flexWrap: 'wrap',
'& > :not(style)': {
mt: 4,
width: 245,
},
}}
>
<ListLabelInputs title="위원회 코드정보" items={summaryArray} />
</Box>
}
{/* <!--// 본문 --> */}
</div>

View File

@ -1,6 +1,8 @@
package com.dbnt.kcscbackend.admin.config;
import com.dbnt.kcscbackend.admin.config.entity.TcMenu;
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService;
import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp;
import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem;
import com.dbnt.kcscbackend.admin.config.service.AdminConfigService;
@ -9,20 +11,21 @@ import com.dbnt.kcscbackend.commonCode.service.CommonCodeService;
import com.dbnt.kcscbackend.config.common.BaseController;
import com.dbnt.kcscbackend.config.common.ResponseCode;
import com.dbnt.kcscbackend.config.common.ResultVO;
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 lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.validation.Errors;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.HashMap;
@ -37,6 +40,9 @@ public class AdminConfigController extends BaseController {
private final AdminConfigService adminConfigService;
private final CommonCodeService commonCodeService;
@Resource(name = "adminCommitteeCodeManagementService")
private AdminCommitteeCodeManagementService adminCommitteeCodeManagementService;
@Operation(
summary = "기본코드 그룹 조회",
description = "기본코드 그룹 조회",
@ -350,4 +356,50 @@ public class AdminConfigController extends BaseController {
return resultVO;
}
@Operation(
summary = "'위원회 코드 관리' 페이지에서 목록 불러오는 API",
description = "관리자 단에서 '환경설정' > '위원회코드 관리' 페이지에서 목록 불러오는 API",
tags = {"AdminConfigController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "303", description = "만료된 토큰"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@GetMapping(value = "/committee-code-management")
public ResultVO getCommitteeCodeManagement(
@AuthenticationPrincipal LoginVO user,
HttpServletRequest request,
@ApiParam(value="상위 code") @RequestParam(required=true) String paramCodeGroup,
@ApiParam(value="code level") @RequestParam(required=true) String paramCodeLevel
) throws Exception {
ResultVO resultVO = new ResultVO();
if(user == null) {
resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode());
} else {
try {
Long upCmtSeq = null;
if (!paramCodeGroup.equals("null")) {
upCmtSeq = Long.parseLong(paramCodeGroup);
}
resultVO = adminCommitteeCodeManagementService.getCommitteeCodeManagement(resultVO, request, user, upCmtSeq, paramCodeLevel);
} 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;
}
}

View File

@ -0,0 +1,20 @@
package com.dbnt.kcscbackend.admin.config.service;
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 io.swagger.annotations.ApiParam;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
public interface AdminCommitteeCodeManagementService {
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, final MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) 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;
}

View File

@ -0,0 +1,75 @@
package com.dbnt.kcscbackend.admin.config.service.impl;
import com.dbnt.kcscbackend.admin.config.service.AdminCommitteeCodeManagementService;
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.commonCode.repository.TnCmtOrgRepository;
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.stereotype.Service;
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("adminCommitteeCodeManagementService")
@RequiredArgsConstructor
public class AdminCommitteeCodeManagementServiceImpl extends EgovAbstractServiceImpl implements AdminCommitteeCodeManagementService {
private final TnCmtOrgRepository tnCmtOrgRepository;
@Override
public ResultVO createCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, MultipartHttpServletRequest multiRequest, CreateStandardResearchVO createStandardResearchVO) throws Exception {
return null;
}
@Override
public ResultVO getCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long upCmtSeq, String cmtType) throws Exception {
System.out.println(
"\n--------------------------------------------------------------\n" +
request.getRequestURI() + " IN:" +
"\n--------------------------------------------------------------\n" +
"user.getEmail():" + "\n" +
user.getEmail() + "\n" +
"\n--------------------------------------------------------------\n"
);
List<Map<String, Object>> list = tnCmtOrgRepository.findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder("Y", upCmtSeq, cmtType).stream()
.map(item -> {
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("orgId", item.getCmtSeq());
returnMap.put("orgNm", item.getCmtNm());
returnMap.put("orgDesc", item.getCmtDesc());
return returnMap;
})
.collect(Collectors.toList());
Map<String, Object> dto = new HashMap<String, Object>();
dto.put("list", list);
resultVO.setResult(dto);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
return resultVO;
}
@Override
public ResultVO setCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, UpdateStandardResearchVO updateStandardResearchVO, Long popupId) throws Exception {
return null;
}
@Override
public ResultVO deleteCommitteeCodeManagement(ResultVO resultVO, HttpServletRequest request, LoginVO user, Long popupId) throws Exception {
return null;
}
}

View File

@ -1,8 +1,6 @@
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;
@ -11,7 +9,6 @@ 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;

View File

@ -8,5 +8,6 @@ import java.util.List;
public interface TnCmtOrgRepository extends JpaRepository<TnCmtOrg, TnCmtOrg.TnCmtOrgId> {
List<TnCmtOrg> findByUseYnAndUpCmtSeqOrderByCmtOrder(String useYn, Long upCmtSeq);
TnCmtOrg findByUseYnAndCmtSeq(String useYn, Long cmtSeq);
List<TnCmtOrg> findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder(String useYn, Long upCmtSeq, String cmtType);
}