diff --git a/src/main/kotlin/top/fatweb/api/aop/EventLogAspect.kt b/src/main/kotlin/top/fatweb/api/aop/EventLogAspect.kt index 28c03c1..b5c26d9 100644 --- a/src/main/kotlin/top/fatweb/api/aop/EventLogAspect.kt +++ b/src/main/kotlin/top/fatweb/api/aop/EventLogAspect.kt @@ -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) diff --git a/src/main/kotlin/top/fatweb/api/config/VelocityEngineConfig.kt b/src/main/kotlin/top/fatweb/api/config/VelocityEngineConfig.kt index fd97e7d..2ae172d 100644 --- a/src/main/kotlin/top/fatweb/api/config/VelocityEngineConfig.kt +++ b/src/main/kotlin/top/fatweb/api/config/VelocityEngineConfig.kt @@ -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 diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt index dee6214..99ce14a 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt @@ -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") diff --git a/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt b/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt index 56dad25..39a4cd6 100644 --- a/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/system/SettingsController.kt @@ -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 = 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 { + settingsService.updateBase(baseSettingsParam) + return ResponseResult.success() + } + /** * Get mail settings * diff --git a/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt b/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt deleted file mode 100644 index c3370ff..0000000 --- a/src/main/kotlin/top/fatweb/api/converter/system/SettingsConverter.kt +++ /dev/null @@ -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) } - ) -} \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/AccountNeedInitException.kt b/src/main/kotlin/top/fatweb/api/exception/AccountNeedInitException.kt index 7f9056d..ec1bdb5 100644 --- a/src/main/kotlin/top/fatweb/api/exception/AccountNeedInitException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/AccountNeedInitException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/AccountNeedResetPasswordException.kt b/src/main/kotlin/top/fatweb/api/exception/AccountNeedResetPasswordException.kt index 79fc9e1..10f6767 100644 --- a/src/main/kotlin/top/fatweb/api/exception/AccountNeedResetPasswordException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/AccountNeedResetPasswordException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/NoEmailConfigException.kt b/src/main/kotlin/top/fatweb/api/exception/NoEmailConfigException.kt index a695abc..0377775 100644 --- a/src/main/kotlin/top/fatweb/api/exception/NoEmailConfigException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/NoEmailConfigException.kt @@ -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 diff --git a/src/main/kotlin/top/fatweb/api/exception/NoVerificationRequiredException.kt b/src/main/kotlin/top/fatweb/api/exception/NoVerificationRequiredException.kt index 5d26ae2..4ae2c74 100644 --- a/src/main/kotlin/top/fatweb/api/exception/NoVerificationRequiredException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/NoVerificationRequiredException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/RetrieveCodeErrorOrExpiredException.kt b/src/main/kotlin/top/fatweb/api/exception/RetrieveCodeErrorOrExpiredException.kt index a91616b..d73239e 100644 --- a/src/main/kotlin/top/fatweb/api/exception/RetrieveCodeErrorOrExpiredException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/RetrieveCodeErrorOrExpiredException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/UserNotFoundException.kt b/src/main/kotlin/top/fatweb/api/exception/UserNotFoundException.kt index 0779276..64b032b 100644 --- a/src/main/kotlin/top/fatweb/api/exception/UserNotFoundException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/UserNotFoundException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/exception/VerificationCodeErrorOrExpiredException.kt b/src/main/kotlin/top/fatweb/api/exception/VerificationCodeErrorOrExpiredException.kt index f3316ee..9c28388 100644 --- a/src/main/kotlin/top/fatweb/api/exception/VerificationCodeErrorOrExpiredException.kt +++ b/src/main/kotlin/top/fatweb/api/exception/VerificationCodeErrorOrExpiredException.kt @@ -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") \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/param/system/BaseSettingsParam.kt b/src/main/kotlin/top/fatweb/api/param/system/BaseSettingsParam.kt new file mode 100644 index 0000000..6d8bb4c --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/param/system/BaseSettingsParam.kt @@ -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? +) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt b/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt index cbf2483..050d2f3 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/IAuthenticationService.kt @@ -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) diff --git a/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt index e818b46..63a178d 100644 --- a/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/permission/impl/AuthenticationServiceImpl.kt @@ -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) } diff --git a/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt b/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt index 9327762..0e8d29d 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/ISettingsService.kt @@ -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 diff --git a/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt b/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt index 635d110..6a1da9c 100644 --- a/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt +++ b/src/main/kotlin/top/fatweb/api/service/system/impl/SettingsServiceImpl.kt @@ -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) diff --git a/src/main/kotlin/top/fatweb/api/settings/BaseSettings.kt b/src/main/kotlin/top/fatweb/api/settings/BaseSettings.kt new file mode 100644 index 0000000..b1479db --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/settings/BaseSettings.kt @@ -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 +) diff --git a/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt b/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt index 9e023e7..8f346a9 100644 --- a/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt +++ b/src/main/kotlin/top/fatweb/api/settings/SettingsOperator.kt @@ -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 setAppValue(field: KMutableProperty1, 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 getAppValue(field: KMutableProperty1): 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 getAppValue(field: KMutableProperty1, default: V): V = systemSettings.base?.let(field) ?: default + /** * Set mail settings value * @@ -108,36 +153,18 @@ object SettingsOperator { * @see KMutableProperty1 * @see MailSettings */ - fun getMailValue(field: KMutableProperty1): V? = systemSettings.mail?.let(field) + fun getMailValue(field: KMutableProperty1): 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 getMailValue(field: KMutableProperty1, default: V): V = systemSettings.mail?.let(field) ?: default } \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt b/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt index 8d49508..d186a21 100644 --- a/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt +++ b/src/main/kotlin/top/fatweb/api/settings/SystemSettings.kt @@ -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 * diff --git a/src/main/kotlin/top/fatweb/api/vo/system/ActiveInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/ActiveInfoVo.kt index 0b6f7c7..65f4b60 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/ActiveInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/ActiveInfoVo.kt @@ -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, /** @@ -25,6 +28,7 @@ data class ActiveInfoVo( * @since 1.0.0 * @see HistoryVo */ + @Schema(description = "登录用户数量历史") val loginHistory: List, /** @@ -33,6 +37,7 @@ data class ActiveInfoVo( * @author FatttSnake, fatttsnake@gmail.com * @since 1.0.0 */ + @Schema(description = "验证用户数量历史") val verifyHistory: List ) { 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 ) } diff --git a/src/main/kotlin/top/fatweb/api/vo/system/BaseSettingsVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/BaseSettingsVo.kt new file mode 100644 index 0000000..80193b6 --- /dev/null +++ b/src/main/kotlin/top/fatweb/api/vo/system/BaseSettingsVo.kt @@ -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? +) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt index 72d6cb3..de37e4c 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/CpuInfoVo.kt @@ -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? = null ) diff --git a/src/main/kotlin/top/fatweb/api/vo/system/FileStoreInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/FileStoreInfoVo.kt index 43cbc0e..0fa6320 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/FileStoreInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/FileStoreInfoVo.kt @@ -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 ) diff --git a/src/main/kotlin/top/fatweb/api/vo/system/HardwareInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/HardwareInfoVo.kt index 12f5a09..8868595 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/HardwareInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/HardwareInfoVo.kt @@ -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 ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/system/MailSettingsVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/MailSettingsVo.kt index b909211..503d2c5 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/MailSettingsVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/MailSettingsVo.kt @@ -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? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/system/OnlineInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/OnlineInfoVo.kt index d98ddf7..8e043d5 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/OnlineInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/OnlineInfoVo.kt @@ -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 ) { 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 ) } diff --git a/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt index 4557402..03cd0e8 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/SettingsVo.kt @@ -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? ) \ No newline at end of file diff --git a/src/main/kotlin/top/fatweb/api/vo/system/SoftwareInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/SoftwareInfoVo.kt index 7eb52ab..1caf962 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/SoftwareInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/SoftwareInfoVo.kt @@ -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 ) diff --git a/src/main/kotlin/top/fatweb/api/vo/system/StorageInfoVo.kt b/src/main/kotlin/top/fatweb/api/vo/system/StorageInfoVo.kt index 7362335..ca62096 100644 --- a/src/main/kotlin/top/fatweb/api/vo/system/StorageInfoVo.kt +++ b/src/main/kotlin/top/fatweb/api/vo/system/StorageInfoVo.kt @@ -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 )