Commit f36c5638 authored by 周健威's avatar 周健威

退第一笔钱bug

parent 7c8d7e91
...@@ -49,6 +49,8 @@ import java.util.*; ...@@ -49,6 +49,8 @@ import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE; 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.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI; import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER; import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
...@@ -202,7 +204,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -202,7 +204,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
originType = OrderAccountDeduction.ORIGIN_ORDER; originType = OrderAccountDeduction.ORIGIN_ORDER;
}else { }else {
stringBuilder = depositRefundDescBuilder; stringBuilder = depositRefundDescBuilder;
originType = OrderAccountDeduction.ORIGIN_DEPOSIT; originType = ORIGIN_DEPOSIT;
} }
oad.getDeductions().add(initDeduction(totalDeductAmount, stringBuilder.toString(), DeductionTypeEnum.VIOLATE_CANCEL, originType)); oad.getDeductions().add(initDeduction(totalDeductAmount, stringBuilder.toString(), DeductionTypeEnum.VIOLATE_CANCEL, originType));
} }
...@@ -438,13 +440,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -438,13 +440,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv); handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv);
if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) { if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) {
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, ORIGIN_DEPOSIT)
); );
} }
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, ORIGIN_DEPOSIT)
); );
//剩余押金 = 押金 - 违章保证金 - 定损金额 //剩余押金 = 押金 - 违章保证金 - 定损金额
...@@ -620,7 +622,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -620,7 +622,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加 //如果没有修改,则添加
if(Boolean.FALSE.equals(flag)) { if(Boolean.FALSE.equals(flag)) {
OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), DeductionTypeEnum.OTHER_DELAY_SAFE, OrderAccountDeduction.ORIGIN_DEPOSIT); OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), DeductionTypeEnum.OTHER_DELAY_SAFE, ORIGIN_DEPOSIT);
oad.getDeductions().add(oadNew); oad.getDeductions().add(oadNew);
//修改归还押金金额 //修改归还押金金额
resetDeposit(oad); resetDeposit(oad);
...@@ -636,8 +638,29 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -636,8 +638,29 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
private void resetDeposit(OrderAccountDetail oad) { private void resetDeposit(OrderAccountDetail oad) {
//修改归还押金金额 //修改归还押金金额
BigDecimal toDeduction = oad.getDeductions().parallelStream().map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
oad.setDepositAmount(oad.getOriginDepositAmount().subtract(toDeduction)); //扣费(押金源)
BigDecimal toDeduction = oad.getDeductions().parallelStream().filter(oadTemp ->
(Integer.valueOf(ORIGIN_DEPOSIT).equals(oadTemp.getOrigin()))
).map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//扣费(订单_押金源)
BigDecimal toOdDeduction = oad.getDeductions().parallelStream().filter(oadTemp ->
(Integer.valueOf(ORIGIN_ORDER_DEPOSIT).equals(oadTemp.getOrigin()))
).map(OrderAccountDeduction::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal toExtendDeduction = oad.getOriginOrderAmount().subtract(toOdDeduction);
//如果订单原款 - 扣费 小于零,则押金有额外扣费
if(toExtendDeduction.compareTo(BigDecimal.ZERO) < 0) {
//置反
toExtendDeduction = BigDecimal.ZERO.subtract(toExtendDeduction);
}else {
//否则 则置为零
toExtendDeduction = BigDecimal.ZERO;
}
oad.setDepositAmount(oad.getOriginDepositAmount().subtract(toDeduction).subtract(toExtendDeduction));
} }
private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) { private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) {
...@@ -660,7 +683,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -660,7 +683,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加 //如果没有修改,则添加
if(Boolean.FALSE.equals(flag)) { if(Boolean.FALSE.equals(flag)) {
OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), dte, OrderAccountDeduction.ORIGIN_DEPOSIT); OrderAccountDeduction oadNew = initDeduction(vio.getCost(), vio.getDeductions(), dte, ORIGIN_DEPOSIT);
oad.getDeductions().add(oadNew); oad.getDeductions().add(oadNew);
//修改归还押金金额 //修改归还押金金额
resetDeposit(oad); resetDeposit(oad);
...@@ -694,7 +717,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -694,7 +717,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderViolation) { if(null != orderViolation) {
//设置扣款项 //设置扣款项
oad.getDeductions().add( oad.getDeductions().add(
initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, OrderAccountDeduction.ORIGIN_DEPOSIT) initDeduction(orderViolation.getPrice(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT.getDesc(), DeductionTypeEnum.VIOLATE_TRAFFIC_DEDUCT, ORIGIN_DEPOSIT)
); );
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
......
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