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
412ea1a4
Commit
412ea1a4
authored
Aug 08, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改订单计算
parent
829874d7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
21 deletions
+52
-21
OrderVo.java
...-system/src/main/java/share/system/domain/vo/OrderVo.java
+6
-0
ComputedOrderPriceResponse.java
...ava/share/system/response/ComputedOrderPriceResponse.java
+4
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+42
-21
No files found.
share-system/src/main/java/share/system/domain/vo/OrderVo.java
View file @
412ea1a4
...
@@ -114,5 +114,11 @@ public class OrderVo {
...
@@ -114,5 +114,11 @@ public class OrderVo {
private
BigDecimal
payPrice
;
private
BigDecimal
payPrice
;
private
BigDecimal
duration
;
private
BigDecimal
balance
;
private
BigDecimal
discountRatio
;
}
}
share-system/src/main/java/share/system/response/ComputedOrderPriceResponse.java
View file @
412ea1a4
...
@@ -42,6 +42,10 @@ public class ComputedOrderPriceResponse implements Serializable {
...
@@ -42,6 +42,10 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty
(
value
=
"折扣比例"
)
@ApiModelProperty
(
value
=
"折扣比例"
)
private
BigDecimal
discountRatio
;
private
BigDecimal
discountRatio
;
//会员折扣
@ApiModelProperty
(
value
=
"会员折扣"
)
private
BigDecimal
memberDiscount
;
@ApiModelProperty
(
value
=
"可用时长"
)
@ApiModelProperty
(
value
=
"可用时长"
)
private
BigDecimal
availableDuration
;
private
BigDecimal
availableDuration
;
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
412ea1a4
...
@@ -2310,6 +2310,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2310,6 +2310,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setAvailableDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setAvailableDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setMemberDiscount
(
BigDecimal
.
ZERO
);
Activity
activity
=
null
;
Activity
activity
=
null
;
ConsumerMember
consumerMember
=
null
;
ConsumerMember
consumerMember
=
null
;
ConsumerWallet
consumerWallet
=
null
;
ConsumerWallet
consumerWallet
=
null
;
...
@@ -2340,10 +2341,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2340,10 +2341,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
//
priceResponse.setTotalFeeNow(totalFee);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
);
}
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
()))
{
...
@@ -2355,10 +2356,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2355,10 +2356,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
else
{
}
else
{
payPrice
=
totalPrice
;
payPrice
=
totalPrice
;
priceResponse
.
setTotalFeeNow
(
payPrice
);
priceResponse
.
setTotalFeeNow
(
payPrice
);
...
@@ -2367,11 +2370,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2367,11 +2370,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
//
priceResponse.setTotalFeeNow(totalFee);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
);
}
}
}
}
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
}
else
if
(!
ObjectUtils
.
isEmpty
(
request
.
getPackId
()))
{
...
@@ -2384,9 +2388,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2384,9 +2388,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
}
priceResponse
.
setTotalFee
(
payPrice
);
priceResponse
.
setTotalFee
(
payPrice
);
if
(
ObjectUtil
.
isEmpty
(
consumerWallet
)
&&
totalFee
.
compareTo
(
new
BigDecimal
(
0
))
==
0
)
{
if
(
ObjectUtil
.
isEmpty
(
consumerWallet
)
&&
totalFee
.
compareTo
(
new
BigDecimal
(
0
))
==
0
)
{
...
@@ -2457,8 +2463,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2457,8 +2463,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
,
OrderComputedPriceRequest
request
)
{
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
,
OrderComputedPriceRequest
request
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
)
&&
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
priceResponse
.
setDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
priceResponse
.
setRemainingDuration
(
BigDecimal
.
ZERO
);
...
@@ -2471,6 +2478,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2471,6 +2478,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
totalFee
);
totalFee
=
new
BigDecimal
(
0
);
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
...
@@ -2485,14 +2494,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2485,14 +2494,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setDuration
(
consumerWallet
.
getRemainingDuration
());
priceResponse
.
setDuration
(
consumerWallet
.
getRemainingDuration
());
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
remainingBalance
=
priceResponse
.
getTotalFeeNow
().
subtract
(
remainingBalance
);
totalFee
=
totalFee
.
divide
(
memberConfig
.
getDiscountRatio
()).
multiply
(
new
BigDecimal
(
100
));
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
>=
0
)
{
remainingBalance
=
totalFee
.
subtract
(
remainingBalance
);
priceResponse
.
setBalance
(
remainingBalance
);
BigDecimal
divide
=
remainingBalance
;
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
remainingBalance
));
divide
=
divide
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
priceResponse
.
setTotalFeeNow
(
divide
);
priceResponse
.
setMemberDiscount
(
remainingBalance
.
subtract
(
divide
));
if
(
consumerWallet
.
getBalance
().
compareTo
(
divide
)
>=
0
)
{
priceResponse
.
setBalance
(
divide
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
divide
));
totalFee
=
new
BigDecimal
(
0
);
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalanc
e
)
<
0
)
{
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
divid
e
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
totalFee
=
remainingBalanc
e
.
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
divid
e
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
}
...
@@ -2504,17 +2518,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2504,17 +2518,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
else
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
<
0
)
{
}
else
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
<
0
)
{
priceResponse
.
setDuration
(
consumerWallet
.
getRemainingDuration
());
priceResponse
.
setDuration
(
consumerWallet
.
getRemainingDuration
());
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
//时长的金额
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
remainingBalance
=
priceResponse
.
getTotalFeeNow
().
subtract
(
remainingBalance
);
//恢复原价
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
>=
0
)
{
totalFee
=
totalFee
.
divide
(
memberConfig
.
getDiscountRatio
()).
multiply
(
new
BigDecimal
(
100
));
priceResponse
.
setBalance
(
remainingBalance
);
//原价减时长
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
remainingBalance
));
remainingBalance
=
totalFee
.
subtract
(
remainingBalance
);
BigDecimal
divide
=
remainingBalance
;
divide
=
divide
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
priceResponse
.
setTotalFeeNow
(
divide
);
priceResponse
.
setMemberDiscount
(
remainingBalance
.
subtract
(
divide
));
if
(
consumerWallet
.
getBalance
().
compareTo
(
divide
)
>=
0
)
{
priceResponse
.
setBalance
(
divide
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
divide
));
totalFee
=
new
BigDecimal
(
0
);
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalanc
e
)
<
0
)
{
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
divid
e
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
BigDecimal
.
ZERO
);
priceResponse
.
setRemainingBalance
(
BigDecimal
.
ZERO
);
totalFee
=
remainingBalanc
e
.
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
divid
e
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
}
...
...
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