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
33728965
Commit
33728965
authored
Jun 16, 2021
by
zhuxiao
Browse files
运营平台、商户系统新增商户应用及相关支付配置
parent
fdbb0edf
Changes
15
Hide whitespace changes
Inline
Side-by-side
docs/sql/init.sql
View file @
33728965
...
...
@@ -253,7 +253,7 @@ CREATE TABLE `t_mch_pay_passage` (
`created_at`
TIMESTAMP
(
6
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
(
6
)
COMMENT
'创建时间'
,
`updated_at`
TIMESTAMP
(
6
)
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
(
6
)
ON
UPDATE
CURRENT_TIMESTAMP
(
6
)
COMMENT
'更新时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`Uni_
MchNo
_WayCode`
(
`
mch_no
`
,
`if_code`
,
`way_code`
)
UNIQUE
KEY
`Uni_
AppId
_WayCode`
(
`
app_id
`
,
`if_code`
,
`way_code`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'商户支付通道表'
;
...
...
@@ -399,12 +399,21 @@ insert into t_sys_entitlement values('ENT_MCH', '商户管理', 'shop', '', 'Rou
insert
into
t_sys_entitlement
values
(
'ENT_MCH_INFO_EDIT'
,
'按钮:编辑'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_INFO_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_INFO_DEL'
,
'按钮:删除'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_LIST'
,
'商户支付参数配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_ADD'
,
'商户支付参数配置'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_VIEW'
,
'商户支付参数配置详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_LIST'
,
'商户支付通道配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_CONFIG'
,
'商户支付通道配置入口'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_ADD'
,
'商户支付通道配置保存'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_CONFIG'
,
'应用配置'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_INFO'
,
'0'
,
'MGR'
,
now
(),
now
());
-- 应用管理
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP'
,
'应用列表'
,
'appstore'
,
'/apps'
,
'MchAppPage'
,
'ML'
,
0
,
1
,
'ENT_MCH'
,
'20'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_LIST'
,
'页面:应用列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_ADD'
,
'按钮:新增'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_EDIT'
,
'按钮:编辑'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_DEL'
,
'按钮:删除'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_LIST'
,
'应用支付参数配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_ADD'
,
'应用支付参数配置'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_VIEW'
,
'应用支付参数配置详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_LIST'
,
'应用支付通道配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_CONFIG'
,
'应用支付通道配置入口'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_ADD'
,
'应用支付通道配置保存'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MGR'
,
now
(),
now
());
-- 服务商管理
insert
into
t_sys_entitlement
values
(
'ENT_ISV'
,
'服务商管理'
,
'block'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'40'
,
'MGR'
,
now
(),
now
());
...
...
@@ -492,9 +501,20 @@ insert into t_sys_entitlement values('ENT_MCH_MAIN', '主页', 'home', '/main',
insert
into
t_sys_entitlement
values
(
'ENT_MCH_MAIN_USER_INFO'
,
'主页用户信息'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_MAIN'
,
'0'
,
'MCH'
,
now
(),
now
());
-- 【商户系统】 商户中心
-- insert into t_sys_entitlement values('ENT_MCH_CENTER', '商户中心', 'team', '', 'RouteView', 'ML', 0, 'ROOT', '10', 'MCH', now(), now());
-- insert into t_sys_entitlement values('ENT_MCH_INFO', '商户信息', 'user', '/mch', 'MchInfoPage', 'ML', 0, 'ENT_MCH_CENTER', '10', 'MCH', now(), now());
-- insert into t_sys_entitlement values('ENT_MCH_INFO_EDIT', '按钮:修改商户信息', 'no-icon', '', '', 'PB', 0, 'ENT_MCH_INFO', '0', 'MCH', now(), now());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_CENTER'
,
'商户中心'
,
'team'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'10'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP'
,
'应用管理'
,
'appstore'
,
'/apps'
,
'MchAppPage'
,
'ML'
,
0
,
1
,
'ENT_MCH_CENTER'
,
'10'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_LIST'
,
'页面:应用列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_ADD'
,
'按钮:新增'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_EDIT'
,
'按钮:编辑'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_APP_DEL'
,
'按钮:删除'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_LIST'
,
'应用支付参数配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_ADD'
,
'应用支付参数配置'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_VIEW'
,
'应用支付参数配置详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_LIST'
,
'应用支付通道配置列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_APP'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_CONFIG'
,
'应用支付通道配置入口'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_ADD'
,
'应用支付通道配置保存'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
-- 【商户系统】 订单管理
insert
into
t_sys_entitlement
values
(
'ENT_ORDER'
,
'订单中心'
,
'transaction'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'20'
,
'MCH'
,
now
(),
now
());
...
...
@@ -505,16 +525,6 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单中心', 'transaction',
insert
into
t_sys_entitlement
values
(
'ENT_REFUND_LIST'
,
'页面:退款订单列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_REFUND_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_REFUND_ORDER_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_REFUND_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
-- 【商户系统】 支付配置
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PC'
,
'支付配置'
,
'file-done'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'30'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_LIST'
,
'支付参数'
,
'interaction'
,
'/pay/config'
,
'PayConfigPage'
,
'ML'
,
0
,
1
,
'ENT_MCH_PC'
,
'10'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_ADD'
,
'商户支付参数配置'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_CONFIG_VIEW'
,
'商户支付参数配置详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_CONFIG_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_LIST'
,
'支付通道'
,
'appstore'
,
'/pay/passage'
,
'PayPassagePage'
,
'ML'
,
0
,
1
,
'ENT_MCH_PC'
,
'20'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_CONFIG'
,
'商户支付通道配置入口'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_MCH_PAY_PASSAGE_ADD'
,
'商户支付通道配置保存'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_MCH_PAY_PASSAGE_LIST'
,
'0'
,
'MCH'
,
now
(),
now
());
-- 【商户系统】 系统管理
insert
into
t_sys_entitlement
values
(
'ENT_SYS_CONFIG'
,
'系统管理'
,
'setting'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ROOT'
,
'200'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_UR'
,
'用户角色管理'
,
'team'
,
''
,
'RouteView'
,
'ML'
,
0
,
1
,
'ENT_SYS_CONFIG'
,
'10'
,
'MCH'
,
now
(),
now
());
...
...
jeepay-core/src/main/java/com/jeequan/jeepay/core/entity/MchApp.java
View file @
33728965
package
com.jeequan.jeepay.core.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -35,7 +36,7 @@ public class MchApp extends BaseModel {
/**
* 应用ID
*/
@TableId
@TableId
(
value
=
"app_id"
,
type
=
IdType
.
ASSIGN_UUID
)
private
String
appId
;
/**
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/isv/IsvPayInterfaceConfigController.java
View file @
33728965
...
...
@@ -54,7 +54,7 @@ public class IsvPayInterfaceConfigController extends CommonCtrl {
@GetMapping
public
ApiRes
list
()
{
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListByI
nfoId
(
CS
.
INFO_TYPE_ISV
,
getValStringRequired
(
"isvNo"
));
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListByI
svNo
(
CS
.
INFO_TYPE_ISV
,
getValStringRequired
(
"isvNo"
));
return
ApiRes
.
ok
(
list
);
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchAppController.java
0 → 100644
View file @
33728965
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mgr.ctrl.merchant
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.queue.MqQueue4ModifyMchUserRemove
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchApp
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 商户应用管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-06-16 09:15
*/
@RestController
@RequestMapping
(
"/api/mchApps"
)
public
class
MchAppController
extends
CommonCtrl
{
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
MqTopic4ModifyMchApp
mqTopic4ModifyMchApp
;
/**
* @Author: ZhuXiao
* @Description: 应用列表
* @Date: 9:59 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
LambdaQueryWrapper
<
MchApp
>
wrapper
=
MchApp
.
gw
();
if
(
StringUtils
.
isNotEmpty
(
mchApp
.
getMchNo
()))
wrapper
.
eq
(
MchApp:
:
getMchNo
,
mchApp
.
getMchNo
());
if
(
StringUtils
.
isNotEmpty
(
mchApp
.
getAppId
()))
wrapper
.
eq
(
MchApp:
:
getAppId
,
mchApp
.
getAppId
());
if
(
StringUtils
.
isNotEmpty
(
mchApp
.
getAppName
()))
wrapper
.
eq
(
MchApp:
:
getAppName
,
mchApp
.
getAppName
());
if
(
mchApp
.
getState
()
!=
null
)
wrapper
.
eq
(
MchApp:
:
getState
,
mchApp
.
getState
());
wrapper
.
orderByDesc
(
MchApp:
:
getCreatedAt
);
IPage
<
MchApp
>
pages
=
mchAppService
.
page
(
getIPage
(),
wrapper
);
return
ApiRes
.
ok
(
pages
);
}
/**
* @Author: ZhuXiao
* @Description: 新建应用
* @Date: 10:05 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_ADD')"
)
@MethodLog
(
remark
=
"新建应用"
)
@PostMapping
public
ApiRes
add
()
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
if
(
mchInfoService
.
getById
(
mchApp
.
getMchNo
())
==
null
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
boolean
result
=
mchAppService
.
save
(
mchApp
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_CREATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: 应用详情
* @Date: 10:13 2021/6/16
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_MCH_APP_VIEW', 'ENT_MCH_APP_EDIT')"
)
@GetMapping
(
"/{appId}"
)
public
ApiRes
detail
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
if
(
mchApp
==
null
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
return
ApiRes
.
ok
(
mchApp
);
}
/**
* @Author: ZhuXiao
* @Description: 更新应用信息
* @Date: 10:11 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_EDIT')"
)
@MethodLog
(
remark
=
"更新应用信息"
)
@PutMapping
(
"/{appId}"
)
public
ApiRes
update
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
mchApp
.
setAppId
(
appId
);
boolean
result
=
mchAppService
.
updateById
(
mchApp
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mqTopic4ModifyMchApp
.
push
(
mchApp
.
getMchNo
(),
mchApp
.
getAppId
());
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: 删除应用
* @Date: 10:14 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_DEL')"
)
@MethodLog
(
remark
=
"删除应用"
)
@DeleteMapping
(
"/{appId}"
)
public
ApiRes
delete
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mqTopic4ModifyMchApp
.
push
(
mchApp
.
getMchNo
(),
appId
);
return
ApiRes
.
ok
();
}
}
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
33728965
...
...
@@ -18,11 +18,14 @@ package com.jeequan.jeepay.mgr.ctrl.merchant;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchApp
;
import
com.jeequan.jeepay.mgr.mq.topic.MqTopic4ModifyMchInfo
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -43,30 +46,31 @@ import java.util.List;
public
class
MchPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqTopic4ModifyMchInfo
mqTopic4ModifyMchInfo
;
@Autowired
private
MqTopic4ModifyMchApp
mqTopic4ModifyMchApp
;
@Autowired
private
MchAppService
mchAppService
;
/**
* @Author: ZhuXiao
* @Description: 查询
商户
支付接口配置列表
* @Description: 查询
应用
支付接口配置列表
* @Date: 15:50 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListBy
InfoId
(
CS
.
INFO_TYPE_MCH
,
getValStringRequired
(
"
mchNo
"
));
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListBy
AppId
(
getValStringRequired
(
"
appId
"
));
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据
商户号
、接口类型 获取
商户
参数配置
* @Description: 根据
appId
、接口类型 获取
应用
参数配置
* @Date: 17:03 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_VIEW')"
)
@GetMapping
(
"/{
mchNo
}/{ifCode}"
)
public
ApiRes
getBy
MchNo
(
@PathVariable
(
value
=
"
mchNo
"
)
String
mchNo
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
@GetMapping
(
"/{
appId
}/{ifCode}"
)
public
ApiRes
getBy
AppId
(
@PathVariable
(
value
=
"
appId
"
)
String
appId
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
_APP
,
appId
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
...
...
@@ -75,19 +79,25 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
/**
* @Author: ZhuXiao
* @Description:
商户
支付接口配置
* @Description:
应用
支付接口配置
* @Date: 16:13 2021/4/27
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"更新
商户
支付参数"
)
@MethodLog
(
remark
=
"更新
应用
支付参数"
)
public
ApiRes
saveOrUpdate
()
{
String
infoId
=
getValStringRequired
(
"infoId"
);
String
ifCode
=
getValStringRequired
(
"ifCode"
);
MchApp
mchApp
=
mchAppService
.
getById
(
infoId
);
if
(
mchApp
==
null
||
mchApp
.
getState
()
!=
CS
.
YES
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
PayInterfaceConfig
payInterfaceConfig
=
getObject
(
PayInterfaceConfig
.
class
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_MCH
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_MCH_APP
);
payInterfaceConfig
.
setInfoId
(
infoId
);
// 存入真实费率
if
(
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
...
...
@@ -101,7 +111,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
payInterfaceConfig
.
setUpdatedBy
(
realName
);
//根据 商户号、接口类型 获取商户参数配置
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
infoId
,
ifCode
);
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
_APP
,
infoId
,
ifCode
);
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
if
(
dbRecoed
!=
null
)
{
payInterfaceConfig
.
setId
(
dbRecoed
.
getId
());
...
...
@@ -115,7 +125,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
,
"配置失败"
);
}
mqTopic4ModifyMch
Info
.
push
(
infoId
);
// 推送mq到目前节点进行更新数据
mqTopic4ModifyMch
App
.
push
(
mchApp
.
getMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-manager/src/main/java/com/jeequan/jeepay/mgr/ctrl/merchant/MchPayPassageConfigController.java
View file @
33728965
...
...
@@ -23,16 +23,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.MchPayPassage
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.entity.*
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mgr.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.MchPayPassageService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
com.jeequan.jeepay.service.impl.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -54,9 +49,9 @@ import java.util.List;
public
class
MchPayPassageConfigController
extends
CommonCtrl
{
@Autowired
private
MchPayPassageService
mchPayPassageService
;
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
PayWayService
payWayService
;
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
MchAppService
mchAppService
;
/**
...
...
@@ -68,7 +63,7 @@ public class MchPayPassageConfigController extends CommonCtrl {
@GetMapping
public
ApiRes
list
()
{
String
mchNo
=
getValStringRequired
(
"
mchNo
"
);
String
appId
=
getValStringRequired
(
"
appId
"
);
String
wayCode
=
getValString
(
"wayCode"
);
String
wayName
=
getValString
(
"wayName"
);
...
...
@@ -84,10 +79,10 @@ public class MchPayPassageConfigController extends CommonCtrl {
List
<
String
>
wayCodeList
=
new
LinkedList
<>();
payWayPage
.
getRecords
().
stream
().
forEach
(
payWay
->
wayCodeList
.
add
(
payWay
.
getWayCode
()));
//
商户
支付通道集合
//
应用
支付通道集合
List
<
MchPayPassage
>
mchPayPassageList
=
mchPayPassageService
.
list
(
MchPayPassage
.
gw
()
.
select
(
MchPayPassage:
:
getWayCode
,
MchPayPassage:
:
getState
)
.
eq
(
MchPayPassage:
:
get
MchNo
,
mchNo
)
.
eq
(
MchPayPassage:
:
get
AppId
,
appId
)
.
in
(
MchPayPassage:
:
getWayCode
,
wayCodeList
));
for
(
PayWay
payWay
:
payWayPage
.
getRecords
())
{
...
...
@@ -107,41 +102,32 @@ public class MchPayPassageConfigController extends CommonCtrl {
/**
* @Author: ZhuXiao
* @Description: 根据
商户号
、支付方式查询可用的支付接口列表
* @Description: 根据
appId
、支付方式查询可用的支付接口列表
* @Date: 17:55 2021/5/8
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_CONFIG')"
)
@GetMapping
(
"/availablePayInterface/{
mchNo
}/{wayCode}"
)
public
ApiRes
availablePayInterface
(
@PathVariable
(
"
mchNo
"
)
String
mchNo
,
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
@GetMapping
(
"/availablePayInterface/{
appId
}/{wayCode}"
)
public
ApiRes
availablePayInterface
(
@PathVariable
(
"
appId
"
)
String
appId
,
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchNo
);
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
if
(
mchApp
==
null
||
mchApp
.
getState
()
!=
CS
.
YES
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchApp
.
getMchNo
());
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
// 根据支付方式查询可用支付接口列表
List
<
JSONObject
>
list
=
mchPayPassageService
.
selectAvailablePayInterfaceList
(
wayCode
,
mchNo
,
CS
.
INFO_TYPE_MCH
,
mchInfo
.
getType
());
List
<
JSONObject
>
list
=
mchPayPassageService
.
selectAvailablePayInterfaceList
(
wayCode
,
appId
,
CS
.
INFO_TYPE_MCH
_APP
,
mchInfo
.
getType
());
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据 商户号、接口类型 获取商户参数配置
* @Date: 17:03 2021/4/27
*/
@GetMapping
(
"/{mchNo}/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"mchNo"
)
String
mchNo
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
return
ApiRes
.
ok
(
payInterfaceConfig
);
}
/**
* @Author: ZhuXiao
* @Description: 商户支付通道配置
* @Description: 应用支付通道配置
* @Date: 17:36 2021/5/8
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_ADD')"
)
...
...
@@ -153,7 +139,15 @@ public class MchPayPassageConfigController extends CommonCtrl {
try
{
List
<
MchPayPassage
>
mchPayPassageList
=
JSONArray
.
parseArray
(
reqParams
,
MchPayPassage
.
class
);
mchPayPassageService
.
saveOrUpdateBatchSelf
(
mchPayPassageList
);
if
(
CollectionUtils
.
isEmpty
(
mchPayPassageList
))
{
throw
new
BizException
(
"操作失败"
);
}
MchApp
mchApp
=
mchAppService
.
getById
(
mchPayPassageList
.
get
(
0
).
getAppId
());
if
(
mchApp
==
null
||
mchApp
.
getState
()
!=
CS
.
YES
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
mchPayPassageService
.
saveOrUpdateBatchSelf
(
mchPayPassageList
,
mchApp
.
getMchNo
());
return
ApiRes
.
ok
();
}
catch
(
Exception
e
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
);
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchAppController.java
0 → 100644
View file @
33728965
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.ctrl.merchant
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.topic.MqTopic4ModifyMchApp
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 商户应用管理类
*
* @author zhuxiao
* @site https://www.jeepay.vip
* @date 2021-06-16 09:15
*/
@RestController
@RequestMapping
(
"/api/mchApps"
)
public
class
MchAppController
extends
CommonCtrl
{
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
MqTopic4ModifyMchApp
mqTopic4ModifyMchApp
;
/**
* @Author: ZhuXiao
* @Description: 应用列表
* @Date: 9:59 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_LIST')"
)
@GetMapping
public
ApiRes
list
()
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
LambdaQueryWrapper
<
MchApp
>
wrapper
=
MchApp
.
gw
();
wrapper
.
eq
(
MchApp:
:
getMchNo
,
getCurrentMchNo
());
if
(
StringUtils
.
isNotEmpty
(
mchApp
.
getAppId
()))
wrapper
.
eq
(
MchApp:
:
getAppId
,
mchApp
.
getAppId
());
if
(
StringUtils
.
isNotEmpty
(
mchApp
.
getAppName
()))
wrapper
.
eq
(
MchApp:
:
getAppName
,
mchApp
.
getAppName
());
if
(
mchApp
.
getState
()
!=
null
)
wrapper
.
eq
(
MchApp:
:
getState
,
mchApp
.
getState
());
wrapper
.
orderByDesc
(
MchApp:
:
getCreatedAt
);
IPage
<
MchApp
>
pages
=
mchAppService
.
page
(
getIPage
(),
wrapper
);
return
ApiRes
.
ok
(
pages
);
}
/**
* @Author: ZhuXiao
* @Description: 新建应用
* @Date: 10:05 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_ADD')"
)
@MethodLog
(
remark
=
"新建应用"
)
@PostMapping
public
ApiRes
add
()
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
mchApp
.
setMchNo
(
getCurrentMchNo
());
boolean
result
=
mchAppService
.
save
(
mchApp
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_CREATE
);
}
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: 应用详情
* @Date: 10:13 2021/6/16
*/
@PreAuthorize
(
"hasAnyAuthority('ENT_MCH_APP_VIEW', 'ENT_MCH_APP_EDIT')"
)
@GetMapping
(
"/{appId}"
)
public
ApiRes
detail
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
if
(
mchApp
==
null
||
!
mchApp
.
getMchNo
().
equals
(
getCurrentMchNo
()))
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
return
ApiRes
.
ok
(
mchApp
);
}
/**
* @Author: ZhuXiao
* @Description: 更新应用信息
* @Date: 10:11 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_EDIT')"
)
@MethodLog
(
remark
=
"更新应用信息"
)
@PutMapping
(
"/{appId}"
)
public
ApiRes
update
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
getObject
(
MchApp
.
class
);
mchApp
.
setAppId
(
appId
);
MchApp
dbRecord
=
mchAppService
.
getById
(
appId
);
if
(!
dbRecord
.
getMchNo
().
equals
(
getCurrentMchNo
()))
{
throw
new
BizException
(
"无权操作!"
);
}
boolean
result
=
mchAppService
.
updateById
(
mchApp
);
if
(!
result
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_UPDATE
);
}
// 推送修改应用消息
mqTopic4ModifyMchApp
.
push
(
getCurrentMchNo
(),
mchApp
.
getAppId
());
return
ApiRes
.
ok
();
}
/**
* @Author: ZhuXiao
* @Description: 删除应用
* @Date: 10:14 2021/6/16
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_APP_DEL')"
)
@MethodLog
(
remark
=
"删除应用"
)
@DeleteMapping
(
"/{appId}"
)
public
ApiRes
delete
(
@PathVariable
(
"appId"
)
String
appId
)
{
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
if
(!
mchApp
.
getMchNo
().
equals
(
getCurrentMchNo
()))
{
throw
new
BizException
(
"无权操作!"
);
}
mchAppService
.
removeByAppId
(
appId
);
// 推送mq到目前节点进行更新数据
mqTopic4ModifyMchApp
.
push
(
getCurrentMchNo
(),
appId
);
return
ApiRes
.
ok
();
}
}
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchPayInterfaceConfigController.java
View file @
33728965
...
...
@@ -23,6 +23,7 @@ import com.jeequan.jeepay.core.entity.PayInterfaceDefine;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.mq.topic.MqTopic4ModifyMchApp
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -44,6 +45,7 @@ import java.util.List;
public
class
MchPayInterfaceConfigController
extends
CommonCtrl
{
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
MqTopic4ModifyMchApp
mqTopic4ModifyMchApp
;
@Autowired
private
MchInfoService
mchInfoService
;
/**
...
...
@@ -55,7 +57,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
@GetMapping
public
ApiRes
list
()
{
MchInfo
mchInfo
=
mchInfoService
.
getById
(
getCurrentUser
().
getSysUser
().
getBelongInfoId
());
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListBy
InfoId
(
CS
.
INFO_TYPE_MCH
,
getCurrentUser
().
getSysUser
().
getBelongInfo
Id
(
));
List
<
PayInterfaceDefine
>
list
=
payInterfaceConfigService
.
selectAllPayIfConfigListBy
AppId
(
getValStringRequired
(
"app
Id
"
));
for
(
PayInterfaceDefine
define
:
list
)
{
define
.
addExt
(
"mchParams"
,
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_NORMAL
?
define
.
getNormalMchParams
()
:
define
.
getIsvsubMchParams
());
...
...
@@ -71,9 +73,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
* @Date: 10:54 2021/5/13
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_CONFIG_VIEW')"
)
@GetMapping
(
"/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
getCurrentUser
().
getSysUser
().
getBelongInfoId
()
,
ifCode
);
@GetMapping
(
"/{
appId}/{
ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"appId"
)
String
appId
,
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
_APP
,
appId
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
...
...
@@ -90,12 +92,12 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
@MethodLog
(
remark
=
"更新商户支付参数"
)
public
ApiRes
saveOrUpdate
()
{
String
mchNo
=
getCurrentUser
().
getSysUser
().
getBelongInfoId
();
String
ifCode
=
getValStringRequired
(
"ifCode"
);
String
infoId
=
getValStringRequired
(
"infoId"
);
PayInterfaceConfig
payInterfaceConfig
=
getObject
(
PayInterfaceConfig
.
class
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_MCH
);
payInterfaceConfig
.
setInfoId
(
mchNo
);
payInterfaceConfig
.
setInfoType
(
CS
.
INFO_TYPE_MCH
_APP
);
payInterfaceConfig
.
setInfoId
(
infoId
);
// 存入真实费率
if
(
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
...
...
@@ -109,7 +111,7 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
payInterfaceConfig
.
setUpdatedBy
(
realName
);
//根据 商户号、接口类型 获取商户参数配置
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
PayInterfaceConfig
dbRecoed
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
_APP
,
infoId
,
ifCode
);
//若配置存在,为saveOrUpdate添加ID,第一次配置添加创建者
if
(
dbRecoed
!=
null
)
{
payInterfaceConfig
.
setId
(
dbRecoed
.
getId
());
...
...
@@ -122,6 +124,9 @@ public class MchPayInterfaceConfigController extends CommonCtrl {
if
(!
result
)
{
throw
new
BizException
(
"配置失败"
);
}
mqTopic4ModifyMchApp
.
push
(
getCurrentMchNo
(),
infoId
);
// 推送mq到目前节点进行更新数据
return
ApiRes
.
ok
();
}
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/merchant/MchPayPassageConfigController.java
View file @
33728965
...
...
@@ -25,13 +25,11 @@ import com.jeequan.jeepay.core.constants.ApiCodeEnum;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.MchPayPassage
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.service.impl.MchInfoService
;
import
com.jeequan.jeepay.service.impl.MchPayPassageService
;
import
com.jeequan.jeepay.service.impl.PayInterfaceConfigService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -54,7 +52,6 @@ import java.util.List;
public
class
MchPayPassageConfigController
extends
CommonCtrl
{
@Autowired
private
MchPayPassageService
mchPayPassageService
;
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Autowired
private
PayWayService
payWayService
;
@Autowired
private
MchInfoService
mchInfoService
;
...
...
@@ -67,14 +64,14 @@ public class MchPayPassageConfigController extends CommonCtrl {
@GetMapping
public
ApiRes
list
()
{
String
mchNo
=
get
CurrentUser
().
getSysUser
().
getBelongInfo
Id
(
);
String
appId
=
get
ValStringRequired
(
"app
Id
"
);
String
wayCode
=
getValString
(
"wayCode"
);
String
wayName
=
getValString
(
"wayName"
);
//支付方式集合
LambdaQueryWrapper
<
PayWay
>
wrapper
=
PayWay
.
gw
();
if
(
StrUtil
.
isNotBlank
(
wayCode
))
wrapper
.
eq
(
PayWay:
:
getWayCode
,
wayCode
);
if
(
StrUtil
.
isNotBlank
(
wayName
))
wrapper
.
like
(
PayWay:
:
getWayName
,
"%"
+
wayName
+
"%"
);
if
(
StrUtil
.
isNotBlank
(
wayName
))
wrapper
.
like
(
PayWay:
:
getWayName
,
wayName
);
IPage
<
PayWay
>
payWayPage
=
payWayService
.
page
(
getIPage
(),
wrapper
);
if
(!
CollectionUtils
.
isEmpty
(
payWayPage
.
getRecords
()))
{
...
...
@@ -86,7 +83,8 @@ public class MchPayPassageConfigController extends CommonCtrl {
// 商户支付通道集合
List
<
MchPayPassage
>
mchPayPassageList
=
mchPayPassageService
.
list
(
MchPayPassage
.
gw
()
.
select
(
MchPayPassage:
:
getWayCode
,
MchPayPassage:
:
getState
)
.
eq
(
MchPayPassage:
:
getMchNo
,
mchNo
)
.
eq
(
MchPayPassage:
:
getAppId
,
appId
)
.
eq
(
MchPayPassage:
:
getMchNo
,
getCurrentMchNo
())
.
in
(
MchPayPassage:
:
getWayCode
,
wayCodeList
));
for
(
PayWay
payWay
:
payWayPage
.
getRecords
())
{
...
...
@@ -106,12 +104,12 @@ public class MchPayPassageConfigController extends CommonCtrl {
/**
* @Author: ZhuXiao
* @Description: 根据
商户号
、支付方式查询可用的支付接口列表
* @Description: 根据
appId
、支付方式查询可用的支付接口列表
* @Date: 11:05 2021/5/13
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_CONFIG')"
)
@GetMapping
(
"/availablePayInterface/{wayCode}"
)
public
ApiRes
availablePayInterface
(
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
@GetMapping
(
"/availablePayInterface/{
appId}/{
wayCode}"
)
public
ApiRes
availablePayInterface
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"wayCode"
)
String
wayCode
)
{
String
mchNo
=
getCurrentUser
().
getSysUser
().
getBelongInfoId
();
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchNo
);
...
...
@@ -120,26 +118,11 @@ public class MchPayPassageConfigController extends CommonCtrl {
}
// 根据支付方式查询可用支付接口列表
List
<
JSONObject
>
list
=
mchPayPassageService
.
selectAvailablePayInterfaceList
(
wayCode
,
mchNo
,
CS
.
INFO_TYPE_MCH
,
mchInfo
.
getType
());
List
<
JSONObject
>
list
=
mchPayPassageService
.
selectAvailablePayInterfaceList
(
wayCode
,
appId
,
CS
.
INFO_TYPE_MCH
_APP
,
mchInfo
.
getType
());
return
ApiRes
.
ok
(
list
);
}
/**
* @Author: ZhuXiao
* @Description: 根据 商户号、接口类型 获取商户参数配置
* @Date: 11:05 2021/5/13
*/
@GetMapping
(
"/{ifCode}"
)
public
ApiRes
getByMchNo
(
@PathVariable
(
value
=
"ifCode"
)
String
ifCode
)
{
String
mchNo
=
getCurrentUser
().
getSysUser
().
getBelongInfoId
();
PayInterfaceConfig
payInterfaceConfig
=
payInterfaceConfigService
.
getByInfoIdAndIfCode
(
CS
.
INFO_TYPE_MCH
,
mchNo
,
ifCode
);
if
(
payInterfaceConfig
!=
null
&&
payInterfaceConfig
.
getIfRate
()
!=
null
)
{
payInterfaceConfig
.
setIfRate
(
payInterfaceConfig
.
getIfRate
().
multiply
(
new
BigDecimal
(
"100"
)));
}
return
ApiRes
.
ok
(
payInterfaceConfig
);
}
/**
* @Author: ZhuXiao
* @Description:
...
...
@@ -156,19 +139,19 @@ public class MchPayPassageConfigController extends CommonCtrl {
/**
* @Author: ZhuXiao
* @Description:
商户
支付通道配置
* @Description:
应用
支付通道配置
* @Date: 11:05 2021/5/13
*/
@PreAuthorize
(
"hasAuthority('ENT_MCH_PAY_PASSAGE_ADD')"
)
@PostMapping
@MethodLog
(
remark
=
"更新
商户
支付通道"
)
@MethodLog
(
remark
=
"更新
应用
支付通道"
)
public
ApiRes
saveOrUpdate
()
{
String
reqParams
=
getValStringRequired
(
"reqParams"
);
try
{
List
<
MchPayPassage
>
mchPayPassageList
=
JSONArray
.
parseArray
(
reqParams
,
MchPayPassage
.
class
);
mchPayPassageService
.
saveOrUpdateBatchSelf
(
mchPayPassageList
,
getCurrent
User
().
getSysUser
().
getBelongInfoId
());
mchPayPassageService
.
saveOrUpdateBatchSelf
(
mchPayPassageList
,
getCurrent
MchNo
());
return
ApiRes
.
ok
();
}
catch
(
Exception
e
)
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYSTEM_ERROR
);
...
...
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/mq/topic/MqTopic4ModifyMchApp.java
0 → 100644
View file @
33728965
/*
* Copyright (c) 2021-2031, 河北计全科技有限公司 (https://www.jeequan.com & jeequan@126.com).
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com.jeequan.jeepay.mch.mq.topic
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.utils.JsonKit
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jms.core.JmsTemplate
;
import
org.springframework.stereotype.Component
;
/*
* 更改商户应用信息
*
* @author terrfly
* @site https://www.jeepay.vip
* @date 2021/6/8 17:10
*/
@Slf4j
@Component
public
class
MqTopic4ModifyMchApp
extends
ActiveMQTopic
{
@Autowired
private
JmsTemplate
jmsTemplate
;
public
MqTopic4ModifyMchApp
(){
super
(
CS
.
MQ
.
TOPIC_MODIFY_MCH_APP
);
}
/** 推送消息到各个节点 **/
public
void
push
(
String
mchNo
,
String
appId
)
{
JSONObject
jsonObject
=
JsonKit
.
newJson
(
"mchNo"
,
mchNo
);
jsonObject
.
put
(
"appId"
,
appId
);
this
.
jmsTemplate
.
convertAndSend
(
this
,
jsonObject
.
toString
());
}
}
jeepay-service/src/main/java/com/jeequan/jeepay/service/impl/MchAppService.java
View file @
33728965
package
com.jeequan.jeepay.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.entity.MchPayPassage
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.service.mapper.MchAppMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* <p>
...
...
@@ -16,4 +24,36 @@ import org.springframework.stereotype.Service;
@Service
public
class
MchAppService
extends
ServiceImpl
<
MchAppMapper
,
MchApp
>
{
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
MchPayPassageService
mchPayPassageService
;
@Autowired
private
PayInterfaceConfigService
payInterfaceConfigService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
removeByAppId
(
String
appId
)
{
// 1.查看当前应用是否存在交易数据
int
payCount
=
payOrderService
.
count
(
PayOrder
.
gw
().
eq
(
PayOrder:
:
getAppId
,
appId
));
if
(
payCount
>
0
)
throw
new
BizException
(
"该应用已存在交易数据,不可删除"
);
// 2.删除应用关联的支付通道
boolean
result
=
mchPayPassageService
.
remove
(
MchPayPassage
.
gw
().
eq
(
MchPayPassage:
:
getAppId
,
appId
));
if
(!
result
)
{
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
}
// 3.删除应用配置的支付参数
result
=
payInterfaceConfigService
.
remove
(
PayInterfaceConfig
.
gw
()
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
appId
)
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_MCH_APP
)
);
if
(!
result
)
{
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
}
// 4.删除当前应用
result
=
removeById
(
appId
);
if
(!
result
)
{
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_DELETE
);
}
}
}
jeepay-service/src/main/java/com/jeequan/jeepay/service/impl/MchInfoService.java
View file @
33728965
...
...
@@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
...
...
@@ -54,6 +55,8 @@ public class MchInfoService extends ServiceImpl<MchInfoMapper, MchInfo> {
@Autowired
private
IsvInfoService
isvInfoService
;
@Autowired
private
MchAppService
mchAppService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addMch
(
MchInfo
mchInfo
,
String
loginUserName
)
{
...
...
@@ -104,9 +107,11 @@ public class MchInfoService extends ServiceImpl<MchInfoMapper, MchInfo> {
mchPayPassageService
.
remove
(
MchPayPassage
.
gw
().
eq
(
MchPayPassage:
:
getMchNo
,
mchNo
));
// 3.删除当前商户支付接口配置参数
List
<
String
>
appIdList
=
new
LinkedList
<>();
mchAppService
.
list
(
MchApp
.
gw
().
eq
(
MchApp:
:
getMchNo
,
mchNo
)).
forEach
(
item
->
appIdList
.
add
(
item
.
getAppId
()));
payInterfaceConfigService
.
remove
(
PayInterfaceConfig
.
gw
()
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
mchNo
)
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_MCH
)
.
in
(
PayInterfaceConfig:
:
getInfoId
,
appIdList
)
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_MCH
_APP
)
);
List
<
SysUser
>
userList
=
sysUserService
.
list
(
SysUser
.
gw
()
...
...
jeepay-service/src/main/java/com/jeequan/jeepay/service/impl/MchPayPassageService.java
View file @
33728965
...
...
@@ -47,10 +47,10 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
* @Description: 根据支付方式查询可用的支付接口列表
* @Date: 9:56 2021/5/10
*/
public
List
<
JSONObject
>
selectAvailablePayInterfaceList
(
String
wayCode
,
String
mchNo
,
Byte
infoType
,
Byte
mchType
)
{
public
List
<
JSONObject
>
selectAvailablePayInterfaceList
(
String
wayCode
,
String
appId
,
Byte
infoType
,
Byte
mchType
)
{
Map
params
=
new
HashMap
();
params
.
put
(
"wayCode"
,
wayCode
);
params
.
put
(
"
mchNo"
,
mchNo
);
params
.
put
(
"
appId"
,
appId
);
params
.
put
(
"infoType"
,
infoType
);
params
.
put
(
"mchType"
,
mchType
);
List
<
JSONObject
>
list
=
baseMapper
.
selectAvailablePayInterfaceList
(
params
);
...
...
@@ -59,7 +59,7 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
// 添加通道状态
for
(
JSONObject
object
:
list
)
{
MchPayPassage
payPassage
=
baseMapper
.
selectOne
(
MchPayPassage
.
gw
()
.
eq
(
MchPayPassage:
:
get
MchNo
,
mchNo
)
.
eq
(
MchPayPassage:
:
get
AppId
,
appId
)
.
eq
(
MchPayPassage:
:
getWayCode
,
wayCode
)
.
eq
(
MchPayPassage:
:
getIfCode
,
object
.
getString
(
"ifCode"
))
);
...
...
@@ -77,16 +77,8 @@ public class MchPayPassageService extends ServiceImpl<MchPayPassageMapper, MchPa
return
list
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveOrUpdateBatchSelf
(
List
<
MchPayPassage
>
mchPayPassageList
)
{
saveOrUpdateBatchSelf
(
mchPayPassageList
,
null
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveOrUpdateBatchSelf
(
List
<
MchPayPassage
>
mchPayPassageList
,
String
mchNo
)
{
if
(
CollectionUtils
.
isEmpty
(
mchPayPassageList
))
{
throw
new
BizException
(
"操作失败"
);
}
for
(
MchPayPassage
payPassage
:
mchPayPassageList
)
{
if
(
payPassage
.
getState
()
==
CS
.
NO
&&
payPassage
.
getId
()
==
null
)
{
continue
;
...
...
jeepay-service/src/main/java/com/jeequan/jeepay/service/impl/PayInterfaceConfigService.java
View file @
33728965
...
...
@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.CS
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.entity.MchInfo
;
import
com.jeequan.jeepay.core.entity.PayInterfaceConfig
;
import
com.jeequan.jeepay.core.entity.PayInterfaceDefine
;
...
...
@@ -48,6 +49,9 @@ public class PayInterfaceConfigService extends ServiceImpl<PayInterfaceConfigMap
@Autowired
private
MchInfoService
mchInfoService
;
@Autowired
private
MchAppService
mchAppService
;
/**
* @Author: ZhuXiao
* @Description: 根据 账户类型、账户号、接口类型 获取支付参数配置
...
...
@@ -66,63 +70,88 @@ public class PayInterfaceConfigService extends ServiceImpl<PayInterfaceConfigMap
* @Description: 根据 账户类型、账户号 获取支付参数配置列表
* @Date: 14:19 2021/5/7
*/
public
List
<
PayInterfaceDefine
>
selectAllPayIfConfigListByI
nfoId
(
Byte
infoType
,
String
infoId
)
{
public
List
<
PayInterfaceDefine
>
selectAllPayIfConfigListByI
svNo
(
Byte
infoType
,
String
infoId
)
{
// 支付定义列表
LambdaQueryWrapper
<
PayInterfaceDefine
>
queryWrapper
=
PayInterfaceDefine
.
gw
();
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getState
,
CS
.
YES
);
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getIsIsvMode
,
CS
.
YES
);
// 支持服务商模式
// 根据商户类型,添加接口是否支持该商户类型条件
MchInfo
mchInfo
=
null
;
Map
<
String
,
PayInterfaceConfig
>
isvPayConfigMap
=
new
HashMap
<>();
// 服务商支付参数配置集合
if
(
infoType
==
CS
.
INFO_TYPE_MCH
)
{
//商户信息
mchInfo
=
mchInfoService
.
getById
(
infoId
);
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
)
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
List
<
PayInterfaceDefine
>
defineList
=
payInterfaceDefineService
.
list
(
queryWrapper
);
if
(
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_NORMAL
)
{
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getIsMchMode
,
CS
.
YES
);
// 支持普通商户模式
}
if
(
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_ISVSUB
)
{
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getIsIsvMode
,
CS
.
YES
);
// 支持服务商模式
// 商户类型为特约商户,服务商应已经配置支付参数
List
<
PayInterfaceConfig
>
isvConfigList
=
this
.
list
(
PayInterfaceConfig
.
gw
()
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
mchInfo
.
getIsvNo
())
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_ISV
)
.
eq
(
PayInterfaceConfig:
:
getState
,
CS
.
YES
)
.
ne
(
PayInterfaceConfig:
:
getIfParams
,
" "
)
.
isNotNull
(
PayInterfaceConfig:
:
getIfParams
));
for
(
PayInterfaceConfig
config
:
isvConfigList
)
{
isvPayConfigMap
.
put
(
config
.
getIfCode
(),
config
);
// 支付参数列表
LambdaQueryWrapper
<
PayInterfaceConfig
>
wrapper
=
PayInterfaceConfig
.
gw
();
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
infoId
);
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
infoType
);
List
<
PayInterfaceConfig
>
configList
=
this
.
list
(
wrapper
);
for
(
PayInterfaceDefine
define
:
defineList
)
{
for
(
PayInterfaceConfig
config
:
configList
)
{
if
(
define
.
getIfCode
().
equals
(
config
.
getIfCode
()))
{
define
.
addExt
(
"ifConfigState"
,
config
.
getState
());
// 配置状态
}
}
}
if
(
infoType
==
CS
.
INFO_TYPE_ISV
)
{
return
defineList
;
}
public
List
<
PayInterfaceDefine
>
selectAllPayIfConfigListByAppId
(
String
appId
)
{
MchApp
mchApp
=
mchAppService
.
getById
(
appId
);
if
(
mchApp
==
null
||
mchApp
.
getState
()
!=
CS
.
YES
)
{
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
MchInfo
mchInfo
=
mchInfoService
.
getById
(
mchApp
.
getMchNo
());
if
(
mchInfo
==
null
||
mchInfo
.
getState
()
!=
CS
.
YES
)
{
throw
new
BizException
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
// 支付定义列表
LambdaQueryWrapper
<
PayInterfaceDefine
>
queryWrapper
=
PayInterfaceDefine
.
gw
();
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getState
,
CS
.
YES
);
Map
<
String
,
PayInterfaceConfig
>
isvPayConfigMap
=
new
HashMap
<>();
// 服务商支付参数配置集合
// 根据商户类型,添加接口是否支持该商户类型条件
if
(
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_NORMAL
)
{
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getIsMchMode
,
CS
.
YES
);
// 支持普通商户模式
}
if
(
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_ISVSUB
)
{
queryWrapper
.
eq
(
PayInterfaceDefine:
:
getIsIsvMode
,
CS
.
YES
);
// 支持服务商模式
// 商户类型为特约商户,服务商应已经配置支付参数
List
<
PayInterfaceConfig
>
isvConfigList
=
this
.
list
(
PayInterfaceConfig
.
gw
()
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
mchInfo
.
getIsvNo
())
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_ISV
)
.
eq
(
PayInterfaceConfig:
:
getState
,
CS
.
YES
)
.
ne
(
PayInterfaceConfig:
:
getIfParams
,
""
)
.
isNotNull
(
PayInterfaceConfig:
:
getIfParams
));
for
(
PayInterfaceConfig
config
:
isvConfigList
)
{
isvPayConfigMap
.
put
(
config
.
getIfCode
(),
config
);
}
}
List
<
PayInterfaceDefine
>
defineList
=
payInterfaceDefineService
.
list
(
queryWrapper
);
// 支付参数列表
LambdaQueryWrapper
<
PayInterfaceConfig
>
wrapper
=
PayInterfaceConfig
.
gw
();
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
info
Id
);
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
infoType
);
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoId
,
app
Id
);
wrapper
.
eq
(
PayInterfaceConfig:
:
getInfoType
,
CS
.
INFO_TYPE_MCH_APP
);
List
<
PayInterfaceConfig
>
configList
=
this
.
list
(
wrapper
);
for
(
PayInterfaceDefine
define
:
defineList
)
{
define
.
addExt
(
"mchType"
,
mchInfo
.
getType
());
// 所属商户类型
for
(
PayInterfaceConfig
config
:
configList
)
{
if
(
define
.
getIfCode
().
equals
(
config
.
getIfCode
()))
{
define
.
addExt
(
"ifConfigState"
,
config
.
getState
());
// 配置状态
}
}
if
(
infoType
==
CS
.
INFO_TYPE_MCH
&&
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_ISVSUB
&&
isvPayConfigMap
.
get
(
define
.
getIfCode
())
==
null
)
{
if
(
mchInfo
.
getType
()
==
CS
.
MCH_TYPE_ISVSUB
&&
isvPayConfigMap
.
get
(
define
.
getIfCode
())
==
null
)
{
define
.
addExt
(
"subMchIsvConfig"
,
CS
.
NO
);
// 特约商户,服务商支付参数的配置状态,0表示未配置
}
}
return
defineList
;
}
}
jeepay-service/src/main/java/com/jeequan/jeepay/service/mapper/MchPayPassageMapper.xml
View file @
33728965
...
...
@@ -24,7 +24,7 @@
and pid.state = 1
and pic.state = 1
and pic.info_type = #{infoType}
and pic.info_id = #{
mchNo
}
and pic.info_id = #{
appId
}
and (pic.if_params is not null and trim(pic.if_params) != '')
<if
test=
"mchType == 1"
>
and pid.is_mch_mode = 1
...
...
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