xuhy
2025-01-15 d5bf846770b001cac64ca27a3fe2886a9c5076b3
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -11,6 +11,7 @@
import com.ruoyi.account.api.vo.PaymentUserCoupon;
import com.ruoyi.account.api.vo.PaymentUserCouponVo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.mapper.ShoppingCartMapper;
@@ -190,7 +191,7 @@
      info.setVip(appUser.getVipId());
      GoodsSeckill goodsSeckill = seckillActivityInfoClient.getSeckillActivityInfo(info).getData();
      //没有秒杀活动或者添加的普通商品则不使用秒杀活动价格
      if((null == goodsSeckill || (null != goodsSeckill.getCashPayment() && null != goodsSeckill.getPointPayment())) || type == 1){
      if((null == goodsSeckill || (null == goodsSeckill.getCashPayment() && null == goodsSeckill.getPointPayment())) || type == 1){
         //没有秒杀价,则判断门店特价
         GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice();
         goodsBargainPrice.setGoodsId(goodsId);
@@ -329,6 +330,11 @@
   @Override
   public Long addGoods(ShoppingCart shoppingCart) {
      Long userid = tokenService.getLoginUserApplet().getUserid();
      Integer goodsSaleNum = orderService.getGoodsSaleNum(shoppingCart.getGoodsId(), null, userid);
      Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData();
      if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && (goodsSaleNum + shoppingCart.getNumber()) > goods.getPurchaseLimit()){
         throw new ServiceException("超出购买数量限制");
      }
      ShoppingCart one = this.getOne(new LambdaQueryWrapper<ShoppingCart>().eq(ShoppingCart::getAppUserId, userid)
            .eq(ShoppingCart::getGoodsId, shoppingCart.getGoodsId()).eq(ShoppingCart::getType, shoppingCart.getType()).eq(ShoppingCart::getStatus, 1));
      if(null != one){