Rename statistics to statistic
This commit is contained in:
@@ -6,21 +6,21 @@ import org.springframework.web.bind.annotation.GetMapping
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping
|
import org.springframework.web.bind.annotation.RequestMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
import top.fatweb.api.entity.common.ResponseResult
|
import top.fatweb.api.entity.common.ResponseResult
|
||||||
import top.fatweb.api.service.system.IStatisticsService
|
import top.fatweb.api.service.system.IStatisticService
|
||||||
import top.fatweb.api.vo.system.*
|
import top.fatweb.api.vo.system.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Statistics controller
|
* Statistic controller
|
||||||
*
|
*
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @see IStatisticsService
|
* @see IStatisticService
|
||||||
*/
|
*/
|
||||||
@Tag(name = "统计接口", description = "系统信息统计相关接口")
|
@Tag(name = "统计接口", description = "系统信息统计相关接口")
|
||||||
@RequestMapping("/system/statistics")
|
@RequestMapping("/system/statistic")
|
||||||
@RestController
|
@RestController
|
||||||
class StatisticsController(
|
class StatisticController(
|
||||||
private val statisticsService: IStatisticsService
|
private val statisticService: IStatisticService
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Get software information
|
* Get software information
|
||||||
@@ -33,7 +33,7 @@ class StatisticsController(
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "获取软件信息")
|
@Operation(summary = "获取软件信息")
|
||||||
@GetMapping("/software")
|
@GetMapping("/software")
|
||||||
fun software(): ResponseResult<SoftwareInfoVo> = ResponseResult.success(data = statisticsService.software())
|
fun software(): ResponseResult<SoftwareInfoVo> = ResponseResult.success(data = statisticService.software())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hardware information
|
* Get hardware information
|
||||||
@@ -46,7 +46,7 @@ class StatisticsController(
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "获取硬件信息")
|
@Operation(summary = "获取硬件信息")
|
||||||
@GetMapping("/hardware")
|
@GetMapping("/hardware")
|
||||||
fun hardware(): ResponseResult<HardwareInfoVo> = ResponseResult.success(data = statisticsService.hardware())
|
fun hardware(): ResponseResult<HardwareInfoVo> = ResponseResult.success(data = statisticService.hardware())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get CPU information
|
* Get CPU information
|
||||||
@@ -59,7 +59,7 @@ class StatisticsController(
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "获取 CPU 信息")
|
@Operation(summary = "获取 CPU 信息")
|
||||||
@GetMapping("/cpu")
|
@GetMapping("/cpu")
|
||||||
fun cpu(): ResponseResult<CpuInfoVo> = ResponseResult.success(data = statisticsService.cpu())
|
fun cpu(): ResponseResult<CpuInfoVo> = ResponseResult.success(data = statisticService.cpu())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get storage information
|
* Get storage information
|
||||||
@@ -72,5 +72,5 @@ class StatisticsController(
|
|||||||
*/
|
*/
|
||||||
@Operation(summary = "获取存储信息")
|
@Operation(summary = "获取存储信息")
|
||||||
@GetMapping("/storage")
|
@GetMapping("/storage")
|
||||||
fun storage(): ResponseResult<StorageInfoVo> = ResponseResult.success(data = statisticsService.storage())
|
fun storage(): ResponseResult<StorageInfoVo> = ResponseResult.success(data = statisticService.storage())
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,12 @@ package top.fatweb.api.service.system
|
|||||||
import top.fatweb.api.vo.system.*
|
import top.fatweb.api.vo.system.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Statistics service interface
|
* Statistic service interface
|
||||||
*
|
*
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
interface IStatisticsService {
|
interface IStatisticService {
|
||||||
/**
|
/**
|
||||||
* Get software information
|
* Get software information
|
||||||
*
|
*
|
||||||
@@ -4,7 +4,7 @@ import org.springframework.stereotype.Service
|
|||||||
import oshi.SystemInfo
|
import oshi.SystemInfo
|
||||||
import oshi.hardware.CentralProcessor
|
import oshi.hardware.CentralProcessor
|
||||||
import top.fatweb.api.properties.ServerProperties
|
import top.fatweb.api.properties.ServerProperties
|
||||||
import top.fatweb.api.service.system.IStatisticsService
|
import top.fatweb.api.service.system.IStatisticService
|
||||||
import top.fatweb.api.util.ByteUtil
|
import top.fatweb.api.util.ByteUtil
|
||||||
import top.fatweb.api.vo.system.*
|
import top.fatweb.api.vo.system.*
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
@@ -13,13 +13,13 @@ import java.util.*
|
|||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Statistics service implement
|
* Statistic service implement
|
||||||
*
|
*
|
||||||
* @author FatttSnake, fatttsnake@gmail.com
|
* @author FatttSnake, fatttsnake@gmail.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
class StatisticsServiceImpl : IStatisticsService {
|
class StatisticServiceImpl : IStatisticService {
|
||||||
private val systemProperties: Properties = System.getProperties()
|
private val systemProperties: Properties = System.getProperties()
|
||||||
private val systemInfo: SystemInfo = SystemInfo()
|
private val systemInfo: SystemInfo = SystemInfo()
|
||||||
private val runtime: Runtime = Runtime.getRuntime()
|
private val runtime: Runtime = Runtime.getRuntime()
|
||||||
Reference in New Issue
Block a user