Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
1b0f5d78
Commit
1b0f5d78
authored
Oct 28, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master-alipay-change' into master-alipay-change
parents
3537314d
758ecec5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
25 deletions
+29
-25
OrderPayBiz.java
...ain/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
+11
-8
OrderRefundBiz.java
.../java/com/xxfc/platform/universal/biz/OrderRefundBiz.java
+18
-17
No files found.
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
View file @
1b0f5d78
...
@@ -69,7 +69,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
...
@@ -69,7 +69,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
private
String
wy_secret
;
private
String
wy_secret
;
public
JSONObject
preparepay
(
OrderPayVo
orderPayVo
)
{
public
JSONObject
preparepay
(
OrderPayVo
orderPayVo
)
{
if
(
null
==
orderPayVo
)
{
if
(
null
==
orderPayVo
)
{
log
.
error
(
"-----参数为空-----------"
);
log
.
error
(
"-----参数为空-----------"
);
...
@@ -347,7 +346,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
...
@@ -347,7 +346,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
}
}
//解冻预授权
//解冻预授权
public
String
fundAuthOrderUnFreeze
(
String
outTradeNo
,
String
serialNumber
,
Integer
refundAmount
,
String
refundReason
,
String
notifyUrl
)
throws
AlipayApiException
{
public
boolean
fundAuthOrderUnFreeze
(
String
outTradeNo
,
String
serialNumber
,
Integer
refundAmount
,
String
refundReason
)
throws
AlipayApiException
{
String
notifyUrl
=
weixinHost
+
"/api/universal/pay/app/unauth/notify/alipay"
;
AlipayClient
alipayClient
=
getAlipayClient
();
AlipayClient
alipayClient
=
getAlipayClient
();
BigDecimal
realAmount
=
new
BigDecimal
(
refundAmount
.
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
BigDecimal
realAmount
=
new
BigDecimal
(
refundAmount
.
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
AlipayFundAuthOrderUnfreezeRequest
request
=
new
AlipayFundAuthOrderUnfreezeRequest
();
AlipayFundAuthOrderUnfreezeRequest
request
=
new
AlipayFundAuthOrderUnfreezeRequest
();
...
@@ -365,16 +365,17 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
...
@@ -365,16 +365,17 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
if
(
response
.
isSuccess
())
{
if
(
response
.
isSuccess
())
{
log
.
info
(
"调用成功"
);
log
.
info
(
"调用成功"
);
log
.
info
(
"response: {}"
+
response
.
getBody
());
//签名后的参数,直接入参到
log
.
info
(
"response: {}"
+
response
.
getBody
());
//签名后的参数,直接入参到
return
response
.
getBody
()
;
return
true
;
}
else
{
}
else
{
log
.
info
(
"调用失败"
);
log
.
info
(
"调用失败"
);
return
null
;
return
false
;
}
}
}
}
//取消预授权
//取消预授权
public
String
fundAuthCancel
(
String
outTradeNo
,
String
serialNumber
,
String
refundReason
,
String
notifyUrl
)
throws
AlipayApiException
{
public
String
fundAuthCancel
(
String
outTradeNo
,
String
serialNumber
,
String
refundReason
)
throws
AlipayApiException
{
AlipayClient
alipayClient
=
getAlipayClient
();
AlipayClient
alipayClient
=
getAlipayClient
();
String
notifyUrl
=
weixinHost
+
"/api/universal/pay/app/unauth/notify/alipay"
;
AlipayFundAuthOperationCancelRequest
request
=
new
AlipayFundAuthOperationCancelRequest
();
AlipayFundAuthOperationCancelRequest
request
=
new
AlipayFundAuthOperationCancelRequest
();
AlipayFundAuthOperationCancelModel
model
=
new
AlipayFundAuthOperationCancelModel
();
AlipayFundAuthOperationCancelModel
model
=
new
AlipayFundAuthOperationCancelModel
();
model
.
setAuthNo
(
outTradeNo
);
// 支付宝资金授权订单号,在授权冻结成功时返回参数中获得
model
.
setAuthNo
(
outTradeNo
);
// 支付宝资金授权订单号,在授权冻结成功时返回参数中获得
...
@@ -398,7 +399,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
...
@@ -398,7 +399,8 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
}
}
//预授权转支付
//预授权转支付
public
void
tradePay
(
String
outTradeNo
,
String
serialNumber
,
Integer
refundAmount
,
String
refundReason
,
String
subject
,
String
notifyUrl
)
throws
AlipayApiException
{
public
boolean
tradePay
(
String
outTradeNo
,
String
serialNumber
,
Integer
refundAmount
,
String
refundReason
,
String
subject
)
throws
AlipayApiException
{
String
notifyUrl
=
weixinHost
+
"/api/universal/pay/app/unauth/notify/alipay"
;
AlipayClient
alipayClient
=
getAlipayClient
();
AlipayClient
alipayClient
=
getAlipayClient
();
BigDecimal
realAmount
=
new
BigDecimal
(
refundAmount
.
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
BigDecimal
realAmount
=
new
BigDecimal
(
refundAmount
.
toString
()).
divide
(
new
BigDecimal
(
"100"
),
2
,
BigDecimal
.
ROUND_UP
);
AlipayTradePayRequest
request
=
new
AlipayTradePayRequest
();
AlipayTradePayRequest
request
=
new
AlipayTradePayRequest
();
...
@@ -418,10 +420,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
...
@@ -418,10 +420,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay> {
AlipayTradePayResponse
response
=
alipayClient
.
execute
(
request
);
AlipayTradePayResponse
response
=
alipayClient
.
execute
(
request
);
if
(
response
.
isSuccess
())
{
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"调用成功"
);
log
.
info
(
"response: {}"
+
response
.
getBody
());
log
.
info
(
"response: {}"
+
response
.
getBody
());
return
true
;
}
else
{
}
else
{
System
.
out
.
println
(
"调用失败"
);
log
.
info
(
"调用失败"
);
return
false
;
}
}
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderRefundBiz.java
View file @
1b0f5d78
...
@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
...
@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.OrderPay
;
import
com.xxfc.platform.universal.entity.OrderPay
;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.mapper.OrderRefundMapper
;
import
com.xxfc.platform.universal.mapper.OrderRefundMapper
;
...
@@ -21,10 +20,6 @@ import org.springframework.stereotype.Service;
...
@@ -21,10 +20,6 @@ import org.springframework.stereotype.Service;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
PAY_DEMOTION
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
UNIVERSAL_PAY
;
/**
/**
* 订单支付退款表
* 订单支付退款表
...
@@ -59,17 +54,17 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
...
@@ -59,17 +54,17 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
Integer
refundAmount
=
orderRefundVo
.
getRefundAmount
();
Integer
refundAmount
=
orderRefundVo
.
getRefundAmount
();
//临时处理
//临时处理
Map
<
String
,
Dictionary
>
dictionaryMap
=
dictionaryBiz
.
getAll4Map
();
//
Map<String, Dictionary> dictionaryMap = dictionaryBiz.getAll4Map();
Integer
demotion
=
Integer
.
valueOf
(
dictionaryMap
.
get
(
UNIVERSAL_PAY
+
"_"
+
PAY_DEMOTION
).
getDetail
());
//
Integer demotion = Integer.valueOf(dictionaryMap.get(UNIVERSAL_PAY + "_" + PAY_DEMOTION).getDetail());
payAmount
=
payAmount
/
demotion
;
//
payAmount = payAmount / demotion;
if
(
payAmount
<=
0
)
{
//
if (payAmount <= 0) {
payAmount
=
1
;
//
payAmount = 1;
}
//
}
//
refundAmount
=
refundAmount
/
demotion
;
//
refundAmount = refundAmount / demotion;
if
(
refundAmount
<=
0
)
{
//
if (refundAmount <= 0) {
refundAmount
=
1
;
//
refundAmount = 1;
}
//
}
String
refundDesc
=
StringUtils
.
isNotBlank
(
orderRefundVo
.
getRefundDesc
())
?
orderRefundVo
.
getRefundDesc
()
:
"审核通过,退款"
;
String
refundDesc
=
StringUtils
.
isNotBlank
(
orderRefundVo
.
getRefundDesc
())
?
orderRefundVo
.
getRefundDesc
()
:
"审核通过,退款"
;
String
out_refund_no
=
Snowflake
.
build
()
+
""
;
String
out_refund_no
=
Snowflake
.
build
()
+
""
;
...
@@ -95,7 +90,13 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
...
@@ -95,7 +90,13 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
}
else
if
(
orderPay
.
getPayWay
()
==
2
&&
orderPay
.
getPayType
()
==
2
)
{
}
else
if
(
orderPay
.
getPayWay
()
==
2
&&
orderPay
.
getPayType
()
==
2
)
{
log
.
info
(
"======支付宝预授权支付退款中==========="
);
log
.
info
(
"======支付宝预授权支付退款中==========="
);
//需要根据实际传过来的参数类型来进行解冻或者预授权转支付
//需要根据实际传过来的参数类型来进行解冻或者预授权转支付
flag
=
payBiz
.
alipayOrderRefund
(
out_trade_no
,
orderPay
.
getSerialNumber
(),
refundAmount
,
refundDesc
,
out_trade_no
+
System
.
currentTimeMillis
());
if
(
orderRefundVo
.
getRefundAmount
()
!=
0
)
{
//解冻金额
flag
=
payBiz
.
fundAuthOrderUnFreeze
(
orderPay
.
getTradeNo
()
+
System
.
currentTimeMillis
(),
orderPay
.
getSerialNumber
(),
orderPay
.
getAmount
(),
orderRefundVo
.
getRefundDesc
());
}
//预授权转支付
if
(
orderRefundVo
.
getFreeze2PayAmount
()
!=
0
)
{
flag
=
payBiz
.
tradePay
(
orderPay
.
getTradeNo
()
+
System
.
currentTimeMillis
(),
orderPay
.
getSerialNumber
(),
orderRefundVo
.
getFreeze2PayAmount
(),
refundDesc
,
refundDesc
);
}
}
else
if
(
orderPay
.
getPayWay
()
==
1
){
}
else
if
(
orderPay
.
getPayWay
()
==
1
){
log
.
info
(
"======微信退款中==========="
);
log
.
info
(
"======微信退款中==========="
);
flag
=
WxPayRefundUtils
.
refund
(
appid
,
mchId
,
partnerKey
,
out_trade_no
,
out_refund_no
,
payAmount
+
""
,
flag
=
WxPayRefundUtils
.
refund
(
appid
,
mchId
,
partnerKey
,
out_trade_no
,
out_refund_no
,
payAmount
+
""
,
...
...
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