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
88319d66
Commit
88319d66
authored
Apr 25, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:callback
parent
5834916f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
+36
-15
No files found.
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
View file @
88319d66
...
@@ -340,35 +340,56 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
...
@@ -340,35 +340,56 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
StudioMerchantApply
toModify
=
MerchantConvert
.
convertApply
(
apply
,
event
,
StudioMerchantApply
toModify
=
MerchantConvert
.
convertApply
(
apply
,
event
,
configService
.
getDefaultBrandSubChannelInfo
().
getSubChannels
());
configService
.
getDefaultBrandSubChannelInfo
().
getSubChannels
());
studioMerchantApplyRpService
.
updateById
(
toModify
);
studioMerchantApplyRpService
.
updateById
(
toModify
);
if
(!
OpenStateEnums
.
SUCCESS
.
getCode
().
equals
(
toModify
.
getOpenState
()))
{
if
(
OpenStateEnums
.
SUCCESS
!=
OpenStateEnums
.
getByCode
(
toModify
.
getOpenState
()))
{
return
;
}
if
(
OpenStateEnums
.
SUCCESS
==
OpenStateEnums
.
getByCode
(
apply
.
getOpenState
()))
{
// 绑定逻辑幂等处理
return
;
return
;
}
}
// 所有子通道全部开通成功
PartyToMerchant
old
=
getRelation
(
apply
.
getStudioId
());
// 1. 如果当前场馆绑定的是自己的商户号(old),则需要将绑定了该商户号的所有其他场馆进行解绑
// 绑定商户
if
(
null
!=
old
&&
!
old
.
getMerchantId
().
equals
(
event
.
getMerchantId
()))
{
this
.
bindWhenOpenSuccess
(
event
,
apply
);
StudioMerchantApply
oldApply
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
old
.
getMerchantId
());
}
if
(!
oldApply
.
getStudioId
().
equals
(
apply
.
getStudioId
()))
{
// 1.1 如果当前场馆绑定的是自己的商户号(old),则需要将绑定了该商户号的所有其他场馆进行解绑
private
Long
unbindWhenOpenSuccess
(
StudioMerchantApply
apply
)
{
this
.
unbindAll
(
old
.
getMerchantId
());
PartyToMerchant
old
=
this
.
getRelation
(
apply
.
getStudioId
());
// 1.2 场馆商户发生了变更,解绑掉绑定了老商户号的品牌
if
(
null
==
old
)
{
brandMerchantService
.
unbind
(
apply
.
getBrandId
(),
old
.
getMerchantId
());
return
null
;
}
}
}
Long
oldMerchantId
=
old
.
getMerchantId
();
StudioMerchantApply
exist
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
oldMerchantId
);
if
(!
exist
.
getStudioId
().
equals
(
apply
.
getStudioId
()))
{
// 之前绑定的商户不是自己的商户,不需要解绑
return
oldMerchantId
;
}
// 1. 如果当前场馆绑定的是自己的商户号(old),则需要将绑定了该商户号的所有其他场馆进行解绑
this
.
unbindAll
(
oldMerchantId
);
// 2. 场馆商户发生了变更,解绑掉绑定了老商户号的品牌
brandMerchantService
.
unbind
(
apply
.
getBrandId
(),
oldMerchantId
);
return
oldMerchantId
;
}
private
void
bindWhenOpenSuccess
(
MerchantEvent
event
,
StudioMerchantApply
apply
)
{
// 1. 解绑历史商户
Long
oldMerchantId
=
this
.
unbindWhenOpenSuccess
(
apply
);
// 2. 绑定场馆
// 2. 绑定场馆
this
.
bind
(
apply
.
getStudioId
(),
event
.
getMerchantId
(),
false
);
this
.
bind
(
apply
.
getStudioId
(),
event
.
getMerchantId
(),
false
);
// 3. 绑定品牌
// 3. 绑定品牌
brandMerchantService
.
bind
(
apply
.
getBrandId
(),
event
.
getMerchantId
());
brandMerchantService
.
bind
(
apply
.
getBrandId
(),
event
.
getMerchantId
());
// 4. 其他操作
// 4. 其他操作
executor
.
execute
(()
->
this
.
doAfterMerchantSuccess
(
event
,
executor
.
execute
(()
->
this
.
doAfterMerchantSuccess
(
event
,
oldMerchantId
));
Optional
.
ofNullable
(
old
).
map
(
PartyToMerchant:
:
getMerchantId
).
orElse
(
null
)));
}
}
private
void
doAfterMerchantSuccess
(
MerchantEvent
event
,
Long
oldMerchantId
)
{
private
void
doAfterMerchantSuccess
(
MerchantEvent
event
,
Long
oldMerchantId
)
{
// 1. 配置场馆小程序appId
// 1. 配置场馆小程序appId
this
.
rebindMiniAppId
(
oldMerchantId
,
event
.
getMerchantId
());
this
.
rebindMiniAppId
(
oldMerchantId
,
event
.
getMerchantId
());
...
...
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