Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
1a76f88d
Commit
1a76f88d
authored
Aug 21, 2024
by
huyuchen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工行对接修改
parent
fabb54f1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
244 additions
and
42 deletions
+244
-42
IcbcAsynctInfoVo.java
.../java/com/yifu/cloud/plus/v1/ekp/vo/IcbcAsynctInfoVo.java
+54
-0
IcbcTransactionFlowIssueController.java
...v1/ekp/controller/IcbcTransactionFlowIssueController.java
+28
-0
IcbcTransactionFlowIssueService.java
.../plus/v1/ekp/service/IcbcTransactionFlowIssueService.java
+6
-0
IcbcTransactionFlowIssueServiceImpl.java
...ekp/service/impl/IcbcTransactionFlowIssueServiceImpl.java
+154
-41
application-test.yml
...-ekp/yifu-ekp-biz/src/main/resources/application-test.yml
+2
-1
No files found.
yifu-ekp/yifu-ekp-api/src/main/java/com/yifu/cloud/plus/v1/ekp/vo/IcbcAsynctInfoVo.java
0 → 100644
View file @
1a76f88d
package
com
.
yifu
.
cloud
.
plus
.
v1
.
ekp
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Author huyc
* @Date 2024/8/21
* @Description 异步通知参数
* @Version 1.0
*/
@Data
public
class
IcbcAsynctInfoVo
implements
Serializable
{
/**
* 企业编号
**/
private
String
outVendorId
;
/**
* 批次号
**/
private
String
appBatserialno
;
/**
* appId
**/
private
String
appId
;
/**
* 批次状态
**/
private
String
status
;
/**
* 金额
**/
private
String
amount
;
/**
* 代发企业账号
**/
private
String
payAcctNo
;
/**
* api
**/
private
String
api
;
/**
* 平台名称
**/
private
String
appName
;
/**
* 企业网银返回值
**/
private
String
companyReturnMsg
;
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/controller/IcbcTransactionFlowIssueController.java
View file @
1a76f88d
...
...
@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 聚富通代发工资相关
*
...
...
@@ -61,4 +63,30 @@ public class IcbcTransactionFlowIssueController {
public
R
businessOpen
()
{
return
icbcTransactionFlowIssueService
.
businessOpen
();
}
/**
* 行名行号查询接口
*
* @param
* @param
* @return
*/
@Operation
(
summary
=
"行名行号查询接口"
,
description
=
"行名行号查询接口"
)
@PostMapping
(
"/querybankinfo"
)
public
R
querybankinfo
()
{
return
icbcTransactionFlowIssueService
.
querybankinfo
();
}
/**
* 代发工资发放成功异步通知功能
*
* @param
* @param
* @return
*/
@Operation
(
summary
=
"代发工资发放成功异步通知功能"
,
description
=
"代发工资发放成功异步通知功能"
)
@PostMapping
(
"/notifyUrl"
)
public
R
asyncNotice
(
HttpServletRequest
request
)
throws
Exception
{
return
icbcTransactionFlowIssueService
.
asyncNotice
(
request
);
}
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/IcbcTransactionFlowIssueService.java
View file @
1a76f88d
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 聚富通代发工资相关
*
...
...
@@ -18,4 +20,8 @@ public interface IcbcTransactionFlowIssueService extends IService<EkpSocialInfo>
R
businessOpen
();
R
querybankinfo
();
R
asyncNotice
(
HttpServletRequest
request
)
throws
Exception
;
}
yifu-ekp/yifu-ekp-biz/src/main/java/com/yifu/cloud/plus/v1/ekp/service/impl/IcbcTransactionFlowIssueServiceImpl.java
View file @
1a76f88d
...
...
@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.ekp.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.icbc.api.DefaultIcbcClient
;
import
com.icbc.api.IcbcApiException
;
import
com.icbc.api.IcbcConstants
;
...
...
@@ -10,8 +11,12 @@ import com.icbc.api.UiIcbcClient;
import
com.icbc.api.request.JftApiPayrollQueryDetailRequestV1
;
import
com.icbc.api.request.JftApiVendorSeparateAccountsBusinessOpenRequestV1
;
import
com.icbc.api.request.JftUiPayrollComfirmSubmitRequestV1
;
import
com.icbc.api.request.MybankEnterpriseAccountQuerybankinfoRequestV1
;
import
com.icbc.api.response.JftApiPayrollQueryDetailResponseV1
;
import
com.icbc.api.response.JftApiVendorSeparateAccountsBusinessOpenResponseV1
;
import
com.icbc.api.response.MybankEnterpriseAccountQuerybankinfoResponseV1
;
import
com.icbc.api.utils.IcbcSignature
;
import
com.icbc.api.utils.WebUtils
;
import
com.yifu.cloud.plus.v1.ekp.config.IcbcConfigProperties
;
import
com.yifu.cloud.plus.v1.ekp.entity.EkpSocialInfo
;
import
com.yifu.cloud.plus.v1.ekp.mapper.EkpSocialInfoMapper
;
...
...
@@ -24,11 +29,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.stereotype.Service
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.math.BigInteger
;
import
java.net.URLDecoder
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.SimpleDateFormat
;
import
java.util.Base64
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 聚富通到账通知交易流水查询
...
...
@@ -45,11 +57,14 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
@Autowired
private
IcbcConfigProperties
icbcConfigProperties
;
//1、网关公钥
private
static
final
String
APIGW_PUBLIC_KEY
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB"
;
//2、appid
private
static
final
String
APP_ID
=
"11000000000000029313"
;
//3、密钥对认证方式,公钥在API平台登记,此处为私钥
private
static
final
String
MY_PRIVATE_KEY
=
"MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC96zrfaBT4YOoLErhTaFnv0De1K3ZsZRQDGm3dIF8wHX/Rqg2sz5hfJexMwNgTepHdxrpveq8bog9jny8CtCT2etUD+NKT0gBYx4FzjCy1vtJzO1BqyzqzHA+GMsFQ/CYucRo25SJRv9szJD7d0SlnD0rnJWnbCuK+OgzM1ixCeUKsF/94Fgbo95UeW6EhH8H4VwNNrWRZei+eLfkIoHMSTB9D2g58i5S++/oieLg52MRd35x3pm60ipcGTgLpLi0xJGNB3dDDNA/UG3D7jbpLha3+eX1SaKU3jmTZYyLBFRe4fuY1LJq8gI03KGNHhPsbu1Gn8q9H7pcK3O1JAqStAgMBAAECggEAPiRuCxO/aNYtPppNfd0zMGjtEXa7NRSNy8YmFKi2/MNqQ2xlNRpoPRnni+W9zgHZILwZ3MhD68LHTk2T0EqpnYzrjnUoUf3w5xvAm9JN/toFenb6BTeiaWDRI5QP9TPMOn3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ynBA1kpucIRUDnUwbGcfEbf2ufhPd10dg=="
;
public
R
submitIcbcTransactionFlow
()
{
//应用id 应用方私钥 网关公钥 应用方加密串
String
APP_ID
=
"11000000000000028685"
;
//应用方私钥
String
MY_PRIVATE_KEY
=
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCEZYrhm3dBp3PqlMc9fBBEE8Tp8M34Yy6Ucs3FV/VahsdHaLe0kEPugf1twbt/hD4hdIwzUj/ZtG2BhusRiMptdlWtNKcIgFxaaFaKANKrIodeQjv0jjZvK9ugoQxmiM4gF5SGX2a847zohv/6TvAYiB9AI3tdKQTbj6I3pwmuO3cfzgU5IwepeguE4fxqnh7C19MEq4vXv0yBq/f43zQ2HBMS+KRgokNLUBqoEOyfaKkPL9ot+zISPwENQOLqQMZ1hczp5tEB2FeZecdzrzjeXkzPSy1ZJmNyNuOl+WG85aoeDJTQ7hx/g6KFA6zU2VBGUR7q4pXdGRslpa6KYETBAgMBAAECggEALkfElXqf5G5hocWiJAcDNJjog5JunX4mITREY9CMbrmgXYDofpDTfkMoUL6hCUEz6sPv4lzE/xgIE3gTIcz8Xek4p9Q480rTfbLtVU5WVgY65aMnjCROOOxO2MaTLCB0VVmIzLP6mNrPBUVzo48GdLzYl7YPgJA/J3T9EpEsXB/iAdjiv/VH9vOIW6WUlQUSceyNznf1rfwMJvHt7zb56IJGZMq9G6C5SUeqWbqbvNi+nL8yeu8fM/O/ERZJQBDwMXbRAPvhhcbDwVzpg4BRc7AVv0SLzy6ZA2+zLJmDe9F9uXmG6QQ4ra8mDqLeugDP9blKUOEm8JLIh7nzvhpNhQKBgQDK4ZEz1zui6GQsxsnbm24EvparfniPqDBS/V29MDZysXDmG123R22RA//BWC3m5cY+3vg0ayCGaXRrc9/V+u+jmwVfsR6XCM6WM2IZVVFBUzqKMlTKsZ4n3V/6pqBHG8++GUab5W6p/7NYI22xx0ZFObEt4EkaaaP7RzY6AVrtCwKBgQCnD6P24uR6VHN84lhyZl+iJW6azTd26AhaJ768wSl5rqN6N4AV9cXeAUKylPgMPvy+2mjNX7He0Oitb7/lrKK93/olmDQoHpqj1yZum8VVPiyEKk6qCoYYoHEloLPJDPRs6yiBjrO8oghHRuyJErKRN6IZC3Rq/mrXuDwrZYS84wKBgFn9wDisigly56xs6PD+esij+ZVMXhHq2rSVKlVW42/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"
;
//应用方加密串
...
...
@@ -96,12 +111,6 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
public
R
selectIcbcTransactionFlowInfo
()
{
//应用id 应用方私钥 网关公钥 应用方加密串
String
APP_ID
=
"11000000000000028685"
;
//应用方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jrO8oghHRuyJErKRN6IZC3Rq/mrXuDwrZYS84wKBgFn9wDisigly56xs6PD+esij+ZVMXhHq2rSVKlVW42/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
,
...
...
@@ -133,14 +142,37 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return
R
.
ok
();
}
public
R
businessOpen
()
{
public
R
querybankinfo
()
{
//1、网关公钥
String
APIGW_PUBLIC_KEY
=
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB"
;
//2、appid
String
APP_ID
=
"11000000000000029313"
;
//3、密钥对认证方式,公钥在API平台登记,此处为私钥
String
MY_PRIVATE_KEY
=
"MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC96zrfaBT4YOoLErhTaFnv0De1K3ZsZRQDGm3dIF8wHX/Rqg2sz5hfJexMwNgTepHdxrpveq8bog9jny8CtCT2etUD+NKT0gBYx4FzjCy1vtJzO1BqyzqzHA+GMsFQ/CYucRo25SJRv9szJD7d0SlnD0rnJWnbCuK+OgzM1ixCeUKsF/94Fgbo95UeW6EhH8H4VwNNrWRZei+eLfkIoHMSTB9D2g58i5S++/oieLg52MRd35x3pm60ipcGTgLpLi0xJGNB3dDDNA/UG3D7jbpLha3+eX1SaKU3jmTZYyLBFRe4fuY1LJq8gI03KGNHhPsbu1Gn8q9H7pcK3O1JAqStAgMBAAECggEAPiRuCxO/aNYtPppNfd0zMGjtEXa7NRSNy8YmFKi2/MNqQ2xlNRpoPRnni+W9zgHZILwZ3MhD68LHTk2T0EqpnYzrjnUoUf3w5xvAm9JN/toFenb6BTeiaWDRI5QP9TPMOn3/md63sBAa5U0C1QnPhk1WsPNpA6c4Mg5EifG6YbVDPUbC8tGLA+l9KCtpYxHc48rcYwe4/Pq5zA3dCx4vcXahdXJh6ZFOG2JkmwROJZGdXmEpAuHuBRLnTzvaJuNSyi5i/+tr7g8IW/27MoVAFtv30YOqYBufOBXXTcfm64UGUfo1anEsVPwXC9UvYS+l0f8f/kKIF8GZSWRa4n2KcQKBgQDowKxRcSOYttJ7l5isXGs3ErvFyIB+ST6cgFjgRMl2gJOybv591dqeaVu5SBp83hKgTg1iftufzvxMpwpd1PVKMqK5MGMTxTuWmxlEh6YKa4QKu1H2D/x0D2YbxhOh2PvdJy18F5T5EQ2Tow7/rU7xfyjaXC0AvEyra9gjX9QWEwKBgQDQ41OcJh+VDIKV/y+fKqpS9Y8DeoZ7VCPPAzDQ1p2bA/eEzVzKViR6mZ6IzIJRlrQB93wvIa5KD84563mWoAX2dYn1iX/x7oLg55Dd/iR+BTRqCZJBiziUb/bSRbLeIEGCfpfCyKhoPuc0H60k4BWT7itkj4Cm1Ht3pJYMQKiyPwKBgQCKUa5WO/lekQ9nGYFGtSmWMhDbCjuqURbfZLrslJRxUxnzCVk+KO/iAlTbOEldeY/yKlBz/1W/k/+GAiL7/knDTXI8wc+veR/fcc7DViXLvXdb9VRQ+dEam+gfi0gxf8S1+cljHJSQq5y450dLlI/8nogFtI+eB0k8+jsZUqK0dwKBgQCE6I+TZAJmUK5qCBNh38C9xjZ3zSbyI6ghGHOf/V4Meuqrmgs3RrYxN7tSaWVlylDAi5p9Vp3Ry9q4qaYUe78vgLwF+bXp1ot51H0tcn3/nQoriemAQLgAYnkWc3iKstVb1XZ0Xj4hDh0H4jvFobq5BCqh8li2Ta49gwBhzWZI+wKBgQCTHyWu3M6FtClYFHm2T3rOpTvjE/3xWZ3gMPsk8bMuyPZPEP83HJGVyBtwlbr05JMtZ1rEaPsVVQn0U1Qp0z+8tl4I9F+fJiUmu0/2/hS2iFsDKdZGJnfAM8APG6K7ID5Km8CnmnPX/ynBA1kpucIRUDnUwbGcfEbf2ufhPd10dg=="
;
DefaultIcbcClient
client
=
new
DefaultIcbcClient
(
APP_ID
,
IcbcConstants
.
SIGN_TYPE_RSA2
,
MY_PRIVATE_KEY
,
APIGW_PUBLIC_KEY
);
try
{
MybankEnterpriseAccountQuerybankinfoRequestV1
.
MybankEnterpriseAccountQuerybankinfoRequestBizV1
bizContent
=
new
MybankEnterpriseAccountQuerybankinfoRequestV1
.
MybankEnterpriseAccountQuerybankinfoRequestBizV1
();
MybankEnterpriseAccountQuerybankinfoRequestV1
request
=
new
MybankEnterpriseAccountQuerybankinfoRequestV1
();
// 请对照接口文档用bizContent.setxxx()方法对业务上送数据进行赋值
bizContent
.
setTransCode
(
"QBKNC"
);
bizContent
.
setTranDate
(
"20240819"
);
bizContent
.
setTranTime
(
"103231001"
);
bizContent
.
setLanguage
(
"zh_CN"
);
bizContent
.
setfSeqNo
(
"AHWX"
);
bizContent
.
setCardNo
(
"6222620250010165293"
);
request
.
setServiceUrl
(
"https://gw.open.icbc.com.cn/api/mybank/enterprise/account/querybankinfo/V1"
);
request
.
setBizContent
(
bizContent
);
MybankEnterpriseAccountQuerybankinfoResponseV1
response
=
client
.
execute
(
request
);
if
(
response
.
isSuccess
())
{
// 业务成功处理
System
.
out
.
println
(
"success"
);
}
else
{
// 失败
System
.
out
.
println
(
"error"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
R
.
ok
();
}
public
R
businessOpen
()
{
String
apiUrl
=
"https://gw.open.icbc.com.cn/api/jft/api/vendor/separate/accounts/business/open/V1"
;
String
encryptKey
=
"u1NKBJOMzvkHFvGiKbsq3g=="
;
...
...
@@ -186,31 +218,31 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return
R
.
ok
();
}
public
R
asyncNotice
(
HttpServletRequest
request
)
throws
Exception
{
//验签
String
api
=
"/icbcIssue/notifyUrl"
;
boolean
verifyFlag
=
verifySignData
(
request
,
api
);
String
returnJson
;
if
(
verifyFlag
)
{
// 验签成功
log
.
info
(
"解密..."
);
String
bizContent
=
dencrypt
(
request
);
log
.
info
(
"解密后参数:"
+
bizContent
);
// 进行自己的处理,此处默认处理成功,返回通知方成功,return_code=0
String
copReturnCode
=
"0"
;
// 通知合作方接收成功的返回码,固定
String
copReturnMsg
=
"success"
;
// 合作方的返回信息,固定
returnJson
=
sign
(
request
,
copReturnCode
,
copReturnMsg
);
log
.
error
(
"通知响应json结果:{}"
,
returnJson
);
return
R
.
ok
(
returnJson
);
}
else
{
// 验签失败
String
copReturnCode
=
"-12345"
;
String
copReturnMsg
=
"icbc jft sign not pass."
;
returnJson
=
sign
(
request
,
copReturnCode
,
copReturnMsg
);
log
.
error
(
"通知响应json结果:{}"
,
returnJson
);
return
R
.
failed
(
returnJson
);
}
}
public
String
getMdCode
(
String
filePath
)
{
// 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;
// }
FileInputStream
in
=
null
;
byte
[]
buffer
=
new
byte
[
1024
];
...
...
@@ -242,4 +274,85 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
return
mdCode
;
}
/**
* 验签方法
*
* @param request
* @param path
* @return
* @throws Exception
*/
private
boolean
verifySignData
(
HttpServletRequest
request
,
String
path
)
throws
Exception
{
// 网关公钥
Map
<
String
,
String
>
params
=
new
HashMap
<>();
String
api
=
request
.
getParameter
(
"api"
);
String
from
=
request
.
getParameter
(
"from"
);
String
appId
=
request
.
getParameter
(
"app_id"
);
String
charset
=
request
.
getParameter
(
"charset"
);
String
format
=
request
.
getParameter
(
"format"
);
//String encrypt_type = request.getParameter("encrypt_type");
String
timestamp
=
request
.
getParameter
(
"timestamp"
);
String
bizContent
=
request
.
getParameter
(
"biz_content"
);
String
signType
=
request
.
getParameter
(
"sign_type"
);
String
sign
=
request
.
getParameter
(
"sign"
);
params
.
put
(
"from"
,
from
);
params
.
put
(
"api"
,
api
);
params
.
put
(
"app_id"
,
appId
);
params
.
put
(
"charset"
,
charset
);
params
.
put
(
"format"
,
format
);
//params.put("encrypt_type", encrypt_type);
params
.
put
(
"timestamp"
,
timestamp
);
params
.
put
(
"biz_content"
,
bizContent
);
params
.
put
(
"sign_type"
,
signType
);
// 目前上行网关签名暂时仅支持RSA
//验证工行上行网关RSA签名
String
signStr
=
WebUtils
.
buildOrderedSignStr
(
path
,
params
);
log
.
error
(
"验签入参,signStr:[[{}]], sign_type:[[{}]], APIGW_PUBLIC_KEY:[[{}]], charset:[[{}]], sign:[[{}]]"
,
signStr
,
signType
,
APIGW_PUBLIC_KEY
,
sign
);
return
IcbcSignature
.
verify
(
signStr
,
signType
,
APIGW_PUBLIC_KEY
,
charset
,
sign
);
}
/**
* 解密
*
* @param request
* @return
* @throws IOException
*/
private
String
dencrypt
(
HttpServletRequest
request
)
throws
IOException
{
String
bizContent
=
URLDecoder
.
decode
(
request
.
getParameter
(
"biz_content"
),
"utf-8"
);
// 解析请求数据map
ObjectMapper
mapper
=
new
ObjectMapper
();
Map
<
String
,
String
>
transMap
=
mapper
.
readValue
(
bizContent
,
Map
.
class
);
// 获取报文密文信息
String
notifyData
=
transMap
.
get
(
"notifyData"
);
return
new
String
(
Base64
.
getDecoder
().
decode
(
notifyData
));
}
/**
* 加签方法
*
* @param request
* @param copReturnCode
* @param copReturnMsg
* @return
* @throws Exception
*/
private
String
sign
(
HttpServletRequest
request
,
String
copReturnCode
,
String
copReturnMsg
)
throws
Exception
{
String
msgId
=
new
SimpleDateFormat
(
"yyyyMMdd"
).
format
(
new
Date
())
+
new
SimpleDateFormat
(
"HHmmss"
).
format
(
new
Date
());
String
responseBizContent
=
"{\"return_code\":\""
+
copReturnCode
+
"\",\"return_msg\":\""
+
copReturnMsg
+
"\""
+
",\"msg_id\":\""
+
msgId
+
"\"}"
;
String
charset
=
request
.
getParameter
(
"charset"
);
// 调用过程使用的编码格式
//商户对消息返回响应进行签名,签名方式需与在API平台登记APP的sign_type保持一致(目前基本都是RSA2)
String
signType
=
IcbcConstants
.
SIGN_TYPE_RSA2
;
String
signStr
=
"\"response_biz_content\":"
+
responseBizContent
+
","
+
"\"sign_type\":"
+
"\""
+
signType
+
"\""
;
String
signParam
=
IcbcSignature
.
sign
(
signStr
,
signType
,
MY_PRIVATE_KEY
,
charset
);
String
returnJson
=
"{\"response_biz_content\":"
+
responseBizContent
+
",\"sign_type\":\""
+
signType
+
"\""
+
",\"sign\":\""
+
signParam
+
"\"}"
;
return
returnJson
;
}
}
yifu-ekp/yifu-ekp-biz/src/main/resources/application-test.yml
View file @
1a76f88d
...
...
@@ -103,4 +103,5 @@ security:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
\ No newline at end of file
-
/swagger-ui/**
-
/icbcIssue/*
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment