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
85d099d3
Commit
85d099d3
authored
Dec 29, 2022
by
5359
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流水号添加随机数
parent
7986c6ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
40 deletions
+53
-40
PingAnServiceImpl.java
...a/com/hand/app/pingAn/service/impl/PingAnServiceImpl.java
+52
-40
pingAn.properties
core/src/main/resources/pingAn.properties
+1
-0
No files found.
core/src/main/java/com/hand/app/pingAn/service/impl/PingAnServiceImpl.java
View file @
85d099d3
...
...
@@ -70,6 +70,7 @@ public class PingAnServiceImpl implements PingAnService {
private
static
Properties
pro
=
null
;
private
static
Calendar
cal
=
null
;
private
static
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyyMMddHHmmssSSS"
);
private
static
String
filePath
=
null
;
static
{
String
path
=
Thread
.
currentThread
().
getContextClassLoader
().
getResource
(
""
).
getPath
().
substring
(
1
);
...
...
@@ -79,6 +80,7 @@ public class PingAnServiceImpl implements PingAnService {
}
baseReqBody
.
put
(
"MrchCode"
,
pro
.
getProperty
(
"MrchCode"
));
baseReqBody
.
put
(
"MainAccount"
,
pro
.
getProperty
(
"AcctNo"
));
filePath
=
pro
.
getProperty
(
"pingAnDownloadFilePath"
);
}
...
...
@@ -88,13 +90,14 @@ public class PingAnServiceImpl implements PingAnService {
* @return
*/
@Override
public
JSONObject
invoke
(
IRequest
iRequest
,
String
interfaceName
,
JSONObject
params
)
{
public
JSONObject
invoke
(
IRequest
iRequest
,
String
interfaceName
,
JSONObject
params
)
{
JSONObject
responseData
=
new
JSONObject
();
// JSONObject requestBody = ApiUtils.getBaseReqBody();
JSONObject
requestBody
=
baseReqBody
.
clone
();
cal
=
Calendar
.
getInstance
();
String
today
=
df
.
format
(
cal
.
getTime
());
requestBody
.
put
(
"CnsmrSeqNo"
,
today
+
"000"
);
long
temp
=
Math
.
round
(
Math
.
random
()
*
899
+
100
);
// 产生100到999的随机数
requestBody
.
put
(
"CnsmrSeqNo"
,
today
+
temp
);
requestBody
.
putAll
(
params
);
/*插入接口日志表*/
...
...
@@ -166,30 +169,37 @@ public class PingAnServiceImpl implements PingAnService {
JSONObject
responseData
=
new
JSONObject
();
logger
.
info
(
"接收推送消息,推送参数: {}"
,
req
.
toString
());
if
(
Objects
.
nonNull
(
req
)
&&
req
.
size
()
>
0
)
{
// 存表
//实际通知报文中会把数据放在ROOT这个key下
JSONObject
data
=
req
.
getJSONObject
(
"ROOT"
);
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
// 事务隔离级别:开启新事务
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRES_NEW
);
//对于每次请求都开启一个事物
TransactionStatus
transactionStatus
=
transactionManager
.
getTransaction
(
def
);
try
{
// 存表
//实际通知报文中会把数据放在ROOT这个key下
JSONObject
data
=
req
.
getJSONObject
(
"ROOT"
);
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
// 事务隔离级别:开启新事务
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRES_NEW
);
//对于每次请求都开启一个事物
TransactionStatus
transactionStatus
=
transactionManager
.
getTransaction
(
def
);
HlsEbankCcbTransaction
hlsEbankCcbTransaction
=
saveTransaction
(
iRequest
,
data
);
//状态刷新
transactionStatus
.
flush
();
//事务提交
transactionManager
.
commit
(
transactionStatus
);
// 调用系统的接口服务,推送通知数据
JSONObject
ldo16
=
new
JSONObject
();
ldo16
.
put
(
"transaction_id"
,
hlsEbankCcbTransaction
.
getTransactionId
());
postNotify
(
ldo16
.
toString
());
responseData
.
put
(
"TxnReturnCode "
,
"000000"
);
responseData
.
put
(
"TxnReturnMsg "
,
"接收成功"
);
}
else
{
responseData
.
put
(
"TxnReturnCode "
,
"111111
"
);
responseData
.
put
(
"TxnReturnMsg "
,
"接收失败
"
);
HlsEbankCcbTransaction
hlsEbankCcbTransaction
=
saveTransaction
(
iRequest
,
data
);
//状态刷新
transactionStatus
.
flush
();
//事务提交
transactionManager
.
commit
(
transactionStatus
);
// 调用系统的接口服务,推送通知数据
JSONObject
ldo16
=
new
JSONObject
();
ldo16
.
put
(
"transaction_id"
,
hlsEbankCcbTransaction
.
getTransactionId
());
postNotify
(
ldo16
.
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
(
);
}
// responseData.put("TxnReturnCode ","000000
");
// responseData.put("TxnReturnMsg ","接收成功
");
}
// else {
// responseData.put("TxnReturnCode ","111111");
// responseData.put("TxnReturnMsg ","接收失败");
// }
responseData
.
put
(
"TxnReturnCode "
,
"000000"
);
responseData
.
put
(
"TxnReturnMsg "
,
"接收成功"
);
return
responseData
;
}
...
...
@@ -297,7 +307,9 @@ public class PingAnServiceImpl implements PingAnService {
orderFiles
.
add
(
orderFile
);
}
OrderFileRequest
orderFileRequest
=
new
OrderFileRequest
();
orderFileRequest
.
setDownPath
(
"D:\\download\\yqzl"
);
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
dateString
=
formatter
.
format
(
new
Date
())
+
"\\"
;
orderFileRequest
.
setDownPath
(
filePath
+
dateString
);
File
file
=
new
File
(
orderFileRequest
.
getDownPath
());
if
(!
file
.
exists
())
{
file
.
mkdirs
();
...
...
@@ -323,13 +335,13 @@ public class PingAnServiceImpl implements PingAnService {
JSONObject
res
=
invoke
(
iRequest
,
interfaceName
,
params
);
// 对当前查询到的数据进行存表
JSONObject
data
=
res
.
getJSONObject
(
"data"
);
if
(
Objects
.
nonNull
(
data
)){
if
(
Objects
.
nonNull
(
data
))
{
isEnd
=
data
.
getString
(
"IsEnd"
);
JSONArray
arr
=
data
.
getJSONArray
(
"list"
);
if
(
Objects
.
nonNull
(
arr
))
{
batchSaveTransactionByC00602
(
iRequest
,
arr
);
}
}
else
{
}
else
{
responseData
.
put
(
Constants
.
RESP_CODE
,
"1111"
);
responseData
.
put
(
"respMsg"
,
"查询出错"
);
break
;
...
...
@@ -351,30 +363,30 @@ public class PingAnServiceImpl implements PingAnService {
JSONObject
res
=
invoke
(
iRequest
,
interfaceName
,
params
);
// 对当前查询到的数据进行存表
JSONObject
data
=
res
.
getJSONObject
(
"data"
);
if
(
Objects
.
nonNull
(
data
)){
if
(
mainFlag
){
if
(
Objects
.
nonNull
(
data
))
{
if
(
mainFlag
)
{
// 处理主账户,每次查询只处理一次
HlsEbankCcbAccount
hlsEbankCcbAccount
=
new
HlsEbankCcbAccount
();
hlsEbankCcbAccount
.
setAccountNo
(
data
.
getString
(
"ShadowAcctNo"
));
Long
recordId
=
hlsEbankCcbAccountMapper
.
queryByAccountNo
(
hlsEbankCcbAccount
);
hlsEbankCcbAccount
.
setSubAccNum
(
data
.
getLong
(
"SubAccNum"
));
hlsEbankCcbAccount
.
setStt
(
data
.
getString
(
"Stt"
));
if
(
Objects
.
nonNull
(
recordId
)){
if
(
Objects
.
nonNull
(
recordId
))
{
hlsEbankCcbAccount
.
setRecordId
(
recordId
);
hlsEbankCcbAccountService
.
updateByPrimaryKeySelective
(
iRequest
,
hlsEbankCcbAccount
);
}
else
{
hlsEbankCcbAccountService
.
updateByPrimaryKeySelective
(
iRequest
,
hlsEbankCcbAccount
);
}
else
{
hlsEbankCcbAccount
.
setMainFlag
(
"Y"
);
hlsEbankCcbAccount
.
setMainAccount
(
data
.
getString
(
"MainAccount"
));
hlsEbankCcbAccount
.
setCorId
(
data
.
getString
(
"CorId"
));
hlsEbankCcbAccount
.
setAccName
(
data
.
getString
(
"AccountName"
));
hlsEbankCcbAccountService
.
insertSelective
(
iRequest
,
hlsEbankCcbAccount
);
hlsEbankCcbAccountService
.
insertSelective
(
iRequest
,
hlsEbankCcbAccount
);
}
mainFlag
=
false
;
}
isEnd
=
data
.
getString
(
"IsEnd"
);
batchSaveAccount
(
iRequest
,
data
);
}
else
{
}
else
{
responseData
.
put
(
Constants
.
RESP_CODE
,
"1111"
);
responseData
.
put
(
"respMsg"
,
"查询出错"
);
break
;
...
...
@@ -433,9 +445,9 @@ public class PingAnServiceImpl implements PingAnService {
}
}
private
void
batchSaveAccount
(
IRequest
iRequest
,
JSONObject
data
){
private
void
batchSaveAccount
(
IRequest
iRequest
,
JSONObject
data
)
{
JSONArray
list
=
data
.
getJSONArray
(
"list"
);
if
(
Objects
.
nonNull
(
list
)){
if
(
Objects
.
nonNull
(
list
))
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
JSONObject
item
=
list
.
getJSONObject
(
i
);
HlsEbankCcbAccount
hlsEbankCcbAccount
=
new
HlsEbankCcbAccount
();
...
...
@@ -444,15 +456,15 @@ public class PingAnServiceImpl implements PingAnService {
hlsEbankCcbAccount
.
setSubAccNum
(
data
.
getLong
(
"SubAccNum"
));
hlsEbankCcbAccount
.
setStt
(
item
.
getString
(
"SubStt"
));
hlsEbankCcbAccount
.
setAccBalance
(
item
.
getDouble
(
"SubAccBalance"
));
if
(
Objects
.
nonNull
(
recordId
)){
if
(
Objects
.
nonNull
(
recordId
))
{
hlsEbankCcbAccount
.
setRecordId
(
recordId
);
hlsEbankCcbAccountService
.
updateByPrimaryKeySelective
(
iRequest
,
hlsEbankCcbAccount
);
}
else
{
hlsEbankCcbAccountService
.
updateByPrimaryKeySelective
(
iRequest
,
hlsEbankCcbAccount
);
}
else
{
hlsEbankCcbAccount
.
setMainFlag
(
"N"
);
hlsEbankCcbAccount
.
setMainAccount
(
data
.
getString
(
"MainAccount"
));
hlsEbankCcbAccount
.
setCorId
(
data
.
getString
(
"CorId"
));
hlsEbankCcbAccount
.
setAccName
(
item
.
getString
(
"SubAccName"
));
hlsEbankCcbAccountService
.
insertSelective
(
iRequest
,
hlsEbankCcbAccount
);
hlsEbankCcbAccountService
.
insertSelective
(
iRequest
,
hlsEbankCcbAccount
);
}
}
}
...
...
core/src/main/resources/pingAn.properties
View file @
85d099d3
...
...
@@ -9,6 +9,7 @@ queryOrderFileUrl=https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFil
fileDownLoadOrderFileUrl
=
https://my-st1.orangebank.com.cn:567/fat7/openapi/file/boapFile/downloadOrderFile
MrchCode
=
0090108040000KTAR000
AcctNo
=
15000101414037
pingAnDownloadFilePath
=
E:
\\
HCLC_FTP
\\
PAB_IN
\\
#测试客户名称:天津市佳兴机械设备租赁有限公司
#测试合同:L21BD00209
\ 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