Browse Source

立即购买不走购物车

chao 3 năm trước cách đây
mục cha
commit
20d190606a

+ 1 - 1
src/main/java/com/caimei365/order/controller/OrderSubmitApi.java

@@ -36,7 +36,7 @@ public class OrderSubmitApi {
      *                  "unionId":"",               //微信unionId
      *                  "addressId": 2732,          //地址ID
      *                  "orderSource": 2,           //订单来源:1WWW、2CRM、4客服[适用后台下单]、5外单[适用后台下单]、6小程序[采美,星范]、7呵呵商城小程序、8维沙小程序
-     *                  "cartType":3,               //购买类型:(1自主下单, 3协销下单)
+     *                  "cartType":3,               //购买类型:(1自主下单(购物车),2自主下单(立即购买),3协销下单)
      *                  "serviceProviderId": 1378,  //协销ID(小程序忽略)
      *                  "clubCouponId": ""          //优惠券Id
      *                  "orderInfo": [              //【订单商品】

+ 2 - 2
src/main/java/com/caimei365/order/mapper/BaseMapper.java

@@ -72,10 +72,10 @@ public interface BaseMapper {
      */
     List<CartItemVo> getPromotionGifts(Integer promotionsId);
     /**
-     * 获取赠品供应商
+     * 根据商品Id获取供应商
      * @param productId 商品Id
      */
-    CartShopVo getPromotionGiftsShop(Integer productId);
+    CartShopVo getShopByProductId(Integer productId);
     /**
      * 发票信息
      * @param userId 用户Id

+ 5 - 0
src/main/java/com/caimei365/order/mapper/CartClubMapper.java

@@ -80,4 +80,9 @@ public interface CartClubMapper {
      * 获取用户发票信息
      */
     InvoiceVo getUserInvoice(Integer userId);
+    /**
+     * 根据商品Id获取下单商品信息
+     * @param productId 商品Id
+     */
+    CartItemVo getCartItemByProductId(Integer productId);
 }

+ 0 - 5
src/main/java/com/caimei365/order/mapper/CartSellerMapper.java

@@ -70,11 +70,6 @@ public interface CartSellerMapper {
      * @param productIds         商品Id集合
      */
     void deleteSellerCartByProductIds(@Param("serviceProviderId") Integer serviceProviderId,@Param("clubId") Integer clubId, @Param("productIds") List<String> productIds);
-    /**
-     * 根据商品Id获取供应商
-     * @param productId      商品Id
-     */
-    CartShopVo getShopByProductId(Integer productId);
     /**
      * 根据商品Ids获取购物车供应商列表
      * @param serviceProviderId  协销Id

+ 1 - 1
src/main/java/com/caimei365/order/model/bo/OrderParamBo.java

@@ -86,7 +86,7 @@ public class OrderParamBo implements Serializable {
      */
     private JSONArray orderInfo;
     /**
-     * 购买类型:(1自主下单, 3协销下单)
+     * 购买类型:(1自主下单(购物车),2自主下单(立即购买),3协销下单)
      */
     private Integer cartType;
     /**

+ 2 - 2
src/main/java/com/caimei365/order/model/dto/SubmitDto.java

@@ -35,9 +35,9 @@ public class SubmitDto implements Serializable {
     @ApiModelProperty("订单来源:1WWW、2CRM、4客服[适用后台下单]、5外单[适用后台下单]、6小程序[采美,星范]、7呵呵商城小程序、8维沙小程序")
     private Integer orderSource;
     /**
-     * 购买类型:(1自主下单, 3协销下单)
+     * 购买类型:(1自主下单(购物车),2自主下单(立即购买),3协销下单)
      */
-    @ApiModelProperty("购买类型:(1自主下单, 3协销下单)")
+    @ApiModelProperty("购买类型:(1自主下单(购物车),2自主下单(立即购买),3协销下单)")
     private Integer cartType;
     /**
      * 协销Id

+ 217 - 59
src/main/java/com/caimei365/order/service/impl/CartClubServiceImpl.java

@@ -809,7 +809,7 @@ public class CartClubServiceImpl implements CartClubService {
                         });
                     } else {
                         // 获取赠品供应商
-                        CartShopVo giftShop = baseMapper.getPromotionGiftsShop(gift.getProductId());
+                        CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
                         shopIds.add(giftShop.getShopId());
                         giftShop.setCartList(new ArrayList<>());
                         giftShop.getCartList().add(gift);
@@ -825,7 +825,221 @@ public class CartClubServiceImpl implements CartClubService {
         Double availableMoney = baseMapper.getAbleUserMoney(userId);
         // 可用采美豆
         Integer userBeans = baseMapper.getUserBeans(userId);
+        // 用户可用优惠券(总)
+        List<CouponVo> couponList = getUserCartCoupons(totalProductList, source, userId);
 
+        // 包装返回数据
+        Map<String, Object> resultData = new HashMap<>();
+        resultData.put("list", shopList);
+        resultData.put("kindCount", kindCount);
+        resultData.put("totalCount", totalCount);
+        resultData.put("totalPrice", totalPrice);
+        resultData.put("reducedPrice", reducedPrice);
+        resultData.put("totalOriginalPrice", totalOriginalPrice);
+        resultData.put("promotions", totalPromotions);
+        resultData.put("invoice", invoice);
+        resultData.put("userMoney", availableMoney);
+        resultData.put("userBeans", userBeans);
+        resultData.put("includeRecharge", includeRecharge);
+        resultData.put("couponList", couponList);
+        return ResponseJson.success(resultData);
+    }
+
+    /**
+     * 立即购买
+     *
+     * @param cartDto {
+     *                userId       用户ID
+     *                productId    商品id
+     *                productCount 商品数量
+     *                source       来源 : 1 网站 ; 2 小程序
+     *                }
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> buyNowProduct(CartDto cartDto) {
+        log.info("¥¥¥¥¥¥¥¥¥¥ > 立即购买");
+        // 供应商信息
+        CartShopVo shop = baseMapper.getShopByProductId(cartDto.getProductId());
+        if (null == shop) {
+            return ResponseJson.error("商品供应商异常!", null);
+        }
+        CartItemVo cartItemVo = cartClubMapper.getCartItemByProductId(cartDto.getProductId());
+        if (null == cartItemVo) {
+            return ResponseJson.error("商品数据异常!", null);
+        }
+        // 用户身份
+        Integer userIdentity = baseMapper.getIdentityByUserId(cartDto.getUserId());
+        // 价格不可见商品
+        if (!(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && userIdentity == 2))) {
+            return ResponseJson.error("商品价格不可见!", null);
+        }
+        cartItemVo.setNumber(cartDto.getProductCount());
+        // 库存不足商品
+        if(!(cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())){
+            return ResponseJson.error("商品库存不足!", null);
+        }
+        // 设置商品图片及税费
+        boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
+        // 促销活动(总)
+        List<PromotionsVo> totalPromotions = new ArrayList<>();
+        // 统计商品总金额
+        final Double[] totalPrice = {MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice()).doubleValue()};
+        // 统计总促销满减
+        final Double[] reducedPrice = {0d};
+        // 供应商促销优惠活动
+        PromotionsVo shopPromotion = baseMapper.getPromotionByShopId(shop.getShopId());
+        // 获取商品促销信息
+        PromotionsVo productPromotions = null;
+        // 没有店铺促销时,商品促销才有效
+        if (null == shopPromotion) {
+            // 获取商品促销信息
+            productPromotions = baseMapper.getPromotionByProductId(cartItemVo.getProductId());
+            /*
+             * 设置商品促销优惠
+             */
+            if (null != productPromotions) {
+                // 当前促销活动的价格计算列表
+                List<PromotionPriceVo> promotionPriceList = productService.getPromotionProducts(productPromotions, cartItemVo, taxFlag);
+                // 更新到总促销列表
+                if (productPromotions.getMode() == 3) {
+                    // 获取赠品
+                    List<CartItemVo> giftList = baseMapper.getPromotionGifts(productPromotions.getId());
+                    productPromotions.setGiftList(giftList);
+                }
+                productPromotions.setProductList(promotionPriceList);
+                // 添加到总促销
+                totalPromotions.add(productPromotions);
+                //单品满减-计算供应商总价/满减金额
+                if (productPromotions.getType() == 1 && productPromotions.getMode() == 2) {
+                    BigDecimal totalAmount = MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice());
+                    if (MathUtil.compare(totalAmount, productPromotions.getTouchPrice()) > -1) {
+                        // 如果满足促销条件,设置供应商价格-满减金额,满减总额 + 当前促销满减金额
+                        totalPrice[0] = MathUtil.sub(totalPrice[0], productPromotions.getReducedPrice()).doubleValue();
+                        reducedPrice[0] = MathUtil.add(reducedPrice[0], productPromotions.getReducedPrice()).doubleValue();
+                    }
+                }
+                cartItemVo.setPromotions(productPromotions);
+            }
+        }
+        if (null != productPromotions || null != shopPromotion) {
+            // 商品处于活动状态
+            cartItemVo.setActStatus(1);
+            // 关闭阶梯价格,活动优先
+            cartItemVo.setLadderFlag(0);
+        } else {
+            if (cartItemVo.getLadderFlag() == 1) {
+                // 设置阶梯价
+                productService.setCartLadderPrices(cartItemVo, taxFlag);
+            } else {
+                // 复购价
+                Double repurchase = baseMapper.getRepurchasePrice(cartItemVo.getProductId(), cartDto.getUserId());
+                if (null != repurchase && repurchase > 0) {
+                    cartItemVo.setPrice(repurchase);
+                }
+            }
+        }
+        // 店铺促销
+        if (null != shopPromotion) {
+            shop.setPromotions(shopPromotion);
+            // 店铺满赠
+            if (shopPromotion.getMode() == 3) {
+                // 获取赠品
+                List<CartItemVo> giftList = baseMapper.getPromotionGifts(shopPromotion.getId());
+                shopPromotion.setGiftList(giftList);
+            }
+            // 设置该优惠下的商品列表
+            List<PromotionPriceVo> promotionPriceList = new ArrayList<>();
+            PromotionPriceVo promotionPrice = new PromotionPriceVo();
+            promotionPrice.setProductId(cartItemVo.getProductId());
+            promotionPrice.setNumber(cartItemVo.getNumber());
+            promotionPrice.setPrice(cartItemVo.getPrice());
+            promotionPriceList.add(promotionPrice);
+            shopPromotion.setProductList(promotionPriceList);
+            // 添加到总促销
+            totalPromotions.add(shopPromotion);
+            // 店铺满减-计算供应商总价/满减金额
+            if (shopPromotion.getMode() == 2 && MathUtil.compare(totalPrice[0], shopPromotion.getTouchPrice()) > -1) {
+                // 该供应商总价 - 满减金额
+                totalPrice[0] = MathUtil.sub(totalPrice[0], shopPromotion.getReducedPrice()).doubleValue();
+                // 该供应商优惠总额 + 满减金额
+                reducedPrice[0] = MathUtil.add(reducedPrice[0], shopPromotion.getReducedPrice()).doubleValue();
+            }
+        }
+        // 供应商商品
+        List<CartItemVo> cartList = new ArrayList<>(1);
+        cartList.add(cartItemVo);
+        shop.setCartList(cartList);
+        shop.setCount(1);
+        // 供应商总价
+        shop.setTotalPrice(totalPrice[0]);
+        // 供应商总优惠
+        shop.setReducedPrice(reducedPrice[0]);
+        // 供应商划线价
+        shop.setOriginalPrice(MathUtil.add(totalPrice[0], reducedPrice[0]).doubleValue());
+        List<CartShopVo> shopList = new ArrayList<>();
+        shopList.add(shop);
+        // 总促销计算
+        totalPromotions.forEach(promotions -> {
+            // 该促销内商品总价
+            double touchPrice = promotions.getProductList().stream().mapToDouble(product -> product.getNumber() * product.getPrice()).sum();
+            // 凑单满减
+            if (promotions.getType() == 2 && promotions.getMode() == 2) {
+                if (MathUtil.compare(touchPrice, promotions.getTouchPrice()) > -1) {
+                    // 总价 - 满减金额
+                    totalPrice[0] = MathUtil.sub(totalPrice[0], promotions.getReducedPrice()).doubleValue();
+                    // 优惠总额 + 满减金额
+                    reducedPrice[0] = MathUtil.add(reducedPrice[0], promotions.getReducedPrice()).doubleValue();
+                }
+            } else if (promotions.getMode() == 3) {
+                // 全部满赠
+                promotions.getGiftList().forEach(gift -> {
+                    if (shop.getShopId().equals(gift.getShopId())) {
+                        // 赠品在当前订单内的供应商下
+                        if (shop.getShopId().equals(gift.getShopId())) {
+                            shop.getCartList().add(gift);
+                        }
+                    } else {
+                        // 获取赠品供应商
+                        CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
+                        giftShop.setCartList(new ArrayList<>());
+                        giftShop.getCartList().add(gift);
+                        shopList.add(giftShop);
+                    }
+                });
+            }
+        });
+        // 是否充值商品
+        boolean includeRecharge = false;
+        boolean recharge = productService.isRechargeProduct(cartDto.getProductId());
+        if (recharge) {
+            includeRecharge = true;
+        }
+        // 发票信息
+        InvoiceVo invoice = baseMapper.getUserInvoice(cartDto.getUserId());
+        // 可用余额
+        Double availableMoney = baseMapper.getAbleUserMoney(cartDto.getUserId());
+        // 可用采美豆
+        Integer userBeans = baseMapper.getUserBeans(cartDto.getUserId());
+        // 获取用户可用优惠券
+        List<CouponVo> couponList = getUserCartCoupons(cartList, cartDto.getSource(), cartDto.getUserId());
+        // 包装返回数据
+        Map<String, Object> resultData = new HashMap<>();
+        resultData.put("list", shopList);
+        resultData.put("kindCount", 1);
+        resultData.put("totalCount", cartDto.getProductCount());
+        resultData.put("totalPrice", totalPrice[0]);
+        resultData.put("reducedPrice", reducedPrice[0]);
+        resultData.put("totalOriginalPrice", shop.getOriginalPrice());
+        resultData.put("invoice", invoice);
+        resultData.put("userMoney", availableMoney);
+        resultData.put("userBeans", userBeans);
+        resultData.put("includeRecharge", includeRecharge);
+        resultData.put("promotions", totalPromotions);
+        resultData.put("couponList", couponList);
+        return ResponseJson.success(resultData);
+    }
+
+    private List<CouponVo> getUserCartCoupons(List<CartItemVo> cartList, Integer source, Integer userId) {
         // 用户可用优惠券(总)
         List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
         Iterator<CouponVo> iterator = couponList.iterator();
@@ -833,7 +1047,7 @@ public class CartClubServiceImpl implements CartClubService {
             CouponVo coupon = iterator.next();
             BigDecimal totalAmount = BigDecimal.ZERO;
             Integer couponType = coupon.getCouponType();
-            for (CartItemVo item : totalProductList) {
+            for (CartItemVo item : cartList) {
                 if (couponType == 0) {
                     if (coupon.getProductType() == 1) {
                         //活动券-全商城商品
@@ -877,63 +1091,7 @@ public class CartClubServiceImpl implements CartClubService {
             }
         }
         couponList.sort((o1, o2) -> o2.getCouponAmount().compareTo(o1.getCouponAmount()));
-
-        // 包装返回数据
-        Map<String, Object> resultData = new HashMap<>();
-        resultData.put("list", shopList);
-        resultData.put("kindCount", kindCount);
-        resultData.put("totalCount", totalCount);
-        resultData.put("totalPrice", totalPrice);
-        resultData.put("reducedPrice", reducedPrice);
-        resultData.put("totalOriginalPrice", totalOriginalPrice);
-        resultData.put("promotions", totalPromotions);
-        resultData.put("invoice", invoice);
-        resultData.put("userMoney", availableMoney);
-        resultData.put("userBeans", userBeans);
-        resultData.put("includeRecharge", includeRecharge);
-        resultData.put("couponList", couponList);
-        return ResponseJson.success(resultData);
-    }
-
-    /**
-     * 立即购买
-     *
-     * @param cartDto {
-     *                userId       用户ID
-     *                productId    商品id
-     *                productCount 商品数量
-     *                source       来源 : 1 网站 ; 2 小程序
-     *                }
-     */
-    @Override
-    public ResponseJson<Map<String, Object>> buyNowProduct(CartDto cartDto) {
-        CartPo cart = cartClubMapper.getCartPo(cartDto);
-        if (cart != null) {
-            // 购物车已存在该商品,更新数量
-            cart.setProductCount(cartDto.getProductCount());
-            cart.setAddTime(new Date());
-            cartClubMapper.updateCart(cart);
-        } else {
-            // 添加新购物车
-            cart = new CartPo();
-            cart.setUserId(cartDto.getUserId());
-            cart.setProductId(cartDto.getProductId());
-            cart.setProductCount(cartDto.getProductCount());
-            Integer shopId = baseMapper.getShopIdByproductId(cartDto.getProductId());
-            cart.setShopId(shopId);
-            //判断是否是再次购买
-            Double repurchase = baseMapper.getRepurchasePrice(cartDto.getProductId(), cartDto.getUserId());
-            if (null != repurchase && repurchase > 0) {
-                // 再次购买
-                cart.setReBuyFlag(1);
-            } else {
-                cart.setReBuyFlag(0);
-            }
-            cart.setAddTime(new Date());
-            cartClubMapper.insertCart(cart);
-        }
-        // 结算商品
-        return settlementShoppingCart(cartDto.getUserId(), cartDto.getProductId().toString(), cartDto.getSource());
+        return couponList;
     }
 
     /**

+ 2 - 2
src/main/java/com/caimei365/order/service/impl/CartSellerServiceImpl.java

@@ -558,7 +558,7 @@ public class CartSellerServiceImpl implements CartSellerService {
                         });
                     } else {
                         // 获取赠品供应商
-                        CartShopVo giftShop = baseMapper.getPromotionGiftsShop(gift.getProductId());
+                        CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
                         shopIds.add(giftShop.getShopId());
                         giftShop.setCartList(new ArrayList<>());
                         giftShop.getCartList().add(gift);
@@ -659,7 +659,7 @@ public class CartSellerServiceImpl implements CartSellerService {
         // 统计商品总金额
         Double totalPrice = 0d;
         // 供应商信息
-        CartShopVo shop = cartSellerMapper.getShopByProductId(productId);
+        CartShopVo shop = baseMapper.getShopByProductId(productId);
         if (null != shop) {
             CartItemVo second = cartSellerMapper.getSecondByProductId(productId);
             second.setActStatus(0);

+ 12 - 10
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -67,7 +67,7 @@ public class SubmitServiceImpl implements SubmitService {
      *                  "unionId":"",               //微信unionId
      *                  "addressId": 2732,          //地址ID
      *                  "orderSource": 2,           //订单来源:1WWW、2CRM、4客服[适用后台下单]、5外单[适用后台下单]、6小程序[采美,星范]、7呵呵商城小程序、8维沙小程序
-     *                  "cartType":3,               //购买类型:(1自主下单, 3协销下单)
+     *                  "cartType":3,               //购买类型:(1自主下单(购物车),2自主下单(立即购买),3协销下单)
      *                  "serviceProviderId": 1378,  //协销ID(小程序忽略)
      *                  "clubCouponId": ""          //优惠券Id
      *                  "orderInfo": [              //【订单商品】
@@ -139,8 +139,10 @@ public class SubmitServiceImpl implements SubmitService {
         // 打印参数
         if (3 == submitDto.getCartType()){
             log.info("******************** 【协销订单】提交订单参数:"+ submitDto);
+        } else if (2 == submitDto.getCartType()) {
+            log.info("******************** 【自主订单】立即购买提交订单参数:"+ submitDto);
         } else {
-            log.info("******************** 【自主订单】提交订单参数:"+ submitDto);
+            log.info("******************** 【自主订单】购物车提交订单参数:"+ submitDto);
         }
         // 机构用户
         OrderParamBo orderParamBo = submitMapper.getOrderUserBoById(clubUserId);
@@ -193,11 +195,11 @@ public class SubmitServiceImpl implements SubmitService {
         if (1== invoiceType || 2 == invoiceType) {
             InvoicePo invoice = new InvoicePo();
             String invoiceTitle = (String) orderInvoice.get("invoiceTitle");
-            if (StringUtils.isNotEmpty(invoiceTitle)){
+            if (StringUtils.isEmpty(invoiceTitle)){
                 return ResponseJson.error("发票抬头信息不正确!", null);
             }
             String corporationTaxNum = (String) orderInvoice.get("corporationTaxNum");
-            if (StringUtils.isNotEmpty(corporationTaxNum)){
+            if (StringUtils.isEmpty(corporationTaxNum)){
                 return ResponseJson.error("纳税人识别号信息不正确!", null);
             }
             invoice.setType(invoiceType);
@@ -207,7 +209,7 @@ public class SubmitServiceImpl implements SubmitService {
                 // 普通发票:发票类型、发票内容(商品明细)、抬头(公司名称)、纳税人识别号[普通发票的公司]
                 String invoiceContent = (String) orderInvoice.get("invoiceContent");
                 Integer invoiceTitleType = (Integer) orderInvoice.get("invoiceTitleType");
-                if (StringUtils.isNotEmpty(invoiceContent) || null == invoiceTitleType) {
+                if (StringUtils.isEmpty(invoiceContent) || null == invoiceTitleType) {
                     return ResponseJson.error("发票信息不完整!", null);
                 }
                 invoice.setInvoiceContent(invoiceContent);
@@ -219,7 +221,7 @@ public class SubmitServiceImpl implements SubmitService {
                 String registeredPhone = (String) orderInvoice.get("registeredPhone");
                 String openBank = (String) orderInvoice.get("openBank");
                 String bankAccountNo = (String) orderInvoice.get("bankAccountNo");
-                if (StringUtils.isNotEmpty(registeredAddress) || StringUtils.isNotEmpty(registeredPhone) || StringUtils.isNotEmpty(openBank) || StringUtils.isNotEmpty(bankAccountNo)) {
+                if (StringUtils.isEmpty(registeredAddress) || StringUtils.isEmpty(registeredPhone) || StringUtils.isEmpty(openBank) || StringUtils.isEmpty(bankAccountNo)) {
                     return ResponseJson.error("发票信息不完整!", null);
                 }
                 invoice.setRegisteredAddress(registeredAddress);
@@ -235,11 +237,11 @@ public class SubmitServiceImpl implements SubmitService {
         // 售后条款id
         Integer clauseId = (Integer) payInfo.get("clauseId");
         orderParamBo.setClauseId(clauseId);
-        // 购买类型:(1自主下单, 3协销下单)
+        // 购买类型:(1自主下单,2直接购买 3协销下单)
         orderParamBo.setCartType(submitDto.getCartType());
         // 下单人
         Integer buyUserId = null;
-        if (1 == submitDto.getCartType()){
+        if (1 == submitDto.getCartType() || 2 == submitDto.getCartType()){
             // 自主下单
             buyUserId = clubUserId;
             if (StringUtils.isNotEmpty(submitDto.getUnionId())) {
@@ -1182,7 +1184,7 @@ public class SubmitServiceImpl implements SubmitService {
              * 更新用户增值税发票
              */
             InvoiceVo userInvoice = baseMapper.getUserInvoice(mainOrder.getUserId());
-            if (null != userInvoice.getId()) {
+            if (null != userInvoice && null != userInvoice.getId()) {
                 // 更新
                 BeanUtils.copyProperties(orderInvoice, userInvoice);
                 baseMapper.updateUserInvoiceByUserId(userInvoice);
@@ -1237,7 +1239,7 @@ public class SubmitServiceImpl implements SubmitService {
             // 清理当前机构的协销购物车数据
             cartSellerMapper.deleteSellerCartByProductIds(orderParamBo.getServiceProviderId(), orderParamBo.getClubId(), productIdList);
             log.info("【提交订单】>>>>删除当前机构的 协销 购物车数据!");
-        } else {
+        } else if (1 == orderParamBo.getCartType()) {
             // 清理用户购物车
             cartClubMapper.deleteCartByProductIds(orderParamBo.getUserId(), productIdList);
             log.info("【提交订单】>>>>删除当前机构 用户 购物车数据!");

+ 1 - 1
src/main/resources/mapper/BaseMapper.xml

@@ -122,7 +122,7 @@
         WHERE cpg.promotionsId = #{promotionsId}
         ORDER BY cpg.id DESC
     </select>
-    <select id="getPromotionGiftsShop" resultType="com.caimei365.order.model.vo.CartShopVo">
+    <select id="getShopByProductId" resultType="com.caimei365.order.model.vo.CartShopVo">
         SELECT
         s.shopID AS shopId,
         s.name AS shopName,

+ 23 - 0
src/main/resources/mapper/CartClubMapper.xml

@@ -170,4 +170,27 @@
         WHERE userId = #{userId}
         order by id desc limit 1
     </select>
+    <select id="getCartItemByProductId" resultType="com.caimei365.order.model.vo.CartItemVo">
+        SELECT
+        p.productID AS productId,
+        p.shopID AS shopId,
+        p.`name` AS `name`,
+        p.mainImage AS image,
+        p.productCode,
+        p.price1 AS price,
+        p.price1 AS originalPrice,
+        p.unit AS unit,
+        p.stock AS stock,
+        p.step AS step,
+        p.minBuyNumber AS min,
+        p.price1TextFlag AS priceFlag,
+        p.ladderPriceFlag AS ladderFlag,
+        p.includedTax AS includedTax,
+        p.invoiceType AS invoiceType,
+        p.taxPoint AS taxRate,
+        p.productCategory,
+        p.validFlag AS validFlag
+        FROM product p
+        WHERE p.validFlag='2' AND p.productID = #{productId}
+    </select>
 </mapper>

+ 0 - 10
src/main/resources/mapper/CartSellerMapper.xml

@@ -81,16 +81,6 @@
             #{productId}
         </foreach>
     </delete>
-    <select id="getShopByProductId" resultType="com.caimei365.order.model.vo.CartShopVo">
-        SELECT
-            p.shopID AS shopId,
-            s.name AS shopName,
-            s.logo AS shopLogo
-        FROM product p
-        LEFT JOIN shop s ON s.shopID = p.shopID
-        WHERE p.productID = #{productId}
-        LIMIT 1
-    </select>
     <select id="getCartShopsByProductIds" resultType="com.caimei365.order.model.vo.CartShopVo">
         SELECT DISTINCT
             c.shopId,