Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
41f2fb4a
Commit
41f2fb4a
authored
Jan 13, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
available coupon check is weekend;
parent
fd228302
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+14
-2
No files found.
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
41f2fb4a
...
@@ -6,6 +6,7 @@ import java.util.*;
...
@@ -6,6 +6,7 @@ import java.util.*;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
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
;
...
@@ -188,7 +189,6 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -188,7 +189,6 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List
<
SPack
>
sPacks
=
packService
.
list
();
List
<
SPack
>
sPacks
=
packService
.
list
();
//迭代
//迭代
sConsumerCoupons
.
forEach
(
item
->
{
sConsumerCoupons
.
forEach
(
item
->
{
item
.
setIsAvailable
(
AvailableEnum
.
AVAILABLE
.
getCode
());
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
});
});
return
sConsumerCoupons
;
return
sConsumerCoupons
;
...
@@ -196,12 +196,24 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -196,12 +196,24 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
private
Boolean
checkCoupon
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
private
Boolean
checkCoupon
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
List
<
SPack
>
sPacks
,
BigDecimal
timeLong
){
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
List
<
SPack
>
sPacks
,
BigDecimal
timeLong
){
item
.
setIsAvailable
(
AvailableEnum
.
AVAILABLE
.
getCode
());
return
checkAvailableDate
(
item
,
couponRequest
)
return
checkAvailableDate
(
item
,
couponRequest
)
&&
checkCouponPeriod
(
item
,
couponRequest
)
&&
checkCouponPeriod
(
item
,
couponRequest
)
&&
checkStore
(
item
,
couponRequest
,
sStores
)
&&
checkStore
(
item
,
couponRequest
,
sStores
)
&&
checkCouponType
(
item
,
couponRequest
,
sStores
,
sRooms
,
timeLong
)
&&
checkCouponType
(
item
,
couponRequest
,
sStores
,
sRooms
,
timeLong
)
&&
checkOrderType
(
item
,
couponRequest
)
&&
checkOrderType
(
item
,
couponRequest
)
&&
checkPack
(
item
,
couponRequest
,
sPacks
);
&&
checkPack
(
item
,
couponRequest
,
sPacks
)
&&
chekcSunday
(
item
,
couponRequest
);
}
private
Boolean
chekcSunday
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
if
(
Objects
.
nonNull
(
item
.
getIsSunday
())&&
item
.
getIsSunday
().
compareTo
(
YesNoEnum
.
yes
.
getIndex
())==
0
){
if
(!
DateUtil
.
isWeekend
(
couponRequest
.
getPreStartDate
())||
DateUtil
.
isWeekend
(
couponRequest
.
getPreEndDate
())){
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷周末可用"
);
}
}
return
item
.
getIsAvailable
()==
0
;
}
}
private
Boolean
checkPack
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SPack
>
sPacks
){
private
Boolean
checkPack
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SPack
>
sPacks
){
...
...
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