Commit 146d899f authored by 周健威's avatar 周健威

修改押金扣款问题

parent 785659d5
......@@ -11,6 +11,15 @@ import java.util.List;
@Data
public class InProgressVO {
public static final int VIOLATE_TYPE_NOT = 0;
public static final int VIOLATE_TYPE_ADVANCE = 1;
public static final int VIOLATE_TYPE_DELAY = 2;
/**
* 违约类型 0--没违约;1--提前还车;2--延期还车
*/
Integer violateType = 0;
/**
* 违约金
*/
......
......@@ -46,6 +46,8 @@ import java.util.List;
import java.util.Map;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.pojo.calculate.InProgressVO.VIOLATE_TYPE_ADVANCE;
import static com.xxfc.platform.order.pojo.calculate.InProgressVO.VIOLATE_TYPE_DELAY;
import static com.xxfc.platform.universal.constant.DictionaryKey.*;
/**
......@@ -278,9 +280,11 @@ public class OrderCalculateBiz implements CalculateInterface {
violateDesc += StrUtil.format("(封顶{}元)", residueAmount);
}
inProgressVO.setViolateType(VIOLATE_TYPE_ADVANCE);
inProgressVO.setViolateAmount(residueAmount);
inProgressVO.setViolateDesc(" 提前还车违约金:"+ violateDesc);
OrderAccountDeduction violateDeduction = orderAccountBiz.initDeduction(inProgressVO.getViolateAmount(), violateDesc, DeductionTypeEnum.VIOLATE_ADVANCE, OrderAccountDeduction.ORIGIN_DEPOSIT);
//提前还车 修改ORIGIN_DEPOSIT 为 ORIGIN_ORDER_DEPOSIT
OrderAccountDeduction violateDeduction = orderAccountBiz.initDeduction(inProgressVO.getViolateAmount(), violateDesc, DeductionTypeEnum.VIOLATE_ADVANCE, OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT);
oad.getDeductions().add(violateDeduction);
}else if (realResidueDays.equals(0)) { //准时还车
//设置消耗费用列表
......@@ -301,6 +305,7 @@ public class OrderCalculateBiz implements CalculateInterface {
.map(VMCalendarPriceCostDTO::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(2+ ""));
//超过的天数 价格 * 200%
inProgressVO.setViolateType(VIOLATE_TYPE_DELAY);
inProgressVO.setViolateAmount(overAmount);
inProgressVO.setViolateDesc(" 延期还车违约金:"+ violateDesc);
inProgressVO.setOverAmountList(overAmountList);
......@@ -349,9 +354,17 @@ public class OrderCalculateBiz implements CalculateInterface {
public InProgressVO calculateOrderComplete(BaseOrder baseOrder, OrderRentVehicleDetail orvd, OrderAccountDetail oad, VehicleItemDTO vehicleItemDTO, Integer useDays, Boolean isCancel) {
InProgressVO inProgressVO = inProgressCalculate(baseOrder, vehicleItemDTO, orvd, useDays, oad, isCancel);
//定金 - (额外消费金额 + 违约金)
oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount().add(inProgressVO.getViolateAmount())));
oad.setOrderAmount(inProgressVO.getRefundOrderAmount());
//后修改为提前还车 订单款扣,延期还车 押金扣
if(InProgressVO.VIOLATE_TYPE_ADVANCE == inProgressVO.getViolateType()) {
//定金 - (额外消费金额)
oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount()));
//订单款 - 违约金
oad.setOrderAmount(inProgressVO.getRefundOrderAmount().subtract(inProgressVO.getViolateAmount()));
}else {
//定金 - (额外消费金额 + 违约金)
oad.setDepositAmount(orvd.getDeposit().subtract(inProgressVO.getExtraAmount().add(inProgressVO.getViolateAmount())));
oad.setOrderAmount(inProgressVO.getRefundOrderAmount());
}
oad.setOriginDepositAmount(orvd.getDeposit());
oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
return inProgressVO;
......
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