Просмотр исходного кода

Merge branch 'tencent-cloud-0919'

suntg 7 лет назад
Родитель
Сommit
d9b6318e0b

+ 16 - 0
src/main/java/com/uas/erp/schedular/entity/Setting.java

@@ -6,6 +6,7 @@ import org.springframework.util.StringUtils;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.Transient;
 
 /**
  * Created by Pro1 on 2017/7/26.
@@ -21,6 +22,13 @@ public class Setting {
     @Column(name = "value_")
     private String value;
 
+    /**
+     * 是否需要用代码配置重置数据库配置,默认:否 <br/>
+     * 可以通过配置setting.json中的选项配置修改
+     */
+    @Transient
+    private boolean resetDefault = false;
+
     public Setting() {
     }
 
@@ -62,4 +70,12 @@ public class Setting {
     public void setValue(String value) {
         this.value = value;
     }
+
+    public boolean isResetDefault() {
+        return resetDefault;
+    }
+
+    public void setResetDefault(boolean resetDefault) {
+        this.resetDefault = resetDefault;
+    }
 }

+ 6 - 0
src/main/java/com/uas/erp/schedular/init/DefaultInitializer.java

@@ -30,6 +30,12 @@ public class DefaultInitializer implements CommandLineRunner {
                 Setting oldOne = settingService.findOne(setting.getKey());
                 if (null == oldOne) {
                     settingService.save(setting);
+                } else {
+                    // 需要用代码配置重置数据库配置,修改数据库配置内容
+                    if (setting.isResetDefault()) {
+                        oldOne.setValue(setting.getValue());
+                        settingService.save(oldOne);
+                    }
                 }
                 // 不修改已设置项
             }

+ 4 - 3
src/main/resources/init/setting.json

@@ -17,7 +17,8 @@
 },{
   "key": "api.b2b.url",
   "description": "优软B2B平台正式接口地址",
-  "value": "http://uas-api.ubtob.com"
+  "value": "http://b2b-api.suntg.com",
+  "resetDefault": true
 },{
   "key": "api.finance.url",
   "description": "金融保理平台(后台)正式接口地址",
@@ -45,7 +46,7 @@
 },{
   "key": "api.publicinquiry.url",
   "description": "公共询价正式地址",
-  "value": "https://api-inquiry.usoftmall.com/"
+  "value": "http://api-inquiry.usoftchina.com/"
 },{
   "key": "api.publicproduct.test.url",
   "description": "公共物料测试地址",
@@ -53,5 +54,5 @@
 },{
   "key": "api.publicproduct.url",
   "description": "公共物料正式地址",
-  "value": "https://api-product.usoftmall.com/"
+  "value": "http://api-product.usoftchina.com/"
 }]