use of com.orion.ops.entity.dto.StatisticCountDTO in project orion-ops by lijiahangmax.
the class StatisticsServiceImpl method homeStatisticsCount.
/**
* 获取首页统计数量
*
* @return 首页统计
*/
private StatisticCountVO homeStatisticsCount() {
StatisticCountDTO count;
// 查询缓存
String countCache = redisTemplate.opsForValue().get(KeyConst.HOME_STATISTICS_COUNT_KEY);
if (Strings.isBlank(countCache)) {
count = new StatisticCountDTO();
// 查询机器数量
Integer machineCount = machineInfoDAO.selectCount(null);
// 查询环境数量
Integer profileCount = applicationProfileDAO.selectCount(null);
// 查询应用数量
Integer appCount = applicationInfoDAO.selectCount(null);
// 查询日志数量
Integer logCount = fileTailListDAO.selectCount(null);
// 设置缓存
count.setMachineCount(machineCount);
count.setProfileCount(profileCount);
count.setAppCount(appCount);
count.setLogCount(logCount);
redisTemplate.opsForValue().set(KeyConst.HOME_STATISTICS_COUNT_KEY, JSON.toJSONString(count), Integer.parseInt(SystemEnvAttr.STATISTICS_CACHE_EXPIRE.getValue()), TimeUnit.MINUTES);
} else {
count = JSON.parseObject(countCache, StatisticCountDTO.class);
}
return Converts.to(count, StatisticCountVO.class);
}
Aggregations