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
9f10457d
Commit
9f10457d
authored
May 17, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改最优优惠券排序
parent
174fbcaa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+2
-8
No files found.
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
9f10457d
...
...
@@ -217,24 +217,20 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
SRoom
room
=
sRoomService
.
getById
(
couponRequest
.
getRoomId
());
//计算时长
BigDecimal
timeLong
=
DateUtils
.
differentHour
(
couponRequest
.
getPreStartDate
(),
couponRequest
.
getPreEndDate
());
BigDecimal
totalPrice
=
timeLong
.
multiply
(
room
.
getPrice
());
BigDecimal
payPrice
=
new
BigDecimal
(
0
);
RoomLabel
roomLabel
;
SPack
byId
;
if
(!
ObjectUtils
.
isEmpty
(
couponRequest
.
getRoomLabelId
()))
{
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
couponRequest
.
getRoomLabelId
());
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
byId
=
null
;
payPrice
=
totalPrice
;
couponRequest
.
setOrderMode
(
BuyTypeEnum
.
TIME
.
getCode
());
}
else
{
byId
=
packService
.
getById
(
roomLabel
.
getPackId
());
if
(!
ObjectUtils
.
isEmpty
(
byId
)
&&
byId
.
getIsOpen
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
couponRequest
.
setPackageId
(
roomLabel
.
getPackId
());
couponRequest
.
setOrderMode
(
BuyTypeEnum
.
PACK
.
getCode
());
}
else
{
payPrice
=
totalPrice
;
byId
=
null
;
couponRequest
.
setPackageId
(
null
);
couponRequest
.
setOrderMode
(
BuyTypeEnum
.
TIME
.
getCode
());
}
...
...
@@ -243,7 +239,6 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
roomLabel
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
couponRequest
.
getPackageId
()))
{
byId
=
packService
.
getById
(
couponRequest
.
getPackageId
());
payPrice
=
computeTotalPrice
(
couponRequest
.
getPackageId
(),
totalPrice
);
couponRequest
.
setOrderMode
(
BuyTypeEnum
.
PACK
.
getCode
());
}
else
{
throw
new
RuntimeException
(
"参数异常"
);
...
...
@@ -257,7 +252,6 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
//查询所有的套餐
List
<
SPack
>
sPacks
=
packService
.
list
();
//迭代
BigDecimal
finalPayPrice
=
payPrice
;
SPack
finalById
=
byId
;
sConsumerCoupons
.
forEach
(
item
->
{
checkCoupon
(
item
,
couponRequest
,
sStores
,
sRooms
,
sPacks
,
timeLong
);
...
...
@@ -274,7 +268,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if
(
vo
.
getIsAvailable
().
equals
(
AvailableEnum
.
AVAILABLE
.
getCode
()))
{
if
(!
ObjectUtils
.
isEmpty
(
roomLabel
))
{
vo
.
setBalance
((
roomLabel
.
getPromotionAmount
().
subtract
(
vo
.
getSalePrice
())).
add
(((
DateUtils
.
differentHour
(
couponRequest
.
getPreStartDate
(),
couponRequest
.
getPreEndDate
())
.
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
))
{
vo
.
setBalance
(
finalById
.
getPrice
().
subtract
(
vo
.
getSalePrice
()));
}
...
...
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