Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
9007e5a0
Commit
9007e5a0
authored
Dec 11, 2023
by
box
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
启用金额校验
parent
840ea36e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
+12
-2
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/CouponServiceImpl.java
View file @
9007e5a0
...
...
@@ -47,6 +47,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.LocalTime
;
import
java.util.*
;
...
...
@@ -346,12 +348,13 @@ public class CouponServiceImpl implements CouponService {
}
List
<
CouponStateVo
>
couponStateVos
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
queryResponse
.
getResult
().
getAvailableCoupons
()))
{
List
<
Product
>
productList
=
Lists
.
newArrayList
();
Long
totalAmount
=
createProductRequest
(
cartGoods
,
productList
,
isNew
);
queryResponse
.
getResult
().
getAvailableCoupons
().
forEach
(
dto
->
{
CouponInfoDto
couponInfo
=
dto
.
getCouponInfo
();
CouponStateVo
vo
=
new
CouponStateVo
();
vo
.
setCouponCode
(
couponInfo
.
getCode
());
vo
.
setType
(
couponInfo
.
getType
());
vo
.
setState
(
CouponStateEnum
.
STATE_0
.
getCode
());
vo
.
setMinAmount
(
couponInfo
.
getMinAmount
());
vo
.
setAmount
(
couponInfo
.
getFaceValue
());
vo
.
setPriceDiscount
(
couponInfo
.
getFaceValue
());
...
...
@@ -360,6 +363,13 @@ public class CouponServiceImpl implements CouponService {
vo
.
setDailyAvailableTimes
(
couponInfo
.
getLeftAvailableNums
());
vo
.
setAvailableTimes
(
couponInfo
.
getConfigMaxRedeemNums
());
// 判断是否满足启用金额
if
(
couponInfo
.
getMinAmount
()
==
null
||
totalAmount
>=
couponInfo
.
getMinAmount
())
{
vo
.
setState
(
CouponStateEnum
.
STATE_0
.
getCode
());
}
else
{
vo
.
setState
(
CouponStateEnum
.
STATE_1
.
getCode
());
vo
.
setMessage
(
"满"
+
new
BigDecimal
(
couponInfo
.
getMinAmount
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
)
+
"元起用"
);
}
couponStateVos
.
add
(
vo
);
});
}
...
...
@@ -370,7 +380,6 @@ public class CouponServiceImpl implements CouponService {
CouponStateVo
vo
=
new
CouponStateVo
();
vo
.
setCouponCode
(
couponInfo
.
getCode
());
vo
.
setType
(
couponInfo
.
getType
());
vo
.
setState
(
CouponStateEnum
.
STATE_1
.
getCode
());
vo
.
setMinAmount
(
couponInfo
.
getMinAmount
());
vo
.
setAmount
(
couponInfo
.
getFaceValue
());
vo
.
setPriceDiscount
(
couponInfo
.
getFaceValue
());
...
...
@@ -378,6 +387,7 @@ public class CouponServiceImpl implements CouponService {
vo
.
setDiscount
(
couponInfo
.
getFaceValue
());
vo
.
setDailyAvailableTimes
(
couponInfo
.
getLeftAvailableNums
());
vo
.
setAvailableTimes
(
couponInfo
.
getConfigMaxRedeemNums
());
vo
.
setState
(
CouponStateEnum
.
STATE_1
.
getCode
());
vo
.
setMessage
(
dto
.
getUnAvailableReason
());
couponStateVos
.
add
(
vo
);
...
...
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