无关风月
2024-11-27 4dfc81531cba8e10ea569559389cdcbd50f4bacd
xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/service/impl/OrderServiceImpl.java
@@ -117,7 +117,9 @@
                this.save(order);
            }else{
                 order = this.getById(orderId);
                 order.setBizOrderNo(orderNo);
                 order.setBuyContent("购买疗愈【"+meditationTitle+"】");
                 this.updateById(order);
            }
            Long orderId9 = order.getId();
@@ -178,6 +180,8 @@
            }else{
                order = this.getById(orderId);
                order.setBuyContent("购买课程【"+courseTitle+"】");
                order.setBizOrderNo(orderNo);
                this.updateById(order);
            }
            Long orderId8 = order.getId();
@@ -299,7 +303,12 @@
            balancePaymentRecord.setPayAmount(one.getRealPayAmount());
            balancePaymentRecord.setPaymentType(PaymentTypeEnum.BALANCE_PAY.getCode());
            balancePaymentRecord.setPaymentStatus(PaymentStatusEnum.COMPLETED.getCode());
            orderPaymentRecordService.save(balancePaymentRecord);
            List<OrderPaymentRecord> list = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, orderId)
                    .eq(OrderPaymentRecord::getPaymentType, 4).list();
            if (list.isEmpty()){
                orderPaymentRecordService.save(balancePaymentRecord);
            }
            return new BigDecimal("0");
        }else {
            // 更新用户余额
@@ -313,7 +322,11 @@
            balancePaymentRecord.setPaymentType(PaymentTypeEnum.BALANCE_PAY.getCode());
            balancePaymentRecord.setPaymentStatus(PaymentStatusEnum.COMPLETED.getCode());
            balancePaymentRecord.setPayAmount(appUser.getBalance());
            orderPaymentRecordService.save(balancePaymentRecord);
            List<OrderPaymentRecord> list = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, orderId)
                    .eq(OrderPaymentRecord::getPaymentType, 4).list();
            if (list.isEmpty()){
                orderPaymentRecordService.save(balancePaymentRecord);
            }
            // 计算除去余额还需支付的金额
            return one.getRealPayAmount()
                    .subtract(appUser.getBalance());
@@ -372,7 +385,14 @@
            clientPlaceOrderVO.setOrderId(payInfo.getString("id"));
            paymentRecord.setPaymentStatus(PaymentStatusEnum.TO_BE_PAID.getCode());
            paymentRecord.setPayAmount(needPayAmount);
            orderPaymentRecordService.save(paymentRecord);
            OrderPaymentRecord list = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, orderId)
                    .ne(OrderPaymentRecord::getPaymentType, 4).one();
            if (list==null){
                orderPaymentRecordService.save(paymentRecord);
            }else{
                list.setPayOrderNo(payInfo.getString("id"));
                orderPaymentRecordService.updateById(list);
            }
            // 设置订单是否需要支付标识
            clientPlaceOrderVO.setZeroFlag(DisabledEnum.NO.getCode());
        }else{
@@ -396,7 +416,14 @@
            paymentRecord.setPaymentType(PaymentTypeEnum.ALI_PAY.getCode());
            paymentRecord.setPaymentStatus(PaymentStatusEnum.TO_BE_PAID.getCode());
            paymentRecord.setPayOrderNo(payInfo.getString("id"));
            orderPaymentRecordService.save(paymentRecord);
            OrderPaymentRecord list = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, orderId)
                    .ne(OrderPaymentRecord::getPaymentType, 4).one();
            if (list==null){
                orderPaymentRecordService.save(paymentRecord);
            }else{
                list.setPayOrderNo(payInfo.getString("id"));
                orderPaymentRecordService.updateById(list);
            }
            clientPlaceOrderVO.setPayAmt(payInfo.getString("pay_amt"));
            clientPlaceOrderVO.setOrderId(payInfo.getString("id"));
            // 设置订单是否需要支付标识