mirror of https://gitee.com/stylefeng/roses
【7.1.6】【statistics】整理
parent
fd81ea7e5e
commit
9d05f8981b
|
@ -106,6 +106,12 @@
|
||||||
<version>${roses.version}</version>
|
<version>${roses.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>system-business-menu</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,13 +1,13 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.aop;
|
package cn.stylefeng.roses.kernel.system.modular.home.aop;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
||||||
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||||
import cn.stylefeng.roses.kernel.system.api.constants.StatisticsCacheConstants;
|
import cn.stylefeng.roses.kernel.system.api.constants.StatisticsCacheConstants;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.context.StatisticsUrlContext;
|
import cn.stylefeng.roses.kernel.system.modular.home.context.StatisticsUrlContext;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsUrl;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsCountService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsCountService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
import org.aspectj.lang.annotation.Around;
|
import org.aspectj.lang.annotation.Around;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.cache;
|
package cn.stylefeng.roses.kernel.system.modular.home.cache;
|
||||||
|
|
||||||
import cn.hutool.cache.impl.TimedCache;
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
|
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.cache;
|
package cn.stylefeng.roses.kernel.system.modular.home.cache;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
|
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
|
||||||
import cn.stylefeng.roses.kernel.system.api.constants.StatisticsCacheConstants;
|
import cn.stylefeng.roses.kernel.system.api.constants.StatisticsCacheConstants;
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.context;
|
package cn.stylefeng.roses.kernel.system.modular.home.context;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsUrl;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsUrlService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsUrlService;
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
|
@ -7,7 +7,10 @@ import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
||||||
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.OnlineUserDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -68,7 +71,7 @@ public class HomePageController {
|
||||||
* @date 2022/2/10 11:34
|
* @date 2022/2/10 11:34
|
||||||
*/
|
*/
|
||||||
@GetResource(name = "获取常用功能接口", path = "/homePage/getCommonFunctions")
|
@GetResource(name = "获取常用功能接口", path = "/homePage/getCommonFunctions")
|
||||||
public ResponseData<List<ResourceRequest>> getCommonFunctions() {
|
public ResponseData<List<SysMenu>> getCommonFunctions() {
|
||||||
return new SuccessResponseData<>(homePageService.getCommonFunctions());
|
return new SuccessResponseData<>(homePageService.getCommonFunctions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.controller;
|
package cn.stylefeng.roses.kernel.system.modular.home.controller;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request.SysStatisticsCountRequest;
|
import cn.stylefeng.roses.kernel.system.modular.home.pojo.request.SysStatisticsCountRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsCountService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsCountService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@ -1,50 +0,0 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.home.entity;
|
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
|
||||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口统计实体
|
|
||||||
*
|
|
||||||
* @author xixiaowei
|
|
||||||
* @date 2022/2/10 9:59
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("interface_statistics")
|
|
||||||
public class InterfaceStatistics extends BaseEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "statistics_id", type = IdType.ASSIGN_ID)
|
|
||||||
@ChineseDescription("主键ID")
|
|
||||||
private Long statisticsId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口名称
|
|
||||||
*/
|
|
||||||
@TableField("interface_name")
|
|
||||||
@ChineseDescription("接口名称")
|
|
||||||
private String interfaceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口路径
|
|
||||||
*/
|
|
||||||
@TableField("interface_url")
|
|
||||||
@ChineseDescription("接口路径")
|
|
||||||
private String interfaceUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 访问次数
|
|
||||||
*/
|
|
||||||
@TableField("request_count")
|
|
||||||
@ChineseDescription("访问次数")
|
|
||||||
private Integer requestCount;
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.entity;
|
package cn.stylefeng.roses.kernel.system.modular.home.entity;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.entity;
|
package cn.stylefeng.roses.kernel.system.modular.home.entity;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.enums;
|
package cn.stylefeng.roses.kernel.system.modular.home.enums;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.enums;
|
package cn.stylefeng.roses.kernel.system.modular.home.enums;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
|
@ -1,14 +0,0 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.home.mapper;
|
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.entity.InterfaceStatistics;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接口统计mapper接口
|
|
||||||
*
|
|
||||||
* @author xixiaowei
|
|
||||||
* @date 2022/2/10 10:08
|
|
||||||
*/
|
|
||||||
public interface InterfaceStatisticsMapper extends BaseMapper<InterfaceStatistics> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.mapper;
|
package cn.stylefeng.roses.kernel.system.modular.home.mapper;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsCount;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsCount;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,6 +1,6 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.mapper;
|
package cn.stylefeng.roses.kernel.system.modular.home.mapper;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsUrl;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="cn.stylefeng.roses.kernel.system.modular.home.mapper.InterfaceStatisticsMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request;
|
package cn.stylefeng.roses.kernel.system.modular.home.pojo.request;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request;
|
package cn.stylefeng.roses.kernel.system.modular.home.pojo.request;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
|
@ -2,11 +2,14 @@ package cn.stylefeng.roses.kernel.system.modular.home.service;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.log.api.pojo.record.LogRecordDTO;
|
import cn.stylefeng.roses.kernel.log.api.pojo.record.LogRecordDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
||||||
|
import cn.stylefeng.roses.kernel.system.api.pojo.menu.antd.AntdSysMenuDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
||||||
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.OnlineUserDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.entity.InterfaceStatistics;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.InterfaceStatistics;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,7 +19,7 @@ import java.util.List;
|
||||||
* @author xixiaowei
|
* @author xixiaowei
|
||||||
* @date 2022/1/25 9:43
|
* @date 2022/1/25 9:43
|
||||||
*/
|
*/
|
||||||
public interface HomePageService extends IService<InterfaceStatistics> {
|
public interface HomePageService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询动态列表
|
* 查询动态列表
|
||||||
|
@ -48,7 +51,7 @@ public interface HomePageService extends IService<InterfaceStatistics> {
|
||||||
* @author xixiaowei
|
* @author xixiaowei
|
||||||
* @date 2022/2/10 11:19
|
* @date 2022/2/10 11:19
|
||||||
*/
|
*/
|
||||||
List<ResourceRequest> getCommonFunctions();
|
List<SysMenu> getCommonFunctions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据统计
|
* 数据统计
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.service;
|
package cn.stylefeng.roses.kernel.system.modular.home.service;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsCount;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsCount;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request.SysStatisticsCountRequest;
|
import cn.stylefeng.roses.kernel.system.modular.home.pojo.request.SysStatisticsCountRequest;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,8 +1,8 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.service;
|
package cn.stylefeng.roses.kernel.system.modular.home.service;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsUrl;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request.SysStatisticsUrlRequest;
|
import cn.stylefeng.roses.kernel.system.modular.home.pojo.request.SysStatisticsUrlRequest;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.home.service.Impl;
|
package cn.stylefeng.roses.kernel.system.modular.home.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -13,14 +13,19 @@ import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceDefinition;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceUrlParam;
|
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceUrlParam;
|
||||||
import cn.stylefeng.roses.kernel.system.api.*;
|
import cn.stylefeng.roses.kernel.system.api.*;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
import cn.stylefeng.roses.kernel.system.api.pojo.home.HomeCompanyInfo;
|
||||||
|
import cn.stylefeng.roses.kernel.system.api.pojo.menu.antd.AntdSysMenuDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationDTO;
|
import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.resource.ResourceRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.user.OnlineUserDTO;
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.OnlineUserDTO;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.OnlineUserRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.SysUserRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.user.request.SysUserRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.entity.InterfaceStatistics;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.mapper.InterfaceStatisticsMapper;
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsCount;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsCountService;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsUrlService;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.menu.entity.SysMenu;
|
||||||
|
import cn.stylefeng.roses.kernel.system.modular.menu.service.SysMenuService;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsCount;
|
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsCount;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.OnlineUserStat;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsCountService;
|
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsCountService;
|
||||||
|
@ -31,6 +36,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.Year;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -41,7 +51,7 @@ import java.util.stream.Collectors;
|
||||||
* @date 2022/1/25 9:45
|
* @date 2022/1/25 9:45
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class HomePageServiceImpl extends ServiceImpl<InterfaceStatisticsMapper, InterfaceStatistics> implements HomePageService, HomePageServiceApi {
|
public class HomePageServiceImpl implements HomePageService, HomePageServiceApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private LogManagerApi logManagerApi;
|
private LogManagerApi logManagerApi;
|
||||||
|
@ -67,6 +77,12 @@ public class HomePageServiceImpl extends ServiceImpl<InterfaceStatisticsMapper,
|
||||||
@Resource
|
@Resource
|
||||||
private SysStatisticsCountService sysStatisticsCountService;
|
private SysStatisticsCountService sysStatisticsCountService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysStatisticsUrlService sysStatisticsUrlService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysMenuService sysMenuService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LogRecordDTO> getRecentLogs() {
|
public List<LogRecordDTO> getRecentLogs() {
|
||||||
|
|
||||||
|
@ -143,22 +159,24 @@ public class HomePageServiceImpl extends ServiceImpl<InterfaceStatisticsMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ResourceRequest> getCommonFunctions() {
|
public List<SysMenu> getCommonFunctions() {
|
||||||
// 获取当前用户
|
List<SysStatisticsCount> sysStatisticsCounts = sysStatisticsCountService.list(Wrappers.<SysStatisticsCount>lambdaQuery().orderByDesc(SysStatisticsCount::getStatCount));
|
||||||
Long userId = LoginContext.me().getLoginUser().getUserId();
|
List<Long> statUrlIds = sysStatisticsCounts.stream().map(SysStatisticsCount::getStatUrlId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<InterfaceStatistics> interfaceStatisticsList = this.list(Wrappers.<InterfaceStatistics>lambdaQuery().eq(InterfaceStatistics::getCreateUser, userId));
|
// 菜单ID集合
|
||||||
|
List<String> statMenuIds = new ArrayList<>();
|
||||||
List<ResourceRequest> resourceRequestList = new ArrayList<>();
|
for (Long statUrlId : statUrlIds) {
|
||||||
for (InterfaceStatistics interfaceStatistics : interfaceStatisticsList) {
|
SysStatisticsUrl sysStatisticsUrl = sysStatisticsUrlService.getOne(Wrappers.<SysStatisticsUrl>lambdaQuery().eq(SysStatisticsUrl::getStatUrl, statUrlId));
|
||||||
ResourceUrlParam resourceUrlParam = new ResourceUrlParam();
|
String statMenuId = sysStatisticsUrl.getStatMenuId();
|
||||||
resourceUrlParam.setUrl(interfaceStatistics.getInterfaceUrl());
|
statMenuIds.add(statMenuId);
|
||||||
ResourceDefinition apiResourceByUrl = resourceServiceApi.getResourceByUrl(resourceUrlParam);
|
|
||||||
ResourceRequest resourceRequest = new ResourceRequest();
|
|
||||||
BeanUtil.copyProperties(apiResourceByUrl, resourceRequest);
|
|
||||||
resourceRequestList.add(resourceRequest);
|
|
||||||
}
|
}
|
||||||
return resourceRequestList;
|
|
||||||
|
List<SysMenu> sysMenuList = new ArrayList<>();
|
||||||
|
for (String statMenuId : statMenuIds) {
|
||||||
|
SysMenu sysMenu = sysMenuService.getOne(Wrappers.<SysMenu>lambdaQuery().eq(SysMenu::getMenuId, statMenuId));
|
||||||
|
sysMenuList.add(sysMenu);
|
||||||
|
}
|
||||||
|
return sysMenuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,10 +184,22 @@ public class HomePageServiceImpl extends ServiceImpl<InterfaceStatisticsMapper,
|
||||||
// key是用户id,value的key是statUrlId,最后的value是次数
|
// key是用户id,value的key是statUrlId,最后的value是次数
|
||||||
Map<String, Map<Long, Integer>> userRequestStats = requestCountCacheApi.getAllKeyValues();
|
Map<String, Map<Long, Integer>> userRequestStats = requestCountCacheApi.getAllKeyValues();
|
||||||
|
|
||||||
// todo
|
|
||||||
ArrayList<SysStatisticsCount> sysStatisticsCounts = new ArrayList<>();
|
ArrayList<SysStatisticsCount> sysStatisticsCounts = new ArrayList<>();
|
||||||
|
// 遍历填充数据
|
||||||
|
for (String userId : userRequestStats.keySet()) {
|
||||||
|
SysStatisticsCount sysStatisticsCount = new SysStatisticsCount();
|
||||||
|
sysStatisticsCount.setUserId(Long.valueOf(userId));
|
||||||
|
Map<Long, Integer> map = userRequestStats.get(userId);
|
||||||
|
for (Long statUrlId : map.keySet()) {
|
||||||
|
sysStatisticsCount.setStatUrlId(statUrlId);
|
||||||
|
sysStatisticsCount.setStatCount(map.get(statUrlId));
|
||||||
|
}
|
||||||
|
|
||||||
// todo
|
// 存放到集合中
|
||||||
|
sysStatisticsCounts.add(sysStatisticsCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量存入数据库
|
||||||
this.sysStatisticsCountService.saveBatch(sysStatisticsCounts);
|
this.sysStatisticsCountService.saveBatch(sysStatisticsCounts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.service.impl;
|
package cn.stylefeng.roses.kernel.system.modular.home.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -7,11 +7,11 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException;
|
import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsCount;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsCount;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.enums.SysStatisticsCountExceptionEnum;
|
import cn.stylefeng.roses.kernel.system.modular.home.enums.SysStatisticsCountExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.mapper.SysStatisticsCountMapper;
|
import cn.stylefeng.roses.kernel.system.modular.home.mapper.SysStatisticsCountMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request.SysStatisticsCountRequest;
|
import cn.stylefeng.roses.kernel.system.modular.home.pojo.request.SysStatisticsCountRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsCountService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsCountService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.service.impl;
|
package cn.stylefeng.roses.kernel.system.modular.home.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -6,11 +6,11 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.entity.SysStatisticsUrl;
|
import cn.stylefeng.roses.kernel.system.modular.home.entity.SysStatisticsUrl;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.enums.SysStatisticsUrlExceptionEnum;
|
import cn.stylefeng.roses.kernel.system.modular.home.enums.SysStatisticsUrlExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.mapper.SysStatisticsUrlMapper;
|
import cn.stylefeng.roses.kernel.system.modular.home.mapper.SysStatisticsUrlMapper;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.pojo.request.SysStatisticsUrlRequest;
|
import cn.stylefeng.roses.kernel.system.modular.home.pojo.request.SysStatisticsUrlRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.service.SysStatisticsUrlService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.SysStatisticsUrlService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.stylefeng.roses.kernel.system.modular.statistic.timer;
|
package cn.stylefeng.roses.kernel.system.modular.home.timer;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
import cn.stylefeng.roses.kernel.system.modular.home.service.HomePageService;
|
||||||
import cn.stylefeng.roses.kernel.timer.api.TimerAction;
|
import cn.stylefeng.roses.kernel.timer.api.TimerAction;
|
|
@ -35,7 +35,7 @@ import cn.stylefeng.roses.kernel.system.modular.role.cache.RoleDataScopeMemoryCa
|
||||||
import cn.stylefeng.roses.kernel.system.modular.role.cache.RoleMemoryCache;
|
import cn.stylefeng.roses.kernel.system.modular.role.cache.RoleMemoryCache;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.role.cache.RoleResourceMemoryCache;
|
import cn.stylefeng.roses.kernel.system.modular.role.cache.RoleResourceMemoryCache;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.role.entity.SysRole;
|
import cn.stylefeng.roses.kernel.system.modular.role.entity.SysRole;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.cache.InterfaceStatisticsMemoryCache;
|
import cn.stylefeng.roses.kernel.system.modular.home.cache.InterfaceStatisticsMemoryCache;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.theme.cache.ThemeMemoryCache;
|
import cn.stylefeng.roses.kernel.system.modular.theme.cache.ThemeMemoryCache;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.theme.pojo.DefaultTheme;
|
import cn.stylefeng.roses.kernel.system.modular.theme.pojo.DefaultTheme;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.user.cache.SysUserMemoryCache;
|
import cn.stylefeng.roses.kernel.system.modular.user.cache.SysUserMemoryCache;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.system.starter;
|
package cn.stylefeng.roses.kernel.system.starter;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.aop.InterfaceStatisticsAop;
|
import cn.stylefeng.roses.kernel.system.modular.home.aop.InterfaceStatisticsAop;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.statistic.timer.InterfaceStatisticsTimer;
|
import cn.stylefeng.roses.kernel.system.modular.home.timer.InterfaceStatisticsTimer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue