Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
15d67332
Commit
15d67332
authored
Jul 06, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信支付校验
parent
32b30971
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
13 deletions
+22
-13
PayServiceImpl.java
...m/gogirl/application/order/serve/impl/PayServiceImpl.java
+22
-13
No files found.
src/main/java/com/gogirl/application/order/serve/impl/PayServiceImpl.java
View file @
15d67332
...
...
@@ -66,6 +66,9 @@ public class PayServiceImpl implements PayService {
throw
new
RRException
(
"订单状态异常"
);
}
this
.
checkCustomerBalance
(
currentCustomerId
,
orderId
);
/*1、扣除余额*/
ConsumerCommand
consumerCmd
=
ConsumerCommand
.
builder
()
.
amount
(
orderManage
.
getTotalPaymentAmount
().
multiply
(
new
BigDecimal
(
100
)).
intValue
())
...
...
@@ -136,6 +139,22 @@ public class PayServiceImpl implements PayService {
}
private
void
checkCustomerBalance
(
Integer
customerId
,
Integer
orderId
)
throws
RRException
{
OrderManage
orderManage
=
orderManageService
.
getById
(
orderId
);
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
customerId
));
if
(
customerBalance
==
null
)
{
throw
new
RRException
(
"您不是会员,请直接使用pos支付"
);
}
if
(
orderManage
.
getTotalPaymentAmount
().
multiply
(
new
BigDecimal
(
100
)).
intValue
()
<
customerBalance
.
getBalance
())
{
throw
new
RRException
(
"请使用余额支付"
);
}
if
(
customerBalance
.
getBalance
()
<=
0
)
{
throw
new
RRException
(
"余额为0,请直接使用pos支付"
);
}
}
@Override
public
WxPayMpOrderResult
balanceWxPay
(
BalanceWxPayQuery
qry
)
throws
UnknownHostException
,
WxPayException
{
...
...
@@ -146,15 +165,9 @@ public class PayServiceImpl implements PayService {
}
//2、余额检查
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
orderManage
.
getOrderUser
()));
if
(
customerBalance
==
null
)
{
throw
new
RRException
(
"余额不存在"
);
}
this
.
checkCustomerBalance
(
qry
.
getCustomerId
(),
qry
.
getOrderId
());
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
qry
.
getCustomerId
()));
if
(
orderManage
.
getTotalPaymentAmount
().
multiply
(
new
BigDecimal
(
100
)).
intValue
()
<
customerBalance
.
getBalance
())
{
throw
new
RRException
(
"请使用余额支付"
);
}
//3、微信统一下单
BigDecimal
leftTotalPaymentAmount
=
orderManage
.
getTotalPaymentAmount
().
subtract
(
new
BigDecimal
(
customerBalance
.
getBalance
()).
divide
(
new
BigDecimal
(
100
),
2
,
BigDecimal
.
ROUND_HALF_UP
));
...
...
@@ -193,12 +206,8 @@ public class PayServiceImpl implements PayService {
throw
new
RRException
(
"订单状态异常"
);
}
//2、余额检查
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>().
eq
(
CustomerBalance:
:
getCustomerId
,
currentCustomerId
));
if
(
orderManage
.
getTotalPaymentAmount
().
multiply
(
new
BigDecimal
(
100
)).
intValue
()
<
customerBalance
.
getBalance
())
{
throw
new
RRException
(
"请使用余额支付"
);
}
this
.
checkCustomerBalance
(
currentCustomerId
,
orderId
);
//3、更新订单
//支付类型:请余额pos支付
...
...
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