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
945850ee
Commit
945850ee
authored
Sep 20, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master-modify-cutAmount' into master-modify-cutAmount
parents
091f3b0d
ae656f5b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
30 deletions
+61
-30
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+48
-15
OrderRefundBiz.java
...main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
+3
-3
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+6
-8
OrderRefundController.java
...a/com/xxfc/platform/order/rest/OrderRefundController.java
+3
-3
OrderTourService.java
...ava/com/xxfc/platform/order/service/OrderTourService.java
+1
-1
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
945850ee
...
...
@@ -88,15 +88,27 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param timeLag 与开始时间的时间差
* @param dicParentKey
*/
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
BigDecimal
mainItemRealAmount
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
,
OrderAccountDetail
oad
)
{
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
BigDecimal
mainItemRealAmount
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
,
OrderAccountDetail
oad
,
BigDecimal
topAmount
)
{
//计算退款金额
//商品价格 - 优惠券减免的价格
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
mainItemRealAmount
);
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
"取消订单退款:"
);
StringBuilder
orderRefundDescBuilder
=
new
StringBuilder
(
""
);
StringBuilder
depositRefundDescBuilder
=
new
StringBuilder
(
""
);
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
if
(
null
==
oad
)
{
oad
=
new
OrderAccountDetail
();
}
BigDecimal
refundMainGoodsAmount
=
calculateRefund
(
originalRefundAmount
,
timeLag
,
dicParentKey
,
refundDescBuilder
,
oad
);
BigDecimal
orderDeductAmount
=
calculateDeduction
(
originalRefundAmount
,
timeLag
,
dicParentKey
,
orderRefundDescBuilder
);
orderDeductAmount
=
orderDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
if
(
topAmount
.
compareTo
(
orderDeductAmount
)
>
0
)
{
totalDeductAmount
=
totalDeductAmount
.
add
(
orderDeductAmount
);
topAmount
=
topAmount
.
subtract
(
orderDeductAmount
);
}
else
{
totalDeductAmount
=
totalDeductAmount
.
add
(
topAmount
);
orderDeductAmount
=
topAmount
;
topAmount
=
BigDecimal
.
ZERO
;
}
BigDecimal
refundMainGoodsAmount
=
originalRefundAmount
.
subtract
(
orderDeductAmount
);
refundMainGoodsAmount
=
refundMainGoodsAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
//退款金额 = 主要商品退款 + (其他商品退款) 即--> 主要商品退款 + (总商品款 - 主要商品款)
...
...
@@ -106,22 +118,41 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
// 押金
BigDecimal
originalRefundAmountDeposit
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
BigDecimal
refundAmountDeposit
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
refundDescBuilder
=
refundDescBuilder
.
append
(
",押金退款:"
);
if
(
null
!=
originalDeductAmount
&&
BigDecimal
.
ZERO
.
compareTo
(
originalDeductAmount
)
<
0
)
{
//通过原扣除款 计算剩余款
BigDecimal
residueAmount
=
calculateRefund
(
originalDeductAmount
,
timeLag
,
dicParentKey
,
refundDescBuilder
,
oad
);
residueAmount
=
residueAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
depositDeductAmount
=
calculateDeduction
(
originalDeductAmount
,
timeLag
,
dicParentKey
,
depositRefundDescBuilder
);
depositDeductAmount
=
depositDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
if
(
topAmount
.
compareTo
(
depositDeductAmount
)
>
0
)
{
totalDeductAmount
=
totalDeductAmount
.
add
(
depositDeductAmount
);
topAmount
=
topAmount
.
subtract
(
depositDeductAmount
);
}
else
{
totalDeductAmount
=
totalDeductAmount
.
add
(
topAmount
);
depositDeductAmount
=
topAmount
;
topAmount
=
BigDecimal
.
ZERO
;
}
//返回押金
refundAmountDeposit
=
originalRefundAmount
.
subtract
(
orderDeductAmount
);
}
//退款金额 :押金 - (原扣除款 - 剩余款) 即: 押金 - (免费天数对应的钱 - 剩余款)
refundAmountDeposit
=
originalRefundAmountDeposit
.
subtract
(
originalDeductAmount
.
subtract
(
residueAmount
));
//设置违章款账单
StringBuilder
stringBuilder
=
new
StringBuilder
(
""
);
if
(
totalDeductAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
orderRefundDescBuilder
.
length
()
>
0
)
{
stringBuilder
=
orderRefundDescBuilder
;
}
else
{
stringBuilder
=
depositRefundDescBuilder
;
}
oad
.
getDeductions
().
add
(
initDeduction
(
totalDeductAmount
,
stringBuilder
.
toString
(),
DeductionTypeEnum
.
VIOLATE_CANCEL
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
));
}
//设置订单押金金额
originalRefundAmount
=
originalRefundAmount
.
add
(
originalRefundAmountDeposit
);
oad
.
setDepositAmount
(
refundAmountDeposit
);
refundAmount
=
refundAmount
.
add
(
refundAmountDeposit
);
//退款子流程: 订单基础,退款描述, 款金额
refundSubProcess
(
baseOrder
,
refundDesc
Builder
.
toString
(),
originalRefundAmount
,
refundAmount
,
AccountTypeEnum
.
OUT_ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
refundSubProcess
(
baseOrder
,
string
Builder
.
toString
(),
originalRefundAmount
,
refundAmount
,
AccountTypeEnum
.
OUT_ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
return
refundAmount
;
}
...
...
@@ -163,11 +194,12 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}
}
public
BigDecimal
calculate
Refund
(
BigDecimal
goodsAmount
,
Long
timeLag
,
String
dicParentKey
,
StringBuilder
refundDescBuilder
,
OrderAccountDetail
orderAccountDetail
)
{
public
BigDecimal
calculate
Deduction
(
BigDecimal
goodsAmount
,
Long
timeLag
,
String
dicParentKey
,
StringBuilder
refundDescBuilder
)
{
BigDecimal
refundGoodsAmount
=
goodsAmount
;
if
(
null
==
orderAccountDetail
)
{
orderAccountDetail
=
new
OrderAccountDetail
();
}
BigDecimal
deductGoodsAmount
=
goodsAmount
;
// if(null == orderAccountDetail) {
// orderAccountDetail = new OrderAccountDetail();
// }
//根据时间处理goodsAmount
//获取出发时间 到现在 距离时间
...
...
@@ -193,13 +225,14 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}})+
""
).
toString
());
refundDescBuilder
=
refundDescBuilder
.
insert
(
0
,
names
[
1
]+
","
);
if
(
goodsAmount
.
subtract
(
refundGoodsAmount
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orderAccountDetail
.
getDeductions
().
add
(
initDeduction
(
goodsAmount
.
subtract
(
refundGoodsAmount
),
names
[
1
],
DeductionTypeEnum
.
VIOLATE_CANCEL
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
));
deductGoodsAmount
=
goodsAmount
.
subtract
(
refundGoodsAmount
);
//orderAccountDetail.getDeductions().add(initDeduction(goodsAmount.subtract(refundGoodsAmount), names[1], DeductionTypeEnum.VIOLATE_CANCEL, OrderAccountDeduction.ORIGIN_DEPOSIT));
}
break
;
}
}
return
refund
GoodsAmount
;
return
deduct
GoodsAmount
;
}
/**
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
View file @
945850ee
...
...
@@ -150,7 +150,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
// //商品价格 - 优惠券减免的价格
// BigDecimal originalRefundAmount = BigDecimal.ZERO.add(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
// StringBuilder refundDescBuilder = new StringBuilder("取消订单退款:");
// BigDecimal refundGoodsAmount = calculate
Refund
(originalRefundAmount, timeLag, dicParentKey, refundDescBuilder);
// BigDecimal refundGoodsAmount = calculate
Deduction
(originalRefundAmount, timeLag, dicParentKey, refundDescBuilder);
// refundGoodsAmount = refundGoodsAmount.setScale(2, RoundingMode.HALF_UP);
//
// //退款金额
...
...
@@ -176,7 +176,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
// StringBuilder refundDescBuilder = new StringBuilder("取消订单押金退款:");
// if(null != originalDeductAmount && BigDecimal.ZERO.compareTo(originalDeductAmount) < 0) {
// //通过原扣除款 计算剩余款
// BigDecimal residueAmount = calculate
Refund
(originalDeductAmount, timeLag, dicParentKey, refundDescBuilder);
// BigDecimal residueAmount = calculate
Deduction
(originalDeductAmount, timeLag, dicParentKey, refundDescBuilder);
// residueAmount = residueAmount.setScale(2, RoundingMode.HALF_UP);
//
// //退款金额 :押金 - (原扣除款 - 剩余款) 即: 押金 - (免费天数对应的钱 - 剩余款)
...
...
@@ -188,7 +188,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
// return refundAmount;
// }
//
// public BigDecimal calculate
Refund
(BigDecimal goodsAmount, Long timeLag, String dicParentKey, StringBuilder refundDescBuilder) {
// public BigDecimal calculate
Deduction
(BigDecimal goodsAmount, Long timeLag, String dicParentKey, StringBuilder refundDescBuilder) {
// BigDecimal refundGoodsAmount = goodsAmount;
//
// //根据时间处理goodsAmount
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
945850ee
...
...
@@ -199,15 +199,13 @@ public class OrderCancelBiz {
//判断是否使用免费天数,并且进行扣款
if
(
freeDays
>
0
)
{
freeDayAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
orvd
.
getFreeDays
()+
""
));
//违约金封顶 租车身份价 * 2天
BigDecimal
topAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
));
if
(
freeDayAmount
.
compareTo
(
topAmount
)
>
0
)
{
freeDayAmount
=
topAmount
;
}
}
//违约金封顶 租车身份价 * 2天
BigDecimal
topAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
));
//退款流程
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
orderItem
.
getRealAmount
(),
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
,
oad
);
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
orderItem
.
getRealAmount
(),
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
,
oad
,
topAmount
);
//如果有扣款项,则生成额外的费用明细
if
(
oad
.
getDeductions
().
size
()
>
0
)
{
...
...
@@ -260,7 +258,7 @@ public class OrderCancelBiz {
}
//退款流程
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
adultItem
.
getRealAmount
().
add
(
childItem
.
getRealAmount
()),
timeLag
,
APP_ORDER
+
"_"
+
key
,
BigDecimal
.
ZERO
,
BigDecimal
.
ZERO
,
oad
);
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
adultItem
.
getRealAmount
().
add
(
childItem
.
getRealAmount
()),
timeLag
,
APP_ORDER
+
"_"
+
key
,
BigDecimal
.
ZERO
,
BigDecimal
.
ZERO
,
oad
,
BigDecimal
.
ZERO
);
//如果有扣款项,则生成额外的费用明细
if
(
oad
.
getDeductions
().
size
()
>
0
)
{
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRefundController.java
View file @
945850ee
...
...
@@ -84,7 +84,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
InProgressVO
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
orderPageVO
,
baseOrderBiz
.
getDaysBetweenDateTime
(
startTime
,
nowTime
));
// orderRefundAmount = orderAccountBiz.calculate
Refund
(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// orderRefundAmount = orderAccountBiz.calculate
Deduction
(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// , orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
// , DictionaryKey.APP_ORDER+ "_"+ RENT_REFUND
// , refundDescBuilder);
...
...
@@ -102,7 +102,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
// }});
// originalDeductAmount = orderItem.getUnitPrice().multiply(new BigDecimal(orvd.getFreeDays()+ ""));
// }
// BigDecimal residueAmount = orderRefundBiz.calculate
Refund
(originalDeductAmount, timeLag, APP_ORDER+ "_"+ RENT_REFUND, refundDescBuilder);
// BigDecimal residueAmount = orderRefundBiz.calculate
Deduction
(originalDeductAmount, timeLag, APP_ORDER+ "_"+ RENT_REFUND, refundDescBuilder);
//扣款 = 违约金 + 消费金额
BigDecimal
residueAmount
=
BigDecimal
.
ZERO
;
//inProgressVO.get
...
...
@@ -119,7 +119,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
// if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
// key = TOUR_REFUND;
// }
// orderRefundAmount = orderRefundBiz.calculate
Refund
(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// orderRefundAmount = orderRefundBiz.calculate
Deduction
(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
// , orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
// , DictionaryKey.APP_ORDER+ "_"+ key
// , refundDescBuilder);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderTourService.java
View file @
945850ee
...
...
@@ -313,7 +313,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
* @return
*/
private
void
costDetail
(
TourPriceVO
vo
,
String
children
)
{
OrderTemplate
template
=
orderTemplateBiz
.
selectByCode
(
OrderCostEnum
.
RENT_VEHICLE
.
getCode
());
OrderTemplate
template
=
orderTemplateBiz
.
selectByCode
(
OrderCostEnum
.
TOUR
.
getCode
());
template
.
setTemplate
(
orderTemplateBiz
.
result
(
template
.
getTemplate
(),
new
HashMap
(){{
put
(
"children"
,
children
);
put
(
"paramJson"
,
""
);
...
...
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