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
6753c950
Commit
6753c950
authored
Jul 24, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单计算增加字段
parent
f0d8a186
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
76 deletions
+102
-76
ComputedOrderPriceResponse.java
...ava/share/system/response/ComputedOrderPriceResponse.java
+7
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+95
-75
No files found.
share-system/src/main/java/share/system/response/ComputedOrderPriceResponse.java
View file @
6753c950
...
...
@@ -27,8 +27,14 @@ public class ComputedOrderPriceResponse implements Serializable {
@ApiModelProperty
(
value
=
"实际支付金额"
)
private
BigDecimal
payFee
;
@ApiModelProperty
(
value
=
"总金额"
)
@ApiModelProperty
(
value
=
"
原
总金额"
)
private
BigDecimal
totalFee
;
//现总金额
@ApiModelProperty
(
value
=
"现总金额"
)
private
BigDecimal
totalFeeNow
;
//优惠折扣
@ApiModelProperty
(
value
=
"优惠折扣"
)
private
BigDecimal
discount
;
@ApiModelProperty
(
value
=
"优惠金额"
)
private
BigDecimal
discountFee
;
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
6753c950
...
...
@@ -2244,7 +2244,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
);
}
else
{
...
...
@@ -2255,7 +2257,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, byId);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
...
...
@@ -2265,7 +2269,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
}
// totalFee = getBigDecimal(consumerWallet, timeLong, priceResponse, totalFee, room);
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
room
,
request
);
...
...
@@ -2278,7 +2284,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
,
consumerMember
);
priceResponse
.
setTotalFeeNow
(
totalFee
);
priceResponse
.
setDiscount
(
totalFee
.
divide
(
payPrice
).
multiply
(
new
BigDecimal
(
100
)));
}
totalFee
=
getBigDecimal
(
consumerWallet
,
activity
,
timeLong
,
priceResponse
,
totalFee
,
byId
,
request
);
}
...
...
@@ -2297,32 +2305,32 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
else
{
priceResponse
.
setDiscountRatio
(
priceResponse
.
getDiscountFee
().
divide
(
priceResponse
.
getTotalFee
(),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
100
)));
}
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
(
ObjectUtil
.
isNotEmpty
(
consumerMember
)
&&
!
match
&&
!
match1
)
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
)));
priceResponse
.
setCouponFee
(
priceResponse
.
getDiscountFee
());
}
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
MemberConfig
memberConfig
=
memberConfigService
.
getOne
(
new
LambdaQueryWrapper
<
MemberConfig
>().
eq
(
MemberConfig:
:
getId
,
consumerMember
.
getMemberConfigId
()));
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
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
));
}
}
}
//
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 (ObjectUtil.isNotEmpty(consumerMember) && !match && !match1) {
//
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getId, consumerMember.getMemberConfigId()));
//
//总金额乘以折扣比例除以100
//
priceResponse.setPayFee(priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100)));
////
priceResponse.setCouponFee(priceResponse.getDiscountFee());
//
}
//
} else {
//
if (ObjectUtil.isNotEmpty(consumerMember)) {
//
MemberConfig memberConfig = memberConfigService.getOne(new LambdaQueryWrapper<MemberConfig>().eq(MemberConfig::getId, consumerMember.getMemberConfigId()));
//
//总金额乘以折扣比例除以100
//
priceResponse.setPayFee(priceResponse.getPayFee().multiply(memberConfig.getDiscountRatio()).divide(new BigDecimal(100)));
//
priceResponse.setDiscountFee(priceResponse.getTotalFee().subtract(priceResponse.getPayFee()));
////
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
.
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
)));
...
...
@@ -2357,7 +2365,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
//总金额乘以折扣比例除以100
priceResponse
.
setPayFee
(
priceResponse
.
getPayFee
().
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
)));
priceResponse
.
setDiscountFee
(
priceResponse
.
getTotalFee
().
subtract
(
priceResponse
.
getPayFee
()));
priceResponse
.
setCouponFee
(
priceResponse
.
getDiscountFee
());
//
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
{
...
...
@@ -2404,7 +2412,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
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
());
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
remainingBalance
=
priceResponse
.
getTotalFeeNow
().
subtract
(
remainingBalance
);
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
>=
0
)
{
priceResponse
.
setBalance
(
remainingBalance
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
remainingBalance
));
...
...
@@ -2423,7 +2432,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
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
());
BigDecimal
remainingBalance
=
consumerWallet
.
getRemainingDuration
().
multiply
(
room
.
getPrice
());
remainingBalance
=
priceResponse
.
getTotalFeeNow
().
subtract
(
remainingBalance
);
if
(
consumerWallet
.
getBalance
().
compareTo
(
remainingBalance
)
>=
0
)
{
priceResponse
.
setBalance
(
remainingBalance
);
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
remainingBalance
));
...
...
@@ -2466,14 +2477,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
()));
if
(
consumerWallet
.
getBalance
().
compareTo
(
priceResponse
.
getTotalFeeNow
())
>=
0
)
{
priceResponse
.
setBalance
(
priceResponse
.
getTotalFeeNow
());
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
priceResponse
.
getTotalFeeNow
()));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
byId
.
getPrice
())
<
0
)
{
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
priceResponse
.
getTotalFeeNow
())
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
totalFee
=
byId
.
getPrice
().
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
priceResponse
.
getTotalFeeNow
().
subtract
(
consumerWallet
.
getBalance
());
}
}
}
...
...
@@ -2483,14 +2494,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
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
()));
if
(
consumerWallet
.
getBalance
().
compareTo
(
priceResponse
.
getTotalFeeNow
())
>=
0
)
{
priceResponse
.
setBalance
(
priceResponse
.
getTotalFeeNow
());
priceResponse
.
setRemainingBalance
(
consumerWallet
.
getBalance
().
subtract
(
priceResponse
.
getTotalFeeNow
()));
totalFee
=
new
BigDecimal
(
0
);
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
byId
.
getPrice
())
<
0
)
{
}
else
if
(
consumerWallet
.
getBalance
().
compareTo
(
priceResponse
.
getTotalFeeNow
())
<
0
)
{
priceResponse
.
setBalance
(
consumerWallet
.
getBalance
());
priceResponse
.
setRemainingBalance
(
new
BigDecimal
(
0
));
totalFee
=
byId
.
getPrice
().
subtract
(
consumerWallet
.
getBalance
());
totalFee
=
priceResponse
.
getTotalFeeNow
().
subtract
(
consumerWallet
.
getBalance
());
}
}
}
...
...
@@ -2498,42 +2509,51 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
totalFee
;
}
private
BigDecimal
getBigDecimal
(
OrderComputedPriceRequest
request
,
Activity
activity
,
BigDecimal
payPrice
,
SConsumer
user
)
{
if
(
ObjectUtil
.
isNotEmpty
(
activity
)
&&
ObjectUtil
.
isNotEmpty
(
user
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getValidOrderStatus
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
private
BigDecimal
getBigDecimal
(
OrderComputedPriceRequest
request
,
Activity
activity
,
BigDecimal
payPrice
,
SConsumer
user
,
ConsumerMember
consumerMember
)
{
if
(
ObjectUtil
.
isNotEmpty
(
user
))
{
if
(
ObjectUtil
.
isNotEmpty
(
activity
))
{
CronParser
cronParser
=
new
CronParser
(
CronDefinitionBuilder
.
instanceDefinitionFor
(
CronType
.
QUARTZ
));
Cron
cron
=
cronParser
.
parse
(
activity
.
getCronExpression
());
ExecutionTime
executionTime
=
ExecutionTime
.
forCron
(
cron
);
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SOrder:
:
getConsumerId
,
user
.
getId
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getValidOrderStatus
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
// queryWrapper.ne(SOrder::getPayPrice, new BigDecimal(0));
//预约结束时间大于等于今天的年月日
queryWrapper
.
ge
(
SOrder:
:
getPreEndDate
,
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
new
Date
())));
queryWrapper
.
isNull
(
SOrder:
:
getCouponId
);
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
orderList
))
{
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
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
}
else
{
AtomicInteger
i
=
new
AtomicInteger
();
orderList
.
stream
().
forEach
(
item
->
{
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
// && (item.getPayPrice().compareTo(item.getTotalPrice().multiply(activity.getDiscountRatio()).divide(new BigDecimal(100)))) > 0
)
{
i
.
getAndIncrement
();
//预约结束时间大于等于今天的年月日
queryWrapper
.
ge
(
SOrder:
:
getPreEndDate
,
DateUtils
.
parseDate
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
new
Date
())));
queryWrapper
.
isNull
(
SOrder:
:
getCouponId
);
List
<
SOrder
>
orderList
=
list
(
queryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
orderList
))
{
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
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
else
{
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
payPrice
=
payPrice
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
});
if
(
i
.
get
()
==
0
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
else
{
return
payPrice
;
AtomicInteger
i
=
new
AtomicInteger
();
orderList
.
stream
().
forEach
(
item
->
{
boolean
match
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreStartDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
boolean
match1
=
executionTime
.
isMatch
(
ZonedDateTime
.
ofInstant
(
item
.
getPreEndDate
().
toInstant
(),
ZoneId
.
systemDefault
()));
if
(
match
&&
match1
// && (item.getPayPrice().compareTo(item.getTotalPrice().multiply(activity.getDiscountRatio()).divide(new BigDecimal(100)))) > 0
)
{
i
.
getAndIncrement
();
}
});
if
(
i
.
get
()
==
0
)
{
payPrice
=
payPrice
.
multiply
(
activity
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
else
{
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
payPrice
=
payPrice
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
}
}
else
{
MemberConfig
memberConfig
=
memberConfigService
.
getById
(
consumerMember
.
getMemberConfigId
());
payPrice
=
payPrice
.
multiply
(
memberConfig
.
getDiscountRatio
()).
divide
(
new
BigDecimal
(
100
));
}
}
return
payPrice
;
...
...
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