From a74ccd3dd7bccd7808af523313fd8e1f7444eb7f Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Wed, 23 Oct 2024 16:58:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=89=8D=E7=AB=AF=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=90=8E=E7=AB=AFweb=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/WebConfigurationDto.java | 132 ++++++++++++++++++ .../controller/ConfigurationController.java | 31 ++++ .../service/ConfigurationService.java | 13 ++ .../impl/ConfigurationServiceImpl.java | 18 +++ service/src/main/resources/application.yml | 3 + 5 files changed, 197 insertions(+) create mode 100644 dao/src/main/java/cn/bunny/dao/dto/system/configuration/WebConfigurationDto.java create mode 100644 service/src/main/java/cn/bunny/services/controller/ConfigurationController.java create mode 100644 service/src/main/java/cn/bunny/services/service/ConfigurationService.java create mode 100644 service/src/main/java/cn/bunny/services/service/impl/ConfigurationServiceImpl.java diff --git a/dao/src/main/java/cn/bunny/dao/dto/system/configuration/WebConfigurationDto.java b/dao/src/main/java/cn/bunny/dao/dto/system/configuration/WebConfigurationDto.java new file mode 100644 index 0000000..84e2f70 --- /dev/null +++ b/dao/src/main/java/cn/bunny/dao/dto/system/configuration/WebConfigurationDto.java @@ -0,0 +1,132 @@ +package cn.bunny.dao.dto.system.configuration; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + +@Getter +@Setter +@Accessors(chain = true) +@Schema(name = "WebConfiguration对象", title = "前端配置选项", description = "前端配置选项") +public class WebConfigurationDto { + + @Schema(name = "Version", description = "应用程序的版本") + @NotBlank(message = "应用程序的版本不能为空") + @NotNull(message = "应用程序的版本不能为空") + private String version; + + @Schema(name = "Title", description = "应用程序的标题") + @NotBlank(message = "应用程序的标题不能为空") + @NotNull(message = "应用程序的标题不能为空") + private String title; + + @Schema(name = "Copyright", description = "版权信息") + @NotBlank(message = "版权信息不能为空") + @NotNull(message = "版权信息不能为空") + private String copyright; + + @Schema(name = "FixedHeader", description = "头部是否固定") + @NotNull(message = "头部是否固定不能为空") + private boolean fixedHeader; + + @Schema(name = "HiddenSideBar", description = "侧边栏是否隐藏") + @NotNull(message = "侧边栏是否隐藏不能为空") + private boolean hiddenSideBar; + + @Schema(name = "MultiTagsCache", description = "是否缓存多个标签") + @NotNull(message = "是否缓存多个标签不能为空") + private boolean multiTagsCache; + + @Schema(name = "KeepAlive", description = "是否持久化") + @NotNull(message = "持久化不能为空") + private boolean keepAlive; + + @Schema(name = "Locale", description = "语言类型") + @NotBlank(message = "语言类型不能为空") + @NotNull(message = "语言类型不能为空") + private String locale; + + @Schema(name = "Layout", description = "应用程序的布局") + @NotBlank(message = "应用程序的布局不能为空") + @NotNull(message = "应用程序的布局不能为空") + private String layout; + + @Schema(name = "Theme", description = "应用程序的主题") + @NotBlank(message = "管理者不能为空") + @NotNull(message = "管理者不能为空") + private String theme; + + @Schema(name = "DarkMode", description = "是否启用深色模式") + @NotNull(message = "darkMode不能为空") + private boolean darkMode; + + @Schema(name = "OverallStyle", description = "应用程序的整体样式") + @NotBlank(message = "整体样式不能为空") + @NotNull(message = "整体样式不能为空") + private String overallStyle; + + @Schema(name = "Grey", description = "是否启用灰色模式") + @NotNull(message = "是否启用灰色模式不能为空") + private boolean grey; + + @Schema(name = "Weak", description = "色弱模式") + @NotNull(message = "色弱模式不能为空") + private boolean weak; + + @Schema(name = "HideTabs", description = "是否隐藏选项卡") + @NotNull(message = "是否隐藏选项卡不能为空") + private boolean hideTabs; + + @Schema(name = "HideFooter", description = "是否隐藏页脚") + @NotNull(message = "是否隐藏页脚不能为空") + private boolean hideFooter; + + @Schema(name = "Stretch", description = "是否拉伸显示") + @NotNull(message = "是否拉伸不能为空") + private boolean stretch; + + @Schema(name = "SidebarStatus", description = "侧边栏的状态") + @NotNull(message = "侧边栏的状态不能为空") + private boolean sidebarStatus; + + @Schema(name = "EpThemeColor", description = "主题颜色") + @NotNull(message = "主题颜色不能为空") + private String epThemeColor; + + @Schema(name = "ShowLogo", description = "是否显示logo") + @NotNull(message = "是否显示logo不能为空") + private boolean showLogo; + + @Schema(name = "ShowModel", description = "要显示的模型") + @NotBlank(message = "showModel不能为空") + @NotNull(message = "showModel不能为空") + private String showModel; + + @Schema(name = "MenuArrowIconNoTransition", description = "菜单箭头图标是否没有过渡效果") + @NotNull(message = "过渡效果不能为空") + private boolean menuArrowIconNoTransition; + + @Schema(name = "CachingAsyncRoutes", description = "是否缓存异步路由") + @NotNull(message = "缓存异步路由不能为空") + private boolean cachingAsyncRoutes; + + @Schema(name = "TooltipEffect", description = "工具提示的效果") + @NotBlank(message = "工具提示不能为空") + @NotNull(message = "工具提示不能为空") + private String tooltipEffect; + + @Schema(name = "ResponsiveStorageNameSpace", description = "响应式存储的命名空间") + @NotBlank(message = "响应式存储的命名空间不能为空") + @NotNull(message = "响应式存储的命名空间不能为空") + private String responsiveStorageNameSpace; + + @Schema(name = "MenuSearchHistory", description = "菜单搜索历史") + @NotNull(message = "菜单搜索历史不能为空") + @Min(value = 1, message = "菜单搜索历史必须大于等于1") + private int menuSearchHistory; + +} diff --git a/service/src/main/java/cn/bunny/services/controller/ConfigurationController.java b/service/src/main/java/cn/bunny/services/controller/ConfigurationController.java new file mode 100644 index 0000000..f59abb3 --- /dev/null +++ b/service/src/main/java/cn/bunny/services/controller/ConfigurationController.java @@ -0,0 +1,31 @@ +package cn.bunny.services.controller; + +import cn.bunny.dao.dto.system.configuration.WebConfigurationDto; +import cn.bunny.dao.pojo.result.Result; +import cn.bunny.dao.pojo.result.ResultCodeEnum; +import cn.bunny.services.service.ConfigurationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@Tag(name = "配置", description = "系统配置相关接口") +@RestController +@RequestMapping("/admin/config") +public class ConfigurationController { + + @Autowired + private ConfigurationService configurationService; + + @Operation(summary = "更新web配置", description = "更新web配置") + @PostMapping("updateWebConfiguration") + public Mono> updateWebConfiguration(@Valid @RequestBody WebConfigurationDto dto) { + configurationService.updateWebConfiguration(dto); + return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); + } +} diff --git a/service/src/main/java/cn/bunny/services/service/ConfigurationService.java b/service/src/main/java/cn/bunny/services/service/ConfigurationService.java new file mode 100644 index 0000000..1ad0c3d --- /dev/null +++ b/service/src/main/java/cn/bunny/services/service/ConfigurationService.java @@ -0,0 +1,13 @@ +package cn.bunny.services.service; + +import cn.bunny.dao.dto.system.configuration.WebConfigurationDto; + +public interface ConfigurationService { + + /** + * * 更新web配置 + * + * @param dto 前端配置选项 + */ + void updateWebConfiguration(WebConfigurationDto dto); +} diff --git a/service/src/main/java/cn/bunny/services/service/impl/ConfigurationServiceImpl.java b/service/src/main/java/cn/bunny/services/service/impl/ConfigurationServiceImpl.java new file mode 100644 index 0000000..0914aae --- /dev/null +++ b/service/src/main/java/cn/bunny/services/service/impl/ConfigurationServiceImpl.java @@ -0,0 +1,18 @@ +package cn.bunny.services.service.impl; + +import cn.bunny.dao.dto.system.configuration.WebConfigurationDto; +import cn.bunny.services.service.ConfigurationService; +import org.springframework.stereotype.Service; + +@Service +public class ConfigurationServiceImpl implements ConfigurationService { + /** + * * 更新web配置 + * + * @param dto 前端配置选项 + */ + @Override + public void updateWebConfiguration(WebConfigurationDto dto) { + + } +} diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index 29a2a46..22f7775 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -88,6 +88,9 @@ management: enabled: true os: enabled: true + git: + mode: full + endpoint: health: show-details: always \ No newline at end of file