|
|
@@ -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(){
|