12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package com.kingdee.eas.custom.shuiyou.utils;
- import cn.com.servyou.rmi.client.ClientProxyFactory;
- import com.kingdee.bos.BOSException;
- import com.kingdee.util.StringUtils;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.util.Properties;
- /**
- * @Description TODO
- * @Date 2024/9/11 16:38
- * @Created by Heyuan
- */
- public class ClientProxyFactoryUtils {
- /**
- * 获取客户端代理工厂
- *
- * @return
- * @throws IOException
- * @throws BOSException
- */
- public static ClientProxyFactory getClientProxyFactory() throws IOException, BOSException {
- StringBuilder errorMsg = new StringBuilder();
- Properties properties = new Properties();
- properties.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
- String ip = properties.getProperty("ip");
- if (StringUtils.isEmpty(ip)) {
- errorMsg.append("接口ip不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
- }
- String appKey = properties.getProperty("appKey");
- if (StringUtils.isEmpty(appKey)) {
- errorMsg.append("接口appKey不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
- }
- String appSecret = properties.getProperty("appSecret");
- if (StringUtils.isEmpty(appSecret)) {
- errorMsg.append("接口appSecret不能为空,请检查配置文件/server/properties/sy/syConfig.properties\n");
- }
- if (errorMsg.length() > 0) {
- throw new BOSException(errorMsg.toString());
- }
- //客户端代理工厂
- return new ClientProxyFactory(appKey, appSecret, ip);
- }
- }
|