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
f19ff496
Commit
f19ff496
authored
Apr 24, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a93b860c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
+6
-0
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
+6
-4
No files found.
soss-system/src/main/java/com/soss/system/domain/OrderDetail.java
View file @
f19ff496
...
...
@@ -83,6 +83,12 @@ public class OrderDetail {
private
BigDecimal
realAmount
;
/**
* 原优惠价
*/
@Excel
(
name
=
"原优惠价"
)
private
BigDecimal
origDiscount
;
/**
* 规格选项详情
*/
@Excel
(
name
=
"规格选项详情"
)
...
...
soss-system/src/main/java/com/soss/system/service/impl/CouponUserServiceImpl.java
View file @
f19ff496
...
...
@@ -212,6 +212,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
}
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
);
if
(
couponVo
.
getPriceLimit
()
!=
null
&&
couponVo
.
getPriceLimit
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
&&
couponVo
.
getPriceLimit
().
compareTo
(
fitGoodsAmount
)
>
0
)
{
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
couponVo
.
setNotFitableDesc
(
"未达到满减要求"
);
...
...
@@ -221,7 +222,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
return
;
}
this
.
wrapperCouponAmount
(
couponVo
,
fitOrderDetails
,
fitGoodsAmount
);
this
.
wrapperCouponAmount
(
couponVo
,
fitOrderDetails
,
fitGoodsAmount
,
fitGoodsOrigDiscount
);
Map
<
Long
,
BigDecimal
>
couponAmountMap
=
couponVo
.
getCouponAmountMap
();
orderDetails
.
forEach
(
orderDetail
->
{
...
...
@@ -257,19 +258,20 @@ public class CouponUserServiceImpl implements ICouponUserService {
return
goodsSkus
;
}
private
void
wrapperCouponAmount
(
CouponVo
couponVo
,
List
<
OrderDetail
>
fitOrderDetails
,
BigDecimal
fitGoodsAmount
)
{
private
void
wrapperCouponAmount
(
CouponVo
couponVo
,
List
<
OrderDetail
>
fitOrderDetails
,
BigDecimal
fitGoodsAmount
,
BigDecimal
fitGoodsOrigDiscount
)
{
Map
<
Long
,
BigDecimal
>
couponAmountMap
=
new
HashMap
<>();
if
(
couponVo
.
getOrderLimit
()
!=
null
&&
couponVo
.
getOrderLimit
())
{
// 单杯
OrderDetail
orderDetail
=
fitOrderDetails
.
stream
().
max
(
Comparator
.
comparing
(
OrderDetail:
:
getUnitPrice
)).
get
();
BigDecimal
discountAmount
=
orderDetail
.
getUnitPrice
();
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
discountAmount
=
orderDetail
.
getOrigDiscount
();
// 折扣使用折扣价(非特惠价格)
discountAmount
=
this
.
getDiscountAmount
(
discountAmount
,
couponVo
.
getPriceDiscount
()).
min
(
BigDecimal
.
valueOf
(
50
));
}
couponVo
.
setCouponAmount
(
discountAmount
);
couponAmountMap
.
put
(
orderDetail
.
getSkuId
(),
couponVo
.
getCouponAmount
());
}
else
{
// 整单
if
(
couponVo
.
getType
().
equals
(
CouponCategoryType
.
DISCOUNT
.
getType
()))
{
// 折扣
BigDecimal
couponAmount
=
this
.
getDiscountAmount
(
fitGoods
Am
ount
,
couponVo
.
getPriceDiscount
());
BigDecimal
couponAmount
=
this
.
getDiscountAmount
(
fitGoods
OrigDisc
ount
,
couponVo
.
getPriceDiscount
());
couponAmount
=
couponAmount
.
min
(
BigDecimal
.
valueOf
(
50
));
// 折扣类整单最高抵扣50元
couponVo
.
setCouponAmount
(
couponAmount
);
fitOrderDetails
.
forEach
(
orderDetail
->
orderDetail
.
setCouponAmount
(
this
.
getDiscountAmount
(
orderDetail
.
getAmountShould
(),
couponVo
.
getPriceDiscount
())));
...
...
@@ -281,7 +283,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
orderDetail
.
setCouponAmount
(
orderDetail
.
getCouponAmount
().
add
(
couponVo
.
getCouponAmount
().
subtract
(
detailCouponSum
)));
}
}
else
{
// 免单
couponVo
.
setCouponAmount
(
fitGoods
Am
ount
);
couponVo
.
setCouponAmount
(
fitGoods
OrigDisc
ount
);
}
fitOrderDetails
.
forEach
(
orderDetail
->
couponAmountMap
.
put
(
orderDetail
.
getSkuId
(),
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