Bläddra i källkod

正品联盟资料库优化part4

Aslee 3 år sedan
förälder
incheckning
b85436ae1a
49 ändrade filer med 540 tillägg och 172 borttagningar
  1. 6 0
      src/main/java/com/caimei/config/ApiConfig.java
  2. 53 0
      src/main/java/com/caimei/config/WxApiInterceptor.java
  3. 1 1
      src/main/java/com/caimei/controller/ImageApi.java
  4. 10 5
      src/main/java/com/caimei/controller/ShopApi.java
  5. 1 1
      src/main/java/com/caimei/mapper/ArticleMapper.java
  6. 1 1
      src/main/java/com/caimei/mapper/FileMapper.java
  7. 1 1
      src/main/java/com/caimei/mapper/ImageMapper.java
  8. 7 1
      src/main/java/com/caimei/mapper/ShopMapper.java
  9. 1 1
      src/main/java/com/caimei/mapper/VideoMapper.java
  10. 5 0
      src/main/java/com/caimei/model/po/ImagePo.java
  11. 10 0
      src/main/java/com/caimei/model/po/UserPo.java
  12. 3 0
      src/main/java/com/caimei/model/vo/ArticleFormVo.java
  13. 22 0
      src/main/java/com/caimei/model/vo/ShopAppInfoVo.java
  14. 6 0
      src/main/java/com/caimei/model/vo/ShopFormVo.java
  15. 3 0
      src/main/java/com/caimei/model/vo/WxImageListVo.java
  16. 2 2
      src/main/java/com/caimei/service/ArticleService.java
  17. 2 2
      src/main/java/com/caimei/service/FileService.java
  18. 3 3
      src/main/java/com/caimei/service/ImageService.java
  19. 5 4
      src/main/java/com/caimei/service/LoginService.java
  20. 2 3
      src/main/java/com/caimei/service/SDKService.java
  21. 7 2
      src/main/java/com/caimei/service/ShopService.java
  22. 8 0
      src/main/java/com/caimei/service/UploadService.java
  23. 2 2
      src/main/java/com/caimei/service/VideoService.java
  24. 5 2
      src/main/java/com/caimei/service/impl/ArticleServiceImpl.java
  25. 2 1
      src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java
  26. 2 2
      src/main/java/com/caimei/service/impl/FileServiceImpl.java
  27. 22 3
      src/main/java/com/caimei/service/impl/ImageServiceImpl.java
  28. 35 18
      src/main/java/com/caimei/service/impl/LoginServiceImpl.java
  29. 35 7
      src/main/java/com/caimei/service/impl/SDKServiceImpl.java
  30. 17 5
      src/main/java/com/caimei/service/impl/ShopServiceImpl.java
  31. 65 2
      src/main/java/com/caimei/service/impl/UploadServiceImpl.java
  32. 2 2
      src/main/java/com/caimei/service/impl/VideoServiceImpl.java
  33. 11 4
      src/main/java/com/caimei/utils/OSSUtils.java
  34. 10 2
      src/main/java/com/caimei/utils/SmsUtils.java
  35. 68 31
      src/main/java/com/caimei/utils/WxUtils.java
  36. 8 13
      src/main/java/com/caimei/wxController/LoginApi.java
  37. 2 3
      src/main/java/com/caimei/wxController/SDKApi.java
  38. 14 14
      src/main/java/com/caimei/wxController/WxDataApi.java
  39. 7 1
      src/main/resources/backup.sql
  40. 3 1
      src/main/resources/config/beta/application-beta.yml
  41. 1 1
      src/main/resources/config/dev/application-dev.yml
  42. 8 3
      src/main/resources/mapper/ArticleMapper.xml
  43. 4 3
      src/main/resources/mapper/ClubMapper.xml
  44. 6 2
      src/main/resources/mapper/FileMapper.xml
  45. 10 4
      src/main/resources/mapper/ImageMapper.xml
  46. 5 4
      src/main/resources/mapper/LoginMapper.xml
  47. 29 8
      src/main/resources/mapper/ShopMapper.xml
  48. 6 2
      src/main/resources/mapper/VideoMapper.xml
  49. 2 5
      src/test/java/com/caimei/AdminApplicationTests.java

+ 6 - 0
src/main/java/com/caimei/config/ApiConfig.java

@@ -17,6 +17,9 @@ public class ApiConfig implements WebMvcConfigurer {
     @Resource
     private ApiInterceptor apiInterceptor;
 
+    @Resource
+    private WxApiInterceptor wxApiInterceptor;
+
     @Override
     public void addInterceptors(InterceptorRegistry registry) {
         //addPathPatterns 用于添加拦截规则
@@ -29,5 +32,8 @@ public class ApiConfig implements WebMvcConfigurer {
                 .addPathPatterns("/user/update/password")
                 .addPathPatterns("/data/**");
 //                .excludePathPatterns("/order/shareCode");
+        registry.addInterceptor(wxApiInterceptor)
+                .addPathPatterns("/wx/data/**")
+                .excludePathPatterns("/wx/data/feedback/submit");
     }
 }

+ 53 - 0
src/main/java/com/caimei/config/WxApiInterceptor.java

@@ -0,0 +1,53 @@
+package com.caimei.config;
+
+import com.caimei.components.RedisService;
+import com.caimei.mapper.LoginMapper;
+import com.caimei.model.vo.WxClubUserVo;
+import com.caimei.service.LoginService;
+import com.caimei.utils.JwtUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/7/21
+ */
+@Component
+public class WxApiInterceptor implements HandlerInterceptor {
+
+    private RedisService redisService;
+
+    @Autowired
+    public void setRedisService(RedisService redisService) {
+        this.redisService = redisService;
+    }
+
+    @Resource
+    private LoginMapper loginMapper;
+
+    @Value("${caimei.zplmapi}")
+    private String zplmapi;
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String token = request.getHeader("X-Token");
+        String cacheOpenId = null != token ? (null != redisService.get(token) ? String.valueOf(redisService.get(token)) : null) : null;
+        // 验证机构用户是否可以登录
+        WxClubUserVo clubUser = loginMapper.findClubUser(cacheOpenId);
+        if (null == cacheOpenId || null == clubUser) {
+            // Token失效
+            response.sendRedirect(zplmapi + "/unauthorized");
+            return false;
+        }
+        return true;
+    }
+
+}

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

@@ -53,7 +53,7 @@ public class ImageApi {
     @ApiOperation("添加/编辑图片")
     @ApiImplicitParam(name = "params", value = "imageId:图片id;authUserId:供应商用户id;imageTitle:图片标题;imageArr:图片数组", required = true)
     @PostMapping("/save")
-    public ResponseJson saveImage(@RequestBody String params) {
+    public ResponseJson saveImage(@RequestBody String params) throws Exception {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer imageId = paramsMap.getInteger("imageId");
         Integer authUserId = paramsMap.getInteger("authUserId");

+ 10 - 5
src/main/java/com/caimei/controller/ShopApi.java

@@ -123,6 +123,8 @@ public class ShopApi {
             return ResponseJson.error("参数异常,请输入供应商状态");
         }
         String qrCodeImage = (String) paramsMap.get("qrCodeImage");
+        String appId = (String) paramsMap.get("appId");
+        String appSecret = (String) paramsMap.get("appSecret");
         Integer createBy = paramsMap.getInteger("createBy");
         List<Map<String, Object>> shopInfoData = (List<Map<String, Object>>) paramsMap.get("shopInfo");
         if (null == shopInfoData || shopInfoData.size() <= 0) {
@@ -154,7 +156,7 @@ public class ShopApi {
             shopInfo.setStatementFileId(statementFileId);
             shopInfoList.add(shopInfo);
         }
-        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus, qrCodeImage, createBy, shopInfoList);
+        return shopService.saveShop(authUserId, shopType, shopName, mobile, linkMan, shopStatus, qrCodeImage, appId, appSecret, createBy, shopInfoList);
     }
 
     /**
@@ -227,15 +229,18 @@ public class ShopApi {
 
     @ApiOperation("用户反馈列表")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
+            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
+            @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
+            @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
+            @ApiImplicitParam(name = "handleStatus", required = false, value = "处理状态:0未处理,1已处理"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     @GetMapping("/feedback/list")
-    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId,
+    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, String clubName, String mobile, Integer handleStatus,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
-                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
-        return shopService.getFeedbackList(authUserId, pageNum, pageSize);
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        return shopService.getFeedbackList(authUserId, clubName, mobile, handleStatus, pageNum, pageSize);
     }
 
     @ApiOperation("用户反馈表单数据")

+ 1 - 1
src/main/java/com/caimei/mapper/ArticleMapper.java

@@ -33,5 +33,5 @@ public interface ArticleMapper {
 
     ArticleFormVo getArticleForm(Integer articleId);
 
-    List<WxArticleListVo> getWxArticleList(@Param("authUserId") Integer authUserId, @Param("articleName") String articleName);
+    List<WxArticleListVo> getWxArticleList(@Param("authUserId") Integer authUserId, @Param("articleTitle") String articleTitle);
 }

+ 1 - 1
src/main/java/com/caimei/mapper/FileMapper.java

@@ -32,5 +32,5 @@ public interface FileMapper {
 
     void updateFileSelective(FilePo file);
 
-    List<WxFileListVo> getWxFileList(Integer authUserId, String fileName);
+    List<WxFileListVo> getWxFileList(@Param("authUserId") Integer authUserId, @Param("fileTitle") String fileTitle);
 }

+ 1 - 1
src/main/java/com/caimei/mapper/ImageMapper.java

@@ -39,5 +39,5 @@ public interface ImageMapper {
 
     List<String> getImageListByImageId(Integer imageId);
 
-    List<WxImageListVo> getWxImageList(Integer authUserId, String imageName);
+    List<WxImageListVo> getWxImageList(Integer authUserId, String imageTitle);
 }

+ 7 - 1
src/main/java/com/caimei/mapper/ShopMapper.java

@@ -66,11 +66,17 @@ public interface ShopMapper {
 
     Integer getProductCount(@Param("authUserId") Integer authUserId, @Param("brandId") Integer brandId);
 
-    List<FeedbackVo> getFeedbackList(Integer authUserId);
+    List<FeedbackVo> getFeedbackList(@Param("authUserId") Integer authUserId, @Param("clubName") String clubName, @Param("mobile") String mobile, @Param("handleStatus") Integer handleStatus);
 
     FeedbackVo getFeedback(Integer feedbackId);
 
     void handleFeedback(@Param("feedbackId") Integer feedbackId, @Param("handleResult") String handleResult);
 
     Integer getShopStatus(Integer authUserId);
+
+    Integer getUserIdByAppId(String appId);
+
+    String getAppSecretByAppId(String appId);
+
+    String getAppId(Integer authUserId);
 }

+ 1 - 1
src/main/java/com/caimei/mapper/VideoMapper.java

@@ -32,5 +32,5 @@ public interface VideoMapper {
 
     void updateVideoSelective(VideoPo video);
 
-    List<WxVideoListVo> getWxVideoList(Integer authUserId, String videoName);
+    List<WxVideoListVo> getWxVideoList(@Param("authUserId") Integer authUserId, @Param("videoTitle") String videoTitle);
 }

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

@@ -25,6 +25,11 @@ public class ImagePo {
      */
     private String title;
 
+    /**
+     * 压缩包链接
+     */
+    private String zipUrl;
+
     /**
      * 审核状态:0审核未通过,1审核通过,2待审核
      */

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

@@ -50,6 +50,16 @@ public class UserPo {
      */
     private String qrCodeImage;
 
+    /**
+     * 公众号appId
+     */
+    private String appId;
+
+    /**
+     * 公众号appSecret
+     */
+    private String appSecret;
+
     /**
      * 创建时间
      */

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

@@ -23,4 +23,7 @@ public class ArticleFormVo {
 
     @ApiModelProperty("文章内容")
     private String articleContent;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
 }

+ 22 - 0
src/main/java/com/caimei/model/vo/ShopAppInfoVo.java

@@ -0,0 +1,22 @@
+package com.caimei.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/5/11
+ */
+@Data
+public class ShopAppInfoVo implements Serializable {
+    @ApiModelProperty("供应商公众号appId")
+    private String appId;
+
+    @ApiModelProperty("供应商公众号appSecret")
+    private String appSecret;
+}

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

@@ -37,6 +37,12 @@ public class ShopFormVo implements Serializable {
     @ApiModelProperty("公众号二维码图片")
     private String qrCodeImage;
 
+    @ApiModelProperty("供应商公众号appId")
+    private String appId;
+
+    @ApiModelProperty("供应商公众号appSecret")
+    private String appSecret;
+
     /**
      * 手机号
      */

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

@@ -19,6 +19,9 @@ public class WxImageListVo {
     @ApiModelProperty("图片标题")
     private String imageTitle;
 
+    @ApiModelProperty("图片压缩包链接")
+    private String imageZipUrl;
+
     @ApiModelProperty("创建时间")
     private Date createTime;
 

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

@@ -74,10 +74,10 @@ public interface ArticleService {
     /**
      * 微信公众号文章列表
      * @param authUserId    供应商用户id
-     * @param articleName   文章名称
+     * @param articleTitle   文章名称
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleTitle, Integer pageNum, Integer pageSize);
 }

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

@@ -65,10 +65,10 @@ public interface FileService {
     /**
      * 微信公众号文件列表
      * @param authUserId        供应商用户id
-     * @param fileName          文件名称
+     * @param fileTitle          文件名称
      * @param pageNum           第几页
      * @param pageSize          一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileTitle, Integer pageNum, Integer pageSize);
 }

+ 3 - 3
src/main/java/com/caimei/service/ImageService.java

@@ -37,7 +37,7 @@ public interface ImageService {
      * @param imageArr          图片数组
      * @return  ResponseJson
      */
-    ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, JSONArray imageArr);
+    ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, JSONArray imageArr) throws Exception;
 
     /**
      * 更新图片状态
@@ -74,10 +74,10 @@ public interface ImageService {
     /**
      * 微信公众号图片列表
      * @param authUserId    供应商用户id
-     * @param imageName     图片名称
+     * @param imageTitle     图片名称
      * @param pageNum       第几页
      * @param pageSize      一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageTitle, Integer pageNum, Integer pageSize);
 }

+ 5 - 4
src/main/java/com/caimei/service/LoginService.java

@@ -13,18 +13,18 @@ public interface LoginService {
     /**
      * 微信授权登录
      * @param code
+     * @param appId
      * @return
      */
-    ResponseJson<WxClubUserVo> loginByAuthorization(String code);
+    ResponseJson<WxClubUserVo> loginByAuthorization(String code, String appId);
 
     /**
      * 发送登录验证码
      *
-     * @param authUserId
      * @param mobile
      * @return
      */
-    ResponseJson sendVerifyCode(Integer authUserId, String mobile);
+    ResponseJson sendVerifyCode(String mobile);
 
     /**
      * 邀请码登录
@@ -33,7 +33,8 @@ public interface LoginService {
      * @param invitationCode
      * @param accessToken
      * @param openId
+     * @param appId
      * @return
      */
-    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId) throws Exception;
+    ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId, String appId) throws Exception;
 }

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

@@ -14,10 +14,9 @@ public interface SDKService {
 
     /**
      * 获取公众号配置数据
-     * @param appId         公众号appId
-     * @param appSecret     公众号appSecret
+     * @param authUserId         供应商用户id
      * @param url           公众号url
      * @return
      */
-    ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) throws Exception;
+    ResponseJson<Map<String, String>> getConfigData(String authUserId, String url) throws Exception;
 }

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

@@ -77,9 +77,11 @@ public interface ShopService {
      *                    createBy           创建人用户id
      *                    }
      * @param qrCodeImage
+     * @param appId
+     * @param appSecret
      * @param shopInfoList
      */
-    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer createBy, List<ShopInfoDto> shopInfoList);
+    ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList);
 
     /**
      * 获取供应商回显数据
@@ -110,11 +112,14 @@ public interface ShopService {
     /**
      * 用户反馈列表
      * @param authUserId    供应商用户id
+     * @param clubName
+     * @param mobile
+     * @param handleStatus
      * @param pageNum
      * @param pageSize
      * @return
      */
-    ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, String clubName, String mobile, Integer handleStatus, Integer pageNum, Integer pageSize);
 
     /**
      * 用户反馈表单数据

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

@@ -1,5 +1,6 @@
 package com.caimei.service;
 
+import com.alibaba.fastjson.JSONArray;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -18,4 +19,11 @@ public interface UploadService {
      * @return
      */
     String saveFile(MultipartFile file) throws IOException;
+
+    /**
+     * 将多张图片压缩并上传
+     * @param imageArr
+     * @return
+     */
+    String saveImageZip(JSONArray imageArr) throws IOException, Exception;
 }

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

@@ -65,10 +65,10 @@ public interface VideoService {
     /**
      * 微信公众号视频列表
      * @param authUserId        供应商用户id
-     * @param videoName         视频名称
+     * @param videoTitle         视频名称
      * @param pageNum           第几页
      * @param pageSize          一页多少条
      * @return
      */
-    ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoName, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoTitle, Integer pageNum, Integer pageSize);
 }

+ 5 - 2
src/main/java/com/caimei/service/impl/ArticleServiceImpl.java

@@ -141,16 +141,19 @@ public class ArticleServiceImpl implements ArticleService {
             return ResponseJson.error("请输入文章id", null);
         }
         ArticleFormVo article = articleMapper.getArticleForm(articleId);
+        if (null == article) {
+            return ResponseJson.error("文章不存在", null);
+        }
         return ResponseJson.success(article);
     }
 
     @Override
-    public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleName, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleTitle, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,供应商用户id不能为空", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxArticleListVo> articleList = articleMapper.getWxArticleList(authUserId, articleName);
+        List<WxArticleListVo> articleList = articleMapper.getWxArticleList(authUserId, articleTitle);
         PageInfo<WxArticleListVo> pageData = new PageInfo<>(articleList);
         return ResponseJson.success(pageData);
     }

+ 2 - 1
src/main/java/com/caimei/service/impl/AuthProductServiceImpl.java

@@ -220,8 +220,9 @@ public class AuthProductServiceImpl implements AuthProductService {
                 imagePath = imageDomain + "/" + uploadService.saveFile(imgFile);
             }
             log.info(">>>>>>>>>>>>>>>>水印图片上传成功:" + imagePath);
+        } else {
+            log.info(">>>>>>>>>>>>>>>>水印图片上传失败");
         }
-        log.info(">>>>>>>>>>>>>>>>水印图片上传失败");
         return imagePath;
     }
 

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

@@ -155,12 +155,12 @@ public class FileServiceImpl implements FileService {
     }
 
     @Override
-    public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileName, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileTitle, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,供应商用户id不能为空", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxFileListVo> fileList = fileMapper.getWxFileList(authUserId, fileName);
+        List<WxFileListVo> fileList = fileMapper.getWxFileList(authUserId, fileTitle);
         PageInfo<WxFileListVo> pageData = new PageInfo<>(fileList);
         return ResponseJson.success(pageData);
     }

+ 22 - 3
src/main/java/com/caimei/service/impl/ImageServiceImpl.java

@@ -9,15 +9,23 @@ 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.caimei.service.UploadService;
 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.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.net.URI;
 import java.util.Date;
 import java.util.List;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
 
 /**
  * Description
@@ -32,6 +40,14 @@ public class ImageServiceImpl implements ImageService {
     @Resource
     private ImageMapper imageMapper;
 
+    private UploadService uploadService;
+
+    @Autowired
+    public void setUploadService(UploadService uploadService) {
+        this.uploadService = uploadService;
+    }
+
+
     @Override
     public ResponseJson<PageInfo<ImageListVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
@@ -45,7 +61,7 @@ public class ImageServiceImpl implements ImageService {
     }
 
     @Override
-    public ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, JSONArray imageArr) {
+    public ResponseJson saveImage(Integer imageId, Integer authUserId, String imageTitle, JSONArray imageArr) throws Exception {
         if (null == imageId && null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id");
         }
@@ -63,6 +79,9 @@ public class ImageServiceImpl implements ImageService {
         // 上线状态默认为“待上线”,审核状态为“待审核”
         image.setStatus(2);
         image.setAuditStatus(2);
+        String imageZipUrl = uploadService.saveImageZip(imageArr);
+        System.out.println(">>>>>>>>>>>>>>>>"+imageZipUrl);
+        image.setZipUrl(imageZipUrl);
         if (null == imageId) {
             image.setAuthUserId(authUserId);
             image.setCreateTime(new Date());
@@ -153,12 +172,12 @@ public class ImageServiceImpl implements ImageService {
     }
 
     @Override
-    public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageName, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageTitle, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxImageListVo> wxImageList = imageMapper.getWxImageList(authUserId, imageName);
+        List<WxImageListVo> wxImageList = imageMapper.getWxImageList(authUserId, imageTitle);
         wxImageList.forEach(image->{
             List<String> imageList = imageMapper.getImageListByImageId(image.getImageId());
             image.setImageList(imageList);

+ 35 - 18
src/main/java/com/caimei/service/impl/LoginServiceImpl.java

@@ -8,7 +8,6 @@ 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;
@@ -44,48 +43,57 @@ public class LoginServiceImpl implements LoginService {
     private AuthMapper authMapper;
 
     @Override
-    public ResponseJson<WxClubUserVo> loginByAuthorization(String code) {
+    public ResponseJson<WxClubUserVo> loginByAuthorization(String code, String appId) {
+        if (StringUtils.isEmpty(code)) {
+            return ResponseJson.error("参数异常,请输入code", null);
+        }
+        if (StringUtils.isEmpty(code)) {
+            return ResponseJson.error("参数异常,请输入appId", null);
+        }
+        // 获取供应商公众号appId对应的appSecret
+        String appSecret = shopMapper.getAppSecretByAppId(appId);
+        if (StringUtils.isEmpty(appSecret)) {
+            return ResponseJson.error("参数异常,该公众号不存在", null);
+        }
         Map<String,String> infoMap;
         try {
-            infoMap = WxUtils.getAccessToken(code);
+            infoMap = WxUtils.getAccessToken(code, appId, appSecret);
         } catch (Exception e) {
             log.info("微信服务器异常", e);
-            return ResponseJson.error("微信服务器异常", null);
+            return ResponseJson.error(-1, "微信服务器异常", null);
+        }
+        if ("-1".equals(infoMap.get("code"))) {
+            return ResponseJson.error(infoMap.get("errmsg"), null);
         }
         //解析相应内容(转换成json对象)
         String openId = infoMap.get("openId");
         String accessToken = infoMap.get("accessToken");
+        log.info("微信授权,openId:>>>>>>>>>>>" + openId);
         WxClubUserVo clubUser = loginMapper.findClubUser(openId);
         if (null == clubUser) {
             clubUser = new WxClubUserVo();
             clubUser.setOpenId(openId);
             clubUser.setAccessToken(accessToken);
-            return ResponseJson.error("未绑定微信", clubUser);
+            return ResponseJson.error(-2, "未绑定微信", clubUser);
         }
         clubUser.setAccessToken(accessToken);
+        // 登录成功redis保存token
+        redisService.set(accessToken, openId, 60L * 60 * 4);
         return ResponseJson.success(clubUser);
     }
 
     @Override
-    public ResponseJson sendVerifyCode(Integer authUserId, String mobile) {
+    public ResponseJson sendVerifyCode(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;
-        }
+        String content = "欢迎登录上海品辉会员,您的短信验证码为:" + verifyCode + ",该验证码 5 分钟内有效,请勿泄漏于他人。";
+
         Boolean sendSms = SmsUtils.sendSms(11, mobile, content);
         if (!sendSms) {
             log.info("会员登录验证码发送失败,手机号>>>>" + mobile);
@@ -97,7 +105,7 @@ public class LoginServiceImpl implements LoginService {
 
 
     @Override
-    public ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId) throws Exception {
+    public ResponseJson<WxClubUserVo> loginByInvitationCode(String mobile, String verifyCode, String invitationCode, String accessToken, String openId, String appId) throws Exception {
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号", null);
         }
@@ -113,8 +121,11 @@ public class LoginServiceImpl implements LoginService {
         if (StringUtils.isEmpty(openId)) {
             return ResponseJson.error("参数异常,请输入openId", null);
         }
+        if (StringUtils.isEmpty(appId)) {
+            return ResponseJson.error("参数异常,请输入appId", null);
+        }
         // 校验验证码是否正确
-        String redisVerifyCode = redisService.get("code:" + mobile).toString();
+        String redisVerifyCode = null == redisService.get("code:" + mobile) ? null : redisService.get("code:" + mobile).toString();
         if (!verifyCode.equals(redisVerifyCode)) {
             return ResponseJson.error("验证码错误,请重新输入", null);
         }
@@ -129,6 +140,10 @@ public class LoginServiceImpl implements LoginService {
         if (1 != clubPo.getStatus() || 1 != shopStatus) {
             return ResponseJson.error("登录失败", null);
         }
+        String dbAppId = shopMapper.getAppId(clubPo.getAuthUserId());
+        if (StringUtils.isEmpty(dbAppId) || !appId.equals(dbAppId)) {
+            return ResponseJson.error("登录失败", null);
+        }
         Map<String, String> userInfo = WxUtils.getUserInfo(accessToken, openId);
         String nickName = userInfo.get("nickName");
         loginMapper.bindClubUser(mobile, nickName, openId, invitationCode);
@@ -139,6 +154,8 @@ public class LoginServiceImpl implements LoginService {
         clubUser.setMobile(mobile);
         clubUser.setOpenId(openId);
         clubUser.setAccessToken(accessToken);
+        // 登录成功redis保存token
+        redisService.set(accessToken, openId, 60L * 60 * 4);
         return ResponseJson.success(clubUser);
     }
 }

+ 35 - 7
src/main/java/com/caimei/service/impl/SDKServiceImpl.java

@@ -1,5 +1,7 @@
 package com.caimei.service.impl;
 
+import com.caimei.components.RedisService;
+import com.caimei.mapper.ShopMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.service.SDKService;
 import com.caimei.utils.CodeUtil;
@@ -7,8 +9,10 @@ import com.caimei.utils.SHA1;
 import com.caimei.utils.WxUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -21,23 +25,47 @@ import java.util.Map;
 @Slf4j
 @Service
 public class SDKServiceImpl implements SDKService {
+    @Resource
+    private ShopMapper shopMapper;
+
+    private RedisService redisService;
+
+    @Autowired
+    public void setRedisService(RedisService redisService) {
+        this.redisService = redisService;
+    }
 
     @Override
-    public ResponseJson<Map<String, String>> getConfigData(String appId, String appSecret, String url) throws Exception {
+    public ResponseJson<Map<String, String>> getConfigData(String appId, String url) throws Exception {
         if (StringUtils.isEmpty(appId)) {
             return ResponseJson.error("参数异常,请输入appId", null);
         }
-        if (StringUtils.isEmpty(appSecret)) {
-            return ResponseJson.error("参数异常,请输入appSecret", null);
-        }
         if (StringUtils.isEmpty(url)) {
             return ResponseJson.error("参数异常,请输入url", null);
         }
+        // 获取供应商公众号appId对应的appSecret
+        String appSecret = shopMapper.getAppSecretByAppId(appId);
+        if (StringUtils.isEmpty(appSecret)) {
+            return ResponseJson.error("参数异常,该公众号不存在", null);
+        }
         // 获取accessToken
-        String accessToken = WxUtils.getAccessToken(appId, appSecret);
+        String accessToken = null == redisService.get("token:" + appId) ? null : String.valueOf(redisService.get("token:" + appId));
+        if (StringUtils.isEmpty(accessToken)) {
+            Map<String,String> tokenMap = WxUtils.getAccessToken(appId, appSecret);
+            if ("-1".equals(tokenMap.get("code"))) {
+                return ResponseJson.error(tokenMap.get("errmsg"), null);
+            }
+            accessToken = tokenMap.get("accessToken");
+        }
         // 获取jsapiTicket
-        Map<String, String> ticketMap = WxUtils.getJsapiTicket(accessToken);
-        String ticket = ticketMap.get("ticket");
+        String ticket = null == redisService.get("ticket:" + appId) ? null : String.valueOf(redisService.get("ticket:" + appId));
+        if (StringUtils.isEmpty(ticket)) {
+            Map<String, String> ticketMap = WxUtils.getJsapiTicket(appId,accessToken);
+            if ("-1".equals(ticketMap.get("code"))) {
+                return ResponseJson.error(ticketMap.get("errmsg"), null);
+            }
+            ticket = ticketMap.get("ticket");
+        }
         // 生成noncestr(随机字符串)和timestamp(时间戳)
         String noncestr = CodeUtil.getRandomCharAndNumr(8);
         String timestamp = String.valueOf(System.currentTimeMillis() / 1000);

+ 17 - 5
src/main/java/com/caimei/service/impl/ShopServiceImpl.java

@@ -187,12 +187,13 @@ public class ShopServiceImpl implements ShopService {
     }
 
     @Override
-    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, Integer createBy, List<ShopInfoDto> shopInfoList) {
+    public ResponseJson saveShop(Integer authUserId, Integer shopType, String shopName, String mobile, String linkMan, Integer shopStatus, String qrCodeImage, String appId, String appSecret, Integer createBy, List<ShopInfoDto> shopInfoList) {
         // 是否为添加操作
         boolean insertFlag = null == authUserId;
+        Integer userIdByMobile = shopMapper.getUserIdByMobile(mobile);
+        Integer userIdByAppId = shopMapper.getUserIdByAppId(appId);
         if (insertFlag) {
             // 添加时验证手机号是否已被使用
-            Integer userIdByMobile = shopMapper.getUserIdByMobile(mobile);
             if (null != userIdByMobile) {
                 return ResponseJson.error("该手机号已被使用,请重新输入", null);
             }
@@ -201,12 +202,19 @@ public class ShopServiceImpl implements ShopService {
             if (null != userIdByShopName) {
                 return ResponseJson.error("该供应商名称已经存在,请重新输入", null);
             }
+            // 添加时验证appId是否已被使用
+            if (null != userIdByAppId) {
+                return ResponseJson.error("该appId已被使用,请重新输入", null);
+            }
         } else {
             // 修改时验证新手机号是否已被使用
-            Integer userIdByMobile = shopMapper.getUserIdByMobile(mobile);
             if (null != userIdByMobile && !userIdByMobile.equals(authUserId)) {
                 return ResponseJson.error("该手机号已被使用,请重新输入", null);
             }
+            // 修改时验证新appId是否已被使用
+            if (null != userIdByAppId && !userIdByAppId.equals(authUserId)) {
+                return ResponseJson.error("该appId已被使用,请重新输入", null);
+            }
         }
         // 更新品牌授权logo
         shopInfoList.forEach(shopInfo->{
@@ -226,6 +234,10 @@ public class ShopServiceImpl implements ShopService {
         shop.setStatus(shopStatus);
         // 公众号二维码图片
         shop.setQrCodeImage(qrCodeImage);
+        // 公众号appId
+        shop.setAppId(appId);
+        // 公众号appSecret
+        shop.setAppSecret(appSecret);
         if (insertFlag) {
             // 用户身份:1管理员,2供应商
             shop.setUserIdentity(2);
@@ -357,12 +369,12 @@ public class ShopServiceImpl implements ShopService {
     }
 
     @Override
-    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, String clubName, String mobile, Integer handleStatus, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,请输入供应商用户id", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<FeedbackVo> feedbackList = shopMapper.getFeedbackList(authUserId);
+        List<FeedbackVo> feedbackList = shopMapper.getFeedbackList(authUserId, clubName, mobile, handleStatus);
         PageInfo<FeedbackVo> pageData = new PageInfo<>(feedbackList);
         return ResponseJson.success(pageData);
     }

+ 65 - 2
src/main/java/com/caimei/service/impl/UploadServiceImpl.java

@@ -1,16 +1,22 @@
 package com.caimei.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.caimei.config.FastDfsClient;
 import com.caimei.service.UploadService;
+import com.caimei.utils.OSSUtils;
 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.io.*;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
 import java.util.UUID;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
 
 /**
  * Description
@@ -28,6 +34,9 @@ public class UploadServiceImpl implements UploadService {
     @Value("${spring.profiles.active}")
     private String active;
 
+    @Value("${caimei.imageDomain}")
+    private String imageDomain;
+
     @Override
     public String saveFile(MultipartFile file) throws IOException {
         String originalFilename = file.getOriginalFilename();
@@ -45,4 +54,58 @@ public class UploadServiceImpl implements UploadService {
     }
 
 
+    @Override
+    public String saveImageZip(JSONArray imageArr) throws Exception {
+        String randomUUID = UUID.randomUUID().toString();
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/zplma/tempImage/";
+        if ("dev".equals(active)){
+            filePath = "D:\\uploadZip\\";
+        }
+        filePath += randomUUID + ".zip";
+        File zipFile = new File(filePath);
+        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
+        BufferedOutputStream bo = new BufferedOutputStream(out);
+        for (Object s : imageArr) {
+            String imageUrl = s.toString();
+            HttpURLConnection httpUrl = (HttpURLConnection) new URL(imageUrl).openConnection();
+            httpUrl.connect();
+            String imgRandomId = UUID.randomUUID().toString();
+            File image = inputStreamToFile(httpUrl.getInputStream(), imgRandomId + ".png");
+            out.putNextEntry(new ZipEntry(image.getName()));
+            FileInputStream in = new FileInputStream(image);
+            BufferedInputStream bi = new BufferedInputStream(in);
+            int b;
+            while ((b = bi.read()) != -1) {
+                bo.write(b);
+            }
+            bo.flush();
+            bi.close();
+            in.close();
+        }
+        bo.close();
+        out.close();
+        return imageDomain + "/" + client.uploadFile(filePath);
+    }
+
+
+    /**
+     *   工具类
+     * inputStream 转 File
+     */
+    public static File inputStreamToFile(InputStream ins, String name) throws Exception{
+        File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
+        if (file.exists()) {
+            return file;
+        }
+        OutputStream os = new FileOutputStream(file);
+        int bytesRead;
+        int len = 8192;
+        byte[] buffer = new byte[len];
+        while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
+            os.write(buffer, 0, bytesRead);
+        }
+        os.close();
+        ins.close();
+        return file;
+    }
 }

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

@@ -155,12 +155,12 @@ public class VideoServiceImpl implements VideoService {
     }
 
     @Override
-    public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoName, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoTitle, Integer pageNum, Integer pageSize) {
         if (null == authUserId) {
             return ResponseJson.error("参数异常,供应商用户id不能为空", null);
         }
         PageHelper.startPage(pageNum, pageSize);
-        List<WxVideoListVo> videoList = videoMapper.getWxVideoList(authUserId, videoName);
+        List<WxVideoListVo> videoList = videoMapper.getWxVideoList(authUserId, videoTitle);
         PageInfo<WxVideoListVo> pageData = new PageInfo<>(videoList);
         return ResponseJson.success(pageData);
     }

+ 11 - 4
src/main/java/com/caimei/utils/OSSUtils.java

@@ -1,16 +1,16 @@
 package com.caimei.utils;
 
+import com.aliyun.oss.HttpMethod;
 import com.aliyun.oss.OSS;
 import com.aliyun.oss.OSSClientBuilder;
-import com.aliyun.oss.model.GetObjectRequest;
-import com.aliyun.oss.model.ObjectMetadata;
-import com.aliyun.oss.model.UploadFileRequest;
+import com.aliyun.oss.model.*;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.URL;
 import java.util.Date;
 import java.util.UUID;
 
@@ -56,6 +56,7 @@ public class OSSUtils {
         try {
             OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
             ObjectMetadata meta = new ObjectMetadata();
+            meta.setObjectAcl(CannedAccessControlList.PublicRead);
             meta.setContentType(contentType);
             fileName = active + "/authFile/" + fileName;
             UploadFileRequest uploadFileRequest = new UploadFileRequest(privateBucket, fileName);
@@ -74,8 +75,14 @@ public class OSSUtils {
             //uploadFileRequest.setCallback("<yourCallbackEvent>");
             // 断点续传上传。
             ossClient.uploadFile(uploadFileRequest);
-            Date expiration = new Date(System.currentTimeMillis() + 3600L * 1000);
+            // 有效期100年
+            Date expiration = new Date(System.currentTimeMillis() + 60L * 60 * 24 * 365 * 100 * 1000);
             url = ossClient.generatePresignedUrl(privateBucket, fileName, expiration).toString();
+            /*GeneratePresignedUrlRequest request =
+                    new GeneratePresignedUrlRequest(privateBucket, fileName, HttpMethod.PUT);//设置为这个URL只支持PUT操作
+            request.setExpiration(expiration);
+            request.setContentType("application/octet-stream");
+            url = ossClient.generatePresignedUrl(request).toString();*/
             // 关闭OSSClient。
             ossClient.shutdown();
         } catch (Throwable e) {

+ 10 - 2
src/main/java/com/caimei/utils/SmsUtils.java

@@ -20,13 +20,21 @@ import java.util.regex.Pattern;
  * @date   2021/7/16
  */
 @Slf4j
+@Component
 public class SmsUtils {
 
-    @Value("${spring.profiles.active}")
     private static String active;
 
-    @Value("${caimei.core}")
+    @Value("${spring.profiles.active}")
+    public void setActive(String active) {
+        SmsUtils.active = active;
+    }
+
     private static String core;
+    @Value("${caimei.core}")
+    public void setCore(String core) {
+        SmsUtils.core = core;
+    }
 
     public static Boolean sendSms(int martId, String mobile, String content) {
         try {

+ 68 - 31
src/main/java/com/caimei/utils/WxUtils.java

@@ -2,42 +2,62 @@ package com.caimei.utils;
 
 
 import com.alibaba.fastjson.JSONObject;
-import com.aliyun.opensearch.sdk.dependencies.org.apache.http.client.HttpClient;
-import com.aliyun.opensearch.sdk.dependencies.org.apache.http.client.ResponseHandler;
-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 com.caimei.components.RedisService;
+import com.caimei.model.ResponseJson;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
  * @author Aslee
  * @date   2021/7/14
  */
+@Component
+@Slf4j
 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;
+    private static RedisService redisService;
+
+    @Autowired
+    public void setRedisService(RedisService redisService1) {
+        redisService = redisService1;
+    }
+
     /**
      * 获取accessToken(公众号配置数据)
      * @param appId         公众号appId
      * @param appSecret     公众号appSecret
      * @return
      */
-	public static String getAccessToken(String appId,String appSecret) throws Exception {
-		String requestUrl = GET_TOKEN_URL.replace("APPID", appId).replace("SECRET", appSecret);
+	public static Map<String,String> getAccessToken(String appId,String appSecret) throws Exception {
+        Map<String, String> result = new HashMap<>(5);
+        String requestUrl = GET_TOKEN_URL.replace("APPID", appId).replace("SECRET", appSecret);
         String response = HttpRequest.sendGet(requestUrl);
-        JSONObject tokenJson = JSONObject.parseObject(response);
-        return String.valueOf(tokenJson.get("access_token"));
+        JSONObject json = JSONObject.parseObject(response);
+        String errcode = String.valueOf(json.get("errcode"));
+        String errmsg = String.valueOf(json.get("errmsg"));
+        if (StringUtils.isNotEmpty(errcode) && !"null".equals(errcode)) {
+            result.put("code", "-1");
+            result.put("errmsg", errmsg);
+            log.info("获取accessToken异常,错误信息:>>>>>>>" + errmsg);
+            return result;
+        }
+        String accessToken = String.valueOf(json.get("access_token"));
+        String expiresIn = String.valueOf(json.get("expires_in"));
+        result.put("code", "0");
+        result.put("accessToken", accessToken);
+        // accessToken有效时长:2小时
+        redisService.set("token:" + appId, accessToken, Long.valueOf(expiresIn));
+        return result;
 	}
 
     /**
@@ -45,37 +65,54 @@ public class WxUtils {
      * @param accessToken   accessToken
      * @return
      */
-	public static Map<String,String> getJsapiTicket(String accessToken) throws Exception {
+	public static Map<String,String> getJsapiTicket(String appId, String accessToken) throws Exception {
         String requestUrl = GET_TICKET_URL.replace("ACCESS_TOKEN", accessToken);
         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);
+        JSONObject json = JSONObject.parseObject(response);
+        String errcode = String.valueOf(json.get("errcode"));
+        String errmsg = String.valueOf(json.get("errmsg"));
+        if (StringUtils.isNotEmpty(errcode) && !"null".equals(errcode) && !"0".equals(errcode)) {
+            result.put("code", "-1");
+            result.put("errmsg", errmsg);
+            log.info("获取ticket异常,错误信息:>>>>>>>" + errmsg);
+            return result;
+        }
+        String ticket = String.valueOf(json.get("ticket"));
+        String expiresIn = String.valueOf(json.get("expires_in"));
+        // ticket:2小时
+        redisService.set("ticket:" + appId, ticket, Long.valueOf(expiresIn));
+        result.put("code", "0");
         result.put("ticket", ticket);
-        result.put("expiresIn", expiresIn);
         return result;
     }
 
     /**
      * 获取accessToken(用户授权)
      * @param code         公众号appId
+     * @param appId
+     * @param appSecret
      * @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);
+    public static Map<String,String> getAccessToken(String code, String appId, String appSecret) 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"));
+        JSONObject json = JSONObject.parseObject(response);
+        String errcode = String.valueOf(json.get("errcode"));
+        String errmsg = String.valueOf(json.get("errmsg"));
+        if (StringUtils.isNotEmpty(errcode) && !"null".equals(errcode)) {
+            result.put("code", "-1");
+            result.put("errmsg", errmsg);
+            log.info("用户授权异常,错误信息:>>>>>>>" + errmsg);
+            return result;
+        }
+        String accessToken = String.valueOf(json.get("access_token"));
+        String refreshToken = String.valueOf(json.get("refresh_token"));
+        String openId = String.valueOf(json.get("openid"));
+        String expiresIn = String.valueOf(json.get("expires_in"));
+        String scope = String.valueOf(json.get("scope"));
+        result.put("code", "0");
         result.put("accessToken", accessToken);
         result.put("refreshToken", refreshToken);
         result.put("openId", openId);

+ 8 - 13
src/main/java/com/caimei/wxController/LoginApi.java

@@ -35,32 +35,26 @@ public class LoginApi {
     private final LoginService loginService;
 
     @ApiOperation("公众号授权登录")
-    @ApiImplicitParam(name = "params", value = "code登录凭证", required = true)
+    @ApiImplicitParam(name = "params", value = "code登录凭证;appId;", 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);
+        String appId = parseObject.getString("appId");
+        return loginService.loginByAuthorization(code, appId);
     }
 
     @ApiOperation("登录验证码发送")
-    @ApiImplicitParam(name = "params", value = "mobile:手机号;authUserId:供应商用户id", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号", 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);
+        return loginService.sendVerifyCode(mobile);
     }
 
-    /**
-     * 邀请码登录
-     */
     @ApiOperation("邀请码登录")
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;invitationCode:邀请码;accessToken;openId;appId", required = true)
     @PostMapping("/login/invitation/code")
     public ResponseJson<WxClubUserVo> invitationCode(@RequestBody String params) throws Exception {
         JSONObject parseObject = JSONObject.parseObject(params);
@@ -69,6 +63,7 @@ public class LoginApi {
         String invitationCode = parseObject.getString("invitationCode");
         String accessToken = parseObject.getString("accessToken");
         String openId = parseObject.getString("openId");
-        return loginService.loginByInvitationCode(mobile, verifyCode, invitationCode, accessToken, openId);
+        String appId = parseObject.getString("appId");
+        return loginService.loginByInvitationCode(mobile, verifyCode, invitationCode, accessToken, openId, appId);
     }
 }

+ 2 - 3
src/main/java/com/caimei/wxController/SDKApi.java

@@ -26,12 +26,11 @@ public class SDKApi {
     @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) throws Exception {
-        return sdkService.getConfigData(appId, appSecret, url);
+    public ResponseJson<Map<String, String>> getConfigData(String appId, String url) throws Exception {
+        return sdkService.getConfigData(appId, url);
     }
 
 }

+ 14 - 14
src/main/java/com/caimei/wxController/WxDataApi.java

@@ -31,15 +31,15 @@ public class WxDataApi {
     @ApiOperation("资料库文章列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
-            @ApiImplicitParam(name = "articleName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "articleTitle", 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,
+    public ResponseJson<PageInfo<WxArticleListVo>> getWxArticleList(Integer authUserId, String articleTitle,
                                                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                     @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return articleService.getWxArticleList(authUserId, articleName, pageNum, pageSize);
+        return articleService.getWxArticleList(authUserId, articleTitle, pageNum, pageSize);
     }
 
     @ApiOperation("资料库文章回显数据")
@@ -52,49 +52,49 @@ public class WxDataApi {
     @ApiOperation("资料库图片列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
-            @ApiImplicitParam(name = "imageName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "imageTitle", 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,
+    public ResponseJson<PageInfo<WxImageListVo>> getWxImageList(Integer authUserId, String imageTitle,
                                                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return imageService.getWxImageList(authUserId, imageName, pageNum, pageSize);
+        return imageService.getWxImageList(authUserId, imageTitle, pageNum, pageSize);
     }
 
     @ApiOperation("资料库视频列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
-            @ApiImplicitParam(name = "videoName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "videoTitle", 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,
+    public ResponseJson<PageInfo<WxVideoListVo>> getWxVideoList(Integer authUserId, String videoTitle,
                                                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return videoService.getWxVideoList(authUserId, videoName, pageNum, pageSize);
+        return videoService.getWxVideoList(authUserId, videoTitle, pageNum, pageSize);
     }
 
     @ApiOperation("资料库文件列表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
-            @ApiImplicitParam(name = "fileName", required = false, value = "文章名称"),
+            @ApiImplicitParam(name = "fileTitle", 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,
+    public ResponseJson<PageInfo<WxFileListVo>> getWxFileList(Integer authUserId, String fileTitle,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
-        return fileService.getWxFileList(authUserId, fileName, pageNum, pageSize);
+        return fileService.getWxFileList(authUserId, fileTitle, pageNum, pageSize);
     }
 
 
     @ApiOperation("提交意见反馈")
-    @ApiImplicitParam(name = "params", required = true, value = "供应商用户id")
-    @GetMapping("/feedback/submit")
+    @ApiImplicitParam(name = "params", required = true, value = "clubUserId:机构用户id;content:反馈内容")
+    @PostMapping("/feedback/submit")
     public ResponseJson submitFeedback(@RequestBody String params) {
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer clubUserId = paramsMap.getInteger("clubUserId");

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

@@ -137,6 +137,7 @@ CREATE TABLE `cm_brand_image` (
                                        `id` INT NOT NULL AUTO_INCREMENT,
                                        `authUserId` INT NULL COMMENT '供应商用户id',
                                        `title` VARCHAR(50) NULL COMMENT '图片标题',
+                                       `zipUrl` TEXT NULL COMMENT '图片压缩包链接',
                                        `status` INT NULL COMMENT '上线状态:0已下线,1已上线,2待上线',
                                        `createTime` DATETIME NULL COMMENT '创建时间',
                                        `auditStatus` INT NULL COMMENT '审核状态:0审核未通过,1审核通过,2待审核',
@@ -193,6 +194,11 @@ CREATE TABLE `cm_brand_club_feedback` (
     COMMENT = '机构意见反馈表';
 
 ALTER TABLE `cm_brand_auth_user`
-    ADD COLUMN `qrCodeImage` TEXT NULL COMMENT '公众号二维码' AFTER `shopType`;
+    ADD COLUMN `qrCodeImage` TEXT NULL COMMENT '公众号二维码' AFTER `shopType`,
+    ADD COLUMN `appId` VARCHAR(45) NULL COMMENT '供应商公众号appId' AFTER `qrCodeImage`,
+    ADD COLUMN `appSecret` VARCHAR(45) NULL COMMENT '供应商公众号appSecret' AFTER `appId`;
+
+
+insert into weixin.menu_tree (`id`,`parentId`,`parentIds`,`name`,`sort`,`wxType`) values (4,0,'0,','上海品辉公众号','10','gh_j3jf92jladsl');
 # ==================================正品联盟7月优化end===============================================
 

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

@@ -63,7 +63,9 @@ caimei:
   #图片服务器
   imageDomain: https://img-b.caimei365.com
   core: https://core-b.caimei365.com
-
+  #公众号
+  appid: wx6512b1dfb84c28e1
+  secret: 10f94918f59f630351319382bb29cab1
 
 #DFS配置
 fdfs:

+ 1 - 1
src/main/resources/config/dev/application-dev.yml

@@ -56,7 +56,7 @@ swagger:
 # 新旧www服务域名
 caimei:
   oldapi: http://localhost:8100
-  zplmapi: http://localhost:8012
+  zplmapi: http://192.168.2.68:8012
   #图片服务器
   imageDomain: http://192.168.2.100
   core: https://core-b.caimei365.com

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

@@ -57,14 +57,19 @@
         </choose>
     </select>
     <select id="getArticleForm" resultType="com.caimei.model.vo.ArticleFormVo">
-        select id as articleId, title as articleTitle, image as articleImage, content as articleContent
+        select id as articleId, title as articleTitle, image as articleImage, content as articleContent, createTime
         from cm_brand_article
-        where id = #{articleId} and status = 1
+        where id = #{articleId}
     </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')
+        select id as articleId, title as articleTitle, image as articleImage, date_format(createTime, '%Y-%m-%d') as
+        createTime
         from cm_brand_article
         where authUserId = #{authUserId}
         and status = 1
+        <if test="articleTitle != null and articleTitle != ''">
+            and title like concat('%',#{articleTitle},'%')
+        </if>
+        order by createTime desc
     </select>
 </mapper>

+ 4 - 3
src/main/resources/mapper/ClubMapper.xml

@@ -7,8 +7,8 @@
         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 into cm_brand_club_feedback(clubUserId, content, commitTime, handleStatus)
+        values (#{clubUserId}, #{content}, NOW(), 0)
     </insert>
     <update id="unbindClubUser">
         update cm_brand_club_user set delFlag = 1 where id = #{clubUserId}
@@ -41,6 +41,7 @@
         openId
         from cm_brand_club_user
         where authId = #{authId}
+        and delFlag = 0
         <if test="mobile != null and mobile != ''">
             and mobile like concat('%',#{mobile},'%')
         </if>
@@ -68,7 +69,7 @@
         where authUserId = #{authUserId}
         and status = 1
         <if test="clubName != null and clubName != ''">
-            authParty like concat('%',#{clubName},'%')
+            and authParty like concat('%',#{clubName},'%')
         </if>
     </select>
     <select id="checkMobile" resultType="java.lang.Integer">

+ 6 - 2
src/main/resources/mapper/FileMapper.xml

@@ -73,9 +73,13 @@
         </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')
+        select id as fileId, title as fileTitle, url as fileUrl, date_format(createTime, '%Y-%m-%d') as createTime
         from cm_brand_file
         where authUserId = #{authUserId}
-          and status = 1
+        and status = 1
+        <if test="fileTitle != null and fileTitle != ''">
+            and title like concat('%',#{fileTitle},'%')
+        </if>
+        order by createTime desc
     </select>
 </mapper>

+ 10 - 4
src/main/resources/mapper/ImageMapper.xml

@@ -2,8 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.mapper.ImageMapper">
     <insert id="insertImage" keyColumn="id" keyProperty="id" parameterType="com.caimei.model.po.ImagePo" useGeneratedKeys="true">
-        insert into cm_brand_image(authUserId, title, auditStatus, status, createTime)
-        values (#{authUserId}, #{title}, #{auditStatus}, #{status}, #{createTime})
+        insert into cm_brand_image(authUserId, title, zipUrl, auditStatus, status, createTime)
+        values (#{authUserId}, #{title}, #{zipUrl}, #{auditStatus}, #{status}, #{createTime})
     </insert>
     <insert id="insertImageDetail">
         insert into cm_brand_image_detail(imageId, image)
@@ -12,6 +12,7 @@
     <update id="updateImageByImageId">
         update cm_brand_image
         set title       = #{title},
+            zipUrl      = #{zipUrl},
             status      = #{status},
             auditStatus = #{auditStatus}
         where id = #{id}
@@ -68,9 +69,14 @@
         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')
+        select id as imageId, title as imageTitle, zipUrl as imageZipUrl, date_format(createTime, '%Y-%m-%d') as
+        createTime
         from cm_brand_image
         where authUserId = #{authUserId}
-          and status = 1
+        and status = 1
+        <if test="imageTitle != null and imageTitle != ''">
+            and title like concat('%',#{imageTitle},'%')
+        </if>
+        order by createTime desc
     </select>
 </mapper>

+ 5 - 4
src/main/resources/mapper/LoginMapper.xml

@@ -3,10 +3,11 @@
 <mapper namespace="com.caimei.mapper.LoginMapper">
     <update id="bindClubUser">
         update cm_brand_club_user
-        set mobile   = #{mobile},
+        set status   = 1,
+            mobile   = #{mobile},
             openId   = #{openId},
             nickName = #{nickName},
-            bindTime =NOW()
+            bindTime = NOW()
         where invitationCode = #{invitationCode};
     </update>
 
@@ -14,14 +15,14 @@
         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
+                 left join cm_brand_auth_user au on a.authUserId = 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
+        select id, authId, status, invitationCodeTime
         from cm_brand_club_user
         where invitationCode = #{invitationCode} and delFlag = 0
     </select>

+ 29 - 8
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`, `qrCodeImage`, `createTime`,
+        insert into cm_brand_auth_user (`name`, `mobile`, `password`, `linkMan`, `userIdentity`, `shopType`, `qrCodeImage`, `appId`, `appSecret`, `createTime`,
                                         `createBy`,`status`)
-        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{qrCodeImage}, #{createTime}, #{createBy}, #{status});
+        values (#{name}, #{mobile}, #{password}, #{linkMan}, #{userIdentity}, #{shopType}, #{qrCodeImage}, #{appId}, #{appSecret}, #{createTime}, #{createBy}, #{status});
     </insert>
     <insert id="insertShopInfo">
         insert into cm_brand_auth_shop_info
@@ -63,7 +63,9 @@
         set `mobile`      = #{mobile},
             `linkMan`     = #{linkMan},
             `status`      = #{status},
-            `qrCodeImage` = #{qrCodeImage}
+            `qrCodeImage` = #{qrCodeImage},
+            `appId`       = #{appId},
+            `appSecret`   = #{appSecret}
         where authUserId = #{authUserId}
     </update>
     <update id="updateShopInfo">
@@ -168,7 +170,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, u.qrCodeImage
+        select u.authUserId, u.name as shopName, u.mobile, u.linkMan, u.status as shopStatus, u.shopType as shopType, u.qrCodeImage, u.appId, u.appSecret
         from cm_brand_auth_user u
         where u.authUserId = #{authUserId};
     </select>
@@ -241,23 +243,42 @@
         where a.authUserId = #{authUserId} and p.brandId = #{brandId}
     </select>
     <select id="getFeedbackList" resultType="com.caimei.model.vo.FeedbackVo">
-        select cf.id as feedbackId, a.authParty as clubName, cu.mobile, content, commitTime, handleStatus, handleResult, handleTime
+        select cf.id as feedbackId, a.authParty as clubName, cu.mobile, content, commitTime, handleStatus, handleResult,
+        handleTime
         from cm_brand_club_feedback cf
-            join cm_brand_club_user cu on cf.clubUserId = cu.id
-            join cm_brand_auth a on cu.authId = a.id
+        join cm_brand_club_user cu on cf.clubUserId = cu.id
+        join cm_brand_auth a on cu.authId = a.id
         where a.authUserId = #{authUserId}
+        <if test="clubName != null and clubName != ''">
+            and a.authParty like concat('%',#{clubName},'%')
+        </if>
+        <if test="mobile != null and mobile != ''">
+            and cu.mobile like concat('%',#{mobile},'%')
+        </if>
+        <if test="handleStatus != null">
+            and cf.handleStatus = #{handleStatus}
+        </if>
     </select>
     <select id="getFeedback" resultType="com.caimei.model.vo.FeedbackVo">
         select cf.id as feedbackId, a.authParty as clubName, cu.mobile, content, commitTime, handleStatus, handleResult, handleTime
         from cm_brand_club_feedback cf
                  join cm_brand_club_user cu on cf.clubUserId = cu.id
                  join cm_brand_auth a on cu.authId = a.id
-        where a.authUserId = #{authUserId}
+        where cf.id = #{feedbackId}
     </select>
     <select id="getShopStatus" resultType="java.lang.Integer">
         select status
         from cm_brand_auth_user
         where authUserId = #{authUserId}
     </select>
+    <select id="getUserIdByAppId" resultType="java.lang.Integer">
+        select authUserId from cm_brand_auth_user where mobile = #{mobile} and userIdentity = 2 and appId is not null limit 1
+    </select>
+    <select id="getAppSecretByAppId" resultType="java.lang.String">
+        select appSecret from cm_brand_auth_user where appId = #{appId} and status = 1
+    </select>
+    <select id="getAppId" resultType="java.lang.String">
+        select appId from cm_brand_auth_user where authUserId = #{authUserId} and status = 1
+    </select>
 
 </mapper>

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

@@ -73,9 +73,13 @@
         </choose>
     </select>
     <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')
+        select id as videoId, title as videoTitle, url as videoUrl, date_format(createTime, '%Y-%m-%d') as createTime
         from cm_brand_video
         where authUserId = #{authUserId}
-          and status = 1
+        and status = 1
+        <if test="videoTitle != null and videoTitle != ''">
+            and title like concat('%',#{videoTitle},'%')
+        </if>
+        order by createTime desc
     </select>
 </mapper>

+ 2 - 5
src/test/java/com/caimei/AdminApplicationTests.java

@@ -46,11 +46,8 @@ public class AdminApplicationTests {
 
     @Test
     public void generateStr(){
-        String s = "";
-        for (int i = 0; i < 40000; i++) {
-            s += "阿Q阿Q阿Q阿Q阿Q";
-        }
-        System.out.println(s);
+        String s = null;
+        s.toString();
     }