Add base settings management api
This commit is contained in:
@@ -17,17 +17,32 @@ import top.fatweb.api.vo.permission.RegisterVo
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see IEventLogService
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
class EventLogAspect(
|
||||
private val eventLogService: IEventLogService
|
||||
) {
|
||||
|
||||
/**
|
||||
* Event log record pointcut
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Pointcut("@annotation(top.fatweb.api.annotation.EventLogRecord)")
|
||||
fun eventLogPointcut() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do after event log record pointcut
|
||||
*
|
||||
* @param joinPoint Join point
|
||||
* @param retValue Return value
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see JoinPoint
|
||||
*/
|
||||
@AfterReturning(value = "eventLogPointcut()", returning = "retValue")
|
||||
fun doAfter(joinPoint: JoinPoint, retValue: Any?) {
|
||||
val annotation = (joinPoint.signature as MethodSignature).method.getAnnotation(EventLogRecord::class.java)
|
||||
|
||||
@@ -6,6 +6,12 @@ import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
/**
|
||||
* Velocity engine configuration
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Configuration
|
||||
class VelocityEngineConfig {
|
||||
@Bean
|
||||
|
||||
@@ -30,8 +30,13 @@ class AuthenticationController(
|
||||
/**
|
||||
* Register
|
||||
*
|
||||
* @param registerParam Register parameters
|
||||
* @return Response object includes user ID
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RegisterParam
|
||||
* @see ResponseResult
|
||||
* @see RegisterVo
|
||||
*/
|
||||
@Operation(summary = "注册")
|
||||
@PostMapping("/register")
|
||||
@@ -44,8 +49,10 @@ class AuthenticationController(
|
||||
/**
|
||||
* Send verify email
|
||||
*
|
||||
* @return Response object includes resend result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see ResponseResult
|
||||
*/
|
||||
@Operation(summary = "发送验证邮件")
|
||||
@PostMapping("/resend")
|
||||
@@ -58,8 +65,12 @@ class AuthenticationController(
|
||||
/**
|
||||
* Verify email
|
||||
*
|
||||
* @param verifyParam Verify parameters
|
||||
* @return Response object includes verify result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see VerifyParam
|
||||
* @see ResponseResult
|
||||
*/
|
||||
@Operation(summary = "验证邮箱")
|
||||
@PostMapping("/verify")
|
||||
@@ -72,8 +83,14 @@ class AuthenticationController(
|
||||
/**
|
||||
* Forget password
|
||||
*
|
||||
* @param request
|
||||
* @param forgetParam Forget parameters
|
||||
* @return Response object includes forget result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see HttpServletRequest
|
||||
* @see ForgetParam
|
||||
* @see ResponseResult
|
||||
*/
|
||||
@Operation(summary = "忘记密码")
|
||||
@PostMapping("/forget")
|
||||
@@ -86,8 +103,14 @@ class AuthenticationController(
|
||||
/**
|
||||
* Retrieve password
|
||||
*
|
||||
* @param request
|
||||
* @param retrieveParam Retrieve parameters
|
||||
* @return Response object include retrieve result
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see HttpServletRequest
|
||||
* @see RetrieveParam
|
||||
* @see ResponseResult
|
||||
*/
|
||||
@Operation(summary = "找回密码")
|
||||
@PostMapping("/retrieve")
|
||||
|
||||
@@ -9,9 +9,11 @@ import org.springframework.web.bind.annotation.PutMapping
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import top.fatweb.api.annotation.BaseController
|
||||
import top.fatweb.api.entity.common.ResponseResult
|
||||
import top.fatweb.api.param.system.BaseSettingsParam
|
||||
import top.fatweb.api.param.system.MailSendParam
|
||||
import top.fatweb.api.param.system.MailSettingsParam
|
||||
import top.fatweb.api.service.system.ISettingsService
|
||||
import top.fatweb.api.vo.system.BaseSettingsVo
|
||||
import top.fatweb.api.vo.system.MailSettingsVo
|
||||
|
||||
/**
|
||||
@@ -25,6 +27,31 @@ import top.fatweb.api.vo.system.MailSettingsVo
|
||||
class SettingsController(
|
||||
private val settingsService: ISettingsService
|
||||
) {
|
||||
/**
|
||||
* Get base settings
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Operation(summary = "获取基础设置")
|
||||
@GetMapping("/base")
|
||||
@PreAuthorize("hasAnyAuthority('system:settings:query:base')")
|
||||
fun getApp(): ResponseResult<BaseSettingsVo> = ResponseResult.success(data = settingsService.getBase())
|
||||
|
||||
/**
|
||||
* Update base settings
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Operation(summary = "更新基础设置")
|
||||
@PutMapping("/base")
|
||||
@PreAuthorize("hasAnyAuthority('system:settings:modify:base')")
|
||||
fun updateApp(@RequestBody baseSettingsParam: BaseSettingsParam): ResponseResult<Nothing> {
|
||||
settingsService.updateBase(baseSettingsParam)
|
||||
return ResponseResult.success()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mail settings
|
||||
*
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package top.fatweb.api.converter.system
|
||||
|
||||
import top.fatweb.api.settings.MailSettings
|
||||
import top.fatweb.api.settings.SystemSettings
|
||||
import top.fatweb.api.vo.system.MailSettingsVo
|
||||
import top.fatweb.api.vo.system.SettingsVo
|
||||
|
||||
/**
|
||||
* Settings converter
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
object SettingsConverter {
|
||||
/**
|
||||
* Convert MailSettings object into MailSettingsVo object
|
||||
*
|
||||
* @param mailSettings MailSettings object
|
||||
* @return MailSettingsVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see MailSettings
|
||||
* @see MailSettingsVo
|
||||
*/
|
||||
fun mailSettingsToMailSettingsVo(mailSettings: MailSettings) = MailSettingsVo(
|
||||
host = mailSettings.host,
|
||||
port = mailSettings.port,
|
||||
securityType = mailSettings.securityType,
|
||||
username = mailSettings.username,
|
||||
password = mailSettings.password,
|
||||
from = mailSettings.from,
|
||||
fromName = mailSettings.fromName
|
||||
)
|
||||
|
||||
/**
|
||||
* Convert SystemSettings object into SettingVo object
|
||||
*
|
||||
* @param systemSettings SystemSettings object
|
||||
* @return SettingsVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see SystemSettings
|
||||
* @see SettingsVo
|
||||
*/
|
||||
fun systemSettingsToSettingsVo(systemSettings: SystemSettings) = SettingsVo(
|
||||
mail = systemSettings.mail?.let { mailSettingsToMailSettingsVo(it) }
|
||||
)
|
||||
}
|
||||
@@ -5,5 +5,6 @@ package top.fatweb.api.exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class AccountNeedInitException : RuntimeException("Account need initialize")
|
||||
@@ -5,5 +5,6 @@ package top.fatweb.api.exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class AccountNeedResetPasswordException : RuntimeException("Account need reset password")
|
||||
@@ -3,8 +3,10 @@ package top.fatweb.api.exception
|
||||
/**
|
||||
* Email settings not configured exception
|
||||
*
|
||||
* @param configs Configs not config
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class NoEmailConfigException(
|
||||
vararg configs: String
|
||||
|
||||
@@ -5,5 +5,6 @@ package top.fatweb.api.exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class NoVerificationRequiredException : RuntimeException("No verification required")
|
||||
@@ -1,3 +1,10 @@
|
||||
package top.fatweb.api.exception
|
||||
|
||||
/**
|
||||
* Retrieve code error or expired exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class RetrieveCodeErrorOrExpiredException : RuntimeException("Retrieve code error or expired")
|
||||
@@ -1,3 +1,10 @@
|
||||
package top.fatweb.api.exception
|
||||
|
||||
/**
|
||||
* User not found exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class UserNotFoundException : RuntimeException("User not found")
|
||||
@@ -5,5 +5,6 @@ package top.fatweb.api.exception
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RuntimeException
|
||||
*/
|
||||
class VerificationCodeErrorOrExpiredException : RuntimeException("Verification code is error or has expired")
|
||||
@@ -0,0 +1,48 @@
|
||||
package top.fatweb.api.param.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* Base settings parameters
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "基础设置请求参数")
|
||||
data class BaseSettingsParam(
|
||||
/**
|
||||
* Application name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "应用名称")
|
||||
val appName: String?,
|
||||
|
||||
/**
|
||||
* Application URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "应用 URL")
|
||||
val appUrl: String?,
|
||||
|
||||
/**
|
||||
* Verify URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "验证邮箱 URL")
|
||||
val verifyUrl: String?,
|
||||
|
||||
/**
|
||||
* Retrieve URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "找回密码 URL")
|
||||
val retrieveUrl: String?
|
||||
)
|
||||
@@ -17,8 +17,12 @@ interface IAuthenticationService {
|
||||
/**
|
||||
* Register
|
||||
*
|
||||
* @param registerParam Register parameters
|
||||
* @return RegisterVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see RegisterParam
|
||||
* @see RegisterVo
|
||||
*/
|
||||
fun register(registerParam: RegisterParam): RegisterVo
|
||||
|
||||
@@ -33,24 +37,34 @@ interface IAuthenticationService {
|
||||
/**
|
||||
* Verify email
|
||||
*
|
||||
* @param verifyParam Verify parameters
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see VerifyParam
|
||||
*/
|
||||
fun verify(verifyParam: VerifyParam)
|
||||
|
||||
/**
|
||||
* Forget password
|
||||
*
|
||||
* @param request
|
||||
* @param forgetParam Forget parameters
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see HttpServletRequest
|
||||
* @see ForgetParam
|
||||
*/
|
||||
fun forget(request: HttpServletRequest, forgetParam: ForgetParam)
|
||||
|
||||
/**
|
||||
* Retrieve password
|
||||
*
|
||||
* @param request
|
||||
* @param retrieveParam Retrieve parameters
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see HttpServletRequest
|
||||
* @see RetrieveParam
|
||||
*/
|
||||
fun retrieve(request: HttpServletRequest, retrieveParam: RetrieveParam)
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ import top.fatweb.api.service.api.v1.IAvatarService
|
||||
import top.fatweb.api.service.permission.IAuthenticationService
|
||||
import top.fatweb.api.service.permission.IUserInfoService
|
||||
import top.fatweb.api.service.permission.IUserService
|
||||
import top.fatweb.api.settings.BaseSettings
|
||||
import top.fatweb.api.settings.SettingsOperator
|
||||
import top.fatweb.api.util.JwtUtil
|
||||
import top.fatweb.api.util.MailUtil
|
||||
import top.fatweb.api.util.RedisUtil
|
||||
@@ -106,10 +108,16 @@ class AuthenticationServiceImpl(
|
||||
|
||||
private fun sendVerifyMail(username: String, code: String, email: String) {
|
||||
val velocityContext = VelocityContext().apply {
|
||||
put("appName", "氮工具")
|
||||
put("appUrl", "http://localhost:5173/")
|
||||
put("appName", SettingsOperator.getAppValue(BaseSettings::appName, "氧工具"))
|
||||
put("appUrl", SettingsOperator.getAppValue(BaseSettings::appUrl, "http://localhost"))
|
||||
put("username", username)
|
||||
put("verifyUrl", "http://localhost:5173/verify?code=${code}")
|
||||
put(
|
||||
"verifyUrl",
|
||||
SettingsOperator.getAppValue(BaseSettings::verifyUrl, "http://localhost/verify?code=\${verifyCode}")
|
||||
.replace(
|
||||
Regex("(?<=([^\\\\]))\\$\\{verifyCode}"), code
|
||||
)
|
||||
)
|
||||
}
|
||||
val template = velocityEngine.getTemplate("templates/email-verify-account-cn.vm")
|
||||
|
||||
@@ -160,11 +168,17 @@ class AuthenticationServiceImpl(
|
||||
|
||||
private fun sendRetrieveMail(username: String, ip: String, code: String, email: String) {
|
||||
val velocityContext = VelocityContext().apply {
|
||||
put("appName", "氮工具")
|
||||
put("appUrl", "http://localhost:5173/")
|
||||
put("appName", SettingsOperator.getAppValue(BaseSettings::appName, "氧工具"))
|
||||
put("appUrl", SettingsOperator.getAppValue(BaseSettings::appUrl, "http://localhost"))
|
||||
put("username", username)
|
||||
put("ipAddress", ip)
|
||||
put("retrieveUrl", "http://localhost:5173/forget?code=${code}")
|
||||
put(
|
||||
"retrieveUrl",
|
||||
SettingsOperator.getAppValue(BaseSettings::retrieveUrl, "http://localhost/retrieve?code=\${retrieveCode}")
|
||||
.replace(
|
||||
Regex("(?<=([^\\\\]))\\$\\{retrieveCode}"), code
|
||||
)
|
||||
)
|
||||
}
|
||||
val template = velocityEngine.getTemplate("templates/email-retrieve-password-cn.vm")
|
||||
|
||||
@@ -209,8 +223,8 @@ class AuthenticationServiceImpl(
|
||||
|
||||
private fun sendPasswordChangedMail(username: String, ip: String, email: String) {
|
||||
val velocityContext = VelocityContext().apply {
|
||||
put("appName", "氮工具")
|
||||
put("appUrl", "http://localhost:5173/")
|
||||
put("appName", SettingsOperator.getAppValue(BaseSettings::appName, "氧工具"))
|
||||
put("appUrl", SettingsOperator.getAppValue(BaseSettings::appUrl, "http://localhost"))
|
||||
put("username", username)
|
||||
put("ipAddress", ip)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package top.fatweb.api.service.system
|
||||
|
||||
import top.fatweb.api.param.system.BaseSettingsParam
|
||||
import top.fatweb.api.param.system.MailSendParam
|
||||
import top.fatweb.api.param.system.MailSettingsParam
|
||||
import top.fatweb.api.vo.system.BaseSettingsVo
|
||||
import top.fatweb.api.vo.system.MailSettingsVo
|
||||
|
||||
/**
|
||||
@@ -11,10 +13,30 @@ import top.fatweb.api.vo.system.MailSettingsVo
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface ISettingsService {
|
||||
/**
|
||||
* Get base settings
|
||||
*
|
||||
* @return BaseSettingsVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see BaseSettingsVo
|
||||
*/
|
||||
fun getBase(): BaseSettingsVo?
|
||||
|
||||
/**
|
||||
* Update base settings
|
||||
*
|
||||
* @param baseSettingsParam Base settings parameters
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see BaseSettingsParam
|
||||
*/
|
||||
fun updateBase(baseSettingsParam: BaseSettingsParam)
|
||||
|
||||
/**
|
||||
* Get mail settings
|
||||
*
|
||||
* @return MailSettingVo object
|
||||
* @return MailSettingsVo object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see MailSettingsVo
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package top.fatweb.api.service.system.impl
|
||||
|
||||
import org.springframework.stereotype.Service
|
||||
import top.fatweb.api.converter.system.SettingsConverter
|
||||
import top.fatweb.api.param.system.BaseSettingsParam
|
||||
import top.fatweb.api.param.system.MailSendParam
|
||||
import top.fatweb.api.param.system.MailSettingsParam
|
||||
import top.fatweb.api.properties.ServerProperties
|
||||
import top.fatweb.api.service.system.ISettingsService
|
||||
import top.fatweb.api.settings.BaseSettings
|
||||
import top.fatweb.api.settings.MailSettings
|
||||
import top.fatweb.api.settings.SettingsOperator
|
||||
import top.fatweb.api.util.MailUtil
|
||||
import top.fatweb.api.util.StrUtil
|
||||
import top.fatweb.api.vo.system.BaseSettingsVo
|
||||
import top.fatweb.api.vo.system.MailSettingsVo
|
||||
|
||||
/**
|
||||
@@ -20,14 +23,40 @@ import top.fatweb.api.vo.system.MailSettingsVo
|
||||
*/
|
||||
@Service
|
||||
class SettingsServiceImpl : ISettingsService {
|
||||
override fun getMail(): MailSettingsVo? = SettingsOperator.settings().mail?.let {
|
||||
SettingsConverter.mailSettingsToMailSettingsVo(
|
||||
it
|
||||
override fun getBase() = BaseSettingsVo(
|
||||
appName = SettingsOperator.getAppValue(BaseSettings::appName, "氧工具"),
|
||||
appUrl = SettingsOperator.getAppValue(BaseSettings::appUrl, "http://localhost"),
|
||||
verifyUrl = SettingsOperator.getAppValue(
|
||||
BaseSettings::verifyUrl,
|
||||
"http://localhost/verify?code=\${verifyCode}"
|
||||
),
|
||||
retrieveUrl = SettingsOperator.getAppValue(
|
||||
BaseSettings::retrieveUrl,
|
||||
"http://localhost/retrieve?code=\${retrieveCode}"
|
||||
)
|
||||
)
|
||||
|
||||
override fun updateBase(baseSettingsParam: BaseSettingsParam) {
|
||||
baseSettingsParam.run {
|
||||
SettingsOperator.setAppValue(BaseSettings::appName, appName)
|
||||
SettingsOperator.setAppValue(BaseSettings::appUrl, appUrl)
|
||||
SettingsOperator.setAppValue(BaseSettings::verifyUrl, verifyUrl)
|
||||
SettingsOperator.setAppValue(BaseSettings::retrieveUrl, retrieveUrl)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMail() = MailSettingsVo(
|
||||
host = SettingsOperator.getMailValue(MailSettings::host),
|
||||
port = SettingsOperator.getMailValue(MailSettings::port),
|
||||
securityType = SettingsOperator.getMailValue(MailSettings::securityType),
|
||||
username = SettingsOperator.getMailValue(MailSettings::username),
|
||||
password = SettingsOperator.getMailValue(MailSettings::password)?.let { StrUtil.md5(it) },
|
||||
from = SettingsOperator.getMailValue(MailSettings::from),
|
||||
fromName = SettingsOperator.getMailValue(MailSettings::fromName)
|
||||
)
|
||||
|
||||
override fun updateMail(mailSettingsParam: MailSettingsParam) {
|
||||
mailSettingsParam.apply {
|
||||
mailSettingsParam.run {
|
||||
SettingsOperator.setMailValue(MailSettings::host, host)
|
||||
SettingsOperator.setMailValue(MailSettings::port, port)
|
||||
SettingsOperator.setMailValue(MailSettings::securityType, securityType)
|
||||
|
||||
44
src/main/kotlin/top/fatweb/api/settings/BaseSettings.kt
Normal file
44
src/main/kotlin/top/fatweb/api/settings/BaseSettings.kt
Normal file
@@ -0,0 +1,44 @@
|
||||
package top.fatweb.api.settings
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
|
||||
/**
|
||||
* Base settings entity
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
data class BaseSettings(
|
||||
/**
|
||||
* Application name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var appName: String? = null,
|
||||
|
||||
/**
|
||||
* Application URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var appUrl: String? = null,
|
||||
|
||||
/**
|
||||
* Verify URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var verifyUrl: String? = null,
|
||||
|
||||
/**
|
||||
* Retrieve URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var retrieveUrl: String? = null
|
||||
)
|
||||
@@ -71,6 +71,51 @@ object SettingsOperator {
|
||||
yamlMapper.writeValue(settingFile, systemSettings)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set base settings value
|
||||
*
|
||||
* @param field Field to set value. e.g. BaseSettings::appName
|
||||
* @param value Value to set
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see KMutableProperty1
|
||||
* @see BaseSettings
|
||||
*/
|
||||
fun <V> setAppValue(field: KMutableProperty1<BaseSettings, V?>, value: V?) {
|
||||
systemSettings.base?.let {
|
||||
field.set(it, value)
|
||||
} ?: let {
|
||||
systemSettings.base = BaseSettings().also { field.set(it, value) }
|
||||
}
|
||||
|
||||
saveSettingsToFile()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base settings value
|
||||
*
|
||||
* @param field Field to get value from. e.g. BaseSettings::appName
|
||||
* @return Value
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see KMutableProperty1
|
||||
* @see BaseSettings
|
||||
*/
|
||||
fun <V> getAppValue(field: KMutableProperty1<BaseSettings, V?>): V? = this.getAppValue(field, null)
|
||||
|
||||
/**
|
||||
* Get base settings value with default value
|
||||
*
|
||||
* @param field Field to get value from. e.g. BaseSettings::appName
|
||||
* @param default Return default value when setting not found
|
||||
* @return Value
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see KMutableProperty1
|
||||
* @see BaseSettings
|
||||
*/
|
||||
fun <V> getAppValue(field: KMutableProperty1<BaseSettings, V?>, default: V): V = systemSettings.base?.let(field) ?: default
|
||||
|
||||
/**
|
||||
* Set mail settings value
|
||||
*
|
||||
@@ -108,36 +153,18 @@ object SettingsOperator {
|
||||
* @see KMutableProperty1
|
||||
* @see MailSettings
|
||||
*/
|
||||
fun <V> getMailValue(field: KMutableProperty1<MailSettings, V?>): V? = systemSettings.mail?.let(field)
|
||||
fun <V> getMailValue(field: KMutableProperty1<MailSettings, V?>): V? = this.getMailValue(field, null)
|
||||
|
||||
/**
|
||||
* Get system settings object
|
||||
* Get value from mail settings with default value
|
||||
*
|
||||
* @return System settings object (Copy)
|
||||
* @param field Field to get value from. e.g. MailSettings::host
|
||||
* @param default Return default value when setting not found
|
||||
* @return Value
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see SystemSettings
|
||||
* @see KMutableProperty1
|
||||
* @see MailSettings
|
||||
*/
|
||||
fun settings(): SystemSettings = systemSettings.copy(
|
||||
mail = systemSettings.mail?.copy()
|
||||
).apply {
|
||||
mail?.apply {
|
||||
password = password?.let {
|
||||
StrUtil.md5(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite all settings
|
||||
*
|
||||
* @param systemSettings SystemSettings object
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
* @see SystemSettings
|
||||
*/
|
||||
fun overwrite(systemSettings: SystemSettings) {
|
||||
this.systemSettings = systemSettings
|
||||
saveSettingsToFile()
|
||||
}
|
||||
fun <V> getMailValue(field: KMutableProperty1<MailSettings, V?>, default: V): V = systemSettings.mail?.let(field) ?: default
|
||||
}
|
||||
@@ -10,6 +10,14 @@ import com.fasterxml.jackson.annotation.JsonInclude
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
data class SystemSettings(
|
||||
/**
|
||||
* Base setting
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var base: BaseSettings? = null,
|
||||
|
||||
/**
|
||||
* Mail setting
|
||||
*
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.api.vo.system.ActiveInfoVo.HistoryVo
|
||||
import java.time.LocalDate
|
||||
|
||||
@@ -9,6 +10,7 @@ import java.time.LocalDate
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "用户活跃信息返回参数")
|
||||
data class ActiveInfoVo(
|
||||
/**
|
||||
* Register user number history
|
||||
@@ -16,6 +18,7 @@ data class ActiveInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "注册用户数量历史")
|
||||
val registerHistory: List<HistoryVo>,
|
||||
|
||||
/**
|
||||
@@ -25,6 +28,7 @@ data class ActiveInfoVo(
|
||||
* @since 1.0.0
|
||||
* @see HistoryVo
|
||||
*/
|
||||
@Schema(description = "登录用户数量历史")
|
||||
val loginHistory: List<HistoryVo>,
|
||||
|
||||
/**
|
||||
@@ -33,6 +37,7 @@ data class ActiveInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "验证用户数量历史")
|
||||
val verifyHistory: List<HistoryVo>
|
||||
) {
|
||||
data class HistoryVo(
|
||||
@@ -43,6 +48,7 @@ data class ActiveInfoVo(
|
||||
* @since 1.0.0
|
||||
* @see LocalDate
|
||||
*/
|
||||
@Schema(description = "记录时间", example = "1900-01-01")
|
||||
val time: LocalDate,
|
||||
|
||||
/**
|
||||
@@ -51,6 +57,7 @@ data class ActiveInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "数量")
|
||||
val count: Int
|
||||
)
|
||||
}
|
||||
|
||||
48
src/main/kotlin/top/fatweb/api/vo/system/BaseSettingsVo.kt
Normal file
48
src/main/kotlin/top/fatweb/api/vo/system/BaseSettingsVo.kt
Normal file
@@ -0,0 +1,48 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* Base settings value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "基础设置返回参数")
|
||||
data class BaseSettingsVo(
|
||||
/**
|
||||
* Application name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "应用名称")
|
||||
val appName: String?,
|
||||
|
||||
/**
|
||||
* Application URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "应用 URL")
|
||||
val appUrl: String?,
|
||||
|
||||
/**
|
||||
* Verify URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "验证邮箱 URL")
|
||||
val verifyUrl: String?,
|
||||
|
||||
/**
|
||||
* Retrieve URL
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "找回密码 URL")
|
||||
val retrieveUrl: String?
|
||||
)
|
||||
@@ -1,6 +1,7 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* CPU information value object
|
||||
@@ -8,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonInclude
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "CPU 信息返回参数")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
data class CpuInfoVo(
|
||||
/**
|
||||
@@ -18,6 +20,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "user")
|
||||
val user: Long,
|
||||
|
||||
/**
|
||||
@@ -28,6 +31,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "nice")
|
||||
val nice: Long,
|
||||
|
||||
/**
|
||||
@@ -40,6 +44,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "system")
|
||||
val system: Long,
|
||||
|
||||
/**
|
||||
@@ -50,6 +55,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "idle")
|
||||
val idle: Long,
|
||||
|
||||
/**
|
||||
@@ -61,6 +67,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "iowait")
|
||||
val iowait: Long,
|
||||
|
||||
/**
|
||||
@@ -71,6 +78,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "irq")
|
||||
val irq: Long,
|
||||
|
||||
/**
|
||||
@@ -81,6 +89,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "softirq")
|
||||
val softirq: Long,
|
||||
|
||||
/**
|
||||
@@ -92,6 +101,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "steal")
|
||||
val steal: Long,
|
||||
|
||||
/**
|
||||
@@ -100,6 +110,7 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "total")
|
||||
val total: Long,
|
||||
|
||||
/**
|
||||
@@ -108,5 +119,6 @@ data class CpuInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "处理器列表")
|
||||
val processors: List<CpuInfoVo>? = null
|
||||
)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* File storage information value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "文件存储信息返回参数")
|
||||
data class FileStoreInfoVo(
|
||||
/**
|
||||
* Mount point of the File System. The
|
||||
@@ -15,6 +18,7 @@ data class FileStoreInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "挂载点")
|
||||
val mount: String,
|
||||
|
||||
/**
|
||||
@@ -23,6 +27,7 @@ data class FileStoreInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "总容量")
|
||||
val total: Long,
|
||||
|
||||
/**
|
||||
@@ -33,5 +38,6 @@ data class FileStoreInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "空闲容量")
|
||||
val free: Long
|
||||
)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* Hardware information value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "硬件信息返回参数")
|
||||
data class HardwareInfoVo(
|
||||
/**
|
||||
* Name of CPU
|
||||
@@ -13,6 +16,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "CPU")
|
||||
val cpu: String,
|
||||
|
||||
/**
|
||||
@@ -21,6 +25,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "架构")
|
||||
val arch: String,
|
||||
|
||||
/**
|
||||
@@ -29,6 +34,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "是否为64位")
|
||||
val is64Bit: Boolean,
|
||||
|
||||
/**
|
||||
@@ -38,6 +44,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "物理 CPU")
|
||||
val cpuPhysicalPackageCount: Int,
|
||||
|
||||
/**
|
||||
@@ -51,6 +58,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "物理核心")
|
||||
val cpuPhysicalProcessorCount: Int,
|
||||
|
||||
/**
|
||||
@@ -64,6 +72,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "逻辑核心")
|
||||
val cpuLogicalProcessorCount: Int,
|
||||
|
||||
/**
|
||||
@@ -72,6 +81,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "微架构")
|
||||
val microarchitecture: String,
|
||||
|
||||
/**
|
||||
@@ -80,6 +90,7 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "内存")
|
||||
val memories: String,
|
||||
|
||||
/**
|
||||
@@ -88,5 +99,6 @@ data class HardwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "存储")
|
||||
val disks: String
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.api.settings.MailSecurityType
|
||||
|
||||
/**
|
||||
@@ -8,6 +9,7 @@ import top.fatweb.api.settings.MailSecurityType
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "邮件设置返回参数")
|
||||
data class MailSettingsVo(
|
||||
/**
|
||||
* Host
|
||||
@@ -15,6 +17,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "SMTP 服务器")
|
||||
val host: String?,
|
||||
|
||||
/**
|
||||
@@ -23,6 +26,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "端口")
|
||||
val port: Int?,
|
||||
|
||||
/**
|
||||
@@ -31,6 +35,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "安全类型")
|
||||
val securityType: MailSecurityType?,
|
||||
|
||||
/**
|
||||
@@ -39,6 +44,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "用户名")
|
||||
val username: String?,
|
||||
|
||||
/**
|
||||
@@ -47,6 +53,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "密码")
|
||||
val password: String?,
|
||||
|
||||
/**
|
||||
@@ -55,6 +62,7 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "发送者")
|
||||
val from: String?,
|
||||
|
||||
/**
|
||||
@@ -63,5 +71,6 @@ data class MailSettingsVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "发送者名称")
|
||||
val fromName: String?
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import top.fatweb.api.vo.system.OnlineInfoVo.HistoryVo
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@@ -9,6 +10,7 @@ import java.time.LocalDateTime
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "在线信息返回参数")
|
||||
data class OnlineInfoVo(
|
||||
/**
|
||||
* Number of user currently online
|
||||
@@ -16,6 +18,7 @@ data class OnlineInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "当前在线用户数量")
|
||||
val current: Long,
|
||||
|
||||
/**
|
||||
@@ -25,6 +28,7 @@ data class OnlineInfoVo(
|
||||
* @since 1.0.0
|
||||
* @see HistoryVo
|
||||
*/
|
||||
@Schema(description = "历史记录")
|
||||
val history: List<HistoryVo>
|
||||
) {
|
||||
data class HistoryVo(
|
||||
@@ -35,6 +39,7 @@ data class OnlineInfoVo(
|
||||
* @since 1.0.0
|
||||
* @see LocalDateTime
|
||||
*/
|
||||
@Schema(description = "记录时间")
|
||||
val time: LocalDateTime,
|
||||
|
||||
/**
|
||||
@@ -43,6 +48,7 @@ data class OnlineInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "记录")
|
||||
val record: String
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* System settings value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
@Schema(description = "系统设置返回参数")
|
||||
data class SettingsVo(
|
||||
/**
|
||||
* MailSettingVo object
|
||||
@@ -14,5 +18,6 @@ data class SettingsVo(
|
||||
* @since 1.0.0
|
||||
* @see MailSettingsVo
|
||||
*/
|
||||
@Schema(description = "邮件设置")
|
||||
val mail: MailSettingsVo?
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
@@ -8,6 +9,7 @@ import java.time.LocalDateTime
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "软甲信息返回参数")
|
||||
data class SoftwareInfoVo(
|
||||
/**
|
||||
* Operating system
|
||||
@@ -15,6 +17,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "操作系统")
|
||||
val os: String,
|
||||
|
||||
/**
|
||||
@@ -23,6 +26,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "位数")
|
||||
val bitness: Int,
|
||||
|
||||
/**
|
||||
@@ -31,6 +35,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 版本")
|
||||
val javaVersion: String,
|
||||
|
||||
/**
|
||||
@@ -39,6 +44,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 版本日期")
|
||||
val javaVersionDate: String,
|
||||
|
||||
/**
|
||||
@@ -47,6 +53,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 供应商")
|
||||
val javaVendor: String,
|
||||
|
||||
/**
|
||||
@@ -55,6 +62,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 运行时")
|
||||
val javaRuntime: String,
|
||||
|
||||
/**
|
||||
@@ -63,6 +71,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 运行时版本")
|
||||
val javaRuntimeVersion: String,
|
||||
|
||||
/**
|
||||
@@ -71,6 +80,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机")
|
||||
val jvm: String,
|
||||
|
||||
/**
|
||||
@@ -79,6 +89,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机版本")
|
||||
val jvmVersion: String,
|
||||
|
||||
/**
|
||||
@@ -87,6 +98,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机信息")
|
||||
val jvmInfo: String,
|
||||
|
||||
/**
|
||||
@@ -95,6 +107,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机供应商")
|
||||
val jvmVendor: String,
|
||||
|
||||
/**
|
||||
@@ -103,6 +116,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 字节文件版本")
|
||||
val javaClassVersion: String,
|
||||
|
||||
/**
|
||||
@@ -111,6 +125,7 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "操作系统启动时间")
|
||||
val osBootTime: LocalDateTime,
|
||||
|
||||
/**
|
||||
@@ -119,5 +134,6 @@ data class SoftwareInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "服务器启动时间")
|
||||
val serverStartupTime: LocalDateTime
|
||||
)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package top.fatweb.api.vo.system
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema
|
||||
|
||||
/**
|
||||
* Storage information value object
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "存储信息返回参数")
|
||||
data class StorageInfoVo(
|
||||
/**
|
||||
* The amount of actual physical memory.
|
||||
@@ -13,6 +16,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "总内存容量")
|
||||
val memoryTotal: Long,
|
||||
|
||||
/**
|
||||
@@ -22,6 +26,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "空闲内存容量")
|
||||
val memoryFree: Long,
|
||||
|
||||
/**
|
||||
@@ -40,6 +45,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "总虚拟内存容量")
|
||||
val virtualMemoryMax: Long,
|
||||
|
||||
/**
|
||||
@@ -57,6 +63,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "已用虚拟内存容量")
|
||||
val virtualMemoryInUse: Long,
|
||||
|
||||
/**
|
||||
@@ -67,6 +74,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "总交换区容量")
|
||||
val swapTotal: Long,
|
||||
|
||||
/**
|
||||
@@ -76,6 +84,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "可用交换区容量")
|
||||
val swapUsed: Long,
|
||||
|
||||
/**
|
||||
@@ -84,6 +93,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机总内存容量")
|
||||
val jvmTotal: Long,
|
||||
|
||||
/**
|
||||
@@ -92,6 +102,7 @@ data class StorageInfoVo(
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Schema(description = "Java 虚拟机空闲内存容量")
|
||||
val jvmFree: Long,
|
||||
|
||||
/**
|
||||
@@ -101,5 +112,6 @@ data class StorageInfoVo(
|
||||
* @since 1.0.0
|
||||
* @see FileStoreInfoVo
|
||||
*/
|
||||
@Schema(description = "文件存储信息列表")
|
||||
val fileStores: List<FileStoreInfoVo>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user