Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
hooloo
ms
soss
Commits
e7652b77
Commit
e7652b77
authored
May 15, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
46ea78e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
15 deletions
+7
-15
soss-admin/src/main/test/JavaTest.java
+0
-0
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+7
-15
No files found.
soss-admin/src/main/test/JavaTest.java
View file @
e7652b77
This diff is collapsed.
Click to expand it.
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
e7652b77
...
...
@@ -187,8 +187,8 @@ public class CouponUserServiceImpl implements ICouponUserService {
List
<
Goods
>
goods
=
goodsMapper
.
selectGoodsByIds
(
goodsIds
);
Assert
.
notEmpty
(
goods
,
"未查询到匹配的商品信息[id="
+
goodsIds
+
"]"
);
// 订单总额
BigDecimal
orderTotalAmount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
orderTotalOrigDiscount
=
orderDetails
.
stream
().
map
(
OrderDetail:
:
getOrigDiscount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
orderTotalAmount
=
orderDetails
.
stream
().
map
(
x
->
x
.
getAmountShould
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
orderTotalOrigDiscount
=
orderDetails
.
stream
().
map
(
x
->
x
.
getOrigDiscount
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
log
.
info
(
"orderTotalAmount:{}, orderTotalOrigDiscount:{}"
,
orderTotalAmount
,
orderTotalOrigDiscount
);
couponVos
.
stream
().
filter
(
couponVo
->
StringUtils
.
isEmpty
(
couponVo
.
getNotFitableDesc
())).
forEach
(
couponVo
->
{
/** 可用饮品范围的判断 */
...
...
@@ -213,8 +213,8 @@ public class CouponUserServiceImpl implements ICouponUserService {
couponVo
.
setCouponAmount
(
couponVo
.
getPriceDiscount
().
min
(
orderTotalOrigDiscount
));
}
else
{
List
<
OrderDetail
>
fitOrderDetails
=
orderDetails
.
stream
().
filter
(
orderDetail
->
fitCouponGoodsIdList
.
contains
(
orderDetail
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
BigDecimal
fitGoodsAmount
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getAmountShould
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsOrigDiscount
=
fitOrderDetails
.
stream
().
map
(
OrderDetail:
:
getOrigDiscount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsAmount
=
fitOrderDetails
.
stream
().
map
(
x
->
x
.
getAmountShould
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
fitGoodsOrigDiscount
=
fitOrderDetails
.
stream
().
map
(
x
->
x
.
getOrigDiscount
().
multiply
(
new
BigDecimal
(
x
.
getNum
()))
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
log
.
info
(
"fitGoodsOrigDiscount:{}, fitGoodsAmount:{}"
,
fitGoodsOrigDiscount
,
fitGoodsAmount
);
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
fitGoodsAmount
)
>
0
)
{
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
...
...
@@ -231,18 +231,10 @@ public class CouponUserServiceImpl implements ICouponUserService {
orderDetails
.
forEach
(
orderDetail
->
{
BigDecimal
couponAmount
=
couponAmountMap
.
get
(
orderDetail
.
getSkuId
());
orderDetail
.
setCouponAmount
(
couponAmount
==
null
?
BigDecimal
.
ZERO
:
couponAmount
.
negate
());
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
orderDetail
.
getOriAmount
().
add
(
orderDetail
.
getCouponAmount
()).
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
orderDetail
.
setRealAmount
(
BigDecimal
.
ZERO
);
}
else
{
orderDetail
.
setRealAmount
(
orderDetail
.
getOriAmount
().
add
(
orderDetail
.
getCouponAmount
()));
}
if
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()).
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
orderDetail
.
setRealAmount
(
BigDecimal
.
ZERO
);
}
else
{
if
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()).
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
orderDetail
.
setRealAmount
(
BigDecimal
.
ZERO
);
}
else
{
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
}
orderDetail
.
setRealAmount
(
orderDetail
.
getAmountShould
().
add
(
orderDetail
.
getCouponAmount
()));
}
});
}
...
...
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