|
@@ -22,8 +22,6 @@ public class DefaultInitializer implements CommandLineRunner {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void run(String... strings) throws Exception {
|
|
public void run(String... strings) throws Exception {
|
|
|
- // 用默认数据重置数据库配置
|
|
|
|
|
- String[] resetDefaultKeys = {"api.b2b.url", "api.publicinquiry.url", "api.publicproduct.url"};
|
|
|
|
|
// 默认数据
|
|
// 默认数据
|
|
|
String settingsStr = StringUtil.copyResource("init/setting.json");
|
|
String settingsStr = StringUtil.copyResource("init/setting.json");
|
|
|
if (!StringUtils.isEmpty(settingsStr)) {
|
|
if (!StringUtils.isEmpty(settingsStr)) {
|
|
@@ -33,17 +31,12 @@ public class DefaultInitializer implements CommandLineRunner {
|
|
|
if (null == oldOne) {
|
|
if (null == oldOne) {
|
|
|
settingService.save(setting);
|
|
settingService.save(setting);
|
|
|
} else {
|
|
} else {
|
|
|
- if (resetDefaultKeys.length > 0) {
|
|
|
|
|
- for (String key : resetDefaultKeys) {
|
|
|
|
|
- // 需要用默认配置重置数据库配置,修改数据库配置内容
|
|
|
|
|
- if (key.equals(setting.getKey())) {
|
|
|
|
|
- oldOne.setValue(setting.getValue());
|
|
|
|
|
- settingService.save(oldOne);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 需要用代码配置重置数据库配置,修改数据库配置内容
|
|
|
|
|
+ if (setting.isResetDefault()) {
|
|
|
|
|
+ oldOne.setValue(setting.getValue());
|
|
|
|
|
+ settingService.save(oldOne);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
// 不修改已设置项
|
|
// 不修改已设置项
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|