xiaoyong931011
2023-08-14 6264b2ccbe02a102bdfc0b8d683679910f158560
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -387,6 +387,7 @@
                    throw new FebsException("兑换券已使用");
                }
                mallRollPerk.setState(2);
                mallRollPerk.setUpdateTime(DateUtil.date());
                mallRollPerkMapper.updateById(mallRollPerk);
                payResultStr = orderInfo.getOrderNo();
@@ -406,12 +407,12 @@
                BigDecimal balanceThree = mallMemberWalletThree.getBalance();
                BigDecimal amountThree = orderInfo.getAmount();
                int reduceThree = memberWalletService.reduce(balanceThree, member.getId(), "balance");
                if (reduceThree == 2) {
                    throw new FebsException("余额不足");
                }
                mallMoneyFlowService.addMoneyFlow(member.getId(), balanceThree.negate(), MoneyFlowTypeEnum.PAY.getValue(),
                        orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue(),"余额支付",2);
//                int reduceThree = memberWalletService.reduce(balanceThree, member.getId(), "balance");
//                if (reduceThree == 2) {
//                    throw new FebsException("余额不足");
//                }
//                mallMoneyFlowService.addMoneyFlow(member.getId(), balanceThree.negate(), MoneyFlowTypeEnum.PAY.getValue(),
//                        orderInfo.getOrderNo(), FlowTypeEnum.BALANCE.getValue(),"余额支付",2);
                //实际支付余额
                BigDecimal amountActualThree = amountThree.subtract(balanceThree).setScale(2, BigDecimal.ROUND_DOWN);
@@ -426,6 +427,7 @@
                wxResultStr = JSONUtil.toJsonStr(brandWCPayRequestDataThree);
                payResultStr = brandWCPayRequestDataThree.getPrepay_id();
                orderInfo.setPayMethod("余额加微信");
                orderInfo.setAmount(amountThree);
                amountActualMsg = amountThree.toString();
                break;
            /**
@@ -645,6 +647,19 @@
        orderInfo.setReceivingTime(new Date());
        this.baseMapper.updateById(orderInfo);
        //是否返利
        if(ObjectUtil.isNotEmpty(member.getReferrerId())){
            String referrerId = member.getReferrerId();
            MallMember mallMemberParent = memberMapper.selectInfoByInviteId(referrerId);
            Long parentId = mallMemberParent.getId();
            String orderNo = orderInfo.getOrderNo();
            MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOneByOrderNoAndMemberIdAndRtMemberId(orderNo, member.getId(), parentId);
            mallMoneyFlow.setStatus(2);
            mallMoneyFlow.setIsReturn(1);
            mallMoneyFlowMapper.updateById(mallMoneyFlow);
            memberWalletService.add(mallMoneyFlow.getAmount(), id, "balance");
        }
        //生成一条团长提成记录
//        Long orderInfoId = orderInfo.getId();
//        List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfoId);