From 56c5db686fc7e87bc19891960fa86c578cc142f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=AF=BC=ED=98=95?= Date: Wed, 28 Feb 2024 09:08:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=EA=B4=80=EB=A0=A8=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EA=B4=80=EB=A6=AC=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/admin/board/AdminPostMgtList.jsx | 8 +- .../src/pages/admin/boards/Keywords.jsx | 154 ++++++++++++++- .../src/pages/admin/boards/List.jsx | 4 +- .../src/pages/admin/config/AboutSiteMgt.jsx | 144 +++++++++++++- .../config/aboutSiteMgt/AboutSiteModal.jsx | 178 ++++++++++++++++++ .../src/routes/index.jsx | 3 +- .../admin/boards/AdminBoardsController.java | 1 + .../admin/config/AdminConfigController.java | 20 ++ .../admin/config/entity/TnPartnerSite.java | 41 ++++ .../repository/TnPartnerSiteRepository.java | 13 ++ .../config/service/AdminConfigService.java | 9 + 11 files changed, 562 insertions(+), 13 deletions(-) create mode 100644 egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnPartnerSiteRepository.java diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx index cb7bf47..36b6e2b 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx @@ -9,7 +9,7 @@ import EgovPaging from 'components/EgovPaging'; import { itemIdxByPage } from 'utils/calc'; -function EgovAdminBoardList(props) { +function AdminPostMgtList(props) { console.group("EgovAdminBoardList"); console.log("[Start] EgovAdminBoardList ------------------------------"); console.log("EgovAdminBoardList [props] : ", props); @@ -100,7 +100,7 @@ function EgovAdminBoardList(props) { {/* */} @@ -117,7 +117,7 @@ function EgovAdminBoardList(props) {

사이트관리

-

게시판생성 관리

+

게시물 관리

{/* */}
@@ -196,4 +196,4 @@ function EgovAdminBoardList(props) { ); } -export default EgovAdminBoardList; \ No newline at end of file +export default AdminPostMgtList; \ No newline at end of file diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/boards/Keywords.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/boards/Keywords.jsx index 4968282..c485536 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/boards/Keywords.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/boards/Keywords.jsx @@ -1,13 +1,90 @@ -import React, { useState, useEffect, useCallback } from 'react'; -import { Link, useLocation } from 'react-router-dom'; +import React, {useState, useEffect, useCallback} from 'react'; +import {Link, useLocation} from 'react-router-dom'; import * as EgovNet from 'api/egovFetch'; import URL from 'constants/url'; -import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; +import {default as EgovLeftNav} from 'components/leftmenu/EgovLeftNavAdmin'; +import Modal from "react-bootstrap/Modal"; +import CODE from "../../../constants/code"; +import EgovAdminBoardEdit from "../board/EgovAdminBoardEdit"; +import {format} from "date-fns"; function StandardCodeMgt(props) { + const location = useLocation(); + + const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시 + const [paginationInfo, setPaginationInfo] = useState({}); + const [listTag, setListTag] = useState([]); + + const [show, setShow] = useState(false); + const [modalBody, setModalBody] = useState(); + const handleClose = () => setShow(false); + const handleShow = () => setShow(true); + + const retrieveList = useCallback(() => { + handleClose(); + console.groupCollapsed("AdminBoardList.retrieveList()"); + + const retrieveListURL = '/admin/boards/board-list'; + + const requestOptions = { + method: "GET", + headers: { + 'Content-type': 'application/json', + + }, + body: JSON.stringify() + } + + EgovNet.requestFetch(retrieveListURL, + requestOptions, + (resp) => { + + let mutListTag = []; + listTag.push(

검색된 결과가 없습니다.

); // 게시판 목록 초기값 + + // 리스트 항목 구성 + resp.result.boardList.forEach(function (item, index) { + if (index === 0) mutListTag = []; // 목록 초기화 + + mutListTag.push( +
+
{item.bbsSeq}
+
{item.bbsId}
+
{item.bbsTitle}
+
{item.frstCrtId}
+
{item.frstCrtDt ? format(item.frstCrtDt, "yyyy-MM-dd HH:mm") : ""}
+
{item.lastChgDt ? format(item.lastChgDt, "yyyy-MM-dd HH:mm") : ""}
+
+
+ ); + }); + + setListTag(mutListTag); + console.log("@@@ resp : "); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + console.groupEnd("EgovAdminBoardList.retrieveList()"); + },[]); + + useEffect(() => { + retrieveList(searchCondition); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + function editBoard(item){ + handleShow(); + if(item != undefined) { + item.mode = CODE.MODE_MODIFY; + } + setModalBody() + } + return (
@@ -15,7 +92,7 @@ function StandardCodeMgt(props) {
  • Home
  • -
  • 사이트관리
  • +
  • 사이트관리
  • 게시판현황
  • 키워드 관리
@@ -29,11 +106,78 @@ function StandardCodeMgt(props) {
-

키워드 관리

+

사이트관리

+

키워드 관리

+ {/* */} + {/*
+
    +
  • + 검색유형선택 + +
  • +
  • + 검색어 + + { + wrdRef.current.value = e.target.value; + }} + /> + + +
  • +
  • + 등록 +
  • +
+
*/} + {/* */} + + {/* */} +
+
+ 번호 + 아이디 + 제목 + 작성자 + 작성일 + 수정일 + +
+
+ {listTag} +
+
+ {/* */} + +
+ {/* */} + {/* { + retrieveList({ ...searchCondition, pageIndex: passedPage, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value }) + }} />*/} + {/* */} +
+ + {/* */}
+ + {modalBody} +
); } diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/boards/List.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/boards/List.jsx index 62486d4..fe4318e 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/boards/List.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/boards/List.jsx @@ -100,7 +100,7 @@ function EgovAdminBoardList(props) {
  • Home
  • 사이트관리
  • -
  • 게시판생성 관리
  • +
  • 게시판 관리
{/* */} @@ -117,7 +117,7 @@ function EgovAdminBoardList(props) {

사이트관리

-

게시판생성 관리

+

게시판 관리

{/* */} {/*
diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/AboutSiteMgt.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/AboutSiteMgt.jsx index 82c04d1..0003462 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/AboutSiteMgt.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/AboutSiteMgt.jsx @@ -5,9 +5,85 @@ import * as EgovNet from 'api/egovFetch'; import URL from 'constants/url'; import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; +import CODE from "../../../constants/code"; +import Modal from "react-bootstrap/Modal"; +import AboutSiteModal from "./aboutSiteMgt/AboutSiteModal"; function StandardCodeMgt(props) { + const location = useLocation(); + + const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시 + const [paginationInfo, setPaginationInfo] = useState({}); + const [listTag, setListTag] = useState([]); + + const [show, setShow] = useState(false); + const [modalBody, setModalBody] = useState(); + const handleClose = () => setShow(false); + const handleShow = () => setShow(true); + + const retrieveList = useCallback(() => { + handleClose(); + console.groupCollapsed("AdminPartnerSiteList.retrieveList()"); + + const retrieveListURL = '/admin/config/partner-site-list'; + + const requestOptions = { + method: "GET", + headers: { + 'Content-type': 'application/json', + + }, + body: JSON.stringify() + } + + EgovNet.requestFetch(retrieveListURL, + requestOptions, + (resp) => { + + let mutListTag = []; + listTag.push(

검색된 결과가 없습니다.

); // 게시판 목록 초기값 + + // 리스트 항목 구성 + resp.result.partnerSiteList.forEach(function (item, index) { + if (index === 0) mutListTag = []; // 목록 초기화 + + mutListTag.push( +
+
{item.siteSeq}
+
{item.siteTitle}
+
{item.siteUrl}
+
{item.fileGrpId}
+
{item.siteOrder}
+
{item.useYn}
+
+
+ ); + }); + + setListTag(mutListTag); + console.log("@@@ resp : "); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + console.groupEnd("EgovAdminBoardList.retrieveList()"); + },[]); + + useEffect(() => { + retrieveList(searchCondition); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + function editBoard(item){ + handleShow(); + if(item != undefined) { + item.mode = CODE.MODE_MODIFY; + } + setModalBody() + } + return (
@@ -15,7 +91,7 @@ function StandardCodeMgt(props) {
  • Home
  • -
  • 사이트관리
  • +
  • 사이트관리
  • 환경설정
  • 관련사이트 관리
@@ -31,9 +107,75 @@ function StandardCodeMgt(props) {

관련사이트 관리

+ {/* */} + {/*
+
    +
  • + 검색유형선택 + +
  • +
  • + 검색어 + + { + wrdRef.current.value = e.target.value; + }} + /> + + +
  • +
  • + 등록 +
  • +
+
*/} + {/* */} + + {/* */} +
+
+ 번호 + 사이트명 + URL + 배너이미지 + 정렬순서 + 사용여부 + +
+
+ {listTag} +
+
+ {/* */} + +
+ {/* */} + {/* { + retrieveList({ ...searchCondition, pageIndex: passedPage, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value }) + }} />*/} + {/* */} +
+ + {/* */}
+ + {modalBody} +
); } diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx new file mode 100644 index 0000000..0f9e22e --- /dev/null +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx @@ -0,0 +1,178 @@ +import React, {useState, useEffect, useRef} from 'react'; +import {Link, useNavigate, useLocation, useParams} from 'react-router-dom'; +import Modal from "react-bootstrap/Modal"; + +import * as EgovNet from 'api/egovFetch'; +import URL from 'constants/url'; +import CODE from 'constants/code'; + +import {default as EgovLeftNav} from 'components/leftmenu/EgovLeftNavAdmin'; +import EgovRadioButtonGroup from 'components/EgovRadioButtonGroup'; +import {Form} from "react-bootstrap"; + + +function AboutSiteModal({props, reloadFunction}) { + console.group("AboutSiteModal"); + console.log("[Start] AboutSiteModal ------------------------------"); + console.log("AboutSiteModal [props] : ", props); + + const navigate = useNavigate(); + const location = useLocation(); + const checkRef = useRef([]); + + console.log("AboutSiteModal [location] : ", location); + + let item = null; + item = props; + console.log("@@@ item : " + JSON.stringify(item)); + + const [modeInfo, setModeInfo] = useState(item != null ? {mode: props.mode} : {mode: CODE.MODE_CREATE}); + const [boardDetail, setBoardDetail] = useState({}); + console.log("@@@ mode : " + modeInfo.mode); + + useEffect(() => { + initMode(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + const initMode = () => { + if (modeInfo.mode === CODE.MODE_MODIFY) { + setBoardDetail(item); + } + } + + function editBoard(e) { + e.preventDefault(); + e.stopPropagation(); + const form = e.target; + const info = { + bbsId: form.bbsId.value, + bbsTitle: form.bbsTitle.value, + bbsDesc: form.bbsDesc.value + } + if (modeInfo.mode === CODE.MODE_MODIFY) { + info.bbsSeq = props.bbsSeq; + } + EgovNet.requestFetch( + '/admin/boards/board-mgt', + { + method: "PUT", + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify(info) + }, + (resp) => { + if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { + alert("저장되었습니다."); + reloadFunction(); + } else if (Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)) { + console.log("토큰 갱신중.") + } else { + alert(resp.result.resultMessage) + } + } + ) + } + + function deleteBoard(bbs){ + if(window.confirm("삭제하시겠습니까?")) { + EgovNet.requestFetch( + '/admin/boards/board-mgt', + { + method: "DELETE", + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify(bbs) + }, + (resp) => { + if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { + alert("삭제되었습니다.") + reloadFunction(); + } else if (Number(resp.resultCode) === Number(CODE.RCV_ERROR_AUTH)) { + console.log("토큰 갱신중.") + } else { + alert(resp.result.resultMessage) + } + } + ) + } + } + + console.log("------------------------------AboutSiteModal [End]"); + console.groupEnd("AboutSiteModal"); + + return ( + <> + {/* */} + + + {modeInfo.mode === CODE.MODE_CREATE && '관련사이트 생성'} + {modeInfo.mode === CODE.MODE_MODIFY && '관련사이트 수정'} + + + + +
+
{editBoard(e)}} noValidate> +
+
필수
+
+ +
+
+
+
필수
+
+ +
+
+
+
필수
+
+ +
+
+
+
필수
+
+ +
+
+
+
필수
+
+ +
+
+ + {/* */} +
+
+ + {modeInfo.mode === CODE.MODE_MODIFY && + + } +
+ +
+ +
+
+ {/* */} +
+
+
+ + + ); +} + +export default AboutSiteModal; \ No newline at end of file diff --git a/egovframe-template-simple-react-contribution/src/routes/index.jsx b/egovframe-template-simple-react-contribution/src/routes/index.jsx index 2f69395..d3dc967 100644 --- a/egovframe-template-simple-react-contribution/src/routes/index.jsx +++ b/egovframe-template-simple-react-contribution/src/routes/index.jsx @@ -117,6 +117,7 @@ import StandardCodeInfo from "../pages/standardCode/info/StandardCodeInfo"; import * as EgovNet from 'api/egovFetch'; // jwt토큰 위조 검사 때문에 추가 import initPage from 'js/ui'; +import AdminPostMgtList from "../pages/admin/board/AdminPostMgtList"; const RootRoutes = () => { //useLocation객체를 이용하여 정규표현식을 사용한 /admin/~ 으로 시작하는 경로와 비교에 사용(아래 1줄) */} @@ -291,7 +292,7 @@ const SecondRoutes = () => { {/* 관리자 - 게시판 현황 */} } /> - } /> + } /> } /> {/* 관리자 - 건설기준 관리 */} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/boards/AdminBoardsController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/boards/AdminBoardsController.java index d3769ed..9215a7b 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/boards/AdminBoardsController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/boards/AdminBoardsController.java @@ -130,4 +130,5 @@ public class AdminBoardsController extends BaseController { resultVO.setResult(resultMap); return resultVO; } + } 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 9f36621..4b5b478 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 @@ -402,4 +402,24 @@ public class AdminConfigController extends BaseController { return resultVO; } + /* ---- 관련사이트 관리 ----- */ + @Operation( + summary = "관련사이트 목록 조회", + description = "관련사이트 목록 조회", + tags = {"AdminConfigController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "조회 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.GET, value = "/partner-site-list", consumes = MediaType.APPLICATION_JSON_VALUE) + public ResultVO getPartnerSiteList() throws Exception { + ResultVO resultVO = new ResultVO(); + Map resultMap = new HashMap<>(); + + resultMap.put("partnerSiteList", adminConfigService.selectPartnerSiteList()); + resultVO.setResult(resultMap); + return resultVO; + } + } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java new file mode 100644 index 0000000..84e2347 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java @@ -0,0 +1,41 @@ +package com.dbnt.kcscbackend.admin.config.entity; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; +import org.springframework.format.annotation.DateTimeFormat; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +@Getter +@Setter +@Entity +@NoArgsConstructor +@DynamicInsert +@DynamicUpdate +@Table(name = "tn_partner_site") +public class TnPartnerSite { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "site_seq") + private int siteSeq; + + @Column(name = "site_title", nullable = false, length = 500) + private String siteTitle; + + @Column(name = "site_url", nullable = false, length = 500) + private String siteUrl; + + @Column(name = "file_grp_id", length = 255) + private String fileGrpId; + + @Column(name = "site_order", nullable = false) + private int siteOrder; + + @Column(name = "use_yn", nullable = false, length = 1) + private char useYn; +} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnPartnerSiteRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnPartnerSiteRepository.java new file mode 100644 index 0000000..955bf17 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnPartnerSiteRepository.java @@ -0,0 +1,13 @@ +package com.dbnt.kcscbackend.admin.config.repository; + +import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface TnPartnerSiteRepository extends JpaRepository { + + List findAllByOrderBySiteOrder(); + +} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java index 0c5fd44..8ee4045 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java @@ -1,10 +1,13 @@ package com.dbnt.kcscbackend.admin.config.service; +import com.dbnt.kcscbackend.admin.boards.entity.TnBbs; import com.dbnt.kcscbackend.admin.config.entity.TbMenuRole; import com.dbnt.kcscbackend.admin.config.entity.TcMenu; +import com.dbnt.kcscbackend.admin.config.entity.TnPartnerSite; import com.dbnt.kcscbackend.admin.config.mapper.TcMenuMapper; import com.dbnt.kcscbackend.admin.config.repository.TbMenuRoleRepository; import com.dbnt.kcscbackend.admin.config.repository.TcMenuRepository; +import com.dbnt.kcscbackend.admin.config.repository.TnPartnerSiteRepository; import com.dbnt.kcscbackend.commonCode.entity.TcCodeGrp; import com.dbnt.kcscbackend.commonCode.entity.TcCodeItem; import com.dbnt.kcscbackend.commonCode.repository.TcCodeGrpRepository; @@ -27,6 +30,7 @@ public class AdminConfigService extends EgovAbstractServiceImpl { private final TcMenuRepository menuRepository; private final TbMenuRoleRepository menuRoleRepository; private final TcMenuMapper menuMapper; + private final TnPartnerSiteRepository tnPartnerSiteRepository; public List selectCodeGrpList(){ return codeGrpRepository.findByUseYn("Y"); @@ -165,4 +169,9 @@ public class AdminConfigService extends EgovAbstractServiceImpl { } menuRoleRepository.saveAll(roleList); } + + public List selectPartnerSiteList() { + return tnPartnerSiteRepository.findAllByOrderBySiteOrder(); + } + } From f86690f8be70b712123d28231bf2b43ae172befb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=AF=BC=ED=98=95?= Date: Wed, 28 Feb 2024 16:03:40 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EA=B4=80=EB=A0=A8=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EB=93=B1=EB=A1=9D=EC=88=98=EC=A0=95=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/aboutSiteMgt/AboutSiteModal.jsx | 48 ++++++++------- .../admin/config/AdminConfigController.java | 60 +++++++++++++++++++ .../admin/config/entity/TnPartnerSite.java | 9 +-- .../config/service/AdminConfigService.java | 25 ++++++++ 4 files changed, 114 insertions(+), 28 deletions(-) diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx index 0f9e22e..371d331 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/config/aboutSiteMgt/AboutSiteModal.jsx @@ -41,20 +41,22 @@ function AboutSiteModal({props, reloadFunction}) { } } - function editBoard(e) { + function editPartnerSite(e) { e.preventDefault(); e.stopPropagation(); const form = e.target; const info = { - bbsId: form.bbsId.value, - bbsTitle: form.bbsTitle.value, - bbsDesc: form.bbsDesc.value + siteTitle: form.siteTitle.value, + siteUrl: form.siteUrl.value, + fileGrpId: form.fileGrpId.value, + siteOrder: form.siteOrder.value, + useYn: form.useYn.value } if (modeInfo.mode === CODE.MODE_MODIFY) { - info.bbsSeq = props.bbsSeq; + info.siteSeq = props.siteSeq; } EgovNet.requestFetch( - '/admin/boards/board-mgt', + '/admin/config/partner-site-mgt', { method: "PUT", headers: { @@ -75,16 +77,16 @@ function AboutSiteModal({props, reloadFunction}) { ) } - function deleteBoard(bbs){ + function deletePartnerSite(partnerSite){ if(window.confirm("삭제하시겠습니까?")) { EgovNet.requestFetch( - '/admin/boards/board-mgt', + '/admin/config/partner-site-mgt', { method: "DELETE", headers: { 'Content-type': 'application/json' }, - body: JSON.stringify(bbs) + body: JSON.stringify(partnerSite) }, (resp) => { if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { @@ -103,6 +105,8 @@ function AboutSiteModal({props, reloadFunction}) { console.log("------------------------------AboutSiteModal [End]"); console.groupEnd("AboutSiteModal"); + const defaultUseYn = props?.useYn ? props.useYn : "Y"; + return ( <> {/* */} @@ -115,40 +119,40 @@ function AboutSiteModal({props, reloadFunction}) {
-
{editBoard(e)}} noValidate> + {editPartnerSite(e)}} noValidate>
-
필수
+
필수
-
-
필수
+
필수
-
-
필수
+
필수
-
-
필수
+
필수
-
-
필수
+
필수
- + +
@@ -158,7 +162,7 @@ function AboutSiteModal({props, reloadFunction}) { {modeInfo.mode === CODE.MODE_MODIFY && - + }
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 fad1f72..72e4ef2 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.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.service.AdminCommitteeCodeManagementService; import com.dbnt.kcscbackend.admin.standardResearch.service.AdminStandardResearchService; @@ -465,4 +467,62 @@ public class AdminConfigController extends BaseController { return resultVO; } + @Operation( + summary = "관련사이트 저장", + description = "관련사이트 저장", + tags = {"AdminConfigController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "저장 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.PUT, value = "/partner-site-mgt") + public ResultVO savePartnerSite(@RequestBody @Valid TnPartnerSite tnPartnerSite, Errors errors, @AuthenticationPrincipal LoginVO user) { + ResultVO resultVO = new ResultVO(); + if (user == null) { + resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode()); + } else { + if (errors.hasErrors()) { + StringBuilder msg = new StringBuilder(); + for (FieldError error : errors.getFieldErrors()) { + msg.append(error.getDefaultMessage()); + msg.append("\n"); + } + resultVO.setResultCode(ResponseCode.INPUT_CHECK_ERROR.getCode()); + resultVO.setResultMessage(msg.toString()); + } else { + System.out.println("@@@ bbs.getBbsSeq() : " + tnPartnerSite.getSiteSeq()); + adminConfigService.savePartnerSite(tnPartnerSite, user.getId()); + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + } + } + return resultVO; + } + + @Operation( + summary = "관련사이트 삭제", + description = "관련사이트 삭제", + tags = {"AdminConfigController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "삭제 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.DELETE, value = "/partner-site-mgt") + public ResultVO removePartnerSite(@RequestBody TnPartnerSite tnPartnerSite, @AuthenticationPrincipal LoginVO user) { + ResultVO resultVO = new ResultVO(); + if (user == null) { + resultVO.setResultCode(ResponseCode.TOKEN_EXPIRED.getCode()); + } else { + String result = adminConfigService.deletePartnerSite(tnPartnerSite, user.getId()); + if (result == null) { + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + } else if (result.equals("notFind")) { + resultVO.setResultCode(ResponseCode.SAVE_ERROR.getCode()); + resultVO.setResultMessage("대상이 존재하지 않습니다."); + } + } + return resultVO; + } + } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java index 84e2347..3f5b1a8 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/entity/TnPartnerSite.java @@ -5,11 +5,8 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; -import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.*; -import javax.validation.constraints.NotBlank; -import java.time.LocalDateTime; @Getter @Setter @@ -22,7 +19,7 @@ public class TnPartnerSite { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "site_seq") - private int siteSeq; + private Long siteSeq; @Column(name = "site_title", nullable = false, length = 500) private String siteTitle; @@ -34,8 +31,8 @@ public class TnPartnerSite { private String fileGrpId; @Column(name = "site_order", nullable = false) - private int siteOrder; + private Long siteOrder; @Column(name = "use_yn", nullable = false, length = 1) - private char useYn; + private String useYn; } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java index d48118c..ba9a1a8 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/service/AdminConfigService.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Optional; @Service @RequiredArgsConstructor @@ -174,4 +175,28 @@ public class AdminConfigService extends EgovAbstractServiceImpl { return tnPartnerSiteRepository.findAllByOrderBySiteOrder(); } + @Transactional + public void savePartnerSite(TnPartnerSite tnPartnerSite, String userId) { + if (tnPartnerSite.getSiteSeq() == null) { + tnPartnerSiteRepository.save(tnPartnerSite); + } else { + TnPartnerSite savedPartnerSite = tnPartnerSiteRepository.findById(tnPartnerSite.getSiteSeq()).orElse(null); + savedPartnerSite.setSiteTitle(tnPartnerSite.getSiteTitle()); + savedPartnerSite.setSiteUrl(tnPartnerSite.getSiteUrl()); + savedPartnerSite.setFileGrpId(tnPartnerSite.getFileGrpId()); + savedPartnerSite.setSiteOrder(tnPartnerSite.getSiteOrder()); + savedPartnerSite.setUseYn(tnPartnerSite.getUseYn()); + tnPartnerSiteRepository.save(savedPartnerSite); + } + } + + @Transactional + public String deletePartnerSite(TnPartnerSite tnPartnerSite, String userId) { + Optional optionalTnPartnerSite = tnPartnerSiteRepository.findById(tnPartnerSite.getSiteSeq()); + optionalTnPartnerSite.ifPresent(partnerSite -> { + tnPartnerSiteRepository.delete(partnerSite); + }); + return optionalTnPartnerSite.isPresent() ? null : "notFind"; + } + } \ No newline at end of file From 67ca3cef15cb176ddeb2d12f65a5f0b2e1d11505 Mon Sep 17 00:00:00 2001 From: "Lim\\jun" Date: Wed, 28 Feb 2024 17:51:58 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Dashboard=20=EC=97=85=EB=8E=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/schedule/EgovAdminScheduleList.jsx | 77 +++++----- .../pages/admin/schedule/ReportAreaChart.jsx | 40 +++++- .../dashboard/AdminDashboardController.java | 51 +++++++ .../repository/DashboardRepository.java | 131 ++++++++++++++++++ .../repository/MenuMonthlyRepository.java | 83 ----------- .../service/AdminDashboardService.java | 21 +-- 6 files changed, 276 insertions(+), 127 deletions(-) create mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java delete mode 100644 kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/MenuMonthlyRepository.java diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx index 643ae36..7c68238 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx @@ -31,8 +31,6 @@ function EgovAdminDashboard(props) { // // const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {schdulSe: '', year: TODAY.getFullYear(), month: TODAY.getMonth(), date: TODAY.getDate()}); // const [calendarTag, setCalendarTag] = useState([]); - // - // const [scheduleList, setScheduleList] = useState([]); // const innerConsole = (...args) => { // console.log(...args); @@ -51,29 +49,45 @@ function EgovAdminDashboard(props) { // setSearchCondition({...searchCondition, year: changedDate.getFullYear(), month: changedDate.getMonth(), date: changedDate.getDate()}); // } - // const retrieveList = useCallback((srchcnd) => { - // console.groupCollapsed("EgovAdminScheduleList.retrieveList()"); - // - // const retrieveListURL = '/schedule/month' + EgovNet.getQueryString(srchcnd); - // - // const requestOptions = { - // method: "GET", - // headers: { - // 'Content-type': 'application/json', - // } - // } - // - // EgovNet.requestFetch(retrieveListURL, - // requestOptions, - // (resp) => { - // setScheduleList(resp.result.resultList); - // }, - // function (resp) { - // console.log("err response : ", resp); - // } - // ); - // console.groupEnd("EgovAdminScheduleList.retrieveList()"); - // }, []); + // const [countTag, setCountTag] = useState([]); + const [dashboardCnt, setDashboardCnt] = useState({ ConnMonthlyCount: [[0, 0.0, 0]] }); + // const [item0, setItem0] = useState([]); + + const retrieveList = useCallback(() => { + const retrieveListURL = '/admin/dashboard/dash-count'; + + const requestOptions = { + method: "POST", + headers: { + 'Content-type': 'application/json', + } + } + + EgovNet.requestFetch(retrieveListURL, + requestOptions, + (resp) => { + // let mutCountTag = []; + setDashboardCnt(resp.result); + console.log(resp.result.ConnMonthlyCount); + + // mutCountTag.push( + //
+ //
{listIdx}
+ //
{item.userId}
+ //
{item.targetUserId}
+ //
{item.accessType === "PRV_LIST" ? "사용자현황 조회" : item.accessType === "PRV_VIEW" ? "User 상세조회" : "User 수정"}
+ //
{item.ipAddress}
+ //
{item.accessDt}
+ //
+ // ); + // setCountTag(mutCountTag); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + // eslint-disable-next-lie react-hooks/exhaustive-deps + }, []); // const Location = React.memo(function Location() { @@ -88,10 +102,9 @@ function EgovAdminDashboard(props) { // ) // }); - // useEffect(() => { - // //retrieveList(searchCondition); disabled by thkim - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [searchCondition]); + useEffect(() => { + retrieveList(); + }, [retrieveList]); // const [dailyUserLogList, setDailyUserLogList] = useState([]); // const [isDailyChart, setIsDailyChart] = useState(true); @@ -236,16 +249,16 @@ function EgovAdminDashboard(props) { {/* Dashboard*/} {/**/} - + - + - + diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/ReportAreaChart.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/ReportAreaChart.jsx index ca4b95c..1a5aa6b 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/ReportAreaChart.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/ReportAreaChart.jsx @@ -1,10 +1,11 @@ -import { useEffect, useState } from 'react'; +import {useCallback, useEffect, useState} from 'react'; // material-ui import { useTheme } from '@mui/material/styles'; // third-party import ReactApexChart from 'react-apexcharts'; +import * as EgovNet from 'api/egovFetch'; // chart options const areaChartOptions = { @@ -23,7 +24,7 @@ const areaChartOptions = { enabled: true }, title: { - text: '2024년 2월', + text: `${new Date().getFullYear()}년 ${new Date().getMonth() + 1}월`, align: 'center' }, responsive: [{ @@ -53,8 +54,35 @@ const ReportAreaChart = () => { const line = theme.palette.divider; const [options, setOptions] = useState(areaChartOptions); + const [connectMethod, setConnectMethod] = useState([]); + + // 메뉴 접속 및 방문자 수 + const retrieveList = useCallback(() => { + const retrieveListURL = '/admin/dashboard/connect-method' + + const requestOptions = { + method: "POST", + headers: { + 'Content-type': 'application/json', + }, + // body: JSON.stringify() + } + + EgovNet.requestFetch(retrieveListURL, + requestOptions, + (resp) => { + setConnectMethod(resp.result.connectMethod[0]); + }, + function (resp) { + console.log("err response : ", resp); + } + ); + // eslint-disable-next-lie react-hooks/exhaustive-deps + }, []); useEffect(() => { + retrieveList(); + setOptions((prevState) => ({ ...prevState, labels: ['PC', 'Mobile'], @@ -73,9 +101,13 @@ const ReportAreaChart = () => { } } })); - }, [primary, secondary, line, theme]); + }, [primary, secondary, line, theme, retrieveList]); - const [series] = useState([90, 10]); + const [series, setSeries] = useState([]); + + useEffect(() => { + setSeries(connectMethod); + }, [connectMethod]); return ; }; diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/AdminDashboardController.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/AdminDashboardController.java index 5ee6130..4f29c2f 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/AdminDashboardController.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/AdminDashboardController.java @@ -27,6 +27,34 @@ public class AdminDashboardController extends BaseController { private final AdminDashboardService adminDashboardService; + @Operation( + summary = "Dashboard 상단 총접속자수 ~ 민원건수 카운트", + description = "상단 카운트 조회", + tags = {"AdminDashboardController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "조회 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.POST, value = "/dash-count", consumes = MediaType.APPLICATION_JSON_VALUE) + public ResultVO getDashCount(@AuthenticationPrincipal LoginVO user) + throws Exception { + + ResultVO resultVO = new ResultVO(); + Map resultMap = new HashMap<>(); + + resultMap.put("ConnMonthlyCount", adminDashboardService.selectConnMonthly()); + resultMap.put("DocuMonthlyCount", adminDashboardService.selectDocuMonthly()); +// resultMap.put("loginMonthlyList", adminDashboardService.selectLoginMonthly()); +// resultMap.put("loginDailyList", adminDashboardService.selectLoginDaily()); + + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage()); + resultVO.setResult(resultMap); + return resultVO; + } + + @Operation( summary = "해당년도 메뉴/방문자수 월/요일별 조회", description = "해당년도 메뉴/방문자수 월/요일별 조회", @@ -80,6 +108,29 @@ public class AdminDashboardController extends BaseController { } + @Operation( + summary = "해당월 접속방법 조회", + description = "해당월 PC/MOBILE 조회", + tags = {"AdminDashboardController"} + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "조회 성공"), + @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님") + }) + @RequestMapping(method = RequestMethod.POST, value = "/connect-method", consumes = MediaType.APPLICATION_JSON_VALUE) + public ResultVO getConnectMethod(@AuthenticationPrincipal LoginVO user) + throws Exception { + + ResultVO resultVO = new ResultVO(); + Map resultMap = new HashMap<>(); + + resultMap.put("connectMethod", adminDashboardService.selectConnectMonthly()); + + resultVO.setResultCode(ResponseCode.SUCCESS.getCode()); + resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage()); + resultVO.setResult(resultMap); + return resultVO; + } diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java new file mode 100644 index 0000000..0bc1274 --- /dev/null +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/DashboardRepository.java @@ -0,0 +1,131 @@ +package com.dbnt.kcscbackend.admin.dashboard.repository; + +import com.dbnt.kcscbackend.admin.logs.entity.TnDailyMenuLog; +import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface DashboardRepository extends JpaRepository { + + @Query(value = "WITH this_month_logs AS ( " + + " SELECT sum(log_cnt) AS this_month_cnt " + + " FROM tn_daily_user_log " + + " WHERE log_dt >= DATE_TRUNC('month', CURRENT_DATE) " + + " AND log_dt < DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month' " + + "), " + + "last_month_logs AS ( " + + " SELECT sum(log_cnt) AS last_month_cnt " + + " FROM tn_daily_user_log " + + " WHERE log_dt >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') " + + " AND log_dt < DATE_TRUNC('month', CURRENT_DATE) " + + ") " + + "SELECT " + + " this_month_cnt, " + + " ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1) AS ratio, " + + " last_month_cnt " + + "FROM this_month_logs, last_month_logs", nativeQuery = true) + List ConnMonthlyCount(); + + @Query(value = "WITH this_month_logs AS ( " + + " SELECT count(*) AS this_month_cnt " + + " FROM tn_document_info " + + " WHERE last_yn = 'Y' AND use_yn = 'Y' " + + " AND frst_crt_dt >= DATE_TRUNC('month', CURRENT_DATE) " + + " AND frst_crt_dt < DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month' " + + "), " + + "last_month_logs AS ( " + + " SELECT count(*) AS last_month_cnt " + + " FROM tn_document_info " + + " WHERE last_yn = 'Y' AND use_yn = 'Y' " + + " AND frst_crt_dt >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '1 month') " + + " AND frst_crt_dt < DATE_TRUNC('month', CURRENT_DATE) " + + ") " + + "SELECT " + + " this_month_cnt, " + + " ROUND(((CAST(this_month_cnt AS NUMERIC) - last_month_cnt) / last_month_cnt * 100), 1) AS ratio, " + + " last_month_cnt " + + "FROM this_month_logs, last_month_logs", nativeQuery = true) + List DocuMonthlyCount(); + + @Query(value = "WITH all_months AS (" + + " SELECT generate_series(DATE_TRUNC('year', CURRENT_DATE), DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '11 month', INTERVAL '1 month') AS month_start" + + ")" + + "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + + "FROM all_months " + + "LEFT JOIN tn_daily_menu_log tn ON TO_CHAR(all_months.month_start, 'yyyy-mm') = TO_CHAR(tn.log_dt, 'yyyy-mm') " + + "GROUP BY TO_CHAR(all_months.month_start, 'yyyy-mm') " + + "ORDER BY TO_CHAR(all_months.month_start, 'yyyy-mm') ASC", nativeQuery = true) + List MenuMonthlyList(); + + @Query(value = "WITH all_days AS (" + + " SELECT generate_series(" + + " DATE_TRUNC('year', now())," + + " DATE_TRUNC('year', now()) + INTERVAL '1 year' - INTERVAL '1 day'," + + " INTERVAL '1 day'" + + " ) AS day" + + ")" + + "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + + "FROM all_days ad " + + "LEFT JOIN tn_daily_menu_log tn ON ad.day = DATE_TRUNC('day', tn.log_dt) " + + "GROUP BY TO_CHAR(ad.day, 'Day') " + + "ORDER BY MIN(ad.day)", nativeQuery = true) + List MenuDailyList(); + + + @Query(value = "WITH all_months AS (" + + " SELECT generate_series(" + + " DATE_TRUNC('year', now())," + + " DATE_TRUNC('year', now()) + INTERVAL '11 month'," + + " INTERVAL '1 month'" + + " ) AS month_start" + + ")" + + "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + + "FROM all_months " + + "LEFT JOIN tn_daily_user_log tn ON TO_CHAR(all_months.month_start, 'yyyy-mm') = TO_CHAR(tn.log_dt, 'yyyy-mm') " + + "GROUP BY TO_CHAR(all_months.month_start, 'yyyy-mm') " + + "ORDER BY TO_CHAR(all_months.month_start, 'yyyy-mm') ASC", nativeQuery = true) + List LoginMonthlyList(); + + + + @Query(value = "WITH all_days AS (" + + " SELECT generate_series(" + + " DATE_TRUNC('year', CURRENT_DATE)," + + " DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year' - INTERVAL '1 day'," + + " INTERVAL '1 day'" + + " ) AS day" + + ")" + + "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + + "FROM all_days ad " + + "LEFT JOIN tn_daily_user_log tn ON ad.day = tn.log_dt " + + "GROUP BY TO_CHAR(ad.day, 'Day') " + + "ORDER BY MIN(ad.day)", nativeQuery = true) + List LoginDailyList(); + + + + @Query(value = "WITH all_days AS (" + + " SELECT generate_series(" + + " DATE_TRUNC('year', CURRENT_DATE)," + + " DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year' - INTERVAL '1 day'," + + " INTERVAL '1 day'" + + " ) AS day" + + ")" + + "SELECT COALESCE(COUNT(tn.access_dt), 0) AS log_cnt " + + "FROM all_days ad " + + "LEFT JOIN (SELECT access_dt FROM public.th_attach_file_log WHERE\n" + + " access_dt >= CURRENT_DATE - INTERVAL '6 day') tn ON ad.day = DATE_TRUNC('day', tn.access_dt) " + + "GROUP BY TO_CHAR(ad.day, 'Day') " + + "ORDER BY MIN(ad.day)", nativeQuery = true) + List FileDailyList(); + + + + @Query(value = "SELECT sum(pc_cnt) AS p_cnt, sum(mobile_cnt) AS m_cnt " + + "FROM tn_daily_user_log " + + "WHERE log_dt >= DATE_TRUNC('month', CURRENT_DATE) " + + "AND log_dt < DATE_TRUNC('month', CURRENT_DATE) + INTERVAL '1 month'", nativeQuery = true) + List findConnMonthly(); +} diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/MenuMonthlyRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/MenuMonthlyRepository.java deleted file mode 100644 index 0000955..0000000 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/repository/MenuMonthlyRepository.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.dbnt.kcscbackend.admin.dashboard.repository; - -import com.dbnt.kcscbackend.admin.logs.entity.TnDailyMenuLog; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import java.util.List; - -public interface MenuMonthlyRepository extends JpaRepository { - - @Query(value = "WITH all_months AS (" + - " SELECT generate_series(DATE_TRUNC('year', CURRENT_DATE), DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '11 month', INTERVAL '1 month') AS month_start" + - ")" + - "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + - "FROM all_months " + - "LEFT JOIN tn_daily_menu_log tn ON TO_CHAR(all_months.month_start, 'yyyy-mm') = TO_CHAR(tn.log_dt, 'yyyy-mm') " + - "GROUP BY TO_CHAR(all_months.month_start, 'yyyy-mm') " + - "ORDER BY TO_CHAR(all_months.month_start, 'yyyy-mm') ASC", nativeQuery = true) - List MenuMonthlyList(); - - @Query(value = "WITH all_days AS (" + - " SELECT generate_series(" + - " DATE_TRUNC('year', now())," + - " DATE_TRUNC('year', now()) + INTERVAL '1 year' - INTERVAL '1 day'," + - " INTERVAL '1 day'" + - " ) AS day" + - ")" + - "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + - "FROM all_days ad " + - "LEFT JOIN tn_daily_menu_log tn ON ad.day = DATE_TRUNC('day', tn.log_dt) " + - "GROUP BY TO_CHAR(ad.day, 'Day') " + - "ORDER BY MIN(ad.day)", nativeQuery = true) - List MenuDailyList(); - - - @Query(value = "WITH all_months AS (" + - " SELECT generate_series(" + - " DATE_TRUNC('year', now())," + - " DATE_TRUNC('year', now()) + INTERVAL '11 month'," + - " INTERVAL '1 month'" + - " ) AS month_start" + - ")" + - "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + - "FROM all_months " + - "LEFT JOIN tn_daily_user_log tn ON TO_CHAR(all_months.month_start, 'yyyy-mm') = TO_CHAR(tn.log_dt, 'yyyy-mm') " + - "GROUP BY TO_CHAR(all_months.month_start, 'yyyy-mm') " + - "ORDER BY TO_CHAR(all_months.month_start, 'yyyy-mm') ASC", nativeQuery = true) - List LoginMonthlyList(); - - - - @Query(value = "WITH all_days AS (" + - " SELECT generate_series(" + - " DATE_TRUNC('year', CURRENT_DATE)," + - " DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year' - INTERVAL '1 day'," + - " INTERVAL '1 day'" + - " ) AS day" + - ")" + - "SELECT COALESCE(SUM(tn.log_cnt), 0) AS log_cnt " + - "FROM all_days ad " + - "LEFT JOIN tn_daily_user_log tn ON ad.day = tn.log_dt " + - "GROUP BY TO_CHAR(ad.day, 'Day') " + - "ORDER BY MIN(ad.day)", nativeQuery = true) - List LoginDailyList(); - - - - @Query(value = "WITH all_days AS (" + - " SELECT generate_series(" + - " DATE_TRUNC('year', CURRENT_DATE)," + - " DATE_TRUNC('year', CURRENT_DATE) + INTERVAL '1 year' - INTERVAL '1 day'," + - " INTERVAL '1 day'" + - " ) AS day" + - ")" + - "SELECT COALESCE(COUNT(tn.access_dt), 0) AS log_cnt " + - "FROM all_days ad " + - "LEFT JOIN (SELECT access_dt FROM public.th_attach_file_log WHERE\n" + - " access_dt >= CURRENT_DATE - INTERVAL '6 day') tn ON ad.day = DATE_TRUNC('day', tn.access_dt) " + - "GROUP BY TO_CHAR(ad.day, 'Day') " + - "ORDER BY MIN(ad.day)", nativeQuery = true) - List FileDailyList(); -} - diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/service/AdminDashboardService.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/service/AdminDashboardService.java index 29a93dc..bee8ac1 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/service/AdminDashboardService.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/dashboard/service/AdminDashboardService.java @@ -1,8 +1,9 @@ package com.dbnt.kcscbackend.admin.dashboard.service; -//import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog; -import com.dbnt.kcscbackend.admin.dashboard.repository.MenuMonthlyRepository; +//import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog; //import com.dbnt.kcscbackend.admin.dashboard.repository.TnDailyUserLogRepository; +import com.dbnt.kcscbackend.admin.dashboard.repository.DashboardRepository; +import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog; import lombok.RequiredArgsConstructor; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.springframework.stereotype.Service; @@ -14,19 +15,23 @@ import java.util.List; @RequiredArgsConstructor public class AdminDashboardService extends EgovAbstractServiceImpl { // private final TnDailyUserLogRepository tnDailyUserLogRepository; - private final MenuMonthlyRepository menuMonthlyRepository; + private final DashboardRepository dashboardRepository; - public List selectMenuMonthly() { return menuMonthlyRepository.MenuMonthlyList(); } + public List selectConnMonthly() { return dashboardRepository.ConnMonthlyCount(); } - public List selectMenuDaily() { return menuMonthlyRepository.MenuDailyList(); } + public List selectDocuMonthly() { return dashboardRepository.DocuMonthlyCount(); } - public List selectLoginMonthly() { return menuMonthlyRepository.LoginMonthlyList(); } + public List selectMenuMonthly() { return dashboardRepository.MenuMonthlyList(); } - public List selectLoginDaily() { return menuMonthlyRepository.LoginDailyList(); } + public List selectMenuDaily() { return dashboardRepository.MenuDailyList(); } - public List selectFileDaily() { return menuMonthlyRepository.FileDailyList(); } + public List selectLoginMonthly() { return dashboardRepository.LoginMonthlyList(); } + public List selectLoginDaily() { return dashboardRepository.LoginDailyList(); } + public List selectFileDaily() { return dashboardRepository.FileDailyList(); } + + public List selectConnectMonthly() { return dashboardRepository.findConnMonthly(); } // public List selectDailyUserLogList(LocalDate startDate, LocalDate endDate) { // return tnDailyUserLogRepository.findByLogDtBetweenOrderByLogDt(startDate, endDate); From 44063a0ac6dcb7ce9bdd75b835bca2fb2fd39dda Mon Sep 17 00:00:00 2001 From: "Lim\\jun" Date: Wed, 28 Feb 2024 17:55:01 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Dashboard=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/admin/schedule/EgovAdminScheduleList.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx index 7c68238..ffa2f59 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx @@ -255,7 +255,7 @@ function EgovAdminDashboard(props) { - + {/**/} From e3845c304b7f2fb3c78fa35cf450a1fcb5653d0c Mon Sep 17 00:00:00 2001 From: "Lim\\jun" Date: Wed, 28 Feb 2024 17:59:40 +0900 Subject: [PATCH 5/5] =?UTF-8?q?Dashboard=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/admin/schedule/EgovAdminScheduleList.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx index ffa2f59..ad4e5d5 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/EgovAdminScheduleList.jsx @@ -50,7 +50,10 @@ function EgovAdminDashboard(props) { // } // const [countTag, setCountTag] = useState([]); - const [dashboardCnt, setDashboardCnt] = useState({ ConnMonthlyCount: [[0, 0.0, 0]] }); + const [dashboardCnt, setDashboardCnt] = useState({ + ConnMonthlyCount: [[0, 0.0, 0]], + DocuMonthlyCount: [[0, 0.0, 0]] + }); // const [item0, setItem0] = useState([]); const retrieveList = useCallback(() => { @@ -249,13 +252,13 @@ function EgovAdminDashboard(props) { {/* Dashboard*/} {/**/} - + - {/**/} +