Jelajahi Sumber

购物车列表

chao 3 tahun lalu
induk
melakukan
f44505cf41

+ 42 - 0
src/main/java/com/caimei365/order/controller/ShoppingCartApi.java

@@ -0,0 +1,42 @@
+package com.caimei365.order.controller;
+
+import com.caimei365.order.model.ResponseJson;
+import com.caimei365.order.service.CartService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 购物车API
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Api(tags="购物车API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/order/cart")
+public class ShoppingCartApi {
+
+    private final CartService cartService;
+
+    /**
+     * 购物车列表详细数据
+     */
+    @ApiOperation("购物车列表详细数据(旧:/shoppingCart/list)")
+    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @GetMapping("/list")
+    public ResponseJson<Map<String,Object>> getShoppingCartList(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("用户Id不能为空!", null);
+        }
+        return cartService.getShoppingCartList(userId);
+    }
+
+}

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

@@ -0,0 +1,31 @@
+package com.caimei365.order.mapper;
+
+import com.caimei365.order.model.vo.LadderPriceVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/9
+ */
+@Mapper
+public interface BaseMapper {
+    /**
+     * 根据用户Id查询用户身份
+     */
+    Integer getIdentityByUserId(Integer userId);
+    /**
+     * 根据商品ID查询阶梯价列表
+     */
+    List<LadderPriceVo> getLadderPriceList(Integer productId);
+    /**
+     * 根据商品ID和用户ID 查询复购价
+     */
+    Double getRepurchasePrice(@Param("productId") Integer productId, @Param("userId") Integer userId);
+
+}

+ 44 - 0
src/main/java/com/caimei365/order/mapper/CartMapper.java

@@ -0,0 +1,44 @@
+package com.caimei365.order.mapper;
+
+import com.caimei365.order.model.vo.CartItemVo;
+import com.caimei365.order.model.vo.CartShopVo;
+import com.caimei365.order.model.vo.CartPromotionsVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Mapper
+public interface CartMapper {
+    /**
+     * 购物车供应商列表
+     * @param userId 用户Id
+     */
+    List<CartShopVo> getCartShops(Integer userId);
+    /**
+     * 购物车供应商下商品列表
+     * @param shopId 供应商Id
+     * @param userId 用户Id
+     */
+    List<CartItemVo> getCartProductsByShopId(Integer shopId, Integer userId);
+    /**
+     * 购物车供应商促销优惠活动
+     * @param shopId 供应商Id
+     */
+    CartPromotionsVo getPromotionByShopId(Integer shopId);
+    /**
+     * 购物车商品促销优惠活动
+     * @param productId 商品Id
+     */
+    CartPromotionsVo getPromotionByProductId(Integer productId);
+    /**
+     * 购物车商品促销优惠活动赠品列表
+     * @param promotionsId 促销Id
+     */
+    List<CartItemVo> getPromotionGifts(Integer promotionsId);
+}

+ 0 - 51
src/main/java/com/caimei365/order/mapper/PriceMapper.java

@@ -1,51 +0,0 @@
-package com.caimei365.order.mapper;
-
-import com.caimei365.order.model.vo.LadderPriceVo;
-import com.caimei365.order.model.vo.PriceVo;
-import com.caimei365.order.model.vo.TaxVo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * Description
- *
- * @author : Charles
- * @date : 2021/4/9
- */
-@Mapper
-public interface PriceMapper {
-    /**
-     * 根据用户Id查询用户身份
-     */
-    Integer getIdentityByUserId(Integer userId);
-    /**
-     * 根据商品id查找价格
-     */
-    PriceVo getDetailPrice(Integer productId);
-    /**
-     * 根据商品id集合查找 价格列表
-     */
-    List<PriceVo> getListPriceByProductIds(@Param("productIds") List<Integer> productIds);
-    /**
-     * 根据商品ID查询阶梯价列表
-     */
-    List<LadderPriceVo> getLadderPricesByProductId(Integer productId);
-    /**
-     * 获取最低阶梯价(价格最低,阶梯数最大)
-     */
-    LadderPriceVo findLowerLadderPrice(Integer productId);
-    /**
-     * 获取最高阶梯价(价格最高,阶梯数最小)
-     */
-    LadderPriceVo findMaxLadderPrice(Integer productId);
-    /**
-     * 根据商品ID和用户ID 查询复购价
-     */
-    Double getRepurchasePrice(@Param("productId") Integer productId, @Param("userId") Integer userId);
-    /**
-     * 根据商品ID含税和发票信息
-     */
-    TaxVo getTaxByProductId(Integer productId);
-}

+ 106 - 0
src/main/java/com/caimei365/order/model/vo/CartItemVo.java

@@ -0,0 +1,106 @@
+package com.caimei365.order.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 购物车商品列表
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Data
+public class CartItemVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 购物车Id
+     */
+    private Integer id;
+    /**
+     * 购买数量
+     */
+    private Integer number;
+    /**
+     * 购物商品效状态:0有效,1后台删除的,2冻结的,3下架,4售罄 >7库存不足,5价格仅会员可见,6未公开价格
+     */
+    private Integer status;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 主图
+     */
+    private String image;
+    /**
+     * 价格
+     */
+    private Double price;
+    /**
+     * 划线价
+     */
+    private Double originalPrice;
+    /**
+     * 单位/规格
+     */
+    private String unit;
+    /**
+     * 库存
+     */
+    private Integer stock;
+    /**
+     * 起订量
+     */
+    private Integer min;
+    /**
+     * 增量
+     */
+    private Integer step;
+    /**
+     * 价格可见度:0公开价格 1不公开价格 2仅对会员机构公开
+     */
+    private Integer priceFlag;
+    /**
+     * 启用阶梯价格标识:1是,0否
+     */
+    private Integer ladderFlag;
+    /**
+     * 是否含税 0不含税,1含税,2未知
+     */
+    private String includedTax;
+    /**
+     * 机构税率
+     */
+    private Double taxRate;
+    /**
+     * 发票类型(基于是否含税基础) 1增值税票,2普通票, 3不能开票
+     */
+    private String invoiceType;
+    /**
+     * 商品是否处于活动状态 1是 0否
+     */
+    private Integer actStatus;
+    /**
+     * 商品上架状态:0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
+     */
+    private Integer validFlag;
+    /**
+     * 商品促销活动
+     */
+    private CartPromotionsVo promotions;
+    /**
+     * 阶梯价列表
+     */
+    List<LadderPriceVo> ladderPrices;
+
+}

+ 38 - 0
src/main/java/com/caimei365/order/model/vo/CartPromotionPriceVo.java

@@ -0,0 +1,38 @@
+package com.caimei365.order.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Data
+public class CartPromotionPriceVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 促销Id
+     */
+    private Integer promotionsId;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 购买数量
+     */
+    private Integer number;
+    /**
+     * 价格
+     */
+    private Double price;
+    /**
+     * 划线价
+     */
+    private Double originalPrice;
+}

+ 22 - 23
src/main/java/com/caimei365/order/model/vo/PromotionsVo.java → src/main/java/com/caimei365/order/model/vo/CartPromotionsVo.java

@@ -8,14 +8,17 @@ import java.util.Date;
 import java.util.List;
 
 /**
- * 促销活动
+ * Description
  *
  * @author : Charles
- * @date : 2021/4/9
+ * @date : 2021/6/25
  */
 @Data
-public class PromotionsVo implements Serializable {
+public class CartPromotionsVo implements Serializable {
     private static final long serialVersionUID = 1L;
+    /**
+     * 促销id
+     */
     private Integer id;
     /**
      * 促销名称
@@ -41,6 +44,18 @@ public class PromotionsVo implements Serializable {
      * 减免价格
      */
     private Double reducedPrice;
+    /**
+     * 时效:1永久,2区间过期,其它无效
+     */
+    private Integer status;
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 店铺id(店铺促销时供应商ID)
+     */
+    private Integer shopId;
     /**
      * 开始时间
      */
@@ -52,27 +67,11 @@ public class PromotionsVo implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date endTime;
     /**
-     * 时效:1永久,2区间过期,其它无效
-     */
-    private Integer status;
-    /**
-     * 店铺id(店铺促销时供应商ID)
-     */
-    private Integer shopId;
-    /**
-     * 商品id
+     * 该优惠下(该购物车商品)价格列表
      */
-    private Integer productId;
+    private List<CartPromotionPriceVo> productList;
     /**
-     * 主订单id
+     * 该优惠下赠品品
      */
-    private Integer orderId;
-//    /**
-//     * 该优惠下商品
-//     */
-//    private List<ProductItemVo> productList;
-//    /**
-//     * 该优惠下赠品品
-//     */
-//    private List<ProductItemVo> giftList;
+    private List<CartItemVo> giftList;
 }

+ 58 - 0
src/main/java/com/caimei365/order/model/vo/CartShopVo.java

@@ -0,0 +1,58 @@
+package com.caimei365.order.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 购物车供应商列表
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Data
+public class CartShopVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 供应商Logo
+     */
+    private String shopLogo;
+    /**
+     * 总价
+     */
+    private Double totalPrice;
+    /**
+     * 减免价格
+     */
+    private Double reducedPrice;
+    /**
+     * 划线价格
+     */
+    private Double originalPrice;
+    /**
+     * 供应商下商品种类
+     */
+    private Integer count;
+    /**
+     * 商品列表
+     */
+    private List<CartItemVo> cartList;
+
+    /**
+     * 促销活动
+     */
+    private CartPromotionsVo promotions;
+
+
+
+
+}

+ 3 - 4
src/main/java/com/caimei365/order/model/vo/LadderPriceVo.java

@@ -5,14 +5,15 @@ import lombok.Data;
 import java.io.Serializable;
 
 /**
- * 阶梯价格
+ * Description
  *
  * @author : Charles
- * @date : 2021/4/9
+ * @date : 2021/6/28
  */
 @Data
 public class LadderPriceVo implements Serializable {
     private static final long serialVersionUID = 1L;
+
     private Integer id;
     /**
      * 商品id
@@ -38,6 +39,4 @@ public class LadderPriceVo implements Serializable {
      * 显示数量 如:1~3
      */
     private String numRange;
-
 }
-

+ 0 - 101
src/main/java/com/caimei365/order/model/vo/PriceVo.java

@@ -1,101 +0,0 @@
-package com.caimei365.order.model.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-/**
- * 商品价格
- *
- * @author : Charles
- * @date : 2021/4/9
- */
-@Data
-public class PriceVo implements Serializable {
-    private static final long serialVersionUID = 1L;
-    /**
-     * 商品productID
-     */
-    private Integer productId;
-    /**
-     * 供应商ID
-     */
-    private Integer shopId;
-    /**
-     * 价格(计算后)
-     */
-    private Double price;
-    /**
-     * 划线价格
-     */
-    private Double originalPrice;
-    /**
-     * 最小购买量
-     */
-    private Integer minBuyNumber;
-    /**
-     * 最大购买量
-     */
-    private Integer maxBuyNumber;
-    /**
-     * 是否公开机构价 0公开价格 1不公开价格
-     */
-    private Integer priceFlag;
-    /**
-     * 是否复购 0否 1是
-     */
-    private Integer repurchaseFlag;
-    /**
-     * 阶梯价标志
-     */
-    private Integer ladderPriceFlag;
-    /**
-     * 市场价
-     */
-    private Double normalPrice;
-    /**
-     * 成本价
-     */
-    private Double costPrice;
-    /**
-     * 比例成本百分比
-     */
-    private Double costProportional;
-    /**
-     * 成本价选中标志:1固定成本 2比例成
-     */
-    private Integer costCheckFlag;
-    /**
-     * 用户身份: 2-会员机构, 4-普通机构
-     */
-    private Integer userIdentity;
-
-    /**
-     * 购买数量: 1逐步增长,2以起订量增长(起订量的倍数增长)
-     */
-    private Integer step;
-    /**
-     * 商品是否处于活动状态 1是 0否
-     */
-    private Integer actStatus;
-    /**
-     * 促销活动
-     */
-    private PromotionsVo promotions;
-    /**
-     * 机构税率
-     */
-    private BigDecimal taxRate;
-    /**
-     * 是否含税 0不含税,1含税,2未知
-     */
-    private String includedTax;
-
-    /**
-     * 发票类型(基于是否含税基础) 1增值税票,2普通票, 3不能开票
-     */
-    private String invoiceType;
-
-}
-

+ 0 - 28
src/main/java/com/caimei365/order/model/vo/TaxVo.java

@@ -1,28 +0,0 @@
-package com.caimei365.order.model.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * Description
- *
- * @author : Charles
- * @date : 2021/4/9
- */
-@Data
-public class TaxVo implements Serializable {
-    private static final long serialVersionUID = 1L;
-    /**
-     * 发票类型(基于是否含税基础)   1增值税票,2普通票, 3不能开票
-     */
-    private Integer invoiceType;
-    /**
-     * 是否含税   0不含税,1含税,2未知
-     */
-    private Integer includedTax;
-    /**
-     * 开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
-     */
-    private Double taxPoint;
-}

+ 20 - 0
src/main/java/com/caimei365/order/service/CartService.java

@@ -0,0 +1,20 @@
+package com.caimei365.order.service;
+
+import com.caimei365.order.model.ResponseJson;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+public interface CartService {
+
+    /**
+     * 购物车列表详细数据
+     * @param userId 用户Id
+     */
+    ResponseJson<Map<String, Object>> getShoppingCartList(Integer userId);
+}

+ 345 - 0
src/main/java/com/caimei365/order/service/impl/CartServiceImpl.java

@@ -0,0 +1,345 @@
+package com.caimei365.order.service.impl;
+
+import com.caimei365.order.mapper.BaseMapper;
+import com.caimei365.order.mapper.CartMapper;
+import com.caimei365.order.model.ResponseJson;
+import com.caimei365.order.model.vo.*;
+import com.caimei365.order.service.CartService;
+import com.caimei365.order.utils.MathUtil;
+import com.caimei365.order.utils.ProductUtil;
+import com.google.common.util.concurrent.AtomicDouble;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.IntStream;
+
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+@Slf4j
+@Service
+public class CartServiceImpl implements CartService {
+    @Value("${caimei.wwwDomain}")
+    private String domain;
+    @Resource
+    private BaseMapper baseMapper;
+    @Resource
+    private CartMapper cartMapper;
+
+    /**
+     * 购物车列表详细数据
+     *
+     * @param userId 用户Id
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getShoppingCartList(Integer userId) {
+        /*
+         * 初始化返回数据
+         */
+        // 购物车供应商列表
+        List<CartShopVo> shopInfoList = cartMapper.getCartShops(userId);
+        // 失效商品列表
+        List<CartItemVo> invalidList = new ArrayList<>();
+        // 商品总数量
+        AtomicInteger totalCount = new AtomicInteger(0);
+        // 商品种类
+        AtomicInteger kindCount = new AtomicInteger(0);
+        // 统计商品总金额
+        AtomicDouble totalPrice = new AtomicDouble(0);
+        // 统计总促销满减
+        AtomicDouble reducedPrice = new AtomicDouble(0);
+        // 统计总划线价
+        AtomicDouble totalOriginalPrice = new AtomicDouble(0);
+        /*
+         * 处理数据
+         */
+        // 促销活动(总)
+        List<CartPromotionsVo> totalPromotions = new ArrayList<>();
+        List<Integer> promotionsIds = new ArrayList<>();
+        // 用户身份
+        Integer userIdentity = baseMapper.getIdentityByUserId(userId);
+        // 遍历供应商列表
+        shopInfoList.forEach(shop -> {
+            // 该供应商下商品种类
+            AtomicInteger shopKindCount = new AtomicInteger(0);
+            // 该供应商总价
+            AtomicDouble shopPrice = new AtomicDouble(0);
+            // 该供应商满减金额(供应商满减,单品满减)
+            AtomicDouble shopReducedPrice = new AtomicDouble(0);
+            // 供应商促销优惠活动
+            CartPromotionsVo shopPromotion = cartMapper.getPromotionByShopId(shop.getShopId());
+            // 供应商下商品列表
+            List<CartItemVo> productList = cartMapper.getCartProductsByShopId(shop.getShopId(), userId);
+
+            // 迭代器设置商品信息
+            Iterator<CartItemVo> productIterator = productList.iterator();
+            while (productIterator.hasNext()) {
+                CartItemVo cartItemVo = productIterator.next();
+                // 图片路径
+                String image = ProductUtil.getImageUrl("product", cartItemVo.getImage(), domain);
+                cartItemVo.setImage(image);
+                // 是否添加税费,不含税商品 开票需添加税费
+                boolean taxFlag = "0".equals(cartItemVo.getIncludedTax()) && ("1".equals(cartItemVo.getInvoiceType()) || "2".equals(cartItemVo.getInvoiceType()));
+                BigDecimal cartItemTax = MathUtil.div(MathUtil.mul(cartItemVo.getPrice(), cartItemVo.getTaxRate()), 100, 2);
+                cartItemVo.setPrice(MathUtil.add(cartItemVo.getPrice(), cartItemTax).doubleValue());
+                // 已上架商品
+                if (cartItemVo.getValidFlag() == 2) {
+                    // 设置商品有效
+                    cartItemVo.setStatus(0);
+                    // 价格是否可见
+                    boolean priceVisible = (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && userIdentity == 2));
+                    // 是否库存充足
+                    boolean isStocked = (cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber());
+                    if (priceVisible && isStocked) {
+                        // 获取商品促销信息
+                        CartPromotionsVo promotions = null;
+                        // 没有店铺促销时,商品促销才有效
+                        if (null == shopPromotion) {
+                            // 获取商品促销信息
+                            promotions = cartMapper.getPromotionByProductId(cartItemVo.getProductId());
+                            /*
+                             * 设置商品促销优惠
+                             */
+                            if (null != promotions) {
+                                cartItemVo.setPromotions(promotions);
+                                Integer promotionsId = promotions.getId();
+                                List<CartPromotionPriceVo> promotionPriceList = new ArrayList<>();
+                                CartPromotionPriceVo promotionPrice = new CartPromotionPriceVo();
+                                promotionPrice.setProductId(cartItemVo.getProductId());
+                                promotionPrice.setNumber(cartItemVo.getNumber());
+                                if (promotions.getType() == 1 && promotions.getMode() == 1) {
+                                    // 单品优惠价添加税费
+                                    if (taxFlag) {
+                                        BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), cartItemVo.getTaxRate()), BigDecimal.valueOf(100), 2);
+                                        promotions.setTouchPrice(MathUtil.add(promotions.getTouchPrice(), addedValueTax).doubleValue());
+                                    }
+                                    promotionPrice.setPrice(promotions.getTouchPrice());
+                                    promotionPrice.setOriginalPrice(cartItemVo.getOriginalPrice());
+                                    // 设置商品活动价
+                                    cartItemVo.setPrice(promotions.getTouchPrice());
+                                } else {
+                                    // 其他优惠商品添加税费
+                                    if (taxFlag) {
+                                        BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(cartItemVo.getPrice(), cartItemVo.getTaxRate()), 100, 2);
+                                        promotionPrice.setPrice(MathUtil.add(cartItemVo.getPrice(), addedValueTax).doubleValue());
+                                    } else {
+                                        promotionPrice.setPrice(cartItemVo.getPrice());
+                                    }
+                                }
+                                promotionPriceList.add(promotionPrice);
+                                if (promotionsIds.contains(promotionsId)) {
+                                    // 列表已有该促销活动
+                                    totalPromotions.forEach(item -> {
+                                        if (item.getId().equals(promotionsId)) {
+                                            promotionPriceList.addAll(item.getProductList());
+                                            item.setProductList(promotionPriceList);
+                                        }
+                                    });
+                                } else {
+                                    // 新的促销活动
+                                    promotionsIds.add(promotions.getId());
+                                    if (promotions.getMode() == 3) {
+                                        // 获取赠品
+                                        List<CartItemVo> giftList = cartMapper.getPromotionGifts(promotions.getId());
+                                        promotions.setGiftList(giftList);
+                                    }
+                                    promotions.setProductList(promotionPriceList);
+                                    // 添加到总促销
+                                    totalPromotions.add(promotions);
+                                }
+                                //单品满减-计算供应商总价/满减金额
+                                if (promotions.getType() == 1 && promotions.getMode() == 2) {
+                                    BigDecimal totalAmount = MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice());
+                                    if (MathUtil.compare(totalAmount, promotions.getTouchPrice()) > -1) {
+                                        // 如果满足促销条件,设置供应商价格-满减金额,满减总额 + 当前促销满减金额
+                                        shopPrice.set(MathUtil.sub(shopPrice.get(), promotions.getReducedPrice()).doubleValue());
+                                        shopReducedPrice.set(MathUtil.add(shopReducedPrice, promotions.getReducedPrice()).doubleValue());
+                                    }
+                                }
+                            }
+                        }
+                        if (null != promotions || null != shopPromotion) {
+                            // 商品处于活动状态
+                            cartItemVo.setActStatus(1);
+                            // 关闭阶梯价格,活动优先
+                            cartItemVo.setLadderFlag(0);
+                        } else {
+                            /*
+                             * 设置阶梯价
+                             */
+                            if (cartItemVo.getLadderFlag() == 1) {
+                                // 阶梯价
+                                List<LadderPriceVo> ladderPrices = baseMapper.getLadderPriceList(cartItemVo.getProductId());
+                                if (!CollectionUtils.isEmpty(ladderPrices)) {
+                                    IntStream.range(0, ladderPrices.size()).forEach(i -> {
+                                        boolean isThisLadder;
+                                        // 添加税费
+                                        if (taxFlag) {
+                                            BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(ladderPrices.get(i).getBuyPrice(), cartItemVo.getTaxRate()), 100, 2);
+                                            ladderPrices.get(i).setBuyPrice(MathUtil.add(ladderPrices.get(i).getBuyPrice(), addedValueTax).doubleValue());
+                                        }
+                                        if (i == ladderPrices.size() - 1) {
+                                            ladderPrices.get(i).setMaxNum(0);
+                                            ladderPrices.get(i).setNumRange("≥" + ladderPrices.get(i).getBuyNum());
+                                            isThisLadder = (cartItemVo.getNumber() >= ladderPrices.get(i).getBuyNum());
+                                        } else {
+                                            ladderPrices.get(i).setMaxNum(ladderPrices.get(i + 1).getBuyNum());
+                                            String buyNumRangeShow = ladderPrices.get(i).getBuyNum() + "~" + (ladderPrices.get(i + 1).getBuyNum() - 1);
+                                            ladderPrices.get(i).setNumRange(buyNumRangeShow);
+                                            isThisLadder = (cartItemVo.getNumber() >= ladderPrices.get(i).getBuyNum() && cartItemVo.getNumber() <= ladderPrices.get(i).getMaxNum());
+                                        }
+                                        if (isThisLadder) {
+                                            cartItemVo.setPrice(ladderPrices.get(i).getBuyPrice());
+                                            cartItemVo.setOriginalPrice(ladderPrices.get(i).getBuyPrice());
+                                        }
+                                    });
+                                    cartItemVo.setMin(ladderPrices.get(0).getBuyNum());
+                                    cartItemVo.setLadderPrices(ladderPrices);
+                                } else {
+                                    cartItemVo.setLadderFlag(0);
+                                }
+                            } else {
+                                // 复购价
+                                Double repurchase = baseMapper.getRepurchasePrice(cartItemVo.getProductId(), userId);
+                                if (null != repurchase && repurchase > 0) {
+                                    cartItemVo.setPrice(repurchase);
+                                }
+                            }
+                        }
+                        // 该供应商下价格累加
+                        shopPrice.set(MathUtil.add(shopPrice, MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice())).doubleValue());
+                        // 该供应商下商品种类 +1
+                        shopKindCount.incrementAndGet();
+                        // 购物车总数量 + 当前商品购买数量
+                        totalCount.updateAndGet(v -> v + cartItemVo.getNumber());
+                    } else {
+                        // 失效商品
+                        if (cartItemVo.getPriceFlag() == 1) {
+                            // 未公开价格
+                            cartItemVo.setStatus(6);
+                        } else if (cartItemVo.getPriceFlag() == 2 && userIdentity == 4) {
+                            // 价格仅会员可见
+                            cartItemVo.setStatus(5);
+                        } else if (cartItemVo.getStock() == null || cartItemVo.getStock() == 0) {
+                            // 售罄
+                            cartItemVo.setStatus(4);
+                        } else if (cartItemVo.getStock() != null && (cartItemVo.getStock() < cartItemVo.getMin() || cartItemVo.getStock() < cartItemVo.getNumber())) {
+                            // 库存不足
+                            cartItemVo.setStatus(7);
+                        }
+                        invalidList.add(cartItemVo);
+                        productIterator.remove();
+                    }
+                } else {
+                    // 失效商品
+                    if (cartItemVo.getValidFlag() == 0) {
+                        // 后台逻辑删除,已停售
+                        cartItemVo.setStatus(1);
+                        invalidList.add(cartItemVo);
+                    } else if (cartItemVo.getValidFlag() == 10) {
+                        // 已冻结,已丢失
+                        cartItemVo.setStatus(2);
+                        invalidList.add(cartItemVo);
+                    } else if (cartItemVo.getValidFlag() == 3) {
+                        // 已下架
+                        cartItemVo.setStatus(3);
+                        invalidList.add(cartItemVo);
+                    }
+                    //隐身商品validFlag = 9 不加入失效商品,直接去除
+                    productIterator.remove();
+                }
+            }
+            // 店铺促销
+            if (null != shopPromotion) {
+                shop.setPromotions(shopPromotion);
+                if (!promotionsIds.contains(shopPromotion.getId())) {
+                    promotionsIds.add(shopPromotion.getId());
+                    // 店铺满赠
+                    if (shopPromotion.getMode() == 3) {
+                        // 获取赠品
+                        List<CartItemVo> giftList = cartMapper.getPromotionGifts(shopPromotion.getId());
+                        shopPromotion.setGiftList(giftList);
+                    }
+                    // 设置该优惠下的商品列表
+                    List<CartPromotionPriceVo> promotionPriceList = new ArrayList<>();
+                    productList.forEach(item -> {
+                        CartPromotionPriceVo promotionPrice = new CartPromotionPriceVo();
+                        promotionPrice.setProductId(item.getProductId());
+                        promotionPrice.setNumber(item.getNumber());
+                        promotionPrice.setPrice(item.getPrice());
+                        promotionPriceList.add(promotionPrice);
+                    });
+                    shopPromotion.setProductList(promotionPriceList);
+                    // 添加到总促销
+                    totalPromotions.add(shopPromotion);
+                    // 店铺满减-计算供应商总价/满减金额
+                    if (shopPromotion.getMode() == 2) {
+                        if (MathUtil.compare(shopPrice, shopPromotion.getTouchPrice()) > -1) {
+                            // 该供应商总价 - 满减金额
+                            shopPrice.set(MathUtil.sub(shopPrice.get(), shopPromotion.getReducedPrice()).doubleValue());
+                            // 该供应商优惠总额 + 满减金额
+                            shopReducedPrice.set(MathUtil.add(shopReducedPrice.get(), shopPromotion.getReducedPrice()).doubleValue());
+                        }
+                    }
+                }
+            }
+            shop.setCartList(productList);
+            // 供应商总价
+            shop.setTotalPrice(shopPrice.get());
+            // 供应商总优惠
+            shop.setReducedPrice(shopReducedPrice.get());
+            // 供应商划线价
+            shop.setOriginalPrice(MathUtil.add(shopPrice.get(), shopReducedPrice.get()).doubleValue());
+            // 供应商下商品种类
+            shop.setCount(shopKindCount.get());
+            // 计算总价
+            totalPrice.set(MathUtil.add(totalPrice, shop.getTotalPrice()).doubleValue());
+            // 优惠总额
+            reducedPrice.set(MathUtil.add(reducedPrice, shop.getReducedPrice()).doubleValue());
+            // 总划线价
+            totalOriginalPrice.set(MathUtil.add(totalOriginalPrice, shop.getOriginalPrice()).doubleValue());
+            // 商品种类
+            kindCount.updateAndGet(v -> v + shopKindCount.get());
+        });
+        // 删除空数据
+        shopInfoList.removeIf(shop -> (null != shop && shop.getCount() == 0));
+        // 总促销计算
+        totalPromotions.forEach(promotions -> {
+            // 该促销内商品总价
+            double touchPrice = promotions.getProductList().stream().mapToDouble(product -> product.getNumber() * product.getPrice()).sum();
+            if (MathUtil.compare(touchPrice, promotions.getTouchPrice()) > -1) {
+                // 凑单满减
+                if (promotions.getType() == 2 && promotions.getMode() == 2) {
+                    // 总价 - 满减金额
+                    totalPrice.set(MathUtil.sub(totalPrice, promotions.getReducedPrice()).doubleValue());
+                    // 优惠总额 + 满减金额
+                    reducedPrice.set(MathUtil.add(reducedPrice, promotions.getReducedPrice()).doubleValue());
+                }
+            }
+        });
+        /*
+         * 返回结果
+         */
+        Map<String, Object> resultMap = new HashMap<>(8);
+        resultMap.put("list", shopInfoList);
+        resultMap.put("invalid", invalidList);
+        resultMap.put("kindCount", kindCount);
+        resultMap.put("totalCount", totalCount);
+        resultMap.put("totalPrice", totalPrice);
+        resultMap.put("reducedPrice", reducedPrice);
+        resultMap.put("totalOriginalPrice", totalOriginalPrice);
+        resultMap.put("promotions", totalPromotions);
+        // 返回数据
+        return ResponseJson.success(resultMap);
+    }
+}

+ 2 - 0
src/main/java/com/caimei365/order/utils/JwtUtil.java

@@ -35,6 +35,8 @@ public class JwtUtil {
      */
     private static final String TOKEN_SECRET = "zhengchao";
 
+    private JwtUtil(){}
+
     /**
      * 生成签名,6EXPIRE_TIME过期
      */

+ 161 - 0
src/main/java/com/caimei365/order/utils/MathUtil.java

@@ -0,0 +1,161 @@
+package com.caimei365.order.utils;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.math.BigDecimal;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/4/9
+ */
+public class MathUtil {
+    /** 默认小数位 */
+	private static final int DEFAULT_SCALE = 4;
+	/**
+	 *
+	 * 构造函数
+	 */
+	private MathUtil() {}
+
+	/**
+	 * 两个实数相加
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @return BigDecimal
+	 */
+	public static BigDecimal add(Object v1, Object v2) {
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		return b1.add(b2);
+	}
+	/**
+	 * 两个实数相减
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @return BigDecimal
+	 */
+	public static BigDecimal sub(Object v1, Object v2) {
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		return b1.subtract(b2);
+	}
+	/**
+	 * 两个实数相乘
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @return BigDecimal
+	 */
+	public static BigDecimal mul(Object v1, Object v2) {
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		return b1.multiply(b2);
+
+	}
+	/**
+	 * 相个实数相乘并四舍五入到Sacle位
+	 *
+	 * @param v1
+	 * @param v2
+	 * @param scale
+	 * @return
+	 */
+	public static BigDecimal mul(Object v1, Object v2, int scale) {
+		if (scale < 0) {
+			throw new IllegalArgumentException("四舍五入的位数不能为负数");
+		}
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		return b1.multiply(b2).setScale(scale, BigDecimal.ROUND_HALF_UP);
+	}
+	/**
+	 * 两个实数相除,四舍五入到默认位数
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @return BigDecimal
+	 */
+	public static BigDecimal div(Object v1, Object v2) {
+		return div(v1, v2, DEFAULT_SCALE);
+	}
+	/**
+	 * 两个实数相除,默认四舍五入到scale位
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @param scale 小数位
+	 * @return BigDecimal
+	 */
+	public static BigDecimal div(Object v1, Object v2, int scale) {
+		if (scale < 0) {
+			throw new IllegalArgumentException("四舍五入的位数不能为负数");
+		}
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		if (equal0(b2)) {
+			throw new IllegalArgumentException("除数不能为0");
+		}
+		return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP);
+	}
+
+	/**
+	 * 两个实数比较
+	 *
+	 * @param v1 BigDecimal
+	 * @param v2 BigDecimal
+	 * @return int [1:v1>v2, 0:v1=v2, 1:v1<v2]
+	 */
+	public static int compare(Object v1, Object v2) {
+		BigDecimal b1 = convert(v1);
+		BigDecimal b2 = convert(v2);
+		return b1.compareTo(b2);
+	}
+
+	/**
+	 * 类型转换函数
+	 *
+	 * @param o <T>
+	 * @return BigDecimal
+	 */
+	public static BigDecimal convert(Object o) {
+		if (o == null) {
+			return BigDecimal.ZERO;
+		} else if (o instanceof BigDecimal) {
+			return (BigDecimal) o;
+		}
+		String str = o.toString();
+		if (StringUtils.isNotBlank(str)) {
+			return new BigDecimal(str);
+		} else {
+			return BigDecimal.ZERO;
+		}
+	}
+
+	private static boolean equal0(Object v1) {
+		BigDecimal b1 = convert(v1);
+		return b1.compareTo(BigDecimal.ZERO) == 0;
+	}
+
+	/**
+	 * 实数的四舍五入函数
+	 *
+	 * @param v
+	 * @param scale
+	 * @return
+	 */
+	public static BigDecimal round(Object v, int scale) {
+		if (scale < 0) {
+			throw new IllegalArgumentException("四舍五入的位数不能为负数");
+		}
+		BigDecimal b = convert(v);
+		return b.setScale(scale, BigDecimal.ROUND_HALF_UP);
+	}
+
+//	public static void main(String[] args){
+//	}
+
+}

+ 59 - 0
src/main/java/com/caimei365/order/utils/ProductUtil.java

@@ -0,0 +1,59 @@
+package com.caimei365.order.utils;
+
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/6/25
+ */
+public class ProductUtil {
+
+    private ProductUtil(){}
+
+    public static String getImageUrl(String dirName, String src, String domain) {
+        // http -> https处理
+        if (StringUtils.isNotEmpty(domain) && domain.startsWith("http:")){
+            domain = domain.replace("http:", "https:");
+        }
+        // 处理图片链接
+        if (StringUtils.isEmpty(domain)){
+            dirName = "";
+        } else {
+            dirName = dirName.trim();
+        }
+        if (StringUtils.equalsIgnoreCase("null", src)){
+            src = "";
+        } else if (src.indexOf(",") > 0) {
+            src = src.substring(0, src.indexOf(","));
+        }
+        String image;
+        if (StringUtils.isNotEmpty(src)){
+            if (StringUtils.equals(dirName, "product")) {
+                src = src.replace("\\", "/");
+            }
+            if (src.startsWith("/uploadFile")){
+                image = src;
+            } else {
+                image = "/uploadFile/" + dirName + "/" + src;
+            }
+        } else {
+            // 默认图片
+            image = "/img/default/none.jpg";
+            if (StringUtils.equals(dirName, "user")) {
+                image = "/img/default/HeaderImg.png";
+            } else if (StringUtils.equals(dirName, "club")) {
+                image = "/img/default/default_club.jpg";
+            } else if (StringUtils.equals(dirName, "shopLogo")) {
+                image = "/img/default/suppliver.jpg";
+            }else if (StringUtils.equals(dirName, "caiMeiImage")) {
+                image = "/img/default/caiMeiImage.jpg";
+            }
+        }
+        return dirName.trim() + image;
+    }
+
+
+}

+ 26 - 0
src/main/resources/mapper/BaseMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.order.mapper.BaseMapper">
+    <select id="getIdentityByUserId" resultType="java.lang.Integer">
+        select userIdentity from user where userID = #{userId}
+    </select>
+    <select id="getLadderPriceList" resultType="com.caimei365.order.model.vo.LadderPriceVo">
+        select
+        id, productId, ladderNum, buyNum, buyPrice
+        from product_ladder_price
+        where productId = #{productId} and userType = 3 and delFlag = 0
+        order by ladderNum asc
+    </select>
+    <select id="getRepurchasePrice" resultType="java.lang.Double">
+        select
+        r.currentPrice
+        from repeat_purchase_price r
+        left join product p on p.productID = r.productId
+        where r.productId = #{productId} and userId = #{userId}
+        and ((p.costCheckFlag=1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag=2)
+        and p.price1 <![CDATA[ >= ]]> r.currentPrice
+        and r.delFlag = 0
+    </select>
+
+
+</mapper>

+ 99 - 0
src/main/resources/mapper/CartMapper.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.order.mapper.CartMapper">
+    <!-- 购物车供应商列表 -->
+    <select id="getCartShops" resultType="com.caimei365.order.model.vo.CartShopVo">
+        select
+            c.shopID as shopId,
+            s.name as shopName,
+            s.logo as shopLogo
+        from cm_cart c
+        left join shop s on c.shopID = s.shopID
+        where c.userID = #{userId}
+        group by c.shopID
+        order by c.cm_cartID desc
+    </select>
+    <select id="getCartProductsByShopId" resultType="com.caimei365.order.model.vo.CartItemVo">
+        select
+            c.cm_cartID as id,
+            c.productCount as number,
+            p.productID as productId,
+            p.shopID as shopId,
+            p.`name` as `name`,
+            p.mainImage as image,
+            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.validFlag as validFlag
+        from cm_cart c
+        left join product p on c.productID = p.productID
+        where c.userID = #{userId} and p.shopID = #{shopId}
+        order by c.cm_cartID desc
+    </select>
+    <select id="getPromotionByShopId" resultType="com.caimei365.order.model.vo.CartPromotionsVo">
+        select
+            pr.id,
+            pr.name,
+            pr.description,
+            pr.type,
+            pr.mode,
+            pr.touchPrice,
+            pr.reducedPrice,
+            pr.beginTime,
+            pr.endTime,
+            pr.status,
+            prp.productId,
+            prp.supplierId as shopId
+        from cm_promotions pr
+        left join cm_promotions_product prp on pr.id = prp.promotionsId
+        where prp.supplierId = #{shopId} and pr.delFlag=0 and pr.type=3
+        and (pr.status = 1 or ( pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))
+        order by pr.type desc limit 1
+    </select>
+    <select id="getPromotionByProductId" resultType="com.caimei365.order.model.vo.CartPromotionsVo">
+        select
+            pr.id,
+            pr.name,
+            pr.description,
+            pr.type,
+            pr.mode,
+            pr.touchPrice,
+            pr.reducedPrice,
+            pr.beginTime,
+            pr.endTime,
+            pr.status,
+            prp.productId,
+            prp.supplierId as shopId
+        from cm_promotions pr
+        left join cm_promotions_product prp on pr.id = prp.promotionsId
+        where prp.productId = #{productId} and pr.delFlag=0 and pr.type in (1,2)
+        and (pr.status = 1 or ( pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))
+        order by pr.type desc limit 1
+    </select>
+    <select id="getPromotionGifts" resultType="com.caimei365.order.model.vo.CartItemVo">
+        select
+            cpg.id as id,
+            p.productID as productId,
+            p.shopID as shopId,
+            p.`name` as `name`,
+            p.mainImage as image,
+            cpg.number as number,
+            0 as price,
+            p.price1 as originalPrice,
+            p.unit as unit,
+            p.stock as stock,
+            p.validFlag as validFlag
+        from cm_promotions_gift cpg
+        left join from product p on cpg.productId = p.productID
+        where cpg.promotionsId = #{promotionsId}
+        order by cpg.id desc
+    </select>
+</mapper>

+ 0 - 94
src/main/resources/mapper/PriceMapper.xml

@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.caimei365.order.mapper.PriceMapper">
-    <select id="getIdentityByUserId" resultType="java.lang.Integer">
-        select userIdentity from user where userID = #{userId}
-    </select>
-    <select id="getDetailPrice" resultType="com.caimei365.order.model.vo.PriceVo">
-        select
-            p.productID as productId,
-            p.actStatus,
-            p.price1 as price,
-            p.minBuyNumber,
-            p.maxBuyNumber,
-            p.price1TextFlag as priceFlag,
-            p.ladderPriceFlag,
-            p.normalPrice,
-            p.costPrice,
-            p.costProportional,
-            p.costCheckFlag,
-            p.step,
-            p.shopID as shopId,
-            p.taxPoint as taxRate,
-            p.includedTax,
-            p.invoiceType
-        from product p
-        where productID = #{productId}
-    </select>
-    <select id="getListPriceByProductIds" resultType="com.caimei365.order.model.vo.PriceVo">
-        select
-            p.productID as productId,
-            p.actStatus,
-            p.price1 as price,
-            p.minBuyNumber,
-            p.maxBuyNumber,
-            p.price1TextFlag as priceFlag,
-            p.ladderPriceFlag,
-            p.normalPrice,
-            p.costPrice,
-            p.costProportional,
-            p.costCheckFlag,
-            p.step,
-            p.shopID as shopId,
-            p.includedTax,
-            p.invoiceType,
-            p.taxPoint as taxRate
-        from product p
-        where productID in
-          <foreach collection="productIds" open="(" separator="," close=")" item="productId">
-              #{productId}
-          </foreach>
-    </select>
-    <select id="getLadderPricesByProductId" resultType="com.caimei365.order.model.vo.LadderPriceVo">
-        select
-        	id, productId, ladderNum, buyNum, buyPrice
-        from product_ladder_price
-        where productId = #{productId} and userType = 3 and delFlag = 0
-        order by ladderNum asc
-    </select>
-    <select id="findLowerLadderPrice" resultType="com.caimei365.order.model.vo.LadderPriceVo">
-        select
-        	id, productId, ladderNum, buyNum, buyPrice
-        from product_ladder_price
-        where productId = #{productId} and userType = 3 and delFlag = 0
-        order by ladderNum DESC
-        limit 1
-    </select>
-    <select id="findMaxLadderPrice" resultType="com.caimei365.order.model.vo.LadderPriceVo">
-        select
-        	id, productId, ladderNum, buyNum, buyPrice
-        from product_ladder_price
-        where productId = #{productId} and userType = 3 and delFlag = 0
-        order by ladderNum asc
-        limit 1
-    </select>
-    <select id="getRepurchasePrice" resultType="java.lang.Double">
-        select
-          r.currentPrice
-        from repeat_purchase_price r
-        left join product p on p.productID = r.productId
-        where r.productId = #{productId} and userId = #{userId}
-        and ((p.costCheckFlag=1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag=2)
-        and p.price1 <![CDATA[ >= ]]> r.currentPrice
-        and r.delFlag = 0
-    </select>
-    <select id="getTaxByProductId" resultType="com.caimei365.order.model.vo.TaxVo">
-        select
-        p.includedTax as includedTax,
-        p.invoiceType as invoiceType,
-        p.taxPoint as taxPoint
-        from product p
-        where productID = #{productId}
-    </select>
-
-</mapper>