Browse Source

正品联盟资料库优化part3

Aslee 3 years ago
parent
commit
af3dabe259
73 changed files with 1500 additions and 179 deletions
  1. 1 1
      src/main/java/com/caimei/config/SwaggerConfig.java
  2. 4 5
      src/main/java/com/caimei/controller/ArticleApi.java
  3. 4 5
      src/main/java/com/caimei/controller/FileApi.java
  4. 2 2
      src/main/java/com/caimei/controller/ImageApi.java
  5. 4 2
      src/main/java/com/caimei/controller/ShopApi.java
  6. 4 18
      src/main/java/com/caimei/controller/UploadApi.java
  7. 2 3
      src/main/java/com/caimei/controller/VideoApi.java
  8. 5 2
      src/main/java/com/caimei/mapper/ArticleMapper.java
  9. 4 0
      src/main/java/com/caimei/mapper/AuthMapper.java
  10. 3 0
      src/main/java/com/caimei/mapper/AuthProductMapper.java
  11. 7 0
      src/main/java/com/caimei/mapper/ClubMapper.java
  12. 5 2
      src/main/java/com/caimei/mapper/FileMapper.java
  13. 5 2
      src/main/java/com/caimei/mapper/ImageMapper.java
  14. 24 0
      src/main/java/com/caimei/mapper/LoginMapper.java
  15. 2 0
      src/main/java/com/caimei/mapper/ShopMapper.java
  16. 4 3
      src/main/java/com/caimei/mapper/VideoMapper.java
  17. 5 0
      src/main/java/com/caimei/model/dto/ShopInfoDto.java
  18. 5 0
      src/main/java/com/caimei/model/po/ClubUserPo.java
  19. 5 0
      src/main/java/com/caimei/model/po/UserPo.java
  20. 1 1
      src/main/java/com/caimei/model/vo/ArticleListVo.java
  21. 1 1
      src/main/java/com/caimei/model/vo/ClubUserVo.java
  22. 1 1
      src/main/java/com/caimei/model/vo/FileListVo.java
  23. 1 1
      src/main/java/com/caimei/model/vo/ImageListVo.java
  24. 3 0
      src/main/java/com/caimei/model/vo/ShopFormVo.java
  25. 12 0
      src/main/java/com/caimei/model/vo/ShopListVo.java
  26. 1 1
      src/main/java/com/caimei/model/vo/VideoListVo.java
  27. 26 0
      src/main/java/com/caimei/model/vo/WxArticleListVo.java
  28. 23 0
      src/main/java/com/caimei/model/vo/WxClubListVo.java
  29. 32 0
      src/main/java/com/caimei/model/vo/WxClubUserVo.java
  30. 26 0
      src/main/java/com/caimei/model/vo/WxFileListVo.java
  31. 27 0
      src/main/java/com/caimei/model/vo/WxImageListVo.java
  32. 20 0
      src/main/java/com/caimei/model/vo/WxProductListVo.java
  33. 26 0
      src/main/java/com/caimei/model/vo/WxVideoListVo.java
  34. 13 2
      src/main/java/com/caimei/service/ArticleService.java
  35. 19 1
      src/main/java/com/caimei/service/AuthClubService.java
  36. 14 0
      src/main/java/com/caimei/service/AuthProductService.java
  37. 12 2
      src/main/java/com/caimei/service/FileService.java
  38. 13 2
      src/main/java/com/caimei/service/ImageService.java
  39. 39 0
      src/main/java/com/caimei/service/LoginService.java
  40. 1 3
      src/main/java/com/caimei/service/SDKService.java
  41. 3 2
      src/main/java/com/caimei/service/ShopService.java
  42. 21 0
      src/main/java/com/caimei/service/UploadService.java
  43. 12 2
      src/main/java/com/caimei/service/VideoService.java
  44. 16 4
      src/main/java/com/caimei/service/impl/ArticleServiceImpl.java
  45. 24 8
      src/main/java/com/caimei/service/impl/AuthClubServiceImpl.java
  46. 21 17
      src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java
  47. 16 4
      src/main/java/com/caimei/service/impl/FileServiceImpl.java
  48. 21 4
      src/main/java/com/caimei/service/impl/ImageServiceImpl.java
  49. 144 0
      src/main/java/com/caimei/service/impl/LoginServiceImpl.java
  50. 2 11
      src/main/java/com/caimei/service/impl/SDKServiceImpl.java
  51. 8 2
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  52. 48 0
      src/main/java/com/caimei/service/impl/UploadServiceImpl.java
  53. 17 4
      src/main/java/com/caimei/service/impl/VideoServiceImpl.java
  54. 240 0
      src/main/java/com/caimei/utils/HttpRequest.java
  55. 68 0
      src/main/java/com/caimei/utils/SmsUtils.java
  56. 62 42
      src/main/java/com/caimei/utils/WxUtils.java
  57. 74 0
      src/main/java/com/caimei/wxController/LoginApi.java
  58. 10 4
      src/main/java/com/caimei/wxController/SDKApi.java
  59. 61 0
      src/main/java/com/caimei/wxController/WxAuthApi.java
  60. 105 0
      src/main/java/com/caimei/wxController/WxDataApi.java
  61. 2 0
      src/main/resources/backup.sql
  62. 2 0
      src/main/resources/config/beta/application-beta.yml
  63. 4 0
      src/main/resources/config/dev/application-dev.yml
  64. 1 0
      src/main/resources/config/prod/application-prod.yml
  65. 8 2
      src/main/resources/mapper/ArticleMapper.xml
  66. 10 0
      src/main/resources/mapper/AuthMapper.xml
  67. 8 0
      src/main/resources/mapper/AuthProductMapper.xml
  68. 17 1
      src/main/resources/mapper/ClubMapper.xml
  69. 7 1
      src/main/resources/mapper/FileMapper.xml
  70. 7 1
      src/main/resources/mapper/ImageMapper.xml
  71. 28 0
      src/main/resources/mapper/LoginMapper.xml
  72. 21 7
      src/main/resources/mapper/ShopMapper.xml
  73. 6 3
      src/main/resources/mapper/VideoMapper.xml

+ 1 - 1
src/main/java/com/caimei/config/SwaggerConfig.java

@@ -33,7 +33,7 @@ public class SwaggerConfig {
                 .enable(swaggerEnabled)
                 .select()
                 // 扫描api
-                .apis(RequestHandlerSelectors.basePackage("com.caimei.controller"))
+                .apis(RequestHandlerSelectors.basePackage("com.caimei.controller").or(RequestHandlerSelectors.basePackage("com.caimei.wxController")))
                 .paths(PathSelectors.any())
                 .build();
     }

+ 4 - 5
src/main/java/com/caimei/controller/ArticleApi.java

@@ -3,8 +3,7 @@ package com.caimei.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.ArticleFormVo;
-import com.caimei.model.vo.ArticleVo;
-import com.caimei.model.vo.ImageFormVo;
+import com.caimei.model.vo.ArticleListVo;
 import com.caimei.service.ArticleService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -44,9 +43,9 @@ public class ArticleApi {
             @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) {
+    public ResponseJson<PageInfo<ArticleListVo>> 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);
     }
 

+ 4 - 5
src/main/java/com/caimei/controller/FileApi.java

@@ -2,7 +2,7 @@ package com.caimei.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.FileVo;
+import com.caimei.model.vo.FileListVo;
 import com.caimei.service.FileService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -12,7 +12,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Map;
 
@@ -43,9 +42,9 @@ public class FileApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<FileVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, Integer auditStatus, Integer status,
-                                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+    public ResponseJson<PageInfo<FileListVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, Integer auditStatus, Integer status,
+                                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                          @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
         return fileService.getFileList(listType, authUserId, fileTitle, auditStatus, status, pageNum, pageSize);
     }
 

+ 2 - 2
src/main/java/com/caimei/controller/ImageApi.java

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.ImageFormVo;
-import com.caimei.model.vo.ImageVo;
+import com.caimei.model.vo.ImageListVo;
 import com.caimei.service.ImageService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -44,7 +44,7 @@ public class ImageApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<ImageListVo>> 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);

+ 4 - 2
src/main/java/com/caimei/controller/ShopApi.java

@@ -42,7 +42,7 @@ public class ShopApi {
      */
     @ApiOperation("供应商列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商列表,2审核列表"),
+            @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1供应商列表,2授权信息审核列表,3资料审核列表"),
             @ApiImplicitParam(name = "shopName", required = false, value = "供应商名称"),
             @ApiImplicitParam(name = "shopType", required = false, value = "供应商类型:1品牌方,2代理商"),
             @ApiImplicitParam(name = "brandId", required = false, value = "所属品牌id"),
@@ -82,6 +82,7 @@ public class ShopApi {
      *                    mobile             手机号
      *                    linkMan            联系人
      *                    shopStatus         供应商状态:0停用 1启用
+     *                    qrCodeImage        公众号二维码图片
      *                    createBy           创建人用户id
      *                    shopInfo  [
      *                                  {
@@ -121,6 +122,7 @@ public class ShopApi {
         if (null == shopStatus) {
             return ResponseJson.error("参数异常,请输入供应商状态");
         }
+        String qrCodeImage = (String) paramsMap.get("qrCodeImage");
         Integer createBy = paramsMap.getInteger("createBy");
         List<Map<String, Object>> shopInfoData = (List<Map<String, Object>>) paramsMap.get("shopInfo");
         if (null == shopInfoData || shopInfoData.size() <= 0) {
@@ -152,7 +154,7 @@ public class ShopApi {
             shopInfo.setStatementFileId(statementFileId);
             shopInfoList.add(shopInfo);
         }
-        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus, createBy, shopInfoList);
+        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus, qrCodeImage, createBy, shopInfoList);
     }
 
     /**

+ 4 - 18
src/main/java/com/caimei/controller/UploadApi.java

@@ -3,6 +3,7 @@ package com.caimei.controller;
 import com.caimei.config.FastDfsClient;
 import com.caimei.mapper.FileMapper;
 import com.caimei.model.po.FilePo;
+import com.caimei.service.UploadService;
 import com.caimei.utils.OSSUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -37,11 +38,9 @@ import java.util.UUID;
 @RequestMapping("/upload")
 public class UploadApi {
     private static final Logger logger = LoggerFactory.getLogger(UploadApi.class);
-    private final FastDfsClient client;
     @Value("${caimei.imageDomain}")
     private String imageDomain;
-    @Value("${spring.profiles.active}")
-    private String active;
+    private final UploadService uploadService;
 
     /**
      * 上传图片
@@ -54,7 +53,7 @@ public class UploadApi {
         String saveFile;
         if (file != null ) {
             // 保存文件
-            saveFile = saveFile(file);
+            saveFile = uploadService.saveFile(file);
             saveFile = imageDomain + "/" + saveFile;
             map.put("data", saveFile);
             map.put("msg", "上传成功");
@@ -66,20 +65,7 @@ public class UploadApi {
         return map;
     }
 
-    private String saveFile(MultipartFile file) throws IOException {
-        String originalFilename = file.getOriginalFilename();
-        String randomUUID = UUID.randomUUID().toString();
-        int index = originalFilename.lastIndexOf(".");
-        String exet = originalFilename.substring(index);
-        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
-        if ("dev".equals(active)){
-            filePath = "D:\\uploadImage\\";
-        }
-        filePath += "\\" + randomUUID + exet;
-        file.transferTo(new File(filePath));
-        logger.info(">>>>>>>>>>>>>>>>图片上传路径:" + filePath);
-        return client.uploadFile(filePath);
-    }
+
 
     @ApiOperation("上传文件")
     @ApiImplicitParam(name = "file", value = "文件", required = true)

+ 2 - 3
src/main/java/com/caimei/controller/VideoApi.java

@@ -2,7 +2,7 @@ package com.caimei.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.VideoVo;
+import com.caimei.model.vo.VideoListVo;
 import com.caimei.service.VideoService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -12,7 +12,6 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.util.Map;
 
@@ -43,7 +42,7 @@ public class VideoApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/list")
-    public ResponseJson<PageInfo<VideoVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<VideoListVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
         return videoService.getVideoList(listType, authUserId, videoTitle, auditStatus, status, pageNum, pageSize);

+ 5 - 2
src/main/java/com/caimei/mapper/ArticleMapper.java

@@ -2,7 +2,8 @@ package com.caimei.mapper;
 
 import com.caimei.model.po.ArticlePo;
 import com.caimei.model.vo.ArticleFormVo;
-import com.caimei.model.vo.ArticleVo;
+import com.caimei.model.vo.ArticleListVo;
+import com.caimei.model.vo.WxArticleListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,7 +19,7 @@ import java.util.List;
 @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);
+    List<ArticleListVo> getArticleList(Integer listType, @Param("authUserId") Integer authUserId, @Param("articleTitle") String articleTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
 
     void insertArticle(ArticlePo article);
 
@@ -31,4 +32,6 @@ public interface ArticleMapper {
     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);
 
     ArticleFormVo getArticleForm(Integer articleId);
+
+    List<WxArticleListVo> getWxArticleList(@Param("authUserId") Integer authUserId, @Param("articleName") String articleName);
 }

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

@@ -31,4 +31,8 @@ public interface AuthMapper {
     Integer getProductWaitAuditNum(Integer authId);
 
     void updateAuthAuditStatus(@Param("authId") Integer authId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
+
+    Integer getClubStatus(Integer authId);
+
+    CmBrandAuthPo getAuthById(Integer authId);
 }

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

@@ -4,6 +4,7 @@ import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.WxProductListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -48,4 +49,6 @@ public interface AuthProductMapper {
     void updateImageByProductId(ProductPo product);
 
     void updateProductAuditStatus(@Param("productId") Integer productId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
+
+    List<WxProductListVo> getWxProductList(@Param("authId") Integer authId, @Param("productName") String productName);
 }

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

@@ -3,6 +3,7 @@ package com.caimei.mapper;
 import com.caimei.model.po.ClubUserPo;
 import com.caimei.model.vo.ClubUserVo;
 import com.caimei.model.vo.ClubVo;
+import com.caimei.model.vo.WxClubListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -28,4 +29,10 @@ public interface ClubMapper {
     void updateCode(@Param("clubUserId") Integer clubUserId, @Param("invitationCode") String invitationCode, @Param("updateTime") Date updateTime, @Param("invitationCodeTime") Date invitationCodeTime);
 
     Integer getStatusByClubUserId(Integer clubUserId);
+
+    List<WxClubListVo> getWxClubList(@Param("authUserId") Integer authUserId, @Param("clubName") String clubName);
+
+    Integer checkMobile(String mobile);
+
+    void insertFeedback(@Param("clubUserId") Integer clubUserId, @Param("content") String content);
 }

+ 5 - 2
src/main/java/com/caimei/mapper/FileMapper.java

@@ -1,7 +1,8 @@
 package com.caimei.mapper;
 
 import com.caimei.model.po.FilePo;
-import com.caimei.model.vo.FileVo;
+import com.caimei.model.vo.FileListVo;
+import com.caimei.model.vo.WxFileListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,7 +18,7 @@ import java.util.List;
 @Mapper
 public interface FileMapper {
 
-    List<FileVo> getFileList(Integer listType, @Param("authUserId") Integer authUserId, @Param("fileTitle") String fileTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
+    List<FileListVo> getFileList(Integer listType, @Param("authUserId") Integer authUserId, @Param("fileTitle") String fileTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
 
     void insertFile(FilePo file);
 
@@ -30,4 +31,6 @@ public interface FileMapper {
     void updateFileAuditStatus(@Param("fileId") Integer fileId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus, @Param("invalidReason") String invalidReason, @Param("auditBy") Integer auditBy, @Param("auditTime") Date auditTime);
 
     void updateFileSelective(FilePo file);
+
+    List<WxFileListVo> getWxFileList(Integer authUserId, String fileName);
 }

+ 5 - 2
src/main/java/com/caimei/mapper/ImageMapper.java

@@ -2,7 +2,8 @@ package com.caimei.mapper;
 
 import com.caimei.model.po.ImagePo;
 import com.caimei.model.vo.ImageFormVo;
-import com.caimei.model.vo.ImageVo;
+import com.caimei.model.vo.ImageListVo;
+import com.caimei.model.vo.WxImageListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -18,7 +19,7 @@ import java.util.List;
 @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);
+    List<ImageListVo> getImageList(Integer listType, @Param("authUserId") Integer authUserId, @Param("imageTitle") String imageTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
 
     void insertImage(ImagePo image);
 
@@ -37,4 +38,6 @@ public interface ImageMapper {
     ImageFormVo getImageForm(Integer imageId);
 
     List<String> getImageListByImageId(Integer imageId);
+
+    List<WxImageListVo> getWxImageList(Integer authUserId, String imageName);
 }

+ 24 - 0
src/main/java/com/caimei/mapper/LoginMapper.java

@@ -0,0 +1,24 @@
+package com.caimei.mapper;
+
+import com.caimei.model.po.ClubUserPo;
+import com.caimei.model.vo.UserLoginVo;
+import com.caimei.model.vo.WxClubUserVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/15
+ */
+@Mapper
+public interface LoginMapper {
+
+
+    WxClubUserVo findClubUser(String openId);
+
+    ClubUserPo findByInvitationCode(String invitationCode);
+
+    void bindClubUser(@Param("mobile") String mobile, @Param("nickName") String nickName, @Param("openId") String openId, @Param("invitationCode") String invitationCode);
+}

+ 2 - 0
src/main/java/com/caimei/mapper/ShopMapper.java

@@ -71,4 +71,6 @@ public interface ShopMapper {
     FeedbackVo getFeedback(Integer feedbackId);
 
     void handleFeedback(@Param("feedbackId") Integer feedbackId, @Param("handleResult") String handleResult);
+
+    Integer getShopStatus(Integer authUserId);
 }

+ 4 - 3
src/main/java/com/caimei/mapper/VideoMapper.java

@@ -1,7 +1,8 @@
 package com.caimei.mapper;
 
 import com.caimei.model.po.VideoPo;
-import com.caimei.model.vo.VideoVo;
+import com.caimei.model.vo.VideoListVo;
+import com.caimei.model.vo.WxVideoListVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,7 +18,7 @@ import java.util.List;
 @Mapper
 public interface VideoMapper {
 
-    List<VideoVo> getVideoList(Integer listType, @Param("authUserId") Integer authUserId, @Param("videoTitle") String videoTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
+    List<VideoListVo> getVideoList(Integer listType, @Param("authUserId") Integer authUserId, @Param("videoTitle") String videoTitle, @Param("auditStatus") Integer auditStatus, @Param("status") Integer status);
 
     void insertVideo(VideoPo video);
 
@@ -31,5 +32,5 @@ public interface VideoMapper {
 
     void updateVideoSelective(VideoPo video);
 
-    Integer getFileNumByMd5Hex(String md5Hex);
+    List<WxVideoListVo> getWxVideoList(Integer authUserId, String videoName);
 }

+ 5 - 0
src/main/java/com/caimei/model/dto/ShopInfoDto.java

@@ -35,6 +35,11 @@ public class ShopInfoDto {
      */
     private String securityLink;
 
+    /**
+     * 公众号二维码图片
+     */
+    private String qrCodeImage;
+
     /**
      * 代理声明类型:1弹窗,2链接,3图片,4文件
      */

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

@@ -11,6 +11,11 @@ import java.util.Date;
  */
 @Data
 public class ClubUserPo {
+    /**
+     * 机构用户id
+     */
+    private Integer id;
+
     /**
      * 机构id
      */

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

@@ -45,6 +45,11 @@ public class UserPo {
      */
     private Integer shopType;
 
+    /**
+     * 公众号二维码图片
+     */
+    private String qrCodeImage;
+
     /**
      * 创建时间
      */

+ 1 - 1
src/main/java/com/caimei/model/vo/ArticleVo.java → src/main/java/com/caimei/model/vo/ArticleListVo.java

@@ -12,7 +12,7 @@ import java.util.Date;
  * @date 2021/7/8
  */
 @Data
-public class ArticleVo {
+public class ArticleListVo {
     @ApiModelProperty("文章id")
     private Integer articleId;
 

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

@@ -13,7 +13,7 @@ import java.util.Date;
  */
 @Data
 public class ClubUserVo {
-    @ApiModelProperty("机构id")
+    @ApiModelProperty("机构用户id")
     private Integer clubUserId;
 
     @ApiModelProperty("机构id")

+ 1 - 1
src/main/java/com/caimei/model/vo/FileVo.java → src/main/java/com/caimei/model/vo/FileListVo.java

@@ -11,7 +11,7 @@ import java.util.Date;
  * @date 2021/7/8
  */
 @Data
-public class FileVo {
+public class FileListVo {
     @ApiModelProperty("文件id")
     private Integer fileId;
 

+ 1 - 1
src/main/java/com/caimei/model/vo/ImageVo.java → src/main/java/com/caimei/model/vo/ImageListVo.java

@@ -11,7 +11,7 @@ import java.util.Date;
  * @date 2021/7/8
  */
 @Data
-public class ImageVo {
+public class ImageListVo {
     @ApiModelProperty("图片id")
     private Integer imageId;
 

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

@@ -34,6 +34,9 @@ public class ShopFormVo implements Serializable {
     @ApiModelProperty("供应商类型")
     private Integer shopType;
 
+    @ApiModelProperty("公众号二维码图片")
+    private String qrCodeImage;
+
     /**
      * 手机号
      */

+ 12 - 0
src/main/java/com/caimei/model/vo/ShopListVo.java

@@ -81,4 +81,16 @@ public class ShopListVo implements Serializable {
 
     @ApiModelProperty("下级待审核数量")
     private Integer waitAuditNum;
+
+    @ApiModelProperty("文章待审核数量")
+    private Integer articleWaitNum;
+
+    @ApiModelProperty("图片待审核数量")
+    private Integer imageWaitNum;
+
+    @ApiModelProperty("视频待审核数量")
+    private Integer videoWaitNum;
+
+    @ApiModelProperty("文件待审核数量")
+    private Integer fileWaitNum;
 }

+ 1 - 1
src/main/java/com/caimei/model/vo/VideoVo.java → src/main/java/com/caimei/model/vo/VideoListVo.java

@@ -11,7 +11,7 @@ import java.util.Date;
  * @date 2021/7/8
  */
 @Data
-public class VideoVo {
+public class VideoListVo {
     @ApiModelProperty("视频id")
     private Integer videoId;
 

+ 26 - 0
src/main/java/com/caimei/model/vo/WxArticleListVo.java

@@ -0,0 +1,26 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_article
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class WxArticleListVo {
+    @ApiModelProperty("文章id")
+    private Integer articleId;
+
+    @ApiModelProperty("文章标题")
+    private String articleTitle;
+
+    @ApiModelProperty("文章图片")
+    private String articleImage;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+}

+ 23 - 0
src/main/java/com/caimei/model/vo/WxClubListVo.java

@@ -0,0 +1,23 @@
+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 WxClubListVo {
+    @ApiModelProperty("机构id")
+    private Integer authId;
+
+    /**
+     * 机构名称
+     */
+    @ApiModelProperty("机构名称")
+    private String clubName;
+}

+ 32 - 0
src/main/java/com/caimei/model/vo/WxClubUserVo.java

@@ -0,0 +1,32 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_club_user
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class WxClubUserVo {
+    @ApiModelProperty("机构用户id")
+    private Integer clubUserId;
+
+    @ApiModelProperty("机构id")
+    private Integer authId;
+
+    @ApiModelProperty("供应商用户id")
+    private Integer authUserId;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ApiModelProperty("openId")
+    private String openId;
+
+    @ApiModelProperty("accessToken")
+    private String accessToken;
+}

+ 26 - 0
src/main/java/com/caimei/model/vo/WxFileListVo.java

@@ -0,0 +1,26 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_file
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class WxFileListVo {
+    @ApiModelProperty("文件id")
+    private Integer fileId;
+
+    @ApiModelProperty("文件标题")
+    private String fileTitle;
+
+    @ApiModelProperty("文件链接")
+    private String fileUrl;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+}

+ 27 - 0
src/main/java/com/caimei/model/vo/WxImageListVo.java

@@ -0,0 +1,27 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * cm_brand_image
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class WxImageListVo {
+    @ApiModelProperty("图片id")
+    private Integer imageId;
+
+    @ApiModelProperty("图片标题")
+    private String imageTitle;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("图片详情列表")
+    private List<String> imageList;
+}

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

@@ -0,0 +1,20 @@
+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 WxProductListVo {
+    @ApiModelProperty("商品id")
+    private Integer productId;
+
+    @ApiModelProperty("商品名称")
+    private String productName;
+}

+ 26 - 0
src/main/java/com/caimei/model/vo/WxVideoListVo.java

@@ -0,0 +1,26 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * cm_brand_video
+ * @author Aslee
+ * @date 2021/7/8
+ */
+@Data
+public class WxVideoListVo {
+    @ApiModelProperty("视频id")
+    private Integer videoId;
+
+    @ApiModelProperty("视频标题")
+    private String videoTitle;
+
+    @ApiModelProperty("视频链接")
+    private String videoUrl;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+}

+ 13 - 2
src/main/java/com/caimei/service/ArticleService.java

@@ -2,7 +2,8 @@ package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.ArticleFormVo;
-import com.caimei.model.vo.ArticleVo;
+import com.caimei.model.vo.ArticleListVo;
+import com.caimei.model.vo.WxArticleListVo;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -25,7 +26,7 @@ public interface ArticleService {
      * @param pageSize      一页多少条
      * @return  ArticleVo
      */
-    ResponseJson<PageInfo<ArticleVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ArticleListVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
 
     /**
      * 添加/编辑文章
@@ -69,4 +70,14 @@ public interface ArticleService {
      * @return
      */
     ResponseJson<ArticleFormVo> getArticleFormData(Integer articleId);
+
+    /**
+     * 微信公众号文章列表
+     * @param authUserId    供应商用户id
+     * @param articleName   文章名称
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleName, Integer pageNum, Integer pageSize);
 }

+ 19 - 1
src/main/java/com/caimei/service/AuthClubService.java

@@ -1,9 +1,9 @@
 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.caimei.model.vo.WxClubListVo;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -56,4 +56,22 @@ public interface AuthClubService {
      * @return
      */
     ResponseJson updateCode(Integer clubUserId);
+
+    /**
+     * 微信公众号机构列表
+     * @param authUserId    供应商用户id
+     * @param clubName      机构名称
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxClubListVo>> getWxClubList(Integer authUserId, String clubName, Integer pageNum, Integer pageSize);
+
+    /**
+     * 提交反馈
+     * @param clubUserId    机构用户id
+     * @param content       反馈内容
+     * @return
+     */
+    ResponseJson submitFeedback(Integer clubUserId, String content);
 }

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

@@ -4,6 +4,7 @@ import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.WxProductListVo;
 import com.github.pagehelper.PageInfo;
 
 import java.io.IOException;
@@ -95,4 +96,17 @@ public interface AuthProductService {
      * @return ResponseJson
      */
     ResponseJson auditProduct(Integer productId, Integer auditStatus, String invalidReason, Integer auditBy);
+
+
+    /**
+     * 微信公众号机构列表
+     * @param authId        认证机构id
+     * @param productName   商品名称
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName, Integer pageNum, Integer pageSize);
 }
+
+

+ 12 - 2
src/main/java/com/caimei/service/FileService.java

@@ -1,7 +1,8 @@
 package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.FileVo;
+import com.caimei.model.vo.FileListVo;
+import com.caimei.model.vo.WxFileListVo;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -24,7 +25,7 @@ public interface FileService {
      * @param pageSize      一页多少条
      * @return  FileVo
      */
-    ResponseJson<PageInfo<FileVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<FileListVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
 
     /**
      * 添加/编辑文件
@@ -61,4 +62,13 @@ public interface FileService {
      */
     ResponseJson auditFile(Integer fileId, Integer auditStatus, String invalidReason, Integer auditBy);
 
+    /**
+     * 微信公众号文件列表
+     * @param authUserId        供应商用户id
+     * @param fileName          文件名称
+     * @param pageNum           第几页
+     * @param pageSize          一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileName, Integer pageNum, Integer pageSize);
 }

+ 13 - 2
src/main/java/com/caimei/service/ImageService.java

@@ -3,7 +3,8 @@ package com.caimei.service;
 import com.alibaba.fastjson.JSONArray;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.vo.ImageFormVo;
-import com.caimei.model.vo.ImageVo;
+import com.caimei.model.vo.ImageListVo;
+import com.caimei.model.vo.WxImageListVo;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -26,7 +27,7 @@ public interface ImageService {
      * @param pageSize      一页多少条
      * @return  ImageVo
      */
-    ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ImageListVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
 
     /**
      * 添加/编辑图片
@@ -69,4 +70,14 @@ public interface ImageService {
      * @return
      */
     ResponseJson<ImageFormVo> getImageFormData(Integer imageId);
+
+    /**
+     * 微信公众号图片列表
+     * @param authUserId    供应商用户id
+     * @param imageName     图片名称
+     * @param pageNum       第几页
+     * @param pageSize      一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageName, Integer pageNum, Integer pageSize);
 }

+ 39 - 0
src/main/java/com/caimei/service/LoginService.java

@@ -0,0 +1,39 @@
+package com.caimei.service;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.WxClubUserVo;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/15
+ */
+public interface LoginService {
+    /**
+     * 微信授权登录
+     * @param code
+     * @return
+     */
+    ResponseJson<WxClubUserVo> loginByAuthorization(String code);
+
+    /**
+     * 发送登录验证码
+     *
+     * @param authUserId
+     * @param mobile
+     * @return
+     */
+    ResponseJson sendVerifyCode(Integer authUserId, String mobile);
+
+    /**
+     * 邀请码登录
+     * @param mobile
+     * @param verifyCode
+     * @param invitationCode
+     * @param accessToken
+     * @param openId
+     * @return
+     */
+    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId) throws Exception;
+}

+ 1 - 3
src/main/java/com/caimei/service/SDKService.java

@@ -1,8 +1,6 @@
 package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.FileVo;
-import com.github.pagehelper.PageInfo;
 
 import java.util.Map;
 
@@ -21,5 +19,5 @@ public interface SDKService {
      * @param url           公众号url
      * @return
      */
-    ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url);
+    ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) throws Exception;
 }

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

@@ -59,7 +59,7 @@ public interface ShopService {
 
     /**
      * 添加供应商
-     *  @param shopSaveDto {
+     * @param shopSaveDto {
      *                    shopType           供应商类型:1代理商,2品牌方
      *                    brandId            品牌id
      *                    shopName           供应商名称
@@ -76,9 +76,10 @@ public interface ShopService {
      *                    statementFileId    声明文件id
      *                    createBy           创建人用户id
      *                    }
+     * @param qrCodeImage
      * @param shopInfoList
      */
-    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, Integer createBy, List<ShopInfoDto> shopInfoList);
+    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer createBy, List<ShopInfoDto> shopInfoList);
 
     /**
      * 获取供应商回显数据

+ 21 - 0
src/main/java/com/caimei/service/UploadService.java

@@ -0,0 +1,21 @@
+package com.caimei.service;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/15
+ */
+public interface UploadService {
+
+    /**
+     * 上传文件
+     * @param file
+     * @return
+     */
+    String saveFile(MultipartFile file) throws IOException;
+}

+ 12 - 2
src/main/java/com/caimei/service/VideoService.java

@@ -1,7 +1,8 @@
 package com.caimei.service;
 
 import com.caimei.model.ResponseJson;
-import com.caimei.model.vo.VideoVo;
+import com.caimei.model.vo.VideoListVo;
+import com.caimei.model.vo.WxVideoListVo;
 import com.github.pagehelper.PageInfo;
 
 /**
@@ -24,7 +25,7 @@ public interface VideoService {
      * @param pageSize      一页多少条
      * @return  VideoVo
      */
-    ResponseJson<PageInfo<VideoVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<VideoListVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize);
 
     /**
      * 添加/编辑视频
@@ -61,4 +62,13 @@ public interface VideoService {
      */
     ResponseJson auditVideo(Integer videoId, Integer auditStatus, String invalidReason, Integer auditBy);
 
+    /**
+     * 微信公众号视频列表
+     * @param authUserId        供应商用户id
+     * @param videoName         视频名称
+     * @param pageNum           第几页
+     * @param pageSize          一页多少条
+     * @return
+     */
+    ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoName, Integer pageNum, Integer pageSize);
 }

+ 16 - 4
src/main/java/com/caimei/service/impl/ArticleServiceImpl.java

@@ -4,7 +4,8 @@ import com.caimei.mapper.ArticleMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.ArticlePo;
 import com.caimei.model.vo.ArticleFormVo;
-import com.caimei.model.vo.ArticleVo;
+import com.caimei.model.vo.ArticleListVo;
+import com.caimei.model.vo.WxArticleListVo;
 import com.caimei.service.ArticleService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -30,14 +31,14 @@ public class ArticleServiceImpl implements ArticleService {
     private ArticleMapper articleMapper;
 
     @Override
-    public ResponseJson<PageInfo<ArticleVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ArticleListVo>> 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);
+        List<ArticleListVo> articleList = articleMapper.getArticleList(listType, authUserId, articleTitle, auditStatus, status);
+        PageInfo<ArticleListVo> pageData = new PageInfo<>(articleList);
         return ResponseJson.success(pageData);
     }
 
@@ -142,4 +143,15 @@ public class ArticleServiceImpl implements ArticleService {
         ArticleFormVo article = articleMapper.getArticleForm(articleId);
         return ResponseJson.success(article);
     }
+
+    @Override
+    public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxArticleListVo> articleList = articleMapper.getWxArticleList(authUserId, articleName);
+        PageInfo<WxArticleListVo> pageData = new PageInfo<>(articleList);
+        return ResponseJson.success(pageData);
+    }
 }

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

@@ -1,24 +1,17 @@
 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.model.vo.WxClubListVo;
 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;
@@ -106,4 +99,27 @@ public class AuthClubServiceImpl implements AuthClubService {
         clubMapper.updateCode(clubUserId, invitationCode, updateTime, invitationCodeTime);
         return ResponseJson.success("更新邀请码成功");
     }
+
+    @Override
+    public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(Integer authUserId, String clubName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxClubListVo> clubList = clubMapper.getWxClubList(authUserId, clubName);
+        PageInfo<WxClubListVo> pageData = new PageInfo<>(clubList);
+        return ResponseJson.success(pageData);
+    }
+
+    @Override
+    public ResponseJson submitFeedback(Integer clubUserId, String content) {
+        if (null == clubUserId) {
+            return ResponseJson.error("参数异常,请输入机构用户id");
+        }
+        if (StringUtils.isEmpty(content)) {
+            return ResponseJson.error("参数异常,请输入反馈内容");
+        }
+        clubMapper.insertFeedback(clubUserId, content);
+        return ResponseJson.success("提交成功");
+    }
 }

+ 21 - 17
src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java

@@ -8,7 +8,9 @@ import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductPo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
+import com.caimei.model.vo.WxProductListVo;
 import com.caimei.service.AuthProductService;
+import com.caimei.service.UploadService;
 import com.caimei.utils.Base64Util;
 import com.caimei.utils.ImageUtils;
 import com.github.pagehelper.PageHelper;
@@ -24,12 +26,10 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import java.awt.*;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
 import java.util.List;
-import java.util.UUID;
 
 /**
  * Description
@@ -50,6 +50,13 @@ public class AuthProductServiceImpl implements AuthProductService {
     @Value("${caimei.imageDomain}")
     private String imageDomain;
 
+    private UploadService uploadService;
+
+    @Autowired
+    public void setUploadService(UploadService uploadService) {
+        this.uploadService = uploadService;
+    }
+
     @Override
     public ResponseJson<PageInfo<ProductListVo>> getProductList(Integer listType, Integer authId, String productName, String snCode, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
         if (null == authId) {
@@ -210,7 +217,7 @@ public class AuthProductServiceImpl implements AuthProductService {
         if (StringUtils.isNotEmpty(img)) {
             MultipartFile imgFile = Base64Util.base64ToMultipart(img);
             if (null != imgFile) {
-                imagePath = imageDomain + "/" + saveImage(imgFile);
+                imagePath = imageDomain + "/" + uploadService.saveFile(imgFile);
             }
             log.info(">>>>>>>>>>>>>>>>水印图片上传成功:" + imagePath);
         }
@@ -237,20 +244,6 @@ public class AuthProductServiceImpl implements AuthProductService {
         return authProductMapper.getProductIdsByAuthId(authId);
     }
 
-
-
-    private String saveImage(MultipartFile file) throws IOException {
-        String originalFilename = file.getOriginalFilename();
-        String randomUUID = UUID.randomUUID().toString();
-        int index = originalFilename.lastIndexOf(".");
-        String exet = originalFilename.substring(index);
-        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
-        filePath += "\\" + randomUUID + exet;
-        file.transferTo(new File(filePath));
-        log.info(">>>>>>>>>>>>>>>>水印图片上传路径:" + filePath);
-        return client.uploadFile(filePath);
-    }
-
     @Override
     public ResponseJson updateAllWaterMark() {
         List<ProductPo> productList = authProductMapper.getAllImage();
@@ -299,4 +292,15 @@ public class AuthProductServiceImpl implements AuthProductService {
         authProductMapper.updateProductAuditStatus(productId, status, auditStatus, invalidReason, auditBy, auditTime);
         return ResponseJson.success("审核品牌授权成功");
     }
+
+    @Override
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName, Integer pageNum, Integer pageSize) {
+        if (null == authId) {
+            return ResponseJson.error("参数异常,请输入授权id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxProductListVo> productList = authProductMapper.getWxProductList(authId, productName);
+        PageInfo<WxProductListVo> pageData = new PageInfo<>(productList);
+        return ResponseJson.success(pageData);
+    }
 }

+ 16 - 4
src/main/java/com/caimei/service/impl/FileServiceImpl.java

@@ -3,7 +3,9 @@ package com.caimei.service.impl;
 import com.caimei.mapper.FileMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.FilePo;
-import com.caimei.model.vo.FileVo;
+import com.caimei.model.vo.FileListVo;
+import com.caimei.model.vo.WxFileListVo;
+import com.caimei.model.vo.WxVideoListVo;
 import com.caimei.service.FileService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -45,14 +47,14 @@ public class FileServiceImpl implements FileService {
     private String active;
 
     @Override
-    public ResponseJson<PageInfo<FileVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<FileListVo>> getFileList(Integer listType, Integer authUserId, String fileTitle, 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<FileVo> fileList = fileMapper.getFileList(listType, authUserId, fileTitle, auditStatus, status);
-        PageInfo<FileVo> pageData = new PageInfo<>(fileList);
+        List<FileListVo> fileList = fileMapper.getFileList(listType, authUserId, fileTitle, auditStatus, status);
+        PageInfo<FileListVo> pageData = new PageInfo<>(fileList);
         return ResponseJson.success(pageData);
     }
 
@@ -152,4 +154,14 @@ public class FileServiceImpl implements FileService {
         return ResponseJson.success("审核文件成功");
     }
 
+    @Override
+    public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxFileListVo> fileList = fileMapper.getWxFileList(authUserId, fileName);
+        PageInfo<WxFileListVo> pageData = new PageInfo<>(fileList);
+        return ResponseJson.success(pageData);
+    }
 }

+ 21 - 4
src/main/java/com/caimei/service/impl/ImageServiceImpl.java

@@ -5,7 +5,9 @@ import com.caimei.mapper.ImageMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.ImagePo;
 import com.caimei.model.vo.ImageFormVo;
-import com.caimei.model.vo.ImageVo;
+import com.caimei.model.vo.ImageListVo;
+import com.caimei.model.vo.WxArticleListVo;
+import com.caimei.model.vo.WxImageListVo;
 import com.caimei.service.ImageService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -31,14 +33,14 @@ public class ImageServiceImpl implements ImageService {
     private ImageMapper imageMapper;
 
     @Override
-    public ResponseJson<PageInfo<ImageVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ImageListVo>> 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);
+        List<ImageListVo> imageList = imageMapper.getImageList(listType, authUserId, imageTitle, auditStatus, status);
+        PageInfo<ImageListVo> pageData = new PageInfo<>(imageList);
         return ResponseJson.success(pageData);
     }
 
@@ -149,4 +151,19 @@ public class ImageServiceImpl implements ImageService {
         image.setImageList(imageList);
         return ResponseJson.success(image);
     }
+
+    @Override
+    public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxImageListVo> wxImageList = imageMapper.getWxImageList(authUserId, imageName);
+        wxImageList.forEach(image->{
+            List<String> imageList = imageMapper.getImageListByImageId(image.getImageId());
+            image.setImageList(imageList);
+        });
+        PageInfo<WxImageListVo> pageData = new PageInfo<>(wxImageList);
+        return ResponseJson.success(pageData);
+    }
 }

+ 144 - 0
src/main/java/com/caimei/service/impl/LoginServiceImpl.java

@@ -0,0 +1,144 @@
+package com.caimei.service.impl;
+
+import com.caimei.components.RedisService;
+import com.caimei.mapper.AuthMapper;
+import com.caimei.mapper.ClubMapper;
+import com.caimei.mapper.LoginMapper;
+import com.caimei.mapper.ShopMapper;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.po.ClubUserPo;
+import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.vo.ShopFormVo;
+import com.caimei.model.vo.WxClubUserVo;
+import com.caimei.service.LoginService;
+import com.caimei.utils.CodeUtil;
+import com.caimei.utils.SmsUtils;
+import com.caimei.utils.WxUtils;
+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.Map;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/15
+ */
+@Slf4j
+@Service
+public class LoginServiceImpl implements LoginService {
+
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private LoginMapper loginMapper;
+    @Resource
+    private ShopMapper shopMapper;
+    @Resource
+    private ClubMapper clubMapper;
+    @Resource
+    private AuthMapper authMapper;
+
+    @Override
+    public ResponseJson<WxClubUserVo> loginByAuthorization(String code) {
+        Map<String,String> infoMap;
+        try {
+            infoMap = WxUtils.getAccessToken(code);
+        } catch (Exception e) {
+            log.info("微信服务器异常", e);
+            return ResponseJson.error("微信服务器异常", null);
+        }
+        //解析相应内容(转换成json对象)
+        String openId = infoMap.get("openId");
+        String accessToken = infoMap.get("accessToken");
+        WxClubUserVo clubUser = loginMapper.findClubUser(openId);
+        if (null == clubUser) {
+            clubUser = new WxClubUserVo();
+            clubUser.setOpenId(openId);
+            clubUser.setAccessToken(accessToken);
+            return ResponseJson.error("未绑定微信", clubUser);
+        }
+        clubUser.setAccessToken(accessToken);
+        return ResponseJson.success(clubUser);
+    }
+
+    @Override
+    public ResponseJson sendVerifyCode(Integer authUserId, String mobile) {
+        if (StringUtils.isEmpty(mobile)) {
+            return ResponseJson.error("参数异常,请输入手机号");
+        }
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,请输入供应商用户id");
+        }
+        Integer clubUserId = clubMapper.checkMobile(mobile);
+        if (null != clubUserId) {
+            return ResponseJson.error("该手机号已使用,请重新输入");
+        }
+        ShopFormVo shop = shopMapper.getShopByUserId(authUserId);
+        String verifyCode = CodeUtil.generateCodeInt(6);
+        String content = "您的短信验证码为:" + verifyCode + ",该验证码 5 分钟内有效,请勿泄漏于他人。";
+        if (StringUtils.isNotEmpty(shop.getShopName()) && shop.getShopName().contains("品辉")) {
+            content = "上海品辉会员" + content;
+        } else {
+            content = "上海品辉会员" + content;
+        }
+        Boolean sendSms = SmsUtils.sendSms(11, mobile, content);
+        if (!sendSms) {
+            log.info("会员登录验证码发送失败,手机号>>>>" + mobile);
+            return ResponseJson.error("发送失败,请确认手机号无误");
+        }
+        redisService.set("code:" + mobile, verifyCode, 300L);
+        return ResponseJson.success("发送成功");
+    }
+
+
+    @Override
+    public ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId) throws Exception {
+        if (StringUtils.isEmpty(mobile)) {
+            return ResponseJson.error("参数异常,请输入手机号", null);
+        }
+        if (StringUtils.isEmpty(verifyCode)) {
+            return ResponseJson.error("参数异常,请输入验证码", null);
+        }
+        if (StringUtils.isEmpty(invitationCode)) {
+            return ResponseJson.error("参数异常,请输入邀请码", null);
+        }
+        if (StringUtils.isEmpty(accessToken)) {
+            return ResponseJson.error("参数异常,请输入accessToken", null);
+        }
+        if (StringUtils.isEmpty(openId)) {
+            return ResponseJson.error("参数异常,请输入openId", null);
+        }
+        // 校验验证码是否正确
+        String redisVerifyCode = redisService.get("code:" + mobile).toString();
+        if (!verifyCode.equals(redisVerifyCode)) {
+            return ResponseJson.error("验证码错误,请重新输入", null);
+        }
+        // 校验邀请码是否有效
+        ClubUserPo clubUserPo = loginMapper.findByInvitationCode(invitationCode);
+        if (null == clubUserPo || 2 == clubUserPo.getStatus() || clubUserPo.getInvitationCodeTime().compareTo(new Date()) < 0) {
+            return ResponseJson.error("邀请码已失效", null);
+        }
+        // 校验机构和供应商的状态是否为已上线
+        CmBrandAuthPo clubPo = authMapper.getAuthById(clubUserPo.getAuthId());
+        Integer shopStatus = shopMapper.getShopStatus(clubPo.getAuthUserId());
+        if (1 != clubPo.getStatus() || 1 != shopStatus) {
+            return ResponseJson.error("登录失败", null);
+        }
+        Map<String, String> userInfo = WxUtils.getUserInfo(accessToken, openId);
+        String nickName = userInfo.get("nickName");
+        loginMapper.bindClubUser(mobile, nickName, openId, invitationCode);
+        WxClubUserVo clubUser = new WxClubUserVo();
+        clubUser.setClubUserId(clubUserPo.getId());
+        clubUser.setAuthId(clubUserPo.getAuthId());
+        clubUser.setAuthUserId(clubPo.getAuthUserId());
+        clubUser.setMobile(mobile);
+        clubUser.setOpenId(openId);
+        clubUser.setAccessToken(accessToken);
+        return ResponseJson.success(clubUser);
+    }
+}

+ 2 - 11
src/main/java/com/caimei/service/impl/SDKServiceImpl.java

@@ -1,25 +1,15 @@
 package com.caimei.service.impl;
 
-import com.caimei.mapper.VideoMapper;
 import com.caimei.model.ResponseJson;
-import com.caimei.model.po.VideoPo;
-import com.caimei.model.vo.VideoVo;
 import com.caimei.service.SDKService;
-import com.caimei.service.VideoService;
 import com.caimei.utils.CodeUtil;
 import com.caimei.utils.SHA1;
 import com.caimei.utils.WxUtils;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
-import java.util.Date;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -33,7 +23,7 @@ import java.util.Map;
 public class SDKServiceImpl implements SDKService {
 
     @Override
-    public ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) {
+    public ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) throws Exception {
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId", null);
         }
@@ -59,6 +49,7 @@ public class SDKServiceImpl implements SDKService {
         map.put("ticket", ticket);
         map.put("noncestr", noncestr);
         map.put("signature", signature);
+        log.info("生成签名:>>>>"+signature);
         return ResponseJson.success(map);
     }
 }

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

@@ -46,7 +46,11 @@ public class ShopServiceImpl implements ShopService {
         while (iterator.hasNext()) {
             // 根据是否完成商品信息审核筛选项,进行筛选
             ShopListVo shop = iterator.next();
-            int waitAuditNum = shop.getWaitAuditNum();
+            int articleWaitNum = shop.getArticleWaitNum();
+            int imageWaitNum = shop.getImageWaitNum();
+            int videoWaitNum = shop.getVideoWaitNum();
+            int fileWaitNum = shop.getFileWaitNum();
+            int waitAuditNum = 3 == listType ? (articleWaitNum + imageWaitNum + videoWaitNum + fileWaitNum) : shop.getWaitAuditNum();
             if (waitAuditNum > 0) {
                 shop.setLowerAuditStatus(0);
                 // 查询筛选项处理
@@ -183,7 +187,7 @@ public class ShopServiceImpl implements ShopService {
     }
 
     @Override
-    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, Integer createBy, List<ShopInfoDto> shopInfoList) {
+    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer createBy, List<ShopInfoDto> shopInfoList) {
         // 是否为添加操作
         boolean insertFlag = null == authUserId;
         if (insertFlag) {
@@ -220,6 +224,8 @@ public class ShopServiceImpl implements ShopService {
         shop.setLinkMan(linkMan);
         // 供应商状态
         shop.setStatus(shopStatus);
+        // 公众号二维码图片
+        shop.setQrCodeImage(qrCodeImage);
         if (insertFlag) {
             // 用户身份:1管理员,2供应商
             shop.setUserIdentity(2);

+ 48 - 0
src/main/java/com/caimei/service/impl/UploadServiceImpl.java

@@ -0,0 +1,48 @@
+package com.caimei.service.impl;
+
+import com.caimei.config.FastDfsClient;
+import com.caimei.service.UploadService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Slf4j
+@Service
+public class UploadServiceImpl implements UploadService {
+
+    @Autowired
+    private FastDfsClient client;
+
+    @Value("${spring.profiles.active}")
+    private String active;
+
+    @Override
+    public String saveFile(MultipartFile file) throws IOException {
+        String originalFilename = file.getOriginalFilename();
+        String randomUUID = UUID.randomUUID().toString();
+        int index = originalFilename.lastIndexOf(".");
+        String exet = originalFilename.substring(index);
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
+        if ("dev".equals(active)){
+            filePath = "D:\\uploadImage\\";
+        }
+        filePath += "\\" + randomUUID + exet;
+        file.transferTo(new File(filePath));
+        log.info(">>>>>>>>>>>>>>>>图片上传路径:" + filePath);
+        return client.uploadFile(filePath);
+    }
+
+
+}

+ 17 - 4
src/main/java/com/caimei/service/impl/VideoServiceImpl.java

@@ -3,7 +3,9 @@ package com.caimei.service.impl;
 import com.caimei.mapper.VideoMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.VideoPo;
-import com.caimei.model.vo.VideoVo;
+import com.caimei.model.vo.VideoListVo;
+import com.caimei.model.vo.WxArticleListVo;
+import com.caimei.model.vo.WxVideoListVo;
 import com.caimei.service.VideoService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -45,14 +47,14 @@ public class VideoServiceImpl implements VideoService {
     private String active;
 
     @Override
-    public ResponseJson<PageInfo<VideoVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<VideoListVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, 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<VideoVo> videoList = videoMapper.getVideoList(listType, authUserId, videoTitle, auditStatus, status);
-        PageInfo<VideoVo> pageData = new PageInfo<>(videoList);
+        List<VideoListVo> videoList = videoMapper.getVideoList(listType, authUserId, videoTitle, auditStatus, status);
+        PageInfo<VideoListVo> pageData = new PageInfo<>(videoList);
         return ResponseJson.success(pageData);
     }
 
@@ -151,4 +153,15 @@ public class VideoServiceImpl implements VideoService {
         videoMapper.updateVideoAuditStatus(videoId, status, auditStatus, invalidReason, auditBy, auditTime);
         return ResponseJson.success("审核视频成功");
     }
+
+    @Override
+    public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoName, Integer pageNum, Integer pageSize) {
+        if (null == authUserId) {
+            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<WxVideoListVo> videoList = videoMapper.getWxVideoList(authUserId, videoName);
+        PageInfo<WxVideoListVo> pageData = new PageInfo<>(videoList);
+        return ResponseJson.success(pageData);
+    }
 }

+ 240 - 0
src/main/java/com/caimei/utils/HttpRequest.java

@@ -0,0 +1,240 @@
+package com.caimei.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * HTTP 请求工具
+ */
+public class HttpRequest {
+    /**
+     * 向指定URL发送GET方法的请求
+     *
+     * @param url   发送请求的URL
+     * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return URL 所代表远程资源的响应结果
+     * @throws Exception
+     */
+    @SuppressWarnings("unused")
+    public static String sendGetWithParameter(String url, String param) throws Exception {
+        StringBuffer result=new StringBuffer();
+        BufferedReader in = null;
+        try {
+            String urlNameString = url + "?" + param;
+            URL realUrl = new URL(urlNameString);
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("Accept-Charset", "utf-8");
+            connection.setRequestProperty("contentType", "utf-8");
+            connection.setConnectTimeout(5000);
+            // 建立实际的连接
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 遍历所有的响应头字段
+            for (String key : map.keySet()) {
+                // System.out.println(key + "--->" + map.get(key)); //关闭响应头的输出
+            }
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        } catch (Exception e) {
+            throw e;
+        }
+        // 使用finally块来关闭输入流
+        finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e2) {
+                throw e2;
+            }
+        }
+        return result.toString();
+    }
+
+
+    @SuppressWarnings("unused")
+    public static String sendGet(String url) throws Exception {
+        StringBuffer result=new StringBuffer();
+        BufferedReader in = null;
+        try {
+
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection connection = realUrl.openConnection();
+            // 设置通用的请求属性
+            connection.setRequestProperty("accept", "*/*");
+            connection.setRequestProperty("connection", "Keep-Alive");
+            connection.setRequestProperty("Accept-Charset", "utf-8");
+            connection.setRequestProperty("contentType", "utf-8");
+            connection.setConnectTimeout(5000);
+            // 建立实际的连接
+            connection.connect();
+            // 获取所有响应头字段
+            Map<String, List<String>> map = connection.getHeaderFields();
+            // 遍历所有的响应头字段
+            for (String key : map.keySet()) {
+                //  System.out.println(key + "--->" + map.get(key));
+            }
+            // 定义 BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(
+                    connection.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        } catch (Exception e) {
+            throw e;
+        }
+        // 使用finally块来关闭输入流
+        finally {
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e2) {
+                throw e2;
+            }
+        }
+        return result.toString();
+    }
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url   发送请求的 URL
+     * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
+     * @return 所代表远程资源的响应结果
+     * @throws Exception
+     */
+    public static String sendPost(String url, String param) throws Exception {
+        PrintWriter out = null;
+        BufferedReader in = null;
+        StringBuffer result=new StringBuffer();
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("Accept-Charset", "utf-8");
+            conn.setRequestProperty("contentType", "utf-8");
+            conn.setConnectTimeout(5000);
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(
+                    new InputStreamReader(conn.getInputStream()));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result.append(line);
+            }
+        } catch (Exception e) {
+            throw e;
+        }
+        //使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception ex) {
+                throw ex;
+            }
+        }
+        return result.toString();
+    }
+
+
+    /**
+     * 向指定 URL 发送POST方法的请求
+     *
+     * @param url 发送请求的 URL
+     * @param paramMap 请求参数
+     * @return 所代表远程资源的响应结果
+     */
+    public static String sendPost(String url, Map<String, ?> paramMap) throws Exception{
+        PrintWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+
+        String param = "";
+        Iterator<String> it = paramMap.keySet().iterator();
+
+        while(it.hasNext()) {
+            String key = it.next();
+            param += key + "=" + paramMap.get(key) + "&";
+        }
+
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            URLConnection conn = realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("Accept-Charset", "utf-8");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+            // 获取URLConnection对象对应的输出流
+            out = new PrintWriter(conn.getOutputStream());
+            // 发送请求参数
+            out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            throw e;
+        }
+        //使用finally块来关闭输出流、输入流
+        finally{
+            try{
+                if(out!=null){
+                    out.close();
+                }
+                if(in!=null){
+                    in.close();
+                }
+            }
+            catch(IOException ex){
+               throw ex;
+            }
+        }
+        return result;
+    }
+
+}

+ 68 - 0
src/main/java/com/caimei/utils/SmsUtils.java

@@ -0,0 +1,68 @@
+package com.caimei.utils;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.module.pay.util.HttpRequest;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Aslee
+ * @date   2021/7/16
+ */
+@Slf4j
+public class SmsUtils {
+
+    @Value("${spring.profiles.active}")
+    private static String active;
+
+    @Value("${caimei.core}")
+    private static String core;
+
+    public static Boolean sendSms(int martId, String mobile, String content) {
+        try {
+            //测试环境手机号允许发短信
+            List<String> list = new ArrayList<>();
+            list.add("15917362709");
+            list.add("15814011616");
+            list.add("13100721916");
+            list.add("15113936829");
+            list.add("15872950940");
+            if ("prod".equals(active) || list.contains(mobile)) {
+                if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
+                    String regex = "^(1[3-9]\\d{9}$)";
+                    Pattern pattern = Pattern.compile(regex);
+                    Matcher matcher = pattern.matcher(mobile);
+                    if (matcher.matches()) {
+                        Map<String, Object> map = new HashMap<>(2);
+                        map.put("content", content);
+                        map.put("mobile", mobile);
+                        String url = core + "/tools/sms/send";
+                        String result = HttpRequest.sendPost(url, map);
+                        JSONObject parseObject = JSONObject.parseObject(result);
+                        Integer code = parseObject.getInteger("code");
+                        if (code != 0) {
+                            log.info("短信发送失败,手机号>>>>" + mobile);
+                        } else {
+                            return true;
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("短信推送异常", e);
+        }
+        return false;
+    }
+
+
+}

+ 62 - 42
src/main/java/com/caimei/utils/WxUtils.java

@@ -7,6 +7,7 @@ import com.aliyun.opensearch.sdk.dependencies.org.apache.http.client.ResponseHan
 import com.aliyun.opensearch.sdk.dependencies.org.apache.http.client.methods.HttpGet;
 import com.aliyun.opensearch.sdk.dependencies.org.apache.http.impl.client.BasicResponseHandler;
 import com.aliyun.opensearch.sdk.dependencies.org.apache.http.impl.client.DefaultHttpClient;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.util.HashMap;
 import java.util.List;
@@ -19,64 +20,83 @@ import java.util.Map;
 public class WxUtils {
 	public final static String GET_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET";
     public final static String GET_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";
+    public final static String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+    public final static String GET_USER_INFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
 
+    @Value("${caimei.appid}")
+    public static String appId;
+    @Value("${caimei.secret}")
+    public static String appSecret;
     /**
-     * 获取accessToken
+     * 获取accessToken(公众号配置数据)
      * @param appId         公众号appId
      * @param appSecret     公众号appSecret
      * @return
      */
-	public static String getAccessToken(String appId,String appSecret){
+	public static String getAccessToken(String appId,String appSecret) throws Exception {
 		String requestUrl = GET_TOKEN_URL.replace("APPID", appId).replace("SECRET", appSecret);
-		HttpClient client = null;
-		String accessToken = null;
-		try {
-            client = new DefaultHttpClient();
-            HttpGet httpget = new HttpGet(requestUrl);
-			ResponseHandler<String> responseHandler = new BasicResponseHandler();
-			String response = client.execute(httpget, responseHandler);
-			JSONObject tokenJson = JSONObject.parseObject(response);
-			accessToken = String.valueOf(tokenJson.get("access_token"));
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			client.getConnectionManager().shutdown();
-		}
-		return accessToken;
+        String response = HttpRequest.sendGet(requestUrl);
+        JSONObject tokenJson = JSONObject.parseObject(response);
+        return String.valueOf(tokenJson.get("access_token"));
 	}
 
     /**
-     * 获取jsapi_ticket
+     * 获取jsapi_ticket(公众号配置数据)
      * @param accessToken   accessToken
      * @return
      */
-	public static Map<String,String> getJsapiTicket(String accessToken){
+	public static Map<String,String> getJsapiTicket(String accessToken) throws Exception {
         String requestUrl = GET_TICKET_URL.replace("ACCESS_TOKEN", accessToken);
-        HttpClient client = null;
-        Map<String, String> result = new HashMap<String, String>();
-        try {
-            client = new DefaultHttpClient();
-            HttpGet httpget = new HttpGet(requestUrl);
-            ResponseHandler<String> responseHandler = new BasicResponseHandler();
-            String response = client.execute(httpget, responseHandler);
-            JSONObject ticketJson = JSONObject.parseObject(response);
-            String errcode = String.valueOf(ticketJson.get("errcode"));
-            String errmsg = String.valueOf(ticketJson.get("errmsg"));
-            String ticket = String.valueOf(ticketJson.get("ticket"));
-            String expiresIn = String.valueOf(ticketJson.get("expires_in"));
-            result.put("errcode", errcode);
-            result.put("errmsg", errmsg);
-            result.put("ticket", ticket);
-            result.put("expiresIn", expiresIn);
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            client.getConnectionManager().shutdown();
-        }
+        Map<String, String> result = new HashMap<>(4);
+        String response = HttpRequest.sendGet(requestUrl);
+        JSONObject ticketJson = JSONObject.parseObject(response);
+        String errcode = String.valueOf(ticketJson.get("errcode"));
+        String errmsg = String.valueOf(ticketJson.get("errmsg"));
+        String ticket = String.valueOf(ticketJson.get("ticket"));
+        String expiresIn = String.valueOf(ticketJson.get("expires_in"));
+        result.put("errcode", errcode);
+        result.put("errmsg", errmsg);
+        result.put("ticket", ticket);
+        result.put("expiresIn", expiresIn);
         return result;
     }
 
+    /**
+     * 获取accessToken(用户授权)
+     * @param code         公众号appId
+     * @return
+     */
+    public static Map<String,String> getAccessToken(String code) throws Exception {
+        String requestUrl = GET_ACCESS_TOKEN_URL.replace("APPID", appId).replace("secret",appSecret).replace("CODE", code);
+        Map<String, String> result = new HashMap<>(5);
+        String response = HttpRequest.sendGet(requestUrl);
+        JSONObject ticketJson = JSONObject.parseObject(response);
+        String accessToken = String.valueOf(ticketJson.get("access_token"));
+        String refreshToken = String.valueOf(ticketJson.get("refresh_token"));
+        String openId = String.valueOf(ticketJson.get("openid"));
+        String expiresIn = String.valueOf(ticketJson.get("expires_in"));
+        String scope = String.valueOf(ticketJson.get("scope"));
+        result.put("accessToken", accessToken);
+        result.put("refreshToken", refreshToken);
+        result.put("openId", openId);
+        result.put("expiresIn", expiresIn);
+        result.put("scope", scope);
+        return result;
+    }
 
-
-
+    /**
+     * 拉取用户信息
+     * @param accessToken
+     * @param openId
+     * @return
+     */
+    public static Map<String,String> getUserInfo(String accessToken, String openId) throws Exception {
+        String requestUrl = GET_USER_INFO_URL.replace("ACCESS_TOKEN", accessToken).replace("OPENID",openId);
+        Map<String, String> result = new HashMap<>(5);
+        String response = HttpRequest.sendGet(requestUrl);
+        JSONObject ticketJson = JSONObject.parseObject(response);
+        String nickName = String.valueOf(ticketJson.get("nickname"));
+        result.put("nickName", nickName);
+        return result;
+    }
 }

+ 74 - 0
src/main/java/com/caimei/wxController/LoginApi.java

@@ -0,0 +1,74 @@
+package com.caimei.wxController;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.dto.PasswordDto;
+import com.caimei.model.vo.UserLoginVo;
+import com.caimei.model.vo.WxClubUserVo;
+import com.caimei.service.LoginService;
+import com.caimei.service.UserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+
+/**
+ * 微信机构用户登录API
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Api(tags = "微信机构用户登录API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/wx/user")
+public class LoginApi {
+
+    private final LoginService loginService;
+
+    @ApiOperation("公众号授权登录")
+    @ApiImplicitParam(name = "params", value = "code登录凭证", required = true)
+    @PostMapping("/login/authorization")
+    public ResponseJson<WxClubUserVo> authorizationLogin(@RequestBody String params) {
+        JSONObject parseObject = JSONObject.parseObject(params);
+        String code = parseObject.getString("code");
+        if (StringUtils.isEmpty(code)) {
+            return ResponseJson.error("参数异常", null);
+        }
+        return loginService.loginByAuthorization(code);
+    }
+
+    @ApiOperation("登录验证码发送")
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;authUserId:供应商用户id", required = true)
+    @PostMapping("/verify/code/send")
+    public ResponseJson sendVerifyCode(@RequestBody String params) {
+        JSONObject parseObject = JSONObject.parseObject(params);
+        String mobile = parseObject.getString("mobile");
+        // 供应商用户id
+        Integer authUserId = parseObject.getInteger("authUserId");
+        return loginService.sendVerifyCode(authUserId, mobile);
+    }
+
+    /**
+     * 邀请码登录
+     */
+    @ApiOperation("邀请码登录")
+    @PostMapping("/login/invitation/code")
+    public ResponseJson<WxClubUserVo> invitationCode(@RequestBody String params) throws Exception {
+        JSONObject parseObject = JSONObject.parseObject(params);
+        String mobile = parseObject.getString("mobile");
+        String verifyCode = parseObject.getString("verifyCode");
+        String invitationCode = parseObject.getString("invitationCode");
+        String accessToken = parseObject.getString("accessToken");
+        String openId = parseObject.getString("openId");
+        return loginService.loginByInvitationCode(mobile, verifyCode, invitationCode, accessToken, openId);
+    }
+}

+ 10 - 4
src/main/java/com/caimei/wxController/SDKAPI.java → src/main/java/com/caimei/wxController/SDKApi.java

@@ -3,6 +3,8 @@ package com.caimei.wxController;
 import com.caimei.model.ResponseJson;
 import com.caimei.service.SDKService;
 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;
@@ -16,16 +18,20 @@ import java.util.Map;
 @Slf4j
 @RestController
 @RequiredArgsConstructor
-@RequestMapping("/wxsdk")
-public class SDKAPI {
+@RequestMapping("/wx/sdk")
+public class SDKApi {
     private final SDKService sdkService;
 
 
     @ApiOperation("获取公众号数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "appId", required = true, value = "公众号appId"),
+            @ApiImplicitParam(name = "appSecret", required = false, value = "公众号appSecret"),
+            @ApiImplicitParam(name = "url", required = false, value = "公众号链接")
+    })
     @GetMapping("/config/data")
-    public ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) {
+    public ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) throws Exception {
         return sdkService.getConfigData(appId, appSecret, url);
     }
 
-
 }

+ 61 - 0
src/main/java/com/caimei/wxController/WxAuthApi.java

@@ -0,0 +1,61 @@
+package com.caimei.wxController;
+
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.WxClubListVo;
+import com.caimei.model.vo.WxProductListVo;
+import com.caimei.service.AuthClubService;
+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.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author Aslee
+ */
+@Api(tags = "微信品牌认证API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/wx/auth")
+public class WxAuthApi {
+    private final AuthClubService authClubService;
+
+    private final AuthProductService authProductService;
+
+    @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("/club/list")
+    public ResponseJson<PageInfo<WxClubListVo>> getWxClubList(Integer authUserId, String clubName,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authClubService.getWxClubList(authUserId, clubName, pageNum, pageSize);
+    }
+
+
+    @ApiOperation("已认证商品列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authId", required = true, value = "认证机构id"),
+            @ApiImplicitParam(name = "productName", required = false, value = "商品名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/product/list")
+    public ResponseJson<PageInfo<WxProductListVo>> getWxProductList(Integer authId, String productName,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return authProductService.getWxProductList(authId, productName, pageNum, pageSize);
+    }
+}

+ 105 - 0
src/main/java/com/caimei/wxController/WxDataApi.java

@@ -0,0 +1,105 @@
+package com.caimei.wxController;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.model.ResponseJson;
+import com.caimei.model.vo.*;
+import com.caimei.service.*;
+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.*;
+
+/**
+ * @author Aslee
+ */
+@Api(tags = "微信资料库API")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/wx/data")
+public class WxDataApi {
+    private final ArticleService articleService;
+    private final ImageService imageService;
+    private final VideoService videoService;
+    private final FileService fileService;
+    private final AuthClubService authClubService;
+
+    @ApiOperation("资料库文章列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "articleName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/article/list")
+    public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleName,
+                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return articleService.getWxArticleList(authUserId, articleName, pageNum, pageSize);
+    }
+
+    @ApiOperation("资料库文章回显数据")
+    @ApiImplicitParam(name = "articleId", value = "文章id", required = true)
+    @GetMapping("/article/form/data")
+    public ResponseJson<ArticleFormVo> getArticleFormData(Integer articleId) {
+        return articleService.getArticleFormData(articleId);
+    }
+
+    @ApiOperation("资料库图片列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "imageName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/image/list")
+    public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageName,
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return imageService.getWxImageList(authUserId, imageName, pageNum, pageSize);
+    }
+
+    @ApiOperation("资料库视频列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "videoName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/video/list")
+    public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoName,
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return videoService.getWxVideoList(authUserId, videoName, pageNum, pageSize);
+    }
+
+    @ApiOperation("资料库文件列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "fileName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
+            @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
+    })
+    @GetMapping("/file/list")
+    public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileName,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return fileService.getWxFileList(authUserId, fileName, pageNum, pageSize);
+    }
+
+
+    @ApiOperation("提交意见反馈")
+    @ApiImplicitParam(name = "params", required = true, value = "供应商用户id")
+    @GetMapping("/feedback/submit")
+    public ResponseJson submitFeedback(@RequestBody String params) {
+        JSONObject paramsMap = JSONObject.parseObject(params);
+        Integer clubUserId = paramsMap.getInteger("clubUserId");
+        String content = paramsMap.getString("content");
+        return authClubService.submitFeedback(clubUserId, content);
+    }
+
+}

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

@@ -192,5 +192,7 @@ CREATE TABLE `cm_brand_club_feedback` (
                                                PRIMARY KEY (`id`))
     COMMENT = '机构意见反馈表';
 
+ALTER TABLE `cm_brand_auth_user`
+    ADD COLUMN `qrCodeImage` TEXT NULL COMMENT '公众号二维码' AFTER `shopType`;
 # ==================================正品联盟7月优化end===============================================
 

+ 2 - 0
src/main/resources/config/beta/application-beta.yml

@@ -62,6 +62,8 @@ caimei:
   zplmapi: https://zplma-b.caimei365.com
   #图片服务器
   imageDomain: https://img-b.caimei365.com
+  core: https://core-b.caimei365.com
+
 
 #DFS配置
 fdfs:

+ 4 - 0
src/main/resources/config/dev/application-dev.yml

@@ -59,6 +59,10 @@ caimei:
   zplmapi: http://localhost:8012
   #图片服务器
   imageDomain: http://192.168.2.100
+  core: https://core-b.caimei365.com
+  #公众号
+  appid: wx6512b1dfb84c28e1
+  secret: 10f94918f59f630351319382bb29cab1
 
 #DFS配置
 fdfs:

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

@@ -59,6 +59,7 @@ caimei:
   zplmapi: https://zplma.caimei365.com
   #图片服务器
   imageDomain: https://img.caimei365.com
+  core: https://core.caimei365.com
 
 #DFS配置
 fdfs:

+ 8 - 2
src/main/resources/mapper/ArticleMapper.xml

@@ -31,7 +31,7 @@
     <delete id="deleteArticleByArticleId">
         delete from cm_brand_article where id = #{articleId}
     </delete>
-    <select id="getArticleList" resultType="com.caimei.model.vo.ArticleVo">
+    <select id="getArticleList" resultType="com.caimei.model.vo.ArticleListVo">
         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
@@ -59,6 +59,12 @@
     <select id="getArticleForm" resultType="com.caimei.model.vo.ArticleFormVo">
         select id as articleId, title as articleTitle, image as articleImage, content as articleContent
         from cm_brand_article
-        where id = #{articleId}
+        where id = #{articleId} and status = 1
+    </select>
+    <select id="getWxArticleList" resultType="com.caimei.model.vo.WxArticleListVo">
+        select id as articleId, title as articleTitle, image as articleImage, date_format(createTime, '%Y-%m-%d')
+        from cm_brand_article
+        where authUserId = #{authUserId}
+        and status = 1
     </select>
 </mapper>

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

@@ -61,4 +61,14 @@
         where authId = #{authId}
           and auditStatus = 2
     </select>
+    <select id="getClubStatus" resultType="java.lang.Integer">
+        select status
+        from cm_brand_auth
+        where id = #{authId}
+    </select>
+    <select id="getAuthById" resultType="com.caimei.model.po.CmBrandAuthPo">
+        select authUserId, status
+        from cm_brand_auth
+        where id = #{authId}
+    </select>
 </mapper>

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

@@ -138,4 +138,12 @@
                appletsCertificateImage
         from cm_brand_auth_product
     </select>
+    <select id="getWxProductList" resultType="com.caimei.model.vo.WxProductListVo">
+        select id as productId,name as productName
+        from cm_brand_auth_product
+        where authId = #{authId}
+        <if test="productName != null and productName != ''">
+            and name like concat('%',#{productName},'%')
+        </if>
+    </select>
 </mapper>

+ 17 - 1
src/main/resources/mapper/ClubMapper.xml

@@ -6,6 +6,10 @@
                                         delFlag)
         values (#{authId}, #{invitationCode}, #{status}, #{addTime}, #{updateTime}, #{invitationCodeTime}, 0)
     </insert>
+    <insert id="insertFeedback">
+        insert into cm_brand_club_feedback(clubUserId, content, commitTime)
+        values (#{clubUserId}, #{content}, NOW())
+    </insert>
     <update id="unbindClubUser">
         update cm_brand_club_user set delFlag = 1 where id = #{clubUserId}
     </update>
@@ -19,7 +23,7 @@
     </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}
+        from cm_brand_auth where authUserId = #{authUserId}
         <if test="clubName != null and clubName != ''">
             and authParty like concat('%',#{clubName},'%');
         </if>
@@ -58,4 +62,16 @@
         from cm_brand_club_user
         where id = #{clubUserId}
     </select>
+    <select id="getWxClubList" resultType="com.caimei.model.vo.WxClubListVo">
+        select id as authId, authParty as clubName
+        from cm_brand_auth
+        where authUserId = #{authUserId}
+        and status = 1
+        <if test="clubName != null and clubName != ''">
+            authParty like concat('%',#{clubName},'%')
+        </if>
+    </select>
+    <select id="checkMobile" resultType="java.lang.Integer">
+        select id as clubUserId from cm_brand_club_user where mobile = #{mobile} and delFlag = 0 limit 1
+    </select>
 </mapper>

+ 7 - 1
src/main/resources/mapper/FileMapper.xml

@@ -47,7 +47,7 @@
     <delete id="deleteFileByFileId">
         delete from cm_brand_file where id = #{fileId}
     </delete>
-    <select id="getFileList" resultType="com.caimei.model.vo.FileVo">
+    <select id="getFileList" resultType="com.caimei.model.vo.FileListVo">
         select a.id as fileId,a.title as fileTitle,a.url as fileUrl,
         a.auditStatus,a.invalidReason,a.status,a.createTime,
         au.name as auditBy,a.auditTime
@@ -72,4 +72,10 @@
             </otherwise>
         </choose>
     </select>
+    <select id="getWxFileList" resultType="com.caimei.model.vo.WxFileListVo">
+        select id as fileId, title as fileTitle, url as fileUrl, date_format(createTime, '%Y-%m-%d')
+        from cm_brand_file
+        where authUserId = #{authUserId}
+          and status = 1
+    </select>
 </mapper>

+ 7 - 1
src/main/resources/mapper/ImageMapper.xml

@@ -36,7 +36,7 @@
     <delete id="deleteImageDetail">
         delete from cm_brand_image_detail where imageId = #{imageId}
     </delete>
-    <select id="getImageList" resultType="com.caimei.model.vo.ImageVo">
+    <select id="getImageList" resultType="com.caimei.model.vo.ImageListVo">
         select a.id as imageId,a.title as imageTitle,
         a.auditStatus,a.invalidReason,a.status,a.createTime,
         au.name as auditBy,a.auditTime
@@ -67,4 +67,10 @@
     <select id="getImageListByImageId" resultType="java.lang.String">
         select image from cm_brand_image_detail where imageId = #{imageId}
     </select>
+    <select id="getWxImageList" resultType="com.caimei.model.vo.WxImageListVo">
+        select id as imageId, title as imageTitle, date_format(createTime, '%Y-%m-%d')
+        from cm_brand_image
+        where authUserId = #{authUserId}
+          and status = 1
+    </select>
 </mapper>

+ 28 - 0
src/main/resources/mapper/LoginMapper.xml

@@ -0,0 +1,28 @@
+<?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.LoginMapper">
+    <update id="bindClubUser">
+        update cm_brand_club_user
+        set mobile   = #{mobile},
+            openId   = #{openId},
+            nickName = #{nickName},
+            bindTime =NOW()
+        where invitationCode = #{invitationCode};
+    </update>
+
+    <select id="findClubUser" resultType="com.caimei.model.vo.WxClubUserVo">
+        select cu.id as clubUserId, cu.authId, a.authUserId, cu.mobile, cu.openId
+        from cm_brand_club_user cu
+                 left join cm_brand_auth a on cu.authId = a.id
+                 left join cm_brand_auth_user au on a.id = au.authUserId
+        where openId = #{openId}
+          and cu.delFlag = 0
+          and a.status = 1
+          and au.status = 1
+    </select>
+    <select id="findByInvitationCode" resultType="com.caimei.model.po.ClubUserPo">
+        select id as clubUserId, authId, status, invitationCodeTime
+        from cm_brand_club_user
+        where invitationCode = #{invitationCode} and delFlag = 0
+    </select>
+</mapper>

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

@@ -6,9 +6,9 @@
         values (#{authUserId}, #{brandId}, #{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`, `linkMan`, `userIdentity`, `shopType`, `createTime`,
+        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `linkMan`, `userIdentity`, `shopType`, `qrCodeImage`, `createTime`,
                                         `createBy`,`status`)
-        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{createTime}, #{createBy}, #{status});
+        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{qrCodeImage}, #{createTime}, #{createBy}, #{status});
     </insert>
     <insert id="insertShopInfo">
         insert into cm_brand_auth_shop_info
@@ -60,9 +60,10 @@
     </update>
     <update id="updateShopByUserId">
         update cm_brand_auth_user
-        set `mobile`  = #{mobile},
-            `linkMan` = #{linkMan},
-            `status`  = #{status}
+        set `mobile`      = #{mobile},
+            `linkMan`     = #{linkMan},
+            `status`      = #{status},
+            `qrCodeImage` = #{qrCodeImage}
         where authUserId = #{authUserId}
     </update>
     <update id="updateShopInfo">
@@ -103,7 +104,12 @@
         (select au.name from cm_brand_auth_user au where au.authUserId = u.createBy) as createBy,
         ((select count(*)from cm_brand_auth where authUserId = u.authUserId and auditStatus = 2) +
         (select count(*) from cm_brand_auth_product p left join cm_brand_auth a on p.authId = a.id
-        where a.authUserId = u.authUserId and p.auditStatus = 2)) as waitAuditNum
+        where a.authUserId = u.authUserId and p.auditStatus = 2)) as waitAuditNum,
+        (select count(*) from cm_brand_article a where a.authUserId = u.authUserId and a.auditStatus = 2) as
+        articleWaitNum,
+        (select count(*) from cm_brand_image i where i.authUserId = u.authUserId and i.auditStatus = 2) as imageWaitNum,
+        (select count(*) from cm_brand_video v where v.authUserId = u.authUserId and v.auditStatus = 2) as videoWaitNum,
+        (select count(*) from cm_brand_file f where f.authUserId = u.authUserId and f.auditStatus = 2) as fileWaitNum
         from cm_brand_auth_user u
         left join cm_brand_auth_shop_info s on u.authUserId = s.authUserId
         left join cm_brand cb on cb.id = s.brandId
@@ -128,6 +134,9 @@
             <when test="listType == 2">
                 ORDER BY waitAuditNum desc, u.createTime DESC
             </when>
+            <when test="listType == 3">
+                ORDER BY (articleWaitNum + imageWaitNum +videoWaitNum +fileWaitNum) desc, u.createTime DESC
+            </when>
             <otherwise>
                 ORDER BY u.createTime DESC
             </otherwise>
@@ -159,7 +168,7 @@
         select count(*) from cm_brand_auth_file where md5Hex = #{md5Hex}
     </select>
     <select id="getShopByUserId" resultType="com.caimei.model.vo.ShopFormVo">
-        select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType
+        select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType, u.qrCodeImage
         from cm_brand_auth_user u
         where u.authUserId = #{authUserId};
     </select>
@@ -245,5 +254,10 @@
                  join cm_brand_auth a on cu.authId = a.id
         where a.authUserId = #{authUserId}
     </select>
+    <select id="getShopStatus" resultType="java.lang.Integer">
+        select status
+        from cm_brand_auth_user
+        where authUserId = #{authUserId}
+    </select>
 
 </mapper>

+ 6 - 3
src/main/resources/mapper/VideoMapper.xml

@@ -47,7 +47,7 @@
     <delete id="deleteVideoByVideoId">
         delete from cm_brand_video where id = #{videoId}
     </delete>
-    <select id="getVideoList" resultType="com.caimei.model.vo.VideoVo">
+    <select id="getVideoList" resultType="com.caimei.model.vo.VideoListVo">
         select a.id as videoId,a.title as videoTitle,a.url as videoUrl,
         a.auditStatus,a.invalidReason,a.status,a.createTime,
         au.name as auditBy,a.auditTime
@@ -72,7 +72,10 @@
             </otherwise>
         </choose>
     </select>
-    <select id="getFileNumByMd5Hex" resultType="java.lang.Integer">
-        select count(*) from cm_brand_video where md5Hex = #{md5Hex}
+    <select id="getWxVideoList" resultType="com.caimei.model.vo.WxVideoListVo">
+        select id as videoId, title as videoTitle, url as videoUrl, date_format(createTime, '%Y-%m-%d')
+        from cm_brand_video
+        where authUserId = #{authUserId}
+          and status = 1
     </select>
 </mapper>