liujie
2026-04-29 2d56c1d1ca0f7cbc05150b8cd48e63372f1a7f32
update
2个文件已修改
82 ■■■■■ 已修改文件
UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -2614,20 +2614,44 @@
    private boolean isPrivateCarPrepayFinalStage(OrderPrivateCar orderPrivateCar) {
        return orderPrivateCar != null
                && Integer.valueOf(1).equals(orderPrivateCar.getPaymentMode())
                && !Integer.valueOf(5).equals(orderPrivateCar.getPrepayStage())
                && orderPrivateCar.getPayMoney() != null
                && orderPrivateCar.getPayMoney() > 0;
                && !Integer.valueOf(5).equals(orderPrivateCar.getPrepayStage());
    }
    private BigDecimal toMoney(Double amount) {
        return new BigDecimal(String.valueOf(amount == null ? 0D : amount)).setScale(2, RoundingMode.HALF_UP);
    }
    private Double getPrivateCarPrepayFinalPayAmount(OrderPrivateCar orderPrivateCar, Double finalAmount) {
    private PaymentRecord getPrivateCarPrepayPaidRecord(OrderPrivateCar orderPrivateCar) throws Exception {
        PaymentRecord paymentRecord = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, orderPrivateCar.getId(), 1, orderPrivateCar.getPayType(), 2);
        if (paymentRecord == null) {
            paymentRecord = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, orderPrivateCar.getId(), 1, null, 2);
        }
        if (paymentRecord != null && orderPrivateCar.getPayType() == null) {
            orderPrivateCar.setPayType(paymentRecord.getPayType());
        }
        return paymentRecord;
    }
    private BigDecimal getPrivateCarPrepayPaidAmount(OrderPrivateCar orderPrivateCar) throws Exception {
        PaymentRecord paymentRecord = getPrivateCarPrepayPaidRecord(orderPrivateCar);
        if (paymentRecord != null && paymentRecord.getAmount() != null && paymentRecord.getAmount() > 0) {
            return toMoney(paymentRecord.getAmount());
        }
        if (orderPrivateCar.getPayMoney() != null && orderPrivateCar.getPayMoney() > 0) {
            return toMoney(orderPrivateCar.getPayMoney());
        }
        return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
    }
    private Double getPrivateCarPrepayFinalPayAmount(OrderPrivateCar orderPrivateCar, Double finalAmount) throws Exception {
        if (!isPrivateCarPrepayFinalStage(orderPrivateCar)) {
            return toMoney(finalAmount).doubleValue();
        }
        BigDecimal spreadAmount = toMoney(finalAmount).subtract(toMoney(orderPrivateCar.getPayMoney())).setScale(2, RoundingMode.HALF_UP);
        BigDecimal paidAmount = getPrivateCarPrepayPaidAmount(orderPrivateCar);
        if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) {
            return toMoney(finalAmount).doubleValue();
        }
        BigDecimal spreadAmount = toMoney(finalAmount).subtract(paidAmount).setScale(2, RoundingMode.HALF_UP);
        if (spreadAmount.compareTo(BigDecimal.ZERO) > 0) {
            orderPrivateCar.setPrepayStage(3);
            return spreadAmount.doubleValue();
@@ -2639,7 +2663,10 @@
        if (!isPrivateCarPrepayFinalStage(orderPrivateCar)) {
            return null;
        }
        BigDecimal paidAmount = toMoney(orderPrivateCar.getPayMoney());
        BigDecimal paidAmount = getPrivateCarPrepayPaidAmount(orderPrivateCar);
        if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) {
            return null;
        }
        BigDecimal settleAmount = toMoney(finalAmount);
        BigDecimal refundAmount = paidAmount.subtract(settleAmount).setScale(2, RoundingMode.HALF_UP);
        if (refundAmount.compareTo(BigDecimal.ZERO) < 0) {
@@ -2667,7 +2694,7 @@
            return ResultUtil.success();
        }
        PaymentRecord paymentRecord = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, orderPrivateCar.getId(), 1, orderPrivateCar.getPayType(), 2);
        PaymentRecord paymentRecord = getPrivateCarPrepayPaidRecord(orderPrivateCar);
        if (paymentRecord == null) {
            return ResultUtil.error("先付订单缺少已支付流水,无法退款");
        }
UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -2112,20 +2112,44 @@
    private boolean isTaxiPrepayFinalStage(OrderTaxi orderTaxi) {
        return orderTaxi != null
                && Integer.valueOf(1).equals(orderTaxi.getPaymentMode())
                && !Integer.valueOf(5).equals(orderTaxi.getPrepayStage())
                && orderTaxi.getPayMoney() != null
                && orderTaxi.getPayMoney() > 0;
                && !Integer.valueOf(5).equals(orderTaxi.getPrepayStage());
    }
    private BigDecimal toMoney(Double amount) {
        return new BigDecimal(String.valueOf(amount == null ? 0D : amount)).setScale(2, RoundingMode.HALF_UP);
    }
    private Double getTaxiPrepayFinalPayAmount(OrderTaxi orderTaxi, Double finalAmount) {
    private PaymentRecord getTaxiPrepayPaidRecord(OrderTaxi orderTaxi) throws Exception {
        PaymentRecord paymentRecord = paymentRecordService.query(1, orderTaxi.getUserId(), 1, orderTaxi.getId(), 2, orderTaxi.getPayType(), 2);
        if (paymentRecord == null) {
            paymentRecord = paymentRecordService.query(1, orderTaxi.getUserId(), 1, orderTaxi.getId(), 2, null, 2);
        }
        if (paymentRecord != null && orderTaxi.getPayType() == null) {
            orderTaxi.setPayType(paymentRecord.getPayType());
        }
        return paymentRecord;
    }
    private BigDecimal getTaxiPrepayPaidAmount(OrderTaxi orderTaxi) throws Exception {
        PaymentRecord paymentRecord = getTaxiPrepayPaidRecord(orderTaxi);
        if (paymentRecord != null && paymentRecord.getAmount() != null && paymentRecord.getAmount() > 0) {
            return toMoney(paymentRecord.getAmount());
        }
        if (orderTaxi.getPayMoney() != null && orderTaxi.getPayMoney() > 0) {
            return toMoney(orderTaxi.getPayMoney());
        }
        return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP);
    }
    private Double getTaxiPrepayFinalPayAmount(OrderTaxi orderTaxi, Double finalAmount) throws Exception {
        if (!isTaxiPrepayFinalStage(orderTaxi)) {
            return toMoney(finalAmount).doubleValue();
        }
        BigDecimal spreadAmount = toMoney(finalAmount).subtract(toMoney(orderTaxi.getPayMoney())).setScale(2, RoundingMode.HALF_UP);
        BigDecimal paidAmount = getTaxiPrepayPaidAmount(orderTaxi);
        if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) {
            return toMoney(finalAmount).doubleValue();
        }
        BigDecimal spreadAmount = toMoney(finalAmount).subtract(paidAmount).setScale(2, RoundingMode.HALF_UP);
        if (spreadAmount.compareTo(BigDecimal.ZERO) > 0) {
            orderTaxi.setPrepayStage(3);
            return spreadAmount.doubleValue();
@@ -2137,7 +2161,10 @@
        if (!isTaxiPrepayFinalStage(orderTaxi)) {
            return null;
        }
        BigDecimal paidAmount = toMoney(orderTaxi.getPayMoney());
        BigDecimal paidAmount = getTaxiPrepayPaidAmount(orderTaxi);
        if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) {
            return null;
        }
        BigDecimal settleAmount = toMoney(finalAmount);
        BigDecimal refundAmount = paidAmount.subtract(settleAmount).setScale(2, RoundingMode.HALF_UP);
        if (refundAmount.compareTo(BigDecimal.ZERO) < 0) {
@@ -2165,7 +2192,7 @@
            return ResultUtil.success();
        }
        PaymentRecord paymentRecord = paymentRecordService.query(1, orderTaxi.getUserId(), 1, orderTaxi.getId(), 2, orderTaxi.getPayType(), 2);
        PaymentRecord paymentRecord = getTaxiPrepayPaidRecord(orderTaxi);
        if (paymentRecord == null) {
            return ResultUtil.error("先付订单缺少已支付流水,无法退款");
        }