无关风月
2024-12-16 fd88d7b527e99bbf7272d28bf0826b05e3c175d8
xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
@@ -371,8 +371,6 @@
                                    order.setRealPayAmount(data1.getIosPrice());
                                    break;
                            }
                            break;
                        case 2:
                            Course data = remoteCourseService.getCourseById(targetId).getData();
@@ -409,6 +407,12 @@
                            break;
                    }
                    // 删除原有非余额支付详细记录
                    OrderPaymentRecord two = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, order.getId())
                            .ne(OrderPaymentRecord::getPaymentType, 4).one();
                    if (two!=null){
                        orderPaymentRecordService.removeById(two.getId());
                    }
                    OrderPaymentRecord one = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, order.getId())
                            .eq(OrderPaymentRecord::getPaymentType, 4).one();
                    if (one!=null){
@@ -434,6 +438,9 @@
                    ClientPlaceOrderVO clientPlaceOrderVO = new ClientPlaceOrderVO();
                    clientPlaceOrderVO.setId(order.getId());
                    clientPlaceOrderVO.setOrderNo(order.getBizOrderNo());
                    order.setRealPayAmount(new BigDecimal("0"));
                    order.setPayType(4);
                    orderService.updateById(order);
                    return R.ok(clientPlaceOrderVO);
            }
@@ -690,11 +697,9 @@
                AppUser data = remoteAppUserService.getAppUserById(one.getAppUserId() + "").getData();
                if (one.getGiveUserId()!=null){
                    remoteAppUserService.addNotice(one.getGiveUserId() + "", one.getBusinessId() + "",
                            one.getAppUserId() + "", one.getTotalAmount() + "");
                            one.getAppUserId() + "", realPayAmount + "");
                }
                if (data.getInviteUserId()!=null) {
                    if (one.getOrderFrom() == 1 || one.getOrderFrom() == 2 || one.getOrderFrom() == 3) {
                        // 查询实际支付价格 不包含余额抵扣价格
                        OrderPaymentRecord one1 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId())
@@ -703,8 +708,7 @@
                    CommissionRule data1 = sysUserClient.getCommission().getData();
                    if (data1 != null) {
                        if (data1.getProportion() != null) {
                            BigDecimal bigDecimal = one1.getPayAmount().multiply(data1.getProportion()).divide(new BigDecimal("100"))
                            BigDecimal bigDecimal = one1.getPayAmount().add(one.getChangePrice()!=null?one.getChangePrice():new BigDecimal("0")).multiply(data1.getProportion()).divide(new BigDecimal("100"))
                                    .setScale(2, BigDecimal.ROUND_DOWN);
                            // 上级获取的分佣金额
                            AppUser appUserById = remoteAppUserService.getAppUserById(data.getInviteUserId() + "").getData();
@@ -714,16 +718,18 @@
//                                                    appUserById.getBalance().add(bigDecimal))
//                                            .build(), SecurityConstants.INNER);
                            // 新增分佣流水明细
                            AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
                            appUserWalletRecord.setAppUserId(data.getInviteUserId());
                            appUserWalletRecord.setChangeType(1);
                            appUserWalletRecord.setReason("分佣收益");
                            appUserWalletRecord.setAmount(bigDecimal);
                            appUserWalletRecord.setChildAppUserId(one.getAppUserId());
                            appUserWalletRecord.setOrderId(one.getId());
                            remoteAppUserService.addBalanceRecord(appUserWalletRecord);
                            one.setCommissionAmount(bigDecimal);
                            one.setCommissionId(data.getInviteUserId());
                            if (bigDecimal.compareTo(new BigDecimal("0"))>0){
                                AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
                                appUserWalletRecord.setAppUserId(data.getInviteUserId());
                                appUserWalletRecord.setChangeType(1);
                                appUserWalletRecord.setReason("分佣收益");
                                appUserWalletRecord.setAmount(bigDecimal);
                                appUserWalletRecord.setChildAppUserId(one.getAppUserId());
                                appUserWalletRecord.setOrderId(one.getId());
                                remoteAppUserService.addBalanceRecord(appUserWalletRecord);
                                one.setCommissionAmount(bigDecimal);
                                one.setCommissionId(data.getInviteUserId());
                            }
                            orderService.updateById(one);
                        }
                    }
@@ -741,7 +747,6 @@
                            Meditation data1 = remoteMeditationService.getMeditationById(one.getBusinessId()).getData();
                            appUserWalletRecord.setChangeType(2);
                            reason = "购买疗愈【"+data1.getMeditationTitle()+"】";
                            break;
                        case 2:
                            Course data2 = remoteCourseService.getCourseById(one.getBusinessId()).getData();