Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
a0fcb7f7
Commit
a0fcb7f7
authored
Jun 16, 2021
by
terrfly
Browse files
更改获取商户应用的配置信息方式
parent
c30acaec
Changes
4
Hide whitespace changes
Inline
Side-by-side
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/ctrl/ApiController.java
View file @
a0fcb7f7
...
...
@@ -74,18 +74,21 @@ public abstract class ApiController extends AbstractCtrl {
MchAppConfigContext
mchAppConfigContext
=
configContextService
.
getMchAppConfigContext
(
mchNo
,
appId
);
MchInfo
mchInfo
=
mchAppConfigContext
==
null
?
null
:
mchAppConfigContext
.
getMchInfo
();
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
){
throw
new
BizException
(
"商户不存在或商户状态不可用"
);
if
(
mchAppConfigContext
==
null
){
throw
new
BizException
(
"商户或商户应用不存在"
);
}
MchApp
mchApp
=
mchAppConfigContext
==
null
?
null
:
mchAppConfigContext
.
getMchApp
();
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
){
throw
new
BizException
(
"商户应用不存在或商户状态不可用"
);
if
(
mchAppConfigContext
.
getMchInfo
()
==
null
||
mchAppConfigContext
.
getMchInfo
().
getState
()
!=
CS
.
YES
){
throw
new
BizException
(
"商户信息不存在或商户状态不可用"
);
}
MchApp
mchApp
=
mchAppConfigContext
.
getMchApp
();
if
(
mchApp
==
null
||
mchApp
.
getState
()
!=
CS
.
YES
){
throw
new
BizException
(
"商户应用不存在或应用状态不可用"
);
}
if
(!
mchApp
.
getMchNo
().
equals
(
mchNo
)){
throw
new
BizException
(
"
商户应用
与商户号不匹配"
);
throw
new
BizException
(
"
参数appId
与商户号不匹配"
);
}
// 验签
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/ctrl/payorder/AbstractPayOrderController.java
View file @
a0fcb7f7
...
...
@@ -240,9 +240,9 @@ public abstract class AbstractPayOrderController extends ApiController {
private
IPaymentService
checkMchWayCodeAndGetService
(
MchAppConfigContext
mchAppConfigContext
,
String
wayCode
){
// 根据支付方式, 查询出 该商户 可用的支付接口
MchPayPassage
mchPayPassage
=
mchPayPassageService
.
findMchPayPassage
(
mchAppConfigContext
.
getMchNo
(),
wayCode
);
MchPayPassage
mchPayPassage
=
mchPayPassageService
.
findMchPayPassage
(
mchAppConfigContext
.
getMchNo
(),
mchAppConfigContext
.
getAppId
(),
wayCode
);
if
(
mchPayPassage
==
null
){
throw
new
BizException
(
"该支付方式
商户未开通
"
);
throw
new
BizException
(
"
商户应用不支持
该支付方式"
);
}
// 接口代码
...
...
jeepay-payment/src/main/java/com/jeequan/jeepay/pay/service/ConfigContextService.java
View file @
a0fcb7f7
...
...
@@ -143,6 +143,8 @@ public class ConfigContextService {
mchInfoConfigContext
.
setMchType
(
mchInfo
.
getType
());
mchInfoConfigContext
.
setMchInfo
(
mchInfo
);
mchAppService
.
list
(
MchApp
.
gw
().
eq
(
MchApp:
:
getMchNo
,
mchNo
)).
stream
().
forEach
(
mchApp
->
mchInfoConfigContext
.
putMchApp
(
mchApp
));
mchInfoConfigContextMap
.
put
(
mchNo
,
mchInfoConfigContext
);
}
/** 初始化 [商户应用支付参数配置信息] **/
...
...
@@ -162,6 +164,7 @@ public class ConfigContextService {
mchApp
=
mchAppService
.
getById
(
appId
);
if
(
mchApp
==
null
){
// DB查询为空
mchAppConfigContextMap
.
remove
(
appId
);
//清除缓存信息
mchInfoConfigContext
.
getAppMap
().
remove
(
appId
);
//清除主体信息中的appId
return
;
}
...
...
@@ -174,6 +177,7 @@ public class ConfigContextService {
MchAppConfigContext
mchAppConfigContext
=
new
MchAppConfigContext
();
// 设置商户信息
mchAppConfigContext
.
setAppId
(
appId
);
mchAppConfigContext
.
setMchNo
(
mchInfo
.
getMchNo
());
mchAppConfigContext
.
setMchType
(
mchInfo
.
getType
());
mchAppConfigContext
.
setMchInfo
(
mchInfo
);
...
...
jeepay-service/src/main/java/com/jeequan/jeepay/service/impl/MchPayPassageService.java
View file @
a0fcb7f7
...
...
@@ -104,11 +104,12 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
}
/** 根据
商户号
和 支付方式, 查询出商户可用的支付接口 **/
public
MchPayPassage
findMchPayPassage
(
String
mchNo
,
String
wayCode
){
/** 根据
应用ID
和 支付方式, 查询出商户可用的支付接口 **/
public
MchPayPassage
findMchPayPassage
(
String
mchNo
,
String
appId
,
String
wayCode
){
List
<
MchPayPassage
>
list
=
list
(
MchPayPassage
.
gw
()
.
eq
(
MchPayPassage:
:
getMchNo
,
mchNo
)
.
eq
(
MchPayPassage:
:
getAppId
,
appId
)
.
eq
(
MchPayPassage:
:
getState
,
CS
.
YES
)
.
eq
(
MchPayPassage:
:
getWayCode
,
wayCode
)
);
...
...
Write
Preview
Supports
Markdown
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