浏览代码

商品模块

e 5 年之前
父节点
当前提交
be1e33985e
共有 26 个文件被更改,包括 2228 次插入0 次删除
  1. 1 0
      pom.xml
  2. 32 0
      product/pom.xml
  3. 56 0
      product/src/main/java/com/caimei/module/product/dao/ProductModuleDao.java
  4. 49 0
      product/src/main/java/com/caimei/module/product/entity/po/Bigtype.java
  5. 526 0
      product/src/main/java/com/caimei/module/product/entity/po/Product.java
  6. 68 0
      product/src/main/java/com/caimei/module/product/entity/po/ProductLadderPrice.java
  7. 48 0
      product/src/main/java/com/caimei/module/product/entity/po/Productdetailinfo.java
  8. 46 0
      product/src/main/java/com/caimei/module/product/entity/po/Productimage.java
  9. 358 0
      product/src/main/java/com/caimei/module/product/entity/po/Shop.java
  10. 48 0
      product/src/main/java/com/caimei/module/product/entity/po/Smalltype.java
  11. 48 0
      product/src/main/java/com/caimei/module/product/entity/po/Tinytype.java
  12. 37 0
      product/src/main/java/com/caimei/module/product/entity/po/UserSearchHistory.java
  13. 22 0
      product/src/main/java/com/caimei/module/product/entity/vo/BigtypeVo.java
  14. 20 0
      product/src/main/java/com/caimei/module/product/entity/vo/LadderPriceVo.java
  15. 17 0
      product/src/main/java/com/caimei/module/product/entity/vo/ProductDetailVo.java
  16. 16 0
      product/src/main/java/com/caimei/module/product/entity/vo/ProductImageVo.java
  17. 53 0
      product/src/main/java/com/caimei/module/product/entity/vo/ProductVo.java
  18. 16 0
      product/src/main/java/com/caimei/module/product/entity/vo/SearchHistoryVo.java
  19. 33 0
      product/src/main/java/com/caimei/module/product/entity/vo/ShopVo.java
  20. 22 0
      product/src/main/java/com/caimei/module/product/entity/vo/SmalltypeVo.java
  21. 16 0
      product/src/main/java/com/caimei/module/product/entity/vo/TinytypeVo.java
  22. 56 0
      product/src/main/java/com/caimei/module/product/service/ProductModuleService.java
  23. 240 0
      product/src/main/java/com/caimei/module/product/service/impl/ProductModuleServiceImpl.java
  24. 128 0
      product/src/main/java/com/caimei/module/product/util/ProductUtils.java
  25. 6 0
      product/src/main/resources/application.yml
  26. 266 0
      product/src/main/resources/com-caimei-module-product/ProductModuleMapper.xml

+ 1 - 0
pom.xml

@@ -16,6 +16,7 @@
     <description>面向服务的组件模块集合,每个子模块一个独立服务。</description>
     <modules>
         <module>caimei-search</module>
+        <module>product</module>
     </modules>
     <properties>
         <java.version>1.8</java.version>

+ 32 - 0
product/pom.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>caimei-modules-soa</artifactId>
+        <groupId>com.caimei.module</groupId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>product</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.5</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 56 - 0
product/src/main/java/com/caimei/module/product/dao/ProductModuleDao.java

@@ -0,0 +1,56 @@
+package com.caimei.module.product.dao;
+
+import com.caimei.module.product.entity.vo.*;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/25
+ */
+@Mapper
+public interface ProductModuleDao {
+    List<ProductVo> getProductsByTinyType(@Param("tinyTypeID") Integer tinyTypeID, @Param("sortType")  Integer sortType);
+
+    List<SearchHistoryVo> getSearchHistoryList(Integer userId);
+
+    Long getSearchHistoryIdByWord(String searchWord);
+
+    void updateSearchHistoryById(SearchHistoryVo historyRecord);
+
+    void insertSearchHistory(SearchHistoryVo historyRecord);
+
+    void deleteSearchHistoryByUserId(Integer userId);
+
+    List<ProductVo> searchProduct(String searchWord);
+
+    ProductVo findProductById(Integer productID);
+
+    List<ProductImageVo> findProductImage(Integer productID);
+
+    ShopVo findProductShopById(Integer shopID);
+
+    ProductDetailVo findProductDetailById(Integer productID);
+
+    List<BigtypeVo> getBigType();
+
+    List<SmalltypeVo> getSmallType(Integer bigTypeID);
+
+    List<TinytypeVo> getTinytype(Integer smallTypeID);
+
+    LadderPriceVo findLowerLadderPrice(Integer productID);
+
+    List<LadderPriceVo> findLadderPrice(Integer productID);
+
+    List<ProductVo> getProductsByPreferredFlag(Integer preferredFlag);
+
+    List<Integer> getRecommendIds(Integer productID);
+
+    List<ProductVo> getRecommendByIds(List<Integer> productIDs);
+
+    List<ProductVo> getDeFaultRecommend(Integer tinyTypeID);
+}

+ 49 - 0
product/src/main/java/com/caimei/module/product/entity/po/Bigtype.java

@@ -0,0 +1,49 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * bigtype
+ * @author
+ */
+@Data
+public class Bigtype implements Serializable {
+    /**
+     * 一级分类ID
+     */
+    private Integer bigTypeID;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 大分类编码
+     */
+    private String bigTypeCode;
+
+    /**
+     * 审核标志
+     */
+    private String validFlag;
+
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+
+    /**
+     * seo 搜索 截止当前没有使用
+     */
+    private String seo;
+
+    /**
+     * 是否在首页显示--首页改版后暂时无用--
+     */
+    private Integer displayOnHomePageFlag;
+
+    private static final long serialVersionUID = 1L;
+}

+ 526 - 0
product/src/main/java/com/caimei/module/product/entity/po/Product.java

@@ -0,0 +1,526 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * product
+ * @author
+ */
+@Data
+public class Product implements Serializable {
+    private Integer productID;
+
+    /**
+     * 品牌Id
+     */
+    private Integer brandID;
+
+    /**
+     * 三级分类Id
+     */
+    private Integer tinyTypeID;
+
+    /**
+     * 常用商品001,精品推荐010,热门推荐100,三者同时存在111
+     */
+    private Integer preferredFlag;
+
+    private Integer selfTypeID;
+
+    /**
+     * 所属供应商Id
+     */
+    private Integer shopID;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 商品别名
+     */
+    private String aliasName;
+
+    /**
+     * 搜索关键词
+     */
+    private String searchKey;
+
+    /**
+     * 市场价
+     */
+    private Double normalPrice;
+
+    private Double price;
+
+    /**
+     * 最低价
+     */
+    private Double highestUserLevelPrice;
+
+    /**
+     * 最高价
+     */
+    private Double lowestUserLevelPrice;
+
+    /**
+     * 最高价会员等级
+     */
+    private Integer lowestUserLevelID;
+
+    private Double price0;
+
+    /**
+     * 普通用户价格等级(范围1-5)
+     */
+    private String price0Grade;
+
+    /**
+     * 普通用户价格文字
+     */
+    private String price0Text;
+
+    /**
+     * 普通用户文字展示标志 0显示价格 1显示文字 2显示等级
+     */
+    private String price0TextFlag;
+
+    /**
+     * 普通会员价
+     */
+    private Double price1;
+
+    /**
+     * 会员用户价格等级(范围1-5)
+     */
+    private String price1Grade;
+
+    /**
+     * 会员用户价格文字
+     */
+    private String price1Text;
+
+    /**
+     * 会员用户文字展示标志 0显示价格 1显示文字 2显示等级
+     */
+    private String price1TextFlag;
+
+    /**
+     * 游客价格
+     */
+    private Double price8;
+
+    /**
+     * 游客用户价格等级(范围1-5)
+     */
+    private String price8Grade;
+
+    /**
+     * 游客价格文字
+     */
+    private String price8Text;
+
+    /**
+     * 游客用户文字展示标志 0显示价格 1显示文字 2显示等级
+     */
+    private String price8TextFlag;
+
+    /**
+     * 启用阶梯价格标识 0否 1是
+     */
+    private String ladderPriceFlag;
+
+    /**
+     * 银卡价
+     */
+    private Double price2;
+
+    /**
+     * 金卡价
+     */
+    private Double price3;
+
+    /**
+     * 铂金价
+     */
+    private Double price4;
+
+    /**
+     * 钻石价
+     */
+    private Double price5;
+
+    /**
+     * 普通服务商价
+     */
+    private Double price6;
+
+    /**
+     * 金牌服务商价
+     */
+    private Double price7;
+
+    /**
+     * 运费
+     */
+    private Double fee;
+
+    /**
+     * 库存
+     */
+    private Integer stock;
+
+    /**
+     * 是否有sku:1有, 0没有
+     */
+    private String hasSkuFlag;
+
+    /**
+     * 主图
+     */
+    private String mainImage;
+
+    /**
+     * sku属性
+     */
+    private String propertiesInfo;
+
+    /**
+     * 添加时间
+     */
+    private String addTime;
+
+    /**
+     * 更新时间
+     */
+    private String updateTime;
+
+    /**
+     * 销量
+     */
+    private Integer sellNumber;
+
+    private Integer weekSellNumber;
+
+    private String beforeValidFlag;
+
+    /**
+     * 商品状态,见表c_productstatus或枚举ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
+     */
+    private String validFlag;
+
+    /**
+     * 收藏量
+     */
+    private Integer favoriteTimes;
+
+    /**
+     * 评论分数
+     */
+    private Double commentScore;
+
+    /**
+     * 评论次数
+     */
+    private Integer commentTimes;
+
+    private String selfRecommendFlag;
+
+    private String sysRecommendFlag;
+
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+
+    /**
+     * 供应商主推商品标志 0否 1是
+     */
+    private String featuredFlag;
+
+    /**
+     * 供应商主推商品排序
+     */
+    private Integer featuredSortIndex;
+
+    /**
+     * 商品货号
+     */
+    private String productCode;
+
+    private Double rate1;
+
+    private Double rate2;
+
+    /**
+     * 包装规格
+     */
+    private String unit;
+
+    /**
+     * 是否推送到ERP,1已推送, 空或0未推送
+     */
+    private String synToERPFlag;
+
+    /**
+     * 销售区域:1全部区域, 0指定区域
+     */
+    private String allAreaFlag;
+
+    /**
+     * 指定的销售区域
+     */
+    private String provinceIDs;
+
+    /**
+     * 服务起订量
+     */
+    private String serviceNumber;
+
+    /**
+     * 最大购买量
+     */
+    private Integer maxBuyNumber;
+
+    private String virtualFlag;
+
+    /**
+     * 最小购买量
+     */
+    private Integer minBuyNumber;
+
+    /**
+     * 最小包装数量
+     */
+    private Integer packageCount;
+
+    /**
+     * 运费:0买家承担, 1卖家承担
+     */
+    private String byFlag;
+
+    /**
+     * 普通商品标志 1是
+     */
+    private Integer normalProductFlag;
+
+    private Integer wholeSaleProductFlag;
+
+    private Integer promotionProductFlag;
+
+    private Integer groupBuyProductFlag;
+
+    /**
+     * 购买梯度数(编辑数量时加减的数量)
+     */
+    private Integer step;
+
+    private String speCommisionFlag;
+
+    private Double speCommision;
+
+    private String videourl;
+
+    private String props;
+
+    private String providers;
+
+    private Double serviceCommissionRatio;
+
+    private Double reCommissionRatio;
+
+    /**
+     * 推送到ERP的原商品名称 name字段的名称可能做修改已适应平台的搜索
+     */
+    private String pushToERPName;
+
+    private Integer prodBeans;
+
+    /**
+     * 该商品是否可以使用采美豆购买
+     */
+    private Integer useBeansFlag;
+
+    /**
+     * 0开放市场 1私有市场
+     */
+    private Integer privateFlag;
+
+    private String invisibleServiceProviderIDs;
+
+    private String displayOnCRMFlag;
+
+    private String needServiceFlag;
+
+    /**
+     * 是否活动商品:1是,空或0不是
+     */
+    private Integer actFlag;
+
+    /**
+     * 活动商品排序
+     */
+    private Long actSort;
+
+    /**
+     * 普通用户活动价格
+     */
+    private BigDecimal actPrice0;
+
+    /**
+     * 普通会员活动价
+     */
+    private BigDecimal actPrice1;
+
+    /**
+     * 银卡会员活动价
+     */
+    private BigDecimal actPrice2;
+
+    /**
+     * 金卡会员活动价
+     */
+    private BigDecimal actPrice3;
+
+    /**
+     * 铂金会员活动价
+     */
+    private BigDecimal actPrice4;
+
+    /**
+     * 钻石会员活动价
+     */
+    private BigDecimal actPrice5;
+
+    /**
+     * 普通服务商活动价
+     */
+    private BigDecimal actPrice6;
+
+    /**
+     * 金牌服务商活动价
+     */
+    private BigDecimal actPrice7;
+
+    /**
+     * 商品活动类型:1推荐热销、2推荐上新、3团购促销
+     */
+    private Integer actType;
+
+    /**
+     * 活动创建时间
+     */
+    private Date actCreateTime;
+
+    /**
+     * 活动开始时间
+     */
+    private Date beginTime;
+
+    /**
+     * 活动结束时间
+     */
+    private Date endTime;
+
+    private Integer shopIndexModuleID;
+
+    /**
+     * 上架时间
+     */
+    private Date onlineTime;
+
+    /**
+     * 下架时间
+     */
+    private Date downlineTime;
+
+    /**
+     * 是否包邮 0包邮 1不包邮
+     */
+    private String freePostFlag;
+
+    /**
+     * crm一级商品分类
+     */
+    private Integer crmBigTypeId;
+
+    /**
+     * crm二级商品分类
+     */
+    private Integer crmSmallTypeId;
+
+    /**
+     * 成本价
+     */
+    private BigDecimal costPrice;
+
+    /**
+     * 比例成本百分比
+     */
+    private BigDecimal costProportional;
+
+    /**
+     * 成本价选中标志:1固定成本 2比例成
+     */
+    private String costCheckFlag;
+
+    private String precisehKey;
+
+    private Double docBoost;
+
+    /**
+     * 是否采美豆专区商品(0 否,1 是)
+     */
+    private String cmbeanFlag;
+
+    /**
+     * 采美豆专区价格(采美豆)
+     */
+    private Integer cmbeanPrice;
+
+    /**
+     * 采美豆专区排序(值越大越前)
+     */
+    private Short cmbeanSort;
+
+    private Integer actBuyGiftNum;
+
+    private Double actFullGiftAmount;
+
+    private Double actFullReduceAmount;
+
+    private Double actReduceAmount;
+
+    /**
+     * (3:高可见度,2:中可见度,1:低可见度)
+     */
+    private String visibility;
+
+    private String surplusTime;
+
+    private String endTimeStr;
+
+    private String priceType;
+
+    /**
+     * 商品标签 用逗号隔开
+     */
+    private String tags;
+
+    /**
+     * 相关推荐类型 0自动选择; 1手动推荐
+     */
+    private String recommendType;
+
+    /**
+     * 械字号   0或Null:不是,1:一类,2:二类,3:三类
+     */
+    private String machineType;
+
+    private static final long serialVersionUID = 1L;
+}

+ 68 - 0
product/src/main/java/com/caimei/module/product/entity/po/ProductLadderPrice.java

@@ -0,0 +1,68 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * product_ladder_price
+ * @author
+ */
+@Data
+public class ProductLadderPrice implements Serializable {
+    private Long id;
+
+    /**
+     * 商品id
+     */
+    private Long productId;
+
+    /**
+     * 用户类型,1游客,2普通用户,3会员用户
+     */
+    private Long userType;
+
+    /**
+     * 第几阶梯
+     */
+    private Long ladderNum;
+
+    /**
+     * 购买数量
+     */
+    private Long buyNum;
+
+    /**
+     * 购买价格
+     */
+    private BigDecimal buyPrice;
+
+    /**
+     * 创建人
+     */
+    private Long createBy;
+
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+
+    /**
+     * 最后更新人
+     */
+    private Long updateBy;
+
+    /**
+     * 最后更新时间
+     */
+    private Date updateDate;
+
+    /**
+     * 删除标记 0正常 其它为已删除(使用时间戳记录)
+     */
+    private String delFlag;
+
+    private static final long serialVersionUID = 1L;
+}

+ 48 - 0
product/src/main/java/com/caimei/module/product/entity/po/Productdetailinfo.java

@@ -0,0 +1,48 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * productdetailinfo
+ * @author
+ */
+@Data
+public class Productdetailinfo implements Serializable {
+    private Integer productDetailInfoID;
+
+    /**
+     * 商品Id
+     */
+    private Integer productID;
+
+    private String propValueAlias;
+
+    private String propValueImages;
+
+    /**
+     * 商品详情信息
+     */
+    private String detailInfo;
+
+    private String detailInfoTxt;
+
+    private String seoTitle;
+
+    private String seoKeyword;
+
+    private String seoDes;
+
+    /**
+     * 服务详情
+     */
+    private String serviceInfo;
+
+    /**
+     * 订购方案
+     */
+    private String orderInfo;
+
+    private static final long serialVersionUID = 1L;
+}

+ 46 - 0
product/src/main/java/com/caimei/module/product/entity/po/Productimage.java

@@ -0,0 +1,46 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * productimage
+ * @author
+ */
+@Data
+public class Productimage implements Serializable {
+    private Integer productImageID;
+
+    /**
+     * 商品Id
+     */
+    private Integer productID;
+
+    /**
+     * 商品对应供应商Id
+     */
+    private Integer shopID;
+
+    /**
+     * 添加时间
+     */
+    private String addTime;
+
+    /**
+     * 图片
+     */
+    private String image;
+
+    /**
+     * 是否主图:1是,空或0不是
+     */
+    private String mainFlag;
+
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+
+    private static final long serialVersionUID = 1L;
+}

+ 358 - 0
product/src/main/java/com/caimei/module/product/entity/po/Shop.java

@@ -0,0 +1,358 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * shop
+ * @author
+ */
+@Data
+public class Shop implements Serializable {
+    private Integer shopID;
+
+    /**
+     * 对应的userId
+     */
+    private Integer userID;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 供应商公司简称
+     */
+    private String sname;
+
+    /**
+     * 英文名
+     */
+    private String nameEn;
+
+    /**
+     * 网站
+     */
+    private String site;
+
+    /**
+     * 供应商接受采美分账的易宝商户编码
+     */
+    private String ledgerNo;
+
+    /**
+     * 公司LOGO
+     */
+    private String logo;
+
+    /**
+     * 供应商欠款金额(供应商口头返佣欠款录入)
+     */
+    private BigDecimal rebateAmount;
+
+    private Double level;
+
+    /**
+     * 评分
+     */
+    private Double score;
+
+    private Integer productCount;
+
+    /**
+     * 法人
+     */
+    private String legalPerson;
+
+    private String businessLicense;
+
+    /**
+     * 营业执照
+     */
+    private String businessLicenseImage;
+
+    private String taxCertificate;
+
+    /**
+     * 税务登记证
+     */
+    private String taxCertificateImage;
+
+    /**
+     * 省
+     */
+    private Integer provinceID;
+
+    /**
+     * 市
+     */
+    private Integer cityID;
+
+    /**
+     * 所在县区Id
+     */
+    private Integer townID;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 注册资本
+     */
+    private Double registeredCapital;
+
+    /**
+     * 公司性质
+     */
+    private String nature;
+
+    /**
+     * 年营业额
+     */
+    private Double turnover;
+
+    /**
+     * 联系人
+     */
+    private String linkMan;
+
+    /**
+     * 固定电话
+     */
+    private String contractPhone;
+
+    /**
+     * 手机号
+     */
+    private String contractMobile;
+
+    /**
+     * 传真
+     */
+    private String fax;
+
+    /**
+     * 邮编
+     */
+    private String zipCode;
+
+    /**
+     * 联系人1(默认联系人)
+     */
+    private String linkMan1;
+
+    /**
+     * 联系人1职务
+     */
+    private String duty1;
+
+    /**
+     * 联系人1固定电话
+     */
+    private String contractPhone1;
+
+    /**
+     * 联系人1手机号
+     */
+    private String contractMobile1;
+
+    /**
+     * 联系人1QQ
+     */
+    private String contractQQ1;
+
+    /**
+     * 联系人1微信
+     */
+    private String wechat1;
+
+    /**
+     * 联系人1邮箱
+     */
+    private String contractEmail1;
+
+    /**
+     * 联系人2
+     */
+    private String linkMan2;
+
+    /**
+     * 联系人2职务
+     */
+    private String duty2;
+
+    /**
+     * 联系人2固定电话
+     */
+    private String contractPhone2;
+
+    /**
+     * 联系人2手机号
+     */
+    private String contractMobile2;
+
+    /**
+     * 联系人2QQ
+     */
+    private String contractQQ2;
+
+    /**
+     * 联系人2微信
+     */
+    private String wechat2;
+
+    /**
+     * 联系人2邮箱
+     */
+    private String contractEmail2;
+
+    private String scope;
+
+    /**
+     * 介绍
+     */
+    private String info;
+
+    /**
+     * 主打产品说明
+     */
+    private String productDesc;
+
+    private Double lng;
+
+    private Double lat;
+
+    /**
+     * 添加时间
+     */
+    private String addTime;
+
+    /**
+     * 审核状态
+     */
+    private String auditStatus;
+
+    /**
+     * 审核时间
+     */
+    private String auditTime;
+
+    /**
+     * 审核信息
+     */
+    private String auditNote;
+
+    /**
+     * 被收藏次数
+     */
+    private Integer favoriteTimes;
+
+    /**
+     * 是否可用,1可用
+     */
+    private String validFlag;
+
+    private String payFlag1;
+
+    private String auditFlag1;
+
+    private String payFlag2;
+
+    private String auditFlag2;
+
+    private String payFlag3;
+
+    private String auditFlag3;
+
+    private String note;
+
+    /**
+     * 供应商状态,见表c_shopstatus或枚举ShopStatus
+     */
+    private Integer status;
+
+    private Integer sortIndex;
+
+    private Double rate1;
+
+    private Double rate2;
+
+    private String masterFlag;
+
+    private String erpFlag;
+
+    private String shopSecret;
+
+    private String masterLogo;
+
+    private String cooperateFlag;
+
+    private Integer bail;
+
+    /**
+     * 经营范围
+     */
+    private String businessScope;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String socialCreditCode;
+
+    /**
+     * 主打项目
+     */
+    private String mainpro;
+
+    /**
+     * 医疗=1和非医疗=2
+     */
+    private String firstShopType;
+
+    /**
+     * 医疗的二级分类 一类器械=1、二类器械 =2、三类器械=3、其他=4 /// 1和非医疗没有二级分类
+     */
+    private String secondShopType;
+
+    /**
+     * 如选择为医疗>>三类器械  则必须要上传资质。
+     */
+    private String medicalPracticeLicenseImg1;
+
+    /**
+     * 如选择为医疗>>三类器械  则必须要上传资质。
+     */
+    private String medicalPracticeLicenseImg2;
+
+    /**
+     * 如选择为医疗>>三类器械  则必须要上传资质。
+     */
+    private String medicalPracticeLicenseImg3;
+
+    /**
+     * 银行账号
+     */
+    private String bankAccount;
+
+    /**
+     * 付款账号的户名
+     */
+    private String bankAccountName;
+
+    /**
+     * 付款账号的开户行
+     */
+    private String bankName;
+
+    /**
+     * 可用余额
+     */
+    private BigDecimal ableRebateAmount;
+
+    private static final long serialVersionUID = 1L;
+}

+ 48 - 0
product/src/main/java/com/caimei/module/product/entity/po/Smalltype.java

@@ -0,0 +1,48 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * smalltype
+ * @author
+ */
+@Data
+public class Smalltype implements Serializable {
+    private Integer smallTypeID;
+
+    /**
+     * 一级分类Id
+     */
+    private Integer bigTypeID;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 小分类编码
+     */
+    private String smallTypeCode;
+
+    /**
+     * 是否可用:1可用,空或0不可用
+     */
+    private String validFlag;
+
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+
+    private String seo;
+
+    /**
+     * 是否在首页显示--首页改版后暂时无用--
+     */
+    private Integer displayOnHomePageFlag;
+
+    private static final long serialVersionUID = 1L;
+}

+ 48 - 0
product/src/main/java/com/caimei/module/product/entity/po/Tinytype.java

@@ -0,0 +1,48 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * tinytype
+ * @author
+ */
+@Data
+public class Tinytype implements Serializable {
+    private Integer tinyTypeID;
+
+    /**
+     * 二级分类Id
+     */
+    private Integer smallTypeID;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 细分类编码
+     */
+    private String tinyTypeCode;
+
+    /**
+     * 细分类图标 CRM
+     */
+    private String icon;
+
+    /**
+     * 是否可用:1可用,空或0不可用
+     */
+    private String validFlag;
+
+    private String seo;
+
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+
+    private static final long serialVersionUID = 1L;
+}

+ 37 - 0
product/src/main/java/com/caimei/module/product/entity/po/UserSearchHistory.java

@@ -0,0 +1,37 @@
+package com.caimei.module.product.entity.po;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * user_search_history
+ * @author
+ */
+@Data
+public class UserSearchHistory implements Serializable {
+    private Long id;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 搜索关键词
+     */
+    private String searchWord;
+
+    /**
+     * 搜索时间
+     */
+    private Date searchDate;
+
+    /**
+     * 删除标记 0 否,其余是
+     */
+    private String delFlag;
+
+    private static final long serialVersionUID = 1L;
+}

+ 22 - 0
product/src/main/java/com/caimei/module/product/entity/vo/BigtypeVo.java

@@ -0,0 +1,22 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Bigtype;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 一级分类
+ *
+ * @author : Charles
+ * @date : 2020/3/16
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class BigtypeVo extends Bigtype {
+    /**
+     * 二级菜单列表
+     */
+    private List<SmalltypeVo> SmalltypeList;
+}

+ 20 - 0
product/src/main/java/com/caimei/module/product/entity/vo/LadderPriceVo.java

@@ -0,0 +1,20 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.ProductLadderPrice;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/17
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class LadderPriceVo extends ProductLadderPrice {
+    /**
+     * 阶梯价格数量区间显示
+     */
+    private String buyNumRangeShow;
+}

+ 17 - 0
product/src/main/java/com/caimei/module/product/entity/vo/ProductDetailVo.java

@@ -0,0 +1,17 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Productdetailinfo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/18
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ProductDetailVo extends Productdetailinfo {
+
+}

+ 16 - 0
product/src/main/java/com/caimei/module/product/entity/vo/ProductImageVo.java

@@ -0,0 +1,16 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Productimage;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/17
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ProductImageVo extends Productimage {
+}

+ 53 - 0
product/src/main/java/com/caimei/module/product/entity/vo/ProductVo.java

@@ -0,0 +1,53 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Product;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/17
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ProductVo extends Product {
+    /**
+     * 展示价格
+     */
+    private BigDecimal retailPrice;
+    /**
+     * 标签数组
+     */
+    private String[] tagsList;
+    /**
+     * 商品图片
+     */
+    private List<ProductImageVo> imageList;
+
+    /**
+     * 商品详情
+     */
+    private ProductDetailVo productDetail;
+
+    /**
+     * 购物车商品数量
+     */
+    private Integer productCount;
+
+    /**
+     *阶梯价格集合
+     */
+    private List<LadderPriceVo> ladderPriceList;
+
+    /**
+     * 供应商信息
+     *
+     */
+    private ShopVo shop;
+
+}

+ 16 - 0
product/src/main/java/com/caimei/module/product/entity/vo/SearchHistoryVo.java

@@ -0,0 +1,16 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.UserSearchHistory;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/17
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SearchHistoryVo extends UserSearchHistory {
+}

+ 33 - 0
product/src/main/java/com/caimei/module/product/entity/vo/ShopVo.java

@@ -0,0 +1,33 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Shop;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : plf
+ * @date : 2020\3\17 0017
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ShopVo extends Shop {
+
+    /**
+     * 购物车总的商品价格
+     */
+    private BigDecimal totalPrice;
+
+    /**
+     * 商品集合
+     */
+    private List<ProductVo> productsList;
+    /**
+     * 经营范围
+     */
+    private String[] businessScopeArray;
+}

+ 22 - 0
product/src/main/java/com/caimei/module/product/entity/vo/SmalltypeVo.java

@@ -0,0 +1,22 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Smalltype;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 二级分类
+ *
+ * @author : Charles
+ * @date : 2020/3/16
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SmalltypeVo extends Smalltype {
+    /**
+     * 三级菜单列表
+     */
+    private List<TinytypeVo> tinytypeList;
+}

+ 16 - 0
product/src/main/java/com/caimei/module/product/entity/vo/TinytypeVo.java

@@ -0,0 +1,16 @@
+package com.caimei.module.product.entity.vo;
+
+import com.caimei.module.product.entity.po.Tinytype;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 三级分类
+ *
+ * @author : Charles
+ * @date : 2020/3/16
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class TinytypeVo extends Tinytype {
+}

+ 56 - 0
product/src/main/java/com/caimei/module/product/service/ProductModuleService.java

@@ -0,0 +1,56 @@
+package com.caimei.module.product.service;
+
+import com.caimei.module.product.entity.vo.BigtypeVo;
+import com.caimei.module.product.entity.vo.LadderPriceVo;
+import com.caimei.module.product.entity.vo.ProductVo;
+import com.caimei.module.product.entity.vo.SearchHistoryVo;
+import com.github.pagehelper.Page;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/25
+ */
+public interface ProductModuleService {
+    /**
+     * 商品分类
+     */
+    List<BigtypeVo> getClassify(String domain);
+    /**
+     * 根据三级分类获取商品
+     */
+    Page<ProductVo> getProductsByTinyType(Integer tinyTypeID, Integer sortType, Integer pageNum, Integer pageSize);
+    /**
+     * 根据关键词获取商品
+     */
+    Page<ProductVo> searchProduct(String searchWord, Integer userId, Integer pageNum, Integer pageSize);
+
+    /**
+     * 商品搜索历史记录
+     */
+    List<SearchHistoryVo> getSearchHistory(Integer userId);
+    /**
+     * 商品详情页
+     */
+    ProductVo getProductDetails(Integer productID, String domain);
+    /**
+     * 设置商品展示价格
+     */
+    ProductVo getShowPrice(ProductVo product, Integer userId);
+    /**
+     * 获取阶梯价格
+     */
+    List<LadderPriceVo> findLadderPrice(Integer productID);
+    /**
+     * 获取模块商品列表
+     * @param preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),三者同时存在111
+     */
+    Page<ProductVo>  getPreferred(Integer preferredFlag, Integer userId, Integer pageNum, Integer pageSize);
+    /**
+     * 相关推荐-根据id
+     */
+    Page<ProductVo> getRecommended(Integer productID, Integer pageNum, Integer pageSize);
+}

+ 240 - 0
product/src/main/java/com/caimei/module/product/service/impl/ProductModuleServiceImpl.java

@@ -0,0 +1,240 @@
+package com.caimei.module.product.service.impl;
+
+import com.caimei.module.product.dao.ProductModuleDao;
+import com.caimei.module.product.entity.vo.*;
+import com.caimei.module.product.service.ProductModuleService;
+import com.caimei.module.product.util.ProductUtils;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/25
+ */
+@Service
+public class ProductModuleServiceImpl implements ProductModuleService {
+    @Resource
+    private ProductModuleDao productModuleDao;
+
+    /**
+     * 获取分类列表
+     */
+    @Override
+    public List<BigtypeVo> getClassify(String domain) {
+        List<BigtypeVo> bigTypeList = productModuleDao.getBigType();
+        for (BigtypeVo bigType : bigTypeList) {
+            List<SmalltypeVo> SmalltypeList = productModuleDao.getSmallType(bigType.getBigTypeID());
+            for (SmalltypeVo smalltype : SmalltypeList) {
+                List<TinytypeVo> tinytypeList = productModuleDao.getTinytype(smalltype.getSmallTypeID());
+                if (!CollectionUtils.isEmpty(tinytypeList)) {
+                    for (TinytypeVo tinyType : tinytypeList) {
+                        if (StringUtils.isEmpty(tinyType.getIcon())) {
+                            tinyType.setIcon(ProductUtils.getImageURL("caiMeiImage", null, 0, domain));
+                        }
+                    }
+                    smalltype.setTinytypeList(tinytypeList);
+                }
+            }
+            bigType.setSmalltypeList(SmalltypeList);
+        }
+        return bigTypeList;
+    }
+
+    /**
+     * 根据三级分类获取商品
+     *
+     * @param tinyTypeID
+     * @param sortType
+     * @param pageNum
+     * @param pageSize
+     */
+    @Override
+    public Page<ProductVo> getProductsByTinyType(Integer tinyTypeID, Integer sortType, Integer pageNum, Integer pageSize) {
+        // sortType (3:价格升序, 4:价格降序, 7:人气, 8:销量)
+        pageNum = null != pageNum ? pageNum : 1;
+        pageSize = null != pageSize ? pageSize : 10;
+        Page<ProductVo> page = PageHelper.startPage(pageNum, pageSize);
+        sortType = null != sortType ? sortType : 8;
+        List<ProductVo> productList = productModuleDao.getProductsByTinyType(tinyTypeID, sortType);
+        page.addAll(productList);
+        return page;
+    }
+
+    /**
+     * 获取模块商品列表
+     *
+     * @param preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),三者同时存在111
+     * @param userId
+     * @param pageNum
+     * @param pageSize
+     */
+    @Override
+    public Page<ProductVo>  getPreferred(Integer preferredFlag, Integer userId, Integer pageNum, Integer pageSize) {
+        pageNum = null != pageNum ? pageNum : 1;
+        pageSize = null != pageSize ? pageSize : 10;
+        Page<ProductVo> page = PageHelper.startPage(pageNum, pageSize);
+        List<ProductVo> productList = productModuleDao.getProductsByPreferredFlag(preferredFlag);
+        page.addAll(productList);
+        return page;
+    }
+
+    /**
+     * 根据关键词获取商品
+     *
+     * @param searchWord
+     * @param userId
+     * @param pageNum
+     * @param pageSize
+     */
+    @Override
+    public Page<ProductVo> searchProduct(String searchWord, Integer userId, Integer pageNum, Integer pageSize) {
+        pageNum = null != pageNum ? pageNum : 1;
+        pageSize = null != pageSize ? pageSize : 10;
+        Page<ProductVo> page = PageHelper.startPage(pageNum, pageSize);
+        // 登录状态下,查询历史记录是否存在
+        if (null != userId) {
+            List<SearchHistoryVo> historyList = productModuleDao.getSearchHistoryList(userId);
+            //保存并删除大于10条的历史记录
+            SearchHistoryVo historyRecord = new SearchHistoryVo();
+            historyRecord.setUserId(userId.longValue());
+            historyRecord.setSearchDate(new Date());
+            historyRecord.setSearchWord(searchWord);
+            historyRecord.setDelFlag("0");
+            if (historyList != null) {
+                Long recordId = productModuleDao.getSearchHistoryIdByWord(searchWord);
+                if (recordId != null && recordId > 0L) {
+                    historyRecord.setId(recordId);
+                    productModuleDao.updateSearchHistoryById(historyRecord);
+                } else {
+                    productModuleDao.insertSearchHistory(historyRecord);
+                }
+                if (historyList.size() >= 10) {
+                    productModuleDao.deleteSearchHistoryByUserId(userId);
+                }
+            } else {
+                productModuleDao.insertSearchHistory(historyRecord);
+            }
+        }
+        List<ProductVo> productList = productModuleDao.searchProduct(searchWord);
+        page.addAll(productList);
+        return page;
+    }
+
+
+    @Override
+    public Page<ProductVo> getRecommended(Integer productID, Integer pageNum, Integer pageSize){
+        ProductVo product = productModuleDao.findProductById(productID);
+        pageNum = null != pageNum ? pageNum : 1;
+        pageSize = null != pageSize ? pageSize : 7;
+        Page<ProductVo> page = PageHelper.startPage(pageNum, pageSize);
+        List<ProductVo> productList;
+        if ("1".equals(product.getRecommendType())) {
+            List<Integer> productIDs = productModuleDao.getRecommendIds(productID);
+            productList = productModuleDao.getRecommendByIds(productIDs);
+            page.addAll(productList);
+        } else {
+            productList = productModuleDao.getDeFaultRecommend(product.getTinyTypeID());
+            page.addAll(productList);
+            page.setTotal(7L);
+            page.setPages(1);
+        }
+        return page;
+    }
+    /**
+     * 商品搜索历史记录
+     */
+    @Override
+    public List<SearchHistoryVo> getSearchHistory(Integer userId) {
+            return productModuleDao.getSearchHistoryList(userId);
+    }
+
+    /**
+     * 商品详情页
+     * @param productID
+     */
+    @Override
+    public ProductVo getProductDetails(Integer productID, String domain) {
+        ProductVo product = productModuleDao.findProductById(productID);
+        String[] split = null;
+        //商品标签
+        if (product.getTags() != null) {
+            String tags = product.getTags();
+            tags = tags.replace(" ", ",").replace("、", ",").replace(",", ",");
+            if (tags.contains(",")) {
+                split = tags.split(",");
+                List<String> list = new ArrayList();
+                for (String s : split) {
+                    if (s != null && !s.equals("")) {
+                        list.add(s);
+                    }
+                }
+                split = list.toArray(new String[list.size()]);
+            }
+        }
+        product.setTagsList(split);
+        product.setMainImage(ProductUtils.getImageURL("product", product.getMainImage(), 0, domain));
+        //商品图片
+        List<ProductImageVo> imageList = productModuleDao.findProductImage(product.getProductID());
+        for (ProductImageVo image : imageList) {
+            String imageURL = ProductUtils.getImageURL("product", image.getImage(), 0, domain);
+            image.setImage(imageURL);
+        }
+        product.setImageList(imageList);
+        //商品详情
+        ProductDetailVo productDetail = productModuleDao.findProductDetailById(productID);
+        product.setProductDetail(productDetail);
+        //供应商信息
+        ShopVo shop = productModuleDao.findProductShopById(product.getShopID());
+        if (shop.getBusinessScope() != null && shop.getBusinessScope().contains("/")) {
+            String[] businessScopeArray = shop.getBusinessScope().split("/");
+            shop.setBusinessScopeArray(businessScopeArray);
+        }
+        shop.setLogo(ProductUtils.getImageURL("shopLogo", shop.getLogo(), 0, domain));
+        shop.setBusinessLicenseImage(ProductUtils.getImageURL("shopLogo", shop.getBusinessLicenseImage(), 0, domain));
+        product.setShop(shop);
+        //价格等级
+        String priceGrade = ProductUtils.getPriceGrade(product.getPrice1());
+        product.setPrice1Grade(priceGrade);
+        return product;
+    }
+
+    /**
+     * 设置商品展示价格
+     *
+     * @param product
+     * @param userId
+     */
+    @Override
+    public ProductVo getShowPrice(ProductVo product, Integer userId) {
+        product.setRetailPrice(new BigDecimal(product.getPrice1()));
+        //是否启用阶梯价格
+        if (null != userId && product.getLadderPriceFlag().equals("1")) {
+            LadderPriceVo ladderPrice = productModuleDao.findLowerLadderPrice(product.getProductID());
+            product.setRetailPrice(ladderPrice.getBuyPrice());
+        }
+        return product;
+    }
+
+    /**
+     * 获取阶梯价格
+     *
+     * @param productID
+     */
+    @Override
+    public List<LadderPriceVo> findLadderPrice(Integer productID) {
+        return productModuleDao.findLadderPrice(productID);
+    }
+
+
+}

+ 128 - 0
product/src/main/java/com/caimei/module/product/util/ProductUtils.java

@@ -0,0 +1,128 @@
+package com.caimei.module.product.util;
+
+import org.springframework.util.StringUtils;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2020/3/25
+ */
+public class ProductUtils {
+	public static String getImageURL(String dirName, String src, String domain) {
+		return getImageURL(dirName, src, 0,domain);
+	}
+	/***
+	 * 获取图片地址
+	 *
+	 * @param src
+	 *            保存在数据库中的图片文件名
+	 * @param type
+	 *            图片的前缀 (如 type = 200 那么则获取的图片是 200_XXX的图片)
+	 * @param dirName
+	 *            图片保存的文件夹名 如 (league)
+	 * @param domain
+	 * 			   加上域名拼成完整路径
+	 * @return
+	 */
+	public static String getImageURL(String dirName, String src, int type, String domain) {
+
+
+		//正式环境 域名 http --- https处理
+		if (domain != null && !"".equals(domain) && domain.startsWith("http:") && domain.toLowerCase().lastIndexOf("test")== -1 && domain.toLowerCase().lastIndexOf("localhost")== -1) {
+			domain = domain.replace("http:", "https:");
+		}
+
+		//正式环境 图片地址 http --- https处理
+		if(src != null && src.startsWith("https:")){
+			//非正式环境 使用http
+			if (domain !=null && !"".equals(domain) && domain.toLowerCase().lastIndexOf("test")>-1 || domain.toLowerCase().lastIndexOf("localhost")>-1){
+				src = src.replace("https:","http:");
+			}
+			return src;
+		}
+
+		//正式环境 图片地址  http --- https处理
+		if(src != null && src.startsWith("http:")){
+			//非正式环境 使用http
+			if (domain !=null && !"".equals(domain) && domain.toLowerCase().lastIndexOf("test")==-1 && domain.toLowerCase().lastIndexOf("localhost")==-1){
+				src = src.replace("http:","https:");
+			}
+			return src;
+		}
+		type = 0 ;
+		dirName = dirName.trim();
+		if (dirName == null) {dirName = "";}
+		if(src == null || src.equalsIgnoreCase("null")) {src = "";}
+		if (src.indexOf(",") > 0) {
+			String tmp = src;
+			src = tmp.substring(0, tmp.indexOf(","));
+		}
+		String image = "/public/3.0/img/default/none.jpg";
+		if (dirName.equals("user")) {
+			image = "/public/3.0/img/default/HeaderImg.png";
+		} else if (dirName.equals("club")) {
+			image = "/public/3.0/img/default/default_club.jpg";
+		} else if (dirName.equals("shopLogo")) {
+			image = "/public/3.0/img/default/suppliver.jpg";
+		}else if (dirName.equals("caiMeiImage")) {
+			image = "/public/3.0/img/default/caiMeiImage.jpg";
+		}else {
+			image = "/public/3.0/img/default/none.jpg";
+		}
+		if (src != null && !src.equals("")) {
+			if (type != 0 || dirName.equals("product")) {
+				src = src.replace("\\", "/");
+				String srcActual = src;
+				String subDirName = "";
+				int index = src.lastIndexOf("/");
+
+				if (index != -1) {
+					subDirName = src.substring(0, index + 1);
+					srcActual = src.substring(index + 1);
+				}
+				boolean b = src.startsWith("/uploadFile");
+				if(b){
+					image = src;
+				}else{
+					image = "/uploadFile/" + dirName + "/" + subDirName
+							+ (type == 0 ? "" : type + "_") + srcActual;
+				}
+			} else {
+				boolean b = src.startsWith("/uploadFile");
+				if(b){
+					image = src;
+				}else{
+					image = "/uploadFile/" + dirName + "/" + src;
+				}
+			}
+		}else {
+			if(StringUtils.isEmpty(image)) {
+				image = "/public/3.0/img/default/none.jpg";
+			}
+		}
+		return domain + image;
+	}
+
+	public static String getProductImageURL(String image, int type, String domain) {
+		if (image == null) {
+			return getImageURL("product", "", type, domain);
+		}
+		return getImageURL("product", image, type, domain);
+	}
+
+	public static String getPriceGrade(Double price){
+        if (price <= 2.5 * 10000L) {
+        	return "1";
+        } else if (price <= 10 * 10000) {
+            return "2";
+        } else if (price <= 25 * 10000) {
+            return "3";
+        } else if (price <= 50 * 10000) {
+            return "4";
+        } else {
+            return "5";
+        }
+	}
+
+}

+ 6 - 0
product/src/main/resources/application.yml

@@ -0,0 +1,6 @@
+
+#整合mybatis
+mybatis:
+  #加载Mybatis映射文件
+  mapper-locations: classpath:com-caimei-module-product/*Mapper.xml
+

+ 266 - 0
product/src/main/resources/com-caimei-module-product/ProductModuleMapper.xml

@@ -0,0 +1,266 @@
+<?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.caimei.module.product.dao.ProductModuleDao">
+    <sql id="BigType_Column_List">
+        bigTypeID, `name`, bigTypeCode, validFlag, sortIndex, seo, displayOnHomePageFlag
+    </sql>
+    <sql id="SmallType_Column_List">
+        smallTypeID, bigTypeID, `name`, smallTypeCode, validFlag, sortIndex, seo, displayOnHomePageFlag
+    </sql>
+    <sql id="Tinytype_Column_List">
+        tinyTypeID, smallTypeID, `name`, tinyTypeCode, icon, validFlag, seo, sortIndex
+    </sql>
+    <sql id="Product_Column_List">
+        productID, brandID, tinyTypeID, preferredFlag, selfTypeID, shopID, `name`, aliasName, searchKey,
+        normalPrice, price, highestUserLevelPrice, lowestUserLevelPrice, lowestUserLevelID,
+        price0, price0Grade, price0Text, price0TextFlag, price1, price1Grade, price1Text,
+        price1TextFlag, price8, price8Grade, price8Text, price8TextFlag, ladderPriceFlag,
+        price2, price3, price4, price5, price6, price7, fee, stock, hasSkuFlag, mainImage,
+        propertiesInfo, addTime, updateTime, sellNumber, weekSellNumber, beforeValidFlag,
+        validFlag, favoriteTimes, commentScore, commentTimes, selfRecommendFlag, sysRecommendFlag,
+        sortIndex, featuredFlag, featuredSortIndex, productCode, rate1, rate2, unit, synToERPFlag,
+        allAreaFlag, provinceIDs, serviceNumber, maxBuyNumber, virtualFlag, minBuyNumber,
+        packageCount, byFlag, normalProductFlag, wholeSaleProductFlag, promotionProductFlag,
+        groupBuyProductFlag, step, speCommisionFlag, speCommision, videourl, props, providers,
+        serviceCommissionRatio, reCommissionRatio, pushToERPName, prodBeans, useBeansFlag,
+        privateFlag, invisibleServiceProviderIDs, displayOnCRMFlag, needServiceFlag, actFlag,
+        actSort, actPrice0, actPrice1, actPrice2, actPrice3, actPrice4, actPrice5, actPrice6,
+        actPrice7, actType, actCreateTime, beginTime, endTime, shopIndexModuleID, onlineTime,
+        downlineTime, freePostFlag, crmBigTypeId, crmSmallTypeId, costPrice, costProportional,
+        costCheckFlag, precisehKey, docBoost, cmbeanFlag, cmbeanPrice, cmbeanSort, actBuyGiftNum,
+        actFullGiftAmount, actFullReduceAmount, actReduceAmount, visibility, surplusTime,
+        endTimeStr, priceType, tags, recommendType, machineType
+    </sql>
+    <sql id="ProductDetail_Column_List">
+        productDetailInfoID, productID, propValueAlias, propValueImages, detailInfo, detailInfoTxt,
+        seoTitle, seoKeyword, seoDes, serviceInfo, orderInfo
+    </sql>
+    <sql id="LadderPrice_Column_List">
+        id, productId, userType, ladderNum, buyNum, buyPrice, createBy, createDate, updateBy,
+        updateDate, delFlag
+    </sql>
+    <sql id="Image_Column_List">
+        productImageID, productID, shopID, addTime, image, mainFlag, sortIndex
+    </sql>
+    <sql id="Shop_Column_List">
+        shopID, userID, `name`, sname, nameEn, site, ledgerNo, logo, rebateAmount, `level`,
+        score, productCount, legalPerson, businessLicense, businessLicenseImage, taxCertificate,
+        taxCertificateImage, provinceID, cityID, townID, address, registeredCapital, nature,
+        turnover, linkMan, contractPhone, contractMobile, fax, zipCode, linkMan1, duty1,
+        contractPhone1, contractMobile1, contractQQ1, wechat1, contractEmail1, linkMan2,
+        duty2, contractPhone2, contractMobile2, contractQQ2, wechat2, contractEmail2, `scope`,
+        info, productDesc, lng, lat, addTime, auditStatus, auditTime, auditNote, favoriteTimes,
+        validFlag, payFlag1, auditFlag1, payFlag2, auditFlag2, payFlag3, auditFlag3, note,
+        `status`, sortIndex, rate1, rate2, masterFlag, erpFlag, shopSecret, masterLogo, cooperateFlag,
+        bail, businessScope, socialCreditCode, mainpro, firstShopType, secondShopType, medicalPracticeLicenseImg1,
+        medicalPracticeLicenseImg2, medicalPracticeLicenseImg3, bankAccount, bankAccountName,
+        bankName, ableRebateAmount
+    </sql>
+    <select id="getBigType" resultType="com.caimei.module.product.entity.vo.BigtypeVo">
+        select
+        <include refid="BigType_Column_List" />
+        from bigtype
+    </select>
+    <select id="getSmallType" resultType="com.caimei.module.product.entity.vo.SmalltypeVo">
+        select
+        <include refid="SmallType_Column_List" />
+        from smalltype
+        where bigTypeID = #{bigTypeID,jdbcType=INTEGER}
+    </select>
+    <select id="getTinytype" resultType="com.caimei.module.product.entity.vo.TinytypeVo">
+        select
+        <include refid="Tinytype_Column_List" />
+        from tinytype
+        where smallTypeID = #{smallTypeID,jdbcType=INTEGER}
+    </select>
+    <!-- sortType (3:价格升序, 4:价格降序, 7:人气, 8:销量) -->
+    <select id="getProductsByTinyType" resultType="com.caimei.module.product.entity.vo.ProductVo" parameterType="java.lang.Integer">
+        select
+        <include refid="Product_Column_List" />
+        from product
+        where validFlag = 2
+        and tinyTypeID = #{tinyTypeID,jdbcType=INTEGER}
+        <choose>
+            <when test="sortType == 3">
+                order by price1 asc
+            </when>
+            <when test="sortType == 4">
+                order by price1 desc
+            </when>
+            <when test="sortType == 7">
+                order by favoriteTimes desc
+            </when>
+            <when test="sortType == 8">
+                order by sellNumber desc
+            </when>
+            <otherwise>
+                order by onlineTime desc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="searchProduct" resultType="com.caimei.module.product.entity.vo.ProductVo">
+        select
+        *
+        from product
+        where validFlag = 2
+        and name like CONCAT('%',#{searchWord,jdbcType=VARCHAR},'%')
+    </select>
+    <select id="findProductById" resultType="com.caimei.module.product.entity.vo.ProductVo">
+        select
+        <include refid="Product_Column_List" />
+        from product
+        where validFlag in (2,3)
+        and productId = #{productId,jdbcType=BIGINT}
+    </select>
+    <select id="getSearchHistoryList" resultType="com.caimei.module.product.entity.vo.SearchHistoryVo">
+        select id, userId, searchWord, searchDate, delFlag
+        from user_search_history
+        where userId = #{userId,jdbcType=BIGINT}
+    </select>
+    <select id="getSearchHistoryIdByWord" resultType="java.lang.Long">
+        select id
+        from user_search_history
+        where searchWord = #{searchWord,jdbcType=VARCHAR}
+        limit 1
+    </select>
+    <select id="findLowerLadderPrice" resultType="com.caimei.module.product.entity.vo.LadderPriceVo">
+        select
+        <include refid="LadderPrice_Column_List" />
+        from product_ladder_price
+        WHERE delFlag = '0'
+          AND productId = #{productId,jdbcType=BIGINT}
+        ORDER BY ladderNum DESC
+        LIMIT 1
+    </select>
+    <select id="findProductImage" resultType="com.caimei.module.product.entity.vo.ProductImageVo">
+        select
+        <include refid="Image_Column_List" />
+        from productimage
+        where productID = #{productID,jdbcType=INTEGER}
+        ORDER BY mainFlag DESC
+    </select>
+    <select id="findProductDetailById" resultType="com.caimei.module.product.entity.vo.ProductDetailVo">
+        select
+        <include refid="ProductDetail_Column_List" />
+        from productdetailinfo
+        where productId = #{productId,jdbcType=BIGINT}
+    </select>
+    <select id="findProductShopById" resultType="com.caimei.module.product.entity.vo.ShopVo">
+        SELECT
+        <include refid="Shop_Column_List" />
+        FROM shop
+        where shopID = #{shopID,jdbcType=INTEGER}
+    </select>
+    <!--新品上线(001) 优惠商品(010) 常用商品(100),三者同时存在111-->
+    <select id="getProductsByPreferredFlag" resultType="com.caimei.module.product.entity.vo.ProductVo">
+        select
+        <include refid="Product_Column_List" />
+        from product
+        where validFlag = 2
+        <if test="preferredFlag == 100">
+            and preferredFlag in (100,101,110,111)
+        </if>
+        <if test="preferredFlag == 10">
+            and preferredFlag in (10,11,110,111)
+        </if>
+        <if test="preferredFlag == 1">
+            and preferredFlag in (1,11,101,111)
+        </if>
+    </select>
+    <update id="updateSearchHistoryById" parameterType="com.caimei.module.product.entity.vo.SearchHistoryVo">
+        update user_search_history
+        <set>
+          <if test="userId != null">
+            userId = #{userId,jdbcType=BIGINT},
+          </if>
+          <if test="searchWord != null">
+            searchWord = #{searchWord,jdbcType=VARCHAR},
+          </if>
+          <if test="searchDate != null">
+            searchDate = #{searchDate,jdbcType=TIMESTAMP},
+          </if>
+          <if test="delFlag != null">
+            delFlag = #{delFlag,jdbcType=VARCHAR},
+          </if>
+        </set>
+        where id = #{id,jdbcType=BIGINT}
+    </update>
+    <insert id="insertSearchHistory" keyColumn="id" keyProperty="id" parameterType="com.caimei.module.product.entity.vo.SearchHistoryVo">
+        insert into user_search_history
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+          <if test="userId != null">
+            userId,
+          </if>
+          <if test="searchWord != null">
+            searchWord,
+          </if>
+          <if test="searchDate != null">
+            searchDate,
+          </if>
+          <if test="delFlag != null">
+            delFlag,
+          </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+          <if test="userId != null">
+            #{userId,jdbcType=BIGINT},
+          </if>
+          <if test="searchWord != null">
+            #{searchWord,jdbcType=VARCHAR},
+          </if>
+          <if test="searchDate != null">
+            #{searchDate,jdbcType=TIMESTAMP},
+          </if>
+          <if test="delFlag != null">
+            #{delFlag,jdbcType=VARCHAR},
+          </if>
+        </trim>
+    </insert>
+    <!--删除大于10条的历史记录-->
+    <delete id="deleteSearchHistoryByUserId" parameterType="java.lang.Long">
+        DELETE tb FROM user_search_history AS tb,(
+            SELECT id FROM user_search_history
+            WHERE userId=#{userId,jdbcType=BIGINT}
+            ORDER BY id DESC
+            LIMIT 1,10
+        ) AS temp
+        WHERE userId=#{userId,jdbcType=BIGINT}
+        AND (temp.id > tb.id)
+    </delete>
+    <select id="findLadderPrice" resultType="com.caimei.module.product.entity.vo.LadderPriceVo">
+        SELECT
+          <include refid="LadderPrice_Column_List" />
+        FROM
+          product_ladder_price
+        WHERE
+          productId = #{productID}
+          AND userType = '3'
+          AND delFlag = '0'
+        ORDER BY
+          ladderNum ASC
+    </select>
+    <select id="getRecommendIds" resultType="java.lang.Integer">
+        SELECT recommendProductID FROM cm_product_recommend WHERE productID=#{productID}  ORDER BY sort ASC
+    </select>
+    <select id="getRecommendByIds" resultType="com.caimei.module.product.entity.vo.ProductVo">
+        SELECT
+          <include refid="Product_Column_List"/>
+        FROM
+          product
+        WHERE
+          validFlag = '2'
+          AND productID IN
+          <foreach collection="list" close="(" separator="," open=")" item="productID">
+              #{productIDs}
+          </foreach>
+    </select>
+    <select id="getDeFaultRecommend" resultType="com.caimei.module.product.entity.vo.ProductVo">
+        select
+        <include refid="Product_Column_List" />
+        from product
+        where validFlag = 2
+        and tinyTypeID = #{tinyTypeID}
+        order by sellNumber desc,onlineTime desc
+        limit 7
+    </select>
+</mapper>