Ver Fonte

优化金蝶云读取配置

ouyj há 3 meses atrás
pai
commit
7bf35d041d

+ 26 - 11
src/main/contract/com/yw/contract/common/sync/jdy/JdyHelper.java

@@ -18,13 +18,16 @@ import java.util.List;
 public class JdyHelper {
     private static final Logger log = LoggerFactory.getLogger(JdyHelper.class);
 
-    public String appKey = "3xBAENSw";//正式
-    //public String appKey = "zPkkBvUh";//测试 
-    public String appSecret = "31dfdd0e43f7a45866572c1fdcee9e147dd5aa0b";
-    public String clientId = "311535";
-    public String clientSecret = "db6843b24529bc61f16ca949d605414a";
-    public String appId = "410484115683545088"; //正式
-    //public String appId = "401915603356618752";//测试
+    //public String appKey = "3xBAENSw";//正式 
+    //public String appKey = "O6zcYS9Q";//测试 
+    public String appKey = getPropertyValue("jdy_appKey", "qr8H1Jlk");//测试  
+    //public String appSecret = "8fd78e74ac21f4f5228cf972d8b4dbb8b61f49ab"; //有时效性
+    public String appSecret = getPropertyValue("jdy_appSecret", "0784bf4ce8270054a519510eba14666783968fab"); //有时效性
+    public String clientId = getPropertyValue("jdy_clientId", "311535");
+    public String clientSecret = getPropertyValue("jdy_clientSecret", "db6843b24529bc61f16ca949d605414a");
+    //public String appId = "410484115683545088"; //正式 
+    //public String appId = "410484115683545088";//测试
+    public String appId = getPropertyValue("jdy_appId", "512699104292376576");//测试
     private final int replay = 3;
 
     public boolean isAuth = false;
@@ -57,10 +60,22 @@ public class JdyHelper {
     }
 
     public void initParam(){
-        appKey= StringUtil.readyPropertiesByIO("appKey");
-        appSecret=StringUtil.readyPropertiesByIO("appSecret");
-        clientId=StringUtil.readyPropertiesByIO("clientId");
-        clientSecret=StringUtil.readyPropertiesByIO("clientSecret");
+        appKey= getPropertyValue("jdy_appKey", appKey);
+        appSecret=getPropertyValue("jdy_appSecret", appSecret);
+        clientId=getPropertyValue("jdy_clientId", clientId);
+        clientSecret=getPropertyValue("jdy_clientSecret", clientSecret);
+        appId=getPropertyValue("jdy_appId", appId);
+    }
+
+    /**
+     * 从配置文件获取属性值,如果配置文件中不存在则使用默认值
+     * @param key 属性键
+     * @param defaultValue 默认值
+     * @return 属性值或默认值
+     */
+    private String getPropertyValue(String key, String defaultValue) {
+        String value = StringUtil.readProperties(key);
+        return StringUtil.isEmpty(value) ? defaultValue : value;
     }
 
     public void initClient(){

+ 11 - 3
src/main/resources/ynet.properties

@@ -1,8 +1,8 @@
 
-FILE_ROOT_PATH = D:\\ygtx\\xinbanoa\\web\\xinbanoa
+FILE_ROOT_PATH = E:\\YR\\workspace\\ygtx_oa
 
 #JS path
-FILE_PATH = D:\\ygtx\\xinbanoa\\web\\xinbanoa
+FILE_PATH = E:\\YR\\workspace\\ygtx_oa
 
 #FILE path
 SYSTEM_TYPE = Windows
@@ -55,11 +55,19 @@ SWFTOOLS = D:\\swftools\\
 #\u662f\u5426\u662f\u6d4b\u8bd5\u73af\u5883
 testEnvironment = true
 #clock single/multiple
-clock = multiple
+clock = single
 
 mes_url = http://127.0.0.1:83
+#mes_url = http://222.243.138.146:880/prod-api
+#mes_url = http://api.hnyunzhu.com:880/prod-api
 mes_UserName = admin
 mes_passwd = admin123
 
+jdy_appKey=qr8H1Jlk
+jdy_appSecret=0784bf4ce8270054a519510eba14666783968fab
+jdy_clientId=311535
+jdy_clientSecret=db6843b24529bc61f16ca949d605414a
+jdy_appId=512699104292376576
+