Refactor:2 #21

Merged
FatttSnake merged 2 commits from FatttSnake into dev 2024-04-22 15:19:19 +08:00
3 changed files with 19 additions and 13 deletions

View File

@@ -20,14 +20,14 @@ data class ActiveInfoGetParam(
*/ */
@Schema( @Schema(
description = "范围", description = "范围",
allowableValues = ["WEAK", "MONTH", "QUARTER", "YEAR", "TWO_YEARS", "THREE_YEARS", "FIVE_YEARS", "ALL"], allowableValues = ["WEEK", "MONTH", "QUARTER", "YEAR", "TWO_YEARS", "THREE_YEARS", "FIVE_YEARS", "ALL"],
defaultValue = "WEAK", defaultValue = "WEEK",
example = "WEAK" example = "WEEK"
) )
val scope: Scope = Scope.WEAK val scope: Scope = Scope.WEEK
) { ) {
enum class Scope(@field:EnumValue @field:JsonValue val code: String) { enum class Scope(@field:EnumValue @field:JsonValue val code: String) {
WEAK("WEAK"), WEEK("WEEK"),
MONTH("MONTH"), MONTH("MONTH"),

View File

@@ -20,16 +20,16 @@ data class OnlineInfoGetParam(
*/ */
@Schema( @Schema(
description = "范围", description = "范围",
allowableValues = ["WEAK", "MONTH", "QUARTER", "YEAR", "TWO_YEARS", "THREE_YEARS", "FIVE_YEARS", "ALL"], allowableValues = ["WEEK", "MONTH", "QUARTER", "YEAR", "TWO_YEARS", "THREE_YEARS", "FIVE_YEARS", "ALL"],
defaultValue = "WEAK", defaultValue = "WEEK",
example = "WEAK" example = "WEEK"
) )
val scope: Scope = Scope.WEAK val scope: Scope = Scope.WEEK
) { ) {
enum class Scope(@field:EnumValue @field:JsonValue val code: String) { enum class Scope(@field:EnumValue @field:JsonValue val code: String) {
DAY("DAY"), DAY("DAY"),
WEAK("WEAK"), WEEK("WEEK"),
MONTH("MONTH"), MONTH("MONTH"),

View File

@@ -66,15 +66,17 @@ class StatisticsServiceImpl(
cpuLogicalProcessorCount = systemInfo.hardware.processor.logicalProcessorCount, cpuLogicalProcessorCount = systemInfo.hardware.processor.logicalProcessorCount,
microarchitecture = systemInfo.hardware.processor.processorIdentifier.microarchitecture, microarchitecture = systemInfo.hardware.processor.processorIdentifier.microarchitecture,
memories = "${ByteUtil.formatByteSize(systemInfo.hardware.memory.total)} (${ memories = "${ByteUtil.formatByteSize(systemInfo.hardware.memory.total)} (${
systemInfo.hardware.memory.physicalMemory.joinToString( if (systemInfo.hardware.memory.physicalMemory.size > 0) systemInfo.hardware.memory.physicalMemory.joinToString(
" + " " + "
) { ByteUtil.formatByteSize(it.capacity) } ) { ByteUtil.formatByteSize(it.capacity) }
else "Unknown"
})", })",
disks = "${ByteUtil.formatByteSize(systemInfo.hardware.diskStores.sumOf { it.size })} (${ disks = if (systemInfo.hardware.diskStores.size > 0) "${ByteUtil.formatByteSize(systemInfo.hardware.diskStores.sumOf { it.size })} (${
systemInfo.hardware.diskStores.joinToString( systemInfo.hardware.diskStores.joinToString(
" + " " + "
) { ByteUtil.formatByteSize(it.size) } ) { ByteUtil.formatByteSize(it.size) }
})" })"
else "Unknown"
) )
override fun cpu(): CpuInfoVo { override fun cpu(): CpuInfoVo {
@@ -190,7 +192,11 @@ class StatisticsServiceImpl(
return OnlineInfoVo( return OnlineInfoVo(
current = redisUtil.keys("${SecurityProperties.jwtIssuer}_login_*") current = redisUtil.keys("${SecurityProperties.jwtIssuer}_login_*")
.distinctBy { Regex("${SecurityProperties.jwtIssuer}_login_(.*):.*").matchEntire(it)?.groupValues?.getOrNull(1) }.size.toLong(), .distinctBy {
Regex("${SecurityProperties.jwtIssuer}_login_(.*):.*").matchEntire(it)?.groupValues?.getOrNull(
1
)
}.size.toLong(),
history = history history = history
) )
} }