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
7ad74a14
Commit
7ad74a14
authored
Oct 16, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
45f42fc8
00f53dcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
56 deletions
+63
-56
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+63
-56
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
7ad74a14
...
...
@@ -2664,15 +2664,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
ConsumerMember
consumerMember
=
null
;
ConsumerWallet
consumerWallet
=
null
;
ConsumerMonthlyCard
consumerMonthlyCard
=
null
;
List
<
ConsumerSecondaryCard
>
consumerSecondaryCardList
=
null
;
ConsumerSecondaryCard
consumerSecondaryCard
=
null
;
LambdaQueryWrapper
<
Activity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
if
(
ObjectUtil
.
isNotEmpty
(
user
))
{
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
user
.
getId
()));
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()));
consumerMonthlyCard
=
consumerMonthlyCardService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMonthlyCard
>().
eq
(
ConsumerMonthlyCard:
:
getConsumerId
,
user
.
getId
()));
consumerSecondaryCardList
=
consumerSecondaryCardService
.
list
(
new
LambdaQueryWrapper
<
ConsumerSecondaryCard
>().
eq
(
ConsumerSecondaryCard:
:
getConsumerId
,
user
.
getId
())
.
ne
(
ConsumerSecondaryCard:
:
getNumber
,
YesNoEnum
.
no
.
getIndex
())
);
consumerMonthlyCard
=
consumerMonthlyCardService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMonthlyCard
>().
eq
(
ConsumerMonthlyCard:
:
getId
,
request
.
getMonthlyCardId
()));
consumerSecondaryCard
=
consumerSecondaryCardService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerSecondaryCard
>().
eq
(
ConsumerSecondaryCard:
:
getId
,
request
.
getSecondaryCardId
()));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
queryWrapper
.
eq
(
Activity:
:
getIsOpen
,
YesNoEnum
.
yes
.
getIndex
());
// if (consumerMember.getIsRights().equals(YesNoEnum.yes.getIndex())) {
...
...
@@ -2711,19 +2709,21 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setTotalFeeNow
(
payPrice
);
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
,
consumerMember
);
}
else
{
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
// priceResponse.setTotalFeeNow(totalFee);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
}
}
else
{
SPack
byId
=
packService
.
getById
(
roomLabel
.
getPackId
());
if
(!
ObjectUtils
.
isEmpty
(
byId
)
&&
byId
.
getIsOpen
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
...
...
@@ -2732,18 +2732,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setTotalFeeNow
(
payPrice
);
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
if
(
CollectionUtils
.
isNotEmpty
(
consumerSecondaryCardList
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCardList
,
priceResponse
,
byId
,
payPrice
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerSecondaryCard
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCard
,
priceResponse
,
byId
,
payPrice
);
}
else
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
roomLabel
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
}
// if(ObjectUtil.isNotEmpty(consumerMonthlyCard)){
// totalFee = getBigDecimal(consumerMonthlyCard,timeLong,priceResponse,totalFee,room);
// }
...
...
@@ -2755,17 +2757,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setTotalFeeNow
(
payPrice
);
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
))
{
totalFee
=
getBigDecimal
(
consumerMonthlyCard
,
timeLong
,
priceResponse
,
totalPrice
,
room
,
consumerMember
);
}
else
{
queryWrapper
.
eq
(
Activity:
:
getLabelId
,
roomLabel
.
getLabelId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
,
consumerMember
);
}
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
...
...
@@ -2778,19 +2781,19 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setTotalFeeNow
(
payPrice
);
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
if
(
CollectionUtils
.
isNotEmpty
(
consumerSecondaryCardList
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCardList
,
priceResponse
,
byId
,
payPrice
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerSecondaryCard
))
{
totalFee
=
getBigDecimal
(
consumerSecondaryCard
,
priceResponse
,
byId
,
payPrice
);
}
else
{
queryWrapper
.
eq
(
Activity:
:
getPackId
,
request
.
getPackId
());
activity
=
activityService
.
getOne
(
queryWrapper
);
totalFee
=
getBigDecimal
(
request
,
activity
,
payPrice
,
user
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setMemberDiscount
(
payPrice
.
subtract
(
totalFee
));
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
,
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscount
());
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
}
}
priceResponse
.
setTotalFee
(
payPrice
);
if
(
ObjectUtil
.
isEmpty
(
consumerWallet
)
&&
totalFee
.
compareTo
(
new
BigDecimal
(
0
))
==
0
)
{
...
...
@@ -3121,7 +3124,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
private
BigDecimal
getBigDecimal
(
ConsumerMonthlyCard
consumerMonthlyCard
,
BigDecimal
timeLong
,
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
)
{
ComputedOrderPriceResponse
priceResponse
,
BigDecimal
totalFee
,
SRoom
room
,
ConsumerMember
consumerMember
)
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
priceResponse
.
setDiscountRatio
(
memberConfig
.
getDiscountRatio
());
priceResponse
.
setTotalFee
(
totalFee
);
if
(
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
timeLong
)
>=
0
)
{
priceResponse
.
setDuration
(
timeLong
);
priceResponse
.
setRemainingDuration
(
consumerMonthlyCard
.
getFreeDuration
().
subtract
(
timeLong
));
...
...
@@ -3138,21 +3144,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
remainingBalance
=
totalFee
.
subtract
(
remainingBalance
);
priceResponse
.
setTotalFeeNow
(
remainingBalance
);
priceResponse
.
setMemberDiscount
(
totalFee
.
subtract
(
remainingBalance
));
totalFee
=
remainingBalance
;
totalFee
=
remainingBalance
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
;
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setPayFee
(
remainingBalance
);
priceResponse
.
setMonthlyCardId
(
consumerMonthlyCard
.
getId
());
priceResponse
.
setMemberDiscount
(
remainingBalance
.
subtract
(
totalFee
));
}
return
totalFee
;
}
private
BigDecimal
getBigDecimal
(
List
<
ConsumerSecondaryCard
>
consumerSecondaryCardList
,
private
BigDecimal
getBigDecimal
(
ConsumerSecondaryCard
consumerSecondaryCard
,
ComputedOrderPriceResponse
priceResponse
,
SPack
byId
,
BigDecimal
payPrice
)
{
//获取集合中次数最少的次卡,次数不低于0
ConsumerSecondaryCard
consumerSecondaryCard
=
consumerSecondaryCardList
.
stream
().
min
(
Comparator
.
comparing
(
ConsumerSecondaryCard:
:
getNumber
)).
get
();
if
(
consumerSecondaryCard
.
getPackId
().
equals
(
byId
.
getId
()))
{
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setMemberDiscount
(
BigDecimal
.
ZERO
);
priceResponse
.
setTotalFeeNow
(
payPrice
);
priceResponse
.
setTotalFeeNow
(
BigDecimal
.
ZERO
);
priceResponse
.
setPayFee
(
BigDecimal
.
ZERO
);
priceResponse
.
setSecondaryCardId
(
consumerSecondaryCard
.
getId
());
payPrice
=
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