Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-support-rlwx
Project
Project
Details
Activity
Releases
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
rl
hls-support-rlwx
Commits
736d2f52
Commit
736d2f52
authored
Dec 13, 2022
by
胡建龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add]平安智能清分接口开发暂存
parent
5965c219
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
286 additions
and
0 deletions
+286
-0
pom.xml
core/pom.xml
+7
-0
PingAnController.java
...ava/com/hand/app/pingAn/controllers/PingAnController.java
+93
-0
PingAnService.java
.../main/java/com/hand/app/pingAn/service/PingAnService.java
+13
-0
PingAnServiceImpl.java
...a/com/hand/app/pingAn/service/impl/PingAnServiceImpl.java
+135
-0
ApiUtils.java
core/src/main/java/com/hand/app/pingAn/utils/ApiUtils.java
+29
-0
pingAn.properties
core/src/main/resources/pingAn.properties
+9
-0
api-sdk-1.9.89.jar
core/src/main/webapp/WEB-INF/lib/api-sdk-1.9.89.jar
+0
-0
No files found.
core/pom.xml
View file @
736d2f52
...
...
@@ -239,6 +239,13 @@
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/postmsg-ump-5.1.jar
</systemPath>
</dependency>
<dependency>
<groupId>
com.hand.hls
</groupId>
<artifactId>
api-sdk
</artifactId>
<version>
1.9.89
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/api-sdk-1.9.89.jar
</systemPath>
</dependency>
<!--ftp -->
<dependency>
<groupId>
com.jcraft
</groupId>
...
...
core/src/main/java/com/hand/app/pingAn/controllers/PingAnController.java
0 → 100644
View file @
736d2f52
package
com
.
hand
.
app
.
pingAn
.
controllers
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hand.app.pingAn.service.PingAnService
;
import
com.hand.app.pingAn.utils.ApiUtils
;
import
com.hand.hap.system.controllers.BaseController
;
import
com.hand.hap.system.dto.ResponseData
;
import
com.pingan.openbank.api.sdk.common.http.HttpResult
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.Random
;
@Controller
public
class
PingAnController
extends
BaseController
{
@Autowired
private
PingAnService
pingAnService
;
@ApiModelProperty
(
"子账户维护(BEDL_C002)"
)
@RequestMapping
(
"/bedl/SubAcctMaintenance"
)
@ResponseBody
public
ResponseData
bindSubAccount
(){
// 模拟请求参数
HashMap
<
String
,
String
>
reqParams
=
new
HashMap
<>();
reqParams
.
put
(
"OpFlag"
,
"A"
);
reqParams
.
put
(
"SubAccountSeq"
,
"123456"
);
reqParams
.
put
(
"SubAccountName"
,
"测试别名"
);
String
seqNoTime
=
new
SimpleDateFormat
(
"yyMMdd"
).
format
(
Calendar
.
getInstance
().
getTime
());
Random
random
=
new
Random
();
String
randomNo
=
""
;
for
(
byte
i
=
0
;
i
<
8
;
i
++)
{
int
randomNumber
=
random
.
nextInt
(
10
);
randomNo
+=
randomNumber
;
}
//系统流水号,规范:用户短号(6位)+日期(6位)+随机编号(10位)
reqParams
.
put
(
"CnsmrSeqNo"
,
"C25634"
+
seqNoTime
+
randomNo
);
return
pingAnService
.
invoke
(
"bedl/SubAcctMaintenance"
,
reqParams
);
}
@ApiModelProperty
(
"近期明细查询(BEDL_C00602)"
)
@RequestMapping
(
"/bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo"
)
@ResponseBody
public
ResponseData
recentDetailQuery
(){
// 模拟请求参数
HashMap
<
String
,
String
>
reqParams
=
new
HashMap
<>();
reqParams
.
put
(
"OpFlag"
,
"1"
);
reqParams
.
put
(
"SubAccountSeq"
,
"123456"
);
reqParams
.
put
(
"SubAccountName"
,
"测试别名"
);
reqParams
.
put
(
"StartTime"
,
"20221201000000"
);
reqParams
.
put
(
"EndTime"
,
"20221202000000"
);
reqParams
.
put
(
"PageNo"
,
"1"
);
reqParams
.
put
(
"PageSize"
,
"200"
);
String
seqNoTime
=
new
SimpleDateFormat
(
"yyMMdd"
).
format
(
Calendar
.
getInstance
().
getTime
());
Random
random
=
new
Random
();
String
randomNo
=
""
;
for
(
byte
i
=
0
;
i
<
10
;
i
++)
{
int
randomNumber
=
random
.
nextInt
(
10
);
randomNo
+=
randomNumber
;
}
//系统流水号,规范:用户短号(6位)+日期(6位)+随机编号(10位)
reqParams
.
put
(
"CnsmrSeqNo"
,
"C25634"
+
seqNoTime
+
randomNo
);
return
pingAnService
.
invoke
(
"bedl/InquiryIntoTheCurrentDetailsOfMainSubaccountAccountTwo"
,
reqParams
);
}
@ApiModelProperty
(
"明细通知接口(BEDL_ZNA001)"
)
@RequestMapping
(
"/api/public/pingAn/notify"
)
@ResponseBody
public
ResponseData
DetailsNotify
(
JSONObject
data
){
// 类似支付结果通知的接口,每次返回一条记录。
// 将数据推送到业务系统
return
pingAnService
.
detailNotify
(
data
);
}
@ApiModelProperty
(
"清分台账明细下载(BEDL_F0P101)"
)
@RequestMapping
(
"/bedl/DetailReportQueryNew"
)
@ResponseBody
public
ResponseData
downloadDetail
(
JSONObject
data
){
return
pingAnService
.
detailNotify
(
data
);
}
}
core/src/main/java/com/hand/app/pingAn/service/PingAnService.java
0 → 100644
View file @
736d2f52
package
com
.
hand
.
app
.
pingAn
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hand.hap.system.dto.ResponseData
;
import
java.util.HashMap
;
public
interface
PingAnService
{
ResponseData
invoke
(
String
interfaceName
,
HashMap
params
);
ResponseData
detailNotify
(
JSONObject
data
);
}
core/src/main/java/com/hand/app/pingAn/service/impl/PingAnServiceImpl.java
0 → 100644
View file @
736d2f52
package
com
.
hand
.
app
.
pingAn
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hand.app.esignHclc.utils.SignHclcUtils
;
import
com.hand.app.pingAn.service.PingAnService
;
import
com.hand.app.pingAn.utils.ApiUtils
;
import
com.hand.app.zhongDengWang.dto.HlsWsRequests
;
import
com.hand.app.zhongDengWang.mapper.HlsWsRequestsMapper
;
import
com.hand.hap.intergration.dto.HapInterfaceHeader
;
import
com.hand.hap.intergration.service.IHapInterfaceHeaderService
;
import
com.hand.hap.system.dto.ResponseData
;
import
com.pingan.openbank.api.sdk.common.http.HttpResult
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
public
class
PingAnServiceImpl
implements
PingAnService
{
@Autowired
private
HlsWsRequestsMapper
hlsWsRequestsMapper
;
@Autowired
private
IHapInterfaceHeaderService
headerService
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
/**
* 还需要考虑是否要开启事务,但是貌似不太需要
* @param interfaceName
* @param params
* @return
*/
@Override
public
ResponseData
invoke
(
String
interfaceName
,
HashMap
params
)
{
ResponseData
responseData
=
new
ResponseData
();
JSONObject
requestBody
=
ApiUtils
.
getBaseReqBody
();
requestBody
.
putAll
(
params
);
/*插入接口日志表*/
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
"url"
,
requestBody
.
toJSONString
(),
"pingAn_"
+
interfaceName
.
substring
(
interfaceName
.
lastIndexOf
(
'/'
)+
1
),
1L
);
HttpResult
result
=
ApiUtils
.
invoke
(
interfaceName
,
requestBody
);
if
(
Objects
.
nonNull
(
result
))
{
if
(
"000000"
.
equals
(
result
.
getCode
()))
{
ArrayList
<
String
>
list
=
new
ArrayList
<>();
JSONObject
res
=
JSONObject
.
parseObject
(
responseData
.
getMessage
());
// todo 记录返回信息并存表
hlsWsRequests
.
setReturnStatus
(
"s"
);
responseData
.
setSuccess
(
true
);
responseData
.
setRows
(
list
);
}
else
{
//请求失败
hlsWsRequests
.
setReturnStatus
(
"f"
);
responseData
.
setSuccess
(
false
);
}
hlsWsRequests
.
setResponseJson
(
result
.
getData
());
hlsWsRequests
.
setResponsedDate
(
new
Date
());
// todo 处理响应信息
}
//更新日志
hlsWsRequestsMapper
.
updateByPrimaryKeySelective
(
hlsWsRequests
);
return
responseData
;
}
public
ResponseData
detailNotify
(
JSONObject
data
){
ResponseData
responseData
=
new
ResponseData
();
// todo 返回单条数据,存记录
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
"url"
,
data
.
toJSONString
(),
"pingAn_notify"
,
1L
);
// 调用系统的接口服务,推送通知数据
postNotify
(
data
);
return
responseData
;
}
private
HlsWsRequests
createRequestLog
(
String
wsdlUrl
,
String
requestClob
,
String
functionName
,
Long
pkValue
)
{
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
.
setRequestDate
(
new
Date
());
hlsWsRequests
.
setRequestWsdlUrl
(
wsdlUrl
);
hlsWsRequests
.
setFunctionName
(
functionName
);
hlsWsRequests
.
setRequestJson
(
requestClob
);
hlsWsRequests
.
setStatusDate
(
new
Date
());
hlsWsRequests
.
setParameterType
(
"json"
);
hlsWsRequests
.
setPkValue
(
pkValue
);
hlsWsRequestsMapper
.
insertSelective
(
hlsWsRequests
);
return
hlsWsRequests
;
}
private
String
postNotify
(
JSONObject
params
)
{
String
sysName
=
"HCL_UPLOAD_FILE"
;
// todo 待修改
String
apiName
=
"writeOffLd037"
;
try
{
//初始化接口信息
HapInterfaceHeader
headerAndLineDTO
=
headerService
.
getHeaderAndLine
(
sysName
,
apiName
);
if
(
headerAndLineDTO
==
null
)
{
logger
.
info
(
"headerAndLineDTO is null, apiName:{}, sysName:{}"
,
apiName
,
sysName
);
return
"N"
;
}
String
url
=
headerAndLineDTO
.
getDomainUrl
()
+
headerAndLineDTO
.
getIftUrl
();
Map
<
String
,
String
>
headInfo
=
new
HashMap
<
String
,
String
>();
headInfo
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
JSONObject
requestData
=
new
JSONObject
();
requestData
.
put
(
"requestData"
,
params
.
toString
());
//发送http请求
SignHclcUtils
signHclcUtils1
=
new
SignHclcUtils
();
String
stringResult
=
signHclcUtils1
.
postString
(
url
,
requestData
,
headInfo
,
SignHclcUtils
.
APPLICATION_FORM_URLENCODED
);
//解析返回结果
JSONObject
jsonResult
=
JSONObject
.
parseObject
(
stringResult
);
if
(
"S"
.
equalsIgnoreCase
(
jsonResult
.
getString
(
"respCode"
)))
{
return
"Y"
;
}
else
{
return
"N"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
"N"
;
}
}
}
core/src/main/java/com/hand/app/pingAn/utils/ApiUtils.java
0 → 100644
View file @
736d2f52
package
com
.
hand
.
app
.
pingAn
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pingan.openbank.api.sdk.client.ApiClient
;
import
com.pingan.openbank.api.sdk.common.http.HttpResult
;
import
com.pingan.openbank.api.sdk.entity.SdkRequest
;
public
class
ApiUtils
{
private
static
ApiClient
apiClient
=
ApiClient
.
getInstance
(
"pingAn.properties"
);
public
static
JSONObject
baseReqBody
=
new
JSONObject
();
private
static
String
MrchCode
=
"0090108040000KTAR000"
;
private
static
String
AcctNo
=
"15000101414037"
;
static
{
// todo 设置通用的请求参数,比如主账号,流水号,企业银企直连标准代码等
baseReqBody
.
put
(
"MrchCode"
,
MrchCode
);
baseReqBody
.
put
(
"MainAccount"
,
AcctNo
);
}
public
static
HttpResult
invoke
(
String
interfaceName
,
JSONObject
requestBody
){
SdkRequest
sdkRequest
=
new
SdkRequest
();
sdkRequest
.
setInterfaceName
(
"V1.0/"
+
interfaceName
);
sdkRequest
.
setBody
(
requestBody
);
return
apiClient
.
invoke
(
sdkRequest
);
}
public
static
JSONObject
getBaseReqBody
(){
return
baseReqBody
.
clone
();
}
}
core/src/main/resources/pingAn.properties
0 → 100644
View file @
736d2f52
appPrivateKey
=
a2f122a29ac693ddcd3cbf0d4e192655eba9c8859039d97a69838cf6097d3488
publicKey
=
0480E866C61C385C2916901CFC10AA53DFD89DBFFA87A4A49C26F82C66F30B7A7038D61FDBE08236F6ACFA6216A6FBCC511841586ABE24107438E049BE98C4660C
appId
=
437d601b-3ce5-443c-ae9f-01c33392e211
baseUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/gateway
appSecret
=
5Q3wv2
fileUploadUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFile/upload
fileDownLoadUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFile/download
queryOrderFileUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFile/queryOrderFile
fileDownLoadOrderFileUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFile/downloadOrderFile
\ No newline at end of file
core/src/main/webapp/WEB-INF/lib/api-sdk-1.9.89.jar
0 → 100644
View file @
736d2f52
File added
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