mirror of https://gitee.com/stylefeng/roses
【7.0.4】【config】更新系统初始化配置
parent
9ae7bba7ce
commit
df963a5943
|
@ -90,7 +90,12 @@ public enum ConfigExceptionEnum implements AbstractExceptionEnum {
|
|||
/**
|
||||
* 初始化配置失败,参数为空
|
||||
*/
|
||||
CONFIG_INIT_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + ConfigConstants.CONFIG_EXCEPTION_STEP_CODE + "11", "初始化配置失败,参数为空");
|
||||
CONFIG_INIT_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + ConfigConstants.CONFIG_EXCEPTION_STEP_CODE + "11", "初始化配置失败,参数为空"),
|
||||
|
||||
/**
|
||||
* 初始化配置失败,系统已经初始化
|
||||
*/
|
||||
CONFIG_INIT_ALREADY(RuleConstants.BUSINESS_ERROR_TYPE_CODE + ConfigConstants.CONFIG_EXCEPTION_STEP_CODE + "12", "初始化配置失败,系统配置已经初始化");
|
||||
|
||||
/**
|
||||
* 错误编码
|
||||
|
|
|
@ -152,6 +152,15 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||
throw new ConfigException(ConfigExceptionEnum.CONFIG_INIT_ERROR);
|
||||
}
|
||||
|
||||
// 如果当前已经初始化过配置,则不能初始化
|
||||
LambdaQueryWrapper<SysConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysConfig::getConfigCode, RuleConstants.SYSTEM_CONFIG_INIT_FLAG_NAME);
|
||||
SysConfig tempSysConfig = this.getOne(lambdaQueryWrapper, false);
|
||||
String alreadyInit = tempSysConfig.getConfigValue();
|
||||
if (Convert.toBool(alreadyInit)) {
|
||||
throw new ConfigException(ConfigExceptionEnum.CONFIG_INIT_ALREADY);
|
||||
}
|
||||
|
||||
// 添加系统已经初始化的配置
|
||||
Map<String, String> sysConfigs = configInitRequest.getSysConfigs();
|
||||
sysConfigs.put(RuleConstants.SYSTEM_CONFIG_INIT_FLAG_NAME, "true");
|
||||
|
|
Loading…
Reference in New Issue