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
8c9fbe03
Commit
8c9fbe03
authored
Mar 16, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7594d361
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
CouponServiceImpl.java
...com/gogirl/application/market/impl/CouponServiceImpl.java
+14
-3
MarketServiceImpl.java
...com/gogirl/application/market/impl/MarketServiceImpl.java
+6
-4
Coupon.java
src/main/java/com/gogirl/domain/market/coupon/Coupon.java
+1
-1
No files found.
src/main/java/com/gogirl/application/market/impl/CouponServiceImpl.java
View file @
8c9fbe03
...
@@ -3,8 +3,6 @@ package com.gogirl.application.market.impl;
...
@@ -3,8 +3,6 @@ package com.gogirl.application.market.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.gogirl.application.market.CouponService
;
import
com.gogirl.application.market.CouponService
;
import
com.gogirl.application.market.MarketService
;
import
com.gogirl.application.market.MarketService
;
import
com.gogirl.domain.market.coupon.Coupon
;
import
com.gogirl.domain.market.coupon.Coupon
;
...
@@ -224,7 +222,20 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
...
@@ -224,7 +222,20 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
})
})
.
peek
(
coupon
->
{
.
peek
(
coupon
->
{
List
<
Integer
>
canUserServeIds
=
couponCustomerRelevanceMapper
.
queryCouponCustomerServeRelevance
(
coupon
.
getId
());
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
filter
(
orderServe
->
orderServe
.
getBindCoupon
()
==
2
)
.
filter
(
orderServe
->
{
if
(
orderServe
.
getProduceId
()
!=
null
)
{
return
orderServe
.
getProduceCurrentPrice
().
compareTo
(
orderServe
.
getProduceBargainPrice
())
>
-
1
;
}
return
true
;
})
.
filter
(
orderServe
->
orderServe
.
getProducePromotionTimeId
()
==
null
)
.
filter
(
orderServe
->
orderServe
.
getLeisureDiscountConfigId
()
==
null
||
orderServe
.
getLeisureDiscountConfigId
()
==
0
)
.
map
(
OrderServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
()));
coupon
.
setCanBeUse
(
ListUtil
.
isNotEmpty
(
canUserServeIds
));
})
})
//过滤达到可用金额
//过滤达到可用金额
.
filter
(
coupon
->
coupon
.
getReachingAmount
().
compareTo
(
orderManage
.
getTotalPrice
())
<
0
)
.
filter
(
coupon
->
coupon
.
getReachingAmount
().
compareTo
(
orderManage
.
getTotalPrice
())
<
0
)
...
...
src/main/java/com/gogirl/application/market/impl/MarketServiceImpl.java
View file @
8c9fbe03
...
@@ -540,18 +540,20 @@ public class MarketServiceImpl implements MarketService {
...
@@ -540,18 +540,20 @@ public class MarketServiceImpl implements MarketService {
//每个服务的内部券抵扣金额
//每个服务的内部券抵扣金额
BigDecimal
discountAmount
=
orderServe
.
getPayPrice
().
multiply
(
totalCouponDiscount
).
divide
(
total
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
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
);
BigDecimal
payAmount
=
orderServe
.
getPayPrice
().
multiply
(
totalCouponPay
).
divide
(
total
,
2
,
BigDecimal
.
ROUND_HALF_UP
);
//最后一个服务使用总额减法而不是除法
//最后一个服务使用总额减法而不是除法
if
(
canUserOrderServeList
.
lastIndexOf
(
orderServe
)
==
canUserOrderServeList
.
size
()
-
1
)
{
if
(
canUserOrderServeList
.
lastIndexOf
(
orderServe
)
==
canUserOrderServeList
.
size
()
-
1
)
{
discountAmount
=
totalCouponDiscount
.
subtract
(
discountCalc
);
discountAmount
=
totalCouponDiscount
.
subtract
(
discountCalc
);
payAmount
=
totalCouponPay
.
subtract
(
payCalc
);
payAmount
=
totalCouponPay
.
subtract
(
payCalc
);
}
}
BigDecimal
actualDiscountAmount
=
discountAmount
.
min
(
orderServe
.
getPayPrice
());
//卡券在订单服务上的抵扣情况
//卡券在订单服务上的抵扣情况
CouponOrderRelevance
couponOrderRelevance
=
CouponOrderRelevance
.
builder
()
CouponOrderRelevance
couponOrderRelevance
=
CouponOrderRelevance
.
builder
()
.
discountAmount
(
discountAmount
.
min
(
orderServe
.
getPayPrice
())
)
.
discountAmount
(
actualDiscountAmount
)
//卡券在这个服务上的实际支付金额
//卡券在这个服务上的实际支付金额
.
payForOrderServe
(
payAmount
)
.
payForOrderServe
(
payAmount
)
.
createTime
(
new
Date
())
.
createTime
(
new
Date
())
...
@@ -574,8 +576,8 @@ public class MarketServiceImpl implements MarketService {
...
@@ -574,8 +576,8 @@ public class MarketServiceImpl implements MarketService {
//保存卡券在订单服务上的使用请款
//保存卡券在订单服务上的使用请款
couponOrderRelevanceService
.
save
(
couponOrderRelevance
);
couponOrderRelevanceService
.
save
(
couponOrderRelevance
);
orderServe
.
addDiscountPrice
(
d
iscountAmount
);
orderServe
.
addDiscountPrice
(
actualD
iscountAmount
);
orderManage
.
addDiscountPrice
(
d
iscountAmount
);
orderManage
.
addDiscountPrice
(
actualD
iscountAmount
);
orderServe
.
setBindCoupon
(
1
);
orderServe
.
setBindCoupon
(
1
);
discountCalc
=
discountCalc
.
add
(
discountAmount
);
discountCalc
=
discountCalc
.
add
(
discountAmount
);
...
...
src/main/java/com/gogirl/domain/market/coupon/Coupon.java
View file @
8c9fbe03
...
@@ -71,6 +71,6 @@ public class Coupon {
...
@@ -71,6 +71,6 @@ public class Coupon {
private
Integer
isCalcAchievement
;
private
Integer
isCalcAchievement
;
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
Integer
canBeUse
;
private
Boolean
canBeUse
;
}
}
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