Browse Source

Merge remote-tracking branch 'remotes/origin/developer' into developerA

Aslee 3 years ago
parent
commit
5665ded5be
35 changed files with 610 additions and 139 deletions
  1. 2 2
      src/main/java/com/caimei365/commodity/components/SearchOpenService.java
  2. 20 0
      src/main/java/com/caimei365/commodity/controller/ProductPageApi.java
  3. 13 0
      src/main/java/com/caimei365/commodity/controller/SearchIndexApi.java
  4. 7 0
      src/main/java/com/caimei365/commodity/controller/SecondHandApi.java
  5. 32 0
      src/main/java/com/caimei365/commodity/mapper/AnnouncementMapper.java
  6. 7 4
      src/main/java/com/caimei365/commodity/mapper/SecondHandMapper.java
  7. 1 0
      src/main/java/com/caimei365/commodity/mapper/ShopMapper.java
  8. 30 2
      src/main/java/com/caimei365/commodity/model/dto/SecondDto.java
  9. 29 0
      src/main/java/com/caimei365/commodity/model/po/AnnouncementPo.java
  10. 17 2
      src/main/java/com/caimei365/commodity/model/po/ProductSecondPo.java
  11. 2 0
      src/main/java/com/caimei365/commodity/model/search/ProductDO.java
  12. 4 0
      src/main/java/com/caimei365/commodity/model/search/ProductListVo.java
  13. 2 0
      src/main/java/com/caimei365/commodity/model/vo/CombinationVo.java
  14. 4 0
      src/main/java/com/caimei365/commodity/model/vo/ProductDetailVo.java
  15. 1 0
      src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java
  16. 11 3
      src/main/java/com/caimei365/commodity/model/vo/SecondDetailVo.java
  17. 4 0
      src/main/java/com/caimei365/commodity/model/vo/ShopVo.java
  18. 11 0
      src/main/java/com/caimei365/commodity/service/PageService.java
  19. 26 4
      src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java
  20. 9 4
      src/main/java/com/caimei365/commodity/service/impl/SearchIndexServiceImpl.java
  21. 85 14
      src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java
  22. 6 0
      src/main/java/com/caimei365/commodity/utils/AppletsLinkUtil.java
  23. 1 1
      src/main/java/com/caimei365/commodity/utils/ImageUtils.java
  24. 2 0
      src/main/java/com/caimei365/commodity/utils/Json2PojoUtil.java
  25. 145 0
      src/main/java/com/caimei365/commodity/utils/ValidateUtil.java
  26. 27 0
      src/main/resources/mapper/AnnouncementMapper.xml
  27. 5 3
      src/main/resources/mapper/CouponMapper.xml
  28. 23 17
      src/main/resources/mapper/PageMapper.xml
  29. 9 5
      src/main/resources/mapper/PriceMapper.xml
  30. 5 3
      src/main/resources/mapper/PromotionsMapper.xml
  31. 1 0
      src/main/resources/mapper/SearchMapper.xml
  32. 21 4
      src/main/resources/mapper/SecondHandMapper.xml
  33. 36 34
      src/main/resources/mapper/SellerMapper.xml
  34. 9 35
      src/main/resources/mapper/ShopMapper.xml
  35. 3 2
      src/main/resources/mapper/UserLikeMapper.xml

+ 2 - 2
src/main/java/com/caimei365/commodity/components/SearchOpenService.java

@@ -224,7 +224,7 @@ public class SearchOpenService {
         config.setStart(num - 1);
         config.setHits(size);
         // 设置搜索结果返回应用中哪些字段
-        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id"));
+        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type"));
         // 注意:config子句中的rerank_size参数,在Rank类对象中设置
         // 设置返回格式为json格式
         config.setSearchFormat(SearchFormat.JSON);
@@ -336,7 +336,7 @@ public class SearchOpenService {
         // config.setStart(0) scroll该参数不起作用,默认为0
         config.setHits(size);
         // 设置搜索结果返回应用中哪些字段
-        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id"));
+        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type"));
         // 设置返回格式为json格式
         config.setSearchFormat(SearchFormat.JSON);
         // 创建参数对象

+ 20 - 0
src/main/java/com/caimei365/commodity/controller/ProductPageApi.java

@@ -2,6 +2,7 @@ package com.caimei365.commodity.controller;
 
 import com.caimei365.commodity.annotation.Statistics;
 import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.po.AnnouncementPo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.*;
@@ -95,6 +96,25 @@ public class ProductPageApi {
     public ResponseJson<Map<String, Object>> getHomeInit(Integer source) {
         return pageService.getHomeInit(source);
     }
+    @ApiOperation("公告展示列表")
+    @ApiImplicitParam(required = false, name = "source", value = "来源:1网站,2小程序")
+    @GetMapping("/home/title")
+    ResponseJson<PaginationVo<AnnouncementPo>> getannlist(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                          @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return pageService.getannlist(pageNum, pageSize);
+    }
+
+    @ApiOperation("公告展示内容页面")
+    @GetMapping("/home/capacity")
+    public ResponseJson<AnnouncementPo> getcapacity(Integer id) {
+        if (id == null || id==0) {
+            return ResponseJson.error("参数异常", null);
+        }
+        return pageService.getcapacity(id);
+    }
+
+
+
 
     /**
      * 首页侧边栏数据(小程序)

+ 13 - 0
src/main/java/com/caimei365/commodity/controller/SearchIndexApi.java

@@ -105,6 +105,19 @@ public class SearchIndexApi {
         return searchIndexService.updateProductIndexById(updateIndexDto.getProductId());
     }
 
+    /**
+     * 根据多个商品Id更新
+     */
+    @ApiOperation("根据多个商品Id更新")
+    @PostMapping("/update/products")
+    public ResponseJson updateProductsIndex(String productIds) {
+        String[] productIdArr = productIds.split(",");
+        for (String productId : productIdArr) {
+            searchIndexService.updateProductIndexById(Integer.parseInt(productId));
+        }
+        return ResponseJson.success();
+    }
+
     /**
      * 根据供应商Id更新
      *

+ 7 - 0
src/main/java/com/caimei365/commodity/controller/SecondHandApi.java

@@ -91,6 +91,13 @@ public class SecondHandApi {
      *                  ,"image" : 图片信息
      *                  ,"productDetails" : 商品详细信息
      *                  ,"source" : 信息来源 1网站  2CRM  3后台
+     *                  ,"publishIdentity" :  发布者身份  1个人身份,2公司身份
+     *                  ,"licenseImage" : 营业执照照片
+     *                  ,"fileType" : 商品包含的文件类型,1,仪器原始合同,2,仪器注册证,3,仪器发票,4,仪器报关单,5,无任何文件'
+     *                  (fileType字符串逗号拼接)
+     *                  ,"checkCode" : 验证码
+     *                  ,"authenticationBackImage" : 身份证背面照片
+     *                  ,"cardNumber" : 收款卡号
      *                  }
      * @param headers   HttpHeaders
      */

+ 32 - 0
src/main/java/com/caimei365/commodity/mapper/AnnouncementMapper.java

@@ -0,0 +1,32 @@
+package com.caimei365.commodity.mapper;
+
+
+import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.po.AnnouncementPo;
+import org.apache.ibatis.annotations.Mapper;
+
+
+import java.util.List;
+
+@Mapper
+public interface AnnouncementMapper {
+
+    /**
+     * 查找公告列表头两个
+     * @return
+     */
+   List<AnnouncementPo> gteannhade();
+
+    /**
+     * 查找公告列表
+     * @return
+     */
+    List<AnnouncementPo> getannlist();
+
+    /**
+     * 根据id查找公告内容
+     * @return
+     */
+   AnnouncementPo getcapacity(Integer id);
+
+}

+ 7 - 4
src/main/java/com/caimei365/commodity/mapper/SecondHandMapper.java

@@ -3,10 +3,7 @@ package com.caimei365.commodity.mapper;
 import com.caimei365.commodity.model.po.ProductImagePo;
 import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.po.ProductSecondPo;
-import com.caimei365.commodity.model.vo.AddressVo;
-import com.caimei365.commodity.model.vo.BrandVo;
-import com.caimei365.commodity.model.vo.SecondDetailVo;
-import com.caimei365.commodity.model.vo.SecondListVo;
+import com.caimei365.commodity.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -94,4 +91,10 @@ public interface SecondHandMapper {
      * 二手商品-相关推荐
      */
     List<SecondListVo> getSecondRecommends(Integer productId);
+
+    void insertSecondFileType(String fileType,Integer secondId,Integer productId);
+
+    Integer findSecondShop(String cardNumber);
+
+    void insertShop(ShopVo shopVo);
 }

+ 1 - 0
src/main/java/com/caimei365/commodity/mapper/ShopMapper.java

@@ -159,4 +159,5 @@ public interface ShopMapper {
      * 获取供应商名称
      */
     String getShopNameByShopId(Integer shopId);
+
 }

+ 30 - 2
src/main/java/com/caimei365/commodity/model/dto/SecondDto.java

@@ -16,6 +16,34 @@ import java.io.Serializable;
 @Data
 public class SecondDto implements Serializable {
     private static final long serialVersionUID = 1L;
+    @ApiModelProperty("收款卡号")
+    private String cardNumber;
+    /**
+     * 验证码
+     */
+    @ApiModelProperty("二手发布验证码")
+    private String checkCode;
+    /**
+     * 商品包含的文件类型,1,仪器原始合同,2,仪器注册证,3,仪器发票,4,仪器报关单,5,无任何文件'
+     *  (fileType字符串逗号拼接)
+     */
+    @ApiModelProperty("商品包含的文件类型,1,仪器原始合同,2,仪器注册证,3,仪器发票,4,仪器报关单,5,无任何文件;字符串逗号拼接")
+    private String fileType;
+    /**
+     * 发布者身份  1个人身份,2公司身份
+     */
+    @ApiModelProperty("发布者身份  1个人身份,2公司身份")
+    private Integer publishIdentity;
+    /**
+     * 身份证背面照片
+     */
+    @ApiModelProperty("身份证背面照片")
+    private String authenticationBackImage;
+    /**
+     * 营业执照照片
+     */
+    @ApiModelProperty("营业执照照片")
+    private String licenseImage;
     /**
      * 二手商品分类,1二手仪1器,2临期产品,3其他
      */
@@ -25,7 +53,7 @@ public class SecondDto implements Serializable {
      * 二手仪器分类的类型,1轻光电、2重光电、3耗材配件(仅适用于二手仪器分类多个用英文逗号分分隔)
      */
     @ApiModelProperty("二手仪器分类的类型,1轻光电、2重光电、3耗材配件")
-    private String instrumentType;
+    private Integer instrumentType;
     /**
      * 品牌Id
      */
@@ -100,7 +128,7 @@ public class SecondDto implements Serializable {
      * 设备类型:1医美、2非医美
      */
     @ApiModelProperty("设备类型:1医美、2非医美")
-    private String secondProductType;
+    private Integer secondProductType;
     /**
      * 商品详情信息(补充信息)
      */

+ 29 - 0
src/main/java/com/caimei365/commodity/model/po/AnnouncementPo.java

@@ -0,0 +1,29 @@
+package com.caimei365.commodity.model.po;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AnnouncementPo {
+
+    private int id;
+    //标题
+    private String title;
+    //内容
+    private String capacity;
+    //状态1为上线2为下线
+    private String state;
+    //创建时间
+    @JsonFormat(pattern = "yyyy年MM月dd日")
+    private Date creationtime;
+    //上线时间
+    @JsonFormat(pattern = "yyyy年MM月dd日")
+    private Date livetime;
+    //下线时间
+    @JsonFormat(pattern = "yyyy年MM月dd日")
+    private Date  offlinetime;
+
+}

+ 17 - 2
src/main/java/com/caimei365/commodity/model/po/ProductSecondPo.java

@@ -26,7 +26,7 @@ public class ProductSecondPo implements Serializable {
     /**
      * 二手仪器分类的类型,1轻光电、2重光电、3耗材配件(仅适用于二手仪器分类多个用英文逗号分分隔)
      */
-    private String instrumentType;
+    private Integer instrumentType;
     /**
      * 品牌Id
      */
@@ -86,7 +86,7 @@ public class ProductSecondPo implements Serializable {
     /**
      * 设备类型:1医美、2非医美
      */
-    private String secondProductType;
+    private Integer secondProductType;
     /**
      * 商品详情信息(补充信息)
      */
@@ -180,5 +180,20 @@ public class ProductSecondPo implements Serializable {
      * 出让承诺函图片
      */
     private String commitmentImage;
+    /**
+     * 发布者身份  1个人身份,2公司身份
+     */
+    @ApiModelProperty("发布者身份  1个人身份,2公司身份")
+    private Integer publishIdentity;
+    /**
+     * 身份证背面照片
+     */
+    @ApiModelProperty("身份证背面照片")
+    private String authenticationBackImage;
+    /**
+     * 营业执照照片
+     */
+    @ApiModelProperty("营业执照照片")
+    private String licenseImage;
 
 }

+ 2 - 0
src/main/java/com/caimei365/commodity/model/search/ProductDO.java

@@ -74,5 +74,7 @@ public class ProductDO implements Serializable {
     private Integer p_time;
 
     private Integer p_promotions_id;
+    /**商品类型:0其它类型(默认),1妆字号,2械字号 */
+    private Integer p_product_type;
     private static final long serialVersionUID = 1L;
 }

+ 4 - 0
src/main/java/com/caimei365/commodity/model/search/ProductListVo.java

@@ -76,6 +76,10 @@ public class ProductListVo implements Serializable {
      * 活动状态:1有效,0失效
      */
     private Integer actStatus;
+    /**
+     * 商品类型:1妆字号,2械字号
+     */
+    private Integer productType;
 
     private static final long serialVersionUID = 1L;
 

+ 2 - 0
src/main/java/com/caimei365/commodity/model/vo/CombinationVo.java

@@ -46,4 +46,6 @@ public class CombinationVo implements Serializable {
 	 * 组合里面选中的商品总金额
 	 */
 	private BigDecimal productTotalAmount;
+
+	private Integer productType;
 }

+ 4 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductDetailVo.java

@@ -33,6 +33,10 @@ public class ProductDetailVo implements Serializable {
      * 所属供应商Id
      */
     private Integer shopId;
+    /**
+     * 特殊供应商标识:正常供应商1,新品供应商2,二手供应商3
+     */
+    private Integer shopType;
     /**
      * 商品名称
      */

+ 1 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java

@@ -79,6 +79,7 @@ public class ProductItemVo implements Serializable {
      * 成本价选中标志:1固定成本 2比例成
      */
     private Integer costCheckFlag;
+
     /**
      * 固定成本价
      */

+ 11 - 3
src/main/java/com/caimei365/commodity/model/vo/SecondDetailVo.java

@@ -15,6 +15,14 @@ import java.util.List;
 @Data
 public class SecondDetailVo implements Serializable {
     private static final long serialVersionUID = 1L;
+    /**
+     * 公司名称
+     */
+    private String companyName;
+    /**
+     * 发布者身份
+     */
+    private Integer publishIdentity;
     /**
      * 商品productID
      */
@@ -76,15 +84,15 @@ public class SecondDetailVo implements Serializable {
     /**
      * 商品类型:0其它类型(默认),1妆字号,2械字号
      */
-    private String productType;
+    private Integer productType;
     /**
      * 二手商品分类,1二手仪1器,2临期产品,3其他
      */
-    private String secondHandType;
+    private Integer secondHandType;
     /**
      * 二手仪器分类的类型,1轻光电、2重光电、3耗材配件(仅适用于二手仪器分类多个用英文逗号分分隔)
      */
-    private String instrumentType;
+    private Integer instrumentType;
     /**
      * 商品类型(二手仪器-重光电)
      */

+ 4 - 0
src/main/java/com/caimei365/commodity/model/vo/ShopVo.java

@@ -13,6 +13,10 @@ import java.util.List;
  */
 @Data
 public class ShopVo implements Serializable {
+    /**
+     * 银行卡号
+     */
+    private String cardNumber;
     /**
      * 用户ID
      */

+ 11 - 0
src/main/java/com/caimei365/commodity/service/PageService.java

@@ -1,6 +1,7 @@
 package com.caimei365.commodity.service;
 
 import com.caimei365.commodity.model.ResponseJson;
+import com.caimei365.commodity.model.po.AnnouncementPo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.*;
@@ -138,6 +139,16 @@ public interface PageService {
      * @param userId        用户Id
      */
     ResponseJson<List<ProductListVo>> getProductDetailRecommends(Integer productId, Integer recommendType, Integer userId);
+    //公告展示
+    ResponseJson<PaginationVo<AnnouncementPo>> getannlist(int pageNum, int pageSize);
+
+    /**
+     * 公告展示-公告详细内容
+     *
+     * @param  id 公告列表Id
+     */
+    ResponseJson<AnnouncementPo> getcapacity(Integer id);
+
 
     /**
      * 商品维修(链接分享数据)

+ 26 - 4
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -37,7 +37,8 @@ import java.util.stream.Collectors;
 public class PageServiceImpl implements PageService {
     @Value("${caimei.wwwDomain}")
     private String domain;
-
+    @Resource
+    private AnnouncementMapper announcementMapper;
     @Resource
     private UserLikeMapper likeMapper;
     @Resource
@@ -246,6 +247,8 @@ public class PageServiceImpl implements PageService {
         } else {
             map.put("couponEntry", 2);
         }
+       List<AnnouncementPo>annlist= announcementMapper.gteannhade();
+        map.put("annlist",annlist);
         return ResponseJson.success(map);
     }
 
@@ -611,9 +614,9 @@ public class PageServiceImpl implements PageService {
             // 没有权限查看该商品
             if (!(pass1 || pass2 || pass3 || pass4 || pass5)) {
                 return ResponseJson.success(1, "没有权限查看该商品", new ProductDetailVo());
-            }
-        } else if (2 == visibility || 1 == visibility || 4 == visibility) {
-            return ResponseJson.success(1, "没有权限查看该商品,userId为空", new ProductDetailVo());
+            }//|| 4 == visibility
+        } else if (2 == visibility || 1 == visibility) {
+            return ResponseJson.success(1, "没有权限查看该商品", new ProductDetailVo());
         }
         // 商品不处于已删除/待审核/审核未通过的状态
         if (0 != product.getValidFlag()) {
@@ -833,6 +836,25 @@ public class PageServiceImpl implements PageService {
         return ResponseJson.success(list);
     }
 
+    @Override
+    public ResponseJson<PaginationVo<AnnouncementPo>> getannlist(int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<AnnouncementPo>list= announcementMapper.getannlist();
+        PaginationVo<AnnouncementPo> pageData = new PaginationVo(list);
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 公告展示-公告详细内容
+     *
+     * @param id 公告列表Id
+     */
+    @Override
+    public ResponseJson<AnnouncementPo> getcapacity(Integer id) {
+        AnnouncementPo announcementPo= announcementMapper.getcapacity(id);
+        return ResponseJson.success(announcementPo);
+    }
+
     /**
      * 商品维修(链接分享数据)
      *

+ 9 - 4
src/main/java/com/caimei365/commodity/service/impl/SearchIndexServiceImpl.java

@@ -954,20 +954,25 @@ public class SearchIndexServiceImpl implements SearchIndexService {
             PageHelper.startPage(i, 50);
             // 获取失效商品IDs
             List<Integer> invalidIds = searchMapper.findArticleInvalidIds();
-            // 删除文档只需要设置需删除文档主键值即可
-            Map<String, Object> deleteDoc = Maps.newLinkedHashMap();
+            JSONArray docsJsonArr = new JSONArray();
             for (Integer invalidId : invalidIds) {
+                // 删除文档只需要设置需删除文档主键值即可
+                Map<String, Object> deleteDoc = Maps.newLinkedHashMap();
                 // 根据ID(主键)删除文档
                 deleteDoc.put("a_id", invalidId);
                 Integer mainId = searchQueryService.getIdByDocId("article", invalidId);
                 if (mainId > -1) {
                     deleteDoc.put("id", mainId);
                 }
+                //此处设置删除文档处理
+                JSONObject deleteJson = new JSONObject();
+                deleteJson.put(DocumentConstants.DOC_KEY_CMD, Command.DELETE.toString());
+                deleteJson.put(DocumentConstants.DOC_KEY_FIELDS, deleteDoc);
+                docsJsonArr.put(deleteJson);
             }
             try {
-                String deleteJsonStr = setDeleteDocument(deleteDoc);
                 // 推送到阿里云
-                String deleteResult = searchOpenService.pushDocument(deleteJsonStr, "search_article");
+                String deleteResult = searchOpenService.pushDocument(docsJsonArr.toString(), "search_article");
                 log.info("删除文档:" + deleteResult);
             } catch (OpenSearchClientException | OpenSearchException | JSONException e) {
                 log.warn("删除文档异常:" + e);

+ 85 - 14
src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java

@@ -11,6 +11,7 @@ import com.caimei365.commodity.model.po.ProductSecondPo;
 import com.caimei365.commodity.model.vo.*;
 import com.caimei365.commodity.service.SecondHandService;
 import com.caimei365.commodity.utils.ImageUtils;
+import com.caimei365.commodity.utils.ValidateUtil;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -43,6 +44,8 @@ public class SecondHandServiceImpl implements SecondHandService {
     private RedisService redisService;
     @Resource
     private PriceMapper priceMapper;
+    @Value("${spring.cloud.config.profile}")
+    private String profile;
 
     /**
      * 二手商品列表
@@ -64,7 +67,7 @@ public class SecondHandServiceImpl implements SecondHandService {
             if (null != userIdentity && userIdentity == 2) {
                 // 会员机构类型:1医美,2生美
                 Integer clubType = priceMapper.getClubTypeById(userId);
-                if (null != clubType && clubType == 1){
+                if (null != clubType && clubType == 1) {
                     userIdentity = 5;
                 }
             }
@@ -159,17 +162,17 @@ public class SecondHandServiceImpl implements SecondHandService {
         second.setImageList(images);
         // 初始商品分类
         String typeStr = "";
-        String secondHandType = second.getSecondHandType();
-        if ("1".equals(secondHandType)) {
+        Integer secondHandType = second.getSecondHandType();
+        if (1 == secondHandType) {
             typeStr += "二手仪器";
-        } else if ("2".equals(secondHandType)) {
+        } else if (2 == secondHandType) {
             typeStr += "临期产品";
         } else {
             typeStr += "其他";
         }
         // 二手仪器分类
-        String instrumentType = second.getInstrumentType();
-        if ("1".equals(instrumentType)) {
+        Integer instrumentType = second.getInstrumentType();
+        if (1 == instrumentType) {
             typeStr += "-美容仪器";
         }
         second.setTypeStr(typeStr);
@@ -201,11 +204,39 @@ public class SecondHandServiceImpl implements SecondHandService {
      *                  ,"image" : 图片信息
      *                  ,"productDetails" : 商品详细信息
      *                  ,"source" : 信息来源 1网站  2CRM  3后台
+     *                  ,"publishIdentity" :  发布者身份  1个人身份,2公司身份
+     *                  ,"licenseImage" : 营业执照照片
+     *                  ,"fileType" : 商品包含的文件类型,1,仪器原始合同,2,仪器注册证,3,仪器发票,4,仪器报关单,5,无任何文件'
+     *                  (fileType字符串逗号拼接)
+     *                  ,"checkCode" : 验证码
+     *                  ,"authenticationBackImage" : 身份证背面照片
+     *                  ,"cardNumber" : 收款卡号
      *                  }
      * @param headers   HttpHeaders
      */
     @Override
     public ResponseJson releaseSecondHand(SecondDto secondDto, HttpHeaders headers) {
+        //校验手机号
+        String contactMobile = secondDto.getContactMobile();
+        String result = ValidateUtil.validateMobile(contactMobile);
+        if (result != null) {
+            return ResponseJson.error("参数异常:联系方式不正确");
+        }
+        //校验验证码
+        String checkCode = secondDto.getCheckCode();
+        if (StringUtils.isBlank(checkCode)) {
+            return ResponseJson.error("参数异常:请输入验证码");
+        }
+        if (StringUtils.isNotBlank(checkCode)) {
+            String redisSmsCode = (String) redisService.get("code:" + contactMobile);
+            // 开发 和 测试环境 固定短信验证码 666666
+            if ("dev".equals(profile) || "beta".equals(profile)) {
+                redisSmsCode = (null != redisSmsCode && !"null".equals(redisSmsCode) ? redisSmsCode : "666666");
+            }
+            if (!checkCode.equals(redisSmsCode)) {
+                return ResponseJson.error("参数异常:手机验证码错误");
+            }
+        }
         // 打印IP
         String ip = headers.getFirst("X-CLIENT-IP");
         log.info("发布二手商品 X-CLIENT-IP : " + ip);
@@ -227,7 +258,7 @@ public class SecondHandServiceImpl implements SecondHandService {
         }
         // 验证传入参数
         String secondHandType = secondDto.getSecondHandType();
-        String instrumentType = secondDto.getInstrumentType();
+        Integer instrumentType = secondDto.getInstrumentType();
         Integer brandId = secondDto.getBrandId();
         String name = secondDto.getName();
         Double price = secondDto.getPrice();
@@ -236,18 +267,29 @@ public class SecondHandServiceImpl implements SecondHandService {
         Integer stock = secondDto.getStock();
         String productQuality = secondDto.getProductQuality();
         String contactName = secondDto.getContactName();
-        String contactMobile = secondDto.getContactMobile();
         String source = secondDto.getSource();
         Integer townId = secondDto.getTownId();
         String address = secondDto.getAddress();
+        String cardNumber = secondDto.getCardNumber();
         // 此图片为逗号隔开的多张数据
         String image = secondDto.getImage();
         String maturityYears = secondDto.getMaturityYears();
-
+        Integer publishIdentity = secondDto.getPublishIdentity();
+        String companyName = secondDto.getCompanyName();
+        String fileType = secondDto.getFileType();
+        if (2 == publishIdentity && StringUtils.isBlank(companyName)) {
+            return ResponseJson.error("参数异常:发布身份为公司身份时,公司名称不能为空");
+        }
+        if (null == publishIdentity || publishIdentity <= 0) {
+            return ResponseJson.error("参数异常:请选择发布者身份");
+        }
+        if (StringUtils.isEmpty(fileType)) {
+            return ResponseJson.error("参数异常:请选择包含的文件类型");
+        }
         if (StringUtils.isEmpty(secondHandType)) {
             return ResponseJson.error("参数异常:请选择分类");
         } else if (StringUtils.equals("1", secondHandType)) {
-            if (StringUtils.isEmpty(instrumentType)) {
+            if (null == instrumentType) {
                 return ResponseJson.error("参数异常:请完善仪器分类");
             }
         } else if (StringUtils.equals("2", secondHandType)) {
@@ -277,9 +319,6 @@ public class SecondHandServiceImpl implements SecondHandService {
         if (StringUtils.isEmpty(contactName)) {
             return ResponseJson.error("参数异常:请输入联系人姓名");
         }
-        if (StringUtils.isEmpty(contactMobile)) {
-            return ResponseJson.error("参数异常:请输入联系方式");
-        }
         if (null == townId) {
             return ResponseJson.error("参数异常:请完善联系地址");
         }
@@ -295,6 +334,9 @@ public class SecondHandServiceImpl implements SecondHandService {
         if (StringUtils.isEmpty(source)) {
             return ResponseJson.error("参数异常:请输入发布来源");
         }
+        if (StringUtils.isBlank(cardNumber)) {
+            return ResponseJson.error("参数异常:请输入收款卡号");
+        }
         // 保存二手商品
         return saveSecondHandProduct(secondDto);
     }
@@ -349,6 +391,20 @@ public class SecondHandServiceImpl implements SecondHandService {
     }
 
     private ResponseJson saveSecondHandProduct(SecondDto secondDto) {
+        //根据银行卡判断是否注册过特殊二手供应商,有则挂在之前的供应商名下,否则注册新供应商
+        Integer shopId = secondHandMapper.findSecondShop(secondDto.getCardNumber());
+        if (null == shopId || shopId <= 0) {
+            //保存为特殊二手供应商
+            ShopVo shopVo = new ShopVo();
+            //1个人,2公司
+            String name = 1 == secondDto.getPublishIdentity() ? secondDto.getContactName() : secondDto.getCompanyName();
+            shopVo.setName(name);
+            shopVo.setLinkMan(secondDto.getContactName());
+            shopVo.setContractMobile(secondDto.getContactMobile());
+            shopVo.setCardNumber(secondDto.getCardNumber());
+            secondHandMapper.insertShop(shopVo);
+            shopId=shopVo.getShopId();
+        }
         // 设置日期时间格式
         Date date = new Date();
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -368,7 +424,7 @@ public class SecondHandServiceImpl implements SecondHandService {
         product.setProductCategory(2);
         product.setPreferredFlag(0);
         // 默认发布到二手供应商
-        product.setShopId(1252);
+        product.setShopId(shopId);
         product.setSellNumber(secondDto.getStock());
         product.setCostPrice(0d);
         product.setCostCheckFlag(2);
@@ -458,8 +514,22 @@ public class SecondHandServiceImpl implements SecondHandService {
         secondPo.setOssName(secondDto.getOssName());
         secondPo.setAuthenticationImage(secondDto.getAuthenticationImage());
         secondPo.setCommitmentImage(secondDto.getCommitmentImage());
+        //新增字段,用户身份,营业执照,身份证背面
+        secondPo.setPublishIdentity(secondDto.getPublishIdentity());
+        secondPo.setLicenseImage(secondDto.getLicenseImage());
+        secondPo.setAuthenticationBackImage(secondDto.getAuthenticationBackImage());
         /* 保存商品二手附加详细信息 */
         secondHandMapper.saveSencondHandProduct(secondPo);
+        //保存商品包含文件
+        String fileTypes = secondDto.getFileType();
+        if (fileTypes.contains(",")) {
+            String[] split = fileTypes.split(",");
+            for (String fileType : split) {
+                secondHandMapper.insertSecondFileType(fileType, secondPo.getId(), product.getProductId());
+            }
+        } else {
+            secondHandMapper.insertSecondFileType(fileTypes, secondPo.getId(), product.getProductId());
+        }
         return ResponseJson.success(product.getProductId());
     }
 
@@ -490,6 +560,7 @@ public class SecondHandServiceImpl implements SecondHandService {
             return "时间未知";
         }
     }
+
     /**
      * 获取是否在固定天数以内
      *

+ 6 - 0
src/main/java/com/caimei365/commodity/utils/AppletsLinkUtil.java

@@ -150,6 +150,10 @@ public class AppletsLinkUtil {
      * 28认证通推广页
      */
     public static final Pattern pattern44 = Pattern.compile("/attestation.html");
+    /**
+     * 29领券中心
+     */
+    public static final Pattern pattern45 = Pattern.compile("/user/coupon-collection.html");
 
     /**
      * 根据链接判断链接类型
@@ -214,6 +218,8 @@ public class AppletsLinkUtil {
                 return 27;
             } else if (pattern44.matcher(link).find()) {
                 return 28;
+            } else if (pattern45.matcher(link).find()) {
+                return 29;
             } else {
                 return -1;
             }

+ 1 - 1
src/main/java/com/caimei365/commodity/utils/ImageUtils.java

@@ -66,7 +66,7 @@ public class ImageUtils {
 		} else if (dirName.equals("club")) {
 			image = "/img/default/default_club.jpg";
 		} else if (dirName.equals("shopLogo")) {
-			image = "/img/default/suppliver.jpg";
+			image = "/img/default/suppliver.png";
 		}else if (dirName.equals("caiMeiImage")) {
 			image = "/img/default/caiMeiImage.jpg";
 		}else {

+ 2 - 0
src/main/java/com/caimei365/commodity/utils/Json2PojoUtil.java

@@ -54,6 +54,8 @@ public class Json2PojoUtil {
 //            product.setBeautyActFlag(json.getInt("p_act_flag"));
             /* 品牌id*/
             product.setBrandId(json.getInt("p_brand_id"));
+            /** 商品类型:0其它类型(默认),1妆字号,2械字号*/
+            product.setProductType(json.getInt("p_product_type"));
             productList.add(product);
         }
         return productList;

+ 145 - 0
src/main/java/com/caimei365/commodity/utils/ValidateUtil.java

@@ -0,0 +1,145 @@
+package com.caimei365.commodity.utils;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/3/5
+ */
+public class ValidateUtil {
+    /** 手机号码验证格式 */
+    private static final String MOBILE_PATTERN = "^1[1-9]\\d{9}$";
+    /** 邮箱验证格式 */
+    private static final String EMAIL_PATTERN = "^\\s*?(.+)@(.+?)\\s*$";
+    /** 密码验证格式 */
+    private static final String PASSWORD_PATTERN = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$";
+    /** 机构名称验证格式 */
+    private static final String CLUB_NAME_PATTERN = "^[a-zA-Z0-9\u4e00-\u9fa5]{1,200}$";
+    /** 统一社会信用代码验证格式 */
+    private static final String SOCIAL_CREDIT_CODE_PATTERN = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$";
+
+    /**
+     * 验证手机号码格式
+     *
+     * @param mobile 手机号
+     */
+    public static String validateMobile(String mobile) {
+        if (StringUtils.isEmpty(mobile) || StringUtils.isBlank(mobile)) {
+            return "手机号不可为空";
+        } else {
+            Pattern pattern = Pattern.compile(MOBILE_PATTERN);
+            Matcher matcher = pattern.matcher(mobile);
+            if (matcher.matches()) {
+                return null;
+            } else {
+                return "手机号码格式不正确";
+            }
+        }
+    }
+
+    /**
+     * 验证简单的邮箱格式
+     *
+     * @param email 邮箱
+     */
+    public static boolean validateEmail(String email) {
+        if (StringUtils.isEmpty(email) || StringUtils.isBlank(email)) {
+            return false;
+        } else {
+            Pattern pattern = Pattern.compile(EMAIL_PATTERN);
+            Matcher matcher = pattern.matcher(email);
+            return matcher.matches();
+        }
+    }
+
+    /**
+     * 密码验证
+     */
+    public static String validatePassWord(String password) {
+        if (StringUtils.isEmpty(password) || StringUtils.isBlank(password)) {
+            return "密码不可为空";
+        }
+        if (password.length() > 16 || password.length() < 8) {
+            return "密码长度不正确(8-16)";
+        }
+        Pattern pattern = Pattern.compile(PASSWORD_PATTERN);
+        Matcher matcher = pattern.matcher(password);
+        if (matcher.matches()) {
+            return null;
+        } else {
+            return "请输入8-16位字符,需字母数字组合。";
+        }
+    }
+
+    /**
+     * 验证机构名称
+     */
+    public static String validateClubName(String name) {
+        if (StringUtils.isEmpty(name) || StringUtils.isBlank(name)) {
+            return "请填写美容机构名称";
+        } else {
+            Pattern pattern = Pattern.compile(CLUB_NAME_PATTERN);
+            Matcher matcher = pattern.matcher(name);
+            if (matcher.matches()) {
+                return null;
+            } else {
+                return "机构名称格式不正确";
+            }
+        }
+    }
+
+    /**
+     * 统一社会信用代码验证
+     */
+    public static String validateSocialCreditCode(String socialCreditCode) {
+        if (StringUtils.isEmpty(socialCreditCode) || StringUtils.isBlank(socialCreditCode)) {
+            return "请输入您的统一社会信用代码";
+        } else {
+            Pattern pattern = Pattern.compile(SOCIAL_CREDIT_CODE_PATTERN);
+            Matcher matcher = pattern.matcher(socialCreditCode);
+            if (matcher.matches()) {
+                return null;
+            } else {
+                return "统一社会信用代码格式不正确";
+            }
+        }
+    }
+
+    /**
+     * 名称(或联系人姓名)1个字的话,全部显示
+     * 名称(或联系人姓名)2个字的话,显示第二个字,第一个字打星号*
+     * 名称(或联系人姓名)3个字的话,显示后两个字,第一个字打星号*
+     * 名称(或联系人姓名)4个字话,显示前两个字和后一个字,中间的用一个星号*表示
+     * 名称(或联系人姓名)5个字及以上的话,显示前两个字和后一个字,中间的统一用3个星号*表示
+     *
+     * @param  name
+     * @return String
+     */
+    public static String nameConversion(String name){
+        char[] nameArr = name.toCharArray();
+        StringBuilder showName = new StringBuilder();
+        switch (nameArr.length) {
+            case 0:
+            case 1:
+                break;
+            case 2:
+                showName.append('*').append(nameArr[1]);
+                break;
+            case 3:
+                showName.append('*').append(nameArr[1]).append(nameArr[2]);
+                break;
+            case 4:
+                showName.append(nameArr[0]).append(nameArr[1]).append('*').append(nameArr[3]);
+                break;
+            default:
+                showName.append(nameArr[0]).append(nameArr[1]).append("***").append(nameArr[nameArr.length-1]);
+        }
+        return showName.toString();
+    }
+
+}

+ 27 - 0
src/main/resources/mapper/AnnouncementMapper.xml

@@ -0,0 +1,27 @@
+<?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.commodity.mapper.AnnouncementMapper">
+
+
+    <select id="gteannhade" resultType="com.caimei365.commodity.model.po.AnnouncementPo">
+        SELECT id,title
+        FROM `announcement_management`
+        WHERE state=1
+        ORDER BY Creationtime DESC
+        LIMIT 10
+    </select>
+
+<select id="getannlist" resultType="com.caimei365.commodity.model.po.AnnouncementPo">
+    SELECT id,title,Creationtime
+    FROM `announcement_management`
+    WHERE state=1
+    ORDER BY Creationtime DESC
+</select>
+
+    <select id="getcapacity" resultType="com.caimei365.commodity.model.po.AnnouncementPo">
+        SELECT title,capacity,Creationtime
+        FROM `announcement_management`
+        WHERE id = #{id} AND state=1
+    </select>
+
+</mapper>

+ 5 - 3
src/main/resources/mapper/CouponMapper.xml

@@ -49,7 +49,8 @@
         SELECT id AS "couponId",
                NAME,
                pcBanner,
-               appletsBanner
+               appletsBanner,
+               productType
         FROM cm_coupon
         WHERE productType = 2
           AND delFlag = 0
@@ -90,7 +91,8 @@
         p.commodityType,
         p.bigTypeID AS bigTypeId,
         p.smallTypeID AS smallTypeId,
-        p.tinyTypeID AS tinyTypeId
+        p.tinyTypeID AS tinyTypeId,
+        p.productType
         FROM
         cm_coupon_product a
         LEFT JOIN product p ON a.productId = p.productID
@@ -313,4 +315,4 @@
     <select id="findUserPermission" resultType="java.lang.Integer">
         select userIdentity from user where userID = #{userId}
     </select>
-</mapper>
+</mapper>

+ 23 - 17
src/main/resources/mapper/PageMapper.xml

@@ -45,7 +45,7 @@
 		order by -sort desc,createDate desc
     </select>
     <select id="getFloorByPageId" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
-        select id, pageId as type, title ,description as detail
+        select id, title ,description as detail
         from cm_page_centre
         where pageId = #{pageId}
         <if test="source == 1">
@@ -58,8 +58,8 @@
     </select>
     <select id="getFloorContentById" resultType="com.caimei365.commodity.model.vo.FloorContentVo">
         select
-         id, floorId, centreId, templateType, pcAdsImage1, pcAdsImage2, pcAdsImage3,pcAdsImage4,pcAdsImage5,
-         appletsAdsImage1, appletsAdsImage2, appletsAdsImage3, appletsAdsImage4, appletsAdsImage5, adsLink1, adsLink2, adsLink3
+         id, floorId, centreId, templateType, pcAdsImage1, pcAdsImage2, pcAdsImage3,
+         appletsAdsImage1, appletsAdsImage2, appletsAdsImage3, adsLink1, adsLink2, adsLink3
          from new_page_floor_content where floorId = #{id}
     </select>
     <select id="getFloorImageById" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
@@ -103,7 +103,7 @@
     </select>
     <select id="getFloorImageByCentreId" resultType="com.caimei365.commodity.model.vo.FloorImageVo">
         select
-            id, floorId, centreId, productId, name, link, image, appletsImage,adsImage, label,content, pcStatus, appletsStatus, sort,displaySort, createDate
+            id, floorId, centreId, productId, name, link, image, appletsImage, label, pcStatus, appletsStatus, sort, displaySort, createDate
         from new_page_floor_image
         where centreId = #{id}
         <if test="source == 1">
@@ -144,7 +144,8 @@
             p.smallTypeID as smallTypeId,
             p.tinyTypeID as tinyTypeId,
             p.visibility as visibility,
-            cshd.detailTalkFlag as detailTalkFlag
+            cshd.detailTalkFlag as detailTalkFlag,
+            p.productType
         from product p
         left join cm_second_hand_detail cshd on p.productID = cshd.productID
         where p.productID = #{productId} and p.validFlag = 2
@@ -171,15 +172,17 @@
         order by - sort desc,createDate desc
     </select>
     <select id="getProductDetails" resultType="com.caimei365.commodity.model.vo.ProductDetailVo">
-        select productID as productId, shopID as shopId,  name, aliasName, commodityType, mainImage, stock, invoiceType,
-            bigTypeID as bigTypeId, smallTypeID as smallTypeId, tinyTypeID as tinyTypeId, searchKey, visibility,
-            brandID as brandId,  productType, tags, unit, normalPrice, price, includedTax, minBuyNumber,
-            productCategory, serviceNumber, taxPoint, supplierTaxPoint, priceFlag, actFlag, ladderPriceFlag,
-            addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
-            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
-            trainingMethod, trainingType ,trainingFee, productRemarks,productDetail as productDetailChose
-        from product
-        where productID = #{productId}
+        select p.productID as productId, p.shopID as shopId,  p.name, p.aliasName, p.commodityType, p.mainImage, p.stock, p.invoiceType,
+               p.bigTypeID as bigTypeId, p.smallTypeID as smallTypeId, p.tinyTypeID as tinyTypeId, p.searchKey, p.visibility,
+               p.brandID as brandId,  p.productType, p.tags, p.unit, p.normalPrice, p.price, p.includedTax, p.minBuyNumber,
+               p.productCategory, p.serviceNumber, p.taxPoint, p.supplierTaxPoint, p.priceFlag, p.actFlag, p.ladderPriceFlag,
+               p.addTime, p.hasSkuFlag, p.sellNumber, p.sortIndex, p.featuredFlag, p.costCheckFlag, p.recommendType, p.machineType,
+               p.productCode, p.updateTime, p.validFlag, p.searchKey, p.allAreaFlag, p.step, p.costPrice, p.provinceIds, p.qualificationImg,
+               p.trainingMethod, p.trainingType ,p.trainingFee, p.productRemarks,p.productDetail as productDetailChose,
+               s.shopType as shopType
+        from product p
+        left join shop s on s.shopId= p.shopId
+        where p.productID = #{productId}
     </select>
     <select id="getBuyAgainProducts" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
         select
@@ -211,7 +214,8 @@
             p.bigTypeID as bigTypeId,
             p.smallTypeID as smallTypeId,
             p.tinyTypeID as tinyTypeId,
-            rpp.currentPrice as discountPrice
+            rpp.currentPrice as discountPrice,
+            p.productType
         from
           repeat_purchase_price rpp
           left join product p on rpp.productId = p.productID
@@ -245,7 +249,8 @@
             p.actStatus,
 			p.`name` as `name`,
 			p.mainImage as image,
-            IFNULL(p.visibility,3) as visibility
+            IFNULL(p.visibility,3) as visibility,
+               p.productType
         from product as p
         left join cm_product_recommend as pr on pr.recommendProductID = p.productID
         where
@@ -258,7 +263,8 @@
             p.actStatus,
 			p.`name` as `name`,
 			p.mainImage as image,
-            IFNULL(p.visibility,3) as visibility
+            IFNULL(p.visibility,3) as visibility,
+               p.productType
         from product as p
         where p.validFlag  = 2
         and p.commodityType = (select commodityType from product as p1 where p1.productID = #{productId})

+ 9 - 5
src/main/resources/mapper/PriceMapper.xml

@@ -25,7 +25,8 @@
             if(csp.id is not null,1,0) as svipProductFlag,
             csp.priceType as svipPriceType,
             csp.discount as svipDiscount,
-            csp.discountPrice as svipDiscountPrice
+            csp.discountPrice as svipDiscountPrice,
+            p.productType
         from product p
         left join cm_svip_product csp on p.productID = csp.productId
         where p.productID = #{productId}
@@ -51,7 +52,8 @@
             if(csp.id is not null,1,0) as svipProductFlag,
             csp.priceType as svipPriceType,
             csp.discount as svipDiscount,
-            csp.discountPrice as svipDiscountPrice
+            csp.discountPrice as svipDiscountPrice,
+            p.productType
         from product p
         left join cm_svip_product csp on p.productID = csp.productId
         where p.productID in
@@ -84,7 +86,7 @@
     </select>
     <select id="getRepurchasePrice" resultType="java.lang.Double">
         select
-          r.currentPrice
+          r.currentPrice,p.productType
         from repeat_purchase_price r
         left join product p on p.productID = r.productId
         where r.productId = #{productId} and userId = #{userId}
@@ -96,7 +98,8 @@
         select
         p.includedTax as includedTax,
         p.invoiceType as invoiceType,
-        p.taxPoint as taxPoint
+        p.taxPoint as taxPoint,
+        p.productType
         from product p
         where productID = #{productId}
     </select>
@@ -120,7 +123,8 @@
                s.productId AS id,
                s.shop AS shopName,
                s.productCount AS productCount,
-               s.property AS property
+               s.property AS property,
+               p.productType
         FROM product p
         LEFT JOIN cm_product_sales s ON p.productID = s.productId
         where p.productId=#{productId}

+ 5 - 3
src/main/resources/mapper/PromotionsMapper.xml

@@ -34,7 +34,7 @@
         from cm_promotions pr
                  left join cm_promotions_product prp on pr.id = prp.promotionsId
         where (prp.productId = #{productId} or
-               prp.supplierId = (select p.shopID from product p where p.productID = #{productId})
+               prp.supplierId = (select p.shopID,p.productType from product p where p.productID = #{productId})
             )
         and (pr.status = 1 or (pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))
         and pr.delFlag not in (1, 2)
@@ -81,7 +81,8 @@
                p.price    as originalPrice,
                p.unit      as unit,
                p.validFlag as validFlag,
-               p.stock     as stock
+               p.stock     as stock,
+               p.productType
         from product p
                  left join cm_promotions_gift cpg on cpg.productId = p.productID
         where cpg.promotionsId = #{promotionsId}
@@ -126,7 +127,8 @@
         p.price,
         p.unit as unit,
         p.priceFlag,
-        IFNULL(p.visibility,3) as visibility
+        IFNULL(p.visibility,3) as visibility,
+        p.productType
         from product p
         left join cm_promotions_product cpp on cpp.productId = p.productID
         where cpp.promotionsId = #{promotionsId}

+ 1 - 0
src/main/resources/mapper/SearchMapper.xml

@@ -292,6 +292,7 @@
         p.priceFlag,
         p.price,
         p.shopID as shopId,
+        p.productType,
         p.searchKey as keyword
         from product p
         left join cm_brand as br on p.brandID = br.id

+ 21 - 4
src/main/resources/mapper/SecondHandMapper.xml

@@ -7,13 +7,14 @@
 			originalPrice, contactName, contactMobile, dockingPeopleName, dockingPeopleMobile, secondProductType,
 			townId, brandName, provinceCityDistrict, address, productQuality, productDetails, viewingNum, payStatus,
 			payAmount, payFormData, payType, payDate, submitDate, reviewedDate, onLineDate, source, publisher, authenticationImage,
-			fileName, ossName, commitmentImage
+			fileName, ossName, commitmentImage,publishIdentity,licenseImage,authenticationBackImage
 		) values (
 			#{productId}, #{sold}, #{secondHandType}, #{instrumentType}, #{fixedYears}, #{maturityYears}, #{companyName},
 			#{detailTalkFlag}, #{originalPrice}, #{contactName}, #{contactMobile}, #{dockingPeopleName}, #{dockingPeopleMobile},
 			#{secondProductType}, #{townId}, #{brandName}, #{provinceCityDistrict}, #{address}, #{productQuality}, #{productDetails},
 			#{viewingNum}, #{payStatus}, #{payAmount}, #{payFormData}, #{payType}, #{payDate}, #{submitDate}, #{reviewedDate},
-			#{onLineDate}, #{source}, #{publisher}, #{authenticationImage}, #{fileName}, #{ossName}, #{commitmentImage}
+			#{onLineDate}, #{source}, #{publisher}, #{authenticationImage}, #{fileName}, #{ossName}, #{commitmentImage},#{publishIdentity},
+			#{licenseImage},#{authenticationBackImage}
 		)
     </insert>
     <insert id="insertProductImage" parameterType="com.caimei365.commodity.model.po.ProductImagePo">
@@ -34,6 +35,15 @@
             #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime}
         )
     </insert>
+    <insert id="insertSecondFileType">
+        insert into cm_second_file_type
+        (fileType,secondId,productId)
+        values (#{fileType},#{secondId},#{productId})
+    </insert>
+    <insert id="insertShop" keyColumn="shopID" keyProperty="shopId" parameterType="com.caimei365.commodity.model.vo.ShopVo" useGeneratedKeys="true">
+        insert into shop (name,linkMan,contractMobile,cardNumber,addTime,status,shopType)
+        values (#{name},#{linkMan},#{contractMobile},#{cardNumber},now(),90,3)
+    </insert>
     <update id="updateSecondHandViews">
         UPDATE cm_second_hand_detail SET viewingNum = #{viewingNum}
         WHERE productID = #{productId}
@@ -101,12 +111,14 @@
             cshd.productDetails,
             cshd.productQuality,
             cshd.secondHandType,
-            cshd.instrumentType,
+            ifnull(cshd.instrumentType,0) as instrumentType,
             cshd.showContactFlag,
             cshd.contactMobile,
             cshd.contactName,
             cshd.fixedYears,
-            cshd.maturityYears
+            cshd.maturityYears,
+            cshd.publishIdentity,
+            cshd.companyName
         from product p
         left join cm_second_hand_detail cshd on p.productID = cshd.productID
         left join cm_brand cb on cb.id = p.brandID
@@ -205,4 +217,9 @@
         and cshr.secondHandProductID = #{productId}
         order by cshr.sort desc
     </select>
+    <select id="findSecondShop" resultType="java.lang.Integer">
+        select shopId from shop
+        where shopType = 3
+        AND cardNumber = #{cardNumber}
+    </select>
 </mapper>

+ 36 - 34
src/main/resources/mapper/SellerMapper.xml

@@ -28,13 +28,15 @@
                p.commodityType,
                p.bigTypeID       as bigTypeId,
                p.smallTypeID     as smallTypeId,
-               p.tinyTypeID      as tinyTypeId
+               p.tinyTypeID      as tinyTypeId,
+               p.productType
         from product p
-        where (name LIKE CONCAT('%', #{searchWord}, '%') or productCode LIKE CONCAT('%', #{searchWord}, '%'))
-          and validFlag in (2, 3, 9)
+        where
+        (name LIKE CONCAT('%',#{searchWord},'%') or productCode LIKE CONCAT('%',#{searchWord},'%'))
+        and validFlag in (2,3,9)
     </select>
     <select id="getCombinationList" resultType="com.caimei365.commodity.model.vo.CombinationVo">
-        select c.id, c.name, c.addTime, c.updateTime
+        select c.id, c.name, c.addTime, c.updateTime,p.productType
         from cm_product_combination c
         left join product p on p.combinationID = c.id
         where c.delFlag = 0 and p.validFlag = 2
@@ -46,33 +48,32 @@
         order by c.addTime desc
     </select>
     <select id="getCombinationProductList" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
-        select p.productID       as productId,
-               p.actStatus,
-               p.name,
-               p.aliasName,
-               p.mainImage       as image,
-               p.unit,
-               p.productCode     as code,
-               p.priceFlag,
-               p.price,
-               p.shopID          as shopId,
-               p.searchKey       as keyword,
-               p.minBuyNumber    as minBuyNumber,
-               p.maxBuyNumber    as maxBuyNumber,
-               p.ladderPriceFlag,
-               p.normalPrice,
-               p.step,
-               p.shopID          as shopId,
-               p.taxPoint        as taxRate,
-               p.includedTax,
-               p.invoiceType,
-               p.productCategory as productCategory,
-               p.validFlag,
-               p.featuredFlag,
-               p.commodityType,
-               p.bigTypeID       as bigTypeId,
-               p.smallTypeID     as smallTypeId,
-               p.tinyTypeID      as tinyTypeId
+        select
+            p.productID as productId,
+            p.actStatus,
+            p.name,
+            p.aliasName,
+            p.unit,
+            p.productCode as code,
+            p.priceFlag as priceFlag,
+            p.price as price,
+            p.shopID as shopId,
+            p.minBuyNumber as minBuyNumber,
+            p.maxBuyNumber as maxBuyNumber,
+            p.ladderPriceFlag,
+            p.normalPrice,
+            p.step,
+            p.shopID as shopId,
+            p.includedTax,
+            p.invoiceType,
+            p.productCategory as productCategory,
+            p.validFlag,
+            p.featuredFlag,
+            p.commodityType,
+            p.bigTypeID as bigTypeId,
+            p.smallTypeID as smallTypeId,
+            p.tinyTypeID as tinyTypeId,
+            p.productType
         from product p
         where p.validFlag = 2
           and p.combinationID = #{id}
@@ -80,13 +81,13 @@
     </select>
 
     <select id="findCombination" resultType="java.lang.Integer">
-        select c.id
+        select c.id,p.productType
         from cm_product_combination c
                  left join product p on p.combinationID = c.id
         where p.productID = #{productId}
     </select>
     <select id="findProductList" resultType="java.lang.Integer">
-        select productID
+        select productID,productType
         from product
         where combinationID = #{combinationId}
     </select>
@@ -118,7 +119,8 @@
         p.commodityType,
         p.bigTypeID as bigTypeId,
         p.smallTypeID as smallTypeId,
-        p.tinyTypeID as tinyTypeId
+        p.tinyTypeID as tinyTypeId,
+        p.productType
         from product p
         where
         p.productID in

+ 9 - 35
src/main/resources/mapper/ShopMapper.xml

@@ -4,7 +4,7 @@
     <insert id="insertProduct" keyColumn="productID" keyProperty="productId"  parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
         insert into product (
             shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
-            brandID, productType, tags, unit, normalPrice, price, includedTax, minBuyNumber, stock,
+            brandID, productType, tags, unit, normalPrice, price, price1, includedTax, minBuyNumber, stock,
             <if test="productCategory != null and  productCategory != ''">
                 productCategory,
             </if>
@@ -36,7 +36,7 @@
                 recommendType,
             </if>
             <if test="priceFlag != null and  priceFlag != ''">
-                priceFlag,
+                price1TextFlag,
             </if>
             <if test="actFlag != null and  actFlag != ''">
                 actFlag,
@@ -74,19 +74,10 @@
             <if test="invoiceType != null and  invoiceType != ''">
                 invoiceType,
             </if>
-            <if test="trainingMethod != null">
-                trainingMethod,
-            </if>
-            <if test="trainingType != null">
-                trainingType,
-            </if>
-            <if test="trainingFee != null">
-                trainingFee,
-            </if>
             updateTime, validFlag
         ) values (
             #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
-            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
+            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
             <if test="productCategory != null and  productCategory != ''">
                 #{productCategory},
             </if>
@@ -155,15 +146,6 @@
             </if>
             <if test="invoiceType != null and  invoiceType != ''">
                 #{invoiceType},
-            </if>
-            <if test="trainingMethod != null">
-                #{trainingMethod},
-            </if>
-            <if test="trainingType != null">
-                #{trainingType},
-            </if>
-            <if test="trainingFee != null">
-                #{trainingFee},
             </if>
              #{updateTime}, #{validFlag}
         )
@@ -173,7 +155,7 @@
             shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
             bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
             brandId = #{brandId}, productType = #{productType}, tags = #{tags}, unit = #{unit}, normalPrice = #{normalPrice},
-            price = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock = #{stock},
+            price = #{price}, price1 = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock = #{stock},
             <if test="productCategory != null and  productCategory != ''">
                 productCategory = #{productCategory},
             </if>
@@ -205,7 +187,7 @@
                 recommendType = #{recommendType},
             </if>
             <if test="priceFlag != null and  priceFlag != ''">
-                priceFlag = #{priceFlag},
+                price1TextFlag = #{priceFlag},
             </if>
             <if test="actFlag != null and  actFlag != ''">
                 actFlag = #{actFlag},
@@ -243,15 +225,6 @@
             <if test="invoiceType != null and  invoiceType != ''">
                 invoiceType = #{invoiceType},
             </if>
-            <if test="trainingMethod != null">
-                trainingMethod = #{trainingMethod},
-            </if>
-            <if test="trainingType != null">
-                trainingType = #{trainingType},
-            </if>
-            <if test="trainingFee != null">
-                trainingFee = #{trainingFee},
-            </if>
             updateTime = #{updateTime}, validFlag = #{validFlag}
         where productID = #{productId}
     </update>
@@ -351,10 +324,11 @@
 			p.shopID as shopId,
 			p.`name` as `name`,
 			p.mainImage as image,
-			p.price,
+			p.price as price,
 			p.unit as unit,
-			p.priceFlag,
-            IFNULL(p.visibility,3) as visibility
+			p.priceFlag as priceFlag,
+            IFNULL(p.visibility,3) as visibility,
+            p.productType
 		from product p
         where p.shopID = #{shopId}
         and p.visibility in

+ 3 - 2
src/main/resources/mapper/UserLikeMapper.xml

@@ -59,7 +59,8 @@
                p.bigTypeID       AS bigTypeId,
                p.smallTypeID     AS smallTypeId,
                p.tinyTypeID      AS tinyTypeId,
-               p.visibility      AS visibility
+               p.visibility      AS visibility,
+               p.productType
         FROM product p
                  LEFT JOIN cm_product_userlike cpu ON p.productID = cpu.productID
         WHERE p.validFlag = '2'
@@ -67,4 +68,4 @@
           AND cpu.userID = #{userId}
         ORDER BY cpu.likeTime DESC
     </select>
-</mapper>
+</mapper>