Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
9a370439
Commit
9a370439
authored
Sep 20, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-modify-cutAmount' into dev
parents
f799ea1e
52babe51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
37 deletions
+38
-37
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+38
-37
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
9a370439
...
@@ -78,51 +78,52 @@ public class OrderCalculateBiz {
...
@@ -78,51 +78,52 @@ public class OrderCalculateBiz {
Integer
residueDays
=
orderItem
.
getTotalNum
()
-
useDays
;
Integer
residueDays
=
orderItem
.
getTotalNum
()
-
useDays
;
//过了出发时间取消订单 ,优先使用免费天数
//过了出发时间取消订单 ,优先使用免费天数
if
(
backFreeDays
<=
0
)
{
if
(
backFreeDays
<=
0
)
{
//
使用天数 小于 总
天数
//
消费
天数
if
(
useDays
<
orderItem
.
getTotalNum
())
{
Integer
consumeDays
=
useDays
-
freeDays
;
//需要扣除订单费用
//如果使用天数 大于 总天数
//判断是否达到优惠券条件 不符合则返还优惠券
if
(
useDays
>
orderItem
.
getTotalNum
())
{
//消费天数
//消费天数
Integer
consumeDays
=
0
-
backFreeDays
;
consumeDays
=
orderItem
.
getTotalNum
()
-
freeDays
;
//计算使用天数的费用
}
consumeAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
consumeDays
+
""
));
if
(
StrUtil
.
isNotBlank
(
baseOrder
.
getCouponTickerNos
()))
{
List
<
BigDecimal
>
couponAmounts
=
Lists
.
newArrayList
();
for
(
String
tickerNo
:
baseOrder
.
getCouponTickerNos
().
split
(
","
))
{
BigDecimal
couponAmount
=
activityFeign
.
use
(
baseOrder
.
getUserId
(),
Lists
.
newArrayList
(
tickerNo
),
baseOrder
.
getNo
(),
Coupon
.
CHANNEL_RENT
,
consumeAmount
,
ActivityFeign
.
TYPE_CHECK
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//能够使用优惠券,则不返还
couponAmounts
.
add
(
couponAmount
);
}
else
{
backCouponNos
.
add
(
tickerNo
);
}
}
for
(
BigDecimal
couponAmount
:
couponAmounts
)
{
//需要扣除订单费用
consumeAmount
=
consumeAmount
.
subtract
(
couponAmount
);
//判断是否达到优惠券条件 不符合则返还优惠券
//计算使用天数的费用
consumeAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
consumeDays
+
""
));
if
(
StrUtil
.
isNotBlank
(
baseOrder
.
getCouponTickerNos
()))
{
List
<
BigDecimal
>
couponAmounts
=
Lists
.
newArrayList
();
for
(
String
tickerNo
:
baseOrder
.
getCouponTickerNos
().
split
(
","
))
{
BigDecimal
couponAmount
=
activityFeign
.
use
(
baseOrder
.
getUserId
(),
Lists
.
newArrayList
(
tickerNo
),
baseOrder
.
getNo
(),
Coupon
.
CHANNEL_RENT
,
consumeAmount
,
ActivityFeign
.
TYPE_CHECK
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//能够使用优惠券,则不返还
couponAmounts
.
add
(
couponAmount
);
}
else
{
backCouponNos
.
add
(
tickerNo
);
}
}
}
}
//设置消费金额
for
(
BigDecimal
couponAmount
:
couponAmounts
)
{
consumeAmount
=
consumeAmount
.
add
(
otherItemRealAmount
);
consumeAmount
=
consumeAmount
.
subtract
(
couponAmount
);
inProgressVO
.
setConsumeAmount
(
consumeAmount
);
if
(
consumeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//消费金额 大于0 增加额外费用
OrderAccountDeduction
extraDeduction
=
orderAccountBiz
.
initDeduction
(
consumeAmount
,
"消费金额"
,
DeductionTypeEnum
.
CONSUME
,
OrderAccountDeduction
.
ORIGIN_ORDER_DEPOSIT
);
oad
.
getDeductions
().
add
(
extraDeduction
);
}
}
}
//消费金额 小于商品的金额 返回钱
//设置消费金额
if
(
consumeAmount
.
compareTo
(
baseOrder
.
getGoodsAmount
())
<=
0
)
{
consumeAmount
=
consumeAmount
.
add
(
otherItemRealAmount
);
//设置返回钱
inProgressVO
.
setConsumeAmount
(
consumeAmount
);
refundAmount
=
refundAmount
.
add
(
baseOrder
.
getGoodsAmount
().
subtract
(
consumeAmount
));
}
else
{
if
(
consumeAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
//设置额外扣减(押金里面扣)
//消费金额 大于0 增加额外费用
inProgressVO
.
setExtraAmount
(
consumeAmount
.
subtract
(
baseOrder
.
getGoodsAmount
())
);
OrderAccountDeduction
extraDeduction
=
orderAccountBiz
.
initDeduction
(
consumeAmount
,
"消费金额"
,
DeductionTypeEnum
.
CONSUME
,
OrderAccountDeduction
.
ORIGIN_ORDER_DEPOSIT
);
}
oad
.
getDeductions
().
add
(
extraDeduction
);
}
else
{
}
//消费金额 小于商品的金额 返回钱
if
(
consumeAmount
.
compareTo
(
baseOrder
.
getGoodsAmount
())
<=
0
)
{
//设置返回钱
refundAmount
=
refundAmount
.
add
(
baseOrder
.
getGoodsAmount
().
subtract
(
consumeAmount
));
}
else
{
//设置额外扣减(押金里面扣)
inProgressVO
.
setExtraAmount
(
consumeAmount
.
subtract
(
baseOrder
.
getGoodsAmount
()));
}
}
}
else
{
}
else
{
//返回剩余免费天数,返回优惠券,订单款
//返回剩余免费天数,返回优惠券,订单款
...
...
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