package com.kingdee.eas.custom.esign.util; import com.kingdee.eas.custom.esign.bizEnum.EsignConfigEnum; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.Properties; import java.util.Set; public class EsignConfig { private Properties propt = new Properties();//共用参数 private static EsignConfig instance = new EsignConfig(); public static EsignConfig getInstance() { return instance; } // 应用ID public String getEsignAppId() { return this.propt.getProperty(EsignConfigEnum.ESIGNAPPID_VALUE); } // 应用密钥 public String getEsignAppSecret() { return this.propt.getProperty(EsignConfigEnum.ESIGNAPPSECRET_VALUE); } // e签宝接口调用域名(模拟环境) //"https://smlopenapi.esign.cn"; // e签宝接口调用域名(正式环境) //"https://openapi.esign.cn"; public String getEsignHost() { return this.propt.getProperty(EsignConfigEnum.ESIGNHOST_VALUE); } public String get(String key) { return this.propt.getProperty(key); } private EsignConfig() { this.initConfig("/server/properties/esign/esignConfig.properties"); } public void initConfig(String filePath) { try { InputStreamReader reader = new InputStreamReader( new FileInputStream(System.getProperty("EAS_HOME") + filePath), "GBK"); this.propt.load(reader); } catch (IOException e) { e.printStackTrace(); } } public Map getConfig() { Map map = new HashMap<>(); Set> set = this.propt.entrySet(); for (Map.Entry entry : set) { map.put((String) entry.getKey(), (String) entry.getValue()); } return map; } }