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
34be0465
Commit
34be0465
authored
Sep 19, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改订单价格计算
parent
b73432ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
30 deletions
+47
-30
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+47
-30
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
34be0465
...
...
@@ -2526,6 +2526,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
);
}
}
else
{
...
...
@@ -2542,6 +2543,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
);
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
...
...
@@ -2558,6 +2560,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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);
...
...
@@ -2577,6 +2580,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
);
}
...
...
@@ -2597,11 +2601,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// } else {
// priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
// }
if
(
ObjectUtil
.
isNotEmpty
(
priceResponse
.
getDiscountFee
())
&&
priceResponse
.
getTotalFee
().
compareTo
(
new
BigDecimal
(
0.00
))
>
0
)
{
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
}
else
{
priceResponse
.
setDiscountRatio
(
new
BigDecimal
(
0
));
}
//
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) {
//
priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
//
} else {
//
priceResponse.setDiscountRatio(new BigDecimal(0));
//
}
}
else
{
// 判断优惠券是否可以使用
if
(
Objects
.
nonNull
(
user
)
&&
Objects
.
nonNull
(
request
.
getCouponId
()))
{
...
...
@@ -2616,28 +2620,20 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
priceResponse
.
setRemainingDuration
(
new
BigDecimal
(
0
));
if
(
priceResponse
.
getPayFee
().
compareTo
(
new
BigDecimal
(
0
))
>
0
)
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
if
(
ObjectUtil
.
isNotEmpty
(
consumer
Wallet
)
&&
ObjectUtil
.
isNotEmpty
(
consumer
Member
))
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getMembershipLevel
,
consumerMember
.
getMembershipLevel
()));
BigDecimal
payFee
=
priceResponse
.
getPayFee
();
BigDecimal
divide
=
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
if
(
payFee
.
compareTo
(
divide
)
==
0
)
{
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
}
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
divide
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setTotalFeeNow
(
divide
);
priceResponse
.
setMemberDiscount
(
payFee
.
subtract
(
divide
));
// priceResponse.setCouponFee(priceResponse.getDiscountFee());
if
(
ObjectUtil
.
isNotEmpty
(
priceResponse
.
getDiscountFee
())
&&
priceResponse
.
getTotalFee
().
compareTo
(
new
BigDecimal
(
0.00
))
>
0
)
{
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
}
else
{
priceResponse
.
setDiscountRatio
(
new
BigDecimal
(
0
));
}
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerWallet
))
{
if
(
consumerWallet
.
getBalance
().
compareTo
(
priceResponse
.
getPayFee
())
>=
0
)
{
BigDecimal
payFee
=
priceResponse
.
getPayFee
();
BigDecimal
divide
=
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
if
(
payFee
.
compareTo
(
divide
)
==
0
)
{
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
}
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
divide
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setTotalFeeNow
(
divide
);
priceResponse
.
setMemberDiscount
(
payFee
.
subtract
(
divide
));
priceResponse
.
setBalance
(
priceResponse
.
getPayFee
());
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
priceResponse
.
getPayFee
()));
totalFee
=
new
BigDecimal
(
0
);
...
...
@@ -2646,7 +2642,28 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
totalFee
=
priceResponse
.
getPayFee
().
subtract
(
consumerWallet
.
getBalance
());
}
priceResponse
.
setPayFee
(
totalFee
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
if
(
priceResponse
.
getPayFee
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
BigDecimal
payFee
=
priceResponse
.
getPayFee
();
BigDecimal
divide
=
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
if
(
payFee
.
compareTo
(
divide
)
==
0
)
{
priceResponse
.
setDiscount
(
BigDecimal
.
ZERO
);
}
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
divide
);
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setTotalFeeNow
(
divide
);
priceResponse
.
setMemberDiscount
(
payFee
.
subtract
(
divide
));
// priceResponse.setCouponFee(priceResponse.getDiscountFee());
// if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) {
// priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
// } else {
// priceResponse.setDiscountRatio(new BigDecimal(0));
// }
}
}
// priceResponse.setDiscount(priceResponse.getPayFee().divide(priceResponse.getTotalFeeNow(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
if
(
ObjectUtil
.
isEmpty
(
consumerWallet
)
&&
ObjectUtil
.
isEmpty
(
consumerMember
))
{
priceResponse
.
setTotalFeeNow
(
priceResponse
.
getPayFee
());
priceResponse
.
setMemberDiscount
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
...
...
@@ -2657,11 +2674,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
}
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
if
(
ObjectUtil
.
isNotEmpty
(
priceResponse
.
getDiscountFee
())
&&
priceResponse
.
getTotalFee
().
compareTo
(
new
BigDecimal
(
0.00
))
>
0
)
{
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
}
else
{
priceResponse
.
setDiscountRatio
(
new
BigDecimal
(
0
));
}
//
if (ObjectUtil.isNotEmpty(priceResponse.getDiscountFee()) && priceResponse.getTotalFee().compareTo(new BigDecimal(0.00)) > 0) {
//
priceResponse.setDiscountRatio(priceResponse.getDiscountFee().divide(priceResponse.getTotalFee(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)));
//
} else {
//
priceResponse.setDiscountRatio(new BigDecimal(0));
//
}
}
return
priceResponse
;
}
...
...
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