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
ea2af0b2
Commit
ea2af0b2
authored
Sep 24, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-modify-cutAmount' into dev
parents
1d8b68b1
86925b86
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
75 deletions
+102
-75
OrderAccountDetail.java
.../xxfc/platform/order/pojo/account/OrderAccountDetail.java
+4
-0
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+47
-28
OrderVehicleCrosstownBiz.java
...com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
+1
-1
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+2
-2
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+9
-9
OrderRefundController.java
...a/com/xxfc/platform/order/rest/OrderRefundController.java
+39
-33
VehicleActiveService.java
...a/com/xxfc/platform/vehicle/biz/VehicleActiveService.java
+0
-2
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/account/OrderAccountDetail.java
View file @
ea2af0b2
...
@@ -29,4 +29,8 @@ public class OrderAccountDetail {
...
@@ -29,4 +29,8 @@ public class OrderAccountDetail {
* 扣款列表
* 扣款列表
*/
*/
List
<
OrderAccountDeduction
>
deductions
=
Lists
.
newArrayList
();
List
<
OrderAccountDeduction
>
deductions
=
Lists
.
newArrayList
();
public
BigDecimal
realTotalDeduct
()
{
return
originDepositAmount
.
add
(
originOrderAmount
).
subtract
(
orderAmount
).
subtract
(
depositAmount
);
}
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
ea2af0b2
...
@@ -84,21 +84,27 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
...
@@ -84,21 +84,27 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
/**
/**
* 租车退款流程
* 租车退款流程
* @param baseOrder
* @param baseOrder
* @param
mainItemRealAmount
主要商品(租车费用、旅游费用等)
* @param
orderDeductSource
主要商品(租车费用、旅游费用等)
* @param timeLag 与开始时间的时间差
* @param timeLag 与开始时间的时间差
* @param dicParentKey
* @param dicParentKey
*/
*/
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
BigDecimal
mainItemRealAmount
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
,
OrderAccountDetail
oad
,
BigDecimal
topAmount
)
{
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
BigDecimal
orderDeductSource
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
depositDeductSource
,
OrderAccountDetail
oad
,
BigDecimal
topAmount
)
{
//计算退款金额
//原来退款 和 最终退款
//商品价格 - 优惠券减免的价格
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
mainItemRealAmount
);
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
StringBuilder
orderRefundDescBuilder
=
new
StringBuilder
(
""
);
StringBuilder
orderRefundDescBuilder
=
new
StringBuilder
(
""
);
StringBuilder
depositRefundDescBuilder
=
new
StringBuilder
(
""
);
StringBuilder
depositRefundDescBuilder
=
new
StringBuilder
(
""
);
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
if
(
null
==
oad
)
{
if
(
null
==
oad
)
{
oad
=
new
OrderAccountDetail
();
oad
=
new
OrderAccountDetail
();
}
}
BigDecimal
orderDeductAmount
=
calculateDeduction
(
originalRefundAmount
,
timeLag
,
dicParentKey
,
orderRefundDescBuilder
);
// 订单款 原订单退款、最终订单退款
BigDecimal
originalOrderRefundAmount
=
BigDecimal
.
ZERO
.
add
(
baseOrder
.
getGoodsAmount
().
subtract
(
baseOrder
.
getCouponAmount
()));
BigDecimal
orderRefundAmount
=
BigDecimal
.
ZERO
.
add
(
baseOrder
.
getGoodsAmount
().
subtract
(
baseOrder
.
getCouponAmount
()));
if
(
null
!=
orderDeductSource
&&
BigDecimal
.
ZERO
.
compareTo
(
orderDeductSource
)
<
0
)
{
BigDecimal
orderDeductAmount
=
calculateDeduction
(
orderDeductSource
,
timeLag
,
dicParentKey
,
orderRefundDescBuilder
);
orderDeductAmount
=
orderDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
orderDeductAmount
=
orderDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
if
(
topAmount
.
compareTo
(
orderDeductAmount
)
>
0
)
{
if
(
topAmount
.
compareTo
(
orderDeductAmount
)
>
0
)
{
totalDeductAmount
=
totalDeductAmount
.
add
(
orderDeductAmount
);
totalDeductAmount
=
totalDeductAmount
.
add
(
orderDeductAmount
);
...
@@ -108,18 +114,27 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
...
@@ -108,18 +114,27 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
orderDeductAmount
=
topAmount
;
orderDeductAmount
=
topAmount
;
topAmount
=
BigDecimal
.
ZERO
;
topAmount
=
BigDecimal
.
ZERO
;
}
}
BigDecimal
refundMainGoodsAmount
=
originalRefundAmount
.
subtract
(
orderDeductAmount
);
//退款金额 = 主要商品退款 + (其他商品退款) 即--> 主要商品退款 + (总商品款 - 主要商品款)
//订单退款
oad
.
setOrderAmount
(
refundMainGoodsAmount
.
add
(
baseOrder
.
getGoodsAmount
().
subtract
(
baseOrder
.
getCouponAmount
()).
subtract
(
mainItemRealAmount
)));
orderRefundAmount
=
orderRefundAmount
.
subtract
(
orderDeductAmount
);
BigDecimal
refundAmount
=
oad
.
getOrderAmount
();
if
(
orderRefundAmount
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
orderRefundAmount
=
BigDecimal
.
ZERO
;
}
}
//设置金额
oad
.
setOriginOrderAmount
(
originalOrderRefundAmount
);
oad
.
setOrderAmount
(
orderRefundAmount
);
originalRefundAmount
=
originalRefundAmount
.
add
(
oad
.
getOriginOrderAmount
());
refundAmount
=
refundAmount
.
add
(
oad
.
getOrderAmount
());
// 押金 原押金退款、最终押金退款
BigDecimal
originalDepositRefundAmount
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
BigDecimal
depositRefundAmount
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
// 押金
if
(
null
!=
depositDeductSource
&&
BigDecimal
.
ZERO
.
compareTo
(
depositDeductSource
)
<
0
)
{
BigDecimal
originalRefundAmountDeposit
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
BigDecimal
refundAmountDeposit
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
if
(
null
!=
originalDeductAmount
&&
BigDecimal
.
ZERO
.
compareTo
(
originalDeductAmount
)
<
0
)
{
//通过原扣除款 计算剩余款
//通过原扣除款 计算剩余款
BigDecimal
depositDeductAmount
=
calculateDeduction
(
originalDeductAmount
,
timeLag
,
dicParentKey
,
depositRefundDescBuilder
);
BigDecimal
depositDeductAmount
=
calculateDeduction
(
depositDeductSource
,
timeLag
,
dicParentKey
,
depositRefundDescBuilder
);
depositDeductAmount
=
depositDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
depositDeductAmount
=
depositDeductAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
if
(
topAmount
.
compareTo
(
depositDeductAmount
)
>
0
)
{
if
(
topAmount
.
compareTo
(
depositDeductAmount
)
>
0
)
{
totalDeductAmount
=
totalDeductAmount
.
add
(
depositDeductAmount
);
totalDeductAmount
=
totalDeductAmount
.
add
(
depositDeductAmount
);
...
@@ -131,24 +146,28 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
...
@@ -131,24 +146,28 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}
}
//返回押金
//返回押金
refundAmountDeposit
=
originalRefundAmountDeposi
t
.
subtract
(
depositDeductAmount
);
depositRefundAmount
=
originalDepositRefundAmoun
t
.
subtract
(
depositDeductAmount
);
}
}
//设置违章款账单
//设置违章款账单
StringBuilder
stringBuilder
=
new
StringBuilder
(
""
);
StringBuilder
stringBuilder
=
new
StringBuilder
(
""
);
if
(
totalDeductAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
totalDeductAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
int
originType
=
0
;
if
(
orderRefundDescBuilder
.
length
()
>
0
)
{
if
(
orderRefundDescBuilder
.
length
()
>
0
)
{
stringBuilder
=
orderRefundDescBuilder
;
stringBuilder
=
orderRefundDescBuilder
;
originType
=
OrderAccountDeduction
.
ORIGIN_ORDER
;
}
else
{
}
else
{
stringBuilder
=
depositRefundDescBuilder
;
stringBuilder
=
depositRefundDescBuilder
;
originType
=
OrderAccountDeduction
.
ORIGIN_DEPOSIT
;
}
}
oad
.
getDeductions
().
add
(
initDeduction
(
totalDeductAmount
,
stringBuilder
.
toString
(),
DeductionTypeEnum
.
VIOLATE_CANCEL
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
));
oad
.
getDeductions
().
add
(
initDeduction
(
totalDeductAmount
,
stringBuilder
.
toString
(),
DeductionTypeEnum
.
VIOLATE_CANCEL
,
originType
));
}
}
//设置订单押金金额
//设置订单押金金额
originalRefundAmount
=
originalRefundAmount
.
add
(
originalRefundAmountDeposit
);
oad
.
setOriginDepositAmount
(
originalDepositRefundAmount
);
oad
.
setDepositAmount
(
refundAmountDeposit
);
oad
.
setDepositAmount
(
depositRefundAmount
);
refundAmount
=
refundAmount
.
add
(
refundAmountDeposit
);
originalRefundAmount
=
originalRefundAmount
.
add
(
originalDepositRefundAmount
);
refundAmount
=
refundAmount
.
add
(
depositRefundAmount
);
//退款子流程: 订单基础,退款描述, 款金额
//退款子流程: 订单基础,退款描述, 款金额
refundSubProcess
(
baseOrder
,
stringBuilder
.
toString
(),
originalRefundAmount
,
refundAmount
,
AccountTypeEnum
.
OUT_ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
refundSubProcess
(
baseOrder
,
stringBuilder
.
toString
(),
originalRefundAmount
,
refundAmount
,
AccountTypeEnum
.
OUT_ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
View file @
ea2af0b2
...
@@ -261,7 +261,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
...
@@ -261,7 +261,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
}
}
//延期扣除费用
//延期扣除费用
if
(
StringUtils
.
isNotBlank
(
orderVehicleCrosstownDto
.
getViolateDetail
()))
{
if
(
StringUtils
.
isNotBlank
(
orderVehicleCrosstownDto
.
getViolateDetail
()))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
orderVehicleCrosstownDto
.
get
Ded
Detail
());
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
orderVehicleCrosstownDto
.
get
Violate
Detail
());
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
0
)
{
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jsonArray
.
get
(
i
).
toString
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
jsonArray
.
get
(
i
).
toString
());
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
ea2af0b2
...
@@ -152,7 +152,7 @@ public class OrderCalculateBiz {
...
@@ -152,7 +152,7 @@ public class OrderCalculateBiz {
violateDesc
+=
StrUtil
.
format
(
"(封顶{}元)"
,
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
violateDesc
+=
StrUtil
.
format
(
"(封顶{}元)"
,
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
}
}
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
inProgressVO
.
setViolateDesc
(
violateDesc
);
inProgressVO
.
setViolateDesc
(
" 提前还车违约金:"
+
violateDesc
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
violateDesc
,
DeductionTypeEnum
.
VIOLATE_ADVANCE
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
violateDesc
,
DeductionTypeEnum
.
VIOLATE_ADVANCE
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
violateDeduction
);
oad
.
getDeductions
().
add
(
violateDeduction
);
}
else
if
(
residueDays
<
0
&&
!
isCancel
){
}
else
if
(
residueDays
<
0
&&
!
isCancel
){
...
@@ -168,7 +168,7 @@ public class OrderCalculateBiz {
...
@@ -168,7 +168,7 @@ public class OrderCalculateBiz {
// }
// }
//超过的天数 * 200% * 单价
//超过的天数 * 200% * 单价
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
)).
multiply
(
new
BigDecimal
((
overDays
+
""
))));
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
)).
multiply
(
new
BigDecimal
((
overDays
+
""
))));
inProgressVO
.
setViolateDesc
(
violateDesc
);
inProgressVO
.
setViolateDesc
(
" 延期还车违约金:"
+
violateDesc
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
violateDesc
,
DeductionTypeEnum
.
VIOLATE_DELAY
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
violateDesc
,
DeductionTypeEnum
.
VIOLATE_DELAY
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
violateDeduction
);
oad
.
getDeductions
().
add
(
violateDeduction
);
}
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
ea2af0b2
...
@@ -149,7 +149,7 @@ public class OrderCancelBiz {
...
@@ -149,7 +149,7 @@ public class OrderCancelBiz {
//原退还押金
//原退还押金
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
BigDecimal
freeDayAmount
=
BigDecimal
.
ZERO
;
//
BigDecimal freeDayAmount = BigDecimal.ZERO;
//如果超过出发时间,不能取消订单
//如果超过出发时间,不能取消订单
...
@@ -202,17 +202,17 @@ public class OrderCancelBiz {
...
@@ -202,17 +202,17 @@ public class OrderCancelBiz {
orvd
.
handelCostDetailExtend
(
csv
);
orvd
.
handelCostDetailExtend
(
csv
);
orderRentVehicleBiz
.
updateSelectiveByIdRe
(
orvd
);
orderRentVehicleBiz
.
updateSelectiveByIdRe
(
orvd
);
}
else
{
}
else
{
//没到出车时间
//
//没到出车时间
//判断是否使用免费天数,并且进行扣款
//
//判断是否使用免费天数,并且进行扣款
if
(
freeDays
>
0
)
{
//
if(freeDays > 0) {
freeDayAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
orvd
.
getFreeDays
()+
""
));
//
freeDayAmount = orderItem.getUnitPrice().multiply(new BigDecimal(orvd.getFreeDays()+ ""));
}
//
}
//违约金封顶 租车身份价 * 2天
//违约金封顶 租车身份价 * 2天
BigDecimal
topAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
));
BigDecimal
topAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
2
+
""
));
//退款流程
//退款流程
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
orderItem
.
getRealAmount
(),
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
,
oad
,
topAmount
);
orderAccountBiz
.
rentRefundProcessCancel
(
baseOrder
,
BigDecimal
.
ZERO
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
orderItem
.
getBuyAmount
()
,
oad
,
topAmount
);
//设置订单数据
//设置订单数据
//baseOrder.setDamagesAmount(csv.getDamagesAmount());
//baseOrder.setDamagesAmount(csv.getDamagesAmount());
...
@@ -267,8 +267,8 @@ public class OrderCancelBiz {
...
@@ -267,8 +267,8 @@ public class OrderCancelBiz {
setOrderId
(
baseOrder
.
getId
());
setOrderId
(
baseOrder
.
getId
());
}});
}});
BigDecimal
adultItemAmount
=
(
null
==
adultItem
)?
BigDecimal
.
ZERO
:
adultItem
.
get
Real
Amount
();
BigDecimal
adultItemAmount
=
(
null
==
adultItem
)?
BigDecimal
.
ZERO
:
adultItem
.
get
Buy
Amount
();
BigDecimal
childItemAmount
=
(
null
==
childItem
)?
BigDecimal
.
ZERO
:
childItem
.
get
Real
Amount
();
BigDecimal
childItemAmount
=
(
null
==
childItem
)?
BigDecimal
.
ZERO
:
childItem
.
get
Buy
Amount
();
//判断是省内还是省外
//判断是省内还是省外
String
key
=
TOUR_IN_REFUND
;
String
key
=
TOUR_IN_REFUND
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRefundController.java
View file @
ea2af0b2
...
@@ -20,6 +20,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
...
@@ -20,6 +20,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import
com.xxfc.platform.order.entity.OrderItem
;
import
com.xxfc.platform.order.entity.OrderItem
;
import
com.xxfc.platform.order.entity.OrderRefund
;
import
com.xxfc.platform.order.entity.OrderRefund
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
...
@@ -76,7 +77,8 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
...
@@ -76,7 +77,8 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
OrderTypeEnum
orderTypeEnum
=
OrderTypeEnum
.
get
(
orderPageVO
.
getType
());
OrderTypeEnum
orderTypeEnum
=
OrderTypeEnum
.
get
(
orderPageVO
.
getType
());
BigDecimal
orderRefundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalRefundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalDeductAmount
=
BigDecimal
.
ZERO
;
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
""
);
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
""
);
String
refundDesc
=
""
;
String
refundDesc
=
""
;
InProgressVO
inProgressVO
=
new
InProgressVO
();
InProgressVO
inProgressVO
=
new
InProgressVO
();
...
@@ -85,36 +87,36 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
...
@@ -85,36 +87,36 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
case
RENT_VEHICLE:
case
RENT_VEHICLE:
DateTime
nowTime
=
DateTime
.
parse
(
DateTime
.
now
().
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
nowTime
=
DateTime
.
parse
(
DateTime
.
now
().
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
startTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
DateTime
endTime
=
DateTime
.
parse
(
new
DateTime
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndTime
()).
toString
(
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
),
CommonConstants
.
YMR_SLASH_FORMATTER_JODA
);
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
orderPageVO
,
baseOrderBiz
.
getDaysBetweenDateTime
(
startTime
,
nowTime
));
Long
timeLag
=
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
();
OrderItem
vehicleItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
VEHICLE_MODEL
.
getCode
());
setOrderId
(
orderPageVO
.
getId
());
}});
if
(
timeLag
<
0
)
{
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
Integer
freeDays
=
(
null
==
vehicleItem
.
getCutNum
())?
0
:
vehicleItem
.
getCutNum
();
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
orderPageVO
,
vehicleItem
,
freeDays
,
baseOrderBiz
.
getDaysBetweenDateTime
(
startTime
,
nowTime
),
new
OrderAccountDetail
(),
Boolean
.
FALSE
);
//.inProgressCalculate(orderPageVO, baseOrderBiz.getDaysBetweenDateTime(startTime, nowTime));
totalDeductAmount
=
oad
.
realTotalDeduct
();
totalRefundAmount
=
oad
.
getOrderAmount
().
add
(
oad
.
getDepositAmount
());
refundDesc
=
inProgressVO
.
getViolateDesc
();
refundDesc
=
inProgressVO
.
getViolateDesc
();
// orderRefundAmount = orderAccountBiz.calculateDeduction(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
}
else
{
// , orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
// , DictionaryKey.APP_ORDER+ "_"+ RENT_REFUND
String
key
=
RENT_REFUND
;
// , refundDescBuilder);
// OrderRentVehicleDetail orvd = orderPageVO.getOrderRentVehicleDetail();
BigDecimal
deductionAmount
=
orderAccountBiz
.
calculateDeduction
(
vehicleItem
.
getBuyAmount
()
// Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
// //原退还押金
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
// BigDecimal originalDeductAmount = BigDecimal.ZERO;
,
refundDescBuilder
);
// BigDecimal originalRefundAmount = BigDecimal.ZERO.add(orvd.getDeposit());
// //判断是否使用免费天数,并且进行扣款
totalDeductAmount
=
deductionAmount
;
// if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
totalRefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
// refundDescBuilder = new StringBuilder("");
refundDesc
=
refundDescBuilder
.
toString
();
// OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{
}
// setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
// setOrderId(orderPageVO.getId());
// }});
// originalDeductAmount = orderItem.getUnitPrice().multiply(new BigDecimal(orvd.getFreeDays()+ ""));
// }
// BigDecimal residueAmount = orderRefundBiz.calculateDeduction(originalDeductAmount, timeLag, APP_ORDER+ "_"+ RENT_REFUND, refundDescBuilder);
//扣款 = 违约金 + 消费金额
// BigDecimal residueAmount = BigDecimal.ZERO;
// //inProgressVO.get
// residueAmount = residueAmount.setScale(2, RoundingMode.HALF_UP);
//押金剩余款 :押金 - (原扣除款 - 剩余款)
//退款金额 :订单剩余款 + 押金剩余款
//orderRefundAmount = orderRefundAmount.add(originalRefundAmount.subtract(originalDeductAmount.subtract(residueAmount)));
break
;
break
;
case
TOUR:
case
TOUR:
...
@@ -141,7 +143,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
...
@@ -141,7 +143,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
,
refundDescBuilder
);
order
RefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
total
RefundAmount
=
orderPageVO
.
getRealAmount
().
subtract
(
deductionAmount
);
refundDesc
=
refundDescBuilder
.
toString
();
refundDesc
=
refundDescBuilder
.
toString
();
break
;
break
;
default
:
default
:
...
@@ -150,8 +152,12 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
...
@@ -150,8 +152,12 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
OrderRefundPriceVO
orpv
=
new
OrderRefundPriceVO
();
OrderRefundPriceVO
orpv
=
new
OrderRefundPriceVO
();
orpv
.
setRealAmount
(
orderPageVO
.
getRealAmount
());
orpv
.
setRealAmount
(
orderPageVO
.
getRealAmount
());
orpv
.
setRefundAmount
(
orderRefundAmount
);
orpv
.
setRefundAmount
(
totalRefundAmount
);
orpv
.
setRefundDesc
(
StrUtil
.
format
(
"取消操作可能会产生额外费用{},是否确定取消订单"
,
refundDesc
));
if
(
totalDeductAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
orpv
.
setRefundDesc
(
"取消操作可能会产生额外费用,是否确定取消订单"
);
}
else
{
orpv
.
setRefundDesc
(
StrUtil
.
format
(
"本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?"
,
totalDeductAmount
,
totalRefundAmount
));
}
return
ObjectRestResponse
.
succ
(
orpv
);
return
ObjectRestResponse
.
succ
(
orpv
);
}
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleActiveService.java
View file @
ea2af0b2
...
@@ -83,7 +83,6 @@ public class VehicleActiveService {
...
@@ -83,7 +83,6 @@ public class VehicleActiveService {
if
(
MileageLift
==
null
||
MileageLift1
>=
MileageLift
)
{
if
(
MileageLift
==
null
||
MileageLift1
>=
MileageLift
)
{
// 写入车辆公里数,预计目的地
// 写入车辆公里数,预计目的地
vehicle
.
setMileageLastUpdate
(
MileageLift1
);
vehicle
.
setMileageLastUpdate
(
MileageLift1
);
vehicle
.
setExpectDestinationBranchCompanyId
(
departureVo
.
getExpectArrivalBranchCompanyId
());
vehicleMapper
.
updateByPrimaryKeySelective
(
vehicle
);
vehicleMapper
.
updateByPrimaryKeySelective
(
vehicle
);
// 修改车辆状态,确认是空闲状态
// 修改车辆状态,确认是空闲状态
...
@@ -211,7 +210,6 @@ public class VehicleActiveService {
...
@@ -211,7 +210,6 @@ public class VehicleActiveService {
if
(
vehicleBookRecord
!=
null
)
{
if
(
vehicleBookRecord
!=
null
)
{
vehicle
.
setParkBranchCompanyId
(
vehicleBookRecord
.
getRetCompany
());
vehicle
.
setParkBranchCompanyId
(
vehicleBookRecord
.
getRetCompany
());
}
}
vehicle
.
setExpectDestinationBranchCompanyId
(
0
);
vehicleMapper
.
updateByPrimaryKeySelective
(
vehicle
);
vehicleMapper
.
updateByPrimaryKeySelective
(
vehicle
);
// 出车记录
// 出车记录
VehicleDepartureLogVo
departureLogVo
=
vehicleDepartureLogMapper
.
selectByBookRecordId
(
arrivalVo
.
getBookRecordId
());
VehicleDepartureLogVo
departureLogVo
=
vehicleDepartureLogMapper
.
selectByBookRecordId
(
arrivalVo
.
getBookRecordId
());
...
...
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