diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java index df13b8e2..577f634c 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/mapper/LogMapper.java @@ -16,8 +16,11 @@ package top.charles7c.cnadmin.monitor.mapper; +import java.util.List; + import top.charles7c.cnadmin.common.base.BaseMapper; import top.charles7c.cnadmin.monitor.model.entity.LogDO; +import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; /** @@ -31,7 +34,14 @@ public interface LogMapper extends BaseMapper { /** * 查询仪表盘总计信息 * - * @return 总计信息 + * @return 仪表盘总计信息 */ DashboardTotalVO selectDashboardTotal(); + + /** + * 查询仪表盘热门模块列表 + * + * @return 仪表盘热门模块列表 + */ + List selectListDashboardPopularModule(); } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java new file mode 100644 index 00000000..b9825d0e --- /dev/null +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardPopularModuleVO.java @@ -0,0 +1,68 @@ +/* + * 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 java.math.BigDecimal; + +import lombok.Data; + +import io.swagger.v3.oas.annotations.media.Schema; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 仪表盘-热门模块信息 + * + * @author Charles7c + * @since 2023/9/9 9:52 + */ +@Data +public class DashboardPopularModuleVO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 模块 + */ + @Schema(description = "模块", example = "角色管理") + private String module; + + /** + * 浏览量(PV) + */ + @Schema(description = "浏览量(PV)", example = "1234") + private Long pvCount; + + /** + * 较昨日新增 PV(百分比) + */ + @Schema(description = "较昨日新增(百分比)", example = "23.4") + private BigDecimal newPvFromYesterday; + + /** + * 今日浏览量(PV) + */ + @JsonIgnore + private Long todayPvCount; + + /** + * 昨日浏览量(PV) + */ + @JsonIgnore + private Long yesterdayPvCount; +} diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java index 5e0871e2..1fc728b4 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/model/vo/DashboardTotalVO.java @@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; /** - * 仪表盘总计信息 + * 仪表盘-总计信息 * * @author Charles7c * @since 2023/9/8 21:32 @@ -51,7 +51,7 @@ public class DashboardTotalVO implements Serializable { /** * 今日浏览量(PV) */ - @Schema(description = "今日浏览量", example = "1234") + @Schema(description = "今日浏览量(PV)", example = "1234") private Long todayPvCount; /** diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java index 96eef1f9..bce9dc57 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/DashboardService.java @@ -18,6 +18,7 @@ import java.util.List; +import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; import top.charles7c.cnadmin.system.model.vo.DashboardAnnouncementVO; @@ -36,6 +37,13 @@ public interface DashboardService { */ DashboardTotalVO getTotal(); + /** + * 查询热门模块列表 + * + * @return 热门模块列表 + */ + List listPopularModule(); + /** * 查询公告列表 * diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java index f6bdf3aa..0749a0dc 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/LogService.java @@ -16,6 +16,8 @@ package top.charles7c.cnadmin.monitor.service; +import java.util.List; + import top.charles7c.cnadmin.common.model.query.PageQuery; import top.charles7c.cnadmin.common.model.vo.PageDataVO; import top.charles7c.cnadmin.monitor.model.query.LoginLogQuery; @@ -79,4 +81,11 @@ public interface LogService { * @return 仪表盘总计信息 */ DashboardTotalVO getDashboardTotal(); + + /** + * 查询仪表盘热门模块列表 + * + * @return 仪表盘热门模块列表 + */ + List listPopularModule(); } diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java index 89737415..23b34279 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/DashboardServiceImpl.java @@ -26,6 +26,7 @@ import cn.hutool.core.util.NumberUtil; +import top.charles7c.cnadmin.monitor.model.vo.DashboardPopularModuleVO; import top.charles7c.cnadmin.monitor.model.vo.DashboardTotalVO; import top.charles7c.cnadmin.monitor.service.DashboardService; import top.charles7c.cnadmin.monitor.service.LogService; @@ -58,6 +59,20 @@ public DashboardTotalVO getTotal() { return totalVO; } + @Override + public List listPopularModule() { + List popularModuleList = logService.listPopularModule(); + for (DashboardPopularModuleVO popularModule : popularModuleList) { + Long todayPvCount = popularModule.getTodayPvCount(); + Long yesterdayPvCount = popularModule.getYesterdayPvCount(); + BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount); + BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100) + : NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1); + popularModule.setNewPvFromYesterday(newPvFromYesterday); + } + return popularModuleList; + } + @Override public List listAnnouncement() { return announcementService.listDashboard(); diff --git a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java index 16727f2a..a52e395a 100644 --- a/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java +++ b/continew-admin-monitor/src/main/java/top/charles7c/cnadmin/monitor/service/impl/LogServiceImpl.java @@ -150,6 +150,11 @@ public DashboardTotalVO getDashboardTotal() { return logMapper.selectDashboardTotal(); } + @Override + public List listPopularModule() { + return logMapper.selectListDashboardPopularModule(); + } + /** * 填充数据 * diff --git a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml index d2ae4931..499d7fea 100644 --- a/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml +++ b/continew-admin-monitor/src/main/resources/mapper/LogMapper.xml @@ -8,4 +8,18 @@ (SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = CURDATE()) AS todayPvCount, (SELECT COUNT(*) FROM `sys_log` WHERE DATE(`create_time`) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)) AS yesterdayPvCount + + \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/mapper/AnnouncementMapper.java b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/mapper/AnnouncementMapper.java index 9133ee38..fa09570d 100644 --- a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/mapper/AnnouncementMapper.java +++ b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/mapper/AnnouncementMapper.java @@ -33,7 +33,7 @@ public interface AnnouncementMapper extends BaseMapper { /** * 查询仪表盘公告列表 * - * @return 公告列表 + * @return 仪表盘公告列表 */ List selectDashboardList(); } \ No newline at end of file diff --git a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/vo/DashboardAnnouncementVO.java b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/vo/DashboardAnnouncementVO.java index 23035d32..80936eb6 100644 --- a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/vo/DashboardAnnouncementVO.java +++ b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/model/vo/DashboardAnnouncementVO.java @@ -25,7 +25,7 @@ import top.charles7c.cnadmin.system.enums.AnnouncementTypeEnum; /** - * 仪表盘公告信息 + * 仪表盘-公告信息 * * @author Charles7c * @since 2023/8/20 10:55 diff --git a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/service/AnnouncementService.java b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/service/AnnouncementService.java index 8ae5ee18..fcd63278 100644 --- a/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/service/AnnouncementService.java +++ b/continew-admin-system/src/main/java/top/charles7c/cnadmin/system/service/AnnouncementService.java @@ -37,7 +37,7 @@ public interface AnnouncementService /** * 查询仪表盘公告列表 * - * @return 公告列表 + * @return 仪表盘公告列表 */ List listDashboard(); } \ No newline at end of file diff --git a/continew-admin-ui/src/api/common/dashboard.ts b/continew-admin-ui/src/api/common/dashboard.ts index ab3ddcbe..35ed3749 100644 --- a/continew-admin-ui/src/api/common/dashboard.ts +++ b/continew-admin-ui/src/api/common/dashboard.ts @@ -10,6 +10,12 @@ export interface DashboardTotalRecord { newPvFromYesterday: number; } +export interface DashboardPopularModuleRecord { + module: string; + pvCount: number; + newPvFromYesterday: number; +} + export interface DashboardAnnouncementRecord { id: string; title: string; @@ -20,6 +26,12 @@ export function getTotal() { return axios.get(`${BASE_URL}/total`); } +export function listPopularModule() { + return axios.get( + `${BASE_URL}/popular/module` + ); +} + export function listAnnouncement() { return axios.get(`${BASE_URL}/announcement`); } diff --git a/continew-admin-ui/src/assets/icons/png/data.png b/continew-admin-ui/src/assets/icons/png/data.png new file mode 100644 index 00000000..6b60def3 Binary files /dev/null and b/continew-admin-ui/src/assets/icons/png/data.png differ diff --git a/continew-admin-ui/src/assets/icons/png/hot.png b/continew-admin-ui/src/assets/icons/png/hot.png new file mode 100644 index 00000000..c24a063a Binary files /dev/null and b/continew-admin-ui/src/assets/icons/png/hot.png differ diff --git a/continew-admin-ui/src/assets/icons/png/popularity.png b/continew-admin-ui/src/assets/icons/png/popularity.png new file mode 100644 index 00000000..99b59841 Binary files /dev/null and b/continew-admin-ui/src/assets/icons/png/popularity.png differ diff --git a/continew-admin-ui/src/assets/icons/png/same-city.png b/continew-admin-ui/src/assets/icons/png/same-city.png new file mode 100644 index 00000000..aa9e7f95 Binary files /dev/null and b/continew-admin-ui/src/assets/icons/png/same-city.png differ diff --git a/continew-admin-ui/src/assets/icons/svg/data.svg b/continew-admin-ui/src/assets/icons/svg/data.svg deleted file mode 100644 index 4c250ee0..00000000 --- a/continew-admin-ui/src/assets/icons/svg/data.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/hot.svg b/continew-admin-ui/src/assets/icons/svg/hot.svg deleted file mode 100644 index 791d3a8a..00000000 --- a/continew-admin-ui/src/assets/icons/svg/hot.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/popularity.svg b/continew-admin-ui/src/assets/icons/svg/popularity.svg deleted file mode 100644 index 97b91c57..00000000 --- a/continew-admin-ui/src/assets/icons/svg/popularity.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/continew-admin-ui/src/assets/icons/svg/same-city.svg b/continew-admin-ui/src/assets/icons/svg/same-city.svg deleted file mode 100644 index 997dc760..00000000 --- a/continew-admin-ui/src/assets/icons/svg/same-city.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/continew-admin-ui/src/views/dashboard/workplace/components/data-panel.vue b/continew-admin-ui/src/views/dashboard/workplace/components/data-panel.vue index 0d5e5a84..496678fd 100644 --- a/continew-admin-ui/src/views/dashboard/workplace/components/data-panel.vue +++ b/continew-admin-ui/src/views/dashboard/workplace/components/data-panel.vue @@ -5,8 +5,8 @@ :span="{ xs: 12, sm: 12, md: 12, lg: 12, xl: 12, xxl: 6 }" > - - + + PvCountIcon - - + + IpCountIcon - - + + TodayPvCountIcon - - + + NewPvFromYesterdayIcon import { ref } from 'vue'; import { DashboardTotalRecord, getTotal } from '@/api/common/dashboard'; + import PvCountIcon from '@/assets/icons/png/popularity.png'; + import IpCountIcon from '@/assets/icons/png/same-city.png'; + import TodayPvCountIcon from '@/assets/icons/png/hot.png'; + import NewPvFromYesterdayIcon from '@/assets/icons/png/data.png'; const totalData = ref({ pvCount: 0, diff --git a/continew-admin-ui/src/views/dashboard/workplace/components/popular-content.vue b/continew-admin-ui/src/views/dashboard/workplace/components/popular-module.vue similarity index 55% rename from continew-admin-ui/src/views/dashboard/workplace/components/popular-content.vue rename to continew-admin-ui/src/views/dashboard/workplace/components/popular-module.vue index 80343927..58097b89 100644 --- a/continew-admin-ui/src/views/dashboard/workplace/components/popular-content.vue +++ b/continew-admin-ui/src/views/dashboard/workplace/components/popular-module.vue @@ -6,61 +6,50 @@ :body-style="{ padding: '17px 20px 21px 20px' }" > - - - - {{ $t('workplace.popularContent.text') }} - - - {{ $t('workplace.popularContent.image') }} - - - {{ $t('workplace.popularContent.video') }} - -