Commit 02a0acbe authored by 周健威's avatar 周健威

Merge branch 'feature-delay-add' into dev

parents 336bdd96 66473170
......@@ -106,8 +106,10 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param orderViolateCoverAmount 订单违约金覆盖值
* @param depositViolateCoverAmount 押金违约金覆盖值
*/
public BigDecimal rentRefundProcessCancel(BaseOrder baseOrder, BigDecimal orderDeductSource, Long timeLag, String dicParentKey, BigDecimal depositAmount, BigDecimal depositDeductSource
, OrderAccountDetail oad, BigDecimal topAmount, BigDecimal orderViolateCoverAmount, BigDecimal depositViolateCoverAmount) {
public BigDecimal rentRefundProcessCancel(BaseOrder baseOrder, BigDecimal orderDeductSource, Long timeLag
, String dicParentKey, BigDecimal depositAmount, BigDecimal depositDeductSource
, OrderAccountDetail oad, BigDecimal topAmount, BigDecimal orderViolateCoverAmount, BigDecimal depositViolateCoverAmount
, Boolean noDeduct) {
//原来退款 和 最终退款
BigDecimal originalRefundAmount = BigDecimal.ZERO;
BigDecimal refundAmount = BigDecimal.ZERO;
......@@ -124,6 +126,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderDeductSource && BigDecimal.ZERO.compareTo(orderDeductSource) < 0) {
BigDecimal orderDeductAmount = calculateDeduction(orderDeductSource, timeLag, dicParentKey, orderRefundDescBuilder);
//如果属于免扣费情况
if(noDeduct) {
orderDeductAmount = BigDecimal.ZERO;
orderRefundDescBuilder = new StringBuilder("");
}
orderDeductAmount = orderDeductAmount.setScale(2, RoundingMode.HALF_UP);
if(null != orderViolateCoverAmount) {
orderDeductAmount = orderViolateCoverAmount;
......@@ -157,6 +164,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != depositDeductSource && BigDecimal.ZERO.compareTo(depositDeductSource) < 0) {
//通过原扣除款 计算剩余款
BigDecimal depositDeductAmount = calculateDeduction(depositDeductSource, timeLag, dicParentKey, depositRefundDescBuilder);
//如果属于免扣费情况
if(noDeduct) {
depositDeductAmount = BigDecimal.ZERO;
depositRefundDescBuilder = new StringBuilder("");
}
depositDeductAmount = depositDeductAmount.setScale(2, RoundingMode.HALF_UP);
if(null != orderViolateCoverAmount) {
depositDeductAmount = orderViolateCoverAmount;
......
......@@ -21,6 +21,8 @@ import com.xxfc.platform.order.pojo.price.CancelNoStartVO;
import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import com.xxfc.platform.tour.feign.TourFeign;
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.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
......@@ -131,6 +133,15 @@ public class OrderCancelBiz {
//触发退款流程
//判断是否已支付
if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//缓冲取消时间(一个小时)
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long autoCancelTime = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.CANCEL_TIME_BUFFER).getDetail());
//判断是否支付超过缓冲取消时间(一个小时)
Long orderCrtLag = System.currentTimeMillis() - baseOrder.getPayTime();
Boolean overCancelBuffer = (orderCrtLag > autoCancelTime)? Boolean.TRUE: Boolean.FALSE;
//判断订单类型
if(OrderTypeEnum.RENT_VEHICLE.getCode().equals(baseOrder.getType())) {
orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{
......@@ -146,7 +157,8 @@ public class OrderCancelBiz {
//根据时间处理goodsAmount
//获取出发时间 到现在 距离时间
Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
if(timeLag < 0 ) {
if(timeLag < 0 && overCancelBuffer) {
Integer useDays = orderCalculateBiz.getIncludeDays(orvd.getStartTime(), System.currentTimeMillis());
if(useDays > orvd.obtainRealDayNum()) {
useDays = orvd.obtainRealDayNum();
......@@ -221,7 +233,7 @@ public class OrderCancelBiz {
//退款流程
//违约金封顶 租车身份价 * 2天
orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount);
orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount, (!overCancelBuffer));
//设置订单数据
//baseOrder.setDamagesAmount(csv.getDamagesAmount());
......@@ -264,6 +276,7 @@ public class OrderCancelBiz {
}
}else if (OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{
setOrderId(baseOrder.getId());
}});
......@@ -290,7 +303,7 @@ public class OrderCancelBiz {
}
//退款流程
orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount), changeViolateAmount, null);
orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount), changeViolateAmount, null, (!overCancelBuffer));
//如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) {
......
......@@ -50,7 +50,7 @@ public class DictionaryKey {
public static final String TOUR_IN_REFUND = "TOUR_IN_REFUND";
/**
* 租车:公司司机租金、免赔费用、违章预备金
* 租车:公司司机租金、免赔费用、违章预备金、租车时间缓冲(小时)
*/
public static final String DRIVER_PRICE = "DRIVER_PRICE";
public static final String DAMAGE_SAFE = "DAMAGE_SAFE";
......@@ -78,4 +78,9 @@ public class DictionaryKey {
* 自动退款保留押金的时间(小时)
*/
public static final String RENT_DEPOSIT_AUTO_REFUND_TIME = "RENT_DEPOSIT_AUTO_REFUND_TIME";
/**
* 取消时间缓冲(分钟)
*/
public static final String CANCEL_TIME_BUFFER = "CANCEL_TIME_BUFFER";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment