Commit 678ab118 authored by 周健威's avatar 周健威

Merge branch 'master-zjw' into dev

parents d951f9fe f36c5638
......@@ -47,6 +47,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_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.universal.constant.DictionaryKey.APP_ORDER;
......@@ -200,7 +202,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
originType = OrderAccountDeduction.ORIGIN_ORDER;
}else {
stringBuilder = depositRefundDescBuilder;
originType = OrderAccountDeduction.ORIGIN_DEPOSIT;
originType = ORIGIN_DEPOSIT;
}
oad.getDeductions().add(initDeduction(totalDeductAmount, stringBuilder.toString(), DeductionTypeEnum.VIOLATE_CANCEL, originType));
}
......@@ -436,13 +438,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
handleDedRefundDesc = handleDed(crosstown, handleDedRefundDesc, csv);
if(csv.getDamagesAmount().compareTo(BigDecimal.ZERO) > 0) {
oad.getDeductions().add(
initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT)
initDeduction(csv.getDamagesAmount(), handleDedRefundDesc, DeductionTypeEnum.DAMAGES, ORIGIN_DEPOSIT)
);
}
//还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT)
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, ORIGIN_DEPOSIT)
);
//剩余押金 = 押金 - 违章保证金 - 定损金额
......@@ -618,7 +620,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加
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);
//修改归还押金金额
resetDeposit(oad);
......@@ -634,8 +636,29 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
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) {
......@@ -658,7 +681,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
//如果没有修改,则添加
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);
//修改归还押金金额
resetDeposit(oad);
......@@ -692,7 +715,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderViolation) {
//设置扣款项
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)
);
//还车扣除款 剩余的 钱,再减去违章预备金
......
......@@ -71,7 +71,7 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
String refundDesc = StringUtils.isNotBlank(orderRefundVo.getRefundDesc()) ? orderRefundVo.getRefundDesc() : "审核通过,退款";
String out_refund_no = Snowflake.build() + "";
if (StringUtils.isBlank(order_no) || StringUtils.isBlank(appid) || StringUtils.isBlank(mchId) || StringUtils.isBlank(partnerKey)
|| payAmount == null || payAmount == 0 || refundAmount == null || refundAmount == 0) {
|| payAmount == null || payAmount == 0 || (refundAmount == null && orderRefundVo.getFreeze2PayAmount() == null) || (refundAmount == 0 && orderRefundVo.getFreeze2PayAmount() == 0)) {
log.error("-----参数为空-----------");
return JsonResultUtil.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
......
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