Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fit-finance
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fitness-server
fit-finance
Commits
6a7ec088
Commit
6a7ec088
authored
Jun 18, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:fix repeat process refund callback and trigger cashier event
parent
fd76e201
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/RefundServiceImpl.java
+21
-13
No files found.
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/RefundServiceImpl.java
View file @
6a7ec088
...
...
@@ -150,26 +150,34 @@ public class RefundServiceImpl implements RefundService {
@Override
public
void
refundCallback
(
RefundEvent
event
)
{
StudioCashierRecord
record
=
studioCashierRecordRpService
.
getById
(
Long
.
parseLong
(
event
.
getTransNo
()))
.
orElse
(
null
);
if
(
null
==
record
)
{
return
;
}
Long
id
=
Long
.
parseLong
(
event
.
getTransNo
());
StudioCashierRecord
exist
=
transactionTemplate
.
execute
(
action
->
{
StudioCashierRecord
record
=
studioCashierRecordRpService
.
getByIdForUpdate
(
id
).
orElse
(
null
);
if
(
null
==
record
)
{
return
null
;
}
BrandCashierTransStateEnum
originalState
=
BrandCashierTransStateEnum
.
valueOf
(
record
.
getTransState
());
BrandCashierTransStateEnum
targetState
=
RefundConvert
.
convertTransState
(
event
.
getRefundState
());
if
(
targetState
==
originalState
)
{
log
.
warn
(
"repeat process refund callback {}, {}"
,
JSON
.
toJSONString
(
event
),
JSON
.
toJSONString
(
record
));
return
null
;
}
BrandCashierTransStateEnum
originalState
=
BrandCashierTransStateEnum
.
valueOf
(
record
.
getTransState
());
BrandCashierTransStateEnum
targetState
=
RefundConvert
.
convertTransState
(
event
.
getRefundState
());
if
(
targetState
==
originalState
)
{
StudioCashierRecord
toModify
=
RefundConvert
.
convertRefund
(
record
,
event
);
studioCashierRecordRpService
.
updateById
(
toModify
);
return
record
;
});
if
(
null
==
exist
)
{
return
;
}
StudioCashierRecord
toModify
=
RefundConvert
.
convertRefund
(
record
,
event
);
studioCashierRecordRpService
.
updateById
(
toModify
);
// 发布收银事件
this
.
triggerCashierEvent
(
record
.
getId
());
this
.
triggerCashierEvent
(
exist
.
getId
());
// 执行后续处理
this
.
doAfterRefund
(
event
,
record
);
this
.
doAfterRefund
(
event
,
exist
);
}
private
void
triggerCashierEvent
(
Long
id
)
{
...
...
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