Merge branch 'master' of http://118.219.150.34:50501/DBNT/kcscDev into thkim
commit
90973d65d1
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, {useState} from 'react';
|
||||
import { Link, NavLink, useNavigate } from 'react-router-dom';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
|
|
@ -13,6 +13,7 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
console.group("EgovHeader");
|
||||
console.log("[Start] EgovHeader ------------------------------");
|
||||
|
||||
const [menuDiv, setMenuDiv] = useState(false);
|
||||
const accessToken = getLocalItem('accessToken');
|
||||
const userInfo = parseJwt(accessToken);
|
||||
const sessionUserId = userInfo?.id;
|
||||
|
|
@ -56,9 +57,15 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
);
|
||||
}
|
||||
|
||||
function allMenuControl(){
|
||||
setMenuDiv(!menuDiv);
|
||||
}
|
||||
|
||||
console.log("------------------------------EgovHeader [End]");
|
||||
console.groupEnd("EgovHeader");
|
||||
|
||||
|
||||
|
||||
return (
|
||||
// <!-- header -->
|
||||
<div className="header">
|
||||
|
|
@ -71,7 +78,8 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
<div className="gnb">
|
||||
<h2 className="blind">주메뉴</h2>
|
||||
<ul>
|
||||
<li><NavLink to={URL.ABOUT} className={({ isActive }) => (isActive ? "cur" : "")}>사이트소개</NavLink></li>
|
||||
<li><NavLink to={URL.STANDARD_CODE_INFO} className={({ isActive }) => (isActive ? "cur" : "")}>건설기준코드</NavLink></li>
|
||||
{/*<li><NavLink to={URL.ABOUT} className={({ isActive }) => (isActive ? "cur" : "")}>사이트소개</NavLink></li>*/}
|
||||
<li><NavLink to={URL.INTRO} className={({ isActive }) => (isActive ? "cur" : "")}>정보마당</NavLink></li>
|
||||
<li><NavLink to={URL.SUPPORT} className={({ isActive }) => (isActive ? "cur" : "")}>고객지원</NavLink></li>
|
||||
<li><NavLink to={URL.INFORM} className={({ isActive }) => (isActive ? "cur" : "")}>알림마당</NavLink></li>
|
||||
|
|
@ -98,17 +106,24 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
{/* <!--// PC web에서 보여지는 영역 --> */}
|
||||
|
||||
{/* <!-- right area --> */}
|
||||
<div className="right_a">
|
||||
<div className="right_a" onClick={allMenuControl}>
|
||||
<button type="button" className="btn btnAllMenu" title="전체메뉴 닫힘">전체메뉴</button>
|
||||
<button type="button" className="btn mobile btnAllMenuM" title="전체메뉴 닫힘">전체메뉴</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <!-- All menu : web --> */}
|
||||
<div className="all_menu WEB closed">
|
||||
<div className={`all_menu WEB ${menuDiv?"open":"closed"}`}>
|
||||
<h2 className="blind">전체메뉴</h2>
|
||||
<div className="inner">
|
||||
<div className="col">
|
||||
<h3>건설기준코드</h3>
|
||||
<ul>
|
||||
<li><NavLink to={URL.STANDARD_CODE_INFO} onClick={allMenuControl} className={({ isActive }) => (isActive ? "cur" : "")}>건설기준코드 안내</NavLink></li>
|
||||
<li><NavLink to={URL.STANDARD_CODE_LIST} onClick={allMenuControl} className={({ isActive }) => (isActive ? "cur" : "")}>건설기준코드 검색</NavLink></li>
|
||||
</ul>
|
||||
</div>
|
||||
{/*<div className="col">
|
||||
<h3>사이트소개</h3>
|
||||
<ul>
|
||||
<li><NavLink to={URL.ABOUT_SITE} className={({ isActive }) => (isActive ? "cur" : "")}>소개</NavLink></li>
|
||||
|
|
@ -116,7 +131,8 @@ function EgovHeader({ loginUser, onChangeLogin }) {
|
|||
<li><NavLink to={URL.ABOUT_ORGANIZATION} className={({ isActive }) => (isActive ? "cur" : "")}>조직소개</NavLink></li>
|
||||
<li><NavLink to={URL.ABOUT_LOCATION} className={({ isActive }) => (isActive ? "cur" : "")}>찾아오시는 길</NavLink></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>*/}
|
||||
|
||||
<div className="col">
|
||||
<h3>정보마당</h3>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -121,7 +121,9 @@ const URL = {
|
|||
ADMIN__LOGS__FILE_DOWNLOAD_STATUS : "/admin/logs/file-download-status", // 위원회 관리/파일 다운현황
|
||||
|
||||
//기준코드
|
||||
STANDARD_CODE_LIST : "/standardCode/list/:listCode", //건설기준코드/리스트
|
||||
STANDARD_CODE_INFO : "/standardCode/info",
|
||||
STANDARD_CODE_LIST : "/standardCode/list", //건설기준코드/리스트
|
||||
STANDARD_CODE_LIST_LINK : "/standardCode/list/:listCode", //건설기준코드/리스트
|
||||
STANDARD_CODE_DETAIL : "/standardCode/detail", //건설기준코드/리스트
|
||||
STANDARD_CODE_VIEWER : "/standardCode/viewer", //건설기준코드/뷰어
|
||||
STANDARD_CODE_VIEWER_LINK : "/standardCode/viewer/:linkedDocCode", //건설기준코드/뷰어/새 창 링크
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@
|
|||
|
||||
|
||||
/* Condition */
|
||||
.condition {padding: 10px; border: 1px solid #dde2e5; border-radius: 10px; font-size: 0; text-align: center;} /* changed by lim padding: 26px;*/
|
||||
.condition {padding: 10px; border: 1px solid #dde2e5; border-radius: 10px; text-align: center;} /* changed by lim padding: 26px;*/
|
||||
.condition > ul,
|
||||
.condition > ul li {display: inline-block; vertical-align: top;}
|
||||
.condition > ul li + li {margin-left: 20px;}
|
||||
|
|
@ -246,7 +246,7 @@ select::-ms-expand {display:none;}
|
|||
/* 건설기준코드list 설계기준 표준시방서 전문시방서 통합 다운로드 탭 */
|
||||
.right_col {display: flex; justify-content: space-between; align-items: center;}
|
||||
.mini_board ul {display: flex; list-style: none; padding: 0; margin: 0;}
|
||||
.tab {padding: 10px; margin-right: 10px; cursor: pointer; border: 1px solid #ccc; border-radius: 5px; transition: background-color 0.3s;}
|
||||
.tab {padding: 5px 10px; margin-right: 10px; cursor: pointer; border: 1px solid #ccc; border-radius: 5px; transition: background-color 0.3s;}
|
||||
.tab:hover {background-color: #f0f0f0;}
|
||||
.active {background-color: #007bff; color: #fff;}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,180 @@
|
|||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import React, {useState, useEffect, useCallback, useRef, PureComponent} from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
|
||||
import {BarChart, Bar, Rectangle, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';
|
||||
|
||||
import Switch from '@mui/material/Switch';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import URL from 'constants/url';
|
||||
|
||||
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
|
||||
|
||||
import { itemIdxByPage } from 'utils/calc';
|
||||
import EgovPaging from 'components/EgovPaging';
|
||||
|
||||
|
||||
function ApiKeys(props) {
|
||||
// console.group("EgovAdminPrivacyList");
|
||||
// console.log("[Start] EgovAdminPrivacyList ------------------------------");
|
||||
// console.log("EgovAdminPrivacyList [props] : ", props);
|
||||
const location = useLocation();
|
||||
// console.log("EgovAdminPrivacyList [location] : ", location);
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });
|
||||
const [paginationInfo, setPaginationInfo] = useState({});
|
||||
const [chartData, setChartData] = useState([]);
|
||||
const [user_id, setuser_id] = useState([]);
|
||||
|
||||
const [listTag, setListTag] = useState([]);
|
||||
// const label = { inputProps: { 'aria-label': '사용여부' } };
|
||||
|
||||
const retrieveList = useCallback((srchCnd) => {
|
||||
// console.groupCollapsed("EgovAdminUsageList.retrieveList()");
|
||||
const retrieveListURL = '/admin/standards/apikey';
|
||||
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(srchCnd)
|
||||
}
|
||||
|
||||
EgovNet.requestFetch(
|
||||
retrieveListURL,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
setPaginationInfo(resp.result.paginationInfo);
|
||||
|
||||
let mutListTag = [];
|
||||
listTag.push(<p className="no_data" key="0">데이터가 없습니다.</p>); // 게시판 목록 초기값
|
||||
|
||||
const resultCnt = parseInt(resp.result.resultCnt);
|
||||
const currentPageNo = resp.result.paginationInfo.pageIndex;
|
||||
const pageSize = resp.result.paginationInfo.rowCnt;
|
||||
|
||||
const startIndex = (currentPageNo - 1) * pageSize;
|
||||
const endIndex = Math.min(startIndex + pageSize, resultCnt);
|
||||
|
||||
// 리스트 항목 구성
|
||||
for (let index = startIndex; index < endIndex; index++) {
|
||||
const listIdx = itemIdxByPage(resultCnt, currentPageNo, 0, index); // pageSize 로 넣으면 listIdx값이 2배씩 줄어서 0으로 수정
|
||||
const item = resp.result.resultList[index];
|
||||
|
||||
mutListTag.push(
|
||||
<div key={listIdx} className="list_item">
|
||||
<div>{item.userId}</div>
|
||||
<div style={{ cursor: 'pointer' }} onClick={() => handleApiKeyChart(item)}>{item.apiKey}</div>
|
||||
<div>{item.startDt} ~ {item.endDt}</div>
|
||||
<div>{item.idntyYn === 'Y' ? <Switch defaultChecked onChange={() => handleSwitchToggle(item)} /> : <Switch onChange={() => handleSwitchToggle(item)} />}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
setListTag(mutListTag);
|
||||
},
|
||||
function (resp) {
|
||||
console.log("err response : ", resp);
|
||||
}
|
||||
);
|
||||
// console.groupEnd("EgovAdminPrivacyList.retrieveList()");
|
||||
},[listTag]);
|
||||
|
||||
const CustomTooltip = ({ active, payload, label }) => {
|
||||
if (active && payload && payload.length) {
|
||||
return (
|
||||
<div className="custom-tooltip">
|
||||
<p className="intro">API 요청 [{user_id}]</p>
|
||||
<p className="label">{`${label} : ${payload[0].value}`}회</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const handleSwitchToggle = async (item) => {
|
||||
try {
|
||||
const updateApiEndpoint = '/admin/standards/apiupdate';
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(item),
|
||||
};
|
||||
|
||||
const response = await EgovNet.requestFetch(updateApiEndpoint, requestOptions);
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
console.log('Data updated successfully:', data);
|
||||
return { success: true, data };
|
||||
} else {
|
||||
console.error('Failed to update data:', data);
|
||||
return { success: false, error: data };
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error during data update:', error);
|
||||
return { success: false, error };
|
||||
}
|
||||
};
|
||||
|
||||
const handleApiKeyChart = (item) => {
|
||||
try {
|
||||
const updateApiEndpoint = '/admin/standards/apiDailyChart';
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(item),
|
||||
};
|
||||
|
||||
EgovNet.requestFetch(
|
||||
updateApiEndpoint,
|
||||
requestOptions,
|
||||
(resp) => {
|
||||
let chartDataArray = resp.result.resultList.map((item, index) => ({
|
||||
logdt: item[0], // Assuming logCnt is the x-axis data
|
||||
"API 요청수": item[1], // Assuming menuTitle is the y-axis data
|
||||
}));
|
||||
setChartData(chartDataArray);
|
||||
// item.userId 값 넣기
|
||||
console.log(`User ID: ${item.userId}`);
|
||||
setuser_id(item.userId);
|
||||
},
|
||||
function (resp) {
|
||||
console.log("err response : ", resp);
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error during data update:', error);
|
||||
return { success: false, error };
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
retrieveList(searchCondition);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
// console.log("------------------------------EgovAdminPrivacyList [End]");
|
||||
// console.groupEnd("EgovAdminPrivacyList");
|
||||
|
||||
const Location = React.memo(function Location() {
|
||||
return (
|
||||
<div className="location">
|
||||
<ul>
|
||||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||
<li><Link to={URL.ADMIN}>건설기준 관리</Link></li>
|
||||
<li>API KEY 관리</li>
|
||||
</ul>
|
||||
</div>
|
||||
)
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="c_wrap">
|
||||
{/* <!-- Location --> */}
|
||||
<Location />
|
||||
<div className="location">
|
||||
<ul>
|
||||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||
<li><Link to={URL.ADMIN} >사이트관리</Link></li>
|
||||
<li>건설기준 관리</li>
|
||||
<li>API KEY 관리</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* <!--// Location --> */}
|
||||
|
||||
<div className="layout">
|
||||
|
|
@ -35,13 +185,51 @@ function ApiKeys(props) {
|
|||
<div className="contents " id="contents">
|
||||
{/* <!-- 본문 --> */}
|
||||
<div className="top_tit">
|
||||
<h1 className="tit_1">건설기준 관리</h1>
|
||||
<h1 className="tit_1">API KEY 관리</h1>
|
||||
</div>
|
||||
|
||||
<h2 className="tit_2">API KEY 관리</h2>
|
||||
{/* <!-- 목록 --> */}
|
||||
<div className="board_list BRD012">
|
||||
<div className="head">
|
||||
<span>사용자</span>
|
||||
<span>발급키</span>
|
||||
<span>승인기간</span>
|
||||
<span>승인여부</span>
|
||||
</div>
|
||||
<div className="result">
|
||||
{listTag}
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 목록 -->*/}
|
||||
|
||||
여기에 구현해주세요.
|
||||
{/* <!--// 본문 --> */}
|
||||
<div className="board_bot mt-1">
|
||||
{/* <!-- Paging --> */}
|
||||
<EgovPaging pagination={paginationInfo} moveToPage={passedPage => {
|
||||
retrieveList({ ...searchCondition, pageIndex: passedPage }) //, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value
|
||||
}} />
|
||||
{/* <!--/ Paging --> */}
|
||||
</div>
|
||||
<div className="pt-2">
|
||||
<ResponsiveContainer width="100%" height={477}>
|
||||
<BarChart data={chartData} layout="vertical"
|
||||
height={477}
|
||||
margin={{
|
||||
top: 0,
|
||||
right: 0,
|
||||
left: 20,
|
||||
bottom: 0,
|
||||
}}
|
||||
>
|
||||
<CartesianGrid strokeDasharray="3 3" />
|
||||
<XAxis type="number" />
|
||||
<YAxis type="category" dataKey="logdt" tick={{ fontSize: 10, whiteSpace: 'nowrap' }} />
|
||||
<Tooltip content={<CustomTooltip/>} />
|
||||
<Legend />
|
||||
<Bar dataKey="API 요청수" fill="#87CEFA" activeBar={<Rectangle fill="gold" stroke="purple" />} />
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
{/* <!--// 본문 -->*/}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -8,13 +8,52 @@ import {AiFillFileMarkdown, AiFillStar} from "react-icons/ai";
|
|||
|
||||
function StandardCodeList(props) {
|
||||
const {listCode} = useParams();
|
||||
const [show, setshow] = useState(false);
|
||||
const [groupseq, setgroupseq] = useState();
|
||||
const [show, setShow] = useState(false);
|
||||
const [groupSeq, setgroupSeq] = useState();
|
||||
|
||||
function showhandling(e) {
|
||||
console.group("StandardCodeList");
|
||||
console.log("[Start] StandardCodeList ------------------------------");
|
||||
console.log("StandardCodeList [props] : ", props);
|
||||
console.log("listcode----------------------------" + listCode);
|
||||
|
||||
const location = useLocation();
|
||||
console.log("StandardCodeList [location] : ", location);
|
||||
|
||||
const category1Ref = useRef();
|
||||
const category2Ref = useRef();
|
||||
const category3Ref = useRef();
|
||||
const wrdRef = useRef();
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {
|
||||
pageIndex: 1,
|
||||
tab: listCode?.substring(0, 2),
|
||||
category1: listCode?.substring(2, 4),
|
||||
category2: listCode?.substring(4, 6),
|
||||
searchWrd: ''
|
||||
});// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시
|
||||
const [masterBoard, setMasterBoard] = useState({});
|
||||
|
||||
/* 검색기능 추가 변수*/
|
||||
const [listData, setlistData] = useState([]);
|
||||
const [filterData, setFilterData] = useState('');
|
||||
const [category1List, setCategory1List] = useState([]);
|
||||
const [category2List, setCategory2List] = useState([]);
|
||||
const [category3List, setCategory3List] = useState([]);
|
||||
const [resultCnt, setResultCnt] = useState(0);
|
||||
|
||||
/* 탭 */
|
||||
const [activeTab, setActiveTab] = useState(10);
|
||||
const [subTabsVisible, setSubTabsVisible] = useState(false);
|
||||
|
||||
function close() {
|
||||
setShow(false);
|
||||
}
|
||||
|
||||
function showHandling(e) {
|
||||
const param = e.currentTarget.dataset;
|
||||
const groupseq = param.groupseq;
|
||||
console.log(groupseq);
|
||||
const groupSeq = param.groupSeq;
|
||||
console.log(groupSeq);
|
||||
EgovNet.requestFetch(
|
||||
'/standardCode/codeListModal.do',
|
||||
{
|
||||
|
|
@ -23,7 +62,7 @@ function StandardCodeList(props) {
|
|||
'Content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(
|
||||
groupseq
|
||||
groupSeq
|
||||
)
|
||||
}, (resp) => {
|
||||
console.log(resp + "------------------------resp")
|
||||
|
|
@ -50,51 +89,13 @@ function StandardCodeList(props) {
|
|||
)
|
||||
}
|
||||
|
||||
setgroupseq(<StandardCodeListModalTable head={head} content={body}/>);
|
||||
setgroupSeq(<StandardCodeListModalTable head={head} content={body}/>);
|
||||
}
|
||||
)
|
||||
setshow(true);
|
||||
setShow(true);
|
||||
|
||||
}
|
||||
|
||||
function close() {
|
||||
setshow(false);
|
||||
}
|
||||
|
||||
console.group("StandardCodeList");
|
||||
console.log("[Start] StandardCodeList ------------------------------");
|
||||
console.log("StandardCodeList [props] : ", props);
|
||||
console.log("listcode----------------------------" + listCode);
|
||||
|
||||
const location = useLocation();
|
||||
console.log("StandardCodeList [location] : ", location);
|
||||
|
||||
const category1Ref = useRef();
|
||||
const category2Ref = useRef();
|
||||
const category3Ref = useRef();
|
||||
const wrdRef = useRef();
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {
|
||||
pageIndex: 1,
|
||||
tab: listCode.substring(0, 2),
|
||||
category1: listCode.substring(2, 4),
|
||||
category2: listCode.substring(4, 6),
|
||||
searchWrd: ''
|
||||
});// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시
|
||||
const [masterBoard, setMasterBoard] = useState({});
|
||||
|
||||
/* 검색기능 추가 변수*/
|
||||
const [listdata, setlistdata] = useState([]);
|
||||
const [filterData, setfilterData] = useState('');
|
||||
const [category1List, setCategory1List] = useState([]);
|
||||
const [category2List, setCategory2List] = useState([]);
|
||||
const [category3List, setCategory3List] = useState([]);
|
||||
const [resultCnt, setResultCnt] = useState(0);
|
||||
|
||||
/* 탭 */
|
||||
const [activeTab, setActiveTab] = useState(10);
|
||||
const [subTabsVisible, setSubTabsVisible] = useState(false);
|
||||
|
||||
const handleTabClick = (tabName) => {
|
||||
setActiveTab(tabName);
|
||||
|
|
@ -135,7 +136,7 @@ function StandardCodeList(props) {
|
|||
(resp) => {
|
||||
setMasterBoard(resp.result.tnDocumentInfo);
|
||||
/*검색을 위한 리스트 state에 저장*/
|
||||
setlistdata(resp.result.resultList);
|
||||
setlistData(resp.result.resultList);
|
||||
setCategory1List(resp.result.category1List);
|
||||
setCategory2List(resp.result.category2List);
|
||||
setCategory3List(resp.result.category3List);
|
||||
|
|
@ -159,49 +160,31 @@ function StandardCodeList(props) {
|
|||
return (
|
||||
<div className="StandardCodeList container">
|
||||
<div className="c_wrap codelistcontent">
|
||||
{/* <!-- Location --> */}
|
||||
<div className="location">
|
||||
<ul>
|
||||
<li><Link to={URL.MAIN} className="home">Home</Link></li>
|
||||
<li><Link to='#'>건설기준코드</Link></li>
|
||||
<li>{masterBoard && masterBoard.bbsNm}</li>
|
||||
<li><Link to={URL.STANDARD_CODE_LIST}>건설기준코드 검색</Link></li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* <!--// Location --> */}
|
||||
|
||||
<div className="layout">
|
||||
{/* <!-- Navigation --> */}
|
||||
|
||||
{/* <!--// Navigation --> */}
|
||||
|
||||
<div className="contents NOTICE_LIST listtablediv">
|
||||
{/* <!-- 본문 --> */}
|
||||
|
||||
<div className="top_tit">
|
||||
<h2 className="tit_1">건설기준코드</h2>
|
||||
<h2 className="tit_1">건설기준코드 검색</h2>
|
||||
</div>
|
||||
|
||||
<h2 className="tit_2">설계기준, 표준시방서 내용을 열람할 수 있습니다.</h2>
|
||||
|
||||
{/* <!-- 검색조건 --> */}
|
||||
<div className="condition">
|
||||
<ul>
|
||||
<li className="third_2 R">
|
||||
<span className="f_search w_200">
|
||||
<input type="text" name="" defaultValue={searchCondition.searchWrd} placeholder="코드명" ref={wrdRef}
|
||||
onChange={e => {
|
||||
setfilterData(e.target.value);
|
||||
}}
|
||||
/>
|
||||
<button type="button"
|
||||
onClick={() => {
|
||||
retrieveList({...searchCondition, pageIndex: 1, category1: category1Ref.current.value, searchWrd: wrdRef.current.value, tab: activeTab});
|
||||
}}>조회</button>
|
||||
</span>
|
||||
<li className="third_1 L">
|
||||
<div className={`tab ${activeTab === 10 ? 'active' : ''}`} onClick={() => handleTabClick(10)}>설계기준</div>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<div className={`tab ${activeTab === 20 ? 'active' : ''}`} onClick={() => handleTabClick(20)}>표준시방서</div>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<div className={`tab ${[40, 50, 60, 70, 80, 90].includes(activeTab) ? 'active' : ''}`} onClick={() => handleTabClick(40)}>전문시방서</div>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<label className="f_select" htmlFor="sel1">
|
||||
<span>{searchCondition.category1}</span>
|
||||
<select id="sel1" title="조건" value={searchCondition.category1} ref={category1Ref}
|
||||
onChange={e => {
|
||||
const updatedCondition = {
|
||||
|
|
@ -272,19 +255,12 @@ function StandardCodeList(props) {
|
|||
</select>
|
||||
</label>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<div className={`tab`}>통합 다운로드</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* <!--// 검색조건 --> */}
|
||||
<div className="right_col">
|
||||
<div className="mini_board">
|
||||
<ul>
|
||||
<div className={`tab ${activeTab === 10 ? 'active' : ''}`} onClick={() => handleTabClick(10)}>설계기준</div>
|
||||
<div className={`tab ${activeTab === 20 ? 'active' : ''}`} onClick={() => handleTabClick(20)}>표준시방서</div>
|
||||
<div className={`tab ${[40, 50, 60, 70, 80, 90].includes(activeTab) ? 'active' : ''}`} onClick={() => handleTabClick(40)}>전문시방서</div>
|
||||
<div className={`tab`}>통합 다운로드</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{subTabsVisible && (
|
||||
<div className="right_col">
|
||||
<div className="mini_board">
|
||||
|
|
@ -315,7 +291,7 @@ function StandardCodeList(props) {
|
|||
<div className="result">
|
||||
|
||||
{/*검색기능 filterData가 없는경우 모든 데이터 출력*/}
|
||||
{listdata.filter(item => {
|
||||
{listData.filter(item => {
|
||||
if (item.groupNm.includes(filterData)) {
|
||||
return item
|
||||
}
|
||||
|
|
@ -327,7 +303,7 @@ function StandardCodeList(props) {
|
|||
<div className="middleCategory">{item.middleCategory}</div>
|
||||
<div className="kcscCd">{item.kcscCd}</div>
|
||||
<div className="groupNm">{item.groupNm}</div>
|
||||
<div className="Revisionhistory"><a className="vieweratag" onClick={showhandling} data-groupseq={item.groupSeq}>개정이력</a></div>
|
||||
<div className="Revisionhistory"><a className="vieweratag" onClick={showHandling} data-groupSeq={item.groupSeq}>개정이력</a></div>
|
||||
<div className="fille">{item.contentcount > 0 ? <a className="vieweratag" href={"/standardCode/viewer/" + item.kcscCd}>내용보기</a> : null}</div>
|
||||
<div className="viewer">{item.docFileGrpId == null ? null :
|
||||
<a href={"https://www.kcsc.re.kr/file/DownloadGrp/" + item.docFileGrpId}><AiFillFileMarkdown/></a>}</div>
|
||||
|
|
@ -343,7 +319,7 @@ function StandardCodeList(props) {
|
|||
{/* <!-- Paging --> */}
|
||||
|
||||
{/* <!--/ Paging --> */}
|
||||
<StandardCodeListModal size={"lg"} show={show} content={groupseq} onClose={close} title={"개정이력"}/>
|
||||
<StandardCodeListModal size={"lg"} show={show} content={groupSeq} onClose={close} title={"개정이력"}/>
|
||||
|
||||
|
||||
{/* <!--// 본문 --> */}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import {React, useCallback, useEffect, useState} from "react";
|
||||
import Modal from "react-bootstrap/Modal";
|
||||
import * as EgovNet from "../../api/egovFetch";
|
||||
import * as EgovNet from "../../../api/egovFetch";
|
||||
import {VwDiv} from "./Vw.style";
|
||||
import Col from "react-bootstrap/Col";
|
||||
import Row from "react-bootstrap/Row";
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import SbItem from './SbItem'
|
||||
import Loading from '../../components/Loading'
|
||||
import Loading from '../../../components/Loading'
|
||||
import BookmarkModal from './BookmarkModal';
|
||||
import {SbContainer} from './Sb.style'
|
||||
import {VwDiv, VwPtag} from './Vw.style'
|
||||
|
|
@ -10,9 +10,9 @@ import Row from 'react-bootstrap/Row';
|
|||
import Col from 'react-bootstrap/Col';
|
||||
import Modal from 'react-bootstrap/Modal';
|
||||
import * as EgovNet from 'api/egovFetch';
|
||||
import {getLocalItem} from "../../utils/storage";
|
||||
import CODE from "../../constants/code";
|
||||
import {parseJwt} from "../../utils/parseJwt";
|
||||
import {getLocalItem} from "../../../utils/storage";
|
||||
import CODE from "../../../constants/code";
|
||||
import {parseJwt} from "../../../utils/parseJwt";
|
||||
|
||||
function CodeViewer(props) {
|
||||
const [treeLoading, setTreeLoading] = useState(true);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import * as EgovNet from "../../api/egovFetch";
|
||||
import * as EgovNet from "../../../api/egovFetch";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import SbItem from "./SbItem";
|
||||
import {Col, Row} from "react-bootstrap";
|
||||
|
|
@ -110,11 +110,11 @@ import AdminLogsFileDownloadStatus from 'pages/admin/logs/FileDownloadStatus';
|
|||
|
||||
|
||||
//건설기준코드
|
||||
import CodeViewer from 'pages/standardCode/viewer';
|
||||
import CodeViewer from 'pages/standardCode/viewer/viewer';
|
||||
|
||||
import * as EgovNet from 'api/egovFetch'; // jwt토큰 위조 검사 때문에 추가
|
||||
import initPage from 'js/ui';
|
||||
import StandardCodeList from "../pages/standardCode/StandardCodeList";
|
||||
import StandardCodeList from "../pages/standardCode/list/StandardCodeList";
|
||||
|
||||
const RootRoutes = () => {
|
||||
//useLocation객체를 이용하여 정규표현식을 사용한 /admin/~ 으로 시작하는 경로와 비교에 사용(아래 1줄) */}
|
||||
|
|
@ -329,6 +329,7 @@ const SecondRoutes = () => {
|
|||
|
||||
{/*기준코드리스트*/}
|
||||
<Route path={URL.STANDARD_CODE_LIST} element={<StandardCodeList />} />
|
||||
<Route path={URL.STANDARD_CODE_LIST_LINK} element={<StandardCodeList />} />
|
||||
|
||||
</Routes>
|
||||
<EgovFooter />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
package com.dbnt.kcscbackend.admin.standards;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.standards.entity.TnApiKey;
|
||||
import com.dbnt.kcscbackend.admin.standards.service.AdminApiService;
|
||||
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
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.http.MediaType;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
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 java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/standards")
|
||||
@Tag(name="AdminStandardsController", description = "사이트관리 건설기준관리 메뉴 컨트롤러")
|
||||
public class AdminStandardsController extends BaseController {
|
||||
|
||||
private final AdminApiService adminApiService;
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준관리 - API 관리",
|
||||
description = "API 관리",
|
||||
tags = {"AdminStandardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/apikey", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO selectApiList(@RequestBody TnApiKey tnApiKey, @AuthenticationPrincipal LoginVO user)
|
||||
throws Exception {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
tnApiKey.setQueryInfo();
|
||||
Map<String, Object> resultMap = adminApiService.selectApiList();
|
||||
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
|
||||
tnApiKey.setContentCnt(totCnt);
|
||||
tnApiKey.setPaginationInfo();
|
||||
resultMap.put("paginationInfo", tnApiKey);
|
||||
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "API key 관리",
|
||||
description = "API key 승인여부 수정",
|
||||
tags = {"AdminStandardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "수정 성공"),
|
||||
@ApiResponse(responseCode = "303", description = "만료된 토큰"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/apiupdate", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO modifyApi(@RequestBody TnApiKey tnApiKey, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
TnApiKey existingApiKey = adminApiService.getApiKeyById(tnApiKey.getUserId());
|
||||
if (existingApiKey != null) {
|
||||
existingApiKey.setIdntyYn(existingApiKey.getIdntyYn().equals("Y") ? "N" : "Y");
|
||||
adminApiService.modifyApi(existingApiKey);
|
||||
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
} else {
|
||||
resultVO.setResultCode(ResponseCode.SAVE_ERROR.getCode()); // 존재하지 않는 user_id에 대한 처리
|
||||
}
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "API key Chart",
|
||||
description = "API key 클릭시 차트",
|
||||
tags = {"AdminStandardsController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "수정 성공"),
|
||||
@ApiResponse(responseCode = "303", description = "만료된 토큰"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/apiDailyChart", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO ApiChart(@RequestBody Map<String, String> dateRange, @AuthenticationPrincipal LoginVO user) throws Exception{
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
String UserId = dateRange.get("userId");
|
||||
|
||||
resultMap.put("resultList", adminApiService.selectApiDailyCount(UserId));
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.dbnt.kcscbackend.admin.standards.entity;
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.BoardParams;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_api_key")
|
||||
public class TnApiKey extends BoardParams {
|
||||
@Id
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "api_key")
|
||||
private String apiKey;
|
||||
|
||||
@Column(name = "idnty_yn")
|
||||
private String idntyYn;
|
||||
|
||||
@Column(name = "start_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate startDt;
|
||||
|
||||
@Column(name = "end_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate endDt;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.dbnt.kcscbackend.admin.standards.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.standards.entity.TnApiKey;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApiKeyRepository extends JpaRepository<TnApiKey, String> {
|
||||
List<TnApiKey> findAllByOrderByEndDtDesc();
|
||||
|
||||
@Query(value = "SELECT TO_CHAR(access_dt, 'YYYY-MM-DD') as log_dt, count(1) as log_cnt "
|
||||
+ "FROM th_api_log "
|
||||
+ "WHERE access_id = :UserId "
|
||||
+ "GROUP BY TO_CHAR(access_dt, 'YYYY-MM-DD') "
|
||||
+ "ORDER BY log_dt asc", nativeQuery = true)
|
||||
List<Object[]> selectCountApiDaily(@Param("UserId") String UserId);
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.dbnt.kcscbackend.admin.standards.service;
|
||||
|
||||
import com.dbnt.kcscbackend.admin.standards.entity.TnApiKey;
|
||||
import com.dbnt.kcscbackend.admin.standards.repository.ApiKeyRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdminApiService extends EgovAbstractServiceImpl {
|
||||
private final ApiKeyRepository apiKeyRepository;
|
||||
|
||||
public Map<String, Object> selectApiList() {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
long totalRecordCount = apiKeyRepository.count(); // 전체 레코드 수 가져오기
|
||||
List<TnApiKey> apiList = apiKeyRepository.findAllByOrderByEndDtDesc(); // 개인 정보 로그 리스트 가져오기
|
||||
|
||||
resultMap.put("resultCnt", String.valueOf(totalRecordCount)); // 개수를 resultMap에 추가
|
||||
resultMap.put("resultList", apiList); // 결과를 resultMap에 추가
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public TnApiKey getApiKeyById(String userId) { return apiKeyRepository.findById(userId).orElse(null); }
|
||||
|
||||
@Transactional
|
||||
public String modifyApi(TnApiKey tnApiKey) {
|
||||
try {
|
||||
apiKeyRepository.save(tnApiKey);
|
||||
return "API key updated successfully";
|
||||
} catch (Exception e) {
|
||||
return "Failed to update API key";
|
||||
}
|
||||
}
|
||||
|
||||
public List<Object[]> selectApiDailyCount(String UserId) {
|
||||
return apiKeyRepository.selectCountApiDaily(UserId);
|
||||
} // 일자별 API 요청횟수
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue