仪表盘数据优化

This commit is contained in:
shimingxy 2025-08-06 10:33:28 +08:00
parent 0a44491962
commit 2fe5124da9
11 changed files with 128 additions and 43 deletions

View File

@ -42,6 +42,12 @@ public interface ReportMapper extends IJpaMapper<JpaEntity> {
public Integer analysisActiveUsers(HashMap<String,Object> reportParameter); public Integer analysisActiveUsers(HashMap<String,Object> reportParameter);
public Integer totalUsers(HashMap<String,Object> reportParameter);
public Integer totalDepts(HashMap<String,Object> reportParameter);
public Integer totalApps(HashMap<String,Object> reportParameter);
public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter); public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter);
public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter); public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter);

View File

@ -33,6 +33,12 @@ public interface ReportService extends IJpaService<JpaEntity>{
public Integer analysisActiveUsers(HashMap<String,Object> reportParameter); public Integer analysisActiveUsers(HashMap<String,Object> reportParameter);
public Integer totalUsers(HashMap<String,Object> reportParameter);
public Integer totalDepts(HashMap<String,Object> reportParameter);
public Integer totalApps(HashMap<String,Object> reportParameter);
public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter); public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter);
public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter); public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter);

View File

@ -32,19 +32,31 @@ public class ReportServiceImpl extends JpaServiceImpl<ReportMapper,JpaEntity> i
public Integer analysisDay(HashMap<String,Object> reportParameter) { public Integer analysisDay(HashMap<String,Object> reportParameter) {
return getMapper().analysisDay(reportParameter); return getMapper().analysisDay(reportParameter);
}; }
public Integer analysisNewUsers(HashMap<String,Object> reportParameter) { public Integer analysisNewUsers(HashMap<String,Object> reportParameter) {
return getMapper().analysisNewUsers(reportParameter); return getMapper().analysisNewUsers(reportParameter);
}; }
public Integer analysisOnlineUsers(HashMap<String,Object> reportParameter) { public Integer analysisOnlineUsers(HashMap<String,Object> reportParameter) {
return getMapper().analysisOnlineUsers(reportParameter); return getMapper().analysisOnlineUsers(reportParameter);
}; }
public Integer analysisActiveUsers(HashMap<String,Object> reportParameter) { public Integer analysisActiveUsers(HashMap<String,Object> reportParameter) {
return getMapper().analysisActiveUsers(reportParameter); return getMapper().analysisActiveUsers(reportParameter);
}; }
public Integer totalUsers(HashMap<String,Object> reportParameter) {
return getMapper().totalDepts(reportParameter);
}
public Integer totalDepts(HashMap<String,Object> reportParameter) {
return getMapper().totalDepts(reportParameter);
}
public Integer totalApps(HashMap<String,Object> reportParameter) {
return getMapper().totalApps(reportParameter);
}
public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter){ public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter){
return getMapper().analysisDayHour(reportParameter); return getMapper().analysisDayHour(reportParameter);

View File

@ -135,5 +135,31 @@
limit 1000 limit 1000
</select> </select>
<!-- 用户统计 -->
<select id="totalUsers" parameterType="java.util.HashMap" resultType="Integer">
select
count(*) reportcount
from mxk_userinfo
where instid = #{instId}
and status = 1
</select>
<!-- 部门统计 -->
<select id="totalDepts" parameterType="java.util.HashMap" resultType="Integer">
select
count(*) reportcount
from mxk_organizations
where instid = #{instId}
and status = 1
</select>
<!-- 应用统计 -->
<select id="totalApps" parameterType="java.util.HashMap" resultType="Integer">
select
count(*) reportcount
from mxk_apps
where instid = #{instId}
and status = 1
</select>
</mapper> </mapper>

View File

@ -13,8 +13,8 @@
<div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md">
<div nz-row nzType="flex" nzAlign="middle" class="bg-primary rounded-md"> <div nz-row nzType="flex" nzAlign="middle" class="bg-primary rounded-md">
<div nz-col nzSpan="12" class="p-md text-white"> <div nz-col nzSpan="12" class="p-md text-white">
<div class="h2 mt0">{{ onlineUsers }}</div> <div class="h2 mt0">{{ onlineUsers + '/' + totalUsers }}</div>
<p class="text-nowrap mb0">{{ 'mxk.home.onlineUsers' | i18n }}</p> <p class="text-nowrap mb0">{{ 'mxk.home.onlineUsers' | i18n }}/{{ 'mxk.home.totalUsers' | i18n }}</p>
</div> </div>
<div nz-col nzSpan="12"> <div nz-col nzSpan="12">
<g2-mini-bar <g2-mini-bar
@ -32,26 +32,6 @@
</div> </div>
<div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md">
<div nz-row nzType="flex" nzAlign="middle" class="bg-success rounded-md"> <div nz-row nzType="flex" nzAlign="middle" class="bg-success rounded-md">
<div nz-col nzSpan="12" class="p-md text-white">
<div class="h2 mt0">{{ dayCount }}</div>
<p class="text-nowrap mb0">{{ 'mxk.home.dayCount' | i18n }}</p>
</div>
<div nz-col nzSpan="12">
<g2-mini-bar
*ngIf="simulateData"
height="35"
color="#fff"
borderWidth="3"
[padding]="[5, 30]"
[data]="simulateData"
tooltipType="mini"
(ready)="fixDark($event)"
></g2-mini-bar>
</div>
</div>
</div>
<div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md">
<div nz-row nzType="flex" nzAlign="middle" class="bg-orange rounded-md">
<div nz-col nzSpan="12" class="p-md text-white"> <div nz-col nzSpan="12" class="p-md text-white">
<div class="h2 mt0">{{ newUsers }}</div> <div class="h2 mt0">{{ newUsers }}</div>
<p class="text-nowrap mb0">{{ 'mxk.home.newUsers' | i18n }}</p> <p class="text-nowrap mb0">{{ 'mxk.home.newUsers' | i18n }}</p>
@ -70,11 +50,31 @@
</div> </div>
</div> </div>
</div> </div>
<div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md">
<div nz-row nzType="flex" nzAlign="middle" class="bg-orange rounded-md">
<div nz-col nzSpan="12" class="p-md text-white">
<div class="h2 mt0">{{ totalDepts }}</div>
<p class="text-nowrap mb0">{{ 'mxk.home.totalDepts' | i18n }}</p>
</div>
<div nz-col nzSpan="12">
<g2-mini-bar
*ngIf="simulateData"
height="35"
color="#fff"
borderWidth="3"
[padding]="[5, 30]"
[data]="simulateData"
tooltipType="mini"
(ready)="fixDark($event)"
></g2-mini-bar>
</div>
</div>
</div>
<div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md"> <div nz-col nzXs="24" nzSm="12" nzMd="6" class="mb-md">
<div nz-row nzType="flex" nzAlign="middle" class="bg-magenta rounded-md"> <div nz-row nzType="flex" nzAlign="middle" class="bg-magenta rounded-md">
<div nz-col nzSpan="12" class="p-md text-white"> <div nz-col nzSpan="12" class="p-md text-white">
<div class="h2 mt0">{{ activeUsers }}</div> <div class="h2 mt0">{{ totalApps }}</div>
<p class="text-nowrap mb0">{{ 'mxk.home.activeUsers' | i18n }}</p> <p class="text-nowrap mb0">{{ 'mxk.home.totalApps' | i18n }}</p>
</div> </div>
<div nz-col nzSpan="12"> <div nz-col nzSpan="12">
<g2-mini-bar <g2-mini-bar
@ -95,7 +95,10 @@
<div nz-col nzXs="24" nzMd="24"> <div nz-col nzXs="24" nzMd="24">
<nz-card [nzBordered]="false" [nzTitle]="dayAccessTitle"> <nz-card [nzBordered]="false" [nzTitle]="dayAccessTitle">
<ng-template #dayAccessTitle> <ng-template #dayAccessTitle>
{{ 'mxk.home.dayAccessCount' | i18n }} {{ 'mxk.home.dayAccessCount' | i18n }}-
<nz-badge [nzCount]="dayCount" [nzOffset]="[10, 0]" [nzStyle]="{ backgroundColor: '#52c41a' }">
<a class="head-badge">{{ 'mxk.home.dayCount' | i18n }}</a>
</nz-badge>
</ng-template> </ng-template>
<!--<g2-bar *ngIf="dayData" height="275" [data]="dayData" color="#fa8c16"></g2-bar>--> <!--<g2-bar *ngIf="dayData" height="275" [data]="dayData" color="#fa8c16"></g2-bar>-->
<g2-bar *ngIf="dayData" height="275" [data]="dayData"></g2-bar> <g2-bar *ngIf="dayData" height="275" [data]="dayData"></g2-bar>
@ -104,7 +107,10 @@
<div nz-col nzXs="24" nzMd="24"> <div nz-col nzXs="24" nzMd="24">
<nz-card [nzTitle]="monthAccessTitle" [nzBordered]="false"> <nz-card [nzTitle]="monthAccessTitle" [nzBordered]="false">
<ng-template #monthAccessTitle> <ng-template #monthAccessTitle>
{{ 'mxk.home.monthAccessCount' | i18n }} {{ 'mxk.home.monthAccessCount' | i18n }}-
<nz-badge [nzCount]="activeUsers" [nzOffset]="[10, 0]" [nzStyle]="{ backgroundColor: '#52c41a' }">
<a class="head-badge">{{ 'mxk.home.activeUsers' | i18n }}</a>
</nz-badge>
</ng-template> </ng-template>
<g2-bar *ngIf="mouthData" height="275" [data]="mouthData"></g2-bar> <g2-bar *ngIf="mouthData" height="275" [data]="mouthData"></g2-bar>
</nz-card> </nz-card>

View File

@ -0,0 +1,7 @@
.head-badge {
height: 20px;
border-radius: 4px;
color: #000;
display: inline-block;
vertical-align: middle;
}

View File

@ -38,9 +38,15 @@ export class HomeComponent implements OnInit {
//当月新增 //当月新增
newUsers!: any[]; newUsers!: any[];
//当月活动 //当月活动
activeUsers!: any[]; activeUsers!: number;
//当天统计 //当天统计
dayCount!: any[]; dayCount!: number;
totalUsers!: number;
totalDepts!: number;
totalApps!: number;
//在线用户 //在线用户
onlineUsers!: any[]; onlineUsers!: any[];
//当日 //当日
@ -108,6 +114,9 @@ export class HomeComponent implements OnInit {
this.dayCount = res.data.dayCount; this.dayCount = res.data.dayCount;
this.newUsers = res.data.newUsers; this.newUsers = res.data.newUsers;
this.activeUsers = res.data.activeUsers; this.activeUsers = res.data.activeUsers;
this.totalDepts = res.data.totalDepts;
this.totalUsers = res.data.totalUsers;
this.totalApps = res.data.totalApps;
const beginDay = new Date().getTime(); const beginDay = new Date().getTime();
const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5]; const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];

View File

@ -67,10 +67,13 @@
} }
}, },
"home": { "home": {
"onlineUsers": "Online Users", "onlineUsers": "Online",
"dayCount": "Day Count", "dayCount": "Day Count",
"newUsers": "Month News", "newUsers": "Month News",
"activeUsers": "Month Actives", "activeUsers": "Month Actives",
"totalUsers": "Users",
"totalDepts": "Depts",
"totalApps": "Apps",
"dayAccessCount": "Today Access Count", "dayAccessCount": "Today Access Count",
"monthAccessCount": "30 Day Access Count", "monthAccessCount": "30 Day Access Count",
"monthAppCount": "30 Day TOP 10 App Access Count", "monthAppCount": "30 Day TOP 10 App Access Count",

View File

@ -66,12 +66,15 @@
} }
}, },
"home": { "home": {
"onlineUsers": "当前在线用户", "onlineUsers": "在线",
"dayCount": "日访问量", "dayCount": "日访问量",
"newUsers": "当月新增用户", "newUsers": "当月新增用户",
"activeUsers": "当月活动用户", "activeUsers": "活动用户",
"dayAccessCount": "当日访问情况统计", "totalUsers": "用户",
"monthAccessCount": "30日访问情况统计", "totalDepts": "组织",
"totalApps": "应用",
"dayAccessCount": "当日访问统计",
"monthAccessCount": "30日访问统计",
"monthAppCount": "30日TOP10应用访问统计", "monthAppCount": "30日TOP10应用访问统计",
"monthBrowserCount": "30日TOP10浏览器访问统计", "monthBrowserCount": "30日TOP10浏览器访问统计",
"monthProvinceAccessCount": "30日TOP10访问统计", "monthProvinceAccessCount": "30日TOP10访问统计",

View File

@ -67,12 +67,15 @@
} }
}, },
"home": { "home": {
"onlineUsers": "當前在線用戶", "onlineUsers": "在線",
"dayCount": "日訪問量", "dayCount": "日訪問量",
"newUsers": "當月新增用戶", "newUsers": "當月新增用戶",
"activeUsers": "當月活動用戶", "activeUsers": "活動用戶",
"dayAccessCount": "當日訪問情況統計", "totalUsers": "用户",
"monthAccessCount": "30日訪問情況統計", "totalDepts": "组织",
"totalApps": "应用",
"dayAccessCount": "當日訪問統計",
"monthAccessCount": "30日訪問統計",
"monthAppCount": "30日TOP10應用訪問統計", "monthAppCount": "30日TOP10應用訪問統計",
"monthBrowserCount": "30日TOP10瀏覽器訪問統計", "monthBrowserCount": "30日TOP10瀏覽器訪問統計",
"monthProvinceAccessCount": "30日TOP10訪問統計", "monthProvinceAccessCount": "30日TOP10訪問統計",

View File

@ -53,6 +53,10 @@ public class DashboardController {
reportParameter.put("onlineUsers", reportService.analysisOnlineUsers(reportParameter)); reportParameter.put("onlineUsers", reportService.analysisOnlineUsers(reportParameter));
reportParameter.put("activeUsers", reportService.analysisActiveUsers(reportParameter)); reportParameter.put("activeUsers", reportService.analysisActiveUsers(reportParameter));
reportParameter.put("totalUsers", reportService.totalUsers(reportParameter));
reportParameter.put("totalDepts", reportService.totalDepts(reportParameter));
reportParameter.put("totalApps", reportService.totalApps(reportParameter));
reportParameter.put("reportMonth", reportService.analysisMonth(reportParameter)); reportParameter.put("reportMonth", reportService.analysisMonth(reportParameter));
reportParameter.put("reportDayHour", reportService.analysisDayHour(reportParameter)); reportParameter.put("reportDayHour", reportService.analysisDayHour(reportParameter));