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
Litemall
Commits
a0fc7d06
Commit
a0fc7d06
authored
May 24, 2019
by
Junling Bu
Browse files
fix[litemall-wx]: 大额优惠券导致订单费用为负
parent
92eaf10c
Changes
3
Hide whitespace changes
Inline
Side-by-side
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/WxOrderService.java
View file @
a0fc7d06
...
...
@@ -318,7 +318,7 @@ public class WxOrderService {
BigDecimal
integralPrice
=
new
BigDecimal
(
0.00
);
// 订单费用
BigDecimal
orderTotalPrice
=
checkedGoodsPrice
.
add
(
freightPrice
).
subtract
(
couponPrice
);
BigDecimal
orderTotalPrice
=
checkedGoodsPrice
.
add
(
freightPrice
).
subtract
(
couponPrice
)
.
max
(
new
BigDecimal
(
0.00
))
;
// 最终支付费用
BigDecimal
actualPrice
=
orderTotalPrice
.
subtract
(
integralPrice
);
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java
View file @
a0fc7d06
...
...
@@ -495,7 +495,8 @@ public class WxCartController {
BigDecimal
integralPrice
=
new
BigDecimal
(
0.00
);
// 订单费用
BigDecimal
orderTotalPrice
=
checkedGoodsPrice
.
add
(
freightPrice
).
subtract
(
couponPrice
);
BigDecimal
orderTotalPrice
=
checkedGoodsPrice
.
add
(
freightPrice
).
subtract
(
couponPrice
).
max
(
new
BigDecimal
(
0.00
));
BigDecimal
actualPrice
=
orderTotalPrice
.
subtract
(
integralPrice
);
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
...
...
litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/BigDecimalTest.java
0 → 100644
View file @
a0fc7d06
package
org.linlinjava.litemall.wx
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.math.BigDecimal
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
BigDecimalTest
{
@Test
public
void
test
()
{
BigDecimal
a
=
new
BigDecimal
(
0
);
BigDecimal
b
=
new
BigDecimal
(
1
);
BigDecimal
c
=
a
.
subtract
(
b
);
BigDecimal
d
=
c
.
max
(
new
BigDecimal
(
0
));
System
.
out
.
println
(
c
);
System
.
out
.
println
(
d
);
}
}
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