mirror of
https://gitee.com/lijiahangmax/orion-ops.git
synced 2026-09-24 15:30:00 +08:00
home statistics add pipeline count.
This commit is contained in:
@@ -2,10 +2,7 @@ package com.orion.ops.controller;
|
||||
|
||||
import com.orion.ops.annotation.IgnoreLog;
|
||||
import com.orion.ops.annotation.RestWrapper;
|
||||
import com.orion.ops.entity.request.AppBuildStatisticsRequest;
|
||||
import com.orion.ops.entity.request.AppPipelineTaskStatisticsRequest;
|
||||
import com.orion.ops.entity.request.AppReleaseStatisticsRequest;
|
||||
import com.orion.ops.entity.request.SchedulerTaskStatisticsRequest;
|
||||
import com.orion.ops.entity.request.*;
|
||||
import com.orion.ops.entity.vo.*;
|
||||
import com.orion.ops.service.api.StatisticsService;
|
||||
import com.orion.ops.utils.Valid;
|
||||
@@ -35,8 +32,8 @@ public class StatisticsController {
|
||||
* 首页统计
|
||||
*/
|
||||
@RequestMapping("/home")
|
||||
public HomeStatisticsVO homeStatistics() {
|
||||
return statisticsService.homeStatistics();
|
||||
public HomeStatisticsVO homeStatistics(@RequestBody HomeStatisticsRequest request) {
|
||||
return statisticsService.homeStatistics(request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@ public class StatisticsCountDTO {
|
||||
private Integer appCount;
|
||||
|
||||
/**
|
||||
* 日志数量
|
||||
* 流水线数量
|
||||
*/
|
||||
private Integer logCount;
|
||||
private Integer pipelineCount;
|
||||
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.orion.ops.entity.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 主页统计
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2022/5/25 16:34
|
||||
*/
|
||||
@Data
|
||||
public class HomeStatisticsRequest {
|
||||
|
||||
/**
|
||||
* profileId
|
||||
*/
|
||||
private Long profileId;
|
||||
|
||||
}
|
||||
@@ -30,9 +30,9 @@ public class HomeStatisticsCountVO {
|
||||
private Integer appCount;
|
||||
|
||||
/**
|
||||
* 日志数量
|
||||
* 流水线数量
|
||||
*/
|
||||
private Integer logCount;
|
||||
private Integer pipelineCount;
|
||||
|
||||
static {
|
||||
TypeStore.STORE.register(StatisticsCountDTO.class, HomeStatisticsCountVO.class, p -> {
|
||||
@@ -40,7 +40,7 @@ public class HomeStatisticsCountVO {
|
||||
vo.setMachineCount(p.getMachineCount());
|
||||
vo.setProfileCount(p.getProfileCount());
|
||||
vo.setAppCount(p.getAppCount());
|
||||
vo.setLogCount(p.getLogCount());
|
||||
vo.setPipelineCount(p.getPipelineCount());
|
||||
return vo;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.orion.ops.service.api;
|
||||
|
||||
import com.orion.ops.entity.request.HomeStatisticsRequest;
|
||||
import com.orion.ops.entity.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -16,9 +17,10 @@ public interface StatisticsService {
|
||||
/**
|
||||
* 获取首页统计信息
|
||||
*
|
||||
* @param request request
|
||||
* @return 统计信息
|
||||
*/
|
||||
HomeStatisticsVO homeStatistics();
|
||||
HomeStatisticsVO homeStatistics(HomeStatisticsRequest request);
|
||||
|
||||
/**
|
||||
* 获取调度任务统计
|
||||
|
||||
+11
-7
@@ -8,6 +8,7 @@ import com.orion.ops.consts.system.SystemEnvAttr;
|
||||
import com.orion.ops.dao.*;
|
||||
import com.orion.ops.entity.domain.*;
|
||||
import com.orion.ops.entity.dto.*;
|
||||
import com.orion.ops.entity.request.HomeStatisticsRequest;
|
||||
import com.orion.ops.entity.vo.*;
|
||||
import com.orion.ops.service.api.*;
|
||||
import com.orion.ops.utils.Utils;
|
||||
@@ -45,7 +46,7 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
private ApplicationInfoDAO applicationInfoDAO;
|
||||
|
||||
@Resource
|
||||
private FileTailListDAO fileTailListDAO;
|
||||
private ApplicationPipelineDAO applicationPipelineDAO;
|
||||
|
||||
@Resource
|
||||
private SchedulerTaskRecordDAO schedulerTaskRecordDAO;
|
||||
@@ -78,10 +79,10 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Override
|
||||
public HomeStatisticsVO homeStatistics() {
|
||||
public HomeStatisticsVO homeStatistics(HomeStatisticsRequest request) {
|
||||
HomeStatisticsVO statistics = new HomeStatisticsVO();
|
||||
// 设置数量
|
||||
HomeStatisticsCountVO count = this.homeCountStatistics();
|
||||
HomeStatisticsCountVO count = this.homeCountStatistics(request.getProfileId());
|
||||
statistics.setCount(count);
|
||||
return statistics;
|
||||
}
|
||||
@@ -89,9 +90,10 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
/**
|
||||
* 获取首页统计数量
|
||||
*
|
||||
* @param profileId profileId
|
||||
* @return 首页统计
|
||||
*/
|
||||
private HomeStatisticsCountVO homeCountStatistics() {
|
||||
private HomeStatisticsCountVO homeCountStatistics(Long profileId) {
|
||||
StatisticsCountDTO count;
|
||||
// 查询缓存
|
||||
String countCache = redisTemplate.opsForValue().get(KeyConst.HOME_STATISTICS_COUNT_KEY);
|
||||
@@ -103,13 +105,15 @@ public class StatisticsServiceImpl implements StatisticsService {
|
||||
Integer profileCount = applicationProfileDAO.selectCount(null);
|
||||
// 查询应用数量
|
||||
Integer appCount = applicationInfoDAO.selectCount(null);
|
||||
// 查询日志数量
|
||||
Integer logCount = fileTailListDAO.selectCount(null);
|
||||
// 查询流水线数量
|
||||
LambdaQueryWrapper<ApplicationPipelineDO> pipelineWrapper = new LambdaQueryWrapper<ApplicationPipelineDO>()
|
||||
.eq(ApplicationPipelineDO::getProfileId, profileId);
|
||||
Integer pipelineCount = applicationPipelineDAO.selectCount(pipelineWrapper);
|
||||
// 设置缓存
|
||||
count.setMachineCount(machineCount);
|
||||
count.setProfileCount(profileCount);
|
||||
count.setAppCount(appCount);
|
||||
count.setLogCount(logCount);
|
||||
count.setPipelineCount(pipelineCount);
|
||||
redisTemplate.opsForValue().set(KeyConst.HOME_STATISTICS_COUNT_KEY, JSON.toJSONString(count),
|
||||
Integer.parseInt(SystemEnvAttr.STATISTICS_CACHE_EXPIRE.getValue()), TimeUnit.MINUTES);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user