Aslee 4 роки тому
батько
коміт
7f3d02e4cc
33 змінених файлів з 933 додано та 122 видалено
  1. 1 1
      src/main/java/com/caimei/AdminApplication.java
  2. 3 1
      src/main/java/com/caimei/controller/AuthApi.java
  3. 95 0
      src/main/java/com/caimei/controller/AuthProductApi.java
  4. 37 29
      src/main/java/com/caimei/controller/ShopApi.java
  5. 12 10
      src/main/java/com/caimei/controller/UploadApi.java
  6. 1 0
      src/main/java/com/caimei/mapper/AuthMapper.java
  7. 38 0
      src/main/java/com/caimei/mapper/AuthProductMapper.java
  8. 11 4
      src/main/java/com/caimei/mapper/ShopMapper.java
  9. 55 0
      src/main/java/com/caimei/model/dto/ProductSaveDto.java
  10. 28 0
      src/main/java/com/caimei/model/po/ProductParamPo.java
  11. 59 0
      src/main/java/com/caimei/model/po/ProductPo.java
  12. 1 1
      src/main/java/com/caimei/model/po/ShopInfoPo.java
  13. 3 0
      src/main/java/com/caimei/model/po/UserPo.java
  14. 2 1
      src/main/java/com/caimei/model/vo/AuthVo.java
  15. 20 0
      src/main/java/com/caimei/model/vo/BrandVo.java
  16. 17 0
      src/main/java/com/caimei/model/vo/CountryVo.java
  17. 31 0
      src/main/java/com/caimei/model/vo/ProductListVo.java
  18. 95 0
      src/main/java/com/caimei/model/vo/ShopFormVo.java
  19. 2 2
      src/main/java/com/caimei/model/vo/ShopListVo.java
  20. 59 0
      src/main/java/com/caimei/service/AuthProductService.java
  21. 3 0
      src/main/java/com/caimei/service/AuthService.java
  22. 31 3
      src/main/java/com/caimei/service/ShopService.java
  23. 0 2
      src/main/java/com/caimei/service/UserService.java
  24. 151 0
      src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java
  25. 8 8
      src/main/java/com/caimei/service/impl/AuthServiceImpl.java
  26. 41 29
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  27. 6 0
      src/main/resources/backup.sql
  28. 11 1
      src/main/resources/config/beta/application-beta.yml
  29. 9 6
      src/main/resources/config/dev/application-dev.yml
  30. 11 1
      src/main/resources/config/prod/application-prod.yml
  31. 5 2
      src/main/resources/mapper/AuthMapper.xml
  32. 48 0
      src/main/resources/mapper/AuthProductMapper.xml
  33. 39 21
      src/main/resources/mapper/ShopMapper.xml

+ 1 - 1
src/main/java/com/caimei/AdminApplication.java

@@ -34,7 +34,7 @@ public class AdminApplication {
     @Bean
     MultipartConfigElement multipartConfigElement() {
         MultipartConfigFactory factory = new MultipartConfigFactory();
-        factory.setLocation("/mnt/newdatadrive/data/runtime/jar-instance/mall-admin/tempImage");
+        factory.setLocation("/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage");
         return factory.createMultipartConfig();
     }
 }

+ 3 - 1
src/main/java/com/caimei/controller/AuthApi.java

@@ -3,6 +3,7 @@ package com.caimei.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.BrandVo;
 import com.caimei.service.AuthService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -13,6 +14,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -35,7 +37,7 @@ public class AuthApi {
      */
     @ApiOperation("授权列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "authParty", required = false, value = "授权机构"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")

+ 95 - 0
src/main/java/com/caimei/controller/AuthProductApi.java

@@ -0,0 +1,95 @@
+package com.caimei.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.ShopListVo;
+import com.caimei.service.AuthProductService;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * 授权商品API
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Api(tags = "授权商品API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/auth/product")
+public class AuthProductApi {
+
+    private final AuthProductService authProductService;
+
+    /**
+     * 授权商品列表
+     */
+    @ApiOperation("授权商品列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authId", required = true, value = "授权id"),
+            @ApiImplicitParam(name = "productName", required = false, value = "商品名称"),
+            @ApiImplicitParam(name = "snCode", required = false, value = "商品SN码"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/list")
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer authId, String productName, String snCode,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authProductService.getProductList(authId, productName, snCode, pageNum, pageSize);
+    }
+
+
+    /**
+     * 更新授权商品状态
+     */
+    @ApiOperation("更新授权商品状态")
+    @ApiImplicitParam(name = "params", value = "productId:授权商品id;status:上架状态:0下架 1上架", required = true)
+    @PostMapping("/update/status")
+    public ResponseJson updateProductStatus(@RequestBody Map<String,Integer> params) {
+        Integer productId = params.get("productId");
+        Integer status = params.get("status");
+        return authProductService.updateProductStatus(productId, status);
+    }
+
+    /**
+     * 删除授权商品
+     */
+    @ApiOperation("删除授权商品")
+    @ApiImplicitParam(name = "params", value = "productId:授权商品id", required = true)
+    @PostMapping("/delete")
+    public ResponseJson deleteProduct(@RequestBody Map<String,Integer> params) {
+        Integer productId = params.get("productId");
+        return authProductService.deleteProduct(productId);
+    }
+
+    /**
+     * 添加/编辑授权商品
+     * @param productSaveDto {
+     *                   productId              授权商品id
+     *                   authId                 授权id
+     *                   productName            商品名称
+     *                   snCode                 商品SN码
+     *                   productImage           商品图片
+     *                   certificateImage       授权牌照
+     *                   status                 上架状态:0下架,1上架
+     *                   createBy               创建人id
+     *                   paramList              商品参数列表
+     * }
+     */
+    @ApiOperation("添加/编辑授权商品")
+    @PostMapping("/save")
+    public ResponseJson saveProduct(@RequestBody ProductSaveDto productSaveDto) {
+        return authProductService.saveProduct(productSaveDto);
+    }
+}

+ 37 - 29
src/main/java/com/caimei/controller/ShopApi.java

@@ -1,10 +1,11 @@
 package com.caimei.controller;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ShopSaveDto;
-import com.caimei.model.vo.ShopVo;
+import com.caimei.model.vo.BrandVo;
+import com.caimei.model.vo.CountryVo;
+import com.caimei.model.vo.ShopFormVo;
+import com.caimei.model.vo.ShopListVo;
 import com.caimei.service.ShopService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -13,10 +14,10 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -48,20 +49,23 @@ public class ShopApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ShopVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan,
-                                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+    public ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan,
+                                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
 
         return shopService.getShopList(shopName, shopType, brandId, mobile, linkMan, pageNum, pageSize);
     }
 
     /**
      * 获取供应商表单数据
-     * @param authUserId    供应商用户id
-     * @return  ShopVo
+     *
+     * @param authUserId 供应商用户id
+     * @return ShopVo
      */
+    @ApiOperation("供应商表单数据")
+    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @GetMapping("/form/data")
-    public ResponseJson<ShopVo> getShopFormData(Integer authUserId) {
+    public ResponseJson<ShopFormVo> getShopFormData(Integer authUserId) {
         return shopService.getShopFormData(authUserId);
     }
 
@@ -118,7 +122,8 @@ public class ShopApi {
     /**
      * 代理声明文件上传
      *
-     * @param params authUserId:供应商用户id,file:上传的文件,fileName:文件名称
+     * @param authUserId:供应商用户id
+     * @param file:代理声明文件
      * @return
      */
     @ApiOperation("代理声明文件上传")
@@ -128,24 +133,27 @@ public class ShopApi {
     })
     @PostMapping("/upload/file")
     public ResponseJson<Integer> uploadFile(Integer authUserId, MultipartFile file) {
-        /*if (StringUtils.isBlank(params)) {
-            return ResponseJson.error("数据异常", null);
-        }
-        Integer authUserId = null;
-        MultipartFile file = null;
-        try {
-            JSONObject paramsMap = JSON.parseObject(params);
-            if (null == paramsMap) {
-                return ResponseJson.error("数据异常,参数不能为空", null);
-            }
-            authUserId = paramsMap.getInteger("authUserId");
-            file = (MultipartFile) paramsMap.get("file");
-            if (null == file) {
-                return ResponseJson.error("数据异常,上传文件不能为空", null);
-            }
-        } catch (Exception e) {
-            log.error("<<<<< 系统异常 >>>>>");
-        }*/
         return shopService.uploadFile(authUserId, file);
     }
+
+    /**
+     * 品牌列表
+     * @param type 1品牌方品牌列表,2代理商品牌列表
+     * @return AuthVo
+     */
+    @ApiOperation("品牌列表")
+    @ApiImplicitParam(name = "type", value = "1品牌方品牌列表,2代理商品牌列表", required = true)
+    @GetMapping("/brand/list")
+    public ResponseJson<List<BrandVo>> getBrandList(Integer type){
+        return shopService.getBrandList(type);
+    }
+
+    /**
+     * 产地国家列表
+     */
+    @ApiOperation("产地国家列表")
+    @GetMapping("/country/list")
+    public ResponseJson<List<CountryVo>> getCountryList(){
+        return shopService.getCountryList();
+    }
 }

+ 12 - 10
src/main/java/com/caimei/controller/UploadApi.java

@@ -4,6 +4,7 @@ import com.caimei.config.FastDfsClient;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -12,21 +13,24 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+/**
+ * @author Aslee
+ * @date 2021/5/14
+ */
 @Api(tags = "上传API")
 @Slf4j
 @RestController
+@RequiredArgsConstructor
 @RequestMapping("/upload")
 public class UploadApi {
-    protected static final Logger logger = LoggerFactory.getLogger(UploadApi.class);
-    @Autowired
-    private FastDfsClient client;
+    private static final Logger logger = LoggerFactory.getLogger(UploadApi.class);
+    private final FastDfsClient client;
     @Value("${caimei.imageDomain}")
     private String imageDomain;
 
@@ -38,7 +42,7 @@ public class UploadApi {
     @PostMapping("/image")
     public Map<String, Object> uploadImage(MultipartFile file) throws IOException {
         Map<String, Object> map = new HashMap<>(2);
-        String saveFile = null;
+        String saveFile;
         if (file != null ) {
             // 保存文件
             saveFile = saveFile(file);
@@ -53,18 +57,16 @@ public class UploadApi {
         return map;
     }
 
-    private String saveFile( MultipartFile file) throws IOException {
+    private String saveFile(MultipartFile file) throws IOException {
         String originalFilename = file.getOriginalFilename();
-        String name = file.getName();
         String randomUUID = UUID.randomUUID().toString();
         int index = originalFilename.lastIndexOf(".");
         String exet = originalFilename.substring(index);
-        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplm-admin/tempImage/";
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
         filePath += "\\" + randomUUID + exet;
         file.transferTo(new File(filePath));
         logger.info(">>>>>>>>>>>>>>>>图片上传路径:" + filePath);
-        String file1 = client.uploadFile(filePath);
-        return file1;
+        return client.uploadFile(filePath);
     }
 
 }

+ 1 - 0
src/main/java/com/caimei/mapper/AuthMapper.java

@@ -2,6 +2,7 @@ package com.caimei.mapper;
 
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.BrandVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 

+ 38 - 0
src/main/java/com/caimei/mapper/AuthProductMapper.java

@@ -0,0 +1,38 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.po.ProductParamPo;
+import com.caimei.model.po.ProductPo;
+import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.BrandVo;
+import com.caimei.model.vo.ProductListVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/17
+ */
+@Mapper
+public interface AuthProductMapper {
+
+    List<ProductListVo> getProductList(@Param("authId") Integer authId, @Param("productName") String productName, @Param("snCode") String snCode);
+
+    void updateProductStatusByProductId(@Param("productId") Integer productId, @Param("status") Integer status);
+
+    void deleteProductByProductId(Integer productId);
+
+    void insertProduct(ProductPo product);
+
+    void updateProductByProductId(ProductPo product);
+
+    void deleteParamsByProductId(Integer productId);
+
+    void insertProductParam(@Param("productId") Integer productId, @Param("paramName") String paramName, @Param("paramContent") String paramContent);
+
+    Integer getProductIdBySnCode(String snCode);
+}

+ 11 - 4
src/main/java/com/caimei/mapper/ShopMapper.java

@@ -3,7 +3,10 @@ package com.caimei.mapper;
 import com.caimei.model.po.CmBrandAuthFilePo;
 import com.caimei.model.po.ShopInfoPo;
 import com.caimei.model.po.UserPo;
-import com.caimei.model.vo.ShopVo;
+import com.caimei.model.vo.BrandVo;
+import com.caimei.model.vo.CountryVo;
+import com.caimei.model.vo.ShopFormVo;
+import com.caimei.model.vo.ShopListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,7 +21,7 @@ import java.util.List;
 @Mapper
 public interface ShopMapper {
 
-    List<ShopVo> getShopList(@Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan);
+    List<ShopListVo> getShopList(@Param("shopName") String shopName, @Param("shopType") Integer shopType, @Param("brandId") Integer brandId, @Param("mobile") String mobile, @Param("linkMan") String linkMan);
 
     void updateShopStatusByUserId(@Param("authUserId") Integer authUserId, @Param("status") Integer status);
 
@@ -34,7 +37,7 @@ public interface ShopMapper {
 
     void insertShop(UserPo shop);
 
-    void updateBrandAuthLogo(Integer brandId);
+    void updateBrandAuthLogo(@Param("brandId") Integer brandId, @Param("brandAuthLogo") String brandAuthLogo);
 
     void updateFileUserId(@Param("statementFileId") Integer statementFileId,@Param("authUserId") Integer authUserId);
 
@@ -44,5 +47,9 @@ public interface ShopMapper {
 
     void updateShopInfoByUserId(ShopInfoPo shopInfo);
 
-    ShopVo getShopByAuthUserId(Integer authUserId);
+    ShopFormVo getShopByAuthUserId(Integer authUserId);
+
+    List<BrandVo> getBrandList(Integer type);
+
+    List<CountryVo> getCountryList();
 }

+ 55 - 0
src/main/java/com/caimei/model/dto/ProductSaveDto.java

@@ -0,0 +1,55 @@
+package com.caimei.model.dto;
+
+
+import com.caimei.model.po.ProductParamPo;
+import com.caimei.module.base.entity.po.CmBrandProductParamPo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/17
+ */
+@Data
+public class ProductSaveDto {
+    @ApiModelProperty("授权商品id")
+    private Integer productId;
+
+    @NotNull(message = "授权id不能为空")
+    @ApiModelProperty("授权id")
+    private Integer authId;
+
+    @NotNull(message = "商品名称不能为空")
+    @ApiModelProperty("商品名称")
+    private String productName;
+
+    @NotNull(message = "商品SN码不能为空")
+    @ApiModelProperty("商品SN码")
+    private String snCode;
+
+    @NotNull(message = "商品图片不能为空")
+    @ApiModelProperty("商品图片")
+    private String productImage;
+
+    @NotNull(message = "授权牌照不能为空")
+    @ApiModelProperty("授权牌照")
+    private String certificateImage;
+
+    @NotNull(message = "上架状态不能为空")
+    @ApiModelProperty("上架状态:0下架,1上架")
+    private Integer status;
+
+    @NotNull(message = "创建人id不能为空")
+    @ApiModelProperty("创建人id")
+    private Integer createBy;
+
+    @NotNull(message = "商品参数列表不能为空")
+    @ApiModelProperty("商品参数列表")
+    private List<ProductParamPo> paramList;
+}

+ 28 - 0
src/main/java/com/caimei/model/po/ProductParamPo.java

@@ -0,0 +1,28 @@
+package com.caimei.model.po;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ProductParamPo {
+    /**
+     * 授权商品id
+     */
+    @ApiModelProperty("授权商品id")
+    private Integer productId;
+    /**
+     * 商品参数名称
+     */
+    @ApiModelProperty("商品参数名称")
+    private String paramName;
+    /**
+     * 商品参数内容
+     */
+    @ApiModelProperty("商品参数内容")
+    private String paramContent;
+}

+ 59 - 0
src/main/java/com/caimei/model/po/ProductPo.java

@@ -0,0 +1,59 @@
+package com.caimei.model.po;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * cm_brand_auth_product
+ *
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ProductPo {
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+
+    /**
+     * 授权Id
+     */
+    private Integer authId;
+
+    /**
+     * 商品名称
+     */
+    private String productName;
+
+    /**
+     * sn码
+     */
+    private String snCode;
+
+    /**
+     * 商品图片
+     */
+    private String productImage;
+
+    /**
+     * 授权牌照
+     */
+    private String certificateImage;
+
+    /**
+     * 上架状态:0下架,1上架
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 创建人Id
+     */
+    private Integer createBy;
+}

+ 1 - 1
src/main/java/com/caimei/model/po/ShopInfoPo.java

@@ -44,7 +44,7 @@ public class ShopInfoPo{
     /**
      * 声明链接
      */
-    private String statementlink;
+    private String statementLink;
 
     /**
      * 声明图片

+ 3 - 0
src/main/java/com/caimei/model/po/UserPo.java

@@ -10,6 +10,9 @@ import lombok.Data;
  */
 @Data
 public class UserPo {
+    /**
+     * 用户id
+     */
     private Integer authUserId;
 
     /**

+ 2 - 1
src/main/java/com/caimei/model/vo/AuthVo.java

@@ -7,7 +7,8 @@ import java.util.Date;
 
 /**
  * cm_brand_auth
- * @author 
+ * @author Aslee
+ * @date 2021/5/17
  */
 @Data
 public class AuthVo {

+ 20 - 0
src/main/java/com/caimei/model/vo/BrandVo.java

@@ -0,0 +1,20 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class BrandVo {
+    @ApiModelProperty("品牌id")
+    private Integer id;
+
+    @ApiModelProperty("品牌名称")
+    private String name;
+
+    @ApiModelProperty("品牌logo")
+    private String authLogo;
+}

+ 17 - 0
src/main/java/com/caimei/model/vo/CountryVo.java

@@ -0,0 +1,17 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class CountryVo {
+    @ApiModelProperty("产地国家id")
+    private Integer countryId;
+
+    @ApiModelProperty("产地国家名称")
+    private String countryName;
+}

+ 31 - 0
src/main/java/com/caimei/model/vo/ProductListVo.java

@@ -0,0 +1,31 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ProductListVo {
+    @ApiModelProperty("商品id")
+    private Integer productId;
+
+    @ApiModelProperty("商品名称")
+    private String productName;
+
+    @ApiModelProperty("商品SN码")
+    private String snCode;
+
+    @ApiModelProperty("上架状态")
+    private Integer status;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("创建人")
+    private Integer createBy;
+}

+ 95 - 0
src/main/java/com/caimei/model/vo/ShopFormVo.java

@@ -0,0 +1,95 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Data
+public class ShopFormVo implements Serializable {
+    /**
+     * 供应商用户id
+     */
+    @ApiModelProperty("供应商用户id")
+    private Integer authUserId;
+
+    /**
+     * 供应商名称
+     */
+    @ApiModelProperty("供应商名称")
+    private String name;
+
+    /**
+     * 供应商类型:1代理商 2品牌方
+     */
+    @ApiModelProperty("供应商类型")
+    private Integer type;
+
+    /**
+     * 所属品牌Id
+     */
+    @ApiModelProperty("所属品牌Id")
+    private Integer brandId;
+
+    /**
+     * 手机号
+     */
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    /**
+     * 联系人
+     */
+    @ApiModelProperty("联系人")
+    private String linkMan;
+
+    /**
+     * 产地国家Id
+     */
+    @ApiModelProperty("产地国家Id")
+    private Integer countryId;
+
+    /**
+     * 供应商状态:0停用 1启用
+     */
+    @ApiModelProperty("供应商状态:0停用 1启用")
+    private Integer shopStatus;
+
+    /**
+     * 代理声明类型:1弹窗,2链接,3图片,4文件
+     */
+    @ApiModelProperty("代理声明类型:1弹窗,2链接,3图片,4文件")
+    private Integer statementType;
+
+    /**
+     * 声明弹窗内容
+     */
+    @ApiModelProperty("声明弹窗内容")
+    private String statementContent;
+
+    /**
+     * 声明链接
+     */
+    @ApiModelProperty("声明链接")
+    private String statementlink;
+
+    /**
+     * 声明图片
+     */
+    @ApiModelProperty("声明图片")
+    private String statementImage;
+
+    /**
+     * 声明文件名称
+     */
+    @ApiModelProperty("声明文件名称")
+    private String statementFileName;
+
+}

+ 2 - 2
src/main/java/com/caimei/model/vo/ShopVo.java → src/main/java/com/caimei/model/vo/ShopListVo.java

@@ -15,7 +15,7 @@ import java.util.List;
  * @date : 2021/5/11
  */
 @Data
-public class ShopVo implements Serializable {
+public class ShopListVo implements Serializable {
     /**
      * 供应商用户id
      */
@@ -38,7 +38,7 @@ public class ShopVo implements Serializable {
      * 所属品牌
      */
     @ApiModelProperty("所属品牌")
-    private Integer brandName;
+    private String brandName;
 
     /**
      * 手机号

+ 59 - 0
src/main/java/com/caimei/service/AuthProductService.java

@@ -0,0 +1,59 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.vo.ProductListVo;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/17
+ */
+public interface AuthProductService {
+
+    /**
+     * 授权商品列表
+     *
+     * @param authId        授权id
+     * @param productName   商品名称
+     * @param snCode        商品SN码
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return  ProductListVo
+     */
+    ResponseJson<PageInfo<ProductListVo>> getProductList(Integer authId, String productName, String snCode, Integer pageNum, Integer pageSize);
+
+    /**
+     * 更新授权商品状态
+     * @param productId     授权商品id
+     * @param status        上架状态:0下架 1上架
+     * @return  ResponseJson
+     */
+    ResponseJson updateProductStatus(Integer productId, Integer status);
+
+    /**
+     * 删除授权商品
+     * @param productId     授权商品Id
+     * @return  ResponseJson
+     */
+    ResponseJson deleteProduct(Integer productId);
+
+    /**
+     * 添加/编辑授权商品
+     * @param productSaveDto {
+     *                   productId              授权商品id
+     *                   authId                 授权id
+     *                   productName            商品名称
+     *                   snCode                 商品SN码
+     *                   productImage           商品图片
+     *                   certificateImage       授权牌照
+     *                   status                 上架状态:0下架,1上架
+     *                   createBy               创建人id
+     *                   paramList              商品参数列表
+     * }
+     * @return ResponseJson
+     */
+    ResponseJson saveProduct(ProductSaveDto productSaveDto);
+}

+ 3 - 0
src/main/java/com/caimei/service/AuthService.java

@@ -2,8 +2,11 @@ package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.BrandVo;
 import com.github.pagehelper.PageInfo;
 
+import java.util.List;
+
 /**
  * Description
  *

+ 31 - 3
src/main/java/com/caimei/service/ShopService.java

@@ -2,10 +2,15 @@ package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ShopSaveDto;
-import com.caimei.model.vo.ShopVo;
+import com.caimei.model.vo.BrandVo;
+import com.caimei.model.vo.CountryVo;
+import com.caimei.model.vo.ShopFormVo;
+import com.caimei.model.vo.ShopListVo;
 import com.github.pagehelper.PageInfo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -25,7 +30,7 @@ public interface ShopService {
      * @param pageSize  一页多少条
      * @return PageInfo<ShopVo>
      */
-    ResponseJson<PageInfo<ShopVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize);
 
     /**
      * 更新供应商状态
@@ -72,5 +77,28 @@ public interface ShopService {
      */
     ResponseJson saveShop(ShopSaveDto shopSaveDto);
 
-    ResponseJson<ShopVo> getShopFormData(Integer authUserId);
+    /**
+     * 获取供应商表单数据
+     * @param authUserId 供应商用户id
+     * @return  ShopVo
+     */
+    ResponseJson<ShopFormVo> getShopFormData(Integer authUserId);
+
+    /**
+     * 根据供应商用户id删除代理声明文件
+     */
+    void deleteFileByUserId(Integer authUserId);
+
+    /**
+     * 品牌列表
+     * @param type 1品牌方品牌列表,2代理商品牌列表
+     * @return AuthVo
+     */
+    ResponseJson<List<BrandVo>> getBrandList(Integer type);
+
+    /**
+     * 产地国家列表
+     * @return CountryVo
+     */
+    ResponseJson<List<CountryVo>> getCountryList();
 }

+ 0 - 2
src/main/java/com/caimei/service/UserService.java

@@ -2,9 +2,7 @@ package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.PasswordDto;
-import com.caimei.model.vo.ShopVo;
 import com.caimei.model.vo.UserLoginVo;
-import com.github.pagehelper.PageInfo;
 
 /**
  * Description

+ 151 - 0
src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java

@@ -0,0 +1,151 @@
+package com.caimei.service.impl;
+
+import com.caimei.mapper.AuthProductMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.ProductSaveDto;
+import com.caimei.model.po.ProductParamPo;
+import com.caimei.model.po.ProductPo;
+import com.caimei.model.vo.ProductListVo;
+import com.caimei.service.AuthProductService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/17
+ */
+@Slf4j
+@Service
+public class AuthProductServiceImpl implements AuthProductService {
+
+    @Resource
+    private AuthProductMapper authProductMapper;
+
+    @Override
+    public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer authId, String productName, String snCode, Integer pageNum, Integer pageSize) {
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入授权id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductListVo> productList = authProductMapper.getProductList(authId, productName, snCode);
+        PageInfo<ProductListVo> pageData = new PageInfo<>(productList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson updateProductStatus(Integer productId, Integer status) {
+        if (productId == null) {
+            return ResponseJson.error("请输入用户id");
+        }
+        if (status == null) {
+            return ResponseJson.error("请输入要更新的状态值");
+        } else if (status != 0 && status != 1) {
+            return ResponseJson.error("状态值只能为0或1");
+        }
+        authProductMapper.updateProductStatusByProductId(productId, status);
+        if (status == 0) {
+            return ResponseJson.success("下架授权商品成功");
+        } else {
+            return ResponseJson.success("上架授权商品成功");
+        }
+    }
+
+    @Override
+    public ResponseJson deleteProduct(Integer productId) {
+        if (null == productId) {
+            return ResponseJson.error("参数异常,请输入授权商品id");
+        }
+        authProductMapper.deleteProductByProductId(productId);
+        return ResponseJson.success("删除授权商品成功");
+    }
+
+    @Override
+    public ResponseJson saveProduct(ProductSaveDto productSaveDto) {
+        Integer productId = productSaveDto.getProductId();
+        Integer authId = productSaveDto.getAuthId();
+        String productName = productSaveDto.getProductName();
+        String snCode = productSaveDto.getSnCode();
+        String productImage = productSaveDto.getProductImage();
+        String certificateImage = productSaveDto.getCertificateImage();
+        Integer status = productSaveDto.getStatus();
+        Integer createBy = productSaveDto.getCreateBy();
+        List<ProductParamPo> paramList = productSaveDto.getParamList();
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入授权id", null);
+        }
+        if (StringUtils.isEmpty(productName)) {
+            return ResponseJson.error("参数异常,请输入商品名称", null);
+        }
+        if (StringUtils.isEmpty(snCode)) {
+            return ResponseJson.error("参数异常,请输入商品SN码", null);
+        }
+        Integer productIdBySnCode = authProductMapper.getProductIdBySnCode(snCode);
+        if (null != productIdBySnCode) {
+            return ResponseJson.error("参数异常,该商品SN码已存在,请重新输入", null);
+        }
+        if (StringUtils.isEmpty(productImage)) {
+            return ResponseJson.error("参数异常,请上传商品图片", null);
+        }
+        if (StringUtils.isEmpty(certificateImage)) {
+            return ResponseJson.error("参数异常,请上传授权牌照", null);
+        }
+        if (null == status) {
+            return ResponseJson.error("参数异常,请输入商品状态值", null);
+        } else if (status != 0 && status != 1) {
+            return ResponseJson.error("商品状态值只能为0或1");
+        }
+        if (null == paramList || paramList.size() <= 0) {
+            return ResponseJson.error("参数异常,商品参数列表不能为空", null);
+        }
+        // 是否为添加操作
+        Boolean insertFlag = null == productId;
+        /*
+            组装商品数据
+         */
+        ProductPo product = new ProductPo();
+        // 授权id
+        product.setAuthId(authId);
+        // 商品名称
+        product.setProductName(productName);
+        // sn码
+        product.setSnCode(snCode);
+        // 商品图片
+        product.setProductImage(productImage);
+        // 授权牌照
+        product.setCertificateImage(certificateImage);
+        // 上架状态:0下架,1上架
+        product.setStatus(status);
+        if (insertFlag) {
+            // 创建人id
+            product.setCreateBy(createBy);
+            // 创建时间
+            product.setCreateTime(new Date());
+            // 插入授权商品
+            authProductMapper.insertProduct(product);
+        } else {
+            // 商品id
+            product.setProductId(productId);
+            // 更新授权商品
+            authProductMapper.updateProductByProductId(product);
+        }
+        // 删除商品参数
+        authProductMapper.deleteParamsByProductId(product.getProductId());
+        // 保存商品参数
+        paramList.forEach(param->{
+            if (StringUtils.isNotBlank(param.getParamName()) && StringUtils.isNotBlank(param.getParamContent())) {
+                authProductMapper.insertProductParam(product.getProductId(), param.getParamName(), param.getParamContent());
+            }
+        });
+        return ResponseJson.success("保存授权商品成功");
+    }
+}

+ 8 - 8
src/main/java/com/caimei/service/impl/AuthServiceImpl.java

@@ -4,6 +4,7 @@ import com.caimei.mapper.AuthMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.BrandVo;
 import com.caimei.service.AuthService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -51,9 +52,9 @@ public class AuthServiceImpl implements AuthService {
         }
         authMapper.updateAuthStatusByAuthId(authId, status);
         if (status == 0) {
-            return ResponseJson.success("停用品牌授权成功");
+            return ResponseJson.success("下架品牌授权成功");
         } else {
-            return ResponseJson.success("启用品牌授权成功");
+            return ResponseJson.success("上架品牌授权成功");
         }
     }
 
@@ -74,12 +75,10 @@ public class AuthServiceImpl implements AuthService {
         if (StringUtils.isEmpty(authParty)) {
             return ResponseJson.error("参数异常,请输入授权机构名称");
         }
-        if (null == authUserId) {
+        if (null == status) {
             return ResponseJson.error("参数异常,请输入授权状态值");
-        } else {
-            if (status != 0 && status != 1) {
-                return ResponseJson.error("参数异常,授权状态值只能为0或1");
-            }
+        } else if (status != 0 && status != 1) {
+            return ResponseJson.error("参数异常,授权状态值只能为0或1");
         }
         if (null == createBy) {
             return ResponseJson.error("参数异常,请输入创建人id");
@@ -94,8 +93,9 @@ public class AuthServiceImpl implements AuthService {
         if (null == authId) {
             auth.setCreateBy(createBy);
             auth.setCreateTime(new Date());
-        } else
+        } else {
             auth.setId(authId);
+        }
         /*
             保存授权
          */

+ 41 - 29
src/main/java/com/caimei/service/impl/ShopServiceImpl.java

@@ -7,7 +7,10 @@ import com.caimei.model.dto.ShopSaveDto;
 import com.caimei.model.po.CmBrandAuthFilePo;
 import com.caimei.model.po.ShopInfoPo;
 import com.caimei.model.po.UserPo;
-import com.caimei.model.vo.ShopVo;
+import com.caimei.model.vo.BrandVo;
+import com.caimei.model.vo.CountryVo;
+import com.caimei.model.vo.ShopFormVo;
+import com.caimei.model.vo.ShopListVo;
 import com.caimei.service.ShopService;
 import com.caimei.utils.AliyunSmsUtil;
 import com.caimei.utils.CodeUtil;
@@ -17,7 +20,6 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -42,14 +44,12 @@ public class ShopServiceImpl implements ShopService {
     private ShopMapper shopMapper;
     @Resource
     private UserMapper userMapper;
-    @Value("${caimei.oldapi}")
-    private String oldapi;
 
     @Override
-    public ResponseJson<PageInfo<ShopVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-        List<ShopVo> shopList = shopMapper.getShopList(shopName, shopType, brandId, mobile, linkMan);
-        PageInfo<ShopVo> pageData = new PageInfo<>(shopList);
+        List<ShopListVo> shopList = shopMapper.getShopList(shopName, shopType, brandId, mobile, linkMan);
+        PageInfo<ShopListVo> pageData = new PageInfo<>(shopList);
         return ResponseJson.success(pageData);
     }
 
@@ -91,7 +91,6 @@ public class ShopServiceImpl implements ShopService {
 
     @Override
     public ResponseJson<Integer> uploadFile(Integer authUserId, MultipartFile file) {
-        System.out.println(oldapi);
         String fileAllName = file.getOriginalFilename();
         String fileType = fileAllName.substring(fileAllName.lastIndexOf(".") + 1);
         String fileName = file.getResource().getFilename();
@@ -135,7 +134,8 @@ public class ShopServiceImpl implements ShopService {
         }
     }
 
-    private void deleteFileByUserId(Integer authUserId) {
+    @Override
+    public void deleteFileByUserId(Integer authUserId) {
         CmBrandAuthFilePo searchFile = new CmBrandAuthFilePo();
         searchFile.setAuthUserId(authUserId);
         CmBrandAuthFilePo oldFile = shopMapper.getStatementFile(searchFile);
@@ -155,8 +155,10 @@ public class ShopServiceImpl implements ShopService {
         if (shopType == null) {
             return ResponseJson.error("请选择供应商类型", null);
         }
+        // 是否为添加操作
+        Boolean insertFlag = null == shopSaveDto.getAuthUserId();
         // 更新品牌授权logo
-        shopMapper.updateBrandAuthLogo(shopSaveDto.getBrandId());
+        shopMapper.updateBrandAuthLogo(shopSaveDto.getBrandId(),shopSaveDto.getBrandAuthLogo());
         /*
             组装供应商用户数据
          */
@@ -169,7 +171,7 @@ public class ShopServiceImpl implements ShopService {
         shop.setLinkMan(shopSaveDto.getLinkMan());
         // 供应商状态
         shop.setStatus(shopSaveDto.getShopStatus());
-        if (null == shopSaveDto.getAuthUserId()) {
+        if (insertFlag) {
             // 用户身份:1管理员,2供应商
             shop.setUserIdentity(2);
             // 创建管理员id
@@ -177,16 +179,12 @@ public class ShopServiceImpl implements ShopService {
             // 创建时间
             shop.setCreateTime(new Date());
             // 设置随机8位密码
-            shop.setPassword(CodeUtil.generateCode(8));
-        } else {
-            shop.setAuthUserId(shopSaveDto.getAuthUserId());
-        }
-        /*
-            保存供应商用户
-         */
-        if (null == shopSaveDto.getAuthUserId()) {
+            shop.setPassword(Md5Util.md5(CodeUtil.generateCode(8)));
+            // 插入供应商用户
             shopMapper.insertShop(shop);
         } else {
+            shop.setAuthUserId(shopSaveDto.getAuthUserId());
+            // 更新供应商用户
             shopMapper.updateShopByUserId(shop);
         }
         /*
@@ -208,21 +206,24 @@ public class ShopServiceImpl implements ShopService {
                 shopInfo.setStatementContent(shopSaveDto.getStatementContent());
             } else if (2 == shopSaveDto.getStatementType()) {
                 // 声明链接
-                shopInfo.setStatementlink(shopSaveDto.getStatementLink());
+                shopInfo.setStatementLink(shopSaveDto.getStatementLink());
             } else if (3 == shopSaveDto.getStatementType()) {
                 // 声明图片
                 shopInfo.setStatementImage(shopSaveDto.getStatementImage());
             }
             if (4 == shopSaveDto.getStatementType()) {
-                // 更新代理声明文件
-                Integer statementFileId = shopSaveDto.getStatementFileId();
-                shopMapper.updateFileUserId(statementFileId, shop.getAuthUserId());
-            } else {
+                if (insertFlag){
+                    // 更新代理声明文件
+                    Integer statementFileId = shopSaveDto.getStatementFileId();
+                    shopMapper.updateFileUserId(statementFileId, shop.getAuthUserId());
+                }
+            } else if (!insertFlag){
                 // 没有选择文件代理声明的情况下,若存在原来的文件,删除代理声明文件
                 deleteFileByUserId(shop.getAuthUserId());
             }
         }
-        if (null == shopSaveDto.getAuthUserId()) {
+        // 保存供应商信息
+        if (insertFlag) {
             shopMapper.insertShopInfo(shopInfo);
         } else {
             shopMapper.updateShopInfoByUserId(shopInfo);
@@ -230,13 +231,24 @@ public class ShopServiceImpl implements ShopService {
         return ResponseJson.success("保存供应商成功", null);
     }
 
-
     @Override
-    public ResponseJson<ShopVo> getShopFormData(Integer authUserId) {
+    public ResponseJson<ShopFormVo> getShopFormData(Integer authUserId) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
-        shopMapper.getShopByAuthUserId(authUserId);
-        return null;
+        ShopFormVo shopForm = shopMapper.getShopByAuthUserId(authUserId);
+        return ResponseJson.success(shopForm);
+    }
+
+    @Override
+    public ResponseJson<List<BrandVo>> getBrandList(Integer type) {
+        List<BrandVo> brandList = shopMapper.getBrandList(type);
+        return ResponseJson.success(brandList);
+    }
+
+    @Override
+    public ResponseJson<List<CountryVo>> getCountryList() {
+        List<CountryVo> countryList =  shopMapper.getCountryList();
+        return ResponseJson.success(countryList);
     }
 }

+ 6 - 0
src/main/resources/backup.sql

@@ -26,7 +26,9 @@ CREATE TABLE `cm_brand_auth_shop_info` (
     ENGINE = InnoDB
     DEFAULT CHARACTER SET = utf8
     COMMENT = '正品联盟供应商信息';
+
 INSERT INTO `cm_brand_auth_user` (`authUserId`, `name`, `password`, `userIdentity`, `status`) VALUES ('1', 'admin', '21D34CF4A2F21FDD791C4C1B67C3F954', '1', '1');
+
 ALTER TABLE `cm_brand_auth_file`
     CHANGE COLUMN `brandAuthId` `authUserId` INT NULL DEFAULT NULL COMMENT '授权用户id' ;
 
@@ -42,3 +44,7 @@ ALTER TABLE `cm_brand_auth`
     DROP COLUMN `brandId`,
     ADD COLUMN `authUserId` INT NULL COMMENT '供应商用户id' AFTER `id`,
     ADD COLUMN `status` INT NULL COMMENT '上架状态:0已下架,1已上架' AFTER `authParty`;
+
+ALTER TABLE `cm_brand_auth_product`
+    ADD COLUMN `status` INT NULL COMMENT '上架状态:0下架,1上架' AFTER `certificateImage`;
+

+ 11 - 1
src/main/resources/config/beta/application-beta.yml

@@ -71,4 +71,14 @@ caimei:
   #支付链接重定向地址
   redirectLink: https://spi-b.caimei365.com/PayOrder/jumpPage
   #图片服务器
-  imageDomain: https://img-b.caimei365.com
+  imageDomain: https://img-b.caimei365.com
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 119.29.0.46:22122

+ 9 - 6
src/main/resources/config/dev/application-dev.yml

@@ -70,10 +70,13 @@ caimei:
   #图片服务器
   imageDomain: https://img-b.caimei365.com
 
-#阿里云oss存储
-aliyun:
-  accessKeyId: LTAI4GBL3o4YkWnbKYgf2Xia
-  accessKeySecret: dBjAXqbYiEPP6Ukuk2ZsXQeET7FVkK
-  bucketName: caimei-oss
-  endpoint: https://oss-cn-shenzhen.aliyuncs.com
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 192.168.2.100:22122
 

+ 11 - 1
src/main/resources/config/prod/application-prod.yml

@@ -69,4 +69,14 @@ caimei:
   #支付链接重定向地址
   redirectLink: https://spi.caimei365.com/PayOrder/jumpPage
   #图片服务器
-  imageDomain: https://img-b.caimei365.com
+  imageDomain: https://img.caimei365.com
+
+#DFS配置
+fdfs:
+  so-timeout: 5000 #上传的超时时间
+  connect-timeout: 2000 #连接超时时间
+  thumb-image:             #缩略图生成参数
+    width: 150
+    height: 150
+  tracker-list:            #TrackerList参数,支持多个
+    - 172.31.165.24:22122

+ 5 - 2
src/main/resources/mapper/AuthMapper.xml

@@ -1,7 +1,10 @@
 <?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.mapper.AuthMapper">
-    <insert id="insertAuth" ></insert>
+    <insert id="insertAuth" >
+        insert into cm_brand_auth (authUserId, authParty, status, createTime, createBy)
+        values (#{authUserId}, #{authParty}, #{status}, #{createTime}, #{createBy})
+    </insert>
     <update id="updateAuthStatusByAuthId">
         update cm_brand_auth
         set status = #{status}
@@ -11,7 +14,7 @@
         update cm_brand_auth
         set authParty = #{authParty},
             status    = #{status}
-        where id = #{authId}
+        where id = #{id}
     </update>
     <delete id="deleteAuthByAuthId">
         delete from cm_brand_auth where id = #{authId}

+ 48 - 0
src/main/resources/mapper/AuthProductMapper.xml

@@ -0,0 +1,48 @@
+<?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.mapper.AuthProductMapper">
+    <insert id="insertProduct">
+        insert into cm_brand_auth_product(`authId`, `name`, `snCode`, `image`, `certificateImage`, `status`,
+                                          `createTime`, `createBy`)
+        values (#{authId}, #{productName}, #{snCode}, #{productImage}, #{certificateImage}, #{status}, #{createTime},
+                #{createBy})
+    </insert>
+    <insert id="insertProductParam">
+        insert into cm_brand_product_param (`productId`, `name`, `content`)
+        values (#{productId}, #{paramName}, #{paramContent})
+    </insert>
+
+    <update id="updateProductStatusByProductId">
+        update cm_brand_auth_product
+        set status = #{status}
+        where id = #{productId}
+    </update>
+    <update id="updateProductByProductId">
+        update cm_brand_auth_product
+        set `name`             = #{productName},
+            `snCode`           = #{snCode},
+            `image`            = #{productImage},
+            `certificateImage` = #{certificateImage}
+        where id = #{productId};
+    </update>
+    <delete id="deleteProductByProductId">
+        delete from cm_brand_auth_product where id = #{productId}
+    </delete>
+    <delete id="deleteParamsByProductId">
+        delete from cm_brand_product_param where productId = #{productId}
+    </delete>
+    <select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
+        select id as productId,name as productName,snCode,status,createTime,createBy
+        from cm_brand_auth_product
+        where authId = #{authId}
+        <if test="productName != null and productName != ''">
+            and name like CONCAT('%',#{productName},'%')
+        </if>
+        <if test="snCode != null and snCode != ''">
+            and snCode like CONCAT('%',#{snCode},'%')
+        </if>
+    </select>
+    <select id="getProductIdBySnCode" resultType="java.lang.Integer">
+        select id from cm_brand_auth_product where snCode = #{snCode} limit 1
+    </select>
+</mapper>

+ 39 - 21
src/main/resources/mapper/ShopMapper.xml

@@ -6,9 +6,9 @@
         values (#{authUserId}, #{name}, #{ossName}, #{md5Hex}, #{uploadTime})
     </insert>
     <insert id="insertShop"  keyColumn="authUserId" keyProperty="authUserId" useGeneratedKeys="true" parameterType="com.caimei.model.po.UserPo">
-        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `userIdentity`, `createTime`, `createBy`,
-                                        `status`)
-        values (#{name}, #{mobile}, #{password}, #{userIdentity}, #{createTime}, #{createBy}, #{status})
+        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `linkMan`, `userIdentity`, `createTime`,
+                                        `createBy`,`status`)
+        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{createTime}, #{createBy}, #{status});
     </insert>
     <insert id="insertShopInfo">
         insert into cm_brand_auth_shop_info
@@ -50,7 +50,7 @@
     </update>
     <update id="updateBrandAuthLogo">
         update cm_brand
-        set authLogo = #{authLogo}
+        set authLogo = #{brandAuthLogo}
         where id = #{brandId}
     </update>
     <update id="updateFileUserId">
@@ -68,25 +68,27 @@
     </update>
     <update id="updateShopInfoByUserId">
         update cm_brand_auth_shop_info
-        set type = #{type},brandId = #{brandId},countryId=#{countryId}
-        <if test="statementType != null">
-            ,statementType = #{statementType}
-        </if>
-        <if test="statementContent != null and statementContent != ''">
-            ,statementContent = #{statementContent}
-        </if>
-        <if test="statementLink !=  and statementLink != ''">
-            ,statementLink = #{statementLink}
-        </if>
-        <if test="statementImage !=  and statementImage != ''">
-            ,statementImage = #{statementImage}
-        </if>
-
+        <set>
+            type = #{type},brandId = #{brandId},countryId=#{countryId},
+            <if test="statementType != null">
+                statementType = #{statementType},
+            </if>
+            <if test="statementContent != null and statementContent != ''">
+                statementContent = #{statementContent},
+            </if>
+            <if test="statementLink != null and statementLink != ''">
+                statementLink = #{statementLink},
+            </if>
+            <if test="statementImage != null and statementImage != ''">
+                statementImage = #{statementImage},
+            </if>
+        </set>
+        where authUserId = #{authUserId}
     </update>
     <delete id="deleteStatementFile">
         delete from cm_brand_auth_file where id = #{id}
     </delete>
-    <select id="getShopList" resultType="com.caimei.model.vo.ShopVo">
+    <select id="getShopList" resultType="com.caimei.model.vo.ShopListVo">
         select u.authUserId,u.name,s.type,cb.name as brandName,u.mobile,u.linkMan,
             u.status as shopStatus,u.createTime,
             (select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy
@@ -133,10 +135,26 @@
     <select id="getFileNumByMd5Hex" resultType="java.lang.Integer">
         select count(*) from cm_brand_auth_file where md5Hex = #{md5Hex}
     </select>
-    <select id="getShopByAuthUserId" resultType="com.caimei.model.vo.ShopVo">
-        select u.authUserId,u.name,u.mobile,u.linkMan,s.type,s.brandId,s.countryId,b.authLogo
+    <select id="getShopByAuthUserId" resultType="com.caimei.model.vo.ShopFormVo">
+        select u.authUserId,u.name,u.mobile,u.linkMan,u.status as shopStatus,s.type,s.brandId,s.countryId,b.authLogo,
+               s.statementType,s.statementContent,s.statementLink,s.statementImage,f.name as statementFileName
                from cm_brand_auth_user u
                    left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
+                   left join cm_brand_auth_file f on u.authUserId = f.authUserId
                 left join cm_brand b on s.brandId = b.id
+                where u.authUserId = #{authUserId}
+    </select>
+    <select id="getBrandList" resultType="com.caimei.model.vo.BrandVo">
+        select id,name,authLogo from cm_brand
+        <where>
+            <if test="type == 1">
+                id not in (select brandId from cm_brand_auth_shop_info where type = 1)
+            </if>
+        </where>
+    </select>
+    <select id="getCountryList" resultType="com.caimei.model.vo.CountryVo">
+        select countryId, name as countryName
+        from country
+        where validFlag = 1
     </select>
 </mapper>