Commit 0dea854b authored by huyuchen's avatar huyuchen

工行对接修改

parent a5adbde5
......@@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
......@@ -65,16 +66,14 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
bizContent.setOutVendorId("020101190");
//操作类型:1-受理 2-审核
bizContent.setOprType("1");
bizContent.setTotalAmt("1000");
bizContent.setTotalCount("1");
bizContent.setAppSerialno("WX2");
bizContent.setLocalFilepath("D:/icbcFile/020101190_WX2_0_20240801.xls");
bizContent.setFileMdcode(getMdCode("D:/icbcFile/020101190_WX2_0_20240801.xls"));
bizContent.setTotalAmt("2");
bizContent.setTotalCount("2");
bizContent.setAppSerialno("WX03");
bizContent.setLocalFilepath("D:/icbcFile/020101190_WX03_0_20240816.xls");
bizContent.setFileMdcode(getMdCode("D:/icbcFile/020101190_WX03_0_20240816.xls"));
bizContent.setFileType("1");
bizContent.setNotifyUrl(null);
bizContent.setAppRemark("备注");
bizContent.setBusinessType(null);
bizContent.setFileCheckSign(null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("key",request);
String a = jsonObject.toJSONString();
......@@ -93,18 +92,26 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
public R selectIcbcTransactionFlowInfo() {
DefaultIcbcClient client = new DefaultIcbcClient(icbcConfigProperties.getAppId(), IcbcConstants.SIGN_TYPE_RSA2,
icbcConfigProperties.getAppPrivateKey(), IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON,
icbcConfigProperties.getApigwPublicKey(), IcbcConstants.ENCRYPT_TYPE_AES, icbcConfigProperties.getAesKey(), null, null);
//应用id 应用方私钥 网关公钥 应用方加密串
String APP_ID = "11000000000000028685";
//应用方私钥
String MY_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEA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Hq2rSVKlVW42/wgVGwZdt8VX9ztKiAgqve1BbjNFmcAytb74YSOgFic5Wwl6uglx8LiwdY93ShQY+maVsPhEj8jFjGe2JlMscX8QgzkfxowrOpdlXsMSYgbG0ccBkXWZXbsh8tsUH9g+WNAoGAbQ5avOo0uF603Uts7ZFC0Lia0Vcx499oxGG5s8Js7tBAS6I7bRp5xokQHz/8BRKBL52oWJklpgy+N6oBnU7rFgRGaZBITABedqIWppHtac4ihUyQ+ZPRIfZqpmOXuaFJVmjUkm6zimpD+TOlaX3ZL88fdDX0E3xuBtBwBuxIkH0CgYEAlXyBbG2/fVV/PDUVCAA+aeWstojR1ncDhJmFnENSk5I/y3mh+d+u4ZG3hmVQZfR1EYM+n9wPQ2LxqNpGPA8o4JK/MSfVKun4lBwjkergHzxWJ5AMuYL1DPrOtMPEqrTqOHfVzSZGsz9cMK4tDWETKKFBOM/5oSdGGW3oYvzcS0M=";
//网关公钥
String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
//应用方加密串
String AES_Key = "8jTKCqZ9035g+HRzpZQqZA==";
DefaultIcbcClient client = new DefaultIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2,
MY_PRIVATE_KEY, IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON,
APIGW_PUBLIC_KEY, IcbcConstants.ENCRYPT_TYPE_AES, AES_Key, null, null);
JftApiPayrollQueryDetailRequestV1 request = new JftApiPayrollQueryDetailRequestV1();
request.setServiceUrl("https://apipcs3.dccnet.com.cn/api/jft/api/payroll/querydetail/V1");
request.setServiceUrl("https://gw.open.icbc.com.cn/api/jft/api/payroll/querydetail/V1");
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz bizContent = new
JftApiPayrollQueryDetailRequestV1.JftApiPayrollQueryDetailRequestV1Biz();
bizContent.setAppId(icbcConfigProperties.getAppId());
bizContent.setOutVendorId(icbcConfigProperties.getCompanyNo());
bizContent.setAppId(APP_ID);
bizContent.setOutVendorId("020101190");
bizContent.setType("2");
//批次号,appSerialno为空时,必输
bizContent.setAppBatserialno("21900");
bizContent.setAppBatserialno("WX01");
//内部批次号,组成规则:批次号-顺序号,appBatserialno为空时必输
// bizContent.setAppSerialno("230921");
bizContent.setStartId("0");
......@@ -176,30 +183,59 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
}
public String getMdCode(String filePath) {
try {
MessageDigest md5Digest = MessageDigest.getInstance("MD5");
byte[] buffer = new byte[8192];
// try {
// MessageDigest md5Digest = MessageDigest.getInstance("MD5");
// byte[] buffer = new byte[8192];
//
// try (FileInputStream fis = new FileInputStream(filePath)) {
// int bytesRead;
// while ((bytesRead = fis.read(buffer)) != -1) {
// md5Digest.update(buffer, 0, bytesRead);
// }
// }
// byte[] md5Bytes = md5Digest.digest();
//
// // Convert the byte to hex format
// StringBuilder result = new StringBuilder();
// for (byte md5Byte : md5Bytes) {
// result.append(Integer.toString((md5Byte & 0xff) + 0x100, 16).substring(1));
// }
//
// return result.toString();
// } catch (NoSuchAlgorithmException | IOException e) {
// //Handle the exception according to your requirements
// e.printStackTrace();
// return null;
// }
try (FileInputStream fis = new FileInputStream(filePath)) {
int bytesRead;
while ((bytesRead = fis.read(buffer)) != -1) {
md5Digest.update(buffer, 0, bytesRead);
FileInputStream in = null;
byte[] buffer = new byte[1024];
String mdCode;
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
in = new FileInputStream(filePath);
int len;
while ((len = in.read(buffer, 0, 1024)) != -1) {
digest.update(buffer, 0, len);
}
BigInteger bigInt = new BigInteger(1, digest.digest());
mdCode = bigInt.toString();
return mdCode;
} catch (NoSuchAlgorithmException noSuchExc) {
mdCode = null;
} catch (IOException exception) {
exception.printStackTrace();
return null;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException exc) {
;
}
byte[] md5Bytes = md5Digest.digest();
// Convert the byte to hex format
StringBuilder result = new StringBuilder();
for (byte md5Byte : md5Bytes) {
result.append(Integer.toString((md5Byte & 0xff) + 0x100, 16).substring(1));
}
return result.toString();
} catch (NoSuchAlgorithmException | IOException e) {
//Handle the exception according to your requirements
e.printStackTrace();
return null;
}
return mdCode;
}
}
......@@ -109,9 +109,10 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
// DefaultIcbcClient client = new DefaultIcbcClient("10000000000000223600", IcbcConstants.SIGN_TYPE_CA_SM_ICBC, MY_PRIVATE_KEY,
// IcbcConstants.CHARSET_UTF8, IcbcConstants.FORMAT_JSON, null,
// null, null, "1.2.156.10197.1.301", null);
String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
String ca_sm_path = "D:/icbcFile/ahwx.y.1302.cer";
String ca_sm_icbc_path = "D:/icbcFile/API_GATEWAY_ICBC_SM.cer";
String ca_sm_icbc_path = "D:/icbcFile/API_GATEWAY_ICBC_SM_REAL.cer";
String ca_sm = IcbcSignature.getCAInfoStr(ca_sm_path);
......@@ -127,14 +128,15 @@ public class IcbcTransactionFlowQueryServiceImpl extends ServiceImpl<EkpSocialIn
MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1 bizContent = new MybankEnterpriseTradeQhisdRequestV1.MybankEnterpriseTradeQhisdRequestBizV1();
MybankEnterpriseTradeQhisdRequestV1 request = new MybankEnterpriseTradeQhisdRequestV1();
bizContent.setTranDate("20240814");
bizContent.setTranDate("20240815");
bizContent.setTranTime("105900000");
bizContent.setTransCode("AHWX");
bizContent.setTransCode("QHISD");
bizContent.setLanguage("zh_CN");
String fSeqNo = "AHWX" + System.currentTimeMillis();
bizContent.setfSeqno(fSeqNo);
bizContent.setAccountNo("1302010109024596014");
bizContent.setBeginDate("20240814");
bizContent.setBeginDate("20240815");
bizContent.setDrcrf("2");
request.setServiceUrl("https://gw.open.icbc.com.cn/api/mybank/enterprise/trade/qhisd/V1");
request.setBizContent(bizContent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment