Переглянути джерело

正品联盟资料库优化part1

Aslee 3 роки тому
батько
коміт
dff89a4f24
29 змінених файлів з 1576 додано та 6 видалено
  1. 92 0
      src/main/java/com/caimei/controller/ArticleApi.java
  2. 102 0
      src/main/java/com/caimei/controller/AuthClubApi.java
  3. 91 0
      src/main/java/com/caimei/controller/ImageApi.java
  4. 31 0
      src/main/java/com/caimei/mapper/ArticleMapper.java
  5. 1 0
      src/main/java/com/caimei/mapper/AuthMapper.java
  6. 31 0
      src/main/java/com/caimei/mapper/ClubMapper.java
  7. 35 0
      src/main/java/com/caimei/mapper/ImageMapper.java
  8. 67 0
      src/main/java/com/caimei/model/po/ArticlePo.java
  9. 43 0
      src/main/java/com/caimei/model/po/ClubUserPo.java
  10. 49 0
      src/main/java/com/caimei/model/po/CmBrandArticle.java
  11. 57 0
      src/main/java/com/caimei/model/po/ImagePo.java
  12. 42 0
      src/main/java/com/caimei/model/vo/ArticleVo.java
  13. 42 0
      src/main/java/com/caimei/model/vo/ClubUserVo.java
  14. 29 0
      src/main/java/com/caimei/model/vo/ClubVo.java
  15. 38 0
      src/main/java/com/caimei/model/vo/ImageVo.java
  16. 64 0
      src/main/java/com/caimei/service/ArticleService.java
  17. 59 0
      src/main/java/com/caimei/service/AuthClubService.java
  18. 63 0
      src/main/java/com/caimei/service/ImageService.java
  19. 135 0
      src/main/java/com/caimei/service/impl/ArticleServiceImpl.java
  20. 109 0
      src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java
  21. 7 5
      src/main/java/com/caimei/service/impl/AuthServiceImpl.java
  22. 136 0
      src/main/java/com/caimei/service/impl/ImageServiceImpl.java
  23. 1 0
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  24. 52 1
      src/main/resources/backup.sql
  25. 59 0
      src/main/resources/mapper/ArticleMapper.xml
  26. 7 0
      src/main/resources/mapper/AuthMapper.xml
  27. 61 0
      src/main/resources/mapper/ClubMapper.xml
  28. 64 0
      src/main/resources/mapper/ImageMapper.xml
  29. 9 0
      src/test/java/com/caimei/AdminApplicationTests.java

+ 92 - 0
src/main/java/com/caimei/controller/ArticleApi.java

@@ -0,0 +1,92 @@
+package com.caimei.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.ArticleVo;
+import com.caimei.service.ArticleService;
+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/7/8
+ */
+@Api(tags = "资料库文章API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/data/article")
+public class ArticleApi {
+
+    private final ArticleService articleService;
+
+
+    @ApiOperation("文章列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1文章列表,2文章审核列表"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "articleTitle", required = false, value = "文章标题"),
+            @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
+            @ApiImplicitParam(name = "status", required = false, value = "文章状态:0已下线,1已上线,2待上线"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/list")
+    public ResponseJson<PageInfo<ArticleVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status,
+                                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return articleService.getArticleList(listType, authUserId, articleTitle, auditStatus, status, pageNum, pageSize);
+    }
+
+    @ApiOperation("添加/编辑文章")
+    @ApiImplicitParam(name = "params", value = "articleId:文章id;authUserId:供应商用户id;articleTitle:文章标题;articleImage:文章图片;articleContent:文章内容;createBy:创建人用户id", required = true)
+    @PostMapping("/save")
+    public ResponseJson saveArticle(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer articleId = paramsMap.getInteger("articleId");
+        Integer authUserId = paramsMap.getInteger("authUserId");
+        String articleTitle = paramsMap.getString("articleTitle");
+        String articleImage = paramsMap.getString("articleImage");
+        String articleContent = paramsMap.getString("articleContent");
+        return articleService.saveArticle(articleId, authUserId, articleTitle, articleImage, articleContent);
+    }
+
+    @ApiOperation("更新文章状态")
+    @ApiImplicitParam(name = "params", value = "articleId:文章id;status:文章状态:0停用 1启用;", required = true)
+    @PostMapping("/update/status")
+    public ResponseJson updateArticleStatus(@RequestBody Map<String,Integer> params) {
+        Integer articleId = params.get("articleId");
+        Integer status = params.get("status");
+        return articleService.updateArticleStatus(articleId, status);
+    }
+
+    @ApiOperation("删除文章")
+    @ApiImplicitParam(name = "params", value = "articleId:文章id", required = true)
+    @PostMapping("/delete")
+    public ResponseJson deleteArticle(@RequestBody Map<String,Integer> params) {
+        Integer articleId = params.get("articleId");
+        return articleService.deleteArticle(articleId);
+    }
+
+    @ApiOperation("审核文章")
+    @ApiImplicitParam(name = "params", value = "articleId:文章id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
+    @PostMapping("/audit")
+    public ResponseJson auditArticle(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer articleId = paramsMap.getInteger("articleId");
+        Integer auditStatus = paramsMap.getInteger("auditStatus");
+        String invalidReason = paramsMap.getString("invalidReason");
+        Integer auditBy = paramsMap.getInteger("auditBy");
+        return articleService.auditArticle(articleId, auditStatus, invalidReason, auditBy);
+    }
+}

+ 102 - 0
src/main/java/com/caimei/controller/AuthClubApi.java

@@ -0,0 +1,102 @@
+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.ClubUserVo;
+import com.caimei.model.vo.ClubVo;
+import com.caimei.service.AuthClubService;
+import com.caimei.service.AuthService;
+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/11
+ */
+@Api(tags = "机构API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/club")
+public class AuthClubApi {
+
+    private final AuthClubService authClubService;
+
+
+    @ApiOperation("机构列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/list")
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer authUserId, String clubName,
+                                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authClubService.getClubList(authUserId, clubName, pageNum, pageSize);
+    }
+
+
+    @ApiOperation("机构用户列表")
+    @GetMapping("/user/list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authId", required = true, value = "机构id"),
+            @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
+            @ApiImplicitParam(name = "status", required = false, value = "状态:1未绑定,2已绑定,3已过期"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authId, String mobile, Integer status,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authClubService.getClubUserList(authId, mobile, status, pageNum, pageSize);
+    }
+
+    @ApiOperation("生成邀请码")
+    @PostMapping("/user/code/generate")
+    @ApiImplicitParam(name = "params", value = "authId:授权机构id", required = true)
+    public ResponseJson generateCode(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer authId = paramsMap.getInteger("authId");
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入授权机构id");
+        }
+        return authClubService.generateCode(authId);
+    }
+
+    @ApiOperation("解绑邀请码")
+    @PostMapping("/user/code/unbind")
+    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id", required = true)
+    public ResponseJson unbindCode(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer clubUserId = paramsMap.getInteger("clubUserId");
+        if (null == clubUserId) {
+            return ResponseJson.error("参数异常,请输入机构用户id");
+        }
+        return authClubService.unbindCode(clubUserId);
+    }
+
+    @ApiOperation("更新邀请码")
+    @PostMapping("/user/code/update")
+    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id", required = true)
+    public ResponseJson updateCode(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer clubUserId = paramsMap.getInteger("clubUserId");
+        if (null == clubUserId) {
+            return ResponseJson.error("参数异常,请输入机构用户id");
+        }
+        return authClubService.updateCode(clubUserId);
+    }
+}

+ 91 - 0
src/main/java/com/caimei/controller/ImageApi.java

@@ -0,0 +1,91 @@
+package com.caimei.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.ImageVo;
+import com.caimei.service.ImageService;
+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/7/9
+ */
+@Api(tags = "资料库图片API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/data/image")
+public class ImageApi {
+
+    private final ImageService imageService;
+
+
+    @ApiOperation("图片列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1图片列表,2图片审核列表"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "imageTitle", required = false, value = "图片标题"),
+            @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
+            @ApiImplicitParam(name = "status", required = false, value = "图片状态:0已下线,1已上线,2待上线"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/list")
+    public ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status,
+                                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return imageService.getImageList(listType, authUserId, imageTitle, auditStatus, status, pageNum, pageSize);
+    }
+
+    @ApiOperation("添加/编辑图片")
+    @ApiImplicitParam(name = "params", value = "imageId:图片id;authUserId:供应商用户id;imageTitle:图片标题;imageImage:图片图片;imageContent:图片内容;createBy:创建人用户id", required = true)
+    @PostMapping("/save")
+    public ResponseJson saveImage(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer imageId = paramsMap.getInteger("imageId");
+        Integer authUserId = paramsMap.getInteger("authUserId");
+        String imageTitle = paramsMap.getString("imageTitle");
+        String[] imageArr = (String[]) paramsMap.get("imageArr");
+        return imageService.saveImage(imageId, authUserId, imageTitle, imageArr);
+    }
+
+    @ApiOperation("更新图片状态")
+    @ApiImplicitParam(name = "params", value = "imageId:图片id;status:图片状态:0停用 1启用;", required = true)
+    @PostMapping("/update/status")
+    public ResponseJson updateImageStatus(@RequestBody Map<String,Integer> params) {
+        Integer imageId = params.get("imageId");
+        Integer status = params.get("status");
+        return imageService.updateImageStatus(imageId, status);
+    }
+
+    @ApiOperation("删除图片")
+    @ApiImplicitParam(name = "params", value = "imageId:图片id", required = true)
+    @PostMapping("/delete")
+    public ResponseJson deleteImage(@RequestBody Map<String,Integer> params) {
+        Integer imageId = params.get("imageId");
+        return imageService.deleteImage(imageId);
+    }
+
+    @ApiOperation("审核图片")
+    @ApiImplicitParam(name = "params", value = "imageId:图片id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
+    @PostMapping("/audit")
+    public ResponseJson auditImage(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer imageId = paramsMap.getInteger("imageId");
+        Integer auditStatus = paramsMap.getInteger("auditStatus");
+        String invalidReason = paramsMap.getString("invalidReason");
+        Integer auditBy = paramsMap.getInteger("auditBy");
+        return imageService.auditImage(imageId, auditStatus, invalidReason, auditBy);
+    }
+}

+ 31 - 0
src/main/java/com/caimei/mapper/ArticleMapper.java

@@ -0,0 +1,31 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.ArticlePo;
+import com.caimei.model.vo.ArticleVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/8
+ */
+@Mapper
+public interface ArticleMapper {
+
+    List<ArticleVo> getArticleList(Integer listType, @Param("authUserId") Integer authUserId, @Param("articleTitle") String articleTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
+
+    void insertArticle(ArticlePo article);
+
+    void updateArticleByArticleId(ArticlePo article);
+
+    void updateArticleStatusByArticleId(@Param("articleId") Integer articleId, @Param("status") Integer status);
+
+    void deleteArticleByArticleId(Integer articleId);
+
+    void updateArticleAuditStatus(@Param("articleId") Integer articleId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
+}

+ 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.ClubVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 

+ 31 - 0
src/main/java/com/caimei/mapper/ClubMapper.java

@@ -0,0 +1,31 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.ClubUserPo;
+import com.caimei.model.vo.ClubUserVo;
+import com.caimei.model.vo.ClubVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/8
+ */
+@Mapper
+public interface ClubMapper {
+    List<ClubVo> getClubList(@Param("authUserId") Integer authUserId, @Param("clubName") String clubName);
+
+    List<ClubUserVo> getClubUserList(@Param("authId") Integer authId, @Param("mobile") String mobile, @Param("status") Integer status);
+
+    void insertClubUser(ClubUserPo clubUser);
+
+    void unbindClubUser(Integer clubUserId);
+
+    void updateCode(@Param("clubUserId") Integer clubUserId, @Param("invitationCode") String invitationCode, @Param("updateTime") Date updateTime, @Param("invitationCodeTime") Date invitationCodeTime);
+
+    Integer getStatusByClubUserId(Integer clubUserId);
+}

+ 35 - 0
src/main/java/com/caimei/mapper/ImageMapper.java

@@ -0,0 +1,35 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.ImagePo;
+import com.caimei.model.vo.ImageVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/8
+ */
+@Mapper
+public interface ImageMapper {
+
+    List<ImageVo> getImageList(Integer listType, @Param("authUserId") Integer authUserId, @Param("imageTitle") String imageTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
+
+    void insertImage(ImagePo image);
+
+    void updateImageByImageId(ImagePo image);
+
+    void updateImageStatusByImageId(@Param("imageId") Integer imageId, @Param("status") Integer status);
+
+    void deleteImageByImageId(Integer imageId);
+
+    void updateImageAuditStatus(@Param("imageId") Integer imageId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
+
+    void deleteImageDetail(Integer imageId);
+
+    void insertImageDetail(@Param("imageId") Integer imageId, @Param("image") String image);
+}

+ 67 - 0
src/main/java/com/caimei/model/po/ArticlePo.java

@@ -0,0 +1,67 @@
+package com.caimei.model.po;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * cm_brand_article
+ * @author  Aslee
+ */
+@Data
+public class ArticlePo {
+    /**
+     * 文章id
+     */
+    private Integer id;
+
+    /**
+     * 供应商用户id
+     */
+    private Integer authUserId;
+
+    /**
+     * 文章标题
+     */
+    private String title;
+
+    /**
+     * 文章图片
+     */
+    private String image;
+
+    /**
+     * 文章内容
+     */
+    private String content;
+
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
+    /**
+     * 审核不通过原因
+     */
+    private String invalidReason;
+
+    /**
+     * 上线状态:0已下线,1已上线,2待上线
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 审核人用户id
+     */
+    private Integer auditBy;
+
+    /**
+     * 审核时间
+     */
+    private Date auditTime;
+}

+ 43 - 0
src/main/java/com/caimei/model/po/ClubUserPo.java

@@ -0,0 +1,43 @@
+package com.caimei.model.po;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_auth_user
+ * @author 
+ */
+@Data
+public class ClubUserPo {
+    /**
+     * 机构id
+     */
+    private Integer authId;
+
+    /**
+     * 邀请码
+     */
+    private String invitationCode;
+
+    /**
+     * 状态:1未绑定,2已绑定,3已过期
+     */
+    private Integer status;
+
+    /**
+     * 添加时间
+     */
+    private Date addTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 邀请码过期时间
+     */
+    private Date invitationCodeTime;
+}

+ 49 - 0
src/main/java/com/caimei/model/po/CmBrandArticle.java

@@ -0,0 +1,49 @@
+package com.caimei.model.po;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * cm_brand_article
+ * @author 
+ */
+@Data
+public class CmBrandArticle implements Serializable {
+    /**
+     * 文章id
+     */
+    private Integer id;
+
+    /**
+     * 文章标题
+     */
+    private String title;
+
+    /**
+     * 文章图片
+     */
+    private String image;
+
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
+    /**
+     * 审核不通过原因
+     */
+    private String invalidReason;
+
+    /**
+     * 上线状态:0已下线,1已上线,2待上线
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+}

+ 57 - 0
src/main/java/com/caimei/model/po/ImagePo.java

@@ -0,0 +1,57 @@
+package com.caimei.model.po;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_article
+ * @author  Aslee
+ */
+@Data
+public class ImagePo {
+    /**
+     * 图片id
+     */
+    private Integer id;
+
+    /**
+     * 供应商用户id
+     */
+    private Integer authUserId;
+
+    /**
+     * 图片标题
+     */
+    private String title;
+
+    /**
+     * 审核状态:0审核未通过,1审核通过,2待审核
+     */
+    private Integer auditStatus;
+
+    /**
+     * 审核不通过原因
+     */
+    private String invalidReason;
+
+    /**
+     * 上线状态:0已下线,1已上线,2待上线
+     */
+    private Integer status;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 审核人用户id
+     */
+    private Integer auditBy;
+
+    /**
+     * 审核时间
+     */
+    private Date auditTime;
+}

+ 42 - 0
src/main/java/com/caimei/model/vo/ArticleVo.java

@@ -0,0 +1,42 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * cm_brand_article
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class ArticleVo {
+    @ApiModelProperty("文章id")
+    private Integer articleId;
+
+    @ApiModelProperty("文章标题")
+    private String articleTitle;
+
+    @ApiModelProperty("文章图片")
+    private String articleImage;
+
+    @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
+    private Integer auditStatus;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
+
+    @ApiModelProperty("上线状态:0已下线,1已上线,2待上线")
+    private Integer status;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+}

+ 42 - 0
src/main/java/com/caimei/model/vo/ClubUserVo.java

@@ -0,0 +1,42 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_club_user
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class ClubUserVo {
+    @ApiModelProperty("机构id")
+    private Integer clubUserId;
+
+    @ApiModelProperty("机构id")
+    private Integer authId;
+
+    @ApiModelProperty("邀请码")
+    private String invitationCode;
+
+    @ApiModelProperty("状态:0未绑定,1已绑定,2已过期")
+    private Integer status;
+
+    @ApiModelProperty("添加时间")
+    private Date addTime;
+
+    @ApiModelProperty("绑定时间")
+    private Date bindTime;
+
+    @ApiModelProperty("微信昵称")
+    private String nickName;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ApiModelProperty("openId")
+    private String openId;
+}

+ 29 - 0
src/main/java/com/caimei/model/vo/ClubVo.java

@@ -0,0 +1,29 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_auth
+ * @author Aslee
+ * @date 2021/5/17
+ */
+@Data
+public class ClubVo {
+    @ApiModelProperty("机构id")
+    private Integer authId;
+
+    /**
+     * 机构名称
+     */
+    @ApiModelProperty("机构名称")
+    private String clubName;
+
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+}

+ 38 - 0
src/main/java/com/caimei/model/vo/ImageVo.java

@@ -0,0 +1,38 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_image
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class ImageVo {
+    @ApiModelProperty("图片id")
+    private Integer imageId;
+
+    @ApiModelProperty("图片标题")
+    private String imageTitle;
+
+    @ApiModelProperty("审核状态:0审核未通过,1审核通过,2待审核")
+    private Integer auditStatus;
+
+    @ApiModelProperty("审核不通过原因")
+    private String invalidReason;
+
+    @ApiModelProperty("上线状态:0已下线,1已上线,2待上线")
+    private Integer status;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("审核人")
+    private String auditBy;
+
+    @ApiModelProperty("审核时间")
+    private Date auditTime;
+}

+ 64 - 0
src/main/java/com/caimei/service/ArticleService.java

@@ -0,0 +1,64 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.ArticleVo;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/8
+ */
+public interface ArticleService {
+
+    /**
+     * 获取文章列表
+     *
+     * @param listType      列表类型:1文章列表,2文章审核列表
+     * @param authUserId    供应商用户id
+     * @param articleTitle  文章标题
+     * @param auditStatus   审核状态
+     * @param status        上线状态
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return  ArticleVo
+     */
+    ResponseJson<PageInfo<ArticleVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+
+    /**
+     * 添加/编辑文章
+     * @param articleId         文章id
+     * @param authUserId        供应商用户id
+     * @param articleTitle      文章标题
+     * @param articleImage      文章图片
+     * @param articleContent    文章内容
+     * @return  ResponseJson
+     */
+    ResponseJson saveArticle(Integer articleId, Integer authUserId, String articleTitle, String articleImage, String articleContent);
+
+    /**
+     * 更新文章状态
+     * @param articleId     文章id
+     * @param status        文章状态:0停用 1启用
+     * @return  ResponseJson
+     */
+    ResponseJson updateArticleStatus(Integer articleId, Integer status);
+
+    /**
+     * 删除文章
+     * @param articleId     文章id
+     * @return  ResponseJson
+     */
+    ResponseJson deleteArticle(Integer articleId);
+
+    /**
+     * 审核文章
+     * @param articleId         文章id
+     * @param auditStatus       审核状态:0审核未通过,1审核通过,2待审核
+     * @param invalidReason     审核不通过原因
+     * @param auditBy           审核人用户id
+     * @return
+     */
+    ResponseJson auditArticle(Integer articleId, Integer auditStatus, String invalidReason, Integer auditBy);
+}

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

@@ -0,0 +1,59 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.ClubUserVo;
+import com.caimei.model.vo.ClubVo;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+public interface AuthClubService {
+
+    /**
+     * 机构列表
+     *
+     * @param authUserId    供应商用户id
+     * @param clubName      机构名称
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return AuthVo
+     */
+    ResponseJson<PageInfo<ClubVo>> getClubList(Integer authUserId, String clubName, Integer pageNum, Integer pageSize);
+
+    /**
+     * 机构用户列表
+     * @param authId    机构id
+     * @param mobile    手机号
+     * @param status    状态:1未绑定,2已绑定,3已过期
+     * @param pageNum   第几页
+     * @param pageSize  一页多少条
+     * @return  ClubUserVo
+     */
+    ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authId, String mobile, Integer status, Integer pageNum, Integer pageSize);
+
+    /**
+     * 生成邀请码
+     * @param authId
+     * @return
+     */
+    ResponseJson generateCode(Integer authId);
+
+    /**
+     * 解绑邀请码
+     * @param clubUserId
+     * @return
+     */
+    ResponseJson unbindCode(Integer clubUserId);
+
+    /**
+     * 更新邀请码
+     * @param clubUserId
+     * @return
+     */
+    ResponseJson updateCode(Integer clubUserId);
+}

+ 63 - 0
src/main/java/com/caimei/service/ImageService.java

@@ -0,0 +1,63 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.ImageVo;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/8
+ */
+public interface ImageService {
+
+    /**
+     * 获取图片列表
+     *
+     * @param listType      列表类型:1图片列表,2图片审核列表
+     * @param authUserId    供应商用户id
+     * @param imageTitle    图片标题
+     * @param auditStatus   审核状态
+     * @param status        上线状态
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return  ImageVo
+     */
+    ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+
+    /**
+     * 添加/编辑图片
+     * @param imageId           图片id
+     * @param authUserId        供应商用户id
+     * @param imageTitle        图片标题
+     * @param imageArr          图片数组
+     * @return  ResponseJson
+     */
+    ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, String[] imageArr);
+
+    /**
+     * 更新图片状态
+     * @param imageId       图片id
+     * @param status        图片状态:0停用 1启用
+     * @return  ResponseJson
+     */
+    ResponseJson updateImageStatus(Integer imageId, Integer status);
+
+    /**
+     * 删除图片
+     * @param imageId     图片id
+     * @return  ResponseJson
+     */
+    ResponseJson deleteImage(Integer imageId);
+
+    /**
+     * 审核图片
+     * @param imageId           图片id
+     * @param auditStatus       审核状态:0审核未通过,1审核通过,2待审核
+     * @param invalidReason     审核不通过原因
+     * @param auditBy           审核人用户id
+     * @return
+     */
+    ResponseJson auditImage(Integer imageId, Integer auditStatus, String invalidReason, Integer auditBy);
+}

+ 135 - 0
src/main/java/com/caimei/service/impl/ArticleServiceImpl.java

@@ -0,0 +1,135 @@
+package com.caimei.service.impl;
+
+import com.caimei.mapper.ArticleMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.ArticlePo;
+import com.caimei.model.vo.ArticleVo;
+import com.caimei.service.ArticleService;
+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 java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Slf4j
+@Service
+public class ArticleServiceImpl implements ArticleService {
+
+    @Resource
+    private ArticleMapper articleMapper;
+
+    @Override
+    public ResponseJson<PageInfo<ArticleVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+        }
+        listType = null == listType ? 1 : listType;
+        PageHelper.startPage(pageNum, pageSize);
+        List<ArticleVo> articleList = articleMapper.getArticleList(listType, authUserId, articleTitle, auditStatus, status);
+        PageInfo<ArticleVo> pageData = new PageInfo<>(articleList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson saveArticle(Integer articleId, Integer authUserId, String articleTitle, String articleImage, String articleContent) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id");
+        }
+        if (StringUtils.isEmpty(articleTitle)) {
+            return ResponseJson.error("参数异常,请输入文章标题");
+        }
+        if (StringUtils.isEmpty(articleImage)) {
+            return ResponseJson.error("参数异常,请输入文章图片");
+        }
+        if (StringUtils.isEmpty(articleContent)) {
+            return ResponseJson.error("参数异常,请输入文章内容");
+        }
+        // 处理富文本内容
+
+        /*
+            组装文章数据
+         */
+        ArticlePo article = new ArticlePo();
+        article.setTitle(articleTitle);
+        article.setImage(articleImage);
+        article.setContent(articleContent);
+        // 上线状态默认为“待上线”,审核状态为“待审核”
+        article.setStatus(2);
+        article.setAuditStatus(2);
+        if (null == articleId) {
+            article.setAuthUserId(authUserId);
+            article.setCreateTime(new Date());
+            // 插入文章
+            articleMapper.insertArticle(article);
+        } else {
+            article.setId(articleId);
+            // 更新文章
+            articleMapper.updateArticleByArticleId(article);
+        }
+        return ResponseJson.success("保存文章成功");
+    }
+
+    @Override
+    public ResponseJson updateArticleStatus(Integer articleId, Integer status) {
+        if (null == articleId) {
+            return ResponseJson.error("请输入文章id");
+        }
+        if (null == status) {
+            return ResponseJson.error("请输入要更新的状态值");
+        }
+        articleMapper.updateArticleStatusByArticleId(articleId, status);
+        if (0 == status) {
+            return ResponseJson.success("下线品牌授权成功");
+        } else {
+            return ResponseJson.success("上线品牌授权成功");
+        }
+    }
+
+    @Override
+    public ResponseJson deleteArticle(Integer articleId) {
+        if (null == articleId) {
+            return ResponseJson.error("参数异常,请输入文章id");
+        }
+        // 删除文章
+        articleMapper.deleteArticleByArticleId(articleId);
+        return ResponseJson.success("删除文章成功");
+    }
+
+    @Override
+    public ResponseJson auditArticle(Integer articleId, Integer auditStatus, String invalidReason, Integer auditBy) {
+        if (null == articleId) {
+            return ResponseJson.error("请输入文章id");
+        }
+        if (null == auditStatus) {
+            return ResponseJson.error("请输入审核结果");
+        }
+        if (0 == auditStatus && StringUtils.isEmpty(invalidReason)) {
+            return ResponseJson.error("请输入审核不通过的理由");
+        }
+        if (null == auditBy) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        Date auditTime = new Date();
+        // 授权状态更新
+        Integer status = null;
+        if (0 == auditStatus) {
+            // 审核不通过,下线文章
+            status = 0;
+        } else {
+            // 审核通过,上线文章
+            status = 1;
+        }
+        articleMapper.updateArticleAuditStatus(articleId, status, auditStatus, invalidReason, auditBy, auditTime);
+        return ResponseJson.success("审核文章成功");
+    }
+}

+ 109 - 0
src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java

@@ -0,0 +1,109 @@
+package com.caimei.service.impl;
+
+import com.caimei.mapper.AuthMapper;
+import com.caimei.mapper.ClubMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.ClubUserPo;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.vo.AuthVo;
+import com.caimei.model.vo.ClubUserVo;
+import com.caimei.model.vo.ClubVo;
+import com.caimei.service.AuthClubService;
+import com.caimei.service.AuthProductService;
+import com.caimei.service.AuthService;
+import com.caimei.utils.CodeUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.catalina.startup.Catalina;
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Slf4j
+@Service
+public class AuthClubServiceImpl implements AuthClubService {
+
+    @Resource
+    private ClubMapper clubMapper;
+
+    @Override
+    public ResponseJson<PageInfo<ClubVo>> getClubList( Integer authUserId, String clubName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<ClubVo> clubList = clubMapper.getClubList(authUserId, clubName);
+        PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authId, String mobile, Integer status, Integer pageNum, Integer pageSize) {
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入授权机构id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<ClubUserVo> clubUserList = clubMapper.getClubUserList(authId, mobile, status);
+        PageInfo<ClubUserVo> pageData = new PageInfo<>(clubUserList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson generateCode(Integer authId) {
+        // 生成邀请码
+        String invitationCode = CodeUtil.generateCodeInt(6);
+        Date currentTime = new Date();
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(currentTime);
+        calendar.add(Calendar.DATE,1);
+        Date tomorrowTime = calendar.getTime();
+        // 构建机构用户
+        ClubUserPo clubUser = new ClubUserPo();
+        clubUser.setAuthId(authId);
+        clubUser.setAddTime(currentTime);
+        clubUser.setUpdateTime(currentTime);
+        clubUser.setInvitationCode(invitationCode);
+        clubUser.setStatus(0);
+        clubUser.setInvitationCodeTime(tomorrowTime);
+        // 插入机构用户
+        clubMapper.insertClubUser(clubUser);
+        return ResponseJson.success("生成邀请码成功");
+    }
+
+    @Override
+    public ResponseJson unbindCode(Integer clubUserId) {
+        Integer status = clubMapper.getStatusByClubUserId(clubUserId);
+        if (1 != status) {
+            return ResponseJson.error("该邀请码未绑定,无法解绑");
+        }
+        clubMapper.unbindClubUser(clubUserId);
+        return ResponseJson.success("解绑成功");
+    }
+
+    @Override
+    public ResponseJson updateCode(Integer clubUserId) {
+        Integer status = clubMapper.getStatusByClubUserId(clubUserId);
+        if (1 == status) {
+            return ResponseJson.error("该邀请码已绑定用户,无法更新");
+        }
+        Date updateTime = new Date();
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(updateTime);
+        calendar.add(Calendar.DATE,1);
+        Date invitationCodeTime = calendar.getTime();
+        String invitationCode = CodeUtil.generateCodeInt(6);
+        clubMapper.updateCode(clubUserId, invitationCode, updateTime, invitationCodeTime);
+        return ResponseJson.success("更新邀请码成功");
+    }
+}

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

@@ -48,34 +48,36 @@ public class AuthServiceImpl implements AuthService {
         List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, status, auditStatus);
         ListIterator<AuthVo> iterator = authList.listIterator();
         while (iterator.hasNext()) {
+            // 根据是否完成商品信息审核筛选项,进行筛选
             AuthVo auth = iterator.next();
             Integer waitAuditNum = auth.getWaitAuditNum();
             if (waitAuditNum > 0) {
                 auth.setLowerAuditStatus(0);
-                if (null != lowerAuditStatus && 1 == lowerAuditStatus) {
+                if ( 1 == lowerAuditStatus) {
                     iterator.remove();
                 }
             } else {
                 auth.setLowerAuditStatus(1);
-                if (null != lowerAuditStatus && 0 == lowerAuditStatus) {
+                if ( 0 == lowerAuditStatus) {
                     iterator.remove();
                 }
             }
         }
+
         PageInfo<AuthVo> pageData = new PageInfo<>(authList);
         return ResponseJson.success(pageData);
     }
 
     @Override
     public ResponseJson updateAuthStatus(Integer authId, Integer status) {
-        if (authId == null) {
+        if (null == authId) {
             return ResponseJson.error("请输入授权id");
         }
-        if (status == null) {
+        if (null == status) {
             return ResponseJson.error("请输入要更新的状态值");
         }
         authMapper.updateAuthStatusByAuthId(authId, status);
-        if (status == 0) {
+        if (0 == status) {
             return ResponseJson.success("下线品牌授权成功");
         } else {
             return ResponseJson.success("上线品牌授权成功");

+ 136 - 0
src/main/java/com/caimei/service/impl/ImageServiceImpl.java

@@ -0,0 +1,136 @@
+package com.caimei.service.impl;
+
+import com.caimei.mapper.ImageMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.ImagePo;
+import com.caimei.model.vo.ImageVo;
+import com.caimei.service.ImageService;
+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 java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/9
+ */
+@Slf4j
+@Service
+public class ImageServiceImpl implements ImageService {
+
+    @Resource
+    private ImageMapper imageMapper;
+
+    @Override
+    public ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+        }
+        listType = null == listType ? 1 : listType;
+        PageHelper.startPage(pageNum, pageSize);
+        List<ImageVo> imageList = imageMapper.getImageList(listType, authUserId, imageTitle, auditStatus, status);
+        PageInfo<ImageVo> pageData = new PageInfo<>(imageList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, String[] imageArr) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id");
+        }
+        if (StringUtils.isEmpty(imageTitle)) {
+            return ResponseJson.error("参数异常,请输入图片标题");
+        }
+        if (null == imageArr || imageArr.length <= 0) {
+            return ResponseJson.error("参数异常,请上传图片");
+        }
+        /*
+            组装图片数据
+         */
+        ImagePo image = new ImagePo();
+        image.setTitle(imageTitle);
+        // 上线状态默认为“待上线”,审核状态为“待审核”
+        image.setStatus(2);
+        image.setAuditStatus(2);
+        if (null == imageId) {
+            image.setAuthUserId(authUserId);
+            image.setCreateTime(new Date());
+            // 插入图片
+            imageMapper.insertImage(image);
+        } else {
+            image.setId(imageId);
+            // 更新图片
+            imageMapper.updateImageByImageId(image);
+            // 删除原来的图片详情
+            imageMapper.deleteImageDetail(imageId);
+        }
+        // 保存图片详情
+        for (String s : imageArr) {
+            imageMapper.insertImageDetail(image.getId(), s);
+        }
+        return ResponseJson.success("保存图片成功");
+    }
+
+    @Override
+    public ResponseJson updateImageStatus(Integer imageId, Integer status) {
+        if (null == imageId) {
+            return ResponseJson.error("请输入图片id");
+        }
+        if (null == status) {
+            return ResponseJson.error("请输入要更新的状态值");
+        }
+        imageMapper.updateImageStatusByImageId(imageId, status);
+        if (0 == status) {
+            return ResponseJson.success("下线品牌授权成功");
+        } else {
+            return ResponseJson.success("上线品牌授权成功");
+        }
+    }
+
+    @Override
+    public ResponseJson deleteImage(Integer imageId) {
+        if (null == imageId) {
+            return ResponseJson.error("参数异常,请输入图片id");
+        }
+        // 删除图片
+        imageMapper.deleteImageByImageId(imageId);
+        // 删除图片详情
+        imageMapper.deleteImageDetail(imageId);
+        return ResponseJson.success("删除图片成功");
+    }
+
+    @Override
+    public ResponseJson auditImage(Integer imageId, Integer auditStatus, String invalidReason, Integer auditBy) {
+        if (null == imageId) {
+            return ResponseJson.error("请输入图片id");
+        }
+        if (null == auditStatus) {
+            return ResponseJson.error("请输入审核结果");
+        }
+        if (0 == auditStatus && StringUtils.isEmpty(invalidReason)) {
+            return ResponseJson.error("请输入审核不通过的理由");
+        }
+        if (null == auditBy) {
+            return ResponseJson.error("请输入审核人用户id");
+        }
+        Date auditTime = new Date();
+        // 授权状态更新
+        Integer status = null;
+        if (0 == auditStatus) {
+            // 审核不通过,下线图片
+            status = 0;
+        } else {
+            // 审核通过,上线图片
+            status = 1;
+        }
+        imageMapper.updateImageAuditStatus(imageId, status, auditStatus, invalidReason, auditBy, auditTime);
+        return ResponseJson.success("审核图片成功");
+    }
+}

+ 1 - 0
src/main/java/com/caimei/service/impl/ShopServiceImpl.java

@@ -43,6 +43,7 @@ public class ShopServiceImpl implements ShopService {
         List<ShopListVo> shopList = shopMapper.getShopList(listType, shopName, shopType, brandId, mobile, linkMan);
         ListIterator<ShopListVo> iterator = shopList.listIterator();
         while (iterator.hasNext()) {
+            // 根据是否完成商品信息审核筛选项,进行筛选
             ShopListVo shop = iterator.next();
             int waitAuditNum = shop.getWaitAuditNum();
             if (waitAuditNum > 0) {

+ 52 - 1
src/main/resources/backup.sql

@@ -101,5 +101,56 @@ ALTER TABLE `cm_brand_auth_product`
 update `cm_brand_auth` set auditStatus = 1, auditBy = 1, auditTime = '2021-06-01 18:17:32';
 update `cm_brand_auth_product` set auditStatus = 1, auditBy = 1, auditTime = '2021-06-01 18:17:32';
 # ==================================正品联盟6月优化end===============================================
-
+# ==================================正品联盟7月优化end===============================================
+CREATE TABLE `cm_brand_club_user` (
+                                           `id` INT NOT NULL AUTO_INCREMENT,
+                                           `authId` VARCHAR(45) NULL COMMENT '授权机构id',
+                                           `invitationCode` VARCHAR(10) NULL COMMENT '邀请码',
+                                           `status` INT NULL COMMENT '0未绑定,1已绑定',
+                                           `addTime` DATETIME NULL COMMENT '添加时间',
+                                           `updateTime` DATETIME NULL COMMENT '更新时间',
+                                           `invitationCodeTime` DATETIME NULL COMMENT '邀请码过期时间',
+                                           `bindTime` DATETIME NULL COMMENT '绑定时间',
+                                           `nickName` VARCHAR(32) NULL COMMENT '微信昵称',
+                                           `mobile` VARCHAR(20) NULL COMMENT '手机号',
+                                           `openId` VARCHAR(32) NULL COMMENT 'openId',
+                                           `delFlag` INT NULL COMMENT '删除(解绑)标识:0未删除,1已删除',
+                                           PRIMARY KEY (`id`))
+    COMMENT = '授权机构用户表';
+
+CREATE TABLE `cm_brand_article` (
+                                         `id` INT NOT NULL AUTO_INCREMENT COMMENT '文章id',
+                                         `authUserId` INT NULL COMMENT '供应商用户id',
+                                         `title` VARCHAR(50) NULL COMMENT '文章标题',
+                                         `image` VARCHAR(255) NULL COMMENT '文章图片',
+                                         `content` MEDIUMTEXT NULL COMMENT '文章内容',
+                                         `status` INT NULL COMMENT '上线状态:0已下线,1已上线,2待上线',
+                                         `createTime` DATETIME NULL COMMENT '创建时间',
+                                         `auditStatus` INT NULL COMMENT '审核状态:0审核未通过,1审核通过,2待审核',
+                                         `invalidReason` VARCHAR(255) NULL COMMENT '审核不通过原因',
+                                         `auditBy` INT NULL COMMENT '审核人用户id',
+                                         `auditTime` DATETIME NULL COMMENT '审核时间',
+                                         PRIMARY KEY (`id`))
+    COMMENT = '正品联盟资料库文章';
+
+CREATE TABLE `cm_brand_image` (
+                                       `id` INT NOT NULL AUTO_INCREMENT,
+                                       `authUserId` INT NULL COMMENT '供应商用户id',
+                                       `title` VARCHAR(50) NULL COMMENT '图片标题',
+                                       `status` INT NULL COMMENT '上线状态:0已下线,1已上线,2待上线',
+                                       `createTime` DATETIME NULL COMMENT '创建时间',
+                                       `auditStatus` INT NULL COMMENT '审核状态:0审核未通过,1审核通过,2待审核',
+                                       `invalidReason` VARCHAR(255) NULL COMMENT '审核不通过原因',
+                                       `auditBy` INT NULL COMMENT '审核人用户id',
+                                       `auditTime` DATETIME NULL COMMENT '审核时间',
+                                       PRIMARY KEY (`id`))
+    COMMENT = '正品联盟资料库图片';
+
+CREATE TABLE `cm_brand_image_detail` (
+                                          `id` INT NOT NULL AUTO_INCREMENT,
+                                          `imageId` INT NULL COMMENT '图片资料id',
+                                          `image` VARCHAR(255) NULL COMMENT '图片路径',
+                                          PRIMARY KEY (`id`))
+    COMMENT = '正品联盟资料库图片详情';
+# ==================================正品联盟7月优化end===============================================
 

+ 59 - 0
src/main/resources/mapper/ArticleMapper.xml

@@ -0,0 +1,59 @@
+<?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.ArticleMapper">
+    <insert id="insertArticle">
+        insert into cm_brand_article(authUserId, title, image, content, auditStatus, status, createTime)
+        values (#{authUserId}, #{title}, #{image}, #{content}, #{auditStatus}, #{status}, #{createTime})
+    </insert>
+    <update id="updateArticleByArticleId">
+        update cm_brand_article
+        set title       = #{title},
+            image       = #{image},
+            content     = #{content},
+            status      = #{status},
+            auditStatus = #{auditStatus}
+        where id = #{id}
+    </update>
+    <update id="updateArticleStatusByArticleId">
+        update cm_brand_article
+        set status = #{status}
+        where id = #{articleId}
+    </update>
+    <update id="updateArticleAuditStatus">
+        update cm_brand_article
+        set status        = #{status},
+            auditStatus   = #{auditStatus},
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
+        where id = #{articleId}
+    </update>
+    <delete id="deleteArticleByArticleId">
+        delete from cm_brand_article where id = #{articleId}
+    </delete>
+    <select id="getArticleList" resultType="com.caimei.model.vo.ArticleVo">
+        select a.id as articleId,a.title as articleTitle,a.image as articleImage,
+        a.auditStatus,a.invalidReason,a.status,a.createTime,
+        au.name as auditBy,a.auditTime
+        from cm_brand_article a
+        left join cm_brand_auth_user au on a.auditBy = au.authUserId
+        where a.authUserId = #{authUserId}
+        <if test="articleTitle != null and articleTitle != ''">
+            and a.title like concat('%',#{articleTitle},'%')
+        </if>
+        <if test="auditStatus != null">
+            and a.auditStatus = #{auditStatus}
+        </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        <choose>
+            <when test="listType == 2">
+                order by a.auditStatus desc, a.createTime desc
+            </when>
+            <otherwise>
+                order by a.createTime desc
+            </otherwise>
+        </choose>
+    </select>
+</mapper>

+ 7 - 0
src/main/resources/mapper/AuthMapper.xml

@@ -61,4 +61,11 @@
         where authId = #{authId}
           and auditStatus = 2
     </select>
+    <select id="getClubList" resultType="com.caimei.model.vo.ClubVo">
+        select id as authId,authParty as clubName,createTime
+        from cm_brand_auth where auditBy = #{authUserId}
+        <if test="clubName != null and clubName != ''">
+            and authParty like concat('%',#{clubName},'%')
+        </if>
+    </select>
 </mapper>

+ 61 - 0
src/main/resources/mapper/ClubMapper.xml

@@ -0,0 +1,61 @@
+<?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.ClubMapper">
+    <insert id="insertClubUser">
+        insert into cm_brand_club_user (authId, invitationCode, status, addTime, updateTime, invitationCodeTime,
+                                        delFlag)
+        values (#{authId}, #{invitationCode}, #{status}, #{addTime}, #{updateTime}, #{invitationCodeTime}, 0)
+    </insert>
+    <update id="unbindClubUser">
+        update cm_brand_club_user set delFlag = 1 where id = #{clubUserId}
+    </update>
+    <update id="updateCode">
+        update cm_brand_club_user
+        set invitationCode     = #{invitationCode},
+            status             = 0,
+            invitationCodeTime = #{invitationCodeTime},
+            updateTime         = #{updateTime}
+        where id = #{clubUserId}
+    </update>
+    <select id="getClubList" resultType="com.caimei.model.vo.ClubVo">
+        select id as authId,authParty as clubName,createTime
+        from cm_brand_auth where auditBy = #{authUserId}
+        <if test="clubName != null and clubName != ''">
+            and authParty like concat('%',#{clubName},'%');
+        </if>
+        order by createTime desc
+    </select>
+    <select id="getClubUserList" resultType="com.caimei.model.vo.ClubUserVo">
+        select id as clubUserId,
+        authId,
+        invitationCode,
+        IF(status = 0, (IF(NOW() >= invitationCodeTime, 2, 0)), status) as status,
+        addTime,
+        bindTime,
+        nickName,
+        mobile,
+        openId
+        from cm_brand_club_user
+        where authId = #{authId}
+        <if test="mobile != null and mobile != ''">
+            and mobile like concat('%',#{mobile},'%')
+        </if>
+        <if test="status != null">
+            <if test="status == 0">
+                and status = 0 and NOW() <![CDATA[<=]]> invitationCodeTime
+            </if>
+            <if test="status == 2">
+                and status = 0 and NOW() >= invitationCodeTime
+            </if>
+            <if test="status == 1">
+                and status = 1
+          </if>
+        </if>
+        order by addTime desc
+    </select>
+    <select id="getStatusByClubUserId" resultType="java.lang.Integer">
+        select IF(status = 0, (IF(NOW() >= invitationCodeTime, 2, 0)), status)
+        from cm_brand_club_user
+        where id = #{clubUserId}
+    </select>
+</mapper>

+ 64 - 0
src/main/resources/mapper/ImageMapper.xml

@@ -0,0 +1,64 @@
+<?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.ImageMapper">
+    <insert id="insertImage" keyColumn="id" keyProperty="id" parameterType="com.caimei.model.po.ImagePo" useGeneratedKeys="true">
+        insert into cm_brand_image(authUserId, title, auditStatus, status, createTime)
+        values (#{authUserId}, #{title}, #{auditStatus}, #{status}, #{createTime})
+    </insert>
+    <insert id="insertImageDetail">
+        insert into cm_brand_image_detail(imageId, image)
+        values (#{imageId}, #{image})
+    </insert>
+    <update id="updateImageByImageId">
+        update cm_brand_image
+        set title       = #{title},
+            status      = #{status},
+            auditStatus = #{auditStatus}
+        where id = #{id}
+    </update>
+    <update id="updateImageStatusByImageId">
+        update cm_brand_image
+        set status = #{status}
+        where id = #{imageId}
+    </update>
+    <update id="updateImageAuditStatus">
+        update cm_brand_image
+        set status        = #{status},
+            auditStatus   = #{auditStatus},
+            invalidReason = #{invalidReason},
+            auditBy       = #{auditBy},
+            auditTime     = #{auditTime}
+        where id = #{imageId}
+    </update>
+    <delete id="deleteImageByImageId">
+        delete from cm_brand_image where id = #{imageId}
+    </delete>
+    <delete id="deleteImageDetail">
+        delete from cm_brand_image_detail where imageId = #{imageId}
+    </delete>
+    <select id="getImageList" resultType="com.caimei.model.vo.ImageVo">
+        select a.id as imageId,a.title as imageTitle,
+        a.auditStatus,a.invalidReason,a.status,a.createTime,
+        au.name as auditBy,a.auditTime
+        from cm_brand_image a
+        left join cm_brand_auth_user au on a.auditBy = au.authUserId
+        where a.authUserId = #{authUserId}
+        <if test="imageTitle != null and imageTitle != ''">
+            and a.title like concat('%',#{imageTitle},'%')
+        </if>
+        <if test="auditStatus != null">
+            and a.auditStatus = #{auditStatus}
+        </if>
+        <if test="status != null">
+            and a.status = #{status}
+        </if>
+        <choose>
+            <when test="listType == 2">
+                order by a.auditStatus desc, a.createTime desc
+            </when>
+            <otherwise>
+                order by a.createTime desc
+            </otherwise>
+        </choose>
+    </select>
+</mapper>

+ 9 - 0
src/test/java/com/caimei/AdminApplicationTests.java

@@ -44,5 +44,14 @@ public class AdminApplicationTests {
         System.out.println(img1);
     }
 
+    @Test
+    public void generateStr(){
+        String s = "";
+        for (int i = 0; i < 40000; i++) {
+            s += "阿Q阿Q阿Q阿Q阿Q";
+        }
+        System.out.println(s);
+    }
+
 
 }