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
70868f48
Commit
70868f48
authored
Apr 30, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改订单金额计算
parent
87514e92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
+22
-12
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+22
-12
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
70868f48
...
@@ -1747,13 +1747,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1747,13 +1747,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
ComputedOrderPriceResponse
priceResponse
=
new
ComputedOrderPriceResponse
();
ComputedOrderPriceResponse
priceResponse
=
new
ComputedOrderPriceResponse
();
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
BigDecimal
totalPrice
=
computeTotalPrice
(
room
.
getPrice
(),
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
BigDecimal
totalPrice
=
computeTotalPrice
(
room
.
getPrice
(),
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
BigDecimal
payPrice
;
BigDecimal
payPrice
=
new
BigDecimal
(
0
);
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
payPrice
=
totalPrice
;
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
}
else
{
payPrice
=
totalPrice
;
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
}
else
{
}
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
}
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
payPrice
=
computeTotalPrice
(
request
.
getPackId
(),
totalPrice
);
}
priceResponse
.
setTotalFee
(
payPrice
);
priceResponse
.
setTotalFee
(
payPrice
);
// 计算优惠券金额
// 计算优惠券金额
if
(
ObjectUtil
.
isNull
(
request
.
getCouponId
())
||
request
.
getCouponId
()
<=
0
)
{
if
(
ObjectUtil
.
isNull
(
request
.
getCouponId
())
||
request
.
getCouponId
()
<=
0
)
{
...
@@ -1811,11 +1816,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1811,11 +1816,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
if
(
consumerCoupon
.
getMinPrice
().
compareTo
(
priceResponse
.
getTotalFee
())
>
0
)
{
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
throw
new
BaseException
(
"总金额小于优惠券最小使用金额"
);
}
}
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
BigDecimal
subtract
=
new
BigDecimal
(
0
);
//(促销价-优惠券促销价)+((时长-促销时长)*单价)
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
BigDecimal
subtract
=
(
roomLabel
.
getPromotionAmount
().
subtract
(
consumerCoupon
.
getSalePrice
())).
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
add
(((
DateUtils
.
differentHour
(
request
.
getPreStartDate
(),
request
.
getPreEndDate
()).
subtract
(
new
BigDecimal
(
roomLabel
.
getPromotionDuration
()))).
multiply
(
room
.
getPrice
())));
subtract
=
(
roomLabel
.
getPromotionAmount
().
subtract
(
consumerCoupon
.
getSalePrice
())).
add
(((
DateUtils
.
differentHour
(
request
.
getPreStartDate
(),
request
.
getPreEndDate
()).
subtract
(
new
BigDecimal
(
roomLabel
.
getPromotionDuration
()))).
multiply
(
room
.
getPrice
())));
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
SPack
byId
=
packService
.
getById
(
request
.
getPackId
());
subtract
=
byId
.
getPrice
().
subtract
(
consumerCoupon
.
getSalePrice
());
}
//判断是否为负数
//判断是否为负数
if
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
if
(
subtract
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
...
...
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