MaxKey hace 2 días
padre
commit
dc59fc0ba9

+ 9 - 7
maxkey-entity/src/main/java/org/dromara/maxkey/entity/ExcelImport.java

@@ -89,13 +89,15 @@ public class ExcelImport extends JpaEntity {
     
     public Workbook biuldWorkbook() throws IOException {
         workbook = null;
-        inputStream = excelFile.getInputStream();
-        if (excelFile.getOriginalFilename().toLowerCase().endsWith(".xls")) {
-            workbook = new HSSFWorkbook(inputStream);
-        } else if (excelFile.getOriginalFilename().toLowerCase().endsWith(".xlsx")) {
-            workbook = new XSSFWorkbook(inputStream);
-        } else {
-            throw new RuntimeException("Excel suffix error.");
+        if(isExcelNotEmpty()) {
+	        inputStream = excelFile.getInputStream();
+	        if (excelFile.getOriginalFilename().toLowerCase().endsWith(".xls")) {
+	            workbook = new HSSFWorkbook(inputStream);
+	        } else if (excelFile.getOriginalFilename().toLowerCase().endsWith(".xlsx")) {
+	            workbook = new XSSFWorkbook(inputStream);
+	        } else {
+	            throw new RuntimeException("Excel suffix error.");
+	        }
         }
         return workbook;
     }

+ 184 - 0
maxkey-entity/src/main/java/org/dromara/maxkey/entity/dto/DashboardVo.java

@@ -0,0 +1,184 @@
+package org.dromara.maxkey.entity.dto;
+
+import java.util.List;
+/*
+ * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
+ * 
+ * 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.
+ */
+ 
+import java.util.Map;
+
+public class DashboardVo {
+
+	String  instId;
+    Integer dayCount;
+    Integer monthCount;
+    Integer newUsers;
+    
+    Integer onlineUsers;
+    Integer activeUsers;
+    
+    Integer totalUsers;
+    Integer totalDepts;
+    Integer totalApps;
+    Integer totalGroups;
+    
+    List<Map<String, Object>> reportMonth;
+    List<Map<String, Object>> reportDayHour;
+    
+    List<Map<String, Object>> reportProvince;
+    
+    List<Map<String, Object>> reportCountry;
+    
+    List<Map<String, Object>> reportBrowser;
+    
+    List<Map<String, Object>>reportApp;
+
+    public DashboardVo() {
+    	
+    }
+    
+    public DashboardVo(String  instId) {
+    	this.instId = instId;
+    }
+    
+	public String getInstId() {
+		return instId;
+	}
+
+	public void setInstId(String instId) {
+		this.instId = instId;
+	}
+
+	public Integer getDayCount() {
+		return dayCount;
+	}
+
+	public void setDayCount(Integer dayCount) {
+		this.dayCount = dayCount;
+	}
+
+	public Integer getMonthCount() {
+		return monthCount;
+	}
+
+	public void setMonthCount(Integer monthCount) {
+		this.monthCount = monthCount;
+	}
+
+	public Integer getNewUsers() {
+		return newUsers;
+	}
+
+	public void setNewUsers(Integer newUsers) {
+		this.newUsers = newUsers;
+	}
+
+	public Integer getOnlineUsers() {
+		return onlineUsers;
+	}
+
+	public void setOnlineUsers(Integer onlineUsers) {
+		this.onlineUsers = onlineUsers;
+	}
+
+	public Integer getActiveUsers() {
+		return activeUsers;
+	}
+
+	public void setActiveUsers(Integer activeUsers) {
+		this.activeUsers = activeUsers;
+	}
+
+	public Integer getTotalUsers() {
+		return totalUsers;
+	}
+
+	public void setTotalUsers(Integer totalUsers) {
+		this.totalUsers = totalUsers;
+	}
+
+	public Integer getTotalDepts() {
+		return totalDepts;
+	}
+
+	public void setTotalDepts(Integer totalDepts) {
+		this.totalDepts = totalDepts;
+	}
+
+	public Integer getTotalApps() {
+		return totalApps;
+	}
+
+	public void setTotalApps(Integer totalApps) {
+		this.totalApps = totalApps;
+	}
+
+	public Integer getTotalGroups() {
+		return totalGroups;
+	}
+
+	public void setTotalGroups(Integer totalGroups) {
+		this.totalGroups = totalGroups;
+	}
+
+	public List<Map<String, Object>> getReportMonth() {
+		return reportMonth;
+	}
+
+	public void setReportMonth(List<Map<String, Object>> reportMonth) {
+		this.reportMonth = reportMonth;
+	}
+
+	public List<Map<String, Object>> getReportDayHour() {
+		return reportDayHour;
+	}
+
+	public void setReportDayHour(List<Map<String, Object>> reportDayHour) {
+		this.reportDayHour = reportDayHour;
+	}
+
+	public List<Map<String, Object>> getReportProvince() {
+		return reportProvince;
+	}
+
+	public void setReportProvince(List<Map<String, Object>> reportProvince) {
+		this.reportProvince = reportProvince;
+	}
+
+	public List<Map<String, Object>> getReportCountry() {
+		return reportCountry;
+	}
+
+	public void setReportCountry(List<Map<String, Object>> reportCountry) {
+		this.reportCountry = reportCountry;
+	}
+
+	public List<Map<String, Object>> getReportBrowser() {
+		return reportBrowser;
+	}
+
+	public void setReportBrowser(List<Map<String, Object>> reportBrowser) {
+		this.reportBrowser = reportBrowser;
+	}
+
+	public List<Map<String, Object>> getReportApp() {
+		return reportApp;
+	}
+
+	public void setReportApp(List<Map<String, Object>> reportApp) {
+		this.reportApp = reportApp;
+	}
+    
+}

+ 5 - 0
maxkey-entity/src/main/java/org/dromara/maxkey/entity/dto/InstDto.java

@@ -17,11 +17,16 @@
 package org.dromara.maxkey.entity.dto;
 
 public class InstDto {
+	
 	String instId;
 
 	public InstDto() {
 		super();
 	}
+	
+	public InstDto(String instId) {
+		this.instId = instId;
+	}
 
 	public String getInstId() {
 		return instId;

+ 0 - 1
maxkey-entity/src/main/java/org/dromara/maxkey/entity/permissions/Resources.java

@@ -20,7 +20,6 @@ package org.dromara.maxkey.entity.permissions;
 import java.io.Serializable;
 import java.util.Date;
 
-import org.dromara.maxkey.entity.authz.vo.AppResourcesVo;
 import org.dromara.mybatis.jpa.entity.JpaEntity;
 
 import jakarta.persistence.Column;

+ 16 - 16
maxkey-persistence/src/main/java/org/dromara/maxkey/persistence/mapper/ReportMapper.java

@@ -20,10 +20,10 @@
  */
 package org.dromara.maxkey.persistence.mapper;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.dromara.maxkey.entity.dto.InstDto;
 import org.dromara.mybatis.jpa.IJpaMapper;
 import org.dromara.mybatis.jpa.entity.JpaEntity;
 
@@ -34,34 +34,34 @@ import org.dromara.mybatis.jpa.entity.JpaEntity;
  */
 public  interface ReportMapper extends IJpaMapper<JpaEntity,String> {
     
-    public Integer analysisDayCount(HashMap<String,Object> reportParameter);
+    public Integer analysisDayCount(InstDto inst);
     
-    public Integer analysisMonthCount(HashMap<String,Object> reportParameter);
+    public Integer analysisMonthCount(InstDto inst);
     
-    public Integer analysisNewUsers(HashMap<String,Object> reportParameter);
+    public Integer analysisNewUsers(InstDto inst);
     
-    public Integer analysisOnlineUsers(HashMap<String,Object> reportParameter);
+    public Integer analysisOnlineUsers(InstDto inst);
     
-    public Integer analysisActiveUsers(HashMap<String,Object> reportParameter);
+    public Integer analysisActiveUsers(InstDto inst);
     
-    public Integer totalUsers(HashMap<String,Object> reportParameter);
+    public Integer totalUsers(InstDto inst);
     
-    public Integer totalDepts(HashMap<String,Object> reportParameter);
+    public Integer totalDepts(InstDto inst);
     
-    public Integer totalApps(HashMap<String,Object> reportParameter);
+    public Integer totalApps(InstDto inst);
     
-    public Integer totalGroups(HashMap<String,Object> reportParameter);
+    public Integer totalGroups(InstDto inst);
     
-    public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisDayHour(InstDto inst);
     
-    public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisMonth(InstDto inst);
     
-    public List<Map<String,Object>> analysisBrowser(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisBrowser(InstDto inst);
     
-    public List<Map<String,Object>> analysisApp(HashMap<String,Object> reportParameter );
+    public List<Map<String,Object>> analysisApp(InstDto inst );
     
-    public List<Map<String,Object>> analysisProvince(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisProvince(InstDto inst);
     
-    public List<Map<String,Object>> analysisCountry(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisCountry(InstDto inst);
     
 }

+ 16 - 16
maxkey-persistence/src/main/java/org/dromara/maxkey/persistence/service/ReportService.java

@@ -17,42 +17,42 @@
 
 package org.dromara.maxkey.persistence.service;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import org.dromara.mybatis.jpa.service.IJpaService;
+import org.dromara.maxkey.entity.dto.InstDto;
 import org.dromara.mybatis.jpa.entity.JpaEntity;
 
 public interface ReportService  extends IJpaService<JpaEntity,String>{
 
-    public Integer analysisDayCount(HashMap<String,Object> reportParameter) ;
+    public Integer analysisDayCount(InstDto inst) ;
     
-    public Integer analysisMonthCount(HashMap<String,Object> reportParameter) ;
+    public Integer analysisMonthCount(InstDto inst) ;
     
-    public Integer analysisNewUsers(HashMap<String,Object> reportParameter) ;
+    public Integer analysisNewUsers(InstDto inst) ;
     
-    public Integer analysisOnlineUsers(HashMap<String,Object> reportParameter) ;
+    public Integer analysisOnlineUsers(InstDto inst) ;
     
-    public Integer analysisActiveUsers(HashMap<String,Object> reportParameter);
+    public Integer analysisActiveUsers(InstDto inst);
     
-    public Integer totalUsers(HashMap<String,Object> reportParameter);
+    public Integer totalUsers(InstDto inst);
     
-    public Integer totalDepts(HashMap<String,Object> reportParameter);
+    public Integer totalDepts(InstDto inst);
     
-    public Integer totalApps(HashMap<String,Object> reportParameter);
+    public Integer totalApps(InstDto inst);
     
-    public Integer totalGroups(HashMap<String,Object> reportParameter);
+    public Integer totalGroups(InstDto inst);
     
-    public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisDayHour(InstDto inst);
     
-    public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisMonth(InstDto inst);
     
     
-    public List<Map<String,Object>> analysisBrowser(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisBrowser(InstDto inst);
     
-    public List<Map<String,Object>> analysisApp(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisApp(InstDto inst);
 
-    public List<Map<String,Object>> analysisProvince(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisProvince(InstDto inst);
     
-    public List<Map<String,Object>> analysisCountry(HashMap<String,Object> reportParameter);
+    public List<Map<String,Object>> analysisCountry(InstDto inst);
 }

+ 32 - 31
maxkey-persistence/src/main/java/org/dromara/maxkey/persistence/service/impl/ReportServiceImpl.java

@@ -18,9 +18,10 @@
 package org.dromara.maxkey.persistence.service.impl;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
+import org.dromara.maxkey.entity.dto.InstDto;
 import org.dromara.maxkey.persistence.mapper.ReportMapper;
 import org.dromara.maxkey.persistence.service.ReportService;
 import org.dromara.mybatis.jpa.entity.JpaEntity;
@@ -31,64 +32,64 @@ import org.springframework.stereotype.Repository;
 public class ReportServiceImpl  extends JpaServiceImpl<ReportMapper,JpaEntity,String> implements ReportService{
 
     @Override
-    public Integer analysisDayCount(HashMap<String,Object> reportParameter) {
-        return getMapper().analysisDayCount(reportParameter);
+    public Integer analysisDayCount(InstDto inst) {
+        return getMapper().analysisDayCount(inst);
     }
     
     @Override
-    public Integer analysisNewUsers(HashMap<String,Object> reportParameter) {
-        return getMapper().analysisNewUsers(reportParameter);
+    public Integer analysisNewUsers(InstDto inst) {
+        return getMapper().analysisNewUsers(inst);
     }
     
     @Override
-    public Integer analysisOnlineUsers(HashMap<String,Object> reportParameter) {
-        return getMapper().analysisOnlineUsers(reportParameter);
+    public Integer analysisOnlineUsers(InstDto inst) {
+        return getMapper().analysisOnlineUsers(inst);
     }
     
     @Override
-    public Integer analysisActiveUsers(HashMap<String,Object> reportParameter) {
-        return getMapper().analysisActiveUsers(reportParameter);
+    public Integer analysisActiveUsers(InstDto inst) {
+        return getMapper().analysisActiveUsers(inst);
     }
     
     @Override
-    public Integer totalUsers(HashMap<String,Object> reportParameter) {
-        return getMapper().totalUsers(reportParameter);
+    public Integer totalUsers(InstDto inst) {
+        return getMapper().totalUsers(inst);
     }
     
     @Override
-    public Integer totalDepts(HashMap<String,Object> reportParameter) {
-        return getMapper().totalDepts(reportParameter);
+    public Integer totalDepts(InstDto inst) {
+        return getMapper().totalDepts(inst);
     }
     
     @Override
-    public Integer totalApps(HashMap<String,Object> reportParameter) {
-        return getMapper().totalApps(reportParameter);
+    public Integer totalApps(InstDto inst) {
+        return getMapper().totalApps(inst);
     }
     
     @Override
-    public List<Map<String,Object>> analysisDayHour(HashMap<String,Object> reportParameter){
-        return getMapper().analysisDayHour(reportParameter);
+    public List<Map<String,Object>> analysisDayHour(InstDto inst){
+        return getMapper().analysisDayHour(inst);
     }
     
     @Override
-    public List<Map<String,Object>> analysisMonth(HashMap<String,Object> reportParameter){
-        return getMapper().analysisMonth(reportParameter);
+    public List<Map<String,Object>> analysisMonth(InstDto inst){
+        return getMapper().analysisMonth(inst);
     }
     
     
     @Override
-    public List<Map<String,Object>> analysisBrowser(HashMap<String,Object> reportParameter){
-        return getMapper().analysisBrowser(reportParameter);
+    public List<Map<String,Object>> analysisBrowser(InstDto inst){
+        return getMapper().analysisBrowser(inst);
     }
     
     @Override
-    public List<Map<String,Object>> analysisApp(HashMap<String,Object> reportParameter){
-        return getMapper().analysisApp(reportParameter);
+    public List<Map<String,Object>> analysisApp(InstDto inst){
+        return getMapper().analysisApp(inst);
     }
     
     @Override
-    public List<Map<String,Object>> analysisProvince(HashMap<String,Object> reportParameter){
-        List<Map<String,Object>> maps = getMapper().analysisProvince(reportParameter);
+    public List<Map<String,Object>> analysisProvince(InstDto inst){
+        List<Map<String,Object>> maps = getMapper().analysisProvince(inst);
         if(null == maps) {
             return new ArrayList<>();
         }
@@ -111,18 +112,18 @@ public class ReportServiceImpl  extends JpaServiceImpl<ReportMapper,JpaEntity,St
     }
     
     @Override
-    public List<Map<String,Object>> analysisCountry(HashMap<String,Object> reportParameter){
-        return getMapper().analysisCountry(reportParameter);
+    public List<Map<String,Object>> analysisCountry(InstDto inst){
+        return getMapper().analysisCountry(inst);
     }
 
 	@Override
-	public Integer analysisMonthCount(HashMap<String, Object> reportParameter) {
-		return getMapper().analysisMonthCount(reportParameter);
+	public Integer analysisMonthCount(InstDto inst) {
+		return getMapper().analysisMonthCount(inst);
 	}
 
 	@Override
-	public Integer totalGroups(HashMap<String, Object> reportParameter) {
-		return getMapper().totalGroups(reportParameter);
+	public Integer totalGroups(InstDto inst) {
+		return getMapper().totalGroups(inst);
 	}
     
 }

+ 15 - 15
maxkey-persistence/src/main/resources/org/dromara/maxkey/persistence/mapper/xml/mysql/ReportMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.maxkey.persistence.mapper.ReportMapper" >
  	<!-- DAY  COUNT 一天访问量 -->
-	<select id="analysisDayCount" parameterType="java.util.HashMap" resultType="Integer">
+	<select id="analysisDayCount" parameterType="InstDto" resultType="Integer">
     	select 
     		count(id) reportcount
     	from mxk_history_login 
@@ -11,7 +11,7 @@
     </select>
     
     <!-- MONTH COUNT 一个月访问量 -->
-    <select id="analysisMonthCount" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisMonthCount" parameterType="InstDto" resultType="Integer">
     	select 
     		count(id) reportcount
     	from mxk_history_login 
@@ -20,7 +20,7 @@
     </select>
     
     <!-- 本月新用户统计 -->
-    <select id="analysisNewUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisNewUsers" parameterType="InstDto" resultType="Integer">
     	select 
 			count(*) reportcount 
 		from mxk_userinfo 
@@ -28,14 +28,14 @@
 		  and last_day(createddate) =last_day(curdate())
     </select>
     <!-- 在线用户统计 -->
-    <select id="analysisOnlineUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisOnlineUsers" parameterType="InstDto" resultType="Integer">
     	    select count(*) reportcount
         from mxk_history_login
         where instid = #{instId}
           and sessionstatus = 1
     </select>
     <!-- 30天活跃用户统计 -->
-    <select id="analysisActiveUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisActiveUsers" parameterType="InstDto" resultType="Integer">
     	select 
 			count(*) reportcount 
 		from mxk_userinfo 
@@ -44,7 +44,7 @@
     </select>
     
     <!-- DAY HOUR COUNT 当天每小时 -->
-	<select id="analysisDayHour" parameterType="java.util.HashMap" resultType="Map">
+	<select id="analysisDayHour" parameterType="InstDto" resultType="Map">
         select h.reportstring reportstring, ifnull(c.reportcount, 0) reportcount from (
             select 0  reportstring union all 
             select 1  reportstring union all 
@@ -80,7 +80,7 @@
     </select>
     
     <!-- 30 DAY COUNT 最近30天每天访问量-->   
-    <select id="analysisMonth" parameterType="java.util.HashMap" resultType="Map">
+    <select id="analysisMonth" parameterType="InstDto" resultType="Map">
     	select 
     		count(id) reportcount, 
 			DATE_FORMAT(logintime, '%Y-%m-%d') reportstring 
@@ -92,7 +92,7 @@
     </select>
     
     <!-- 30天浏览器的访问统计 -->
-    <select id="analysisBrowser" parameterType="java.util.HashMap" resultType="Map">
+    <select id="analysisBrowser" parameterType="InstDto" resultType="Map">
     	select 
     		count(id) reportcount, 
 			coalesce(browser,'Other') reportstring 
@@ -105,7 +105,7 @@
     </select>
     
     <!-- 30天应用单点登录的访问统计 -->
-	<select id="analysisApp" parameterType="Map" resultType="Map">
+	<select id="analysisApp" parameterType="InstDto" resultType="Map">
     	select 
 			count(id) reportcount,
 			appname 
@@ -117,7 +117,7 @@
     </select>
     
     <!-- 30天各省份的访问统计 -->
-	<select id="analysisProvince" parameterType="java.util.HashMap" resultType="Map">
+	<select id="analysisProvince" parameterType="InstDto" resultType="Map">
 		select
 			count(id) as reportcount,
 			coalesce(province,'Other') as reportstring
@@ -130,7 +130,7 @@
 			limit 1000
 	</select>
 	
-	<select id="analysisCountry" parameterType="java.util.HashMap" resultType="Map">
+	<select id="analysisCountry" parameterType="InstDto" resultType="Map">
 		select
 			count(id) as reportcount,
 			coalesce(country,'Other') as reportstring
@@ -144,7 +144,7 @@
 	</select>
 	
 	    <!-- 用户统计 -->
-    <select id="totalUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalUsers" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_userinfo 
@@ -153,7 +153,7 @@
     </select>
     
     <!-- 部门统计 -->
-    <select id="totalDepts" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalDepts" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_organizations 
@@ -162,7 +162,7 @@
     </select>
     
     <!-- 应用统计 -->
-    <select id="totalApps" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalApps" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_apps 
@@ -171,7 +171,7 @@
     </select>
     
     <!-- 部门统计 -->
-    <select id="totalGroups" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalGroups" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_groups 

+ 13 - 13
maxkey-persistence/src/main/resources/org/dromara/maxkey/persistence/mapper/xml/postgresql/ReportMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.maxkey.persistence.mapper.ReportMapper">
     <!-- DAY  COUNT 一天访问量 -->
-    <select id="analysisDayCount" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisDayCount" parameterType="InstDto" resultType="Integer">
         select count(id) reportcount
         from mxk_history_login
         where instid = #{instId}
@@ -10,7 +10,7 @@
     </select>
     
     <!-- MONTH COUNT 一个月访问量 -->
-    <select id="analysisMonthCount" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisMonthCount" parameterType="InstDto" resultType="Integer">
     	select 
     		count(id) reportcount
     	from mxk_history_login 
@@ -19,7 +19,7 @@
     </select>
     
     <!-- 本月新用户统计 -->
-    <select id="analysisNewUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisNewUsers" parameterType="InstDto" resultType="Integer">
         select count(*) reportcount
         from mxk_userinfo
         where instid = #{instId}
@@ -27,7 +27,7 @@
     </select>
     
     <!-- 在线用户统计 -->
-    <select id="analysisOnlineUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisOnlineUsers" parameterType="InstDto" resultType="Integer">
         select count(*) reportcount
         from mxk_history_login
         where instid = #{instId}
@@ -35,7 +35,7 @@
     </select>
     
     <!-- 30天活跃用户统计 -->
-    <select id="analysisActiveUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="analysisActiveUsers" parameterType="InstDto" resultType="Integer">
         select count(*) reportcount
         from mxk_userinfo
         where instid = #{instId}
@@ -43,7 +43,7 @@
     </select>
 
     <!-- DAY HOUR COUNT 当天每小时 -->
-    <select id="analysisDayHour" parameterType="java.util.HashMap" resultType="Map">
+    <select id="analysisDayHour" parameterType="InstDto" resultType="Map">
         select count(id) reportcount,
                to_char(logintime,'HH24') reportstring
         from mxk_history_login
@@ -53,7 +53,7 @@
         order by reportstring
     </select>
     <!-- 30 DAY COUNT 最近30天每天访问量-->
-    <select id="analysisMonth" parameterType="java.util.HashMap" resultType="Map">
+    <select id="analysisMonth" parameterType="InstDto" resultType="Map">
         select count(id) reportcount,
             date (logintime) reportstring
         from mxk_history_login
@@ -64,7 +64,7 @@
     </select>
 
     <!-- 30天浏览器的访问统计 -->
-    <select id="analysisBrowser" parameterType="java.util.HashMap" resultType="Map">
+    <select id="analysisBrowser" parameterType="InstDto" resultType="Map">
         select count(id)                  reportcount,
                coalesce(browser, 'Other') reportstring
         from mxk_history_login
@@ -75,7 +75,7 @@
     </select>
 
     <!-- 30天应用单点登录的访问统计 -->
-    <select id="analysisApp" parameterType="Map" resultType="Map">
+    <select id="analysisApp" parameterType="InstDto" resultType="Map">
         select count(id) reportcount,
                appname
         from mxk_history_login_apps
@@ -86,7 +86,7 @@
     </select>
 
     <!-- 用户统计 -->
-    <select id="totalUsers" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalUsers" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_userinfo 
@@ -95,7 +95,7 @@
     </select>
     
     <!-- 部门统计 -->
-    <select id="totalDepts" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalDepts" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_organizations 
@@ -104,7 +104,7 @@
     </select>
     
     <!-- 应用统计 -->
-    <select id="totalApps" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalApps" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_apps 
@@ -113,7 +113,7 @@
     </select>
     
     <!-- 部门统计 -->
-    <select id="totalGroups" parameterType="java.util.HashMap" resultType="Integer">
+    <select id="totalGroups" parameterType="InstDto" resultType="Integer">
             select 
                 count(*) reportcount 
             from mxk_groups 

+ 1 - 0
maxkey-starter/maxkey-starter-web/src/main/java/org/dromara/maxkey/autoconfigure/MvcAutoConfiguration.java

@@ -122,6 +122,7 @@ public class MvcAutoConfiguration implements WebMvcConfigurer {
         Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
         //xml entity mapper
         //jaxb2Marshaller.setClassesToBeBound(org.dromara.maxkey.entity.xml.UserInfoXML.class);
+        jaxb2Marshaller.setPackagesToScan("org.dromara.maxkey");
         return jaxb2Marshaller;
     }
 

+ 22 - 23
maxkey-webs/maxkey-web-mgt/src/main/java/org/dromara/maxkey/web/controller/DashboardController.java

@@ -17,10 +17,10 @@
 
 package org.dromara.maxkey.web.controller;
 
-import java.util.HashMap;
-
 import org.dromara.maxkey.authn.annotation.CurrentUser;
 import org.dromara.maxkey.entity.Message;
+import org.dromara.maxkey.entity.dto.DashboardVo;
+import org.dromara.maxkey.entity.dto.InstDto;
 import org.dromara.maxkey.entity.idm.UserInfo;
 import org.dromara.maxkey.persistence.service.ReportService;
 import org.slf4j.Logger;
@@ -42,36 +42,35 @@ public class DashboardController {
     ReportService reportService;
 
     @GetMapping(value={"/dashboard"})
-    public Message<?> dashboard(@CurrentUser UserInfo currentUser) {
+    public Message<DashboardVo> dashboard(@CurrentUser UserInfo currentUser) {
         logger.debug("dashboard . ");
-        HashMap<String,Object> requestParameter = new HashMap<>();
-        requestParameter.put("instId", currentUser.getInstId());
         
-        HashMap<String,Object> reportParameter = new HashMap<>();
-        reportParameter.put("instId", currentUser.getInstId());
-        reportParameter.put("dayCount", reportService.analysisDayCount(requestParameter));
-        reportParameter.put("monthCount", reportService.analysisMonthCount(requestParameter));
-        reportParameter.put("newUsers", reportService.analysisNewUsers(requestParameter));
+        InstDto inst = new InstDto(currentUser.getInstId());
+        
+        DashboardVo dbVo = new DashboardVo(currentUser.getInstId());
+        dbVo.setDayCount(reportService.analysisDayCount(inst));
+        dbVo.setMonthCount(reportService.analysisMonthCount(inst));
+        dbVo.setNewUsers(reportService.analysisNewUsers(inst));
         
-        reportParameter.put("onlineUsers", reportService.analysisOnlineUsers(requestParameter));
-        reportParameter.put("activeUsers", reportService.analysisActiveUsers(requestParameter));
+        dbVo.setOnlineUsers(reportService.analysisOnlineUsers(inst));
+        dbVo.setActiveUsers(reportService.analysisActiveUsers(inst));
         
-        reportParameter.put("totalUsers", reportService.totalUsers(requestParameter));
-        reportParameter.put("totalDepts", reportService.totalDepts(requestParameter));
-        reportParameter.put("totalApps", reportService.totalApps(requestParameter));
-        reportParameter.put("totalGroups", reportService.totalGroups(requestParameter));
+        dbVo.setTotalUsers(reportService.totalUsers(inst));
+        dbVo.setTotalDepts(reportService.totalDepts(inst));
+        dbVo.setTotalApps(reportService.totalApps(inst));
+        dbVo.setTotalGroups(reportService.totalGroups(inst));
         
-        reportParameter.put("reportMonth", reportService.analysisMonth(requestParameter));
-        reportParameter.put("reportDayHour", reportService.analysisDayHour(requestParameter));
+        dbVo.setReportMonth(reportService.analysisMonth(inst));
+        dbVo.setReportDayHour(reportService.analysisDayHour(inst));
         
-        reportParameter.put("reportProvince", reportService.analysisProvince(requestParameter));
+        dbVo.setReportProvince(reportService.analysisProvince(inst));
         
-        reportParameter.put("reportCountry", reportService.analysisCountry(requestParameter));
+        dbVo.setReportCountry(reportService.analysisCountry(inst));
         
-        reportParameter.put("reportBrowser", reportService.analysisBrowser(requestParameter));
+        dbVo.setReportBrowser(reportService.analysisBrowser(inst));
         
-        reportParameter.put("reportApp", reportService.analysisApp(requestParameter));
-        return new Message<>(reportParameter);
+        dbVo.setReportApp(reportService.analysisApp(inst));
+        return new Message<>(dbVo);
     }
 
 }