From 432cad27ab1e31df6dde53701aa88cb30ec85f96 Mon Sep 17 00:00:00 2001 From: thkim Date: Fri, 23 Feb 2024 14:20:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20-=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=84=A4=EC=A0=95=20-=20=EC=9C=84=EC=9B=90?= =?UTF-8?q?=ED=9A=8C=20=EC=BD=94=EB=93=9C=EA=B4=80=EB=A6=AC=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84=20-=20=EC=B4=9D=EA=B4=84?= =?UTF-8?q?=EC=9C=84=EC=9B=90=ED=9A=8C=20=EB=AA=A9=EB=A1=9D=20=EA=B0=80?= =?UTF-8?q?=EC=A0=B8=EC=98=A4=EA=B8=B0=20=EA=B5=AC=ED=98=84=20=EA=B1=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../list/ListCreateUpdateDelete.jsx | 11 +- .../src/components/list/ListLabelInputs.jsx | 2 - .../pages/admin/config/CommitteeCodeMgt.jsx | 144 +++++++++++------- .../admin/config/AdminConfigController.java | 60 +++++++- .../AdminCommitteeCodeManagementService.java | 20 +++ ...minCommitteeCodeManagementServiceImpl.java | 75 +++++++++ .../AdminStandardResearchController.java | 3 - .../repository/TnCmtOrgRepository.java | 1 + 8 files changed, 250 insertions(+), 66 deletions(-) create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminCommitteeCodeManagementService.java create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/impl/AdminCommitteeCodeManagementServiceImpl.java diff --git a/egovframe-template-simple-react-contribution/src/components/list/ListCreateUpdateDelete.jsx b/egovframe-template-simple-react-contribution/src/components/list/ListCreateUpdateDelete.jsx index f98ba48..509529a 100644 --- a/egovframe-template-simple-react-contribution/src/components/list/ListCreateUpdateDelete.jsx +++ b/egovframe-template-simple-react-contribution/src/components/list/ListCreateUpdateDelete.jsx @@ -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], }, {onClickListner(e, index);}} @@ -99,7 +100,9 @@ function ListCreateUpdateDelete(props) { } > , - onClickItem + onClickItem, + props.nameKey, + props.idKey )} diff --git a/egovframe-template-simple-react-contribution/src/components/list/ListLabelInputs.jsx b/egovframe-template-simple-react-contribution/src/components/list/ListLabelInputs.jsx index 44e06c6..122b64f 100644 --- a/egovframe-template-simple-react-contribution/src/components/list/ListLabelInputs.jsx +++ b/egovframe-template-simple-react-contribution/src/components/list/ListLabelInputs.jsx @@ -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]); diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/CommitteeCodeMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/CommitteeCodeMgt.jsx index 1c1656b..6d5f156 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/CommitteeCodeMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/CommitteeCodeMgt.jsx @@ -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}¶mCodeLevel=${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 (
@@ -107,7 +142,6 @@ function CommitteeCodeMgt(props) {

위원회 코드 관리

- - - - - - - :not(style)': { - mt: 4, - width: 245, - }, - }} - > - + + + + + + { true && + :not(style)': { + mt: 4, + width: 245, + }, + }} + > + + + } + {/* */}
diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java index 58a14b9..9f36621 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/AdminConfigController.java @@ -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; + } + } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminCommitteeCodeManagementService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminCommitteeCodeManagementService.java new file mode 100644 index 0000000..7e6ae13 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminCommitteeCodeManagementService.java @@ -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; + +} \ No newline at end of file diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/impl/AdminCommitteeCodeManagementServiceImpl.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/impl/AdminCommitteeCodeManagementServiceImpl.java new file mode 100644 index 0000000..60b0f01 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/impl/AdminCommitteeCodeManagementServiceImpl.java @@ -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> list = tnCmtOrgRepository.findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder("Y", upCmtSeq, cmtType).stream() + .map(item -> { + Map returnMap = new HashMap<>(); + returnMap.put("orgId", item.getCmtSeq()); + returnMap.put("orgNm", item.getCmtNm()); + returnMap.put("orgDesc", item.getCmtDesc()); + return returnMap; + }) + .collect(Collectors.toList()); + + Map dto = new HashMap(); + 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; + } +} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/standardResearch/AdminStandardResearchController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/standardResearch/AdminStandardResearchController.java index b56428e..3154df3 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/standardResearch/AdminStandardResearchController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/standardResearch/AdminStandardResearchController.java @@ -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; diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/commonCode/repository/TnCmtOrgRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/commonCode/repository/TnCmtOrgRepository.java index 2e1f4c7..c3ff2ac 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/commonCode/repository/TnCmtOrgRepository.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/commonCode/repository/TnCmtOrgRepository.java @@ -8,5 +8,6 @@ import java.util.List; public interface TnCmtOrgRepository extends JpaRepository { List findByUseYnAndUpCmtSeqOrderByCmtOrder(String useYn, Long upCmtSeq); TnCmtOrg findByUseYnAndCmtSeq(String useYn, Long cmtSeq); + List findByUseYnAndUpCmtSeqAndCmtTypeOrderByCmtOrder(String useYn, Long upCmtSeq, String cmtType); }