mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-27 14:57:10 +08:00
feat: 完善仪表盘访问趋势区块内容
This commit is contained in:
@@ -19,8 +19,11 @@ package top.charles7c.cnadmin.monitor.mapper;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import top.charles7c.cnadmin.common.base.BaseMapper;
|
||||
import top.charles7c.cnadmin.monitor.model.entity.LogDO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
|
||||
@@ -39,9 +42,19 @@ public interface LogMapper extends BaseMapper<LogDO> {
|
||||
*/
|
||||
DashboardTotalVO selectDashboardTotal();
|
||||
|
||||
/**
|
||||
* 查询仪表盘访问趋势信息
|
||||
*
|
||||
* @param days
|
||||
* 日期数
|
||||
*
|
||||
* @return 仪表盘访问趋势信息
|
||||
*/
|
||||
List<DashboardAccessTrendVO> selectListDashboardAccessTrend(@Param("days") Integer days);
|
||||
|
||||
/**
|
||||
* 查询仪表盘热门模块列表
|
||||
*
|
||||
*
|
||||
* @return 仪表盘热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> selectListDashboardPopularModule();
|
||||
|
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.charles7c.cnadmin.monitor.model.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 仪表盘-访问趋势信息
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2023/9/9 20:20
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "仪表盘-访问趋势信息")
|
||||
public class DashboardAccessTrendVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description = "日期", example = "2023-08-08")
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 浏览量(PV)
|
||||
*/
|
||||
@Schema(description = "浏览量(PV)", example = "1000")
|
||||
private Long pvCount;
|
||||
|
||||
/**
|
||||
* IP 数
|
||||
*/
|
||||
@Schema(description = "IP 数", example = "500")
|
||||
private Long ipCount;
|
||||
}
|
@@ -18,6 +18,7 @@ package top.charles7c.cnadmin.monitor.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardGeoDistributionVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
@@ -38,16 +39,25 @@ public interface DashboardService {
|
||||
*/
|
||||
DashboardTotalVO getTotal();
|
||||
|
||||
/**
|
||||
* 查询访问趋势信息
|
||||
*
|
||||
* @param days
|
||||
* 日期数
|
||||
* @return 访问趋势信息
|
||||
*/
|
||||
List<DashboardAccessTrendVO> listAccessTrend(Integer days);
|
||||
|
||||
/**
|
||||
* 查询热门模块列表
|
||||
*
|
||||
*
|
||||
* @return 热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> listPopularModule();
|
||||
|
||||
/**
|
||||
* 查询访客地域分布信息
|
||||
*
|
||||
*
|
||||
* @return 访客地域分布信息
|
||||
*/
|
||||
DashboardGeoDistributionVO getGeoDistribution();
|
||||
|
@@ -83,9 +83,16 @@ public interface LogService {
|
||||
*/
|
||||
DashboardTotalVO getDashboardTotal();
|
||||
|
||||
/**
|
||||
* 查询仪表盘访问趋势信息
|
||||
*
|
||||
* @return 仪表盘访问趋势信息
|
||||
*/
|
||||
List<DashboardAccessTrendVO> listDashboardAccessTrend(Integer days);
|
||||
|
||||
/**
|
||||
* 查询仪表盘热门模块列表
|
||||
*
|
||||
*
|
||||
* @return 仪表盘热门模块列表
|
||||
*/
|
||||
List<DashboardPopularModuleVO> listDashboardPopularModule();
|
||||
|
@@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardGeoDistributionVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO;
|
||||
import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO;
|
||||
@@ -63,6 +64,11 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
return totalVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardAccessTrendVO> listAccessTrend(Integer days) {
|
||||
return logService.listDashboardAccessTrend(days);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardPopularModuleVO> listPopularModule() {
|
||||
List<DashboardPopularModuleVO> popularModuleList = logService.listDashboardPopularModule();
|
||||
|
@@ -151,6 +151,11 @@ public class LogServiceImpl implements LogService {
|
||||
return logMapper.selectDashboardTotal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardAccessTrendVO> listDashboardAccessTrend(Integer days) {
|
||||
return logMapper.selectListDashboardAccessTrend(days);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DashboardPopularModuleVO> listDashboardPopularModule() {
|
||||
return logMapper.selectListDashboardPopularModule();
|
||||
|
@@ -9,6 +9,18 @@
|
||||
(SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS yesterdayPvCount
|
||||
</select>
|
||||
|
||||
<select id="selectListDashboardAccessTrend"
|
||||
resultType="top.charles7c.cnadmin.monitor.model.vo.DashboardAccessTrendVO">
|
||||
SELECT
|
||||
DATE(`create_time`) AS date,
|
||||
COUNT(*) AS pvCount,
|
||||
COUNT(DISTINCT `client_ip`) AS ipCount
|
||||
FROM `sys_log`
|
||||
GROUP BY DATE(`create_time`)
|
||||
ORDER BY DATE(`create_time`) DESC
|
||||
LIMIT #{days}
|
||||
</select>
|
||||
|
||||
<select id="selectListDashboardPopularModule"
|
||||
resultType="top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO">
|
||||
SELECT
|
||||
|
Reference in New Issue
Block a user