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
ad189f7d
Commit
ad189f7d
authored
Sep 10, 2021
by
terrfly
Browse files
添加商户系统的退款功能权限配置项
parent
19851620
Changes
7
Hide whitespace changes
Inline
Side-by-side
docs/sql/init.sql
View file @
ad189f7d
...
@@ -636,6 +636,7 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单中心', 'transaction',
...
@@ -636,6 +636,7 @@ insert into t_sys_entitlement values('ENT_ORDER', '订单中心', 'transaction',
insert
into
t_sys_entitlement
values
(
'ENT_ORDER_LIST'
,
'页面:订单列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_ORDER_LIST'
,
'页面:订单列表'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_SEARCH_PAY_WAY'
,
'筛选项:支付方式'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_SEARCH_PAY_WAY'
,
'筛选项:支付方式'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_REFUND'
,
'按钮:订单退款'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_REFUND_ORDER'
,
'退款记录'
,
'exception'
,
'/refund'
,
'RefundOrderListPage'
,
'ML'
,
0
,
1
,
'ENT_ORDER'
,
'20'
,
'MCH'
,
now
(),
now
());
insert
into
t_sys_entitlement
values
(
'ENT_REFUND_ORDER'
,
'退款记录'
,
'exception'
,
'/refund'
,
'RefundOrderListPage'
,
'ML'
,
0
,
1
,
'ENT_ORDER'
,
'20'
,
'MCH'
,
now
(),
now
());
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_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_REFUND_ORDER_VIEW'
,
'按钮:详情'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_REFUND_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
...
...
docs/sql/patch.sql
View file @
ad189f7d
...
@@ -214,3 +214,9 @@ insert into t_sys_entitlement values('ENT_DIVISION_RECORD_VIEW', '按钮:详
...
@@ -214,3 +214,9 @@ insert into t_sys_entitlement values('ENT_DIVISION_RECORD_VIEW', '按钮:详
##
-- ++++ ++++
##
-- ++++ ++++
##
-- ++++ [v1.7.0] ===> [v1.7.1] ++++
-- 添加商户系统的退款功能权限配置项
insert
into
t_sys_entitlement
values
(
'ENT_PAY_ORDER_REFUND'
,
'按钮:订单退款'
,
'no-icon'
,
''
,
''
,
'PB'
,
0
,
1
,
'ENT_PAY_ORDER'
,
'0'
,
'MCH'
,
now
(),
now
());
##
-- ++++ ++++
jeepay-manager/src/main/resources/banner.txt
View file @
ad189f7d
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
\____/ \___/\___/ .___/\__,_/\__, /
\____/ \___/\___/ .___/\__,_/\__, /
/_/ /____/
/_/ /____/
:: Jeepay :: (v1.7.
0
.RELEASE)
:: Jeepay :: (v1.7.
1
.RELEASE)
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
jeepay-merchant/src/main/java/com/jeequan/jeepay/mch/ctrl/order/PayOrderController.java
View file @
ad189f7d
...
@@ -18,21 +18,29 @@ package com.jeequan.jeepay.mch.ctrl.order;
...
@@ -18,21 +18,29 @@ package com.jeequan.jeepay.mch.ctrl.order;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.jeequan.jeepay.JeepayClient
;
import
com.jeequan.jeepay.core.aop.MethodLog
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.constants.ApiCodeEnum
;
import
com.jeequan.jeepay.core.entity.MchApp
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.entity.PayOrder
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.entity.PayWay
;
import
com.jeequan.jeepay.core.exception.BizException
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.core.model.ApiRes
;
import
com.jeequan.jeepay.core.utils.SeqKit
;
import
com.jeequan.jeepay.exception.JeepayException
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.mch.ctrl.CommonCtrl
;
import
com.jeequan.jeepay.model.RefundOrderCreateReqModel
;
import
com.jeequan.jeepay.request.RefundOrderCreateRequest
;
import
com.jeequan.jeepay.response.RefundOrderCreateResponse
;
import
com.jeequan.jeepay.service.impl.MchAppService
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
com.jeequan.jeepay.service.impl.PayOrderService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
com.jeequan.jeepay.service.impl.PayWayService
;
import
com.jeequan.jeepay.service.impl.SysConfigService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -50,8 +58,9 @@ import java.util.Map;
...
@@ -50,8 +58,9 @@ import java.util.Map;
public
class
PayOrderController
extends
CommonCtrl
{
public
class
PayOrderController
extends
CommonCtrl
{
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
PayOrderService
payOrderService
;
@Autowired
private
PayWayService
payWayService
;
@Autowired
private
PayWayService
payWayService
;
@Autowired
private
MchAppService
mchAppService
;
@Autowired
private
SysConfigService
sysConfigService
;
/**
/**
* @Author: ZhuXiao
* @Author: ZhuXiao
...
@@ -138,4 +147,60 @@ public class PayOrderController extends CommonCtrl {
...
@@ -138,4 +147,60 @@ public class PayOrderController extends CommonCtrl {
return
ApiRes
.
ok
(
payOrder
);
return
ApiRes
.
ok
(
payOrder
);
}
}
/**
* 发起订单退款
* @author terrfly
* @site https://www.jeequan.com
* @date 2021/6/17 16:38
*/
@MethodLog
(
remark
=
"发起订单退款"
)
@PreAuthorize
(
"hasAuthority('ENT_PAY_ORDER_REFUND')"
)
@PostMapping
(
"/refunds/{payOrderId}"
)
public
ApiRes
refund
(
@PathVariable
(
"payOrderId"
)
String
payOrderId
)
{
Long
refundAmount
=
getRequiredAmountL
(
"refundAmount"
);
String
refundReason
=
getValStringRequired
(
"refundReason"
);
PayOrder
payOrder
=
payOrderService
.
getById
(
payOrderId
);
if
(
payOrder
==
null
||
!
payOrder
.
getMchNo
().
equals
(
getCurrentMchNo
()))
{
return
ApiRes
.
fail
(
ApiCodeEnum
.
SYS_OPERATION_FAIL_SELETE
);
}
if
(
payOrder
.
getState
()
!=
PayOrder
.
STATE_SUCCESS
){
throw
new
BizException
(
"订单状态不正确"
);
}
if
(
payOrder
.
getRefundAmount
()
+
refundAmount
>
payOrder
.
getAmount
()){
throw
new
BizException
(
"退款金额超过订单可退款金额!"
);
}
RefundOrderCreateRequest
request
=
new
RefundOrderCreateRequest
();
RefundOrderCreateReqModel
model
=
new
RefundOrderCreateReqModel
();
request
.
setBizModel
(
model
);
model
.
setMchNo
(
payOrder
.
getMchNo
());
// 商户号
model
.
setAppId
(
payOrder
.
getAppId
());
model
.
setPayOrderId
(
payOrderId
);
model
.
setMchRefundNo
(
SeqKit
.
genMhoOrderId
());
model
.
setRefundAmount
(
refundAmount
);
model
.
setRefundReason
(
refundReason
);
model
.
setCurrency
(
"CNY"
);
MchApp
mchApp
=
mchAppService
.
getById
(
payOrder
.
getAppId
());
JeepayClient
jeepayClient
=
new
JeepayClient
(
sysConfigService
.
getDBApplicationConfig
().
getPaySiteUrl
(),
mchApp
.
getAppSecret
());
try
{
RefundOrderCreateResponse
response
=
jeepayClient
.
execute
(
request
);
if
(
response
.
getCode
()
!=
0
){
throw
new
BizException
(
response
.
getMsg
());
}
return
ApiRes
.
ok
(
response
.
get
());
}
catch
(
JeepayException
e
)
{
throw
new
BizException
(
e
.
getMessage
());
}
}
}
}
jeepay-merchant/src/main/resources/banner.txt
View file @
ad189f7d
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
\____/ \___/\___/ .___/\__,_/\__, /
\____/ \___/\___/ .___/\__,_/\__, /
/_/ /____/
/_/ /____/
:: Jeepay :: (v1.7.
0
.RELEASE)
:: Jeepay :: (v1.7.
1
.RELEASE)
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
jeepay-payment/src/main/resources/banner.txt
View file @
ad189f7d
...
@@ -4,5 +4,5 @@
...
@@ -4,5 +4,5 @@
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
/ /_/ // __/ __/ /_/ / /_/ / /_/ /
\____/ \___/\___/ .___/\__,_/\__, /
\____/ \___/\___/ .___/\__,_/\__, /
/_/ /____/
/_/ /____/
:: Jeepay :: (v1.7.
0
.RELEASE)
:: Jeepay :: (v1.7.
1
.RELEASE)
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
适合互联网企业使用的开源支付系统 : https://www.jeequan.com
pom.xml
View file @
ad189f7d
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<!-- 配置属性声明, 支持自定义参数 -->
<!-- 配置属性声明, 支持自定义参数 -->
<properties>
<properties>
<isys.version>
1.7.
0
</isys.version>
<!-- 指定当前[项目]版本号 -->
<isys.version>
1.7.
1
</isys.version>
<!-- 指定当前[项目]版本号 -->
<java.version>
1.8
</java.version>
<!-- 指定java版本号 -->
<java.version>
1.8
</java.version>
<!-- 指定java版本号 -->
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<!-- 项目构建输出编码 -->
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<!-- 项目构建输出编码 -->
...
...
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