luodangjia
2024-12-16 a8d2cb07f6440dc54dc4005b0b06d5a47cb1517d
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -470,8 +470,8 @@
            //使用商品的基础价格
            price.setCash(1 == goods.getCashPayment() ? goods.getSellingPrice() : null);
            price.setPoint(1 == goods.getPointPayment() ? goods.getIntegral() : null);
            price.setCashPayment(goods.getCashPayment() == 1 ? true : false);
            price.setPointPayment(goods.getPointPayment() == 1 ? true : false);
            price.setCashPayment(goods.getCashPayment() == 1);
            price.setPointPayment(goods.getPointPayment() == 1);
         }
         vo.setCash(price.getCash());
         vo.setPoint(price.getPoint());
@@ -484,7 +484,7 @@
         goodsShop.setGoodsId(shoppingCart.getGoodsId());
         goodsShop.setShopId(shopId);
         GoodsShop goodsShop1 = goodsShopClient.getGoodsShop(goodsShop).getData();
         vo.setVerifiable(goods.getAppointStore() == 1 && null == goodsShop1 ? false : true);
         vo.setVerifiable(goods.getAppointStore() != 1 || null != goodsShop1);
         //判断当前数量是否已经超出限购数量(需要计算已经购买的数量)
         if(null == goods.getPurchaseLimit() || -1 == goods.getPurchaseLimit()){
            vo.setPurchaseLimit(false);
@@ -497,7 +497,7 @@
                     .eq(OrderGood::getGoodsId, shoppingCart.getGoodsId()).eq(OrderGood::getDelFlag, 0));
               sum = orderGoodList.stream().mapToInt(OrderGood::getNum).sum();
            }
            vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit() ? true : false);
            vo.setPurchaseLimit((num + sum) > goods.getPurchaseLimit());
         }
         vo.setDistributionMode(goods.getDistributionMode());
         vo.setEarnSpendingPoints(price.getEarnSpendingPoints());
@@ -696,11 +696,11 @@
      OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData();
      BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData();
      //系统活动设置(优惠券和活动能否同时使用)
      boolean useSimultaneously = baseSetting.getContent().equals("1") ? true : false;
      boolean useSimultaneously = baseSetting.getContent().equals("1");
      //满XX才打折,只有现金才能优惠
      //如果使用优惠券,则需要判断是否可以和同时使用,且活动满足使用条件。
      //没有使用优惠券,只需要判断是都满足使用条件
      if(((useSimultaneously && null != shoppingCartPayment.getUserCouponId()) || null == shoppingCartPayment.getUserCouponId()) &&
      if((useSimultaneously || null == shoppingCartPayment.getUserCouponId()) &&
            null != orderActivityInfo && shoppingCartPayment.getPaymentType() != 3 && orderActivityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){
         BigDecimal paymentMoney1 = orderActivityInfo.getDiscount().divide(new BigDecimal(10)).multiply(paymentMoney);
         BigDecimal bigDecimal = paymentMoney.subtract(paymentMoney1).setScale(2, RoundingMode.HALF_EVEN);
@@ -913,6 +913,9 @@
         balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
         //修改订支付状态
         order.setPayStatus(2);
         if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
            order.setOrderStatus(2);
         }
         orderService.updateById(order);
         //删除购物车数据
         this.removeBatchByIds(ids);
@@ -1000,6 +1003,9 @@
               balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord);
               //修改订支付状态
               order.setPayStatus(2);
               if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
                  order.setOrderStatus(2);
               }
               orderService.updateById(order);
               //删除购物车数据
               this.removeBatchByIds(ids);
@@ -1007,6 +1013,9 @@
         }else{
            //修改订支付状态
            order.setPayStatus(2);
            if(goods.getType() == 2 && null == shoppingCartPayment.getUserAddressId()){
               order.setOrderStatus(2);
            }
            orderService.updateById(order);
            //删除购物车数据
            this.removeBatchByIds(ids);
@@ -1036,7 +1045,7 @@
      VipSetting vipSetting3 = vipSettingClient.getVipSetting(3).getData();
      Integer vipLevelUpShopRole = vipSetting3.getVipLevelUpShopRole();
      Integer vipLevelUpShop = vipSetting3.getVipLevelUpShop();
      if(1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){
      if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 3 && shopPoint >= vipLevelUpShop){
         appUser.setVipId(3);
         appUserClient.editAppUserById(appUser);
         //添加等级变化记录
@@ -1054,7 +1063,7 @@
      VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData();
      vipLevelUpShopRole = vipSetting2.getVipLevelUpShopRole();
      vipLevelUpShop = vipSetting2.getVipLevelUpShop();
      if(1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){
      if(null != vipLevelUpShopRole && 1 == vipLevelUpShopRole && appUser.getVipId() < 2 && shopPoint >= vipLevelUpShop){
         appUser.setVipId(2);
         appUserClient.editAppUserById(appUser);
         //添加等级变化记录