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
10010900
Commit
10010900
authored
Apr 15, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:pay channel
parent
31aafe18
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
71 additions
and
35 deletions
+71
-35
app/src/main/resources/application-canary.yml
+4
-3
app/src/main/resources/application-dev.yml
+4
-3
app/src/main/resources/application-local.yml
+4
-3
app/src/main/resources/application-prod.yml
+4
-3
app/src/main/resources/application-rc.yml
+4
-3
service/src/main/java/com/jiejing/fitness/finance/service/config/PayChannelConfig.java
+26
-0
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
+5
-4
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
+13
-10
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
+7
-6
No files found.
app/src/main/resources/application-canary.yml
View file @
10010900
...
...
@@ -15,6 +15,7 @@ spring:
default-binder
:
biz-kafka
finance
:
brand
:
merchant
:
channel
:
"
001"
channel
:
cashier
:
"
001"
ali_native
:
"
002"
wx_native
:
"
003"
app/src/main/resources/application-dev.yml
View file @
10010900
...
...
@@ -15,6 +15,7 @@ spring:
default-binder
:
biz-kafka
finance
:
brand
:
merchant
:
channel
:
"
001"
channel
:
cashier
:
"
001"
ali_native
:
"
002"
wx_native
:
"
003"
app/src/main/resources/application-local.yml
View file @
10010900
...
...
@@ -20,6 +20,7 @@ spring:
default-binder
:
biz-kafka
finance
:
brand
:
merchant
:
channel
:
"
001"
channel
:
cashier
:
"
001"
ali_native
:
"
002"
wx_native
:
"
003"
app/src/main/resources/application-prod.yml
View file @
10010900
...
...
@@ -15,6 +15,7 @@ spring:
default-binder
:
biz-kafka
finance
:
brand
:
merchant
:
channel
:
"
001"
channel
:
cashier
:
"
001"
ali_native
:
"
002"
wx_native
:
"
003"
app/src/main/resources/application-rc.yml
View file @
10010900
...
...
@@ -15,6 +15,7 @@ spring:
default-binder
:
biz-kafka
finance
:
brand
:
merchant
:
channel
:
"
001"
channel
:
cashier
:
"
001"
ali_native
:
"
002"
wx_native
:
"
003"
service/src/main/java/com/jiejing/fitness/finance/service/config/PayChannelConfig.java
0 → 100644
View file @
10010900
package
com
.
jiejing
.
fitness
.
finance
.
service
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
/**
* 支付渠道配置
*
* @author chengyubing
* @since 2024/4/15 14:14
*/
@Data
@Configuration
@EnableConfigurationProperties
(
PayChannelConfig
.
class
)
@ConfigurationProperties
(
prefix
=
"finance.channel"
)
public
class
PayChannelConfig
{
private
String
cashier
;
private
String
aliNative
;
private
String
wxNative
;
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
View file @
10010900
...
...
@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.repository.entity.PartyToMerchant;
import
com.jiejing.fitness.finance.repository.entity.StudioMerchantApply
;
import
com.jiejing.fitness.finance.repository.service.PartyToMerchantRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioMerchantApplyRpService
;
import
com.jiejing.fitness.finance.service.config.PayChannelConfig
;
import
com.jiejing.fitness.finance.service.global.ConfigService
;
import
com.jiejing.fitness.finance.service.merchant.BrandMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.convert.MerchantConvert
;
...
...
@@ -33,8 +34,8 @@ import org.springframework.stereotype.Service;
@Service
public
class
BrandMerchantServiceImpl
implements
BrandMerchantService
{
@
Value
(
"${finance.brand.merchant.channel}"
)
private
String
channel
;
@
Resource
private
PayChannelConfig
config
;
@Resource
private
StudioMerchantApplyRpService
studioMerchantApplyRpService
;
...
...
@@ -53,7 +54,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
@Override
public
void
bind
(
Long
brandId
,
Long
merchantId
)
{
PartyToMerchant
exist
=
partyToMerchantRpService
.
getOneByPartyAndMerchantId
(
c
hannel
,
brandId
,
PartyToMerchant
exist
=
partyToMerchantRpService
.
getOneByPartyAndMerchantId
(
c
onfig
.
getCashier
()
,
brandId
,
PartyTypeEnum
.
BRAND
,
merchantId
);
if
(
null
!=
exist
)
{
return
;
...
...
@@ -73,7 +74,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
@Override
public
List
<
BrandMerchantVO
>
list
(
Long
brandId
)
{
List
<
PartyToMerchant
>
relations
=
partyToMerchantRpService
.
listByParty
(
brandId
,
PartyTypeEnum
.
BRAND
,
c
hannel
);
c
onfig
.
getCashier
()
);
if
(
CollectionUtil
.
isEmpty
(
relations
))
{
return
Lists
.
newArrayList
();
}
...
...
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
View file @
10010900
...
...
@@ -18,6 +18,7 @@ import com.jiejing.fitness.finance.repository.entity.StudioMerchantApply;
import
com.jiejing.fitness.finance.repository.query.PageStudioMerchantApplyQuery
;
import
com.jiejing.fitness.finance.repository.service.PartyToMerchantRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioMerchantApplyRpService
;
import
com.jiejing.fitness.finance.service.config.PayChannelConfig
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.global.ConfigService
;
import
com.jiejing.fitness.finance.service.global.dto.SubChannelInfoDTO
;
...
...
@@ -66,8 +67,8 @@ import org.springframework.transaction.annotation.Transactional;
@Service
public
class
StudioMerchantServiceImpl
implements
StudioMerchantService
{
@
Value
(
"${finance.brand.merchant.channel}"
)
private
String
channel
;
@
Resource
private
PayChannelConfig
config
;
@Resource
private
StudioRpcService
studioRpcService
;
...
...
@@ -219,8 +220,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
ConfigSubChannelVO
vo
=
merchantRpcService
.
bindAppIdWxXcxOffline
(
c
hannel
,
relation
.
getMerchantId
(),
appId
);
ConfigSubChannelVO
vo
=
merchantRpcService
.
bindAppIdWxXcxOffline
(
c
onfig
.
getCashier
(),
relation
.
getMerchantId
(),
appId
);
return
StudioMerchantBindXcxAppIdVO
.
builder
().
state
(
vo
.
getState
()).
failMessage
(
vo
.
getFailMessage
())
.
build
();
...
...
@@ -228,7 +229,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
private
PartyToMerchant
getRelation
(
Long
studioId
)
{
List
<
PartyToMerchant
>
relations
=
partyToMerchantRpService
.
listByParty
(
studioId
,
PartyTypeEnum
.
STUDIO
,
c
hannel
);
c
onfig
.
getCashier
()
);
if
(
CollectionUtil
.
isEmpty
(
relations
))
{
return
null
;
}
...
...
@@ -243,8 +244,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
AuthSubChannelVO
vo
=
merchantRpcService
.
authSubChannel
(
c
hannel
,
relation
.
getMerchantId
(),
subChannel
,
authType
);
AuthSubChannelVO
vo
=
merchantRpcService
.
authSubChannel
(
c
onfig
.
getCashier
(),
relation
.
getMerchantId
()
,
subChannel
,
authType
);
return
BeanUtil
.
map
(
vo
,
StudioMerchantAuthSubChannelVO
.
class
);
}
...
...
@@ -303,7 +304,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
config
.
getAppId
()));
}
private
Map
<
ResourceTypeEnums
,
ResourceInfo
>
upload
(
ApplyStudioMerchantParams
params
,
StudioMerchantApply
apply
)
{
private
Map
<
ResourceTypeEnums
,
ResourceInfo
>
upload
(
ApplyStudioMerchantParams
params
,
StudioMerchantApply
apply
)
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
=
MerchantConvert
.
convertResourceMap
(
params
.
getResourceMap
());
...
...
@@ -314,7 +316,8 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
resourceMap
.
keySet
().
forEach
(
type
->
{
ResourceInfo
info
=
resourceMap
.
get
(
type
);
ResourceInfoVO
vo
=
resourceIdUrlMap
.
get
(
info
.
getResourceId
());
String
thirdId
=
merchantRpcService
.
upload
(
MerchantConvert
.
convertUploadRequest
(
channel
,
type
,
vo
));
String
thirdId
=
merchantRpcService
.
upload
(
MerchantConvert
.
convertUploadRequest
(
config
.
getCashier
(),
type
,
vo
));
info
.
setThirdId
(
thirdId
);
});
return
resourceMap
;
...
...
@@ -355,7 +358,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
Long
id
=
IdWorker
.
getId
();
StudioVO
studio
=
studioRpcService
.
getStudio
(
params
.
getStudioId
());
StudioMerchantApply
exist
=
studioMerchantApplyRpService
.
getLatestOneSuccessByStudioId
(
studio
.
getId
());
StudioMerchantApply
apply
=
MerchantConvert
.
convertApply
(
id
,
params
,
studio
,
exist
,
c
hannel
);
StudioMerchantApply
apply
=
MerchantConvert
.
convertApply
(
id
,
params
,
studio
,
exist
,
c
onfig
.
getCashier
()
);
studioMerchantApplyRpService
.
insert
(
apply
);
return
apply
;
...
...
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
View file @
10010900
...
...
@@ -29,6 +29,7 @@ import com.jiejing.fitness.finance.repository.service.PartyToMerchantRpService;
import
com.jiejing.fitness.finance.repository.service.StudioCheckSettleRecordRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioMerchantApplyRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioSettleRecordRpService
;
import
com.jiejing.fitness.finance.service.config.PayChannelConfig
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.enums.GlobalConfigEnums
;
import
com.jiejing.fitness.finance.service.pay.PayService
;
...
...
@@ -82,8 +83,8 @@ import org.springframework.stereotype.Service;
@Service
public
class
PayServiceImpl
implements
PayService
{
@
Value
(
"${finance.brand.merchant.channel}"
)
private
String
channel
;
@
Resource
private
PayChannelConfig
config
;
@Resource
private
PartyToMerchantRpService
partyToMerchantRpService
;
...
...
@@ -161,7 +162,7 @@ public class PayServiceImpl implements PayService {
@Override
public
PayVO
merchantPay
(
StudioMerchantPayParams
params
)
{
StudioVO
studio
=
studioRpcService
.
getStudio
(
params
.
getStudioId
());
PartyToMerchant
relation
=
partyToMerchantRpService
.
getByStudioId
(
studio
.
getId
(),
c
hannel
);
PartyToMerchant
relation
=
partyToMerchantRpService
.
getByStudioId
(
studio
.
getId
(),
c
onfig
.
getCashier
()
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
...
...
@@ -178,7 +179,7 @@ public class PayServiceImpl implements PayService {
@Override
public
void
payCallback
(
PayEvent
event
)
{
if
(!
event
.
getChannelNo
().
equals
(
c
hannel
))
{
if
(!
event
.
getChannelNo
().
equals
(
c
onfig
.
getCashier
()
))
{
return
;
}
StudioCashierRecord
record
=
studioCashierRecordRpService
.
getById
(
Long
.
parseLong
(
event
.
getTransNo
()))
...
...
@@ -331,9 +332,9 @@ public class PayServiceImpl implements PayService {
private
String
getChannelNo
(
NativePayParams
params
)
{
switch
(
params
.
getChannel
())
{
case
WX:
return
"003"
;
return
config
.
getWxNative
()
;
case
ALI:
return
"002"
;
return
config
.
getAliNative
()
;
default
:
throw
new
BizException
(
FinanceErrorEnums
.
NOT_SUPPORT_TYPE
);
}
...
...
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