diff --git a/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx b/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx
index 31162ba..58be7d2 100644
--- a/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx
+++ b/egovframe-template-simple-react-contribution/src/components/cards/AnalyticEcommerce.jsx
@@ -48,7 +48,7 @@ const AnalyticEcommerce = ({ color, title, count, percentage, isLoss, extra }) =
{extra}
{' '}
- 건이 추가되었습니다.
+ 건이 기록되었습니다.
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 9390c16..3ca47cb 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
@@ -1,29 +1,14 @@
import React, {useState, useEffect, useCallback} from 'react'; // PureComponent
import {Link} from 'react-router-dom'; //useLocation
-import {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';
+// import {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';
import * as EgovNet from 'api/egovFetch';
import URL from 'constants/url';
// import CODE from 'constants/code';
// material-ui
-import {
- Avatar,
- AvatarGroup,
- Box,
- Button,
- Grid,
- List,
- ListItemAvatar,
- ListItemButton,
- ListItemSecondaryAction,
- ListItemText,
- MenuItem,
- Stack,
- TextField,
- Typography
-} from '@mui/material';
+import { Box, Button, Grid, Stack, Typography } from '@mui/material';
import MainCard from 'components/cards/MainCard';
import BbsTable from './BbsTable';
import IncomeAreaChart from './IncomeAreaChart';
@@ -33,7 +18,7 @@ import AnalyticEcommerce from 'components/cards/AnalyticEcommerce';
import {default as EgovLeftNav} from 'components/leftmenu/EgovLeftNavAdmin';
-function EgovAdminScheduleList(props) {
+function EgovAdminDashboard(props) {
// console.group("EgovAdminScheduleList");
// console.log("[Start] EgovAdminScheduleList ------------------------------");
// console.log("EgovAdminScheduleList [props] : ", props);
@@ -41,7 +26,7 @@ function EgovAdminScheduleList(props) {
// const location = useLocation();
// console.log("EgovAdminScheduleList [location] : ", location);
- // const DATE = new Date();
+ const DATE = new Date();
// const TODAY = new Date(DATE.getFullYear(), DATE.getMonth(), DATE.getDate());
//
// const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {schdulSe: '', year: TODAY.getFullYear(), month: TODAY.getMonth(), date: TODAY.getDate()});
@@ -53,14 +38,6 @@ function EgovAdminScheduleList(props) {
// console.log(...args);
// }
- // const getLastDateOfMonth = (year, month) => {
- // const LAST_DATE_SUPPLMENT = 1;
- // return new Date(year, month + LAST_DATE_SUPPLMENT, 0);
- // }
- // const getFirstDateOfMonth = (year, month) => {
- // return new Date(year, month, 1);
- // }
-
// const changeDate = (target, amount) => {
// let changedDate;
//
@@ -98,125 +75,6 @@ function EgovAdminScheduleList(props) {
// console.groupEnd("EgovAdminScheduleList.retrieveList()");
// }, []);
- // const drawCalendar = () => {
- // console.groupCollapsed("EgovAdminScheduleList.drawCalendar()");
- // const PREV_MONTH_ADDITION = -1;
- //
- // let lastOfLastMonth = getLastDateOfMonth(searchCondition.year, searchCondition.month + PREV_MONTH_ADDITION);
- // let firstOfThisMonth = getFirstDateOfMonth(searchCondition.year, searchCondition.month);
- // let lastOfThisMonth = getLastDateOfMonth(searchCondition.year, searchCondition.month);
- //
- // console.log("lastOfLastMonth : ", lastOfLastMonth, lastOfLastMonth.getDay());
- // console.log("firstOfThisMonth :", firstOfThisMonth, firstOfThisMonth.getDay());
- // console.log("lastOfThisMonth :", lastOfThisMonth, lastOfThisMonth.getDay());
- // console.log("scheduleList : ", scheduleList);
- //
- // let firstDayOfThisMonth = firstOfThisMonth.getDay();
- // let lastDateOfThisMonth = lastOfThisMonth.getDate();
- // console.log("firstDayOfThisMonth", firstDayOfThisMonth, "lastDateOfThisMonth", lastDateOfThisMonth)
- //
- // let monthArr = [];
- // let weekArr = [];
- //
- // // firstWeek Date Set START
- // let firstWeekDateCount = 0;
- // for (let day = 0; day < 7; day++) {
- // if (day < firstDayOfThisMonth) { //
- // weekArr.push(0);
- // firstWeekDateCount = 0;
- // } else {
- // weekArr.push(++firstWeekDateCount);
- // }
- // }
- // monthArr.push(weekArr);
- // console.log("FirstWeek monthArr : ", monthArr);
- // // firstWeek Date Set END
- //
- // // otherWeek Date Set START
- // let dayCount = 0;
- // weekArr = [];//초기화
- // for (let day = firstWeekDateCount + 1; day <= lastDateOfThisMonth; day++) {
- //
- // if (dayCount % 7 !== 6) {
- // weekArr.push(day);
- // } else {
- // weekArr.push(day);
- // monthArr.push(weekArr);
- // weekArr = [];
- // dayCount = -1;
- // }
- // dayCount++;
- // }
- // // otherWeek Date Set END
- //
- // // lastWeek Date Set START
- // if (weekArr.length > 0) {//남은 부분
- // for (let day = weekArr.length; day < 7; day++) {
- // weekArr.push(0);
- // }
- // monthArr.push(weekArr);
- // }
- // // lastWeek Date Set END
- // console.log("OtherWeek monthArr : ", monthArr);
- //
- // let mutsUseYearMonth = searchCondition.year.toString() + ((searchCondition.month + 1).toString().length === 1 ? "0" + (searchCondition.month + 1).toString() : (searchCondition.month + 1).toString());
- // console.log("mutsUseYearMonth : ", mutsUseYearMonth);
- //
- // let mutCalendarTagList = [];
- // let keyIdx = 0;
- //
- // //draw Calendar
- // monthArr.forEach((week, weekIdx) => {
- // console.log();
- // mutCalendarTagList.push(
- //
{
- // week.map((day, dayIdx) => {
- // if (day !== 0) {//당월 일별 구현
- // let sDate = day.toString().length === 1 ? "0" + day.toString() : day.toString();
- // let iUseDate = Number(mutsUseYearMonth + sDate);
- // if (scheduleList.length > 0) {//일정 있는 경우
- // return (
- //
- // {day}
- // {
- // scheduleList.map((schedule, scheduleIdx) => {
- // let iBeginDate = Number(schedule.schdulBgnde.substring(0, 8));
- // let iEndDate = Number(schedule.schdulEndde.substring(0, 8));
- // innerConsole("scheduleList ", day, scheduleIdx, iBeginDate, iUseDate, iEndDate, iUseDate >= iBeginDate && iUseDate <= iEndDate);
- // innerConsole("schedule.schdulId ", schedule.schdulId);
- // if (iUseDate >= iBeginDate && iUseDate <= iEndDate) {
- // return (
- // <>
- // {schedule.schdulNm}
- //
- //
- // >
- // );
- // } else return <>>
- // })
- // }
- // |
- // );
- // } else {//일정 없는 경우
- // return (
- //
- // {day}
- // | );
- // }
- // } else if (day === 0) {// 이전달/다음달 구현
- // return ( | );
- // } else return <>>
- // })
- // }
);
- // })
- // console.log("mutCalendarTagList : ", mutCalendarTagList);
- // setCalendarTag(mutCalendarTagList);
- // console.groupEnd("EgovAdminScheduleList.drawCalendar()");
- // }
// const Location = React.memo(function Location() {
// return (
@@ -235,83 +93,78 @@ function EgovAdminScheduleList(props) {
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [searchCondition]);
- // useEffect(() => {
- // drawCalendar();
+ // const [dailyUserLogList, setDailyUserLogList] = useState([]);
+ // const [isDailyChart, setIsDailyChart] = useState(true);
+ //
+ // const getDailyUserLogList = useCallback(() => {
+ // // console.groupCollapsed("EgovAdminScheduleList.getDailyUserLogList()");
+ // //
+ // // console.log("@@@ isDailyChart : " + isDailyChart);
+ //
+ // const dailyUserLogListURL = isDailyChart ? '/admin/dashboard/daily-user-log-list' : '/admin/dashboard/monthly-user-log-list';
+ //
+ // const requestOptions = {
+ // method: "GET",
+ // headers: {
+ // 'Content-type': 'application/json',
+ // }
+ // }
+ //
+ // EgovNet.requestFetch(dailyUserLogListURL,
+ // requestOptions,
+ // (resp) => {
+ // setDailyUserLogList(resp.result.dailyUserLogList);
+ // // console.log("@@@ : " + dailyUserLogList);
+ // },
+ // function (resp) {
+ // // console.log("err response : ", resp);
+ // }
+ // );
+ // // console.groupEnd("EgovAdminScheduleList.getDailyUserLogList()");
// // eslint-disable-next-line react-hooks/exhaustive-deps
- // }, [scheduleList]);
-
- const [dailyUserLogList, setDailyUserLogList] = useState([]);
- const [isDailyChart, setIsDailyChart] = useState(true);
-
- const getDailyUserLogList = useCallback(() => {
- // console.groupCollapsed("EgovAdminScheduleList.getDailyUserLogList()");
- //
- // console.log("@@@ isDailyChart : " + isDailyChart);
-
- const dailyUserLogListURL = isDailyChart ? '/admin/dashboard/daily-user-log-list' : '/admin/dashboard/monthly-user-log-list';
-
- const requestOptions = {
- method: "GET",
- headers: {
- 'Content-type': 'application/json',
- }
- }
-
- EgovNet.requestFetch(dailyUserLogListURL,
- requestOptions,
- (resp) => {
- setDailyUserLogList(resp.result.dailyUserLogList);
- // console.log("@@@ : " + dailyUserLogList);
- },
- function (resp) {
- // console.log("err response : ", resp);
- }
- );
- // console.groupEnd("EgovAdminScheduleList.getDailyUserLogList()");
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isDailyChart]);
-
- useEffect(() => {
- getDailyUserLogList();
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isDailyChart]);
-
- const handleChartToggle = () => {
- setIsDailyChart(!isDailyChart);
- };
-
- const ChartToggle = ({onToggle}) => {
-
- const handleToggle = () => {
- onToggle(!isDailyChart);
- };
-
- return (
-
- )
- }
-
- const data = dailyUserLogList.map(item => ({
- logDt: item.logDt,
- uv: item.mobileCnt,
- "사용자 접속현황": item.logCnt,
- amt: item.pcCnt,
- }));
-
- const CustomTooltip = ({active, payload, label}) => {
- if (active && payload && payload.length) {
- return (
-
-
사용자 접속 현황
-
{`${label} : ${payload[0].value}`}
-
- );
- }
-
- return null;
- };
+ // }, [isDailyChart]);
+ //
+ // useEffect(() => {
+ // getDailyUserLogList();
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
+ // }, [isDailyChart]);
+ //
+ // const handleChartToggle = () => {
+ // setIsDailyChart(!isDailyChart);
+ // };
+ //
+ // const ChartToggle = ({onToggle}) => {
+ //
+ // const handleToggle = () => {
+ // onToggle(!isDailyChart);
+ // };
+ //
+ // return (
+ //
+ // )
+ // }
+ //
+ // const data = dailyUserLogList.map(item => ({
+ // logDt: item.logDt,
+ // uv: item.mobileCnt,
+ // "사용자 접속현황": item.logCnt,
+ // amt: item.pcCnt,
+ // }));
+ //
+ // const CustomTooltip = ({active, payload, label}) => {
+ // if (active && payload && payload.length) {
+ // return (
+ //
+ //
사용자 접속 현황
+ //
{`${label} : ${payload[0].value}`}
+ //
+ // );
+ // }
+ //
+ // return null;
+ // };
// class UserLogChart extends PureComponent {
// render() {
@@ -342,7 +195,8 @@ function EgovAdminScheduleList(props) {
// console.log("------------------------------EgovAdminScheduleList [End]");
// console.groupEnd("EgovAdminScheduleList");
- const [value, setValue] = useState('today');
+
+ // const [value, setValue] = useState('today');
const [slot, setSlot] = useState('week');
return (
@@ -376,16 +230,16 @@ function EgovAdminScheduleList(props) {
{/* Dashboard*/}
{/**/}
-
+
-
+
-
+
-
+
@@ -394,7 +248,7 @@ function EgovAdminScheduleList(props) {
- 방문자
+ { DATE.getFullYear() }년 메뉴접속 / 방문수
@@ -426,7 +280,7 @@ function EgovAdminScheduleList(props) {
- 다운로드 현황
+ 다운로드수
@@ -500,4 +354,4 @@ function EgovAdminScheduleList(props) {
);
}
-export default EgovAdminScheduleList;
\ No newline at end of file
+export default EgovAdminDashboard;
\ No newline at end of file
diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/IncomeAreaChart.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/IncomeAreaChart.jsx
index 86e71ac..dffd916 100644
--- a/egovframe-template-simple-react-contribution/src/pages/admin/schedule/IncomeAreaChart.jsx
+++ b/egovframe-template-simple-react-contribution/src/pages/admin/schedule/IncomeAreaChart.jsx
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
-import { useState, useEffect } from 'react';
+import { useState, useEffect, useCallback } from 'react';
// material-ui
import { useTheme } from '@mui/material/styles';
@@ -7,6 +7,8 @@ import { useTheme } from '@mui/material/styles';
// third-party
import ReactApexChart from 'react-apexcharts';
+import * as EgovNet from 'api/egovFetch';
+
// chart options
const areaChartOptions = {
chart: {
@@ -37,8 +39,41 @@ const IncomeAreaChart = ({ slot }) => {
const line = theme.palette.divider;
const [options, setOptions] = useState(areaChartOptions);
+ const [menuMonthlyList, setMenuMonthlyList] = useState([]);
+ const [menuDailyList, setMenuDailyList] = useState([]);
+ const [loginMonthlyList, setLoginMonthlyList] = useState([]);
+ const [loginDailyList, setLoginDailyList] = useState([]);
+
+ // 메뉴 접속 및 방문자 수
+ const retrieveList = useCallback(() => {
+ const retrieveListURL = '/admin/dashboard/menu-login'
+
+ const requestOptions = {
+ method: "POST",
+ headers: {
+ 'Content-type': 'application/json',
+ },
+ // body: JSON.stringify()
+ }
+
+ EgovNet.requestFetch(retrieveListURL,
+ requestOptions,
+ (resp) => {
+ setMenuMonthlyList(resp.result.menuMonthlyList);
+ setMenuDailyList(resp.result.menuDailyList);
+ setLoginMonthlyList(resp.result.loginMonthlyList);
+ setLoginDailyList(resp.result.loginDailyList);
+ },
+ function (resp) {
+ console.log("err response : ", resp);
+ }
+ );
+ // eslint-disable-next-lie react-hooks/exhaustive-deps
+ }, []);
useEffect(() => {
+ retrieveList();
+
setOptions((prevState) => ({
...prevState,
colors: [theme.palette.primary.main, theme.palette.primary[700]],
@@ -85,31 +120,31 @@ const IncomeAreaChart = ({ slot }) => {
theme: 'light'
}
}));
- }, [primary, secondary, line, theme, slot]);
+ }, [primary, secondary, line, theme, slot, retrieveList]);
const [series, setSeries] = useState([
{
- name: 'Page Views',
- data: [0, 86, 28, 115, 48, 210, 136]
+ name: 'Menu Views',
+ data: menuDailyList
},
{
- name: 'Sessions',
- data: [0, 43, 14, 56, 24, 105, 68]
+ name: 'Login Count',
+ data: loginDailyList
}
]);
useEffect(() => {
setSeries([
{
- name: 'Page Views',
- data: slot === 'month' ? [76, 85, 101, 98, 87, 105, 91, 114, 94, 86, 115, 35] : [31, 40, 28, 51, 42, 109, 100]
+ name: 'Menu Views',
+ data: slot === 'month' ? menuMonthlyList : menuDailyList
},
{
- name: 'Sessions',
- data: slot === 'month' ? [110, 60, 150, 35, 60, 36, 26, 45, 65, 52, 53, 41] : [11, 32, 45, 32, 34, 52, 41]
+ name: 'Login Count',
+ data: slot === 'month' ? loginMonthlyList : loginDailyList
}
]);
- }, [slot]);
+ }, [slot, menuMonthlyList, menuDailyList, loginMonthlyList, loginDailyList]);
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 0678eb6..317fa1a 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
@@ -1,8 +1,10 @@
package com.dbnt.kcscbackend.admin.dashboard;
-import com.dbnt.kcscbackend.admin.dashboard.dto.MonthlyUserLogDTO;
+//import com.dbnt.kcscbackend.admin.dashboard.dto.MonthlyUserLogDTO;
import com.dbnt.kcscbackend.admin.dashboard.service.AdminDashboardService;
+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;
@@ -10,6 +12,8 @@ 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;
@@ -30,57 +34,93 @@ public class AdminDashboardController extends BaseController {
private final AdminDashboardService adminDashboardService;
@Operation(
- summary = "일별 사용자 현황 차트 조회",
- description = "일별 사용자 현황 차트 조회",
+ summary = "해당년도 메뉴/방문자수 월/요일별 조회",
+ description = "해당년도 메뉴/방문자수 월/요일별 조회",
tags = {"AdminDashboardController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
- @RequestMapping(method = RequestMethod.GET, value = "/daily-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResultVO getDailyUserLogList() throws Exception {
+ @RequestMapping(method = RequestMethod.POST, value = "/menu-login", consumes = MediaType.APPLICATION_JSON_VALUE)
+ public ResultVO getMenuVisit(@AuthenticationPrincipal LoginVO user)
+ throws Exception {
+
ResultVO resultVO = new ResultVO();
Map resultMap = new HashMap<>();
- // 현재 날짜
- // todo endDate 뒤에 .minus 지워야함
- LocalDate endDate = LocalDate.now().minusMonths(6);
- // 3개월 전 날짜 계산
- LocalDate startDate = endDate.minusMonths(3);
+ resultMap.put("menuMonthlyList", adminDashboardService.selectMenuMonthly());
+ resultMap.put("menuDailyList", adminDashboardService.selectMenuDaily());
+ resultMap.put("loginMonthlyList", adminDashboardService.selectLoginMonthly());
+ resultMap.put("loginDailyList", adminDashboardService.selectLoginDaily());
- resultMap.put("dailyUserLogList", adminDashboardService.selectDailyUserLogList(startDate, endDate));
+ resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
+ resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
resultVO.setResult(resultMap);
return resultVO;
}
- @Operation(
- summary = "월별 사용자 현황 차트 조회",
- description = "월별 사용자 현황 차트 조회",
- tags = {"AdminDashboardController"}
- )
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "조회 성공"),
- @ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
- })
- @RequestMapping(method = RequestMethod.GET, value = "/monthly-user-log-list", consumes = MediaType.APPLICATION_JSON_VALUE)
- public ResultVO getMonthlyUserLogList() throws Exception {
- ResultVO resultVO = new ResultVO();
- Map resultMap = new HashMap<>();
- // 현재 날짜
- // todo endDate 뒤에 .minus 지워야함
- LocalDate endDate = LocalDate.now().minusMonths(6);
- // 3개월 전 날짜 계산
- LocalDate startDate = endDate.minusMonths(3);
- List