/* */
|
package com.gkhy.exam.pay.utils;
|
/* */
|
/* */
|
|
|
import com.gkhy.exam.pay.utils.config.SdkConfig;
|
import com.gkhy.exam.pay.utils.config.StringUtil;
|
|
import java.io.IOException;
|
import java.io.InputStream;
|
import java.util.Properties;
|
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */ public class ClientFactory
|
/* */ {
|
/* */ private static boolean onReady = false;
|
|
/* */
|
/* */
|
public static void initConfig() {
|
/* 25 */
|
if (!onReady) {
|
/* 26 */
|
InputStream read = null;
|
/* */
|
try {
|
/* 28 */
|
read = ClientFactory.class.getClassLoader().getResourceAsStream("config.properties");
|
/* */
|
/* 30 */
|
if (read != null) {
|
/* 31 */
|
Properties properties = new Properties();
|
/* 32 */
|
properties.load(read);
|
/* 33 */
|
String appId = properties.getProperty("appId");
|
/* 34 */
|
String fsServiceUrl = properties.getProperty("remote.fsweb.service");
|
/* 35 */
|
String fsPublicUrl = properties.getProperty("remote.fsweb.public");
|
/* 36 */
|
sdkConfig(appId, fsServiceUrl, fsPublicUrl);
|
/* */
|
} else {
|
/* */
|
/* 39 */
|
if (SdkConfig.appId == null) {
|
/* 40 */
|
SdkConfig.loadSDKProperties();
|
/* */
|
}
|
/* 42 */
|
openClient();
|
/* */
|
}
|
/* 44 */
|
} catch (Exception e) {
|
/* 45 */
|
e.printStackTrace();
|
/* 46 */
|
throw new RuntimeException("加载配置文件错误!");
|
/* */
|
} finally {
|
/* */
|
try {
|
/* 49 */
|
if (read != null) {
|
/* 50 */
|
read.close();
|
/* */
|
}
|
/* 52 */
|
} catch (IOException e) {
|
/* 53 */
|
e.printStackTrace();
|
/* 54 */
|
throw new RuntimeException("加载配置文件错误!");
|
/* */
|
}
|
/* */
|
}
|
/* */
|
}
|
/* */
|
}
|
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
public static ResponseDataVo<?> sdkConfig(String appId, String fsServiceUrl, String fsPublicUrl) {
|
/* 70 */
|
if (!StringUtil.verificationEmpty(appId) && !StringUtil.verificationEmpty(fsServiceUrl) &&
|
/* 71 */ !StringUtil.verificationEmpty(fsPublicUrl)) {
|
/* 72 */
|
SdkConfig.appId = appId;
|
/* 73 */
|
SdkConfig.fsServiceUrl = fsServiceUrl;
|
/* 74 */
|
SdkConfig.fsPublicUrl = fsPublicUrl;
|
/* 75 */
|
openClient();
|
/* 76 */
|
return new ResponseDataVo("0000", null, "设置成功");
|
/* */
|
}
|
/* 78 */
|
return new ResponseDataVo("1111", null, "设置失败");
|
/* */
|
}
|
|
/* */
|
/* */
|
/* */
|
public static void logConfig(String logPath, String logMaxFileSize, String logTotalSizeCap, boolean logAdditive) {
|
/* 83 */
|
if (logPath != null) {
|
/* 84 */
|
SdkConfig.logPath = logPath;
|
/* */
|
}
|
/* 86 */
|
if (logMaxFileSize != null) {
|
/* 87 */
|
SdkConfig.logMaxFileSize = logMaxFileSize;
|
/* */
|
}
|
/* 89 */
|
if (logTotalSizeCap != null) {
|
/* 90 */
|
SdkConfig.logTotalSizeCap = logTotalSizeCap;
|
/* */
|
}
|
/* 92 */
|
SdkConfig.logAdditive = logAdditive;
|
/* */
|
/* 94 */
|
// LoggerBuilder.reLoad();
|
/* */
|
}
|
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
static void openClient() {
|
/* 104 */
|
onReady = true;
|
/* */
|
}
|
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
static void closeClient() {
|
/* 114 */
|
onReady = false;
|
/* */
|
}
|
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
/* */
|
// public static BillClient getBillClient() {
|
// /* 124 */
|
// initConfig();
|
// /* */
|
// /* 126 */
|
// if (!onReady) {
|
// /* 127 */
|
// throw new RuntimeException(
|
// /* 128 */ "Your configuration item verification failed. Please call the sdkconfig function to set");
|
// /* */
|
// }
|
// /* */
|
// /* 131 */
|
// BillClient billClient = (BillClient) (new ClientValidatorAndLogProxy(new BillClientImpl())).newProxyInstance();
|
// /* 132 */
|
// return billClient;
|
// /* */
|
// }
|
//
|
// /* */
|
// /* */
|
// /* */
|
// /* */
|
// /* */
|
// /* */
|
// /* */
|
// /* */
|
// public static PaymentClient getPaymentClient() {
|
// /* 142 */
|
// initConfig();
|
// /* 143 */
|
// if (!onReady) {
|
// /* 144 */
|
// throw new RuntimeException(
|
// /* 145 */ "Your configuration item verification failed. Please call the sdkconfig function to set");
|
// /* */
|
// }
|
// /* */
|
// /* 148 */
|
// PaymentClient paymentClient = (PaymentClient) (new ClientValidatorAndLogProxy(new PaymentClientImpl()))
|
///* 149 */.newProxyInstance();
|
// /* 150 */
|
// return paymentClient;
|
// /* */
|
// }
|
/* */
|
}
|
|
|
/* Location: D:\jar\sign_util-1.0-SNAPSHOT.20240227.jar!\BOOT-INF\lib\SNAPSHOT-1.0.0.jar!\com\xjhys\edu\fee\sdk\client\impl\ClientFactory.class
|
* Java compiler version: 8 (52.0)
|
* JD-Core Version: 1.1.3
|
*/
|