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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+13
-3
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
);
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
payPrice
=
totalPrice
;
payPrice
=
totalPrice
;
}
else
{
}
else
{
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
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
(
"总金额小于优惠券最小使用金额"
);
}
}
BigDecimal
subtract
=
new
BigDecimal
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
//(促销价-优惠券促销价)+((时长-促销时长)*单价)
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
BigDecimal
subtract
=
(
roomLabel
.
getPromotionAmount
().
subtract
(
consumerCoupon
.
getSalePrice
())).
subtract
=
(
roomLabel
.
getPromotionAmount
().
subtract
(
consumerCoupon
.
getSalePrice
())).
add
(((
DateUtils
.
differentHour
(
request
.
getPreStartDate
(),
request
.
getPreEndDate
()).
subtract
(
new
BigDecimal
(
roomLabel
.
getPromotionDuration
()))).
multiply
(
room
.
getPrice
())));
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