修复问题

This commit is contained in:
junj2.liang 2022-09-02 12:10:02 +08:00
parent 598dffcc5d
commit 85d774d0e4
2 changed files with 19 additions and 26 deletions

View File

@ -132,8 +132,7 @@ public class SydApi4Database implements SydApi {
if (null == this.hsms || this.hsms.length < 1) { if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1); throw new SydApiException(-1);
} }
@CheckForNull SydApiException le = new SydApiException(0);
SydApiException le = null;
updateLastUseTime(); updateLastUseTime();
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
@ -191,8 +190,8 @@ public class SydApi4Database implements SydApi {
log.debug("Util.hexString2Bytes方法返回值{}", Arrays.toString(procData)); log.debug("Util.hexString2Bytes方法返回值{}", Arrays.toString(procData));
} }
@CheckForNull
SydApiException le = null; SydApiException le = new SydApiException(0);
updateLastUseTime(); updateLastUseTime();
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
@ -236,6 +235,7 @@ public class SydApi4Database implements SydApi {
} }
} }
} }
throw le; throw le;
} }
@ -254,8 +254,7 @@ public class SydApi4Database implements SydApi {
updateLastUseTime(); updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex); String keyIndex = String.format("%08d", iKeyIndex);
@CheckForNull SydApiException le = new SydApiException(0);
SydApiException le = null;
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -335,8 +334,8 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) { for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i])); keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
} }
@CheckForNull
SydApiException le = null; SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -394,8 +393,8 @@ public class SydApi4Database implements SydApi {
} }
updateLastUseTime(); updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex); String keyIndex = String.format("%08d", iKeyIndex);
@CheckForNull
SydApiException le = null; SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -478,8 +477,7 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) { for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i])); keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
} }
@CheckForNull SydApiException le = new SydApiException(0);
SydApiException le = null;
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -546,8 +544,8 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) { for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i])); keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
} }
@CheckForNull
SydApiException le = null; SydApiException le = new SydApiException(0);
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
continue; continue;
@ -617,8 +615,7 @@ public class SydApi4Database implements SydApi {
if (Consts.PkgNumAll != iPkgNum && Consts.PkgNumHead != iPkgNum) { if (Consts.PkgNumAll != iPkgNum && Consts.PkgNumHead != iPkgNum) {
iv = pcProcData.getBytes(); iv = pcProcData.getBytes();
} }
@CheckForNull SydApiException le = new SydApiException(0);
SydApiException le = null;
updateLastUseTime(); updateLastUseTime();
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {
@ -716,8 +713,8 @@ public class SydApi4Database implements SydApi {
} }
String keyIndex = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex)); String keyIndex = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex));
log.debug("\"SK\" + SYMUtil.genPrivateKeyMark方法返回值{}", keyIndex); log.debug("\"SK\" + SYMUtil.genPrivateKeyMark方法返回值{}", keyIndex);
@CheckForNull
SydApiException le = null; SydApiException le = new SydApiException(0);
updateLastUseTime(); updateLastUseTime();
for (SydApi4j api : this.hsms) { for (SydApi4j api : this.hsms) {
if (null == api) { if (null == api) {

View File

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