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
20c9b184
Commit
20c9b184
authored
Sep 12, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
b895e92c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
29 deletions
+88
-29
DeductionTypeEnum.java
...c/platform/order/contant/enumerate/DeductionTypeEnum.java
+1
-1
DedDetailDTO.java
.../main/java/com/xxfc/platform/order/pojo/DedDetailDTO.java
+3
-0
OrderAccountDeduction.java
...fc/platform/order/pojo/account/OrderAccountDeduction.java
+2
-0
OrderAccountDetail.java
.../xxfc/platform/order/pojo/account/OrderAccountDetail.java
+18
-0
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+49
-21
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+11
-2
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+4
-5
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/DeductionTypeEnum.java
View file @
20c9b184
...
@@ -4,7 +4,7 @@ import java.util.HashMap;
...
@@ -4,7 +4,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
public
enum
DeductionTypeEnum
{
public
enum
DeductionTypeEnum
{
//账款类型 1--违约金;2--消费金额;3--赔偿金(定损);4--违章
扣款
//账款类型 1--违约金;2--消费金额;3--赔偿金(定损);4--违章
相关
VIOLATE_CANCEL
(
101
,
"提前取消违约金"
),
VIOLATE_CANCEL
(
101
,
"提前取消违约金"
),
VIOLATE_ADVANCE
(
102
,
"提前还车违约金"
),
VIOLATE_ADVANCE
(
102
,
"提前还车违约金"
),
VIOLATE_DELAY
(
103
,
"延迟还车违约金"
),
VIOLATE_DELAY
(
103
,
"延迟还车违约金"
),
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/DedDetailDTO.java
View file @
20c9b184
...
@@ -7,6 +7,9 @@ import java.util.List;
...
@@ -7,6 +7,9 @@ import java.util.List;
@Data
@Data
public
class
DedDetailDTO
{
public
class
DedDetailDTO
{
//public static final int TYPE_VIOLATE_ADVANCE = 1;
/**
/**
* : 扣除项名称
* : 扣除项名称
*/
*/
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/account/OrderAccountDeduction.java
View file @
20c9b184
...
@@ -9,6 +9,8 @@ public class OrderAccountDeduction {
...
@@ -9,6 +9,8 @@ public class OrderAccountDeduction {
public
static
final
int
ORIGIN_ORDER
=
1
;
public
static
final
int
ORIGIN_ORDER
=
1
;
public
static
final
int
ORIGIN_DEPOSIT
=
2
;
public
static
final
int
ORIGIN_DEPOSIT
=
2
;
public
static
final
int
ORIGIN_ORDER_DEPOSIT
=
3
;
public
static
final
int
ORIGIN_DEPOSIT_ORDER
ß
=
4
;
/**
/**
* 名称
* 名称
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/account/OrderAccountDetail.java
View file @
20c9b184
...
@@ -8,7 +8,25 @@ import java.util.List;
...
@@ -8,7 +8,25 @@ import java.util.List;
@Data
@Data
public
class
OrderAccountDetail
{
public
class
OrderAccountDetail
{
/**
* 实际返回订单款
*/
BigDecimal
orderAmount
;
BigDecimal
orderAmount
;
/**
* 实际返回押金款
*/
BigDecimal
depositAmount
;
BigDecimal
depositAmount
;
/**
* 原来要返回的订单款
*/
BigDecimal
originOrderAmount
;
/**
* 原来要返回的押金款
*/
BigDecimal
originDepositAmount
;
/**
* 扣款列表
*/
List
<
OrderAccountDeduction
>
deductions
=
Lists
.
newArrayList
();
List
<
OrderAccountDeduction
>
deductions
=
Lists
.
newArrayList
();
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
20c9b184
...
@@ -294,36 +294,64 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
...
@@ -294,36 +294,64 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}
}
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
InProgressVO
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
orderMQDTO
,
orderItem
,
orderMQDTO
.
getOrderRentVehicleDetail
().
getFreeDays
()
orderCalculateBiz
.
calculateOrderComplete
(
orderMQDTO
,
orderMQDTO
.
getOrderRentVehicleDetail
(),
oad
,
orderItem
,
orderMQDTO
.
getOrderRentVehicleDetail
().
getUsedDay
());
,
orderMQDTO
.
getOrderRentVehicleDetail
().
getUsedDay
(),
oad
);
//还车扣除款 剩余的 钱,再减去违章预备金
//还车扣除款 剩余的 钱,再减去违章预备金
oad
.
getDeductions
().
add
(
new
OrderAccountDeduction
(){{
oad
.
getDeductions
().
add
(
setOrigin
(
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
initDeduction
(
illegalReserve
,
"违章保证金"
,
DeductionTypeEnum
.
VIOLATE_TRAFFIC_KEEP
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
)
setAmount
(
illegalReserve
);
);
setType
(
DeductionTypeEnum
.
KEEP_VIOLATE_TRAFFIC
.
getCode
());
oad
.
getDeductions
().
add
(
}});
initDeduction
(
crosstown
.
getDeductionCost
(),
"定损赔偿金"
,
DeductionTypeEnum
.
DAMAGES
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
)
);
//剩余押金 -
oad
.
setDepositAmount
(
oad
.
getDepositAmount
().
subtract
(
illegalReserve
).
subtract
(
crosstown
.
getDeductionCost
()));
handleCrosstownDetail
(
crosstown
,
oad
);
BigDecimal
refundAmont
=
crosstown
.
getRestDeposit
().
subtract
(
illegalReserve
);
BigDecimal
refundAmont
=
crosstown
.
getRestDeposit
().
subtract
(
illegalReserve
);
BigDecimal
originalRefundAmount
=
crosstown
.
getRestDeposit
().
add
(
crosstown
.
getDeductionCost
()).
subtract
(
illegalReserve
);
BigDecimal
originalRefundAmount
=
crosstown
.
getRestDeposit
().
add
(
crosstown
.
getDeductionCost
()).
subtract
(
illegalReserve
);
String
refundDesc
=
"退还押金:"
+
refundAmont
.
toString
()+
"(已扣除 违章预备金:"
+
illegalReserve
.
toString
();
String
refundDesc
=
"退还押金:"
+
refundAmont
.
toString
()+
"(已扣除 违章预备金:"
+
illegalReserve
.
toString
();
try
{
refundDesc
=
handleDed
(
crosstown
,
refundDesc
);
if
(
null
!=
crosstown
.
getDedDetail
())
{
List
<
DedDetailDTO
>
dddList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
crosstown
.
getDedDetail
()),
DedDetailDTO
.
class
);
for
(
DedDetailDTO
ddd
:
dddList
)
{
refundDesc
+=
", "
+
ddd
.
getDeductions
()+
":"
+
ddd
.
getCost
();
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"crosstown.getDedDetail() crosstown id :"
+
crosstown
.
getId
()
+
" 转换失败"
);
}
refundDesc
+=
")"
;
refundDesc
+=
")"
;
refundTrigger
(
orderMQDTO
,
orderMQDTO
.
getOrderRentVehicleDetail
(),
illegalReserve
,
originalRefundAmount
,
refundAmont
,
refundDesc
,
RefundStatusEnum
.
RESIDUE_ILLEGAL
.
getCode
(),
RefundTypeEnum
.
PART_DEPOSIT
,
null
);
refundTrigger
(
orderMQDTO
,
orderMQDTO
.
getOrderRentVehicleDetail
(),
illegalReserve
,
originalRefundAmount
,
refundAmont
,
refundDesc
,
RefundStatusEnum
.
RESIDUE_ILLEGAL
.
getCode
(),
RefundTypeEnum
.
PART_DEPOSIT
,
oad
);
// DepositRefundRecord depositRefundRecord = orderDepositRefundRecordBiz.findByCrossIdAndStatus(crosstown.getId(), depositRefundRecordStatus);
// depositRefundRecord.setIscomplete(Boolean.TRUE);
// orderDepositRefundRecordBiz.updateSelectiveById(depositRefundRecord);
orderDepositRefundRecordBiz
.
completeRecordStatus
(
crosstown
.
getId
(),
depositRefundRecordStatus
);
orderDepositRefundRecordBiz
.
completeRecordStatus
(
crosstown
.
getId
(),
depositRefundRecordStatus
);
orderMsgBiz
.
handelMsgDeposit
(
orderMQDTO
.
getOrderRentVehicleDetail
(),
orderMQDTO
,
userFeign
.
userDetailById
(
orderMQDTO
.
getUserId
()).
getData
());
orderMsgBiz
.
handelMsgDeposit
(
orderMQDTO
.
getOrderRentVehicleDetail
(),
orderMQDTO
,
userFeign
.
userDetailById
(
orderMQDTO
.
getUserId
()).
getData
());
}
}
}
}
private
String
handleDed
(
OrderVehicleCrosstown
crosstown
,
String
refundDesc
)
{
try
{
if
(
null
!=
crosstown
.
getDedDetail
())
{
List
<
DedDetailDTO
>
dddList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
crosstown
.
getDedDetail
()),
DedDetailDTO
.
class
);
for
(
DedDetailDTO
ddd
:
dddList
)
{
refundDesc
+=
", "
+
ddd
.
getDeductions
()+
":"
+
ddd
.
getCost
();
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"crosstown.getDedDetail() crosstown id :"
+
crosstown
.
getId
()
+
" 转换失败"
);
}
return
refundDesc
;
}
private
void
handleCrosstownDetail
(
OrderVehicleCrosstown
crosstown
,
OrderAccountDetail
oad
)
{
try
{
if
(
null
!=
crosstown
.
getViolateDetail
())
{
List
<
DedDetailDTO
>
dddList
=
JSONUtil
.
toList
(
JSONUtil
.
parseArray
(
crosstown
.
getViolateDetail
()),
DedDetailDTO
.
class
);
for
(
DedDetailDTO
vio
:
dddList
)
{
if
(
OrderViolateEnum
.
BEFORE
.
getCode
().
equals
(
vio
.
getType
()))
{
for
(
OrderAccountDeduction
deduction
:
oad
.
getDeductions
())
{
if
(
DeductionTypeEnum
.
VIOLATE_ADVANCE
.
getCode
().
equals
(
deduction
.
getType
()))
{
deduction
.
setName
(
vio
.
getDeductions
());
BigDecimal
diff
=
vio
.
getCost
().
subtract
(
deduction
.
getAmount
());
//修改归还押金金额
oad
.
setDepositAmount
(
oad
.
getDepositAmount
().
subtract
(
diff
));
deduction
.
setAmount
(
vio
.
getCost
());
}
}
}
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"crosstown.getViolateDetail() crosstown id :"
+
crosstown
.
getId
()
+
" 转换失败"
);
}
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
20c9b184
...
@@ -126,7 +126,7 @@ public class OrderCalculateBiz {
...
@@ -126,7 +126,7 @@ public class OrderCalculateBiz {
residueDays
=
2
;
residueDays
=
2
;
}
}
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
inProgressVO
.
setViolateAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
((
residueDays
+
""
))));
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
"违约金"
,
DeductionTypeEnum
.
VIOLATE_
CANCEL
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
"违约金"
,
DeductionTypeEnum
.
VIOLATE_
ADVANCE
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
violateDeduction
);
oad
.
getDeductions
().
add
(
violateDeduction
);
}
else
if
(
residueDays
<
0
){
}
else
if
(
residueDays
<
0
){
//如果订单 出发中 或者 已完成 或者定损中
//如果订单 出发中 或者 已完成 或者定损中
...
@@ -139,7 +139,7 @@ public class OrderCalculateBiz {
...
@@ -139,7 +139,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
+
""
))));
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
"违约金"
,
DeductionTypeEnum
.
VIOLATE_
CANCEL
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
OrderAccountDeduction
violateDeduction
=
orderAccountBiz
.
initDeduction
(
inProgressVO
.
getViolateAmount
(),
"违约金"
,
DeductionTypeEnum
.
VIOLATE_
DELAY
,
OrderAccountDeduction
.
ORIGIN_DEPOSIT
);
oad
.
getDeductions
().
add
(
violateDeduction
);
oad
.
getDeductions
().
add
(
violateDeduction
);
}
}
}
}
...
@@ -155,4 +155,13 @@ public class OrderCalculateBiz {
...
@@ -155,4 +155,13 @@ public class OrderCalculateBiz {
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
Integer
freeDays
=
(
null
==
orderItem
.
getCutNum
())?
0
:
orderItem
.
getCutNum
();
return
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
null
);
return
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
null
);
}
}
public
InProgressVO
calculateOrderComplete
(
BaseOrder
baseOrder
,
OrderRentVehicleDetail
orvd
,
OrderAccountDetail
oad
,
OrderItem
orderItem
,
Integer
useDays
)
{
InProgressVO
inProgressVO
=
inProgressCalculate
(
baseOrder
,
orderItem
,
orvd
.
getFreeDays
(),
useDays
,
oad
);
oad
.
setDepositAmount
(
orvd
.
getDeposit
().
subtract
(
inProgressVO
.
getExtraAmount
()).
subtract
(
inProgressVO
.
getViolateAmount
()));
oad
.
setOrderAmount
(
inProgressVO
.
getRefundOrderAmount
());
oad
.
setOriginDepositAmount
(
orvd
.
getDeposit
());
oad
.
setOriginOrderAmount
(
baseOrder
.
getRealAmount
());
return
inProgressVO
;
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
20c9b184
...
@@ -113,7 +113,7 @@ public class OrderCancelBiz {
...
@@ -113,7 +113,7 @@ public class OrderCancelBiz {
setVersion
(
baseOrder
.
getVersion
());
setVersion
(
baseOrder
.
getVersion
());
}};
}};
BaseOrder
hasUpdateOrder
=
baseOrderBiz
.
updateSelectiveByIdReT
(
updateOrder
);
BaseOrder
hasUpdateOrder
=
baseOrderBiz
.
updateSelectiveByIdReT
(
updateOrder
);
InProgressVO
inProgressVO
=
n
ew
InProgressVO
()
;
InProgressVO
inProgressVO
=
n
ull
;
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
//触发退款流程
//触发退款流程
...
@@ -145,9 +145,7 @@ public class OrderCancelBiz {
...
@@ -145,9 +145,7 @@ public class OrderCancelBiz {
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long
useTimeLag
=
System
.
currentTimeMillis
()
-
beginOfStartDay
;
Long
useTimeLag
=
System
.
currentTimeMillis
()
-
beginOfStartDay
;
Integer
useDays
=
new
BigDecimal
(
useTimeLag
+
""
).
divide
(
new
BigDecimal
((
24
*
60
*
60
*
1000
)+
""
)).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
Integer
useDays
=
new
BigDecimal
(
useTimeLag
+
""
).
divide
(
new
BigDecimal
((
24
*
60
*
60
*
1000
)+
""
)).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
oad
);
inProgressVO
=
orderCalculateBiz
.
calculateOrderComplete
(
baseOrder
,
orvd
,
oad
,
orderItem
,
useDays
);
oad
.
setDepositAmount
(
orvd
.
getDeposit
().
subtract
(
inProgressVO
.
getExtraAmount
()).
subtract
(
inProgressVO
.
getViolateAmount
()));
oad
.
setOrderAmount
(
inProgressVO
.
getRefundOrderAmount
());
//结合
//结合
//退款子流程: 订单基础,退款描述,退款金额
//退款子流程: 订单基础,退款描述,退款金额
orderAccountBiz
.
refundSubProcess
(
baseOrder
,
""
,
baseOrder
.
getRealAmount
().
subtract
(
orvd
.
getDeposit
()),
oad
.
getDepositAmount
().
add
(
oad
.
getOrderAmount
()),
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
orderAccountBiz
.
refundSubProcess
(
baseOrder
,
""
,
baseOrder
.
getRealAmount
().
subtract
(
orvd
.
getDeposit
()),
oad
.
getDepositAmount
().
add
(
oad
.
getOrderAmount
()),
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
...
@@ -233,7 +231,8 @@ public class OrderCancelBiz {
...
@@ -233,7 +231,8 @@ public class OrderCancelBiz {
//取消租车免费天数使用
//取消租车免费天数使用
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
int
result
=
userFeign
.
memberDays
(
baseOrder
.
getUserId
(),
orvd
.
getFreeDays
(),
UserFeign
.
MEMBER_DAYS_WITHDRAW
);
Integer
freeDays
=
(
null
==
inProgressVO
)
?
orvd
.
getFreeDays
():
inProgressVO
.
getBackFreeDays
();
int
result
=
userFeign
.
memberDays
(
baseOrder
.
getUserId
(),
freeDays
,
UserFeign
.
MEMBER_DAYS_WITHDRAW
);
if
(
result
<
0
)
{
if
(
result
<
0
)
{
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
ResultCode
.
FAILED_CODE
);
}
}
...
...
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