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
b0f5dc59
Commit
b0f5dc59
authored
Mar 05, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:brand -> studio
parent
6388820c
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
980 additions
and
758 deletions
+980
-758
api/src/main/java/com/jiejing/fitness/finance/api/enums/PartyTypeEnums.java
+9
-11
api/src/main/java/com/jiejing/fitness/finance/api/merchant/BrandMerchantApi.java
+0
-73
api/src/main/java/com/jiejing/fitness/finance/api/merchant/StudioMerchantApi.java
+65
-0
api/src/main/java/com/jiejing/fitness/finance/api/merchant/StudioMerchantApiFallback.java
+26
-33
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/ApplyStudioMerchantRequest.java
+2
-2
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/AuthStudioSubChannelRequest.java
+5
-5
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/BindStudioMerchantXcxAppIdRequest.java
+5
-5
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/BrandMerchantRefundRequest.java
+0
-44
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/GetAuthStudioSubChannelRequest.java
+5
-5
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/GetStudioMerchantApplyRequest.java
+2
-2
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/GetStudioMerchantRequest.java
+5
-5
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/PageStudioMerchantApplyRequest.java
+2
-2
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/StudioMerchantPayRequest.java
+5
-5
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/StudioMerchantApplyVO.java
+2
-2
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/StudioMerchantAuthSubChannelVO.java
+2
-3
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/StudioMerchantBindXcxAppIdVO.java
+2
-2
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/StudioMerchantVO.java
+4
-8
app/src/main/java/com/jiejing/fitness/finance/app/controller/merchant/BrandMerchantController.java
+0
-123
app/src/main/java/com/jiejing/fitness/finance/app/controller/merchant/StudioMerchantController.java
+112
-0
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/PartyToMerchant.java
+17
-9
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/StudioMerchantApply.java
+5
-5
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/PartyToMerchantMapper.java
+4
-4
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/PartyToMerchantMapper.xml
+2
-2
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/StudioMerchantApplyMapper.java
+7
-5
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/StudioMerchantApplyMapper.xml
+15
-5
repository/src/main/java/com/jiejing/fitness/finance/repository/query/PageStudioMerchantApplyQuery.java
+76
-0
repository/src/main/java/com/jiejing/fitness/finance/repository/service/PartyToMerchantRpService.java
+47
-10
repository/src/main/java/com/jiejing/fitness/finance/repository/service/StudioMerchantApplyRpService.java
+30
-22
repository/src/test/java/com/jiejing/fitness/finance/repository/GeneratorServiceEntity.java
+3
-4
service/src/main/java/com/jiejing/fitness/finance/service/event/ListenerService.java
+7
-7
service/src/main/java/com/jiejing/fitness/finance/service/merchant/BrandMerchantService.java
+7
-69
service/src/main/java/com/jiejing/fitness/finance/service/merchant/StudioMerchantService.java
+110
-0
service/src/main/java/com/jiejing/fitness/finance/service/merchant/convert/MerchantConvert.java
+53
-37
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
+17
-219
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
+298
-0
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/ApplyStudioMerchantParams.java
+6
-6
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/PageStudioMerchantApplyParams.java
+2
-3
service/src/main/java/com/jiejing/fitness/finance/service/pay/PayService.java
+2
-2
service/src/main/java/com/jiejing/fitness/finance/service/pay/convert/PayConvert.java
+7
-8
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
+10
-9
service/src/main/java/com/jiejing/fitness/finance/service/pay/params/StudioMerchantPayParams.java
+2
-2
No files found.
api/src/main/java/com/jiejing/fitness/finance/api/enums/
Merchant
TypeEnums.java
→
api/src/main/java/com/jiejing/fitness/finance/api/enums/
Party
TypeEnums.java
View file @
b0f5dc59
...
...
@@ -6,21 +6,19 @@ import lombok.AllArgsConstructor;
import
lombok.Getter
;
/**
* 商户类型
*
* @author raccoon
* @since 2020-11-06 16:44
* @author chengyubing
* @since 2024/3/4 18:22
*/
@Getter
@AllArgsConstructor
public
enum
Merchant
TypeEnums
{
public
enum
Party
TypeEnums
{
/**
*
未知
*
业务方类型
*/
UNKNOWN
(
""
,
"
"
),
STUDIO
(
"STUDIO"
,
"场馆
"
),
BRAND
(
"BRAND"
,
"品牌"
),
UNKNOWN
(
"UNKNOWN"
,
"未知"
),
;
@EnumValue
...
...
@@ -28,9 +26,9 @@ public enum MerchantTypeEnums {
private
final
String
desc
;
public
static
MerchantTypeEnums
getByCode
(
String
code
)
{
return
Arrays
.
stream
(
MerchantTypeEnums
.
values
()).
filter
(
e
->
e
.
getCode
().
equals
(
code
)).
findFirst
()
public
static
PartyTypeEnums
getByCode
(
String
code
)
{
return
Arrays
.
stream
(
PartyTypeEnums
.
values
()).
filter
(
e
->
e
.
getCode
().
equals
(
code
)).
findFirst
()
.
orElse
(
UNKNOWN
);
}
}
api/src/main/java/com/jiejing/fitness/finance/api/merchant/BrandMerchantApi.java
deleted
100644 → 0
View file @
6388820c
package
com
.
jiejing
.
fitness
.
finance
.
api
.
merchant
;
import
com.jiejing.common.model.JsonResult
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
com.jiejing.paycenter.api.pay.vo.RefundVO
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* 品牌商户API
*
* @author chengyubing
* @since 2024/2/22 11:49
*/
@FeignClient
(
name
=
"FINANCE"
,
url
=
"${rpc.url.fit-finance:http://app-fit-finance:7008}"
,
fallbackFactory
=
BrandMerchantApiFallback
.
class
)
public
interface
BrandMerchantApi
{
String
TAG
=
"金融-品牌商户管理"
;
@ApiOperation
(
value
=
"品牌入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/apply"
)
JsonResult
<
Void
>
apply
(
ApplyBrandMerchantRequest
request
);
@ApiOperation
(
value
=
"查询品牌当前绑定的商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/get"
)
JsonResult
<
BrandMerchantVO
>
get
(
GetBrandMerchantRequest
request
);
@ApiOperation
(
value
=
"查询品牌进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/getApply"
)
JsonResult
<
BrandMerchantApplyVO
>
getApply
(
GetBrandMerchantApplyRequest
request
);
@ApiOperation
(
value
=
"分页查询品牌进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/pageApply"
)
JsonResult
<
PageVO
<
BrandMerchantApplyVO
>>
pageApply
(
PageBrandMerchantApplyRequest
request
);
@ApiOperation
(
value
=
"绑定微信小程序appId"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/bindXcxAppId"
)
JsonResult
<
BrandMerchantBindXcxAppIdVO
>
bindXcxAppId
(
BindBrandMerchantXcxAppIdRequest
request
);
@ApiOperation
(
value
=
"授权子渠道"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/authSubChannel"
)
JsonResult
<
BrandMerchantAuthSubChannelVO
>
authSubChannel
(
AuthBrandMerchantSubChannelRequest
request
);
@ApiOperation
(
value
=
"查询授权子渠道结果"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/listAuthSubChannel"
)
JsonResult
<
List
<
BrandMerchantAuthSubChannelVO
>>
listAuthSubChannel
(
GetAuthBrandMerchantSubChannelRequest
request
);
@ApiOperation
(
value
=
"支付"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/pay"
)
JsonResult
<
PayVO
>
pay
(
BrandMerchantPayRequest
request
);
@ApiOperation
(
value
=
"退款"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/refund"
)
JsonResult
<
RefundVO
>
refund
(
BrandMerchantRefundRequest
request
);
}
api/src/main/java/com/jiejing/fitness/finance/api/merchant/StudioMerchantApi.java
0 → 100644
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
api
.
merchant
;
import
com.jiejing.common.model.JsonResult
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* @author chengyubing
* @since 2024/3/5 09:41
*/
@FeignClient
(
name
=
"FINANCE"
,
url
=
"${rpc.url.fit-finance:http://app-fit-finance:7008}"
,
fallbackFactory
=
StudioMerchantApiFallback
.
class
)
public
interface
StudioMerchantApi
{
String
TAG
=
"金融-场馆商户管理"
;
@ApiOperation
(
value
=
"场馆入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/getMerchant"
)
JsonResult
<
StudioMerchantVO
>
getMerchant
(
GetStudioMerchantRequest
request
);
@ApiOperation
(
value
=
"场馆入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/apply"
)
JsonResult
<
Void
>
apply
(
ApplyStudioMerchantRequest
request
);
@ApiOperation
(
value
=
"查询场馆进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/getApply"
)
JsonResult
<
StudioMerchantApplyVO
>
getApply
(
GetStudioMerchantApplyRequest
request
);
@ApiOperation
(
value
=
"分页查询场馆进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/pageApply"
)
JsonResult
<
PageVO
<
StudioMerchantApplyVO
>>
pageApply
(
PageStudioMerchantApplyRequest
request
);
@ApiOperation
(
value
=
"绑定微信小程序appId"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/bindXcxAppId"
)
JsonResult
<
StudioMerchantBindXcxAppIdVO
>
bindXcxAppId
(
BindStudioMerchantXcxAppIdRequest
request
);
@ApiOperation
(
value
=
"授权子渠道"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/authSubChannel"
)
JsonResult
<
StudioMerchantAuthSubChannelVO
>
authSubChannel
(
AuthStudioSubChannelRequest
request
);
@ApiOperation
(
value
=
"查询授权子渠道结果"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/listAuthSubChannel"
)
JsonResult
<
List
<
StudioMerchantAuthSubChannelVO
>>
listAuthSubChannel
(
GetAuthStudioSubChannelRequest
request
);
@ApiOperation
(
value
=
"支付"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/pay"
)
JsonResult
<
PayVO
>
pay
(
StudioMerchantPayRequest
request
);
}
\ No newline at end of file
api/src/main/java/com/jiejing/fitness/finance/api/merchant/
Brand
MerchantApiFallback.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/
Studio
MerchantApiFallback.java
View file @
b0f5dc59
...
...
@@ -2,79 +2,72 @@ package com.jiejing.fitness.finance.api.merchant;
import
com.jiejing.common.model.JsonResult
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
com.jiejing.paycenter.api.pay.vo.RefundVO
;
import
feign.hystrix.FallbackFactory
;
import
java.util.List
;
import
org.springframework.stereotype.Component
;
/**
* @author chengyubing
* @since 2024/
2/22 11:49
* @since 2024/
3/5 09:41
*/
@Component
public
class
BrandMerchantApiFallback
implements
FallbackFactory
<
Brand
MerchantApi
>
{
public
class
StudioMerchantApiFallback
implements
FallbackFactory
<
Studio
MerchantApi
>
{
@Override
public
Brand
MerchantApi
create
(
Throwable
throwable
)
{
return
new
Brand
MerchantApi
()
{
public
Studio
MerchantApi
create
(
Throwable
throwable
)
{
return
new
Studio
MerchantApi
()
{
@Override
public
JsonResult
<
Void
>
apply
(
ApplyBrand
MerchantRequest
request
)
{
public
JsonResult
<
StudioMerchantVO
>
getMerchant
(
GetStudio
MerchantRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
BrandMerchantVO
>
get
(
GetBrand
MerchantRequest
request
)
{
public
JsonResult
<
Void
>
apply
(
ApplyStudio
MerchantRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
BrandMerchantApplyVO
>
getApply
(
GetBrand
MerchantApplyRequest
request
)
{
public
JsonResult
<
StudioMerchantApplyVO
>
getApply
(
GetStudio
MerchantApplyRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
PageVO
<
BrandMerchantApplyVO
>>
pageApply
(
PageBrand
MerchantApplyRequest
request
)
{
public
JsonResult
<
PageVO
<
StudioMerchantApplyVO
>>
pageApply
(
PageStudio
MerchantApplyRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
BrandMerchantBindXcxAppIdVO
>
bindXcxAppId
(
BindBrandMerchantXcxAppIdRequest
request
)
{
public
JsonResult
<
StudioMerchantBindXcxAppIdVO
>
bindXcxAppId
(
BindStudioMerchantXcxAppIdRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
BrandMerchantAuthSubChannelVO
>
authSubChannel
(
AuthBrandMerchantSubChannelRequest
request
)
{
public
JsonResult
<
StudioMerchantAuthSubChannelVO
>
authSubChannel
(
AuthStudioSubChannelRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
List
<
Brand
MerchantAuthSubChannelVO
>>
listAuthSubChannel
(
GetAuth
BrandMerchant
SubChannelRequest
request
)
{
public
JsonResult
<
List
<
Studio
MerchantAuthSubChannelVO
>>
listAuthSubChannel
(
GetAuth
Studio
SubChannelRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
PayVO
>
pay
(
BrandMerchantPayRequest
request
)
{
return
JsonResult
.
rpcError
();
}
@Override
public
JsonResult
<
RefundVO
>
refund
(
BrandMerchantRefundRequest
request
)
{
public
JsonResult
<
PayVO
>
pay
(
StudioMerchantPayRequest
request
)
{
return
JsonResult
.
rpcError
();
}
};
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Apply
Brand
MerchantRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Apply
Studio
MerchantRequest.java
View file @
b0f5dc59
...
...
@@ -26,8 +26,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"申请
品牌
商户请求信息"
)
public
class
Apply
Brand
MerchantRequest
{
@ApiModel
(
description
=
"申请
场馆
商户请求信息"
)
public
class
Apply
Studio
MerchantRequest
{
@ApiModelProperty
(
value
=
"场馆ID"
,
required
=
true
)
@NotNull
(
message
=
"场馆ID不能为空"
)
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Auth
BrandMerchant
SubChannelRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Auth
Studio
SubChannelRequest.java
View file @
b0f5dc59
...
...
@@ -18,12 +18,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户授权子渠道"
)
public
class
Auth
BrandMerchant
SubChannelRequest
{
@ApiModel
(
description
=
"
场馆
商户授权子渠道"
)
public
class
Auth
Studio
SubChannelRequest
{
@ApiModelProperty
(
value
=
"
品牌
ID"
,
required
=
true
)
@NotNull
(
message
=
"
品牌
ID不能为空"
)
private
Long
brand
Id
;
@ApiModelProperty
(
value
=
"
场馆
ID"
,
required
=
true
)
@NotNull
(
message
=
"
场馆
ID不能为空"
)
private
Long
studio
Id
;
@ApiModelProperty
(
value
=
"子渠道"
,
required
=
true
)
@NotNull
(
message
=
"子渠道不能为空"
)
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Bind
Brand
MerchantXcxAppIdRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Bind
Studio
MerchantXcxAppIdRequest.java
View file @
b0f5dc59
...
...
@@ -16,12 +16,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户绑定小程序appId"
)
public
class
Bind
Brand
MerchantXcxAppIdRequest
{
@ApiModel
(
description
=
"
场馆
商户绑定小程序appId"
)
public
class
Bind
Studio
MerchantXcxAppIdRequest
{
@ApiModelProperty
(
value
=
"
品牌
ID"
,
required
=
true
)
@NotNull
(
message
=
"
品牌
ID不能为空"
)
private
Long
brand
Id
;
@ApiModelProperty
(
value
=
"
场馆
ID"
,
required
=
true
)
@NotNull
(
message
=
"
场馆
ID不能为空"
)
private
Long
studio
Id
;
@ApiModelProperty
(
value
=
"小程序appId"
,
required
=
true
)
@NotNull
(
message
=
"小程序appId不能为空"
)
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/BrandMerchantRefundRequest.java
deleted
100644 → 0
View file @
6388820c
package
com
.
jiejing
.
fitness
.
finance
.
api
.
merchant
.
request
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.math.BigDecimal
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author chengyubing
* @since 2024/2/27 10:54
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
description
=
"品牌商户退款Request"
)
public
class
BrandMerchantRefundRequest
{
@ApiModelProperty
(
value
=
"场馆ID"
,
required
=
true
)
@NotNull
(
message
=
"场馆ID不能为空"
)
private
Long
studioId
;
@ApiModelProperty
(
name
=
"支付总金额(元)"
,
required
=
true
)
@NotNull
(
message
=
"支付总金额不能为空"
)
private
BigDecimal
transAmount
;
@ApiModelProperty
(
name
=
"上层业务退款单号"
,
required
=
true
)
@NotBlank
(
message
=
"上层业务退款单号不能为空"
)
private
String
orderNo
;
@ApiModelProperty
(
name
=
"退款请求对应的支付流水号"
,
required
=
true
)
@NotBlank
(
message
=
"退款请求对应的支付流水号不能为空"
)
private
String
payTransNo
;
@ApiModelProperty
(
name
=
"退款原因"
,
required
=
true
)
@NotBlank
(
message
=
"退款原因不能为空"
)
private
String
refundReason
;
}
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/GetAuth
BrandMerchant
SubChannelRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/GetAuth
Studio
SubChannelRequest.java
View file @
b0f5dc59
...
...
@@ -16,11 +16,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户查看授权子渠道结果"
)
public
class
GetAuth
BrandMerchant
SubChannelRequest
{
@ApiModel
(
description
=
"
场馆
商户查看授权子渠道结果"
)
public
class
GetAuth
Studio
SubChannelRequest
{
@ApiModelProperty
(
value
=
"
品牌
ID"
,
required
=
true
)
@NotNull
(
message
=
"
品牌
ID不能为空"
)
private
Long
brand
Id
;
@ApiModelProperty
(
value
=
"
场馆
ID"
,
required
=
true
)
@NotNull
(
message
=
"
场馆
ID不能为空"
)
private
Long
studio
Id
;
}
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Get
Brand
MerchantApplyRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Get
Studio
MerchantApplyRequest.java
View file @
b0f5dc59
...
...
@@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"申请
品牌
商户记录请求信息"
)
public
class
Get
Brand
MerchantApplyRequest
{
@ApiModel
(
description
=
"申请
场馆
商户记录请求信息"
)
public
class
Get
Studio
MerchantApplyRequest
{
@ApiModelProperty
(
value
=
"申请ID"
,
required
=
true
)
@NotNull
(
message
=
"申请ID不能为空"
)
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Get
Brand
MerchantRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Get
Studio
MerchantRequest.java
View file @
b0f5dc59
...
...
@@ -18,11 +18,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"申请
品牌
商户请求信息"
)
public
class
Get
Brand
MerchantRequest
{
@ApiModel
(
description
=
"申请
场馆
商户请求信息"
)
public
class
Get
Studio
MerchantRequest
{
@ApiModelProperty
(
value
=
"
品牌
ID"
,
required
=
true
)
@NotNull
(
message
=
"
品牌
ID不能为空"
)
private
Long
brand
Id
;
@ApiModelProperty
(
value
=
"
场馆
ID"
,
required
=
true
)
@NotNull
(
message
=
"
场馆
ID不能为空"
)
private
Long
studio
Id
;
}
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Page
Brand
MerchantApplyRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/Page
Studio
MerchantApplyRequest.java
View file @
b0f5dc59
...
...
@@ -19,8 +19,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"分页查询申请
品牌
商户请求信息Request"
)
public
class
Page
Brand
MerchantApplyRequest
{
@ApiModel
(
description
=
"分页查询申请
场馆
商户请求信息Request"
)
public
class
Page
Studio
MerchantApplyRequest
{
@ApiModelProperty
(
value
=
"商户简称"
)
private
String
shortName
;
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/
Brand
MerchantPayRequest.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/request/
Studio
MerchantPayRequest.java
View file @
b0f5dc59
...
...
@@ -21,12 +21,12 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
description
=
"
品牌
商户支付Request"
)
public
class
Brand
MerchantPayRequest
{
@ApiModel
(
description
=
"
场馆
商户支付Request"
)
public
class
Studio
MerchantPayRequest
{
@ApiModelProperty
(
value
=
"
品牌
ID"
,
required
=
true
)
@NotNull
(
message
=
"
品牌
ID不能为空"
)
private
Long
brand
Id
;
@ApiModelProperty
(
value
=
"
场馆
ID"
,
required
=
true
)
@NotNull
(
message
=
"
场馆
ID不能为空"
)
private
Long
studio
Id
;
@ApiModelProperty
(
name
=
"支付总金额(元)"
,
required
=
true
)
@NotNull
(
message
=
"支付总金额不能为空"
)
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Brand
MerchantApplyVO.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Studio
MerchantApplyVO.java
View file @
b0f5dc59
...
...
@@ -23,8 +23,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户申请VO"
)
public
class
Brand
MerchantApplyVO
{
@ApiModel
(
description
=
"
场馆
商户申请VO"
)
public
class
Studio
MerchantApplyVO
{
@ApiModelProperty
(
"ID"
)
private
Long
id
;
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Brand
MerchantAuthSubChannelVO.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Studio
MerchantAuthSubChannelVO.java
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
api
.
merchant
.
vo
;
import
com.jiejing.paycenter.common.enums.common.OpenStateEnums
;
import
com.jiejing.paycenter.common.enums.merchant.AuthPhaseEnums
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
...
...
@@ -17,8 +16,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户认证子渠道VO"
)
public
class
Brand
MerchantAuthSubChannelVO
{
@ApiModel
(
description
=
"
场馆
商户认证子渠道VO"
)
public
class
Studio
MerchantAuthSubChannelVO
{
@ApiModelProperty
(
value
=
"申请单"
)
private
String
applyNo
;
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Brand
MerchantBindXcxAppIdVO.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Studio
MerchantBindXcxAppIdVO.java
View file @
b0f5dc59
...
...
@@ -16,8 +16,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
商户绑定小程序AppIdVO"
)
public
class
Brand
MerchantBindXcxAppIdVO
{
@ApiModel
(
description
=
"
场馆
商户绑定小程序AppIdVO"
)
public
class
Studio
MerchantBindXcxAppIdVO
{
/**
* @see OpenStateEnums
...
...
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Brand
MerchantVO.java
→
api/src/main/java/com/jiejing/fitness/finance/api/merchant/vo/
Studio
MerchantVO.java
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
api
.
merchant
.
vo
;
import
com.jiejing.fitness.finance.api.merchant.request.model.BrandBankCardInfo
;
import
com.jiejing.fitness.finance.api.merchant.request.model.BrandLegalInfo
;
import
com.jiejing.fitness.finance.api.merchant.request.model.BrandLicenseInfo
;
import
com.jiejing.fitness.finance.api.merchant.request.model.BrandResourceInfo
;
import
com.jiejing.paycenter.api.merchant.vo.SubChannelConfigVO
;
import
com.jiejing.paycenter.common.enums.common.OpenStateEnums
;
import
com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums
;
...
...
@@ -23,11 +19,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"
品牌
当前绑定的商户信息VO"
)
public
class
Brand
MerchantVO
{
@ApiModel
(
description
=
"
场馆
当前绑定的商户信息VO"
)
public
class
Studio
MerchantVO
{
@ApiModelProperty
(
"
品牌
ID"
)
private
Long
brand
Id
;
@ApiModelProperty
(
"
场馆
ID"
)
private
Long
studio
Id
;
@ApiModelProperty
(
"渠道号"
)
private
String
channelNo
;
...
...
app/src/main/java/com/jiejing/fitness/finance/app/controller/merchant/BrandMerchantController.java
deleted
100644 → 0
View file @
6388820c
package
com
.
jiejing
.
fitness
.
finance
.
app
.
controller
.
merchant
;
import
com.jiejing.common.model.JsonResult
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.common.utils.convert.BeanUtil
;
import
com.jiejing.fitness.finance.api.merchant.BrandMerchantApi
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.fitness.finance.service.merchant.BrandMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams
;
import
com.jiejing.fitness.finance.service.pay.PayService
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
com.jiejing.paycenter.api.pay.vo.RefundVO
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author chengyubing
* @since 2024/2/22 11:53
*/
@RestController
public
class
BrandMerchantController
implements
BrandMerchantApi
{
@Resource
private
BrandMerchantService
brandMerchantService
;
@Resource
private
PayService
payService
;
@ApiOperation
(
value
=
"品牌入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/apply"
)
@Override
public
JsonResult
<
Void
>
apply
(
@RequestBody
@Valid
ApplyBrandMerchantRequest
request
)
{
ApplyBrandMerchantParams
params
=
BeanUtil
.
map
(
request
,
ApplyBrandMerchantParams
.
class
);
brandMerchantService
.
apply
(
params
);
return
JsonResult
.
success
();
}
@ApiOperation
(
value
=
"查询品牌当前绑定的商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/get"
)
@Override
public
JsonResult
<
BrandMerchantVO
>
get
(
@RequestBody
@Valid
GetBrandMerchantRequest
request
)
{
return
JsonResult
.
success
(
brandMerchantService
.
getMerchant
(
request
.
getBrandId
()));
}
@ApiOperation
(
value
=
"查询品牌进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/getApply"
)
@Override
public
JsonResult
<
BrandMerchantApplyVO
>
getApply
(
@RequestBody
@Valid
GetBrandMerchantApplyRequest
request
)
{
return
JsonResult
.
success
(
brandMerchantService
.
getApply
(
request
.
getId
()));
}
@ApiOperation
(
value
=
"分页查询品牌进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/pageApply"
)
@Override
public
JsonResult
<
PageVO
<
BrandMerchantApplyVO
>>
pageApply
(
@RequestBody
@Valid
PageBrandMerchantApplyRequest
request
)
{
PageBrandMerchantApplyParams
params
=
BeanUtil
.
map
(
request
,
PageBrandMerchantApplyParams
.
class
);
return
JsonResult
.
success
(
brandMerchantService
.
pageApply
(
params
));
}
@ApiOperation
(
value
=
"绑定微信小程序appId"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/bindXcxAppId"
)
@Override
public
JsonResult
<
BrandMerchantBindXcxAppIdVO
>
bindXcxAppId
(
@RequestBody
@Valid
BindBrandMerchantXcxAppIdRequest
request
)
{
return
JsonResult
.
success
(
brandMerchantService
.
bindXcxAppId
(
request
.
getBrandId
(),
request
.
getAppId
()));
}
@ApiOperation
(
value
=
"授权子渠道"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/authSubChannel"
)
@Override
public
JsonResult
<
BrandMerchantAuthSubChannelVO
>
authSubChannel
(
@RequestBody
@Valid
AuthBrandMerchantSubChannelRequest
request
)
{
return
JsonResult
.
success
(
brandMerchantService
.
authSubChannel
(
request
.
getBrandId
(),
request
.
getSubChannel
(),
request
.
getAuthType
()));
}
@ApiOperation
(
value
=
"查询授权子渠道结果"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/listAuthSubChannel"
)
@Override
public
JsonResult
<
List
<
BrandMerchantAuthSubChannelVO
>>
listAuthSubChannel
(
@RequestBody
@Valid
GetAuthBrandMerchantSubChannelRequest
request
)
{
return
JsonResult
.
success
(
brandMerchantService
.
listAuthSubChannel
(
request
.
getBrandId
()));
}
@ApiOperation
(
value
=
"支付"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/pay"
)
@Override
public
JsonResult
<
PayVO
>
pay
(
@RequestBody
@Valid
BrandMerchantPayRequest
request
)
{
BrandMerchantPayParams
params
=
BeanUtil
.
map
(
request
,
BrandMerchantPayParams
.
class
);
return
JsonResult
.
success
(
payService
.
merchantPay
(
params
));
}
@ApiOperation
(
value
=
"退款"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/brandMerchant/refund"
)
@Override
public
JsonResult
<
RefundVO
>
refund
(
@RequestBody
@Valid
BrandMerchantRefundRequest
request
)
{
BrandMerchantRefundParams
params
=
BeanUtil
.
map
(
request
,
BrandMerchantRefundParams
.
class
);
return
JsonResult
.
success
(
payService
.
merchantRefund
(
params
));
}
}
app/src/main/java/com/jiejing/fitness/finance/app/controller/merchant/StudioMerchantController.java
0 → 100644
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
app
.
controller
.
merchant
;
import
com.jiejing.common.model.JsonResult
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.common.utils.convert.BeanUtil
;
import
com.jiejing.fitness.finance.api.merchant.StudioMerchantApi
;
import
com.jiejing.fitness.finance.api.merchant.request.ApplyStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest
;
import
com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.fitness.finance.service.merchant.StudioMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageStudioMerchantApplyParams
;
import
com.jiejing.fitness.finance.service.pay.PayService
;
import
com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author chengyubing
* @since 2024/3/5 09:56
*/
@RestController
public
class
StudioMerchantController
implements
StudioMerchantApi
{
@Resource
private
StudioMerchantService
studioMerchantService
;
@Resource
private
PayService
payService
;
@ApiOperation
(
value
=
"场馆入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/getMerchant"
)
@Override
public
JsonResult
<
StudioMerchantVO
>
getMerchant
(
@RequestBody
@Valid
GetStudioMerchantRequest
request
)
{
return
JsonResult
.
success
(
studioMerchantService
.
getMerchant
(
request
.
getStudioId
()));
}
@ApiOperation
(
value
=
"场馆入驻商户"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/apply"
)
@Override
public
JsonResult
<
Void
>
apply
(
@RequestBody
@Valid
ApplyStudioMerchantRequest
request
)
{
ApplyStudioMerchantParams
params
=
BeanUtil
.
map
(
request
,
ApplyStudioMerchantParams
.
class
);
studioMerchantService
.
apply
(
params
);
return
JsonResult
.
success
();
}
@ApiOperation
(
value
=
"查询场馆进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/getApply"
)
@Override
public
JsonResult
<
StudioMerchantApplyVO
>
getApply
(
@RequestBody
@Valid
GetStudioMerchantApplyRequest
request
)
{
return
JsonResult
.
success
(
studioMerchantService
.
getApply
(
request
.
getId
()));
}
@ApiOperation
(
value
=
"分页查询场馆进件申请记录"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/pageApply"
)
@Override
public
JsonResult
<
PageVO
<
StudioMerchantApplyVO
>>
pageApply
(
@RequestBody
@Valid
PageStudioMerchantApplyRequest
request
)
{
PageStudioMerchantApplyParams
params
=
BeanUtil
.
map
(
request
,
PageStudioMerchantApplyParams
.
class
);
return
JsonResult
.
success
(
studioMerchantService
.
pageApply
(
params
));
}
@ApiOperation
(
value
=
"绑定微信小程序appId"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/bindXcxAppId"
)
@Override
public
JsonResult
<
StudioMerchantBindXcxAppIdVO
>
bindXcxAppId
(
@RequestBody
@Valid
BindStudioMerchantXcxAppIdRequest
request
)
{
return
JsonResult
.
success
(
studioMerchantService
.
bindXcxAppId
(
request
.
getStudioId
(),
request
.
getAppId
()));
}
@ApiOperation
(
value
=
"授权子渠道"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/authSubChannel"
)
@Override
public
JsonResult
<
StudioMerchantAuthSubChannelVO
>
authSubChannel
(
@RequestBody
@Valid
AuthStudioSubChannelRequest
request
)
{
return
JsonResult
.
success
(
studioMerchantService
.
authSubChannel
(
request
.
getStudioId
(),
request
.
getSubChannel
(),
request
.
getAuthType
()));
}
@ApiOperation
(
value
=
"查询授权子渠道结果"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/listAuthSubChannel"
)
@Override
public
JsonResult
<
List
<
StudioMerchantAuthSubChannelVO
>>
listAuthSubChannel
(
@RequestBody
@Valid
GetAuthStudioSubChannelRequest
request
)
{
return
JsonResult
.
success
(
studioMerchantService
.
listAuthSubChannel
(
request
.
getStudioId
()));
}
@ApiOperation
(
value
=
"支付"
,
tags
=
{
TAG
})
@PostMapping
(
value
=
"/private/studioMerchant/pay"
)
@Override
public
JsonResult
<
PayVO
>
pay
(
@RequestBody
@Valid
StudioMerchantPayRequest
request
)
{
StudioMerchantPayParams
params
=
BeanUtil
.
map
(
request
,
StudioMerchantPayParams
.
class
);
return
JsonResult
.
success
(
payService
.
merchantPay
(
params
));
}
}
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/
Brand
ToMerchant.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/
Party
ToMerchant.java
View file @
b0f5dc59
...
...
@@ -15,6 +15,7 @@
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.jiejing.fitness.finance.api.enums.PartyTypeEnums
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.io.Serializable
;
...
...
@@ -26,19 +27,19 @@ import lombok.NoArgsConstructor;
/**
* <p>
*
品牌商户关联表(1:1)
*
商户关联表
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-04
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Builder
(
toBuilder
=
true
)
@NoArgsConstructor
@AllArgsConstructor
public
class
Brand
ToMerchant
implements
Serializable
{
public
class
Party
ToMerchant
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4973389381018495600
L
;
private
static
final
long
serialVersionUID
=
128336673584905078
L
;
/**
* 备注: ID 是否允许为null: NO
...
...
@@ -47,14 +48,19 @@ public class BrandToMerchant implements Serializable {
private
Long
id
;
/**
*
渠道号
*
备注: 渠道号 是否允许为null: YES
*/
private
String
channelNo
;
/**
* 备注:
品牌
ID 是否允许为null: YES
* 备注:
业务方
ID 是否允许为null: YES
*/
private
Long
brandId
;
private
Long
partyId
;
/**
* 备注: 业务方类型 是否允许为null: YES
*/
private
PartyTypeEnums
partyType
;
/**
* 备注: paycenter的商户ID 是否允许为null: YES
...
...
@@ -62,7 +68,7 @@ public class BrandToMerchant implements Serializable {
private
Long
merchantId
;
/**
* 备注: 商户号 是否允许为null: YES
* 备注: 商户号
(冗余)
是否允许为null: YES
*/
private
String
merchantNo
;
...
...
@@ -81,7 +87,9 @@ public class BrandToMerchant implements Serializable {
public
static
final
String
CHANNEL_NO
=
"channel_no"
;
public
static
final
String
BRAND_ID
=
"brand_id"
;
public
static
final
String
PARTY_ID
=
"party_id"
;
public
static
final
String
PARTY_TYPE
=
"party_type"
;
public
static
final
String
MERCHANT_ID
=
"merchant_id"
;
...
...
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/
Brand
MerchantApply.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/entity/
Studio
MerchantApply.java
View file @
b0f5dc59
...
...
@@ -29,22 +29,22 @@ import lombok.NoArgsConstructor;
/**
* <p>
*
品牌
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表)
*
场馆
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表)
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-05
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Builder
(
toBuilder
=
true
)
@NoArgsConstructor
@AllArgsConstructor
public
class
Brand
MerchantApply
implements
Serializable
{
public
class
Studio
MerchantApply
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4973389381018495600
L
;
private
static
final
long
serialVersionUID
=
-
5392799333879973205
L
;
/**
*
ID
*
备注: ID 是否允许为null: NO
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
ID_WORKER
)
private
Long
id
;
...
...
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Brand
ToMerchantMapper.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Party
ToMerchantMapper.java
View file @
b0f5dc59
...
...
@@ -14,16 +14,16 @@
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
mapper
;
import
com.jiejing.fitness.finance.repository.entity.
Brand
ToMerchant
;
import
com.jiejing.fitness.finance.repository.entity.
Party
ToMerchant
;
import
com.jiejing.mbp.inject.XBaseMapper
;
/**
* <p>
*
品牌商户关联表(1:1)
Mapper 接口
*
商户关联表
Mapper 接口
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-04
*/
public
interface
BrandToMerchantMapper
extends
XBaseMapper
<
Brand
ToMerchant
>
{
public
interface
PartyToMerchantMapper
extends
XBaseMapper
<
Party
ToMerchant
>
{
}
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Brand
ToMerchantMapper.xml
→
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Party
ToMerchantMapper.xml
View file @
b0f5dc59
...
...
@@ -13,11 +13,11 @@
~ 官网: www.xiaomai5.com
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jiejing.fitness.finance.repository.mapper.
Brand
ToMerchantMapper"
>
<mapper
namespace=
"com.jiejing.fitness.finance.repository.mapper.
Party
ToMerchantMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, channel_no,
brand_id
, merchant_id, merchant_no, create_time, update_time
id, channel_no,
party_id, party_type
, merchant_id, merchant_no, create_time, update_time
</sql>
</mapper>
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Brand
MerchantApplyMapper.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Studio
MerchantApplyMapper.java
View file @
b0f5dc59
...
...
@@ -14,19 +14,21 @@
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
mapper
;
import
com.jiejing.fitness.finance.repository.entity.
Brand
MerchantApply
;
import
com.jiejing.fitness.finance.repository.entity.
Studio
MerchantApply
;
import
com.jiejing.mbp.inject.XBaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* <p>
*
品牌
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) Mapper 接口
*
场馆
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) Mapper 接口
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-05
*/
public
interface
BrandMerchantApplyMapper
extends
XBaseMapper
<
Brand
MerchantApply
>
{
public
interface
StudioMerchantApplyMapper
extends
XBaseMapper
<
Studio
MerchantApply
>
{
BrandMerchantApply
getLatestOneSuccessByBrandId
(
@Param
(
"brandId"
)
Long
brandId
);
StudioMerchantApply
getLatestOneSuccessByMerchantId
(
@Param
(
"merchantId"
)
Long
merchantId
);
StudioMerchantApply
getLatestOneSuccessByStudioId
(
@Param
(
"studioId"
)
Long
studioId
);
}
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Brand
MerchantApplyMapper.xml
→
repository/src/main/java/com/jiejing/fitness/finance/repository/mapper/
Studio
MerchantApplyMapper.xml
View file @
b0f5dc59
...
...
@@ -13,18 +13,28 @@
~ 官网: www.xiaomai5.com
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.jiejing.fitness.finance.repository.mapper.
Brand
MerchantApplyMapper"
>
<mapper
namespace=
"com.jiejing.fitness.finance.repository.mapper.
Studio
MerchantApplyMapper"
>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, brand_id, studio_id, apply_no, apply_type, channel_no, merchant_id, merchant_no, merchant_name, short_name, company_type, open_state, open_fail_message, ali_open_state, ali_auth_state, ali_merchant_no, ali_open_fail_message, wx_offline_open_state, wx_offline_auth_state, wx_offline_merchant_no, wx_offline_open_fail_message, wx_online_open_state, wx_online_auth_state, wx_online_merchant_no, wx_online_open_fail_message, merchant_info, salt, finish_time, create_time, update_time
</sql>
<select
id=
"getLatestOneSuccessBy
Brand
Id"
resultType=
"com.jiejing.fitness.finance.repository.entity.Brand
MerchantApply"
>
<select
id=
"getLatestOneSuccessBy
Merchant
Id"
resultType=
"com.jiejing.fitness.finance.repository.entity.Studio
MerchantApply"
>
select *
from brand_merchant_apply
where brand_id = #{brandId}
from studio_merchant_apply
where merchant_id = #{merchantId}
and open_state = 'S'
order by id desc
limit 1
</select>
<select
id=
"getLatestOneSuccessByStudioId"
resultType=
"com.jiejing.fitness.finance.repository.entity.StudioMerchantApply"
>
select *
from studio_merchant_apply
where studio_id = #{studioId}
and open_state = 'S'
order by id desc
limit 1
...
...
repository/src/main/java/com/jiejing/fitness/finance/repository/query/PageStudioMerchantApplyQuery.java
0 → 100644
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
query
;
import
com.jiejing.fitness.finance.api.enums.ApplyTypeEnums
;
import
com.jiejing.paycenter.common.enums.common.OpenStateEnums
;
import
com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums
;
import
lombok.Data
;
/**
* @author chengyubing
* @since 2024/2/22 18:03
*/
@Data
public
class
PageStudioMerchantApplyQuery
{
/**
* 商户简称
*/
private
String
shortName
;
/**
* 操作类型
*/
private
ApplyTypeEnums
applyType
;
/**
* 场馆ID
*/
private
Long
studioId
;
/**
* 申请类型
*/
private
CompanyTypeEnums
companyType
;
/**
* 商户名称
*/
private
String
merchantName
;
/**
* 申请状态
*/
private
OpenStateEnums
openState
;
/**
* 商户号
*/
private
String
merchantNo
;
/**
* 支付宝商户号
*/
private
String
aliMerchantNo
;
/**
* 微信线上商户号
*/
private
String
wxOnlineMerchantNo
;
/**
* 微信线下商户号
*/
private
String
wxOfflineMerchantNo
;
/**
* 页码:0开始
*/
private
Integer
current
;
/**
* 分页大小
*/
private
Integer
size
;
}
repository/src/main/java/com/jiejing/fitness/finance/repository/service/
Brand
ToMerchantRpService.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/service/
Party
ToMerchantRpService.java
View file @
b0f5dc59
...
...
@@ -15,27 +15,64 @@
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jiejing.fitness.finance.repository.entity.BrandToMerchant
;
import
com.jiejing.fitness.finance.repository.mapper.BrandToMerchantMapper
;
import
com.jiejing.common.utils.collection.CollectionUtil
;
import
com.jiejing.fitness.finance.api.enums.PartyTypeEnums
;
import
com.jiejing.fitness.finance.repository.entity.PartyToMerchant
;
import
com.jiejing.fitness.finance.repository.mapper.PartyToMerchantMapper
;
import
com.jiejing.mbp.MapperRepoService
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
/**
* <p>
*
品牌商户关联表(1:1)
服务实现类
*
商户关联表
服务实现类
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-04
*/
@Service
public
class
Brand
ToMerchantRpService
extends
MapperRepoService
<
Long
,
BrandToMerchant
,
Brand
ToMerchantMapper
>
{
public
class
Party
ToMerchantRpService
extends
MapperRepoService
<
Long
,
PartyToMerchant
,
Party
ToMerchantMapper
>
{
public
BrandToMerchant
getByBrandId
(
Long
brandId
,
String
channelNo
)
{
QueryWrapper
<
BrandToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
BrandToMerchant
.
BRAND_ID
,
brandId
);
wrapper
.
eq
(
BrandToMerchant
.
CHANNEL_NO
,
channelNo
);
public
List
<
PartyToMerchant
>
listByParty
(
Long
partyId
,
PartyTypeEnums
partyType
,
String
channelNo
)
{
QueryWrapper
<
PartyToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
PartyToMerchant
.
PARTY_ID
,
partyId
);
wrapper
.
eq
(
PartyToMerchant
.
PARTY_TYPE
,
partyType
);
wrapper
.
eq
(
PartyToMerchant
.
CHANNEL_NO
,
channelNo
);
return
this
.
baseMapper
.
selectList
(
wrapper
);
}
public
PartyToMerchant
getByStudioId
(
Long
studioId
,
String
channelNo
)
{
QueryWrapper
<
PartyToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
PartyToMerchant
.
PARTY_ID
,
studioId
);
wrapper
.
eq
(
PartyToMerchant
.
PARTY_TYPE
,
PartyTypeEnums
.
STUDIO
);
wrapper
.
eq
(
PartyToMerchant
.
CHANNEL_NO
,
channelNo
);
List
<
PartyToMerchant
>
list
=
this
.
baseMapper
.
selectList
(
wrapper
);
return
CollectionUtil
.
isEmpty
(
list
)
?
null
:
list
.
get
(
0
);
}
public
PartyToMerchant
getOneByPartyAndMerchantId
(
String
channelNo
,
Long
partyId
,
PartyTypeEnums
partyType
,
Long
merchantId
)
{
QueryWrapper
<
PartyToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
PartyToMerchant
.
PARTY_ID
,
partyId
);
wrapper
.
eq
(
PartyToMerchant
.
MERCHANT_ID
,
merchantId
);
wrapper
.
eq
(
PartyToMerchant
.
PARTY_TYPE
,
partyType
);
wrapper
.
eq
(
PartyToMerchant
.
CHANNEL_NO
,
channelNo
);
return
this
.
baseMapper
.
selectOne
(
wrapper
);
}
public
void
deleteByParty
(
Long
partyId
,
PartyTypeEnums
partyType
)
{
QueryWrapper
<
PartyToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
PartyToMerchant
.
PARTY_ID
,
partyId
);
wrapper
.
eq
(
PartyToMerchant
.
PARTY_TYPE
,
partyType
);
this
.
baseMapper
.
delete
(
wrapper
);
}
public
void
deleteByPartyAndMerchantId
(
Long
partyId
,
PartyTypeEnums
partyType
,
Long
merchantId
)
{
QueryWrapper
<
PartyToMerchant
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
PartyToMerchant
.
PARTY_ID
,
partyId
);
wrapper
.
eq
(
PartyToMerchant
.
PARTY_TYPE
,
partyType
);
wrapper
.
eq
(
PartyToMerchant
.
MERCHANT_ID
,
merchantId
);
this
.
baseMapper
.
delete
(
wrapper
);
}
}
repository/src/main/java/com/jiejing/fitness/finance/repository/service/
Brand
MerchantApplyRpService.java
→
repository/src/main/java/com/jiejing/fitness/finance/repository/service/
Studio
MerchantApplyRpService.java
View file @
b0f5dc59
...
...
@@ -16,61 +16,69 @@ package com.jiejing.fitness.finance.repository.service;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jiejing.common.utils.text.StringUtil
;
import
com.jiejing.fitness.finance.repository.entity.
Brand
MerchantApply
;
import
com.jiejing.fitness.finance.repository.mapper.
Brand
MerchantApplyMapper
;
import
com.jiejing.fitness.finance.repository.query.Page
Brand
MerchantApplyQuery
;
import
com.jiejing.fitness.finance.repository.entity.
Studio
MerchantApply
;
import
com.jiejing.fitness.finance.repository.mapper.
Studio
MerchantApplyMapper
;
import
com.jiejing.fitness.finance.repository.query.Page
Studio
MerchantApplyQuery
;
import
com.jiejing.mbp.MapperRepoService
;
import
org.springframework.data.domain.Page
;
import
org.springframework.stereotype.Service
;
/**
* <p>
*
品牌
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) 服务实现类
*
场馆
商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) 服务实现类
* </p>
*
* @author chengyubing, created on 2024-0
2-22
* @author chengyubing, created on 2024-0
3-05
*/
@Service
public
class
Brand
MerchantApplyRpService
extends
MapperRepoService
<
Long
,
BrandMerchantApply
,
Brand
MerchantApplyMapper
>
{
public
class
Studio
MerchantApplyRpService
extends
MapperRepoService
<
Long
,
StudioMerchantApply
,
Studio
MerchantApplyMapper
>
{
public
BrandMerchantApply
getLatestOneSuccessByBrandId
(
Long
brandId
)
{
return
this
.
baseMapper
.
getLatestOneSuccessByBrandId
(
brandId
);
}
public
Page
<
BrandMerchantApply
>
page
(
PageBrand
MerchantApplyQuery
params
)
{
QueryWrapper
<
Brand
MerchantApply
>
wrapper
=
new
QueryWrapper
<>();
public
Page
<
StudioMerchantApply
>
page
(
PageStudio
MerchantApplyQuery
params
)
{
QueryWrapper
<
Studio
MerchantApply
>
wrapper
=
new
QueryWrapper
<>();
if
(
StringUtil
.
isNotBlank
(
params
.
getShortName
()))
{
wrapper
.
like
(
Brand
MerchantApply
.
SHORT_NAME
,
params
.
getShortName
());
wrapper
.
like
(
Studio
MerchantApply
.
SHORT_NAME
,
params
.
getShortName
());
}
if
(
null
!=
params
.
getApplyType
())
{
wrapper
.
eq
(
Brand
MerchantApply
.
APPLY_TYPE
,
params
.
getApplyType
());
wrapper
.
eq
(
Studio
MerchantApply
.
APPLY_TYPE
,
params
.
getApplyType
());
}
if
(
null
!=
params
.
getStudioId
())
{
wrapper
.
eq
(
Brand
MerchantApply
.
STUDIO_ID
,
params
.
getStudioId
());
wrapper
.
eq
(
Studio
MerchantApply
.
STUDIO_ID
,
params
.
getStudioId
());
}
if
(
null
!=
params
.
getCompanyType
())
{
wrapper
.
eq
(
Brand
MerchantApply
.
COMPANY_TYPE
,
params
.
getCompanyType
());
wrapper
.
eq
(
Studio
MerchantApply
.
COMPANY_TYPE
,
params
.
getCompanyType
());
}
if
(
StringUtil
.
isNotBlank
(
params
.
getMerchantName
()))
{
wrapper
.
like
(
Brand
MerchantApply
.
MERCHANT_NAME
,
params
.
getMerchantName
());
wrapper
.
like
(
Studio
MerchantApply
.
MERCHANT_NAME
,
params
.
getMerchantName
());
}
if
(
null
!=
params
.
getOpenState
())
{
wrapper
.
eq
(
Brand
MerchantApply
.
OPEN_STATE
,
params
.
getOpenState
());
wrapper
.
eq
(
Studio
MerchantApply
.
OPEN_STATE
,
params
.
getOpenState
());
}
if
(
StringUtil
.
isNotBlank
(
params
.
getMerchantNo
()))
{
wrapper
.
eq
(
Brand
MerchantApply
.
MERCHANT_NO
,
params
.
getMerchantNo
());
wrapper
.
eq
(
Studio
MerchantApply
.
MERCHANT_NO
,
params
.
getMerchantNo
());
}
if
(
StringUtil
.
isNotBlank
(
params
.
getAliMerchantNo
()))
{
wrapper
.
eq
(
Brand
MerchantApply
.
ALI_MERCHANT_NO
,
params
.
getAliMerchantNo
());
wrapper
.
eq
(
Studio
MerchantApply
.
ALI_MERCHANT_NO
,
params
.
getAliMerchantNo
());
}
if
(
StringUtil
.
isNotBlank
(
params
.
getWxOnlineMerchantNo
()))
{
wrapper
.
eq
(
Brand
MerchantApply
.
WX_ONLINE_MERCHANT_NO
,
params
.
getWxOnlineMerchantNo
());
wrapper
.
eq
(
Studio
MerchantApply
.
WX_ONLINE_MERCHANT_NO
,
params
.
getWxOnlineMerchantNo
());
}
if
(
StringUtil
.
isNotBlank
(
params
.
getWxOfflineMerchantNo
()))
{
wrapper
.
eq
(
Brand
MerchantApply
.
WX_OFFLINE_MERCHANT_NO
,
params
.
getWxOfflineMerchantNo
());
wrapper
.
eq
(
Studio
MerchantApply
.
WX_OFFLINE_MERCHANT_NO
,
params
.
getWxOfflineMerchantNo
());
}
return
this
.
findByWrapperPage
(
wrapper
,
params
.
getCurrent
(),
params
.
getSize
());
}
public
StudioMerchantApply
getLatestOneSuccessByMerchantId
(
Long
merchantId
)
{
return
this
.
baseMapper
.
getLatestOneSuccessByMerchantId
(
merchantId
);
}
public
StudioMerchantApply
getLatestOneSuccessByStudioId
(
Long
studioId
)
{
QueryWrapper
<
StudioMerchantApply
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
StudioMerchantApply
.
STUDIO_ID
,
studioId
);
return
this
.
baseMapper
.
getLatestOneSuccessByStudioId
(
studioId
);
}
}
repository/src/test/java/com/jiejing/fitness/finance/repository/GeneratorServiceEntity.java
View file @
b0f5dc59
...
...
@@ -52,10 +52,9 @@ public class GeneratorServiceEntity {
private
String
author
=
"chengyubing"
;
private
String
[]
tableNames
=
{
// "global_config",
// "brand_merchant_apply",
// "brand_to_merchant",
// "brand_bind_wx_app_id_apply",
"brand_cashier_record"
// "studio_merchant_apply",
// "party_to_merchant",
// "brand_cashier_record"
};
/**
...
...
service/src/main/java/com/jiejing/fitness/finance/service/event/ListenerService.java
View file @
b0f5dc59
...
...
@@ -3,8 +3,8 @@ package com.jiejing.fitness.finance.service.event;
import
static
org
.
springframework
.
integration
.
IntegrationMessageHeaderAccessor
.
DELIVERY_ATTEMPT
;
import
com.alibaba.fastjson.JSON
;
import
com.jiejing.fitness.finance.api.enums.
Merchant
TypeEnums
;
import
com.jiejing.fitness.finance.service.merchant.
Brand
MerchantService
;
import
com.jiejing.fitness.finance.api.enums.
Party
TypeEnums
;
import
com.jiejing.fitness.finance.service.merchant.
Studio
MerchantService
;
import
com.jiejing.fitness.finance.service.pay.PayService
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
com.jiejing.paycenter.common.event.PayEvent
;
...
...
@@ -28,7 +28,7 @@ public class ListenerService {
private
static
final
int
MAX_RETRY
=
3
;
@Resource
private
BrandMerchantService
brand
MerchantService
;
private
StudioMerchantService
studio
MerchantService
;
@Resource
private
PayService
payService
;
...
...
@@ -42,10 +42,10 @@ public class ListenerService {
event
.
setSubChannels
(
Optional
.
ofNullable
(
event
.
getSubChannels
()).
orElse
(
new
ArrayList
<>(
1
)));
event
.
setSubChannelAuths
(
Optional
.
ofNullable
(
event
.
getSubChannelAuths
()).
orElse
(
new
ArrayList
<>(
1
)));
MerchantTypeEnums
merchantType
=
Merchant
TypeEnums
.
getByCode
(
event
.
getBizCode
());
switch
(
merchantT
ype
)
{
case
BRAND
:
brand
MerchantService
.
callback
(
event
);
PartyTypeEnums
type
=
Party
TypeEnums
.
getByCode
(
event
.
getBizCode
());
switch
(
t
ype
)
{
case
STUDIO
:
studio
MerchantService
.
callback
(
event
);
break
;
default
:
break
;
...
...
service/src/main/java/com/jiejing/fitness/finance/service/merchant/BrandMerchantService.java
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
service
.
merchant
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelEnums
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
java.util.List
;
/**
* 品牌商户服务
*
...
...
@@ -21,69 +9,19 @@ import java.util.List;
public
interface
BrandMerchantService
{
/**
* 进件申请
*
* @param params 请求参数
*/
void
apply
(
ApplyBrandMerchantParams
params
);
/**
* 进件申请回调
*
* @param event 事件
*/
void
callback
(
MerchantEvent
event
);
/**
* 获取品牌当前绑定的商户信息
*
* @param brandId 品牌ID
* @return 商户
*/
BrandMerchantVO
getMerchant
(
Long
brandId
);
/**
* 获取申请记录详情
*
* @param id ID
* @return 结果
*/
BrandMerchantApplyVO
getApply
(
Long
id
);
/**
* 分页查询品牌商户申请记录
*
* @param params 请求
* @return 响应
*/
PageVO
<
BrandMerchantApplyVO
>
pageApply
(
PageBrandMerchantApplyParams
params
);
/**
* 绑定小程序AppId
*
* @param brandId 品牌Id
* @param appId appId
* @return 结果
*/
BrandMerchantBindXcxAppIdVO
bindXcxAppId
(
Long
brandId
,
String
appId
);
/**
* 授权子渠道
* 绑定
*
* @param brandId 品牌ID
* @param subChannel 子渠道
* @param authType 授权类型
* @return 结果
* @param merchantId 商户ID
*/
BrandMerchantAuthSubChannelVO
authSubChannel
(
Long
brandId
,
SubChannelEnums
subChannel
,
SubChannelAuthTypeEnums
authType
);
void
bind
(
Long
brandId
,
Long
merchantId
);
/**
*
查询授权子渠道结果
*
解绑
*
* @param brandId 品牌ID
* @
return 结果
* @param brandId
品牌ID
* @
param merchantId 商户ID
*/
List
<
BrandMerchantAuthSubChannelVO
>
listAuthSubChannel
(
Long
brand
Id
);
void
unbind
(
Long
brandId
,
Long
merchant
Id
);
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/StudioMerchantService.java
0 → 100644
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
service
.
merchant
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageStudioMerchantApplyParams
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelEnums
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
java.util.List
;
/**
* @author chengyubing
* @since 2024/3/5 09:58
*/
public
interface
StudioMerchantService
{
/**
* 进件申请
*
* @param params 请求参数
*/
void
apply
(
ApplyStudioMerchantParams
params
);
/**
* 绑定
*
* @param studioId 场馆ID
* @param merchantId 商户ID
*/
void
bind
(
Long
studioId
,
Long
merchantId
);
/**
* 解绑
*
* @param studioId 场馆ID
* @param merchantId 商户ID
*/
void
unbind
(
Long
studioId
,
Long
merchantId
);
/**
* 解绑所有
*
* @param studioId 场馆ID
*/
void
unbindAll
(
Long
studioId
);
/**
* 进件申请回调
*
* @param event 事件
*/
void
callback
(
MerchantEvent
event
);
/**
* 获取场馆当前绑定的商户信息
*
* @param studioId 场馆ID
* @return 商户
*/
StudioMerchantVO
getMerchant
(
Long
studioId
);
/**
* 获取申请记录详情
*
* @param id ID
* @return 结果
*/
StudioMerchantApplyVO
getApply
(
Long
id
);
/**
* 分页查询场馆商户申请记录
*
* @param params 请求
* @return 响应
*/
PageVO
<
StudioMerchantApplyVO
>
pageApply
(
PageStudioMerchantApplyParams
params
);
/**
* 绑定小程序AppId
*
* @param studioId 场馆ID
* @param appId appId
* @return 结果
*/
StudioMerchantBindXcxAppIdVO
bindXcxAppId
(
Long
studioId
,
String
appId
);
/**
* 授权子渠道
*
* @param studioId 场馆ID
* @param subChannel 子渠道
* @param authType 授权类型
* @return 结果
*/
StudioMerchantAuthSubChannelVO
authSubChannel
(
Long
studioId
,
SubChannelEnums
subChannel
,
SubChannelAuthTypeEnums
authType
);
/**
* 查询授权子渠道结果
*
* @param studioId 场馆ID
* @return 结果
*/
List
<
StudioMerchantAuthSubChannelVO
>
listAuthSubChannel
(
Long
studioId
);
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/convert/MerchantConvert.java
View file @
b0f5dc59
...
...
@@ -3,22 +3,23 @@ package com.jiejing.fitness.finance.service.merchant.convert;
import
static
com
.
jiejing
.
paycenter
.
common
.
enums
.
merchant
.
ResourceTypeEnums
.*;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.jiejing.common.utils.convert.BeanUtil
;
import
com.jiejing.common.utils.crypt.AesUtil
;
import
com.jiejing.filecenter.api.resource.vo.ResourceInfoVO
;
import
com.jiejing.fitness.finance.api.enums.ApplyTypeEnums
;
import
com.jiejing.fitness.finance.api.enums.
Merchant
TypeEnums
;
import
com.jiejing.fitness.finance.api.enums.
Party
TypeEnums
;
import
com.jiejing.fitness.finance.api.merchant.request.model.AddressInfo
;
import
com.jiejing.fitness.finance.api.merchant.request.model.BrandResourceInfo
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandBankCardVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandLegalVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandLicenseVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandResourceVO
;
import
com.jiejing.fitness.finance.repository.entity.BrandMerchantApply
;
import
com.jiejing.fitness.finance.repository.entity.BrandToMerchant
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.fitness.finance.repository.entity.PartyToMerchant
;
import
com.jiejing.fitness.finance.repository.entity.StudioMerchantApply
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams
;
import
com.jiejing.fitness.finance.service.utils.JsonUtil
;
import
com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest
;
import
com.jiejing.paycenter.api.merchant.request.UploadRequest
;
...
...
@@ -59,10 +60,10 @@ import java.util.stream.Collectors;
public
class
MerchantConvert
{
public
static
ApplyMerchantRequest
convertRequest
(
String
channelNo
,
String
applyNo
,
Apply
Brand
MerchantParams
params
,
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
,
Apply
Studio
MerchantParams
params
,
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
,
ApplyMerchantRequest
subChannelInfo
)
{
return
ApplyMerchantRequest
.
builder
()
.
bizCode
(
MerchantTypeEnums
.
BRAND
.
getCode
())
.
bizCode
(
PartyTypeEnums
.
STUDIO
.
getCode
())
.
applyNo
(
applyNo
)
.
channelNo
(
channelNo
)
.
companyType
(
params
.
getCompanyType
())
...
...
@@ -80,7 +81,7 @@ public class MerchantConvert {
}
private
static
Contact
convertContact
(
Apply
Brand
MerchantParams
params
)
{
private
static
Contact
convertContact
(
Apply
Studio
MerchantParams
params
)
{
return
Contact
.
builder
()
.
contactName
(
params
.
getLegal
().
getLegalName
())
.
contactPhone
(
params
.
getLegal
().
getLegalPhone
())
...
...
@@ -89,7 +90,7 @@ public class MerchantConvert {
.
build
();
}
private
static
BusinessInfo
convertBusiness
(
Apply
Brand
MerchantParams
params
)
{
private
static
BusinessInfo
convertBusiness
(
Apply
Studio
MerchantParams
params
)
{
AddressInfo
address
=
params
.
getLicense
().
getLicenseAddress
();
return
BusinessInfo
.
builder
()
.
mcc
(
MccEnums
.
MCC_7941
)
...
...
@@ -104,7 +105,7 @@ public class MerchantConvert {
.
build
();
}
private
static
License
convertLicense
(
Apply
Brand
MerchantParams
params
)
{
private
static
License
convertLicense
(
Apply
Studio
MerchantParams
params
)
{
AddressInfo
address
=
params
.
getLicense
().
getLicenseAddress
();
return
License
.
builder
()
.
licenseType
(
LicenseTypeEnums
.
NATIONAL_LEGAL_MERGE
)
...
...
@@ -124,7 +125,7 @@ public class MerchantConvert {
.
build
();
}
private
static
BankCard
convertBankCard
(
Apply
Brand
MerchantParams
params
)
{
private
static
BankCard
convertBankCard
(
Apply
Studio
MerchantParams
params
)
{
AddressInfo
address
=
params
.
getBankCard
().
getCardAddress
();
return
BankCard
.
builder
()
.
cardType
(
params
.
getBankCard
().
getCardType
())
...
...
@@ -150,7 +151,7 @@ public class MerchantConvert {
.
build
();
}
private
static
Legal
convertLegal
(
Apply
Brand
MerchantParams
params
)
{
private
static
Legal
convertLegal
(
Apply
Studio
MerchantParams
params
)
{
AddressInfo
address
=
params
.
getLegal
().
getLegalAddress
();
return
Legal
.
builder
()
.
legalName
(
params
.
getLegal
().
getLegalName
())
...
...
@@ -169,11 +170,11 @@ public class MerchantConvert {
.
build
();
}
public
static
BrandMerchantApply
convertApply
(
Long
id
,
ApplyBrand
MerchantParams
params
,
StudioVO
studio
,
Brand
MerchantApply
exist
,
String
channel
)
{
public
static
StudioMerchantApply
convertApply
(
Long
id
,
ApplyStudio
MerchantParams
params
,
StudioVO
studio
,
Studio
MerchantApply
exist
,
String
channel
)
{
String
salt
=
AesUtil
.
getSalt
(
8
);
Apply
Brand
MerchantParams
encrypt
=
params
.
encrypt
(
salt
);
return
Brand
MerchantApply
.
builder
()
Apply
Studio
MerchantParams
encrypt
=
params
.
encrypt
(
salt
);
return
Studio
MerchantApply
.
builder
()
.
id
(
id
)
.
applyNo
(
Long
.
toString
(
id
))
.
brandId
(
studio
.
getBrandId
())
...
...
@@ -191,8 +192,8 @@ public class MerchantConvert {
.
build
();
}
private
static
String
convertMerchantInfo
(
Apply
Brand
MerchantParams
encrypt
)
{
return
JSON
.
toJSONString
(
Apply
Brand
MerchantParams
.
builder
()
private
static
String
convertMerchantInfo
(
Apply
Studio
MerchantParams
encrypt
)
{
return
JSON
.
toJSONString
(
Apply
Studio
MerchantParams
.
builder
()
.
legal
(
encrypt
.
getLegal
())
.
license
(
encrypt
.
getLicense
())
.
bankCard
(
encrypt
.
getBankCard
())
...
...
@@ -211,7 +212,7 @@ public class MerchantConvert {
.
build
();
}
public
static
BrandMerchantApply
convertApply
(
Brand
MerchantApply
apply
,
MerchantEvent
event
,
public
static
StudioMerchantApply
convertApply
(
Studio
MerchantApply
apply
,
MerchantEvent
event
,
List
<
SubChannelInfo
>
defaultSubChannels
)
{
// 品牌商户规则:微信线下公众号、微信线下小程序、支付宝线下通道全部开通成功才算成功
Map
<
SubChannelOpenTypeEnums
,
SubChannelInfo
>
channelMap
=
convertSubChannelMap
(
event
.
getSubChannels
(),
...
...
@@ -222,7 +223,7 @@ public class MerchantConvert {
SubChannelInfo
wxGzhOffline
=
channelMap
.
get
(
SubChannelOpenTypeEnums
.
WX_GZH_OFFLINE
);
OpenStateEnums
wxOfflineState
=
convertWxOfflineState
(
channelMap
);
String
wxOfflineFailMessage
=
convertWxOfflineFailMessage
(
channelMap
);
return
Brand
MerchantApply
.
builder
()
return
Studio
MerchantApply
.
builder
()
.
id
(
apply
.
getId
())
.
brandId
(
apply
.
getBrandId
())
.
studioId
(
apply
.
getStudioId
())
...
...
@@ -379,14 +380,6 @@ public class MerchantConvert {
.
collect
(
Collectors
.
toList
());
}
public
static
BrandToMerchant
convertMerchant
(
BrandMerchantApply
apply
)
{
BrandToMerchant
merchant
=
BeanUtil
.
map
(
apply
,
BrandToMerchant
.
class
);
merchant
.
setId
(
apply
.
getBrandId
());
merchant
.
setCreateTime
(
new
Date
());
merchant
.
setUpdateTime
(
new
Date
());
return
merchant
;
}
public
static
Map
<
ResourceTypeEnums
,
ResourceInfo
>
convertResourceMap
(
BrandResourceInfo
resource
)
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
map
=
new
HashMap
<>(
1
);
if
(
null
!=
resource
.
getLicensePicId
())
{
...
...
@@ -426,7 +419,7 @@ public class MerchantConvert {
return
ResourceInfo
.
builder
().
resourceId
(
id
).
type
(
type
).
build
();
}
public
static
BrandMerchantVO
convertBrandMerchant
(
Brand
ToMerchant
relation
,
MerchantVO
merchant
,
public
static
StudioMerchantVO
convertStuidoMerchant
(
Party
ToMerchant
relation
,
MerchantVO
merchant
,
List
<
SubChannelInfo
>
defaultSubChannels
)
{
Map
<
SubChannelOpenTypeEnums
,
SubChannelInfo
>
channelMap
=
convertSubChannelMap
(
JsonUtil
.
convertList
(
merchant
.
getSubChannels
(),
SubChannelInfo
.
class
),
defaultSubChannels
);
...
...
@@ -438,8 +431,8 @@ public class MerchantConvert {
JsonUtil
.
convertList
(
merchant
.
getSubChannelAuths
(),
SubChannelAuthInfo
.
class
));
OpenStateEnums
wxOfflineAuthState
=
convertWxOfflineAuthState
(
JsonUtil
.
convertList
(
merchant
.
getSubChannelAuths
(),
SubChannelAuthInfo
.
class
));
return
Brand
MerchantVO
.
builder
()
.
brandId
(
relation
.
getBrand
Id
())
return
Studio
MerchantVO
.
builder
()
.
studioId
(
relation
.
getParty
Id
())
.
channelNo
(
merchant
.
getChannelNo
())
.
merchantId
(
merchant
.
getId
())
.
merchantNo
(
merchant
.
getMerchantNo
())
...
...
@@ -462,10 +455,10 @@ public class MerchantConvert {
.
build
();
}
public
static
BrandMerchantApplyVO
convertApply
(
Brand
MerchantApply
apply
)
{
Apply
Brand
MerchantParams
info
=
JSON
.
parseObject
(
apply
.
getMerchantInfo
(),
Apply
Brand
MerchantParams
.
class
).
decrypt
(
apply
.
getSalt
());
BrandMerchantApplyVO
vo
=
BeanUtil
.
map
(
apply
,
Brand
MerchantApplyVO
.
class
);
public
static
StudioMerchantApplyVO
convertApply
(
Studio
MerchantApply
apply
)
{
Apply
Studio
MerchantParams
info
=
JSON
.
parseObject
(
apply
.
getMerchantInfo
(),
Apply
Studio
MerchantParams
.
class
).
decrypt
(
apply
.
getSalt
());
StudioMerchantApplyVO
vo
=
BeanUtil
.
map
(
apply
,
Studio
MerchantApplyVO
.
class
);
vo
.
setLegal
(
info
.
getLegal
());
vo
.
setResource
(
info
.
getResource
());
vo
.
setLicense
(
info
.
getLicense
());
...
...
@@ -473,7 +466,7 @@ public class MerchantConvert {
return
vo
;
}
public
static
List
<
BrandMerchantApplyVO
>
convertApplyList
(
List
<
Brand
MerchantApply
>
applies
)
{
public
static
List
<
StudioMerchantApplyVO
>
convertApplyList
(
List
<
Studio
MerchantApply
>
applies
)
{
return
Optional
.
ofNullable
(
applies
)
.
orElse
(
new
ArrayList
<>())
.
stream
()
...
...
@@ -481,4 +474,27 @@ public class MerchantConvert {
.
collect
(
Collectors
.
toList
());
}
public
static
PartyToMerchant
convertPartyToMerchant
(
String
channelNo
,
Long
partyId
,
PartyTypeEnums
type
,
Long
merchantId
,
String
merchantNo
)
{
PartyToMerchant
merchant
=
new
PartyToMerchant
();
merchant
.
setId
(
IdWorker
.
getId
());
merchant
.
setChannelNo
(
channelNo
);
merchant
.
setMerchantId
(
merchantId
);
merchant
.
setMerchantNo
(
merchantNo
);
merchant
.
setPartyId
(
partyId
);
merchant
.
setPartyType
(
type
);
merchant
.
setCreateTime
(
new
Date
());
merchant
.
setUpdateTime
(
new
Date
());
return
merchant
;
}
public
static
PartyToMerchant
convertPartyToMerchant
(
Long
id
,
Long
merchantId
,
String
merchantNo
)
{
PartyToMerchant
merchant
=
new
PartyToMerchant
();
merchant
.
setId
(
id
);
merchant
.
setMerchantId
(
merchantId
);
merchant
.
setMerchantNo
(
merchantNo
);
merchant
.
setUpdateTime
(
new
Date
());
return
merchant
;
}
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
service
.
merchant
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.jiejing.common.exception.BizException
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.common.utils.convert.BeanUtil
;
import
com.jiejing.filecenter.api.resource.vo.ResourceInfoVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO
;
import
com.jiejing.fitness.finance.repository.entity.BrandMerchantApply
;
import
com.jiejing.fitness.finance.repository.entity.BrandToMerchant
;
import
com.jiejing.fitness.finance.repository.entity.GlobalConfig
;
import
com.jiejing.fitness.finance.repository.query.PageBrandMerchantApplyQuery
;
import
com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService
;
import
com.jiejing.fitness.finance.repository.service.BrandToMerchantRpService
;
import
com.jiejing.fitness.finance.repository.service.GlobalConfigRpService
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.enums.GlobalConfigEnums
;
import
com.jiejing.fitness.finance.api.enums.PartyTypeEnums
;
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.merchant.BrandMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.convert.MerchantConvert
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams
;
import
com.jiejing.fitness.finance.service.rpc.MerchantRpcService
;
import
com.jiejing.fitness.finance.service.rpc.ResourceRpcService
;
import
com.jiejing.fitness.finance.service.rpc.StudioRpcService
;
import
com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest
;
import
com.jiejing.paycenter.api.merchant.vo.AuthSubChannelVO
;
import
com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO
;
import
com.jiejing.paycenter.api.merchant.vo.MerchantVO
;
import
com.jiejing.paycenter.api.merchant.vo.SubChannelAuthVO
;
import
com.jiejing.paycenter.common.enums.common.OpenStateEnums
;
import
com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelEnums
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
com.jiejing.paycenter.common.model.ResourceInfo
;
import
com.jiejing.paycenter.common.model.SubChannelAuthInfo
;
import
com.jiejing.studio.api.studio.vo.StudioVO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 品牌商户服务
...
...
@@ -68,188 +26,28 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
private
String
channel
;
@Resource
private
Studio
RpcService
studioRpc
Service
;
private
Studio
MerchantApplyRpService
studioMerchantApplyRp
Service
;
@Resource
private
MerchantRpcService
merchantRpc
Service
;
private
PartyToMerchantRpService
partyToMerchantRp
Service
;
@Resource
private
ResourceRpcService
resourceRpcService
;
@Resource
private
BrandMerchantApplyRpService
brandMerchantApplyRpService
;
@Resource
private
BrandToMerchantRpService
brandToMerchantRpService
;
@Resource
private
GlobalConfigRpService
globalConfigRpService
;
@Async
(
value
=
"financeThreadPool"
)
@Override
public
void
apply
(
ApplyBrandMerchantParams
params
)
{
Long
id
=
IdWorker
.
getId
();
StudioVO
studio
=
studioRpcService
.
getStudio
(
params
.
getStudioId
());
BrandMerchantApply
exist
=
brandMerchantApplyRpService
.
getLatestOneSuccessByBrandId
(
studio
.
getBrandId
());
BrandMerchantApply
apply
=
MerchantConvert
.
convertApply
(
id
,
params
,
studio
,
exist
,
channel
);
brandMerchantApplyRpService
.
insert
(
apply
);
try
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
=
this
.
upload
(
params
);
ApplyMerchantRequest
request
=
MerchantConvert
.
convertRequest
(
channel
,
apply
.
getApplyNo
(),
params
,
resourceMap
,
getDefaultBrandSubChannelInfo
());
merchantRpcService
.
apply
(
request
);
}
catch
(
Exception
e
)
{
log
.
error
(
"apply brand merchant fail {}, brand id = {}, studio id = {}"
,
id
,
studio
.
getBrandId
(),
params
.
getStudioId
(),
e
);
this
.
doOpenMerchantFail
(
id
,
e
.
getMessage
());
public
void
bind
(
Long
brandId
,
Long
merchantId
)
{
PartyToMerchant
exist
=
partyToMerchantRpService
.
getOneByPartyAndMerchantId
(
channel
,
brandId
,
PartyTypeEnums
.
BRAND
,
merchantId
);
if
(
null
!=
exist
)
{
return
;
}
this
.
doOpenMerchantProcess
(
id
);
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
@Override
public
void
callback
(
MerchantEvent
event
)
{
switch
(
event
.
getState
())
{
case
PROCESS:
this
.
doOpenMerchantProcess
(
Long
.
parseLong
(
event
.
getApplyNo
()));
break
;
case
FAIL:
this
.
doOpenMerchantFail
(
Long
.
parseLong
(
event
.
getApplyNo
()),
event
.
getFailMessage
());
break
;
case
SUCCESS:
this
.
doOpenMerchantSuccess
(
event
);
break
;
default
:
break
;
}
}
@Override
public
BrandMerchantVO
getMerchant
(
Long
brandId
)
{
BrandToMerchant
relation
=
brandToMerchantRpService
.
getByBrandId
(
brandId
,
channel
);
if
(
null
==
relation
)
{
return
null
;
}
MerchantVO
merchant
=
merchantRpcService
.
getByMerchantId
(
relation
.
getMerchantId
());
return
MerchantConvert
.
convertBrandMerchant
(
relation
,
merchant
,
getDefaultBrandSubChannelInfo
().
getSubChannels
());
}
@Override
public
BrandMerchantApplyVO
getApply
(
Long
id
)
{
BrandMerchantApply
apply
=
brandMerchantApplyRpService
.
getById
(
id
)
.
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
return
MerchantConvert
.
convertApply
(
apply
);
}
@Override
public
PageVO
<
BrandMerchantApplyVO
>
pageApply
(
PageBrandMerchantApplyParams
params
)
{
Page
<
BrandMerchantApply
>
page
=
brandMerchantApplyRpService
.
page
(
BeanUtil
.
map
(
params
,
PageBrandMerchantApplyQuery
.
class
));
return
PageVO
.
convert
(
page
,
MerchantConvert
.
convertApplyList
(
page
.
getContent
()));
}
@Override
public
BrandMerchantBindXcxAppIdVO
bindXcxAppId
(
Long
brandId
,
String
appId
)
{
BrandToMerchant
relation
=
brandToMerchantRpService
.
getByBrandId
(
brandId
,
channel
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
ConfigSubChannelVO
vo
=
merchantRpcService
.
bindAppIdWxXcxOffline
(
channel
,
IdWorker
.
getIdStr
(),
relation
.
getMerchantId
(),
appId
);
return
BrandMerchantBindXcxAppIdVO
.
builder
().
state
(
vo
.
getState
()).
failMessage
(
vo
.
getFailMessage
())
.
build
();
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
merchantId
);
partyToMerchantRpService
.
insert
(
MerchantConvert
.
convertPartyToMerchant
(
apply
.
getChannelNo
(),
brandId
,
PartyTypeEnums
.
BRAND
,
apply
.
getMerchantId
(),
apply
.
getMerchantNo
()));
}
@Override
public
BrandMerchantAuthSubChannelVO
authSubChannel
(
Long
brandId
,
SubChannelEnums
subChannel
,
SubChannelAuthTypeEnums
authType
)
{
BrandToMerchant
relation
=
brandToMerchantRpService
.
getByBrandId
(
brandId
,
channel
);
AuthSubChannelVO
vo
=
merchantRpcService
.
authSubChannel
(
channel
,
relation
.
getMerchantId
(),
subChannel
,
authType
);
return
BeanUtil
.
map
(
vo
,
BrandMerchantAuthSubChannelVO
.
class
);
}
@Override
public
List
<
BrandMerchantAuthSubChannelVO
>
listAuthSubChannel
(
Long
brandId
)
{
BrandToMerchant
relation
=
brandToMerchantRpService
.
getByBrandId
(
brandId
,
channel
);
MerchantVO
merchant
=
merchantRpcService
.
getByMerchantId
(
relation
.
getMerchantId
());
List
<
SubChannelAuthVO
>
auths
=
merchant
.
getSubChannelAuths
();
return
Optional
.
ofNullable
(
auths
).
orElse
(
new
ArrayList
<>(
1
)).
stream
()
.
map
(
e
->
BeanUtil
.
map
(
e
,
BrandMerchantAuthSubChannelVO
.
class
)).
collect
(
Collectors
.
toList
());
}
private
void
doOpenMerchantSuccess
(
MerchantEvent
event
)
{
BrandMerchantApply
apply
=
brandMerchantApplyRpService
.
getByIdForUpdate
(
Long
.
parseLong
(
event
.
getApplyNo
())).
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
BrandMerchantApply
applyToModify
=
MerchantConvert
.
convertApply
(
apply
,
event
,
getDefaultBrandSubChannelInfo
().
getSubChannels
());
if
(
OpenStateEnums
.
SUCCESS
==
applyToModify
.
getOpenState
())
{
// 所有子通道全部开通成功
BrandToMerchant
exist
=
brandToMerchantRpService
.
getByBrandId
(
apply
.
getBrandId
(),
channel
);
if
(
null
==
exist
)
{
brandToMerchantRpService
.
insert
(
MerchantConvert
.
convertMerchant
(
apply
));
}
else
{
brandToMerchantRpService
.
updateById
(
MerchantConvert
.
convertMerchant
(
apply
));
}
}
brandMerchantApplyRpService
.
updateById
(
applyToModify
);
}
private
Map
<
ResourceTypeEnums
,
ResourceInfo
>
upload
(
ApplyBrandMerchantParams
params
)
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
=
MerchantConvert
.
convertResourceMap
(
params
.
getResource
());
Map
<
Long
,
ResourceInfoVO
>
resourceIdUrlMap
=
resourceRpcService
.
getResourceMap
(
params
.
getStudioId
(),
getResourceIds
(
resourceMap
));
resourceMap
.
keySet
().
forEach
(
type
->
{
ResourceInfo
info
=
resourceMap
.
get
(
type
);
ResourceInfoVO
vo
=
resourceIdUrlMap
.
get
(
info
.
getResourceId
());
String
thirdId
=
merchantRpcService
.
upload
(
MerchantConvert
.
convertUploadRequest
(
channel
,
type
,
vo
));
info
.
setThirdId
(
thirdId
);
});
return
resourceMap
;
}
private
List
<
Long
>
getResourceIds
(
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
)
{
return
resourceMap
.
values
().
stream
()
.
map
(
ResourceInfo:
:
getResourceId
)
.
filter
(
Objects:
:
nonNull
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
private
void
doOpenMerchantFail
(
Long
id
,
String
failMessage
)
{
brandMerchantApplyRpService
.
updateById
(
BrandMerchantApply
.
builder
().
id
(
id
).
openState
(
OpenStateEnums
.
FAIL
)
.
openFailMessage
(
failMessage
).
build
());
}
private
void
doOpenMerchantProcess
(
Long
id
)
{
brandMerchantApplyRpService
.
updateById
(
BrandMerchantApply
.
builder
().
id
(
id
).
openState
(
OpenStateEnums
.
PROCESS
).
build
());
}
private
ApplyMerchantRequest
getDefaultBrandSubChannelInfo
()
{
GlobalConfig
config
=
globalConfigRpService
.
getById
(
GlobalConfigEnums
.
BRAND_MERCHANT_SUB_CHANNELS
.
getCode
())
.
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
return
JSON
.
parseObject
(
config
.
getConfigValue
(),
ApplyMerchantRequest
.
class
);
public
void
unbind
(
Long
brandId
,
Long
merchantId
)
{
partyToMerchantRpService
.
deleteByPartyAndMerchantId
(
brandId
,
PartyTypeEnums
.
BRAND
,
merchantId
);
}
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
0 → 100644
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
service
.
merchant
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.jiejing.common.exception.BizException
;
import
com.jiejing.common.model.PageVO
;
import
com.jiejing.common.utils.collection.CollectionUtil
;
import
com.jiejing.common.utils.convert.BeanUtil
;
import
com.jiejing.filecenter.api.resource.vo.ResourceInfoVO
;
import
com.jiejing.fitness.finance.api.enums.PartyTypeEnums
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO
;
import
com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO
;
import
com.jiejing.fitness.finance.repository.entity.GlobalConfig
;
import
com.jiejing.fitness.finance.repository.entity.PartyToMerchant
;
import
com.jiejing.fitness.finance.repository.entity.StudioMerchantApply
;
import
com.jiejing.fitness.finance.repository.query.PageStudioMerchantApplyQuery
;
import
com.jiejing.fitness.finance.repository.service.GlobalConfigRpService
;
import
com.jiejing.fitness.finance.repository.service.PartyToMerchantRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioMerchantApplyRpService
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.enums.GlobalConfigEnums
;
import
com.jiejing.fitness.finance.service.merchant.BrandMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.StudioMerchantService
;
import
com.jiejing.fitness.finance.service.merchant.convert.MerchantConvert
;
import
com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams
;
import
com.jiejing.fitness.finance.service.merchant.params.PageStudioMerchantApplyParams
;
import
com.jiejing.fitness.finance.service.rpc.MerchantRpcService
;
import
com.jiejing.fitness.finance.service.rpc.ResourceRpcService
;
import
com.jiejing.fitness.finance.service.rpc.StudioRpcService
;
import
com.jiejing.paycenter.api.merchant.request.ApplyMerchantRequest
;
import
com.jiejing.paycenter.api.merchant.vo.AuthSubChannelVO
;
import
com.jiejing.paycenter.api.merchant.vo.ConfigSubChannelVO
;
import
com.jiejing.paycenter.api.merchant.vo.MerchantVO
;
import
com.jiejing.paycenter.api.merchant.vo.SubChannelAuthVO
;
import
com.jiejing.paycenter.common.enums.common.OpenStateEnums
;
import
com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums
;
import
com.jiejing.paycenter.common.enums.merchant.SubChannelEnums
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
com.jiejing.paycenter.common.model.ResourceInfo
;
import
com.jiejing.studio.api.studio.vo.StudioVO
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author chengyubing
* @since 2024/3/5 09:58
*/
@Slf4j
@Service
public
class
StudioMerchantServiceImpl
implements
StudioMerchantService
{
@Value
(
"${finance.brand.merchant.channel}"
)
private
String
channel
;
@Resource
private
StudioRpcService
studioRpcService
;
@Resource
private
MerchantRpcService
merchantRpcService
;
@Resource
private
ResourceRpcService
resourceRpcService
;
@Resource
private
StudioMerchantApplyRpService
studioMerchantApplyRpService
;
@Resource
private
PartyToMerchantRpService
partyToMerchantRpService
;
@Resource
private
GlobalConfigRpService
globalConfigRpService
;
@Resource
private
BrandMerchantService
brandMerchantService
;
@Async
(
value
=
"financeThreadPool"
)
@Override
public
void
apply
(
ApplyStudioMerchantParams
params
)
{
Long
id
=
IdWorker
.
getId
();
StudioVO
studio
=
studioRpcService
.
getStudio
(
params
.
getStudioId
());
StudioMerchantApply
exist
=
studioMerchantApplyRpService
.
getLatestOneSuccessByStudioId
(
studio
.
getId
());
StudioMerchantApply
apply
=
MerchantConvert
.
convertApply
(
id
,
params
,
studio
,
exist
,
channel
);
studioMerchantApplyRpService
.
insert
(
apply
);
try
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
=
this
.
upload
(
params
);
ApplyMerchantRequest
request
=
MerchantConvert
.
convertRequest
(
channel
,
apply
.
getApplyNo
(),
params
,
resourceMap
,
getDefaultBrandSubChannelInfo
());
merchantRpcService
.
apply
(
request
);
}
catch
(
Exception
e
)
{
log
.
error
(
"apply brand merchant fail {}, brand id = {}, studio id = {}"
,
id
,
studio
.
getBrandId
(),
params
.
getStudioId
(),
e
);
this
.
doOpenMerchantFail
(
id
,
e
.
getMessage
());
return
;
}
this
.
doOpenMerchantProcess
(
id
);
}
@Override
public
void
bind
(
Long
studioId
,
Long
merchantId
)
{
PartyToMerchant
relation
=
getRelation
(
studioId
);
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
merchantId
);
if
(
null
==
relation
)
{
partyToMerchantRpService
.
insert
(
MerchantConvert
.
convertPartyToMerchant
(
apply
.
getChannelNo
(),
studioId
,
PartyTypeEnums
.
STUDIO
,
apply
.
getMerchantId
(),
apply
.
getMerchantNo
()));
}
else
{
partyToMerchantRpService
.
updateById
(
MerchantConvert
.
convertPartyToMerchant
(
relation
.
getId
(),
merchantId
,
apply
.
getMerchantNo
()));
}
}
@Override
public
void
unbind
(
Long
studioId
,
Long
merchantId
)
{
partyToMerchantRpService
.
deleteByPartyAndMerchantId
(
studioId
,
PartyTypeEnums
.
STUDIO
,
merchantId
);
}
@Override
public
void
unbindAll
(
Long
studioId
)
{
partyToMerchantRpService
.
deleteByParty
(
studioId
,
PartyTypeEnums
.
STUDIO
);
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
Exception
.
class
)
@Override
public
void
callback
(
MerchantEvent
event
)
{
switch
(
event
.
getState
())
{
case
PROCESS:
this
.
doOpenMerchantProcess
(
Long
.
parseLong
(
event
.
getApplyNo
()));
break
;
case
FAIL:
this
.
doOpenMerchantFail
(
Long
.
parseLong
(
event
.
getApplyNo
()),
event
.
getFailMessage
());
break
;
case
SUCCESS:
this
.
doOpenMerchantSuccess
(
event
);
break
;
default
:
break
;
}
}
@Override
public
StudioMerchantVO
getMerchant
(
Long
studioId
)
{
PartyToMerchant
relation
=
getRelation
(
studioId
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
MerchantVO
merchant
=
merchantRpcService
.
getByMerchantId
(
relation
.
getMerchantId
());
return
MerchantConvert
.
convertStuidoMerchant
(
relation
,
merchant
,
getDefaultBrandSubChannelInfo
().
getSubChannels
());
}
@Override
public
StudioMerchantApplyVO
getApply
(
Long
id
)
{
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getById
(
id
)
.
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
return
MerchantConvert
.
convertApply
(
apply
);
}
@Override
public
PageVO
<
StudioMerchantApplyVO
>
pageApply
(
PageStudioMerchantApplyParams
params
)
{
Page
<
StudioMerchantApply
>
page
=
studioMerchantApplyRpService
.
page
(
BeanUtil
.
map
(
params
,
PageStudioMerchantApplyQuery
.
class
));
return
PageVO
.
convert
(
page
,
MerchantConvert
.
convertApplyList
(
page
.
getContent
()));
}
@Override
public
StudioMerchantBindXcxAppIdVO
bindXcxAppId
(
Long
studioId
,
String
appId
)
{
PartyToMerchant
relation
=
getRelation
(
studioId
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
ConfigSubChannelVO
vo
=
merchantRpcService
.
bindAppIdWxXcxOffline
(
channel
,
IdWorker
.
getIdStr
(),
relation
.
getMerchantId
(),
appId
);
return
StudioMerchantBindXcxAppIdVO
.
builder
().
state
(
vo
.
getState
()).
failMessage
(
vo
.
getFailMessage
())
.
build
();
}
private
PartyToMerchant
getRelation
(
Long
studioId
)
{
List
<
PartyToMerchant
>
relations
=
partyToMerchantRpService
.
listByParty
(
studioId
,
PartyTypeEnums
.
STUDIO
,
channel
);
if
(
CollectionUtil
.
isEmpty
(
relations
))
{
return
null
;
}
return
relations
.
get
(
0
);
}
@Override
public
StudioMerchantAuthSubChannelVO
authSubChannel
(
Long
studioId
,
SubChannelEnums
subChannel
,
SubChannelAuthTypeEnums
authType
)
{
PartyToMerchant
relation
=
getRelation
(
studioId
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
AuthSubChannelVO
vo
=
merchantRpcService
.
authSubChannel
(
channel
,
relation
.
getMerchantId
(),
subChannel
,
authType
);
return
BeanUtil
.
map
(
vo
,
StudioMerchantAuthSubChannelVO
.
class
);
}
@Override
public
List
<
StudioMerchantAuthSubChannelVO
>
listAuthSubChannel
(
Long
studioId
)
{
PartyToMerchant
relation
=
getRelation
(
studioId
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
MerchantVO
merchant
=
merchantRpcService
.
getByMerchantId
(
relation
.
getMerchantId
());
List
<
SubChannelAuthVO
>
auths
=
merchant
.
getSubChannelAuths
();
return
Optional
.
ofNullable
(
auths
).
orElse
(
new
ArrayList
<>(
1
)).
stream
()
.
map
(
e
->
BeanUtil
.
map
(
e
,
StudioMerchantAuthSubChannelVO
.
class
)).
collect
(
Collectors
.
toList
());
}
private
void
doOpenMerchantSuccess
(
MerchantEvent
event
)
{
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getByIdForUpdate
(
Long
.
parseLong
(
event
.
getApplyNo
())).
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
StudioMerchantApply
applyToModify
=
MerchantConvert
.
convertApply
(
apply
,
event
,
getDefaultBrandSubChannelInfo
().
getSubChannels
());
studioMerchantApplyRpService
.
updateById
(
applyToModify
);
if
(
OpenStateEnums
.
SUCCESS
==
applyToModify
.
getOpenState
())
{
// 所有子通道全部开通成功
// 1. 绑定场馆
this
.
bind
(
apply
.
getStudioId
(),
event
.
getMerchantId
());
// 2. 绑定品牌
brandMerchantService
.
bind
(
apply
.
getBrandId
(),
event
.
getMerchantId
());
}
}
private
Map
<
ResourceTypeEnums
,
ResourceInfo
>
upload
(
ApplyStudioMerchantParams
params
)
{
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
=
MerchantConvert
.
convertResourceMap
(
params
.
getResource
());
Map
<
Long
,
ResourceInfoVO
>
resourceIdUrlMap
=
resourceRpcService
.
getResourceMap
(
params
.
getStudioId
(),
getResourceIds
(
resourceMap
));
resourceMap
.
keySet
().
forEach
(
type
->
{
ResourceInfo
info
=
resourceMap
.
get
(
type
);
ResourceInfoVO
vo
=
resourceIdUrlMap
.
get
(
info
.
getResourceId
());
String
thirdId
=
merchantRpcService
.
upload
(
MerchantConvert
.
convertUploadRequest
(
channel
,
type
,
vo
));
info
.
setThirdId
(
thirdId
);
});
return
resourceMap
;
}
private
List
<
Long
>
getResourceIds
(
Map
<
ResourceTypeEnums
,
ResourceInfo
>
resourceMap
)
{
return
resourceMap
.
values
().
stream
()
.
map
(
ResourceInfo:
:
getResourceId
)
.
filter
(
Objects:
:
nonNull
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
private
void
doOpenMerchantFail
(
Long
id
,
String
failMessage
)
{
studioMerchantApplyRpService
.
updateById
(
StudioMerchantApply
.
builder
().
id
(
id
).
openState
(
OpenStateEnums
.
FAIL
)
.
openFailMessage
(
failMessage
).
build
());
}
private
void
doOpenMerchantProcess
(
Long
id
)
{
studioMerchantApplyRpService
.
updateById
(
StudioMerchantApply
.
builder
().
id
(
id
).
openState
(
OpenStateEnums
.
PROCESS
).
build
());
}
private
ApplyMerchantRequest
getDefaultBrandSubChannelInfo
()
{
GlobalConfig
config
=
globalConfigRpService
.
getById
(
GlobalConfigEnums
.
BRAND_MERCHANT_SUB_CHANNELS
.
getCode
())
.
orElseThrow
(()
->
new
BizException
(
FinanceErrorEnums
.
NOT_EXIST
));
return
JSON
.
parseObject
(
config
.
getConfigValue
(),
ApplyMerchantRequest
.
class
);
}
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/Apply
Brand
MerchantParams.java
→
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/Apply
Studio
MerchantParams.java
View file @
b0f5dc59
...
...
@@ -28,8 +28,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"申请
品牌
商户请求信息"
)
public
class
Apply
Brand
MerchantParams
{
@ApiModel
(
description
=
"申请
场馆
商户请求信息"
)
public
class
Apply
Studio
MerchantParams
{
@ApiModelProperty
(
value
=
"场馆ID"
,
required
=
true
)
@NotNull
(
message
=
"场馆ID不能为空"
)
...
...
@@ -69,8 +69,8 @@ public class ApplyBrandMerchantParams {
@Valid
private
BrandResourceInfo
resource
;
public
Apply
Brand
MerchantParams
encrypt
(
String
salt
)
{
Apply
BrandMerchantParams
copy
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
),
ApplyBrand
MerchantParams
.
class
);
public
Apply
Studio
MerchantParams
encrypt
(
String
salt
)
{
Apply
StudioMerchantParams
copy
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
),
ApplyStudio
MerchantParams
.
class
);
if
(
null
!=
copy
.
getBankCard
())
{
copy
.
getBankCard
().
setCardNo
(
AesUtil
.
encrypt
(
salt
,
copy
.
getBankCard
().
getCardNo
()));
copy
.
getBankCard
().
setCertNo
(
AesUtil
.
encrypt
(
salt
,
copy
.
getBankCard
().
getCertNo
()));
...
...
@@ -85,8 +85,8 @@ public class ApplyBrandMerchantParams {
return
copy
;
}
public
Apply
Brand
MerchantParams
decrypt
(
String
salt
)
{
Apply
BrandMerchantParams
copy
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
),
ApplyBrand
MerchantParams
.
class
);
public
Apply
Studio
MerchantParams
decrypt
(
String
salt
)
{
Apply
StudioMerchantParams
copy
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
this
),
ApplyStudio
MerchantParams
.
class
);
if
(
null
!=
copy
.
getBankCard
())
{
copy
.
getBankCard
().
setCardNo
(
AesUtil
.
decrypt
(
salt
,
copy
.
getBankCard
().
getCardNo
()));
copy
.
getBankCard
().
setCertNo
(
AesUtil
.
decrypt
(
salt
,
copy
.
getBankCard
().
getCertNo
()));
...
...
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/Page
Brand
MerchantApplyParams.java
→
service/src/main/java/com/jiejing/fitness/finance/service/merchant/params/Page
Studio
MerchantApplyParams.java
View file @
b0f5dc59
...
...
@@ -5,7 +5,6 @@ import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import
com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
...
...
@@ -20,8 +19,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
description
=
"申请
品牌
商户请求信息"
)
public
class
Page
Brand
MerchantApplyParams
{
@ApiModel
(
description
=
"申请
场馆
商户请求信息"
)
public
class
Page
Studio
MerchantApplyParams
{
@ApiModelProperty
(
value
=
"商户简称"
)
private
String
shortName
;
...
...
service/src/main/java/com/jiejing/fitness/finance/service/pay/PayService.java
View file @
b0f5dc59
package
com
.
jiejing
.
fitness
.
finance
.
service
.
pay
;
import
com.jiejing.fitness.finance.service.pay.params.
Brand
MerchantPayParams
;
import
com.jiejing.fitness.finance.service.pay.params.
Studio
MerchantPayParams
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
com.jiejing.paycenter.api.pay.vo.RefundVO
;
...
...
@@ -19,7 +19,7 @@ public interface PayService {
* @param params 请求参数
* @return 结果
*/
PayVO
merchantPay
(
Brand
MerchantPayParams
params
);
PayVO
merchantPay
(
Studio
MerchantPayParams
params
);
/**
* 支付回调
...
...
service/src/main/java/com/jiejing/fitness/finance/service/pay/convert/PayConvert.java
View file @
b0f5dc59
...
...
@@ -9,10 +9,9 @@ import com.jiejing.common.utils.text.StringUtil;
import
com.jiejing.fitness.finance.api.enums.BrandCashierTransStateEnums
;
import
com.jiejing.fitness.finance.api.enums.BrandCashierTransTypeEnums
;
import
com.jiejing.fitness.finance.repository.entity.BrandCashierRecord
;
import
com.jiejing.fitness.finance.repository.entity.BrandToMerchant
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams
;
import
com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams
;
import
com.jiejing.fitness.finance.service.utils.FeeUtil
;
import
com.jiejing.fitness.finance.service.utils.MoneyUtil
;
import
com.jiejing.paycenter.api.merchant.vo.MerchantVO
;
...
...
@@ -27,7 +26,7 @@ import com.jiejing.paycenter.common.enums.pay.PayStateEnums;
import
com.jiejing.paycenter.common.enums.pay.PayTypeEnums
;
import
com.jiejing.paycenter.common.event.PayEvent
;
import
com.jiejing.paycenter.common.event.RefundEvent
;
import
com.jiejing.
paycenter.common.model.SubChannelInfo
;
import
com.jiejing.
studio.api.studio.vo.StudioVO
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Date
;
...
...
@@ -46,7 +45,7 @@ public class PayConvert {
private
static
final
List
<
String
>
WX_AUTH_CODE_PREFIX
=
Lists
.
newArrayList
(
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
);
public
static
PayRequest
convert
(
Brand
MerchantPayParams
params
,
BrandCashierRecord
record
)
{
public
static
PayRequest
convert
(
Studio
MerchantPayParams
params
,
BrandCashierRecord
record
)
{
PayRequest
request
=
BeanUtil
.
map
(
params
,
PayRequest
.
class
);
request
.
setTransNo
(
record
.
getTransNo
());
request
.
setMerchantId
(
record
.
getMerchantId
());
...
...
@@ -60,7 +59,7 @@ public class PayConvert {
return
request
;
}
public
static
BrandCashierRecord
convertPayInit
(
BrandMerchantPayParams
params
,
BrandToMerchant
relation
,
public
static
BrandCashierRecord
convertPayInit
(
StudioMerchantPayParams
params
,
StudioVO
studio
,
MerchantVO
merchant
)
{
setSubChannel
(
params
);
Long
id
=
IdWorker
.
getId
();
...
...
@@ -72,7 +71,7 @@ public class PayConvert {
.
orderNo
(
params
.
getOrderNo
())
.
orderType
(
params
.
getOrderType
())
.
transType
(
BrandCashierTransTypeEnums
.
PAY
)
.
brandId
(
relation
.
getBrandId
())
.
brandId
(
studio
.
getBrandId
())
.
studioId
(
params
.
getStudioId
())
.
merchantId
(
merchant
.
getId
())
.
merchantNo
(
merchant
.
getMerchantNo
())
...
...
@@ -94,7 +93,7 @@ public class PayConvert {
.
build
();
}
private
static
void
setSubChannel
(
Brand
MerchantPayParams
params
)
{
private
static
void
setSubChannel
(
Studio
MerchantPayParams
params
)
{
if
(
PayTypeEnums
.
BARCODE
!=
params
.
getPayType
()
||
StringUtil
.
isBlank
(
params
.
getAuthCode
()))
{
// 未设置子渠道,不是付款码支付或付款码为空,直接返回
return
;
...
...
@@ -111,7 +110,7 @@ public class PayConvert {
}
}
private
static
BigDecimal
getFeeRate
(
Brand
MerchantPayParams
params
,
MerchantVO
merchant
)
{
private
static
BigDecimal
getFeeRate
(
Studio
MerchantPayParams
params
,
MerchantVO
merchant
)
{
SubChannelOpenTypeEnums
scene
;
switch
(
params
.
getPayType
())
{
case
MINI:
...
...
service/src/main/java/com/jiejing/fitness/finance/service/pay/impl/PayServiceImpl.java
View file @
b0f5dc59
...
...
@@ -2,14 +2,14 @@ package com.jiejing.fitness.finance.service.pay.impl;
import
com.jiejing.common.exception.BizException
;
import
com.jiejing.fitness.finance.repository.entity.BrandCashierRecord
;
import
com.jiejing.fitness.finance.repository.entity.
Brand
ToMerchant
;
import
com.jiejing.fitness.finance.repository.entity.
Party
ToMerchant
;
import
com.jiejing.fitness.finance.repository.service.BrandCashierRecordRpService
;
import
com.jiejing.fitness.finance.repository.service.
Brand
ToMerchantRpService
;
import
com.jiejing.fitness.finance.repository.service.
Party
ToMerchantRpService
;
import
com.jiejing.fitness.finance.service.enums.FinanceErrorEnums
;
import
com.jiejing.fitness.finance.service.pay.PayService
;
import
com.jiejing.fitness.finance.service.pay.convert.PayConvert
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams
;
import
com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams
;
import
com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams
;
import
com.jiejing.fitness.finance.service.rpc.MerchantRpcService
;
import
com.jiejing.fitness.finance.service.rpc.PayRpcService
;
import
com.jiejing.fitness.finance.service.rpc.StudioRpcService
;
...
...
@@ -18,12 +18,10 @@ import com.jiejing.paycenter.api.pay.request.PayRequest;
import
com.jiejing.paycenter.api.pay.request.RefundPayRequest
;
import
com.jiejing.paycenter.api.pay.vo.PayVO
;
import
com.jiejing.paycenter.api.pay.vo.RefundVO
;
import
com.jiejing.paycenter.common.enums.pay.PayStateEnums
;
import
com.jiejing.paycenter.common.event.PayEvent
;
import
com.jiejing.paycenter.common.event.RefundEvent
;
import
com.jiejing.studio.api.studio.vo.StudioVO
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -41,7 +39,7 @@ public class PayServiceImpl implements PayService {
private
String
channel
;
@Resource
private
BrandToMerchantRpService
brand
ToMerchantRpService
;
private
PartyToMerchantRpService
party
ToMerchantRpService
;
@Resource
private
PayRpcService
payRpcService
;
...
...
@@ -56,13 +54,16 @@ public class PayServiceImpl implements PayService {
private
MerchantRpcService
merchantRpcService
;
@Override
public
PayVO
merchantPay
(
Brand
MerchantPayParams
params
)
{
public
PayVO
merchantPay
(
Studio
MerchantPayParams
params
)
{
StudioVO
studio
=
studioRpcService
.
getStudio
(
params
.
getStudioId
());
BrandToMerchant
relation
=
brandToMerchantRpService
.
getByBrandId
(
studio
.
getBrandId
(),
channel
);
PartyToMerchant
relation
=
partyToMerchantRpService
.
getByStudioId
(
studio
.
getId
(),
channel
);
if
(
null
==
relation
)
{
throw
new
BizException
(
FinanceErrorEnums
.
MERCHANT_NOT_OPEN
);
}
MerchantVO
merchant
=
merchantRpcService
.
getByMerchantId
(
relation
.
getMerchantId
());
BrandCashierRecord
record
=
PayConvert
.
convertPayInit
(
params
,
relation
,
merchant
);
BrandCashierRecord
record
=
PayConvert
.
convertPayInit
(
params
,
studio
,
merchant
);
brandCashierRecordRpService
.
insert
(
record
);
PayRequest
request
=
PayConvert
.
convert
(
params
,
record
);
...
...
service/src/main/java/com/jiejing/fitness/finance/service/pay/params/
Brand
MerchantPayParams.java
→
service/src/main/java/com/jiejing/fitness/finance/service/pay/params/
Studio
MerchantPayParams.java
View file @
b0f5dc59
...
...
@@ -22,8 +22,8 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
description
=
"
品牌
商户支付Params"
)
public
class
Brand
MerchantPayParams
{
@ApiModel
(
description
=
"
场馆
商户支付Params"
)
public
class
Studio
MerchantPayParams
{
@ApiModelProperty
(
value
=
"场馆ID"
,
required
=
true
)
@NotNull
(
message
=
"场馆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