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
4faf9dd2
Commit
4faf9dd2
authored
Jul 02, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改计算订单价格,用户钱包计算增加会员日的处理
parent
e60d3fef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
28 deletions
+75
-28
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+75
-28
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
4faf9dd2
...
@@ -1884,7 +1884,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1884,7 +1884,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
);
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
()))
{
...
@@ -1896,7 +1896,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1896,7 +1896,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
else
{
}
else
{
payPrice
=
totalPrice
;
payPrice
=
totalPrice
;
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
request
.
setBuyType
(
BuyTypeEnum
.
TIME
.
getCode
());
...
@@ -1906,7 +1906,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1906,7 +1906,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
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
()))
{
...
@@ -1918,7 +1918,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1918,7 +1918,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
activity
=
activityService
.
getOne
(
queryWrapper
);
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
);
}
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
);
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
)
{
...
@@ -1954,9 +1954,43 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1954,9 +1954,43 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
priceResponse
;
return
priceResponse
;
}
}
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
)
{
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
,
OrderComputedPriceRequest
request
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isEmpty
(
activity
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
totalFee
=
totalFee
.
subtract
(
consumerWallet
.
getBalance
());
}
}
else
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
<
0
)
{
priceResponse
.
setDuration
(
consumerWallet
.
getRemainingDuration
());
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
BigDecimal
remainingBalance
=
timeLong
.
subtract
(
consumerWallet
.
getRemainingDuration
()).
multiply
(
room
.
getPrice
());
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
>=
0
)
{
priceResponse
.
setBalance
(
remainingBalance
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
remainingBalance
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
totalFee
=
remainingBalance
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
else
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
...
@@ -1974,24 +2008,47 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -1974,24 +2008,47 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee
=
remainingBalance
.
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
remainingBalance
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
else
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
totalFee
=
totalFee
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
return
totalFee
;
return
totalFee
;
}
}
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SPack
byId
)
{
private
BigDecimal
getBigDecimal
(
ConsumerWallet
consumerWallet
,
Activity
activity
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SPack
byId
,
OrderComputedPriceRequest
request
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
ObjectUtil
.
isEmpty
(
activity
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
request
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
totalFee
=
totalFee
.
subtract
(
consumerWallet
.
getBalance
());
}
}
else
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
<
0
)
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
byId
.
getPrice
())
>=
0
)
{
priceResponse
.
setBalance
(
byId
.
getPrice
());
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
byId
.
getPrice
()));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
byId
.
getPrice
())
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
totalFee
=
byId
.
getPrice
().
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
else
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
if
(
consumerWallet
.
getRemainingDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
priceResponse
.
setRemainingDuration
(
consumerWallet
.
getRemainingDuration
().
subtract
(
timeLong
));
...
@@ -2007,16 +2064,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -2007,16 +2064,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee
=
byId
.
getPrice
().
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
byId
.
getPrice
().
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
else
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
>=
0
)
{
priceResponse
.
setBalance
(
totalFee
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
totalFee
));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
totalFee
)
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
totalFee
=
totalFee
.
subtract
(
consumerWallet
.
getBalance
());
}
}
}
}
}
return
totalFee
;
return
totalFee
;
...
...
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