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
487fde0a
Commit
487fde0a
authored
Jun 28, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改查询订单金额
parent
7b02730d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
15 deletions
+32
-15
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+32
-15
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
487fde0a
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.cronutils.model.Cron
;
import
com.cronutils.model.Cron
;
import
com.cronutils.model.CronType
;
import
com.cronutils.model.definition.CronDefinitionBuilder
;
import
com.cronutils.model.definition.CronDefinitionBuilder
;
import
com.cronutils.model.time.ExecutionTime
;
import
com.cronutils.model.time.ExecutionTime
;
import
com.cronutils.parser.CronParser
;
import
com.cronutils.parser.CronParser
;
...
@@ -1852,51 +1853,67 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1852,51 +1853,67 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private
ComputedOrderPriceResponse
computedPrice
(
OrderComputedPriceRequest
request
,
SConsumer
user
)
{
private
ComputedOrderPriceResponse
computedPrice
(
OrderComputedPriceRequest
request
,
SConsumer
user
)
{
// 计算各种价格
// 计算各种价格
ComputedOrderPriceResponse
priceResponse
=
new
ComputedOrderPriceResponse
();
ComputedOrderPriceResponse
priceResponse
=
new
ComputedOrderPriceResponse
();
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
BigDecimal
totalPrice
=
computeTotalPrice
(
room
.
getPrice
(),
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
BigDecimal
payPrice
=
new
BigDecimal
(
0
);
BigDecimal
totalFee
=
new
BigDecimal
(
0
);
Activity
activity
;
Activity
activity
;
ConsumerMember
consumerMember
=
new
ConsumerMember
();
LambdaQueryWrapper
<
Activity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
Activity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
ObjectUtil
.
isNotEmpty
(
user
))
{
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getIsOpen
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
Activity:
:
getIsOpen
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
Activity:
:
getMemberType
,
consumerMember
.
getMemberType
());
queryWrapper
.
eq
(
Activity:
:
getMemberType
,
consumerMember
.
getMemberType
());
}
}
SRoom
room
=
roomService
.
getById
(
request
.
getRoomId
());
BigDecimal
totalPrice
=
computeTotalPrice
(
room
.
getPrice
(),
request
.
getPreStartDate
(),
request
.
getPreEndDate
());
BigDecimal
payPrice
=
new
BigDecimal
(
0
);
BigDecimal
totalFee
=
new
BigDecimal
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
if
(!
ObjectUtils
.
isEmpty
(
request
.
getRoomLabelId
()))
{
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
RoomLabel
roomLabel
=
roomLabelService
.
selectRoomLabelById
(
request
.
getRoomLabelId
());
payPrice
=
totalPrice
;
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
if
(
ObjectUtils
.
isEmpty
(
roomLabel
.
getPackId
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
payPrice
=
totalPrice
;
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
else
{
}
else
{
SPack
byId
=
packService
.
getById
(
roomLabel
.
getPackId
());
SPack
byId
=
packService
.
getById
(
roomLabel
.
getPackId
());
if
(!
ObjectUtils
.
isEmpty
(
byId
)
&&
byId
.
getIsOpen
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
if
(!
ObjectUtils
.
isEmpty
(
byId
)
&&
byId
.
getIsOpen
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
roomLabel
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
payPrice
=
computeTotalPrice
(
roomLabel
.
getPackId
(),
totalPrice
);
request
.
setBuyType
(
BuyTypeEnum
.
PACK
.
getCode
());
request
.
setBuyType
(
BuyTypeEnum
.
PACK
.
getCode
());
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
roomLabel
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
else
{
}
else
{
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
payPrice
=
totalPrice
;
payPrice
=
totalPrice
;
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
}
}
}
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
request
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
payPrice
=
computeTotalPrice
(
request
.
getPackId
(),
totalPrice
);
payPrice
=
computeTotalPrice
(
request
.
getPackId
(),
totalPrice
);
request
.
setBuyType
(
BuyTypeEnum
.
PACK
.
getCode
());
request
.
setBuyType
(
BuyTypeEnum
.
PACK
.
getCode
());
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
request
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
}
priceResponse
.
setTotalFee
(
payPrice
);
priceResponse
.
setTotalFee
(
payPrice
);
priceResponse
.
setPayFee
(
totalFee
);
priceResponse
.
setPayFee
(
totalFee
);
// 计算优惠券金额
// 计算优惠券金额
if
(
ObjectUtil
.
isNull
(
request
.
getCouponId
())
||
request
.
getCouponId
()
<=
0
)
{
if
(
ObjectUtil
.
isNull
(
request
.
getCouponId
())
||
request
.
getCouponId
()
<=
0
)
{
priceResponse
.
setCouponFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setCouponFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setPayFee
(
payPrice
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
()).
multiply
(
new
BigDecimal
(
100
)));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
//总金额乘以折扣比例除以100
//总金额乘以折扣比例除以100
...
@@ -1922,14 +1939,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1922,14 +1939,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private
BigDecimal
getBigDecimal
(
OrderComputedPriceRequest
request
,
Activity
activity
,
BigDecimal
payPrice
,
SConsumer
user
)
{
private
BigDecimal
getBigDecimal
(
OrderComputedPriceRequest
request
,
Activity
activity
,
BigDecimal
payPrice
,
SConsumer
user
)
{
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
com
.
cronutils
.
model
.
CronType
.
QUARTZ
));
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getUnfinishOrderStatus
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getUnfinishOrderStatus
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
ne
(
SOrder:
:
getPayPrice
,
new
BigDecimal
(
0
.00
));
queryWrapper
.
ne
(
SOrder:
:
getPayPrice
,
new
BigDecimal
(
0
));
queryWrapper
.
isNull
(
SOrder:
:
getCouponId
);
queryWrapper
.
isNull
(
SOrder:
:
getCouponId
);
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
orderList
))
{
if
(
CollectionUtils
.
isEmpty
(
orderList
))
{
...
...
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