Merge remote-tracking branch 'origin/dev-1.0' into dev-1.0

This commit is contained in:
cheney 2022-09-02 14:27:29 +08:00
commit c6d6a200cc
4 changed files with 31 additions and 25 deletions

View File

@ -10,6 +10,7 @@ import com.sunyard.util.SYMUtil;
import org.apache.logging.log4j.Logger;
import racal.sunyard.main.SydApi4j;
import javax.annotation.CheckForNull;
import java.util.Arrays;
import java.util.List;
@ -131,8 +132,7 @@ public class SydApi4Database implements SydApi {
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
updateLastUseTime();
for (SydApi4j api : this.hsms) {
@ -190,7 +190,8 @@ public class SydApi4Database implements SydApi {
log.debug("Util.hexString2Bytes方法返回值{}", Arrays.toString(procData));
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
updateLastUseTime();
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -234,6 +235,7 @@ public class SydApi4Database implements SydApi {
}
}
}
throw le;
}
@ -252,7 +254,7 @@ public class SydApi4Database implements SydApi {
updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex);
SydApiException le = null;
SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) {
if (null == api) {
continue;
@ -333,7 +335,7 @@ public class SydApi4Database implements SydApi {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) {
if (null == api) {
continue;
@ -392,7 +394,7 @@ public class SydApi4Database implements SydApi {
updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex);
SydApiException le = null;
SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) {
if (null == api) {
continue;
@ -443,6 +445,9 @@ public class SydApi4Database implements SydApi {
}
} catch (SydApiException e) {
if (null==e){
}
le = e;
if (e.getRetCode() < 0) {
log.error("HA 重试");
@ -453,6 +458,7 @@ public class SydApi4Database implements SydApi {
}
}
}
throw le;
}
@ -471,7 +477,7 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) {
if (null == api) {
continue;
@ -538,7 +544,8 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) {
if (null == api) {
continue;
@ -608,8 +615,7 @@ public class SydApi4Database implements SydApi {
if (Consts.PkgNumAll != iPkgNum && Consts.PkgNumHead != iPkgNum) {
iv = pcProcData.getBytes();
}
SydApiException le = null;
SydApiException le = new SydApiException(0);
updateLastUseTime();
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -707,7 +713,8 @@ public class SydApi4Database implements SydApi {
}
String keyIndex = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex));
log.debug("\"SK\" + SYMUtil.genPrivateKeyMark方法返回值{}", keyIndex);
SydApiException le = null;
SydApiException le = new SydApiException(0);
updateLastUseTime();
for (SydApi4j api : this.hsms) {
if (null == api) {

View File

@ -33,13 +33,16 @@ public class HsmLinkInfo {
log.debug("mutiHsmLinkInfo方法接收参数:pcIpList:{},iPortList:{},iConnectTimeOut:{},iDealTimeOut:{}", Arrays.toString(pcIpList),Arrays.toString(iPortList),iConnectTimeOut,iAllDealTimeOut);
log.debug("链接参数整理");
if (null == pcIpList &&
null == iPortList &&
pcIpList.length != iPortList.length) {
if (null == pcIpList ||
null == iPortList
) {
log.error("ip 和 port 为空");
throw new IllegalArgumentException("入参错误");
}
if ( pcIpList.length != iPortList.length){
log.error("加密机配置 ip 和 port 数量错误");
throw new IllegalArgumentException("入参错误");
}
if ( iAllDealTimeOut < pcIpList.length) {
log.error("加密机配置交易时间过短");
throw new IllegalArgumentException("入参错误");

View File

@ -35,8 +35,8 @@ public class LogFactory {
// 日志目录
public static String pcLogPath = "./sydapi-logs/";
// 日期格式
private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// // 日期格式
// private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private LogFactory() {
}
@ -59,10 +59,10 @@ public class LogFactory {
// "/logs/test/" + jobID + "/syncshows-job-" + jobID + ".log.gz",
// "true", jobID, null, null, null, tp, null, layout, null,
// null, null, null, config);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// 日志打印方式输出为文件   
Appender appender = FileAppender.createAppender(
String.format( pcLogPath +"sydapi_"+getToday() + ".log"),
String.format( pcLogPath +"sydapi_"+ format.format(new Date()) + ".log"),
"true", "false",
logName, null, "true", "true", null, layout, null, null, null, config);
@ -88,10 +88,6 @@ public class LogFactory {
}
public static String getToday(){
return format.format( new Date());
}
/**
* 创建 Logger
* @return Logger

View File

@ -3,10 +3,10 @@ package com.sunyard.sge.pool;
public class PoolConfig {
// 最大空闲时间
private long maxIdle = 5 * 60 ; // 5 分钟
private long maxIdle = 5L * 60L ; // 5 分钟
// 最大无用时间
private long maxUseless = 30 * 60 ; // 30 分钟
private long maxUseless = 30L * 60L ; // 30 分钟
public long getMaxIdle() {
return maxIdle;