From 6058af744bdf4fe6a3856c46fe31cfb4dbd8e255 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 29 七月 2025 11:54:01 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 40 insertions(+), 9 deletions(-) diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java index 35256f3..d18f9d1 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java +++ b/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); @@ -3967,6 +3994,8 @@ MgtOrderTotal mgtOrderTotalFirst = orderMapper.totalOrderFirst(mgtShopOrderPageDto); MgtOrderTotal mgtOrderTotalSecond = orderMapper.totalOrderSecond(mgtShopOrderPageDto); MgtOrderTotal mgtOrderTotalThird = orderMapper.totalOrderThird(mgtShopOrderPageDto); + MgtOrderTotal mgtOrderTotalFour = orderMapper.totalOrderFour(mgtShopOrderPageDto); + mgtOrderTotal.setOrderTotal(mgtOrderTotalFirst.getOrderTotal()); mgtOrderTotal.setOrderMoneyTotal(mgtOrderTotalFirst.getOrderMoneyTotal()); mgtOrderTotal.setShopOrderTotal(mgtOrderTotalSecond.getShopOrderTotal()); @@ -4363,7 +4392,7 @@ */ private List<MgtMapBigTotalVo> bigListRemoveNull(List<MgtMapBigTotalVo> MgtMapIntTotalVos) { for (int i = 0; i < MgtMapIntTotalVos.size(); i++) { - if (StringUtils.isBlank(MgtMapIntTotalVos.get(i).getMapKey())) { + if(MgtMapIntTotalVos.get(i).getMapKey().isEmpty()){ MgtMapIntTotalVos.remove(i); } } @@ -4968,6 +4997,8 @@ orderFromList.add(kauishou); orderFromList.add(meituan); orderFromList = bigListRemoveNull(orderFromList); + + //排行 List<MgtMapBigTotalVo> sortedList = orderFromList.stream() // 按 mapValue 降序排序,处理 null 值(若 mapValue 可能为 null) -- Gitblit v1.7.1