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