|
|
@@ -22,6 +22,8 @@ public class DefaultInitializer implements CommandLineRunner {
|
|
|
|
|
|
@Override
|
|
|
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");
|
|
|
if (!StringUtils.isEmpty(settingsStr)) {
|
|
|
@@ -30,7 +32,18 @@ public class DefaultInitializer implements CommandLineRunner {
|
|
|
Setting oldOne = settingService.findOne(setting.getKey());
|
|
|
if (null == oldOne) {
|
|
|
settingService.save(setting);
|
|
|
+ } else {
|
|
|
+ if (resetDefaultKeys.length > 0) {
|
|
|
+ for (String key : resetDefaultKeys) {
|
|
|
+ // 需要用默认配置重置数据库配置,修改数据库配置内容
|
|
|
+ if (key.equals(setting.getKey())) {
|
|
|
+ oldOne.setKey(setting.getKey());
|
|
|
+ settingService.save(oldOne);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
// 不修改已设置项
|
|
|
}
|
|
|
}
|