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
d9ceb47c
Commit
d9ceb47c
authored
Mar 31, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
折扣券
parent
10f56e85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
MarketServiceImpl.java
...com/gogirl/application/market/impl/MarketServiceImpl.java
+14
-13
StoreClassesServiceImpl.java
...application/store/store/impl/StoreClassesServiceImpl.java
+4
-2
CouponCustomerRelevance.java
.../gogirl/domain/market/coupon/CouponCustomerRelevance.java
+1
-1
No files found.
src/main/java/com/gogirl/application/market/impl/MarketServiceImpl.java
View file @
d9ceb47c
...
...
@@ -305,7 +305,7 @@ public class MarketServiceImpl implements MarketService {
orderServe
.
setBindOuterCoupon
(
2
);
});
//1
.
改价结算
//1
、
改价结算
//总支付金额等于 总价格+总改价
orderManage
.
setTotalPaymentAmount
(
orderManage
.
getTotalPrice
().
add
(
orderManage
.
getChangePrice
()));
//总折扣金额
...
...
@@ -325,7 +325,7 @@ public class MarketServiceImpl implements MarketService {
}
});
//
3.
次卡
//
2、
次卡
if
(
ListUtil
.
isNotEmpty
(
timesCardUsedRecordList
))
{
//次卡使用记录
timesCardUsedRecordList
.
forEach
(
timesCardUsedRecord
->
timesCardUsedRecord
.
setStatus
(
TimesCardUsedRecord
.
STATUS_CHOSE
));
...
...
@@ -396,7 +396,7 @@ public class MarketServiceImpl implements MarketService {
couponOrderRelevanceService
.
remove
(
new
LambdaQueryWrapper
<
CouponOrderRelevance
>()
.
eq
(
CouponOrderRelevance:
:
getOrderId
,
orderId
));
//
4。
外部券
//
3、
外部券
if
(
ListUtil
.
isNotEmpty
(
outerCouponCustomerRelevanceServiceList
))
{
//删除之前的外部券抵扣情况记录
...
...
@@ -418,10 +418,11 @@ public class MarketServiceImpl implements MarketService {
OrderServe
orderServe
=
this
.
queryMaxPayPrice
(
orderManage
,
serveIds
);
if
(
orderServe
!=
null
)
{
//如果有属于这个服务的辅助服务 就查出来一起折扣
OrderServe
supportServe
=
this
.
querySupportServe
(
orderManage
,
orderServe
);
BigDecimal
actualDiscountAmount
=
orderServe
.
getPayPrice
().
min
(
couponCustomerRelevance
.
getDiscountAmount
());
BigDecimal
discountAmount
=
couponCustomerRelevance
.
getDiscountAmount
();
// if (couponCustomerRelevance.getType() == 5) {
// discountAmount = orderServe.getPrice().multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
// }
BigDecimal
actualDiscountAmount
=
orderServe
.
getPayPrice
().
min
(
discountAmount
);
//新增外部券抵扣情况记录
CouponOrderRelevance
couponOrderRelevance
=
CouponOrderRelevance
.
builder
()
...
...
@@ -462,7 +463,7 @@ public class MarketServiceImpl implements MarketService {
});
}
//
5.
内部券
//
4、
内部券
if
(
ListUtil
.
isNotEmpty
(
innerCouponCustomerRelevanceServiceList
))
{
//删除之前的内部券抵扣情况记录
...
...
@@ -484,12 +485,14 @@ public class MarketServiceImpl implements MarketService {
if
(!
total
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
equals
(
BigDecimal
.
ZERO
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
)))
{
//卡券的总折扣金额
BigDecimal
totalCouponDiscount
=
couponCustomerRelevance
.
getDiscountAmount
();
// if (couponCustomerRelevance.getType() == 5) {
// totalCouponDiscount = canUserOrderServeList.stream().map(OrderServe::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add)
// .multiply(BigDecimal.ONE.subtract(couponCustomerRelevance.getDiscountPercent()));
// }
//卡券总支付金额
BigDecimal
totalCouponPay
=
couponCustomerRelevance
.
getPayAmount
();
//计算参数(最后一个订单服务的折扣金额要用总折扣金额减 防止除法计算精度问题)
BigDecimal
discountCalc
=
BigDecimal
.
ZERO
;
//计算参数(最后一个订单服务的实际支付要用总实际支付金额减 防止除法计算精度问题)
BigDecimal
payCalc
=
BigDecimal
.
ZERO
;
...
...
@@ -499,15 +502,13 @@ public class MarketServiceImpl implements MarketService {
BigDecimal
discountAmount
=
orderServe
.
getPayPrice
().
multiply
(
totalCouponDiscount
).
divide
(
total
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
//每个服务的卡券实际支付金额
BigDecimal
payAmount
=
orderServe
.
getPayPrice
().
multiply
(
totalCouponPay
).
divide
(
total
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
//最后一个服务使用总额减法而不是除法
if
(
canUserOrderServeList
.
lastIndexOf
(
orderServe
)
==
canUserOrderServeList
.
size
()
-
1
)
{
discountAmount
=
totalCouponDiscount
.
subtract
(
discountCalc
);
payAmount
=
totalCouponPay
.
subtract
(
payCalc
);
}
BigDecimal
actualDiscountAmount
=
discountAmount
.
min
(
orderServe
.
getPayPrice
());
BigDecimal
actualDiscountAmount
=
discountAmount
.
min
(
orderServe
.
getPayPrice
());
//卡券在订单服务上的抵扣情况
CouponOrderRelevance
couponOrderRelevance
=
CouponOrderRelevance
.
builder
()
.
discountAmount
(
actualDiscountAmount
)
...
...
src/main/java/com/gogirl/application/store/store/impl/StoreClassesServiceImpl.java
View file @
d9ceb47c
...
...
@@ -23,9 +23,11 @@ public class StoreClassesServiceImpl extends ServiceImpl<StoreClassesMapper, Sto
@Override
public
List
<
StoreClassesTechnician
>
queryMonthClasses
(
Integer
technicianId
,
Integer
departmentId
,
String
month
)
{
List
<
StoreClasses
>
classList
=
this
.
list
(
new
LambdaQueryWrapper
<
StoreClasses
>().
eq
(
StoreClasses:
:
getDepartmentId
,
departmentId
));
List
<
StoreClasses
>
classList
=
this
.
list
(
new
LambdaQueryWrapper
<
StoreClasses
>()
.
eq
(
StoreClasses:
:
getDepartmentId
,
departmentId
));
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<
Integer
,
Integer
>();
//处理一个对应关系只返回012
//处理一个对应关系只返回012
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<>();
map
.
put
(
0
,
0
);
for
(
int
i
=
0
;
i
<
classList
.
size
();
i
++)
{
StoreClasses
item
=
classList
.
get
(
i
);
...
...
src/main/java/com/gogirl/domain/market/coupon/CouponCustomerRelevance.java
View file @
d9ceb47c
...
...
@@ -83,7 +83,7 @@ public class CouponCustomerRelevance implements Serializable {
@ApiModelProperty
(
"优惠折扣"
)
private
BigDecimal
discountPercent
;
@ApiModelProperty
(
"优惠券类型:1.现金抵扣券;2.免单券;3满减券;4卸甲券"
)
@ApiModelProperty
(
"优惠券类型:1.现金抵扣券;2.免单券;3满减券;4卸甲券
5折扣券
"
)
private
Integer
type
;
@ApiModelProperty
(
"0 = 内部券 1 = 外部券"
)
...
...
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