Dashboard 업뎃
parent
f86690f8be
commit
67ca3cef15
|
|
@ -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 [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || {schdulSe: '', year: TODAY.getFullYear(), month: TODAY.getMonth(), date: TODAY.getDate()});
|
||||||
// const [calendarTag, setCalendarTag] = useState([]);
|
// const [calendarTag, setCalendarTag] = useState([]);
|
||||||
//
|
|
||||||
// const [scheduleList, setScheduleList] = useState([]);
|
|
||||||
|
|
||||||
// const innerConsole = (...args) => {
|
// const innerConsole = (...args) => {
|
||||||
// console.log(...args);
|
// console.log(...args);
|
||||||
|
|
@ -51,29 +49,45 @@ function EgovAdminDashboard(props) {
|
||||||
// setSearchCondition({...searchCondition, year: changedDate.getFullYear(), month: changedDate.getMonth(), date: changedDate.getDate()});
|
// setSearchCondition({...searchCondition, year: changedDate.getFullYear(), month: changedDate.getMonth(), date: changedDate.getDate()});
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// const retrieveList = useCallback((srchcnd) => {
|
// const [countTag, setCountTag] = useState([]);
|
||||||
// console.groupCollapsed("EgovAdminScheduleList.retrieveList()");
|
const [dashboardCnt, setDashboardCnt] = useState({ ConnMonthlyCount: [[0, 0.0, 0]] });
|
||||||
//
|
// const [item0, setItem0] = useState([]);
|
||||||
// const retrieveListURL = '/schedule/month' + EgovNet.getQueryString(srchcnd);
|
|
||||||
//
|
const retrieveList = useCallback(() => {
|
||||||
// const requestOptions = {
|
const retrieveListURL = '/admin/dashboard/dash-count';
|
||||||
// method: "GET",
|
|
||||||
// headers: {
|
const requestOptions = {
|
||||||
// 'Content-type': 'application/json',
|
method: "POST",
|
||||||
// }
|
headers: {
|
||||||
// }
|
'Content-type': 'application/json',
|
||||||
//
|
}
|
||||||
// EgovNet.requestFetch(retrieveListURL,
|
}
|
||||||
// requestOptions,
|
|
||||||
// (resp) => {
|
EgovNet.requestFetch(retrieveListURL,
|
||||||
// setScheduleList(resp.result.resultList);
|
requestOptions,
|
||||||
// },
|
(resp) => {
|
||||||
// function (resp) {
|
// let mutCountTag = [];
|
||||||
// console.log("err response : ", resp);
|
setDashboardCnt(resp.result);
|
||||||
// }
|
console.log(resp.result.ConnMonthlyCount);
|
||||||
// );
|
|
||||||
// console.groupEnd("EgovAdminScheduleList.retrieveList()");
|
// mutCountTag.push(
|
||||||
// }, []);
|
// <div key={listIdx} className="list_item">
|
||||||
|
// <div>{listIdx}</div>
|
||||||
|
// <div>{item.userId}</div>
|
||||||
|
// <div>{item.targetUserId}</div>
|
||||||
|
// <div>{item.accessType === "PRV_LIST" ? "사용자현황 조회" : item.accessType === "PRV_VIEW" ? "User 상세조회" : "User 수정"}</div>
|
||||||
|
// <div>{item.ipAddress}</div>
|
||||||
|
// <div>{item.accessDt}</div>
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// setCountTag(mutCountTag);
|
||||||
|
},
|
||||||
|
function (resp) {
|
||||||
|
console.log("err response : ", resp);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// eslint-disable-next-lie react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
// const Location = React.memo(function Location() {
|
// const Location = React.memo(function Location() {
|
||||||
|
|
@ -88,10 +102,9 @@ function EgovAdminDashboard(props) {
|
||||||
// )
|
// )
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// //retrieveList(searchCondition); disabled by thkim
|
retrieveList();
|
||||||
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [retrieveList]);
|
||||||
// }, [searchCondition]);
|
|
||||||
|
|
||||||
// const [dailyUserLogList, setDailyUserLogList] = useState([]);
|
// const [dailyUserLogList, setDailyUserLogList] = useState([]);
|
||||||
// const [isDailyChart, setIsDailyChart] = useState(true);
|
// const [isDailyChart, setIsDailyChart] = useState(true);
|
||||||
|
|
@ -236,16 +249,16 @@ function EgovAdminDashboard(props) {
|
||||||
{/* <Typography variant="h5">Dashboard</Typography>*/}
|
{/* <Typography variant="h5">Dashboard</Typography>*/}
|
||||||
{/*</Grid>*/}
|
{/*</Grid>*/}
|
||||||
<Grid item xs={12} sm={6} md={4} lg={3}>
|
<Grid item xs={12} sm={6} md={4} lg={3}>
|
||||||
<AnalyticEcommerce title={`총접속자수 (${DATE.getMonth() + 1}월)`} count="442,236" percentage={59.3} extra="35,000" />
|
<AnalyticEcommerce title={`총접속자수 (${DATE.getMonth() + 1}월)`} count={dashboardCnt.ConnMonthlyCount[0]?.[0]?.toLocaleString() || ''} percentage={parseFloat(dashboardCnt.ConnMonthlyCount[0]?.[1]) || 0} extra={dashboardCnt.ConnMonthlyCount[0]?.[2]?.toLocaleString() || ''} isLoss={dashboardCnt.ConnMonthlyCount[0]?.[1] < 0} color={dashboardCnt.ConnMonthlyCount[0]?.[1] < 0 ? "warning" : "primary"} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} md={4} lg={3}>
|
<Grid item xs={12} sm={6} md={4} lg={3}>
|
||||||
<AnalyticEcommerce title={`건설기준 오류건수 (${DATE.getMonth() + 1}월)`} count="78,250" percentage={70.5} extra="8,900" />
|
<AnalyticEcommerce title={`건설기준 오류건수 (${DATE.getMonth() + 1}월)`} count="78,250" percentage={70.5} extra="8,900" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} md={4} lg={3}>
|
<Grid item xs={12} sm={6} md={4} lg={3}>
|
||||||
<AnalyticEcommerce title={`기준코드 등록건수 (${DATE.getMonth() + 1}월)`} count="18,800" percentage={27.4} isLoss color="warning" extra="1,943" />
|
<AnalyticEcommerce title={`기준코드 등록건수 (${DATE.getMonth() + 1}월)`} count={dashboardCnt.DocuMonthlyCount[0]?.[0]?.toLocaleString() || ''} percentage={parseFloat(dashboardCnt.DocuMonthlyCount[0]?.[1]) || 0} extra={dashboardCnt.DocuMonthlyCount[0]?.[2]?.toLocaleString() || ''} isLoss={dashboardCnt.DocuMonthlyCount[0]?.[1] < 0} color={dashboardCnt.DocuMonthlyCount[0]?.[1] < 0 ? "warning" : "primary"} />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} sm={6} md={4} lg={3}>
|
<Grid item xs={12} sm={6} md={4} lg={3}>
|
||||||
<AnalyticEcommerce title={`민원건수 (${DATE.getMonth() + 1}월)`} count="5" percentage={80} isLoss color="warning" extra="1" />
|
<AnalyticEcommerce title={`민원건수 (${DATE.getMonth() + 1}월)`} count="5" percentage={80} extra="1" isLoss color="warning" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item md={8} sx={{ display: { sm: 'none', md: 'block', lg: 'none' } }} />
|
<Grid item md={8} sx={{ display: { sm: 'none', md: 'block', lg: 'none' } }} />
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import { useEffect, useState } from 'react';
|
import {useCallback, useEffect, useState} from 'react';
|
||||||
|
|
||||||
// material-ui
|
// material-ui
|
||||||
import { useTheme } from '@mui/material/styles';
|
import { useTheme } from '@mui/material/styles';
|
||||||
|
|
||||||
// third-party
|
// third-party
|
||||||
import ReactApexChart from 'react-apexcharts';
|
import ReactApexChart from 'react-apexcharts';
|
||||||
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
// chart options
|
// chart options
|
||||||
const areaChartOptions = {
|
const areaChartOptions = {
|
||||||
|
|
@ -23,7 +24,7 @@ const areaChartOptions = {
|
||||||
enabled: true
|
enabled: true
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
text: '2024년 2월',
|
text: `${new Date().getFullYear()}년 ${new Date().getMonth() + 1}월`,
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
responsive: [{
|
responsive: [{
|
||||||
|
|
@ -53,8 +54,35 @@ const ReportAreaChart = () => {
|
||||||
const line = theme.palette.divider;
|
const line = theme.palette.divider;
|
||||||
|
|
||||||
const [options, setOptions] = useState(areaChartOptions);
|
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(() => {
|
useEffect(() => {
|
||||||
|
retrieveList();
|
||||||
|
|
||||||
setOptions((prevState) => ({
|
setOptions((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
labels: ['PC', 'Mobile'],
|
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 <ReactApexChart options={options} series={series} type="donut" />;
|
return <ReactApexChart options={options} series={series} type="donut" />;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,34 @@ public class AdminDashboardController extends BaseController {
|
||||||
|
|
||||||
private final AdminDashboardService adminDashboardService;
|
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<String, Object> 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(
|
@Operation(
|
||||||
summary = "해당년도 메뉴/방문자수 월/요일별 조회",
|
summary = "해당년도 메뉴/방문자수 월/요일별 조회",
|
||||||
description = "해당년도 메뉴/방문자수 월/요일별 조회",
|
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<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
|
resultMap.put("connectMethod", adminDashboardService.selectConnectMonthly());
|
||||||
|
|
||||||
|
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||||
|
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||||
|
resultVO.setResult(resultMap);
|
||||||
|
return resultVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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<TnDailyMenuLog, Long> {
|
||||||
|
|
||||||
|
@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<Object[]> 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<Object[]> 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<Long> 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<Long> 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<Long> 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<Long> 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<Long> 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<Object[]> findConnMonthly();
|
||||||
|
}
|
||||||
|
|
@ -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<TnDailyMenuLog, Long> {
|
|
||||||
|
|
||||||
@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<Long> 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<Long> 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<Long> 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<Long> 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<Long> FileDailyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.dbnt.kcscbackend.admin.dashboard.service;
|
package com.dbnt.kcscbackend.admin.dashboard.service;
|
||||||
|
|
||||||
//import com.dbnt.kcscbackend.admin.dashboard.entity.TnDailyUserLog;
|
//import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
||||||
import com.dbnt.kcscbackend.admin.dashboard.repository.MenuMonthlyRepository;
|
|
||||||
//import com.dbnt.kcscbackend.admin.dashboard.repository.TnDailyUserLogRepository;
|
//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 lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -14,19 +15,23 @@ import java.util.List;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AdminDashboardService extends EgovAbstractServiceImpl {
|
public class AdminDashboardService extends EgovAbstractServiceImpl {
|
||||||
// private final TnDailyUserLogRepository tnDailyUserLogRepository;
|
// private final TnDailyUserLogRepository tnDailyUserLogRepository;
|
||||||
private final MenuMonthlyRepository menuMonthlyRepository;
|
private final DashboardRepository dashboardRepository;
|
||||||
|
|
||||||
public List<Long> selectMenuMonthly() { return menuMonthlyRepository.MenuMonthlyList(); }
|
public List<Object[]> selectConnMonthly() { return dashboardRepository.ConnMonthlyCount(); }
|
||||||
|
|
||||||
public List<Long> selectMenuDaily() { return menuMonthlyRepository.MenuDailyList(); }
|
public List<Object[]> selectDocuMonthly() { return dashboardRepository.DocuMonthlyCount(); }
|
||||||
|
|
||||||
public List<Long> selectLoginMonthly() { return menuMonthlyRepository.LoginMonthlyList(); }
|
public List<Long> selectMenuMonthly() { return dashboardRepository.MenuMonthlyList(); }
|
||||||
|
|
||||||
public List<Long> selectLoginDaily() { return menuMonthlyRepository.LoginDailyList(); }
|
public List<Long> selectMenuDaily() { return dashboardRepository.MenuDailyList(); }
|
||||||
|
|
||||||
public List<Long> selectFileDaily() { return menuMonthlyRepository.FileDailyList(); }
|
public List<Long> selectLoginMonthly() { return dashboardRepository.LoginMonthlyList(); }
|
||||||
|
|
||||||
|
public List<Long> selectLoginDaily() { return dashboardRepository.LoginDailyList(); }
|
||||||
|
|
||||||
|
public List<Long> selectFileDaily() { return dashboardRepository.FileDailyList(); }
|
||||||
|
|
||||||
|
public List<Object[]> selectConnectMonthly() { return dashboardRepository.findConnMonthly(); }
|
||||||
|
|
||||||
// public List<TnDailyUserLog> selectDailyUserLogList(LocalDate startDate, LocalDate endDate) {
|
// public List<TnDailyUserLog> selectDailyUserLogList(LocalDate startDate, LocalDate endDate) {
|
||||||
// return tnDailyUserLogRepository.findByLogDtBetweenOrderByLogDt(startDate, endDate);
|
// return tnDailyUserLogRepository.findByLogDtBetweenOrderByLogDt(startDate, endDate);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue