mirror of https://gitee.com/stylefeng/roses
【7.2.5】【config】系统初始化配置细化,增加分组名称和分组说明
parent
63e62ea16a
commit
3efbd0a43f
|
@ -36,6 +36,22 @@ import java.util.List;
|
|||
*/
|
||||
public interface ConfigInitStrategyApi {
|
||||
|
||||
/**
|
||||
* 获取这个配置组下的标题
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/24 15:03
|
||||
*/
|
||||
String getTitle();
|
||||
|
||||
/**
|
||||
* 获取这个配置组的详细说明
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/24 15:03
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* 获取需要被初始化的配置集合
|
||||
*
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
*/
|
||||
package cn.stylefeng.roses.kernel.config.modular.controller;
|
||||
|
||||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitItem;
|
||||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitRequest;
|
||||
import cn.stylefeng.roses.kernel.config.modular.entity.SysConfig;
|
||||
import cn.stylefeng.roses.kernel.config.modular.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.InitConfigResponse;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.config.modular.service.SysConfigService;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
|
||||
|
@ -156,7 +156,7 @@ public class SysConfigController {
|
|||
* @date 2021/7/8 16:36
|
||||
*/
|
||||
@GetResource(name = "获取需要初始化的配置列表", path = "/sysConfig/getInitConfigList")
|
||||
public ResponseData<List<ConfigInitItem>> getInitConfigList() {
|
||||
public ResponseData<InitConfigResponse> getInitConfigList() {
|
||||
return new SuccessResponseData<>(sysConfigService.getInitConfigs());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package cn.stylefeng.roses.kernel.config.modular.pojo;
|
||||
|
||||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitItem;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化界面参数的分组
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/24 15:01
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class InitConfigGroup {
|
||||
|
||||
/**
|
||||
* 参数的分组标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 分组的详情
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 本分组下,初始化的列表
|
||||
*/
|
||||
private List<ConfigInitItem> configInitItemList;
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package cn.stylefeng.roses.kernel.config.modular.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化参数响应
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/24 14:59
|
||||
*/
|
||||
@Data
|
||||
public class InitConfigResponse {
|
||||
|
||||
/**
|
||||
* 初始化参数界面的整体标题
|
||||
*/
|
||||
public String title;
|
||||
|
||||
/**
|
||||
* 初始化参数界面的详情信息
|
||||
*/
|
||||
public String description;
|
||||
|
||||
/**
|
||||
* 具体的参数分组列表,初始化界面可以返回多个分组
|
||||
*/
|
||||
public List<InitConfigGroup> initConfigGroupList;
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||
*/
|
||||
package cn.stylefeng.roses.kernel.config.modular.param;
|
||||
package cn.stylefeng.roses.kernel.config.modular.pojo.param;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
|
@ -24,10 +24,10 @@
|
|||
*/
|
||||
package cn.stylefeng.roses.kernel.config.modular.service;
|
||||
|
||||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitItem;
|
||||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitRequest;
|
||||
import cn.stylefeng.roses.kernel.config.modular.entity.SysConfig;
|
||||
import cn.stylefeng.roses.kernel.config.modular.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.InitConfigResponse;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
@ -121,7 +121,7 @@ public interface SysConfigService extends IService<SysConfig> {
|
|||
* @author fengshuonan
|
||||
* @date 2021/7/8 17:49
|
||||
*/
|
||||
List<ConfigInitItem> getInitConfigs();
|
||||
InitConfigResponse getInitConfigs();
|
||||
|
||||
/**
|
||||
* 获取后端部署的地址
|
||||
|
|
|
@ -39,7 +39,9 @@ import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitItem;
|
|||
import cn.stylefeng.roses.kernel.config.api.pojo.ConfigInitRequest;
|
||||
import cn.stylefeng.roses.kernel.config.modular.entity.SysConfig;
|
||||
import cn.stylefeng.roses.kernel.config.modular.mapper.SysConfigMapper;
|
||||
import cn.stylefeng.roses.kernel.config.modular.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.InitConfigGroup;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.InitConfigResponse;
|
||||
import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigParam;
|
||||
import cn.stylefeng.roses.kernel.config.modular.service.SysConfigService;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
|
@ -234,13 +236,24 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigInitItem> getInitConfigs() {
|
||||
List<ConfigInitItem> configInitItemList = new ArrayList<>();
|
||||
public InitConfigResponse getInitConfigs() {
|
||||
|
||||
InitConfigResponse initConfigResponse = new InitConfigResponse();
|
||||
initConfigResponse.setTitle("首次运行参数生成");
|
||||
initConfigResponse.setDescription("第一次进入Guns系统会配置系统的一些秘钥和部署的url信息,这些秘钥均为随机生成,以确保系统的安全性");
|
||||
|
||||
// 获取所有参数分组下的配置信息
|
||||
List<InitConfigGroup> configGroupList = new ArrayList<>();
|
||||
Map<String, ConfigInitStrategyApi> beans = SpringUtil.getBeansOfType(ConfigInitStrategyApi.class);
|
||||
for (ConfigInitStrategyApi value : beans.values()) {
|
||||
configInitItemList.addAll(value.getInitConfigs());
|
||||
String title = value.getTitle();
|
||||
String description = value.getDescription();
|
||||
List<ConfigInitItem> initConfigs = value.getInitConfigs();
|
||||
configGroupList.add(new InitConfigGroup(title, description, initConfigs));
|
||||
}
|
||||
return configInitItemList;
|
||||
initConfigResponse.setInitConfigGroupList(configGroupList);
|
||||
|
||||
return initConfigResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,16 @@ import java.util.List;
|
|||
@Component
|
||||
public class DefaultStrategyImpl implements ConfigInitStrategyApi {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "系统参数";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "系统相关的初始化配置";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigInitItem> getInitConfigs() {
|
||||
ArrayList<ConfigInitItem> configInitItems = new ArrayList<>();
|
||||
|
@ -28,17 +38,12 @@ public class DefaultStrategyImpl implements ConfigInitStrategyApi {
|
|||
configInitItems.add(new ConfigInitItem("auth认证用的jwt秘钥", "SYS_AUTH_JWT_SECRET", RandomUtil.randomString(30), "用于校验登录token"));
|
||||
configInitItems.add(new ConfigInitItem("Druid控制台账号", "SYS_DRUID_ACCOUNT", "admin", "Druid控制台账号"));
|
||||
configInitItems.add(new ConfigInitItem("Druid控制台账号密码", "SYS_DRUID_PASSWORD", RandomUtil.randomString(20), "Druid控制台账号密码"));
|
||||
configInitItems.add(new ConfigInitItem("是否开启图形验证码", "SYS_CAPTCHA_OPEN", "false", "是否开启图形验证码,用在beetl版本"));
|
||||
configInitItems.add(new ConfigInitItem("是否开启拖拽验证码", "SYS_DRAG_CAPTCHA_OPEN", "false", "是否开启拖拽验证码,用在vue版本"));
|
||||
configInitItems.add(new ConfigInitItem("JWT安全码", "SYS_JWT_SECRET", RandomUtil.randomString(20), "jwt-spring-boot-starter模块的秘钥,非认证用的jwt秘钥,默认20位随机字符串"));
|
||||
configInitItems.add(new ConfigInitItem("JWT过期时间", "SYS_JWT_TIMEOUT_SECONDS", "" + 60 * 60 * 24, "jwt-spring-boot-starter模块的秘钥过期时间,默认1天"));
|
||||
configInitItems.add(new ConfigInitItem("Linux本地文件保存路径", "SYS_LOCAL_FILE_SAVE_PATH_LINUX", "/tmp/tempFilePath", "本地文件存储的路径,如果没有用本地文件存储,可忽略此配置"));
|
||||
configInitItems.add(new ConfigInitItem("Windows本地文件保存路径", "SYS_LOCAL_FILE_SAVE_PATH_WINDOWS", "D:\\tempFilePath", "本地文件存储的路径,如果没有用本地文件存储,可忽略此配置"));
|
||||
configInitItems.add(new ConfigInitItem("session过期时间", "SYS_SESSION_EXPIRED_SECONDS", "3600", "单位:秒,session的过期时间,这个时间段内不操作会自动踢下线"));
|
||||
configInitItems.add(new ConfigInitItem("账号单端登录限制", "SYS_SINGLE_ACCOUNT_LOGIN_FLAG", "false", "如果开启,则同一个账号只能一个地方登录"));
|
||||
configInitItems.add(new ConfigInitItem("系统默认密码", "SYS_DEFAULT_PASSWORD", "123456", "用在重置密码的默认密码"));
|
||||
configInitItems.add(new ConfigInitItem("系统发布版本", "SYS_RELEASE_VERSION", DateUtil.format(new Date(), "yyyyMMdd"), "系统发布的版本号"));
|
||||
configInitItems.add(new ConfigInitItem("是否开启demo演示", "SYS_DEMO_ENV_FLAG", "false", "是否开启demo演示环境"));
|
||||
configInitItems.add(new ConfigInitItem("数据库加密AES秘钥", "SYS_ENCRYPT_SECRET_KEY", RandomUtil.randomString(32), "对称加密秘钥,用在数据库数据加密"));
|
||||
return configInitItems;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue