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
3bf6045f
Commit
3bf6045f
authored
Jun 14, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改优惠券查询
parent
81d94082
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
59 deletions
+67
-59
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+67
-59
No files found.
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
3bf6045f
...
@@ -95,12 +95,12 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -95,12 +95,12 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List
<
SStore
>
list
=
sStoreService
.
list
();
List
<
SStore
>
list
=
sStoreService
.
list
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<
SConsumerCoupon
>();
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<
SConsumerCoupon
>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
useStatus
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
useStatus
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
if
(
UserStatusEnum
.
EXPIRED
.
getCode
().
compareTo
(
useStatus
)==
0
)
{
if
(
UserStatusEnum
.
EXPIRED
.
getCode
().
compareTo
(
useStatus
)
==
0
)
{
//已过期查询3个月以内的
//已过期查询3个月以内的
queryWrapper
.
gt
(
SConsumerCoupon:
:
getEndDate
,
DateUtils
.
addMonths
(
new
Date
(),
-
3
));
queryWrapper
.
gt
(
SConsumerCoupon:
:
getEndDate
,
DateUtils
.
addMonths
(
new
Date
(),
-
3
));
}
}
queryWrapper
.
orderByDesc
(
SConsumerCoupon:
:
getCreateTime
);
queryWrapper
.
orderByDesc
(
SConsumerCoupon:
:
getCreateTime
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectList
(
queryWrapper
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectList
(
queryWrapper
);
...
@@ -258,7 +258,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -258,7 +258,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
//迭代
//迭代
SPack
finalById
=
byId
;
SPack
finalById
=
byId
;
sConsumerCoupons
.
forEach
(
item
->
{
sConsumerCoupons
.
forEach
(
item
->
{
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
SConsumerCouponVo
vo
=
new
SConsumerCouponVo
();
SConsumerCouponVo
vo
=
new
SConsumerCouponVo
();
BeanUtils
.
copyProperties
(
item
,
vo
);
BeanUtils
.
copyProperties
(
item
,
vo
);
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
())
&&
StringUtils
.
isEmpty
(
item
.
getStoreIds
()))
{
if
(
item
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
())
&&
StringUtils
.
isEmpty
(
item
.
getStoreIds
()))
{
...
@@ -270,12 +270,20 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -270,12 +270,20 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
}
//取绝对值
//取绝对值
if
(
vo
.
getIsAvailable
().
equals
(
AvailableEnum
.
AVAILABLE
.
getCode
()))
{
if
(
vo
.
getIsAvailable
().
equals
(
AvailableEnum
.
AVAILABLE
.
getCode
()))
{
if
(!
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
AMOUNT
.
getCode
()))
{
if
(
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
AMOUNT
.
getCode
()))
{
if
(!
ObjectUtils
.
isEmpty
(
roomLabel
))
{
vo
.
setBalance
(
timeLong
.
multiply
(
room
.
getPrice
()).
subtract
(
vo
.
getOriginalPrice
()).
abs
());
}
if
(!
ObjectUtils
.
isEmpty
(
finalById
))
{
vo
.
setBalance
(
finalById
.
getPrice
().
subtract
(
vo
.
getOriginalPrice
()).
abs
());
}
}
else
if
(
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
())
||
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
MINUS
.
getCode
())
||
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
DURATION
.
getCode
())
||
vo
.
getCouponType
().
equals
(
CouponTypeEnum
.
PACKAGE
.
getCode
()))
{
if
(!
ObjectUtils
.
isEmpty
(
roomLabel
))
{
if
(!
ObjectUtils
.
isEmpty
(
roomLabel
))
{
vo
.
setBalance
((
roomLabel
.
getPromotionAmount
().
subtract
(
vo
.
getSalePrice
())).
vo
.
setBalance
((
roomLabel
.
getPromotionAmount
().
subtract
(
vo
.
getSalePrice
())).
add
(((
timeLong
.
subtract
(
new
BigDecimal
(
roomLabel
.
getPromotionDuration
()))).
multiply
(
room
.
getPrice
()))).
abs
());
add
(((
timeLong
.
subtract
(
new
BigDecimal
(
roomLabel
.
getPromotionDuration
()))).
multiply
(
room
.
getPrice
()))).
abs
());
}
else
if
(!
ObjectUtils
.
isEmpty
(
finalById
))
{
}
else
if
(!
ObjectUtils
.
isEmpty
(
finalById
))
{
vo
.
setBalance
(
finalById
.
getPrice
().
subtract
(
vo
.
getSalePrice
()));
vo
.
setBalance
(
finalById
.
getPrice
().
subtract
(
vo
.
getSalePrice
())
.
abs
()
);
}
}
}
else
{
}
else
{
vo
.
setBalance
(
new
BigDecimal
(
"999"
));
vo
.
setBalance
(
new
BigDecimal
(
"999"
));
...
@@ -303,19 +311,19 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -303,19 +311,19 @@ 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
());
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
)
&&
chekcWeeks
(
item
,
couponRequest
);
&&
chekcWeeks
(
item
,
couponRequest
);
}
}
private
Boolean
chekcWeeks
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
private
Boolean
chekcWeeks
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
if
(
StringUtils
.
isNotBlank
(
item
.
getWeeks
()))
{
if
(
StringUtils
.
isNotBlank
(
item
.
getWeeks
()))
{
Integer
startWeek
=
DateUtil
.
dayOfWeek
(
DateUtils
.
addDays
(
couponRequest
.
getPreStartDate
(),
-
1
));
Integer
startWeek
=
DateUtil
.
dayOfWeek
(
DateUtils
.
addDays
(
couponRequest
.
getPreStartDate
(),
-
1
));
//查询可用优惠卷判断星期只判断订单预约开始时间
//查询可用优惠卷判断星期只判断订单预约开始时间
// Integer endWeek = DateUtil.dayOfWeek(DateUtils.addDays(couponRequest.getPreEndDate(), -1));
// Integer endWeek = DateUtil.dayOfWeek(DateUtils.addDays(couponRequest.getPreEndDate(), -1));
...
@@ -325,19 +333,19 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -325,19 +333,19 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
// ||!weeks.contains(endWeek)
// ||!weeks.contains(endWeek)
)
{
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
if
(
checkIfArrayIsContinuous
(
weeks
.
stream
().
mapToInt
(
i
->
i
.
intValue
()).
toArray
()))
{
if
(
checkIfArrayIsContinuous
(
weeks
.
stream
().
mapToInt
(
i
->
i
.
intValue
()).
toArray
()))
{
if
(
weeks
.
size
()==
1
)
{
if
(
weeks
.
size
()
==
1
)
{
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"可用"
);
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"可用"
);
}
else
if
(
WeekEnum
.
isSundays
(
weeks
))
{
}
else
if
(
WeekEnum
.
isSundays
(
weeks
))
{
item
.
setReason
(
"优惠卷周末可用"
);
item
.
setReason
(
"优惠卷周末可用"
);
}
else
if
(
WeekEnum
.
isAllWorkDays
(
weeks
))
{
}
else
if
(
WeekEnum
.
isAllWorkDays
(
weeks
))
{
item
.
setReason
(
"优惠卷周一至周五可用"
);
item
.
setReason
(
"优惠卷周一至周五可用"
);
}
else
{
}
else
{
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"至"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
weeks
.
size
()-
1
))
+
"可用"
);
item
.
setReason
(
"优惠卷"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
0
))
+
"至"
+
WeekEnum
.
getValueByCode
(
weeks
.
get
(
weeks
.
size
()
-
1
))
+
"可用"
);
}
}
}
else
{
}
else
{
StringBuffer
buf
=
new
StringBuffer
(
"优惠券"
);
StringBuffer
buf
=
new
StringBuffer
(
"优惠券"
);
for
(
int
index
=
0
;
index
<
weeks
.
size
();
index
++)
{
for
(
int
index
=
0
;
index
<
weeks
.
size
();
index
++)
{
buf
.
append
(
WeekEnum
.
getValueByCode
(
weeks
.
get
(
index
)));
buf
.
append
(
WeekEnum
.
getValueByCode
(
weeks
.
get
(
index
)));
if
(
index
<
weeks
.
size
())
{
if
(
index
<
weeks
.
size
())
{
buf
.
append
(
"可用"
);
buf
.
append
(
"可用"
);
...
@@ -360,69 +368,69 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -360,69 +368,69 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
}
Arrays
.
sort
(
array
);
// 先对数组进行排序
Arrays
.
sort
(
array
);
// 先对数组进行排序
for
(
int
i
=
0
;
i
<
array
.
length
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
array
.
length
-
1
;
i
++)
{
if
(
array
[
i
]
!=
array
[
i
+
1
])
{
if
(
array
[
i
]
!=
array
[
i
+
1
])
{
return
false
;
// 如果相邻两个元素之间存在跨度大于1的情况则返回false
return
false
;
// 如果相邻两个元素之间存在跨度大于1的情况则返回false
}
}
}
}
return
true
;
// 没有发现跨度大于1的情况则返回true
return
true
;
// 没有发现跨度大于1的情况则返回true
}
}
private
Boolean
checkPack
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SPack
>
sPacks
){
private
Boolean
checkPack
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SPack
>
sPacks
)
{
if
(
couponRequest
.
getOrderMode
().
compareTo
(
BuyTypeEnum
.
PACK
.
getCode
())==
0
if
(
couponRequest
.
getOrderMode
().
compareTo
(
BuyTypeEnum
.
PACK
.
getCode
())
==
0
&&
StringUtils
.
isNotBlank
(
item
.
getPackIds
())&&
Objects
.
nonNull
(
couponRequest
.
getPackageId
()))
{
&&
StringUtils
.
isNotBlank
(
item
.
getPackIds
())
&&
Objects
.
nonNull
(
couponRequest
.
getPackageId
()))
{
List
<
Long
>
confPackIds
=
Arrays
.
stream
(
item
.
getPackIds
().
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
Long
>
confPackIds
=
Arrays
.
stream
(
item
.
getPackIds
().
split
(
","
)).
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
if
(!
confPackIds
.
contains
(
couponRequest
.
getPackageId
()))
{
if
(!
confPackIds
.
contains
(
couponRequest
.
getPackageId
()))
{
List
<
SPack
>
packs
=
sPacks
.
stream
().
filter
(
obj
->
confPackIds
.
contains
(
obj
.
getId
())).
collect
(
Collectors
.
toList
());
List
<
SPack
>
packs
=
sPacks
.
stream
().
filter
(
obj
->
confPackIds
.
contains
(
obj
.
getId
())).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
packs
))
{
if
(!
CollectionUtils
.
isEmpty
(
packs
))
{
List
<
String
>
packNames
=
packs
.
stream
().
map
(
SPack:
:
getName
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
packNames
=
packs
.
stream
().
map
(
SPack:
:
getName
).
distinct
().
collect
(
Collectors
.
toList
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷当前套餐不可用,"
+
packNames
.
toString
()+
"套餐可用"
);
item
.
setReason
(
"优惠卷当前套餐不可用,"
+
packNames
.
toString
()
+
"套餐可用"
);
}
}
}
}
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
private
Boolean
checkOrderType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
private
Boolean
checkOrderType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
if
(
Objects
.
nonNull
(
item
.
getOrderType
())&&
item
.
getOrderType
().
compareTo
(
couponRequest
.
getOrderType
())!=
0
)
{
if
(
Objects
.
nonNull
(
item
.
getOrderType
())
&&
item
.
getOrderType
().
compareTo
(
couponRequest
.
getOrderType
())
!=
0
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷"
+
OrderTypeEnum
.
getEnumByCode
(
item
.
getOrderType
()).
getName
()+
"可用"
);
item
.
setReason
(
"优惠卷"
+
OrderTypeEnum
.
getEnumByCode
(
item
.
getOrderType
()).
getName
()
+
"可用"
);
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
private
Boolean
checkAvailableDate
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
private
Boolean
checkAvailableDate
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
if
((
Objects
.
nonNull
(
item
.
getStartDate
())
&&
Objects
.
nonNull
(
item
.
getEndDate
()))
if
((
Objects
.
nonNull
(
item
.
getStartDate
())
&&
Objects
.
nonNull
(
item
.
getEndDate
()))
&&(
item
.
getStartDate
().
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
&&
(
item
.
getStartDate
().
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
||
item
.
getEndDate
().
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
)){
||
item
.
getEndDate
().
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
))
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷未生效,优惠卷有效时间为"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getStartDate
())
item
.
setReason
(
"优惠卷未生效,优惠卷有效时间为"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getStartDate
())
+
"-"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getEndDate
()));
+
"-"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
item
.
getEndDate
()));
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
private
Boolean
checkCouponPeriod
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
){
private
Boolean
checkCouponPeriod
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
)
{
Boolean
isOrderCrossDay
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"yyyyMMdd"
,
couponRequest
.
getPreEndDate
()))
>
Boolean
isOrderCrossDay
=
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"yyyyMMdd"
,
couponRequest
.
getPreEndDate
()))
>
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"yyyyMMdd"
,
couponRequest
.
getPreStartDate
()));
Integer
.
parseInt
(
DateUtils
.
parseDateToStr
(
"yyyyMMdd"
,
couponRequest
.
getPreStartDate
()));
String
startStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
couponRequest
.
getPreStartDate
());
String
startStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
couponRequest
.
getPreStartDate
());
String
lastDayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
DateUtils
.
addDays
(
couponRequest
.
getPreStartDate
(),
1
));
String
lastDayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
DateUtils
.
addDays
(
couponRequest
.
getPreStartDate
(),
1
));
Boolean
isCouponCrossDay
=
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()))>
0
;
Boolean
isCouponCrossDay
=
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()))
>
0
;
if
(
Objects
.
nonNull
(
item
.
getCouponTimeStart
())&&
Objects
.
nonNull
(
item
.
getCouponTimeEnd
())
if
(
Objects
.
nonNull
(
item
.
getCouponTimeStart
())
&&
Objects
.
nonNull
(
item
.
getCouponTimeEnd
())
&&
(!
StringUtils
.
equals
(
item
.
getCouponTimeStart
(),
"00:00"
)||(!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"24:00"
)&&!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"23:00"
))))
{
&&
(!
StringUtils
.
equals
(
item
.
getCouponTimeStart
(),
"00:00"
)
||
(!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"24:00"
)
&&
!
StringUtils
.
equals
(
item
.
getCouponTimeEnd
(),
"23:00"
))))
{
//判断是否跨日券
//判断是否跨日券
if
(
isCouponCrossDay
)
{
if
(
isCouponCrossDay
)
{
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())>
0
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
||
DateUtils
.
parseDate
(
lastDayStr
+
" "
+
item
.
getCouponTimeEnd
()).
compareTo
(
couponRequest
.
getPreEndDate
())<
0
)
{
||
DateUtils
.
parseDate
(
lastDayStr
+
" "
+
item
.
getCouponTimeEnd
()).
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-次日"
+
item
.
getCouponTimeEnd
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-次日"
+
item
.
getCouponTimeEnd
());
}
}
}
else
{
}
else
{
//判断是否跨日订单
//判断是否跨日订单
if
(
isOrderCrossDay
){
if
(
isOrderCrossDay
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-"
+
item
.
getCouponTimeEnd
());
item
.
setReason
(
"优惠卷可用时段为"
+
item
.
getCouponTimeStart
()
+
"-"
+
item
.
getCouponTimeEnd
());
}
else
{
}
else
{
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
if
(
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeStart
()).
compareTo
(
couponRequest
.
getPreStartDate
())
>
0
||
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()).
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
)
{
||
DateUtils
.
parseDate
(
startStr
+
" "
+
item
.
getCouponTimeEnd
()).
compareTo
(
couponRequest
.
getPreEndDate
())
<
0
)
{
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
item
.
setIsAvailable
(
AvailableEnum
.
UNAVAILABLE
.
getCode
());
...
@@ -431,16 +439,16 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -431,16 +439,16 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
}
}
}
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
private
Boolean
checkCouponType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
private
Boolean
checkCouponType
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
BigDecimal
timeLong
){
,
List
<
SStore
>
sStores
,
List
<
SRoom
>
sRooms
,
BigDecimal
timeLong
)
{
SStore
sStore
=
sStores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
couponRequest
.
getStoreId
())).
findFirst
().
orElse
(
null
);
SStore
sStore
=
sStores
.
stream
().
filter
(
store
->
store
.
getId
().
equals
(
couponRequest
.
getStoreId
())).
findFirst
().
orElse
(
null
);
SRoom
byId
=
sRooms
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
couponRequest
.
getRoomId
())).
findFirst
().
orElse
(
null
);
SRoom
byId
=
sRooms
.
stream
().
filter
(
room
->
room
.
getId
().
equals
(
couponRequest
.
getRoomId
())).
findFirst
().
orElse
(
null
);
BigDecimal
subtract
=
new
BigDecimal
(
item
.
getMinDuration
());
BigDecimal
subtract
=
new
BigDecimal
(
item
.
getMinDuration
());
CouponTypeEnum
couponTypeEnum
=
CouponTypeEnum
.
getTypeCode
(
item
.
getCouponType
());
CouponTypeEnum
couponTypeEnum
=
CouponTypeEnum
.
getTypeCode
(
item
.
getCouponType
());
switch
(
couponTypeEnum
){
switch
(
couponTypeEnum
)
{
case
PACKAGE:
case
PACKAGE:
if
(
couponRequest
.
getOrderMode
().
equals
(
BuyTypeEnum
.
PACK
.
getCode
()))
{
if
(
couponRequest
.
getOrderMode
().
equals
(
BuyTypeEnum
.
PACK
.
getCode
()))
{
//计算价格
//计算价格
...
@@ -464,11 +472,11 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -464,11 +472,11 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
extracted
(
item
,
timeLong
,
byId
,
subtract
,
sStore
);
extracted
(
item
,
timeLong
,
byId
,
subtract
,
sStore
);
break
;
break
;
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
private
Boolean
checkStore
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
)
{
private
Boolean
checkStore
(
SConsumerCoupon
item
,
CouponRequest
couponRequest
,
List
<
SStore
>
sStores
)
{
if
(
StringUtils
.
isNotBlank
(
item
.
getStoreIds
()))
{
if
(
StringUtils
.
isNotBlank
(
item
.
getStoreIds
()))
{
List
<
Long
>
storeIds
=
Arrays
.
asList
(
item
.
getStoreIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
List
<
Long
>
storeIds
=
Arrays
.
asList
(
item
.
getStoreIds
().
split
(
","
)).
stream
().
map
(
Long:
:
parseLong
).
collect
(
Collectors
.
toList
());
if
(!
storeIds
.
contains
(
couponRequest
.
getStoreId
()))
{
if
(!
storeIds
.
contains
(
couponRequest
.
getStoreId
()))
{
...
@@ -477,7 +485,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
...
@@ -477,7 +485,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
item
.
setReason
(
"优惠卷当前门店不可用,适用门店:"
+
storeNames
.
toString
());
item
.
setReason
(
"优惠卷当前门店不可用,适用门店:"
+
storeNames
.
toString
());
}
}
}
}
return
item
.
getIsAvailable
()
==
0
;
return
item
.
getIsAvailable
()
==
0
;
}
}
@Override
@Override
...
...
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