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
bfa199da
Commit
bfa199da
authored
Sep 11, 2019
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
076838c7
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
493 additions
and
349 deletions
+493
-349
DeductionTypeEnum.java
...c/platform/order/contant/enumerate/DeductionTypeEnum.java
+3
-2
DedDetailDTO.java
.../main/java/com/xxfc/platform/order/pojo/DedDetailDTO.java
+2
-1
InProgressVO.java
.../com/xxfc/platform/order/pojo/calculate/InProgressVO.java
+27
-2
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+107
-12
OrderRefundBiz.java
...main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
+282
-282
OrderCalculateBiz.java
.../com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
+11
-9
OrderCancelBiz.java
...ava/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
+20
-6
RentDepositJobHandler.java
...xxfc/platform/order/jobhandler/RentDepositJobHandler.java
+7
-1
RefundMQHandler.java
...va/com/xxfc/platform/order/mqhandler/RefundMQHandler.java
+1
-1
OrderRefundController.java
...a/com/xxfc/platform/order/rest/OrderRefundController.java
+33
-33
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/DeductionTypeEnum.java
View file @
bfa199da
...
...
@@ -4,11 +4,12 @@ import java.util.HashMap;
import
java.util.Map
;
public
enum
DeductionTypeEnum
{
//账款类型 1--违约金;2--
补扣消费款
;3--赔偿金(定损);4--违章扣款
//账款类型 1--违约金;2--
消费金额
;3--赔偿金(定损);4--违章扣款
VIOLATE
(
1
,
"违约金"
),
EXTRA
(
2
,
"
补扣消费款
"
),
EXTRA
(
2
,
"
消费金额
"
),
DAMAGES
(
3
,
"赔偿金(定损)"
),
VIOLATE_TRAFFIC
(
4
,
"违章扣款"
),
KEEP_VIOLATE_TRAFFIC
(
5
,
"违章扣款保留金"
),
;
/**
* 编码
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/DedDetailDTO.java
View file @
bfa199da
...
...
@@ -23,7 +23,8 @@ public class DedDetailDTO {
Integer
id
;
//1、延期, 2、车辆损坏 3、其他
//作为:DedDetail :2、车辆损坏 3、其他
//作为:violate_amount_detail 1--提前还车 2--延期还车
Integer
type
;
//小雨都不知道什么东西
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/calculate/InProgressVO.java
View file @
bfa199da
...
...
@@ -24,9 +24,29 @@ public class InProgressVO {
BigDecimal
extraAmount
=
BigDecimal
.
ZERO
;
/**
*
退款
*
已使用天数
*/
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
Integer
usedDays
=
0
;
/**
* 已使用的金额
*/
BigDecimal
usedAmount
=
BigDecimal
.
ZERO
;
/**
* 已使用免费天数
*/
Integer
usedfreeDays
=
0
;
/**
* 已使用的免费天数对应的费用
*/
BigDecimal
usedFreeDaysAmount
=
BigDecimal
.
ZERO
;
/**
* 返回订单款金额
*/
BigDecimal
refundOrderAmount
=
BigDecimal
.
ZERO
;
/**
* 返还的优惠券
...
...
@@ -37,4 +57,9 @@ public class InProgressVO {
* 返还的免费天数
*/
Integer
backFreeDays
=
0
;
String
cancelCostDetail
=
""
;
String
advanceDelayCostDetail
=
""
;
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
bfa199da
...
...
@@ -3,34 +3,40 @@ package com.xxfc.platform.order.biz;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.IntervalUtil
;
import
com.
xxfc.platform.order.contant.enumerate.DeductionTypeEnum
;
import
com.xxfc.platform.order.
contant.enumerate.RefundStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.
RefundTypeEnum
;
import
com.xxfc.platform.order.entity.
BaseOrder
;
import
com.xxfc.platform.order.
entity.OrderItem
;
import
com.
github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.order.
biz.inner.OrderMsgBiz
;
import
com.xxfc.platform.order.contant.enumerate.
*
;
import
com.xxfc.platform.order.entity.
*
;
import
com.xxfc.platform.order.
pojo.DedDetailDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.mq.OrderMQDTO
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.universal.vo.OrderRefundVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.jexl2.MapContext
;
import
org.mockito.internal.util.collections.Sets
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.order.entity.OrderAccount
;
import
com.xxfc.platform.order.mapper.OrderAccountMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
APP_ORDER
;
/**
* 订单帐目
...
...
@@ -46,27 +52,44 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
@Autowired
BaseOrderBiz
baseOrderBiz
;
@Autowired
OrderRentVehicleBiz
orderRentVehicleBiz
;
@Autowired
OrderVehicleCrosstownBiz
crosstownBiz
;
@Autowired
OrderMsgBiz
orderMsgBiz
;
@Autowired
OrderDepositRefundRecordBiz
orderDepositRefundRecordBiz
;
@Autowired
ThirdFeign
thirdFeign
;
@Autowired
UserFeign
userFeign
;
/**
* 租车
(包括旅游)
退款流程
* 租车退款流程
* @param baseOrder
* @param mainItem 主要商品(租车费用、旅游费用等)
* @param mainItem
RealAmount
主要商品(租车费用、旅游费用等)
* @param timeLag 与开始时间的时间差
* @param dicParentKey
*/
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
OrderItem
mainItem
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
)
{
public
BigDecimal
rentRefundProcessCancel
(
BaseOrder
baseOrder
,
BigDecimal
mainItemRealAmount
,
Long
timeLag
,
String
dicParentKey
,
BigDecimal
depositAmount
,
BigDecimal
originalDeductAmount
)
{
//计算退款金额
//商品价格 - 优惠券减免的价格
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
mainItem
.
getRealAmount
()
);
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
mainItem
RealAmount
);
StringBuilder
refundDescBuilder
=
new
StringBuilder
(
"取消订单退款:"
);
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
BigDecimal
refundMainGoodsAmount
=
calculateRefund
(
originalRefundAmount
,
timeLag
,
dicParentKey
,
refundDescBuilder
,
oad
);
refundMainGoodsAmount
=
refundMainGoodsAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
//退款金额 = 主要商品退款 + (其他商品退款) 即--> 主要商品退款 + (订单总商品款 - 主要商品款)
BigDecimal
refundAmount
=
refundMainGoodsAmount
.
add
(
baseOrder
.
getOrderAmount
().
subtract
(
mainItem
.
getRealAmount
()));
oad
.
setOrderAmount
(
refundMainGoodsAmount
.
add
(
baseOrder
.
getOrderAmount
().
subtract
(
mainItemRealAmount
)));
BigDecimal
refundAmount
=
oad
.
getOrderAmount
();
// 押金
BigDecimal
originalRefundAmountDeposit
=
BigDecimal
.
ZERO
.
add
(
depositAmount
);
...
...
@@ -82,9 +105,10 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
}
originalRefundAmount
=
originalRefundAmount
.
add
(
originalRefundAmountDeposit
);
oad
.
setDepositAmount
(
refundAmountDeposit
);
refundAmount
=
refundAmount
.
add
(
refundAmountDeposit
);
//退款子流程: 订单基础,退款描述
,退
款金额
//退款子流程: 订单基础,退款描述
,
款金额
refundSubProcess
(
baseOrder
,
refundDescBuilder
.
toString
(),
originalRefundAmount
,
refundAmount
,
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
return
refundAmount
;
}
...
...
@@ -211,4 +235,75 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return
refundStatus
;
}
public
void
refundTrigger
(
BaseOrder
baseOrder
,
OrderRentVehicleDetail
orvd
,
BigDecimal
residueAmount
,
BigDecimal
originalRefundAmount
,
BigDecimal
refundAmont
,
String
refundDesc
,
Integer
refundStatus
,
RefundTypeEnum
refundTypeEnum
,
OrderAccountDetail
oad
)
{
//退款子流程: 订单基础,退款描述,退款金额
refundSubProcess
(
baseOrder
,
refundDesc
,
originalRefundAmount
,
refundAmont
,
refundTypeEnum
.
getCode
(),
refundStatus
,
oad
);
//设置剩余没有返还的钱
orderRentVehicleBiz
.
updateSelectiveById
(
new
OrderRentVehicleDetail
(){{
setId
(
orvd
.
getId
());
setReturnPayResidue
(
residueAmount
);
}});
}
/**
* 退还部分押金
* @param orderMQDTO
*/
public
void
refundPartDeposit
(
OrderMQDTO
orderMQDTO
){
Map
<
String
,
Dictionary
>
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
BigDecimal
illegalReserve
=
new
BigDecimal
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
ILLEGAL_RESERVE
).
getDetail
());
//未退还, 进行挂起保留违章预备金 的退还
if
(
RefundStatusEnum
.
NONE
.
getCode
().
equals
(
orderMQDTO
.
getRefundStatus
()))
{
Integer
crosstownTypeEnum
;
DepositRefundStatus
depositRefundRecordStatus
;
//判断是否定损过
if
(
SYS_TRUE
.
equals
(
orderMQDTO
.
getOrderRentVehicleDetail
().
getFixedLossStatus
()))
{
crosstownTypeEnum
=
CrosstownTypeEnum
.
FIXED_LOSS
.
getCode
();
depositRefundRecordStatus
=
DepositRefundStatus
.
FIXLOSSREFUNDARRIVAL
;
}
else
{
crosstownTypeEnum
=
CrosstownTypeEnum
.
ARRIVE
.
getCode
();
depositRefundRecordStatus
=
DepositRefundStatus
.
REFUNDARRIVAL
;
}
OrderVehicleCrosstown
crosstown
=
crosstownBiz
.
selectOne
(
new
OrderVehicleCrosstown
(){{
setOrderId
(
orderMQDTO
.
getId
());
setType
(
crosstownTypeEnum
);
}});
if
(
null
==
crosstown
)
{
throw
new
BaseException
(
ResultCode
.
PARAM_ILLEGAL_CODE
,
Sets
.
newSet
(
"退款第一部分押金失败,获取不了还车/定损记录,订单号:"
+
orderMQDTO
.
getId
()));
}
if
(
null
==
crosstown
.
getRestDeposit
()
||
crosstown
.
getRestDeposit
().
subtract
(
illegalReserve
).
compareTo
(
BigDecimal
.
ZERO
)
<
0
){
throw
new
BaseException
(
ResultCode
.
PARAM_ILLEGAL_CODE
,
Sets
.
newSet
(
"退第一笔押金剩余金额异常,异常记录为:"
+
crosstown
.
getId
()));
}
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
//还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal
refundAmont
=
crosstown
.
getRestDeposit
().
subtract
(
illegalReserve
);
BigDecimal
originalRefundAmount
=
crosstown
.
getRestDeposit
().
add
(
crosstown
.
getDeductionCost
()).
subtract
(
illegalReserve
);
String
refundDesc
=
"退还押金:"
+
refundAmont
.
toString
()+
"(已扣除 违章预备金:"
+
illegalReserve
.
toString
();
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
()
+
" 转换失败"
);
}
refundDesc
+=
")"
;
refundTrigger
(
orderMQDTO
,
orderMQDTO
.
getOrderRentVehicleDetail
(),
illegalReserve
,
originalRefundAmount
,
refundAmont
,
refundDesc
,
RefundStatusEnum
.
RESIDUE_ILLEGAL
.
getCode
(),
RefundTypeEnum
.
PART_DEPOSIT
,
null
);
// DepositRefundRecord depositRefundRecord = orderDepositRefundRecordBiz.findByCrossIdAndStatus(crosstown.getId(), depositRefundRecordStatus);
// depositRefundRecord.setIscomplete(Boolean.TRUE);
// orderDepositRefundRecordBiz.updateSelectiveById(depositRefundRecord);
orderDepositRefundRecordBiz
.
completeRecordStatus
(
crosstown
.
getId
(),
depositRefundRecordStatus
);
orderMsgBiz
.
handelMsgDeposit
(
orderMQDTO
.
getOrderRentVehicleDetail
(),
orderMQDTO
,
userFeign
.
userDetailById
(
orderMQDTO
.
getUserId
()).
getData
());
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderRefundBiz.java
View file @
bfa199da
This diff is collapsed.
Click to expand it.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
View file @
bfa199da
...
...
@@ -77,6 +77,10 @@ public class OrderCalculateBiz {
public
InProgressVO
inProgressCalculate
(
BaseOrder
baseOrder
,
OrderItem
orderItem
,
Integer
freeDays
,
Integer
useDays
,
OrderAccountDetail
oad
)
{
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
InProgressVO
inProgressVO
=
new
InProgressVO
();
inProgressVO
.
setUsedDays
(
useDays
);
inProgressVO
.
setUsedfreeDays
(
freeDays
);
inProgressVO
.
setUsedAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
useDays
+
""
)));
inProgressVO
.
setUsedFreeDaysAmount
(
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
freeDays
+
""
)));
//计算:剩余免费天数
Integer
backFreeDays
=
freeDays
-
useDays
;
...
...
@@ -86,15 +90,13 @@ public class OrderCalculateBiz {
Integer
residueDays
=
orderItem
.
getTotalNum
()
-
useDays
;
//过了出发时间取消订单 ,优先使用免费天数
if
(
backFreeDays
<=
0
)
{
//大于总天数 只返回押金
if
(
useDays
>=
orderItem
.
getTotalNum
())
{
//退押金
//orderRefundBiz.rentRefundDepositProcess(hasUpdateOrder, orvd.getDeposit(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, freeDayAmount);
}
else
{
//使用天数 小于 总天数
if
(
useDays
<
orderItem
.
getTotalNum
())
{
//需要扣除订单费用
//判断是否达到优惠券条件 不符合则返还优惠券
//消费天数
Integer
consumeDays
=
0
-
backFreeDays
;
//计算使用天数的费用
//计算使用天数的费用
BigDecimal
consumeAmount
=
orderItem
.
getUnitPrice
().
multiply
(
new
BigDecimal
(
consumeDays
+
""
));
List
<
BigDecimal
>
couponAmounts
=
Lists
.
newArrayList
();
for
(
String
tickerNo
:
baseOrder
.
getCouponTickerNos
().
split
(
","
))
{
...
...
@@ -111,8 +113,6 @@ public class OrderCalculateBiz {
consumeAmount
=
consumeAmount
.
subtract
(
couponAmount
);
}
if
(
consumeAmount
.
compareTo
(
orderItem
.
getRealAmount
())
>
0
)
{
//消费金额 大于真实的金额 增加额外费用
inProgressVO
.
setExtraAmount
(
consumeAmount
.
subtract
(
orderItem
.
getRealAmount
()));
...
...
@@ -123,6 +123,8 @@ public class OrderCalculateBiz {
//否则,设置返回钱
refundAmount
=
refundAmount
.
add
(
orderItem
.
getRealAmount
().
subtract
(
consumeAmount
));
}
}
else
{
}
}
else
{
//返回剩余免费天数,返回优惠券,订单款
...
...
@@ -131,7 +133,7 @@ public class OrderCalculateBiz {
}
inProgressVO
.
setRefundAmount
(
refundAmount
);
inProgressVO
.
setRefund
Order
Amount
(
refundAmount
);
inProgressVO
.
setBackCoupons
(
backCouponNos
);
//计算违约金
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
View file @
bfa199da
...
...
@@ -8,6 +8,7 @@ import com.xxfc.platform.activity.feign.ActivityFeign;
import
com.xxfc.platform.order.biz.*
;
import
com.xxfc.platform.order.contant.enumerate.*
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.calculate.InProgressVO
;
import
com.xxfc.platform.order.pojo.mq.OrderMQDTO
;
import
com.xxfc.platform.tour.feign.TourFeign
;
...
...
@@ -111,6 +112,8 @@ public class OrderCancelBiz {
setVersion
(
baseOrder
.
getVersion
());
}};
BaseOrder
hasUpdateOrder
=
baseOrderBiz
.
updateSelectiveByIdReT
(
updateOrder
);
InProgressVO
inProgressVO
=
new
InProgressVO
();
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
//触发退款流程
//判断是否已支付
...
...
@@ -139,11 +142,12 @@ public class OrderCancelBiz {
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long
useTimeLag
=
System
.
currentTimeMillis
()
-
orvd
.
getStartTime
();
Integer
useDays
=
new
BigDecimal
(
useTimeLag
+
""
).
divide
(
new
BigDecimal
((
24
*
60
*
60
*
1000
)+
""
)).
setScale
(
0
,
BigDecimal
.
ROUND_UP
).
intValue
();
InProgressVO
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
null
);
inProgressVO
=
orderCalculateBiz
.
inProgressCalculate
(
baseOrder
,
orderItem
,
freeDays
,
useDays
,
oad
);
oad
.
setDepositAmount
(
orvd
.
getDeposit
().
subtract
(
inProgressVO
.
getExtraAmount
()).
subtract
(
inProgressVO
.
getViolateAmount
()));
oad
.
setOrderAmount
(
inProgressVO
.
getRefundOrderAmount
());
//结合
//退款子流程: 订单基础,退款描述,退款金额
orderAccountBiz
.
refundSubProcess
(
baseOrder
,
""
,
baseOrder
.
getRealAmount
()
,
inProgressVO
.
getRefundAmount
(),
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
null
);
orderAccountBiz
.
refundSubProcess
(
baseOrder
,
""
,
baseOrder
.
getRealAmount
()
.
subtract
(
orvd
.
getDeposit
()),
oad
.
getDepositAmount
().
add
(
oad
.
getOrderAmount
()),
RefundTypeEnum
.
ORDER_FUND
.
getCode
(),
RefundStatusEnum
.
ALL
.
getCode
(),
oad
);
}
else
{
//没到出车时间
...
...
@@ -158,7 +162,7 @@ public class OrderCancelBiz {
}
}
orderAccountBiz
.
rentRefundProcessCancel
(
hasUpdateOrder
,
orderItem
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
);
orderAccountBiz
.
rentRefundProcessCancel
(
hasUpdateOrder
,
orderItem
.
getRealAmount
()
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
orvd
.
getDeposit
(),
freeDayAmount
);
}
//退款流程
...
...
@@ -174,7 +178,6 @@ public class OrderCancelBiz {
try
{
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
baseOrder
.
getUserId
()).
getData
();
//处理后台用户提醒短信的发送
// orderMsgBiz.handelBgUserMsg4Pay(orvd, baseOrder, appUserDTO, OrderMsgBiz.RENT_CANCEL);
orderMsgBiz
.
handelMsgCancel
(
orvd
,
otd
,
omd
,
baseOrder
,
appUserDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -184,15 +187,26 @@ public class OrderCancelBiz {
otd
=
orderTourDetailBiz
.
selectOne
(
new
OrderTourDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
Long
timeLag
=
otd
.
getStartTime
()
-
System
.
currentTimeMillis
();
OrderItem
adultItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_ADULT
.
getCode
());
setOrderId
(
baseOrder
.
getId
());
}});
OrderItem
childItem
=
orderItemBiz
.
selectOne
(
new
OrderItem
(){{
setType
(
ItemTypeEnum
.
TOUR_CHILD
.
getCode
());
setOrderId
(
baseOrder
.
getId
());
}});
//判断是省内还是省外
String
key
=
TOUR_IN_REFUND
;
if
(
SYS_TRUE
.
equals
(
otd
.
getIsOutside
()))
{
key
=
TOUR_REFUND
;
}
//退款流程
order
RefundBiz
.
rentRefundProcess
(
hasUpdateOrder
,
timeLag
,
APP_ORDER
+
"_"
+
key
);
order
AccountBiz
.
rentRefundProcessCancel
(
hasUpdateOrder
,
adultItem
.
getRealAmount
().
add
(
childItem
.
getRealAmount
()),
timeLag
,
APP_ORDER
+
"_"
+
key
,
BigDecimal
.
ZERO
,
BigDecimal
.
ZERO
);
//站点总人数减少
tourFeign
.
updateTourGoodPersonNum
(
otd
.
getVerificationId
(),
TourFeign
.
TOTAL_PERSON
,
(
otd
.
getTotalNumber
()
*
-
1
));
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/jobhandler/RentDepositJobHandler.java
View file @
bfa199da
...
...
@@ -10,6 +10,7 @@ import com.xxfc.platform.order.entity.BaseOrder;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.entity.OrderVehicleCrosstown
;
import
com.xxfc.platform.order.entity.OrderViolation
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
...
...
@@ -61,6 +62,9 @@ public class RentDepositJobHandler extends IJobHandler {
@Autowired
OrderRefundBiz
orderRefundBiz
;
@Autowired
OrderAccountBiz
orderAccountBiz
;
@Autowired
OrderMsgBiz
orderMsgBiz
;
...
...
@@ -120,7 +124,9 @@ public class RentDepositJobHandler extends IJobHandler {
refundAmont
=
orvd
.
getReturnPayResidue
();
refundDesc
+=
refundAmont
.
toString
();
}
orderRefundBiz
.
refundTrigger
(
baseOrder
,
orvd
,
BigDecimal
.
ZERO
,
orvd
.
getReturnPayResidue
(),
refundAmont
,
refundDesc
,
RefundStatusEnum
.
REFUND_DEPOSIT
.
getCode
(),
RefundTypeEnum
.
RESIDUE_DEPOSIT
);
OrderAccountDetail
oad
=
new
OrderAccountDetail
();
orderAccountBiz
.
refundTrigger
(
baseOrder
,
orvd
,
BigDecimal
.
ZERO
,
orvd
.
getReturnPayResidue
(),
refundAmont
,
refundDesc
,
RefundStatusEnum
.
REFUND_DEPOSIT
.
getCode
(),
RefundTypeEnum
.
RESIDUE_DEPOSIT
,
oad
);
//orderRefundBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), RefundTypeEnum.RESIDUE_DEPOSIT);
orderDepositRefundRecordBiz
.
completeRecordStatus
(
crosstown
.
getId
(),
DepositRefundStatus
.
VIOLATIONARRIVAL
);
orderMsgBiz
.
handelMsgDeposit
(
orvd
,
baseOrder
,
userFeign
.
userDetailById
(
baseOrder
.
getUserId
()).
getData
());
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mqhandler/RefundMQHandler.java
View file @
bfa199da
...
...
@@ -42,7 +42,7 @@ public class RefundMQHandler {
String
msg
=
new
String
(
message
.
getBody
(),
"UTF-8"
);
OrderMQDTO
orderMQDTO
=
JSONUtil
.
toBean
(
msg
,
OrderMQDTO
.
class
);
orderRefundBiz
.
refundPartDeposit
(
orderMQDTO
);
//
orderRefundBiz.refundPartDeposit(orderMQDTO);
executorService
.
shutdown
();
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRefundController.java
View file @
bfa199da
...
...
@@ -72,43 +72,43 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
switch
(
orderTypeEnum
)
{
case
RENT_VEHICLE:
orderRefundAmount
=
orderRefundBiz
.
calculateRefund
(
orderPageVO
.
getGoodsAmount
().
subtract
(
orderPageVO
.
getCouponAmount
())
,
orderPageVO
.
getOrderRentVehicleDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
RENT_REFUND
,
refundDescBuilder
);
OrderRentVehicleDetail
orvd
=
orderPageVO
.
getOrderRentVehicleDetail
();
Long
timeLag
=
orvd
.
getStartTime
()
-
System
.
currentTimeMillis
();
//原退还押金
BigDecimal
originalDeductAmount
=
BigDecimal
.
ZERO
;
BigDecimal
originalRefundAmount
=
BigDecimal
.
ZERO
.
add
(
orvd
.
getDeposit
());
//判断是否使用免费天数,并且进行扣款
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
refundDescBuilder
=
new
StringBuilder
(
""
);
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
.
calculateRefund
(
originalDeductAmount
,
timeLag
,
APP_ORDER
+
"_"
+
RENT_REFUND
,
refundDescBuilder
);
residueAmount
=
residueAmount
.
setScale
(
2
,
RoundingMode
.
HALF_UP
);
//押金剩余款 :押金 - (原扣除款 - 剩余款)
//退款金额 :订单剩余款 + 押金剩余款
orderRefundAmount
=
orderRefundAmount
.
add
(
originalRefundAmount
.
subtract
(
originalDeductAmount
.
subtract
(
residueAmount
)));
//
orderRefundAmount = orderRefundBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
//
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
//
, DictionaryKey.APP_ORDER+ "_"+ RENT_REFUND
//
, refundDescBuilder);
//
OrderRentVehicleDetail orvd = orderPageVO.getOrderRentVehicleDetail();
//
Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
//
//原退还押金
//
BigDecimal originalDeductAmount = BigDecimal.ZERO;
//
BigDecimal originalRefundAmount = BigDecimal.ZERO.add(orvd.getDeposit());
//
//判断是否使用免费天数,并且进行扣款
//
if(null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
//
refundDescBuilder = new StringBuilder("");
//
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.calculateRefund(originalDeductAmount, timeLag, APP_ORDER+ "_"+ RENT_REFUND, refundDescBuilder);
//
residueAmount = residueAmount.setScale(2, RoundingMode.HALF_UP);
//
//
//押金剩余款 :押金 - (原扣除款 - 剩余款)
//
//退款金额 :订单剩余款 + 押金剩余款
//
orderRefundAmount = orderRefundAmount.add(originalRefundAmount.subtract(originalDeductAmount.subtract(residueAmount)));
break
;
case
TOUR:
//判断是省内还是省外
String
key
=
TOUR_IN_REFUND
;
if
(
SYS_TRUE
.
equals
(
orderPageVO
.
getOrderTourDetail
().
getIsOutside
()))
{
key
=
TOUR_REFUND
;
}
orderRefundAmount
=
orderRefundBiz
.
calculateRefund
(
orderPageVO
.
getGoodsAmount
().
subtract
(
orderPageVO
.
getCouponAmount
())
,
orderPageVO
.
getOrderTourDetail
().
getStartTime
()
-
System
.
currentTimeMillis
()
,
DictionaryKey
.
APP_ORDER
+
"_"
+
key
,
refundDescBuilder
);
break
;
//
String key = TOUR_IN_REFUND;
//
if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
//
key = TOUR_REFUND;
//
}
//
orderRefundAmount = orderRefundBiz.calculateRefund(orderPageVO.getGoodsAmount().subtract(orderPageVO.getCouponAmount())
//
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
//
, DictionaryKey.APP_ORDER+ "_"+ key
//
, refundDescBuilder);
//
break;
default
:
break
;
}
...
...
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