From 29c9ada64cee7adf3399e92ee3a62f2b9ed338ed Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 14 一月 2025 10:19:38 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 38 +++++++++++++++++++++++++++++++++++--- 1 files changed, 35 insertions(+), 3 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index d96c6e6..cbc3f2d 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -144,8 +144,31 @@ //查询符合商品类型的商品数据 List<ShoppingCart> list = this.list(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid) .in(ShoppingCart::getGoodsId, goodsIds).eq(ShoppingCart::getStatus, 1)); + //删除过期的秒杀活动商品 + List<ShoppingCart> list1 = new ArrayList<>(); + for (ShoppingCart shoppingCart : list) { + if(shoppingCart.getType() == 2){ + GetSeckillActivityInfo info = new GetSeckillActivityInfo(); + info.setGoodsId(shoppingCart.getGoodsId()); + info.setVip(appUser.getVipId()); + GoodsSeckill data1 = seckillActivityInfoClient.getSeckillActivityInfo(info).getData(); + if(null != data1){ + SeckillActivityInfo seckillActivityInfo = seckillActivityInfoClient.getSeckillActivityInfoById(data1.getSeckillActivityInfoId()).getData(); + if(null != seckillActivityInfo && (seckillActivityInfo.getIsShelves() == 1 && + seckillActivityInfo.getStartTime().isBefore(LocalDateTime.now()) && seckillActivityInfo.getEndTime().isAfter(LocalDateTime.now()))){ + + list1.add(shoppingCart); + continue; + } + } + this.removeById(shoppingCart.getId()); + }else{ + list1.add(shoppingCart); + } + } + //构建返回数据 - List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null); + List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list1, null); return page; } @@ -509,7 +532,7 @@ confirmOrderVo.setDiscountAmount(activityAmount); int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); confirmOrderVo.setEarnPoint(earnPoint); - if(BigDecimal.ZERO.compareTo(paymentMoney) > 0){ + if(null != paymentMoney && BigDecimal.ZERO.compareTo(paymentMoney) > 0){ paymentMoney = BigDecimal.ZERO; } @@ -520,6 +543,7 @@ UserAddress userAddress = userAddressClient.getDefaultUserAddress(userid).getData(); if(null != userAddress){ userAddress.setIdStr(userAddress.getId().toString()); + userAddress.setRecieveAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getRecieveAddress()); confirmOrderVo.setUserAddress(userAddress); } confirmOrderVo.setPaymentType(confirmOrder.getPaymentType()); @@ -971,6 +995,7 @@ order.setDelFlag(0); order.setCreateTime(LocalDateTime.now()); order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); + order.setDistributionMode(shoppingCartPayment.getDistributionMode()); if(2 == shoppingCartPayment.getPaymentType()){ BigDecimal balance = appUser.getBalance(); @@ -1215,6 +1240,7 @@ //构建余额明细变动记录 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); balanceChangeRecord.setAppUserId(appUser.getId()); + balanceChangeRecord.setVipId(appUser.getVipId()); balanceChangeRecord.setOrderId(order.getId()); balanceChangeRecord.setChangeType(5); balanceChangeRecord.setBeforeAmount(balance.add(paymentMoney)); @@ -1338,6 +1364,7 @@ //构建余额明细变动记录 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); balanceChangeRecord.setAppUserId(appUser.getId()); + balanceChangeRecord.setVipId(appUser.getVipId()); balanceChangeRecord.setOrderId(order.getId()); balanceChangeRecord.setChangeType(5); balanceChangeRecord.setBeforeAmount(balance.add(expressFee)); @@ -1472,10 +1499,15 @@ } //删除购物车数据 - Long userid = tokenService.getLoginUserApplet().getUserid(); + Long userid = order.getAppUserId(); List<OrderGood> list = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId())); List<Integer> goodsIds = list.stream().map(OrderGood::getGoodsId).collect(Collectors.toList()); this.remove(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid).in(ShoppingCart::getGoodsId, goodsIds)); + + //商品销量增加 + for (Integer goodsId : goodsIds) { + goodsClient.editGoodsNum(goodsId, 1); + } return R.ok(); } -- Gitblit v1.7.1