puzhibing
2 天以前 6058af744bdf4fe6a3856c46fe31cfb4dbd8e255
ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -402,6 +402,17 @@
        appSureOrderVo.setOrderPayMoney(orderPayMoney);
        // 设置订单商品列表
        appSureOrderVo.setAppSureOrderGoodsVoList(appSureOrderGoodsVoList);
        appSureOrderVo.setLotteryDraw(false);
        // 返回AppPlaceOrderVo对象
        List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData();
        if (data.size() > 0) {
            BigDecimal finalOrderPayMoney = orderPayMoney;
            List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList());
            if (collect.size() > 0) {
                appSureOrderVo.setLotteryDraw(true);
                appSureOrderVo.setLotteryEventId(collect.get(0).getId());
            }
        }
        return appSureOrderVo;
    }
@@ -510,6 +521,17 @@
        appPanicBuyVo.setOrderGoodsMoney(orderGoodsMoney);
        appPanicBuyVo.setOrderPayDeposit(orderPayDeposit);
        appPanicBuyVo.setOrderPayMoney(orderPayMoney);
        appPanicBuyVo.setLotteryDraw(false);
        // 返回AppPlaceOrderVo对象
        List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData();
        if (data.size() > 0) {
            BigDecimal finalOrderPayMoney = orderPayMoney;
            List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList());
            if (collect.size() > 0) {
                appPanicBuyVo.setLotteryDraw(true);
                appPanicBuyVo.setLotteryEventId(collect.get(0).getId());
            }
        }
        return appPanicBuyVo;
    }
@@ -1601,16 +1623,15 @@
        appPlaceOrderVo.setSignType(payArr[4]);
        appPlaceOrderVo.setPaySign(payArr[5]);
        appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId());
        appPlaceOrderVo.setLotteryDraw(false);
        // 返回AppPlaceOrderVo对象
        List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData();
        if (data.size() > 0) {
            List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).collect(Collectors.toList());
            appPlaceOrderVo.setLotteryDraw(collect.size() > 0);
            List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) <= 0).collect(Collectors.toList());
            if (collect.size() > 0) {
                appPlaceOrderVo.setLotteryDraw(true);
                appPlaceOrderVo.setLotteryEventId(collect.get(0).getId());
            }
        } else {
            appPlaceOrderVo.setLotteryDraw(false);
        }
        return appPlaceOrderVo;
    }
@@ -3167,7 +3188,13 @@
                consumerGoodsService.sendGoodsGift(giftSendDtoList);
                //抽奖奖品中的平台商品需要生成订单数据
                if (memberGiftRecord.getPrizeFrom() == 2) {
                    addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId());
                    Order one = this.getOne(new QueryWrapper<Order>().eq("activity_id", memberGiftRecord.getGiftId()).eq("order_from", 4));
                    if(null == one){
                        addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId(), 3);
                    }else{
                        one.setOrderStatus(3);
                        this.updateById(one);
                    }
                }
                break;
            case 3:
@@ -3205,18 +3232,18 @@
    
    
    /**
     * 核销抽奖的平台商品生成订单
     * 抽奖的平台商品生成订单--待审核
     *
     * @param shopId
     * @param userId
     * @param goods
     * @param goodsNum
     */
    public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId) {
    public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId, Integer status) {
        Order order = new Order();
        order.setOrderId(IdUtils.simpleUUID());
        order.setDelFlag(0);
        order.setOrderStatus(3);
        order.setOrderStatus(status);
        order.setOrderNo(CodeFactoryUtil.getShopOrderNo());
        order.setOrderFrom(4);
        order.setShopId(shopId);