Browse Source

供应商权限管理part2

Aslee 2 years ago
parent
commit
bd7716a27c
29 changed files with 579 additions and 138 deletions
  1. 2 0
      src/main/java/com/caimei/AdminApplication.java
  2. 16 0
      src/main/java/com/caimei/annotation/CurrentUser.java
  3. 63 0
      src/main/java/com/caimei/annotation/CurrentUserResolver.java
  4. 21 0
      src/main/java/com/caimei/annotation/WebConfig.java
  5. 68 5
      src/main/java/com/caimei/config/ArgumentFilter.java
  6. 11 4
      src/main/java/com/caimei/config/FilterConfig.java
  7. 50 12
      src/main/java/com/caimei/controller/admin/auth/AuthApi.java
  8. 33 10
      src/main/java/com/caimei/controller/admin/auth/AuthClubApi.java
  9. 29 12
      src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java
  10. 24 7
      src/main/java/com/caimei/controller/admin/auth/AuthTemplateApi.java
  11. 26 5
      src/main/java/com/caimei/controller/admin/auth/DoctorApi.java
  12. 85 13
      src/main/java/com/caimei/controller/admin/auth/ShopApi.java
  13. 20 5
      src/main/java/com/caimei/controller/admin/data/ArticleApi.java
  14. 20 5
      src/main/java/com/caimei/controller/admin/data/FileApi.java
  15. 20 5
      src/main/java/com/caimei/controller/admin/data/ImageApi.java
  16. 19 4
      src/main/java/com/caimei/controller/admin/data/VideoApi.java
  17. 10 1
      src/main/java/com/caimei/controller/admin/sys/SysMenuApi.java
  18. 9 1
      src/main/java/com/caimei/controller/admin/sys/SysRoleApi.java
  19. 17 2
      src/main/java/com/caimei/controller/admin/sys/SysUserApi.java
  20. 31 6
      src/main/java/com/caimei/controller/admin/vip/VipApi.java
  21. 0 3
      src/main/java/com/caimei/service/auth/impl/ArticleServiceImpl.java
  22. 0 3
      src/main/java/com/caimei/service/auth/impl/AuthClubServiceImpl.java
  23. 0 6
      src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java
  24. 0 9
      src/main/java/com/caimei/service/auth/impl/DoctorServiceImpl.java
  25. 0 9
      src/main/java/com/caimei/service/auth/impl/ShopServiceImpl.java
  26. 3 3
      src/main/java/com/caimei/service/auth/impl/UserServiceImpl.java
  27. 0 3
      src/main/java/com/caimei/service/data/impl/ImageServiceImpl.java
  28. 0 3
      src/main/java/com/caimei/service/data/impl/VideoServiceImpl.java
  29. 2 2
      src/main/java/com/caimei/utils/JwtUtil.java

+ 2 - 0
src/main/java/com/caimei/AdminApplication.java

@@ -4,6 +4,7 @@ import com.github.tobato.fastdfs.FdfsClientConfig;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.MultipartConfigFactory;
 import org.springframework.boot.web.servlet.MultipartConfigFactory;
+import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.EnableMBeanExport;
 import org.springframework.context.annotation.EnableMBeanExport;
 import org.springframework.context.annotation.Import;
 import org.springframework.context.annotation.Import;
@@ -21,6 +22,7 @@ import javax.servlet.MultipartConfigElement;
 @Import(FdfsClientConfig.class)
 @Import(FdfsClientConfig.class)
 // 解决jmx重复注册bean的问题
 // 解决jmx重复注册bean的问题
 @EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
 @EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
+@ServletComponentScan
 @SpringBootApplication
 @SpringBootApplication
 public class AdminApplication {
 public class AdminApplication {
 
 

+ 16 - 0
src/main/java/com/caimei/annotation/CurrentUser.java

@@ -0,0 +1,16 @@
+package com.caimei.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Aslee
+ * @date 2022/07/22
+ * 自定义注解:获取当前用户
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface CurrentUser {
+}

+ 63 - 0
src/main/java/com/caimei/annotation/CurrentUserResolver.java

@@ -0,0 +1,63 @@
+package com.caimei.annotation;
+
+import com.caimei.components.RedisService;
+import com.caimei.mapper.cmMapper.SystemMapper;
+import com.caimei.model.po.SysUser;
+import com.caimei.model.po.UserPo;
+import com.caimei.utils.JwtUtil;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.MethodParameter;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.support.WebDataBinderFactory;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.method.support.ModelAndViewContainer;
+
+import javax.annotation.Resource;
+
+/**
+ * @author Aslee
+ * @date 2022/7/22
+ * 统一处理供应商和供应商子用户登陆后,authUserId不明确的问题
+ */
+@Component
+public class CurrentUserResolver implements HandlerMethodArgumentResolver {
+
+    private RedisService redisService;
+    @Autowired
+    public void setRedisService(RedisService redisService) {
+        this.redisService = redisService;
+    }
+
+    @Resource
+    private SystemMapper systemMapper;
+
+    @Override
+    public boolean supportsParameter(MethodParameter parameter) {
+        return parameter.hasParameterAnnotation(CurrentUser.class) &&
+                parameter.getParameterType().isAssignableFrom(SysUser.class);
+    }
+
+    @Override
+    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer container,
+                                  NativeWebRequest request, WebDataBinderFactory factory) {
+        // header中获取用户token
+        String token = request.getHeader("X-Token");
+        String cacheToken = null!=token ? String.valueOf(redisService.get(token)) : null;
+        // Redis过期后会得到"null"值,所以需判断字符串"null"
+        if (cacheToken != null && cacheToken.length() != 0 && !"null".equals(cacheToken)) {
+            if (cacheToken.contains(",")) {
+                // 前端机构用户登录
+                String[] tokenArr = cacheToken.split(",");
+                Integer authUserId = Integer.parseInt(tokenArr[1]);
+                return systemMapper.getUser(authUserId);
+            } else {
+                // 后台管理员/供应商/供应商子用户登录
+                Integer authUserId = JwtUtil.parseTokenUid(cacheToken);
+                return systemMapper.getUser(authUserId);
+            }
+        }
+        return null;
+    }
+}

+ 21 - 0
src/main/java/com/caimei/annotation/WebConfig.java

@@ -0,0 +1,21 @@
+package com.caimei.annotation;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.method.support.HandlerMethodArgumentResolver;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+    @Resource
+    private CurrentUserResolver currentUserResolver;
+
+    @Override
+    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
+        argumentResolvers.add(currentUserResolver);
+    }
+
+}

+ 68 - 5
src/main/java/com/caimei/config/ArgumentFilter.java

@@ -1,16 +1,24 @@
 package com.caimei.config;
 package com.caimei.config;
 
 
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.twelvemonkeys.util.LinkedSet;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
+import org.springframework.util.StreamUtils;
 
 
 import javax.servlet.*;
 import javax.servlet.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.*;
 
 
 @Slf4j
 @Slf4j
-@Component
+//@Component
 public class ArgumentFilter implements Filter {
 public class ArgumentFilter implements Filter {
 
 
     @Override
     @Override
@@ -21,12 +29,67 @@ public class ArgumentFilter implements Filter {
         Integer userId = 123456;
         Integer userId = 123456;
         log.info("filter获取用户Id={}", userId);
         log.info("filter获取用户Id={}", userId);
         HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(httpRequest) {
         HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(httpRequest) {
+            /*@Override
+            public Enumeration<String> getParameterNames(){
+                Set<String> paramNames = new LinkedSet<>();
+                paramNames.add("authUserId");
+                Enumeration<String> parameterNames = super.getParameterNames();
+                if (parameterNames.hasMoreElements()) {
+                    paramNames.add(parameterNames.nextElement());
+                }
+                return Collections.enumeration(paramNames);
+            }
+
+            @Override
+            public String[] getParameterValues(String name){
+                if ("authUserId".equals(name)) {
+                    return new String[]{"123456"};
+                }
+                return super.getParameterValues(name);
+            }*/
+
             @Override
             @Override
-            public String getHeader(String name) {
-                if ("userId".equals(name)) {
-                    return userId + "";
+            public ServletInputStream getInputStream() {
+                byte[] requestBody = new byte[0];
+                try {
+                    //获取request的输入流,并设置格式为UTF-8
+                    BufferedReader streamReader = new BufferedReader(new InputStreamReader(request.getInputStream(), "UTF-8"));
+                    //将输入流数据放入StringBuilder
+                    StringBuilder stringBuilder = new StringBuilder();
+                    String inputStr = null;
+                    while ((inputStr = streamReader.readLine()) != null) {
+                        stringBuilder.append(inputStr);
+                    }
+                    Gson gson = new Gson();
+                    HashMap map = gson.fromJson(stringBuilder.toString(), HashMap.class);
+                    map.put("authUserId", "234567");
+                    requestBody = gson.toJson(map).getBytes();
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
                 }
-                return super.getHeader(name);
+
+                final ByteArrayInputStream bais = new ByteArrayInputStream(requestBody);
+                return new ServletInputStream() {
+                    @Override
+                    public boolean isFinished() {
+                        return false;
+                    }
+
+                    @Override
+                    public boolean isReady() {
+                        return true;
+                    }
+
+                    @Override
+                    public void setReadListener(ReadListener readListener) {
+
+                    }
+
+                    @Override
+                    public int read() {
+                        return bais.read();
+                    }
+                };
             }
             }
         };
         };
         filterChain.doFilter(requestWrapper, httpResponse);
         filterChain.doFilter(requestWrapper, httpResponse);

+ 11 - 4
src/main/java/com/caimei/config/FilterConfig.java

@@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.Filter;
 import javax.servlet.Filter;
 
 
-@Configuration
+//@Configuration
 public class FilterConfig {
 public class FilterConfig {
 
 
     @Resource
     @Resource
@@ -17,10 +17,17 @@ public class FilterConfig {
     public FilterRegistrationBean<Filter> registerAuthFilter() {
     public FilterRegistrationBean<Filter> registerAuthFilter() {
         FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
         FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<>();
         registration.setFilter(argumentFilter);
         registration.setFilter(argumentFilter);
-        registration.addUrlPatterns("/level2");
-        registration.setName("authFilter");
+        registration.addUrlPatterns("/auth/*");
+        registration.addUrlPatterns("/club/*");
+        registration.addUrlPatterns("/shop/*");
+        registration.addUrlPatterns("/user/update/password");
+        registration.addUrlPatterns("/data/*");
+        registration.addUrlPatterns("/sys/*");
+        registration.addUrlPatterns("/vip/*");
+        registration.addUrlPatterns("/auth/export/excel");
+        registration.setName("argumentFilter");
         // 值越小,Filter越靠前
         // 值越小,Filter越靠前
-        registration.setOrder(1);
+        registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
         return registration;
         return registration;
     }
     }
 }
 }

+ 50 - 12
src/main/java/com/caimei/controller/admin/auth/AuthApi.java

@@ -1,8 +1,10 @@
 package com.caimei.controller.admin.auth;
 package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CmBrandAuthPo;
 import com.caimei.model.po.CmBrandAuthPo;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.AuthFormVo;
 import com.caimei.model.vo.AuthFormVo;
 import com.caimei.model.vo.AuthVo;
 import com.caimei.model.vo.AuthVo;
 import com.caimei.service.auth.AuthService;
 import com.caimei.service.auth.AuthService;
@@ -17,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.ParseException;
@@ -46,7 +49,6 @@ public class AuthApi {
     @ApiOperation("授权列表")
     @ApiOperation("授权列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1授权列表,2授权审核列表,3供应商审核列表,4授权牌物流列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1授权列表,2授权审核列表,3供应商审核列表,4授权牌物流列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "authParty", required = false, value = "授权机构"),
             @ApiImplicitParam(name = "authParty", required = false, value = "授权机构"),
             @ApiImplicitParam(name = "mobile", required = false, value = "机构用户手机号"),
             @ApiImplicitParam(name = "mobile", required = false, value = "机构用户手机号"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),
@@ -58,20 +60,35 @@ public class AuthApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<AuthVo>> getAuthList(Integer listType, Integer authUserId, String authParty, String mobile,
+    public ResponseJson<PageInfo<AuthVo>> getAuthList(@CurrentUser SysUser sysUser, Integer listType, String authParty, String mobile,
                                                       Integer status, Integer auditStatus, Integer lowerAuditStatus,
                                                       Integer status, Integer auditStatus, Integer lowerAuditStatus,
                                                       Integer shopAuditStatus, Integer sendStatus,
                                                       Integer shopAuditStatus, Integer sendStatus,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return authService.getAuthList(listType, authUserId, authParty, mobile, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus, pageNum, pageSize);
         return authService.getAuthList(listType, authUserId, authParty, mobile, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("机构下拉框列表")
     @ApiOperation("机构下拉框列表")
     @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @GetMapping("/select")
     @GetMapping("/select")
-    public ResponseJson<List<AuthVo>> getAuthSelectList(Integer authUserId) {
+    public ResponseJson<List<AuthVo>> getAuthSelectList(@CurrentUser SysUser sysUser) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         return authService.getAuthSelectList(authUserId);
         return authService.getAuthSelectList(authUserId);
     }
     }
@@ -113,17 +130,25 @@ public class AuthApi {
      * 添加/编辑授权
      * 添加/编辑授权
      */
      */
     @ApiOperation("添加/编辑授权")
     @ApiOperation("添加/编辑授权")
-    @ApiImplicitParam(name = "params", value = "authId:授权id;authUserId:供应商用户id;authParty:授权机构;provinceId;cityId;" +
+    @ApiImplicitParam(name = "params", value = "authId:授权id;authParty:授权机构;provinceId;cityId;" +
             "townId;address;lngAndLat;mobile;userMobile:对应机构用户手机号;" +
             "townId;address;lngAndLat;mobile;userMobile:对应机构用户手机号;" +
             "firstClubType:一级分类为医美=1,生美=2,项目公司=3,个人=4,其他=5;" +
             "firstClubType:一级分类为医美=1,生美=2,项目公司=3,个人=4,其他=5;" +
             "secondClubType:医美的二级分类为诊所=1、门诊=2、医院=3,其他=4。生美二级分类,美容院=5,养生馆=6,其他=7;" +
             "secondClubType:医美的二级分类为诊所=1、门诊=2、医院=3,其他=4。生美二级分类,美容院=5,养生馆=6,其他=7;" +
             "medicalLicenseImage:医疗许可证图;empNum:员工人数;" +
             "medicalLicenseImage:医疗许可证图;empNum:员工人数;" +
             "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id;source:1供应商保存,2机构保存", required = true)
             "logo;customFlag:是否需要自定义属性:0否,1是;remarks:店铺备注;createBy:创建人id;source:1供应商保存,2机构保存", required = true)
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveAuth(@RequestBody String params) throws ParseException {
+    public ResponseJson saveAuth(@CurrentUser SysUser sysUser, @RequestBody String params) throws ParseException {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer authId = paramsMap.getInteger("authId");
         Integer authId = paramsMap.getInteger("authId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         Integer provinceId = paramsMap.getInteger("provinceId");
         Integer provinceId = paramsMap.getInteger("provinceId");
         Integer cityId = paramsMap.getInteger("cityId");
         Integer cityId = paramsMap.getInteger("cityId");
         Integer townId = paramsMap.getInteger("townId");
         Integer townId = paramsMap.getInteger("townId");
@@ -212,14 +237,19 @@ public class AuthApi {
 
 
     @ApiOperation("excel导入")
     @ApiOperation("excel导入")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "createBy", required = true, value = "创建人用户id"),
             @ApiImplicitParam(name = "createBy", required = true, value = "创建人用户id"),
             @ApiImplicitParam(name = "file", required = true, value = "机构excel表格"),
             @ApiImplicitParam(name = "file", required = true, value = "机构excel表格"),
     })
     })
     @PostMapping("/import/excel")
     @PostMapping("/import/excel")
-    public ResponseJson importDataByExcel(MultipartFile file, Integer authUserId, Integer createBy) {
+    public ResponseJson importDataByExcel(@CurrentUser SysUser sysUser, MultipartFile file, Integer createBy) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商id");
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         if (null == createBy) {
         if (null == createBy) {
             return ResponseJson.error("参数异常,请输入创建人id");
             return ResponseJson.error("参数异常,请输入创建人id");
@@ -231,9 +261,17 @@ public class AuthApi {
     }
     }
 
 
     @ApiOperation("ldm门店图/备注导入")
     @ApiOperation("ldm门店图/备注导入")
-    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @GetMapping("/ldm/image/import")
     @GetMapping("/ldm/image/import")
-    public ResponseJson importLdmImage(Integer authUserId) {
+    public ResponseJson importLdmImage(@CurrentUser SysUser sysUser) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return authService.importLdmImage(authUserId);
         return authService.importLdmImage(authUserId);
     }
     }
 
 

+ 33 - 10
src/main/java/com/caimei/controller/admin/auth/AuthClubApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.auth;
 package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.ClubUserVo;
 import com.caimei.model.vo.ClubUserVo;
 import com.caimei.model.vo.ClubVo;
 import com.caimei.model.vo.ClubVo;
 import com.caimei.service.auth.AuthClubService;
 import com.caimei.service.auth.AuthClubService;
@@ -35,15 +37,23 @@ public class AuthClubApi {
 
 
     @ApiOperation("机构列表")
     @ApiOperation("机构列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
             @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer authUserId, String clubName,
+    public ResponseJson<PageInfo<ClubVo>> getClubList(@CurrentUser SysUser sysUser, String clubName,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return authClubService.getClubList(authUserId, clubName, pageNum, pageSize);
         return authClubService.getClubList(authUserId, clubName, pageNum, pageSize);
     }
     }
 
 
@@ -51,30 +61,43 @@ public class AuthClubApi {
     @ApiOperation("机构用户列表")
     @ApiOperation("机构用户列表")
     @GetMapping("/user/list")
     @GetMapping("/user/list")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "name", required = false, value = "姓名"),
             @ApiImplicitParam(name = "name", required = false, value = "姓名"),
             @ApiImplicitParam(name = "status", required = false, value = "状态:0停用,1启用"),
             @ApiImplicitParam(name = "status", required = false, value = "状态:0停用,1启用"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
-    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authUserId, String mobile, String name, Integer status,
+    public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(@CurrentUser SysUser sysUser, String mobile, String name, Integer status,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return authClubService.getClubUserList(authUserId, mobile, name, status, pageNum, pageSize);
         return authClubService.getClubUserList(authUserId, mobile, name, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("添加/编辑机构用户")
     @ApiOperation("添加/编辑机构用户")
     @PostMapping("/user/save")
     @PostMapping("/user/save")
-    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id;authUserId:供应商用户id;mobile:手机号", required = true)
-    public ResponseJson saveClubUser(@RequestBody String params) {
+    @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id;mobile:手机号", required = true)
+    public ResponseJson saveClubUser(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer clubUserId = paramsMap.getInteger("clubUserId");
         Integer clubUserId = paramsMap.getInteger("clubUserId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         String mobile = paramsMap.getString("mobile");
         String mobile = paramsMap.getString("mobile");
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id");
-        }
         if (StringUtils.isEmpty(mobile)) {
         if (StringUtils.isEmpty(mobile)) {
             return ResponseJson.error("参数异常,请输入手机号");
             return ResponseJson.error("参数异常,请输入手机号");
         }
         }

+ 29 - 12
src/main/java/com/caimei/controller/admin/auth/AuthProductApi.java

@@ -2,11 +2,13 @@ package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.annotation.Idempotent;
 import com.caimei.annotation.Idempotent;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.dto.ProductSaveDto;
 import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductParamPo;
 import com.caimei.model.po.ProductTypePo;
 import com.caimei.model.po.ProductTypePo;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductFormVo;
 import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.ProductListVo;
 import com.caimei.model.vo.ProductTypeListVo;
 import com.caimei.model.vo.ProductTypeListVo;
@@ -152,21 +154,26 @@ public class AuthProductApi {
     }
     }
 
 
     @ApiOperation("添加/编辑设备分类")
     @ApiOperation("添加/编辑设备分类")
-    @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;authUserId:供应商用户id;name:设备分类名称;image:图片;createBy:创建人用户id;", required = true)
+    @ApiImplicitParam(name = "params", value = "productTypeId:设备分类id;name:设备分类名称;image:图片;createBy:创建人用户id;", required = true)
     @PostMapping("/type/save")
     @PostMapping("/type/save")
-    public ResponseJson saveProductType(@RequestBody String params) throws IOException {
+    public ResponseJson saveProductType(@CurrentUser SysUser sysUser, @RequestBody String params) throws IOException {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer productTypeId = paramsMap.getInteger("productTypeId");
         Integer productTypeId = paramsMap.getInteger("productTypeId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         Integer brandId = paramsMap.getInteger("brandId");
         Integer brandId = paramsMap.getInteger("brandId");
         String name = paramsMap.getString("name");
         String name = paramsMap.getString("name");
         String image = paramsMap.getString("image");
         String image = paramsMap.getString("image");
         Integer createBy = paramsMap.getInteger("createBy");
         Integer createBy = paramsMap.getInteger("createBy");
         String paramListStr = paramsMap.getString("paramList");
         String paramListStr = paramsMap.getString("paramList");
         List<ProductParamPo> paramList = JSONArray.parseArray(paramListStr, ProductParamPo.class);
         List<ProductParamPo> paramList = JSONArray.parseArray(paramListStr, ProductParamPo.class);
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空");
-        }
         if (null == brandId) {
         if (null == brandId) {
             return ResponseJson.error("参数异常,品牌id不能为空");
             return ResponseJson.error("参数异常,品牌id不能为空");
         }
         }
@@ -213,7 +220,6 @@ public class AuthProductApi {
     @ApiOperation("设备分类列表")
     @ApiOperation("设备分类列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1设备分类列表,2设备分类审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1设备分类列表,2设备分类审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
             @ApiImplicitParam(name = "name", required = false, value = "设备分类名称"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
             @ApiImplicitParam(name = "status", required = false, value = "上线状态:0下线,1上线,2待上线"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
@@ -221,21 +227,32 @@ public class AuthProductApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/type/list")
     @GetMapping("/type/list")
-    public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(Integer listType, Integer authUserId, String name, Integer status, Integer auditStatus,
+    public ResponseJson<PageInfo<ProductTypeListVo>> getProductTypeList(@CurrentUser SysUser sysUser, Integer listType, String name, Integer status, Integer auditStatus,
                                                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                                         @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         return authProductService.getProductTypeList(listType, authUserId, name, status, auditStatus, pageNum, pageSize);
         return authProductService.getProductTypeList(listType, authUserId, name, status, auditStatus, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("设备分类下拉框列表")
     @ApiOperation("设备分类下拉框列表")
-    @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @GetMapping("/type/select")
     @GetMapping("/type/select")
-    public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(Integer authUserId) {
+    public ResponseJson<List<ProductTypeListVo>> getProductTypeSelectList(@CurrentUser SysUser sysUser) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空", null);
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         return authProductService.getProductTypeSelectList(authUserId);
         return authProductService.getProductTypeSelectList(authUserId);
     }
     }

+ 24 - 7
src/main/java/com/caimei/controller/admin/auth/AuthTemplateApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.auth;
 package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.TemplateVo;
 import com.caimei.model.vo.TemplateVo;
 import com.caimei.service.auth.AuthTemplateService;
 import com.caimei.service.auth.AuthTemplateService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
@@ -31,14 +33,19 @@ public class AuthTemplateApi {
     @ApiOperation("授权牌模板列表")
     @ApiOperation("授权牌模板列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = true, value = "列表类型:1管理员列表,2供应商列表"),
             @ApiImplicitParam(name = "listType", required = true, value = "列表类型:1管理员列表,2供应商列表"),
-            @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<TemplateVo>> getTemplateList(Integer listType, Integer authUserId,
+    public ResponseJson<PageInfo<TemplateVo>> getTemplateList(@CurrentUser SysUser sysUser, Integer listType,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return authTemplateService.getTemplateList(listType, authUserId, pageNum, pageSize);
         return authTemplateService.getTemplateList(listType, authUserId, pageNum, pageSize);
     }
     }
 
 
@@ -46,12 +53,17 @@ public class AuthTemplateApi {
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "templateId", required = false, value = "模板id"),
             @ApiImplicitParam(name = "templateId", required = false, value = "模板id"),
             @ApiImplicitParam(name = "authId", required = false, value = "机构id"),
             @ApiImplicitParam(name = "authId", required = false, value = "机构id"),
-            @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
             @ApiImplicitParam(name = "authFlag", required = false, value = "是否作为机构授权牌模板:1是0否"),
             @ApiImplicitParam(name = "authFlag", required = false, value = "是否作为机构授权牌模板:1是0否"),
             @ApiImplicitParam(name = "status", required = false, value = "启用状态:0停用,1启用")
             @ApiImplicitParam(name = "status", required = false, value = "启用状态:0停用,1启用")
     })
     })
     @GetMapping("/form/data")
     @GetMapping("/form/data")
-    public ResponseJson<TemplateVo> getTemplateFormData(Integer templateId, Integer authId, Integer authUserId, Integer authFlag, Integer status) {
+    public ResponseJson<TemplateVo> getTemplateFormData(@CurrentUser SysUser sysUser, Integer templateId, Integer authId, Integer authFlag, Integer status) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == templateId && null == authId && null == authUserId) {
         if (null == templateId && null == authId && null == authUserId) {
             return ResponseJson.error("参数异常", null);
             return ResponseJson.error("参数异常", null);
         }
         }
@@ -60,14 +72,19 @@ public class AuthTemplateApi {
 
 
     @ApiOperation("添加/编辑授权模板")
     @ApiOperation("添加/编辑授权模板")
     @ApiImplicitParam(name = "params", required = true, value = "templateId:模板id;templateImage:模板图片;" +
     @ApiImplicitParam(name = "params", required = true, value = "templateId:模板id;templateImage:模板图片;" +
-            "authUserId:供应商用户id;status:状态:1启用,0停用;qrPosition:二维码位置;qrSize:二维码尺寸;" +
+            "status:状态:1启用,0停用;qrPosition:二维码位置;qrSize:二维码尺寸;" +
             "logoSize:logo尺寸;authFlag:1设置为机构授权牌模板;productFlag:1设置为设备授权牌模板")
             "logoSize:logo尺寸;authFlag:1设置为机构授权牌模板;productFlag:1设置为设备授权牌模板")
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveTemplate(@RequestBody String params){
+    public ResponseJson saveTemplate(@CurrentUser SysUser sysUser, @RequestBody String params){
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject parseObject = JSONObject.parseObject(params);
         JSONObject parseObject = JSONObject.parseObject(params);
         Integer templateId = parseObject.getInteger("templateId");
         Integer templateId = parseObject.getInteger("templateId");
         String templateImage = parseObject.getString("templateImage");
         String templateImage = parseObject.getString("templateImage");
-        Integer authUserId = parseObject.getInteger("authUserId");
         Integer status = parseObject.getInteger("status");
         Integer status = parseObject.getInteger("status");
         String qrPosition = parseObject.getString("qrPosition");
         String qrPosition = parseObject.getString("qrPosition");
         Integer qrSize = parseObject.getInteger("qrSize");
         Integer qrSize = parseObject.getInteger("qrSize");

+ 26 - 5
src/main/java/com/caimei/controller/admin/auth/DoctorApi.java

@@ -1,8 +1,10 @@
 package com.caimei.controller.admin.auth;
 package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.CmBrandDoctorPo;
 import com.caimei.model.po.CmBrandDoctorPo;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.DoctorFormVo;
 import com.caimei.model.vo.DoctorFormVo;
 import com.caimei.model.vo.DoctorListVo;
 import com.caimei.model.vo.DoctorListVo;
 import com.caimei.service.auth.DoctorService;
 import com.caimei.service.auth.DoctorService;
@@ -36,7 +38,6 @@ public class DoctorApi {
     @ApiOperation("医师列表")
     @ApiOperation("医师列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "doctorType", required = false, value = "医师类型:1操作医师,2培训医师"),
             @ApiImplicitParam(name = "doctorType", required = false, value = "医师类型:1操作医师,2培训医师"),
             @ApiImplicitParam(name = "doctorName", required = false, value = "医师姓名"),
             @ApiImplicitParam(name = "doctorName", required = false, value = "医师姓名"),
             @ApiImplicitParam(name = "certificateNo", required = false, value = "从业资格证编号"),
             @ApiImplicitParam(name = "certificateNo", required = false, value = "从业资格证编号"),
@@ -46,9 +47,21 @@ public class DoctorApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus,
+    public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(@CurrentUser SysUser sysUser, Integer listType, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
+        if (null == doctorType) {
+            return ResponseJson.error("参数异常,医师类型不能为空", null);
+        }
         return doctorService.getDoctorList(listType, authUserId, doctorType, doctorName, certificateNo, status, auditStatus, pageNum, pageSize);
         return doctorService.getDoctorList(listType, authUserId, doctorType, doctorName, certificateNo, status, auditStatus, pageNum, pageSize);
     }
     }
 
 
@@ -89,15 +102,23 @@ public class DoctorApi {
      * 添加/编辑医师
      * 添加/编辑医师
      */
      */
     @ApiOperation("添加/编辑医师")
     @ApiOperation("添加/编辑医师")
-    @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;authId:机构id;doctorType:医师类型:1操作医师,2培训医师;" +
+    @ApiImplicitParam(name = "params", value = "doctorId:医师id;authId:机构id;doctorType:医师类型:1操作医师,2培训医师;" +
             "doctorName:医师姓名;" +"certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;" +
             "doctorName:医师姓名;" +"certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;" +
             "bannerList:轮播图列表;" +"doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}]);" +
             "bannerList:轮播图列表;" +"doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}]);" +
             "tagList(['标签1','标签2'];" + "paramList([{name:'参数1',content:'内容1'}..]))", required = true)
             "tagList(['标签1','标签2'];" + "paramList([{name:'参数1',content:'内容1'}..]))", required = true)
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveDoctor(@RequestBody String params) {
+    public ResponseJson saveDoctor(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer doctorId = paramsMap.getInteger("doctorId");
         Integer doctorId = paramsMap.getInteger("doctorId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         Integer authId = paramsMap.getInteger("authId");
         Integer authId = paramsMap.getInteger("authId");
         Integer doctorType = paramsMap.getInteger("doctorType");
         Integer doctorType = paramsMap.getInteger("doctorType");
         String doctorName = paramsMap.getString("doctorName");
         String doctorName = paramsMap.getString("doctorName");

+ 85 - 13
src/main/java/com/caimei/controller/admin/auth/ShopApi.java

@@ -2,10 +2,15 @@ package com.caimei.controller.admin.auth;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
+import com.caimei.components.RedisService;
+import com.caimei.mapper.cmMapper.SystemMapper;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.dto.ShopInfoDto;
 import com.caimei.model.dto.ShopInfoDto;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.*;
 import com.caimei.model.vo.*;
 import com.caimei.service.auth.ShopService;
 import com.caimei.service.auth.ShopService;
+import com.caimei.utils.JwtUtil;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,9 +19,12 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -36,6 +44,17 @@ public class ShopApi {
 
 
     private final ShopService shopService;
     private final ShopService shopService;
 
 
+
+    private RedisService redisService;
+
+    @Autowired
+    public void setRedisService(RedisService redisService) {
+        this.redisService = redisService;
+    }
+
+    @Resource
+    private SystemMapper systemMapper;
+
     /**
     /**
      * 供应商列表
      * 供应商列表
      */
      */
@@ -70,6 +89,7 @@ public class ShopApi {
     @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
     @GetMapping("/form/data")
     @GetMapping("/form/data")
     public ResponseJson<ShopFormVo> getShopFormData(Integer authUserId) {
     public ResponseJson<ShopFormVo> getShopFormData(Integer authUserId) {
+        // 由管理员调用接口,无法通过@CurrentUser注解获取供应商用户id
         return shopService.getShopFormData(authUserId);
         return shopService.getShopFormData(authUserId);
     }
     }
 
 
@@ -105,6 +125,7 @@ public class ShopApi {
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;", required = true)
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;", required = true)
     @PostMapping("/save")
     @PostMapping("/save")
     public ResponseJson saveShop(@RequestBody String params) {
     public ResponseJson saveShop(@RequestBody String params) {
+        // 由管理员调用接口,无法通过@CurrentUser注解获取供应商用户id
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer authUserId = paramsMap.getInteger("authUserId");
         Integer authUserId = paramsMap.getInteger("authUserId");
         Integer shopType = paramsMap.getInteger("shopType");
         Integer shopType = paramsMap.getInteger("shopType");
@@ -172,6 +193,7 @@ public class ShopApi {
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;status:供应商状态:0停用 1启用", required = true)
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;status:供应商状态:0停用 1启用", required = true)
     @PostMapping("/update/status")
     @PostMapping("/update/status")
     public ResponseJson updateShopStatus(@RequestBody Map<String,Integer> params) {
     public ResponseJson updateShopStatus(@RequestBody Map<String,Integer> params) {
+        // 由管理员调用接口,无法通过@CurrentUser注解获取供应商用户id
         Integer authUserId = params.get("authUserId");
         Integer authUserId = params.get("authUserId");
         Integer status = params.get("status");
         Integer status = params.get("status");
         return shopService.updateShopStatus(authUserId, status);
         return shopService.updateShopStatus(authUserId, status);
@@ -184,6 +206,7 @@ public class ShopApi {
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id", required = true)
     @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id", required = true)
     @PostMapping("/reset/password")
     @PostMapping("/reset/password")
     public ResponseJson resetShopPassword(@RequestBody Map<String,Integer> params) {
     public ResponseJson resetShopPassword(@RequestBody Map<String,Integer> params) {
+        // 由管理员调用接口,无法通过@CurrentUser注解获取供应商用户id
         Integer authUserId = params.get("authUserId");
         Integer authUserId = params.get("authUserId");
         return shopService.resetShopPassword(authUserId);
         return shopService.resetShopPassword(authUserId);
     }
     }
@@ -235,7 +258,6 @@ public class ShopApi {
 
 
     @ApiOperation("用户反馈列表")
     @ApiOperation("用户反馈列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
             @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
             @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
             @ApiImplicitParam(name = "handleStatus", required = false, value = "处理状态:0未处理,1已处理"),
             @ApiImplicitParam(name = "handleStatus", required = false, value = "处理状态:0未处理,1已处理"),
@@ -243,9 +265,18 @@ public class ShopApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/feedback/list")
     @GetMapping("/feedback/list")
-    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, String clubName, String mobile, Integer handleStatus,
+    public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(@CurrentUser SysUser sysUser, String clubName, String mobile, Integer handleStatus,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                               @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return shopService.getFeedbackList(authUserId, clubName, mobile, handleStatus, pageNum, pageSize);
         return shopService.getFeedbackList(authUserId, clubName, mobile, handleStatus, pageNum, pageSize);
     }
     }
 
 
@@ -276,11 +307,18 @@ public class ShopApi {
     }
     }
 
 
     @ApiOperation("修改手机号")
     @ApiOperation("修改手机号")
-    @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;oldMobile:旧手机号;verifyCode:验证码;newMobile:新手机号;", required = true)
+    @ApiImplicitParam(name = "params", value = "oldMobile:旧手机号;verifyCode:验证码;newMobile:新手机号;", required = true)
     @PostMapping("/mobile/change")
     @PostMapping("/mobile/change")
-    public ResponseJson changeMobile(@RequestBody String params) {
+    public ResponseJson changeMobile(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 修改用户信息:供应商和子用户都可以修改个人信息,直接取id即可
+        Integer authUserId = sysUser.getId();
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject parseObject = JSONObject.parseObject(params);
         JSONObject parseObject = JSONObject.parseObject(params);
-        Integer authUserId = parseObject.getInteger("authUserId");
         String verifyCode = parseObject.getString("verifyCode");
         String verifyCode = parseObject.getString("verifyCode");
         String oldMobile = parseObject.getString("oldMobile");
         String oldMobile = parseObject.getString("oldMobile");
         String newMobile = parseObject.getString("newMobile");
         String newMobile = parseObject.getString("newMobile");
@@ -288,11 +326,18 @@ public class ShopApi {
     }
     }
 
 
     @ApiOperation("登录账号绑定")
     @ApiOperation("登录账号绑定")
-    @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;mobile:手机号;verifyCode:验证码;loginAccount:登录账号;", required = true)
+    @ApiImplicitParam(name = "params", value = "mobile:手机号;verifyCode:验证码;loginAccount:登录账号;", required = true)
     @PostMapping("/account/bind")
     @PostMapping("/account/bind")
-    public ResponseJson bindLoginAccount(@RequestBody String params) {
+    public ResponseJson bindLoginAccount(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 修改用户信息:供应商和子用户都可以修改个人信息,直接取id即可
+        Integer authUserId = sysUser.getId();
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         JSONObject parseObject = JSONObject.parseObject(params);
         JSONObject parseObject = JSONObject.parseObject(params);
-        Integer authUserId = parseObject.getInteger("authUserId");
         String verifyCode = parseObject.getString("verifyCode");
         String verifyCode = parseObject.getString("verifyCode");
         String mobile = parseObject.getString("mobile");
         String mobile = parseObject.getString("mobile");
         String loginAccount = parseObject.getString("loginAccount");
         String loginAccount = parseObject.getString("loginAccount");
@@ -300,14 +345,41 @@ public class ShopApi {
     }
     }
 
 
     @ApiOperation("一键更新机构授权牌")
     @ApiOperation("一键更新机构授权牌")
-    @ApiImplicitParam(name = "params",value = "authUserId:供应商用户id")
     @PostMapping("/authImage/update/all")
     @PostMapping("/authImage/update/all")
-    public ResponseJson updateAllAuthImage(@RequestBody String params ){
-        JSONObject parseObject = JSONObject.parseObject(params);
-        Integer authUserId = parseObject.getInteger("authUserId");
+    public ResponseJson updateAllAuthImage(@CurrentUser SysUser sysUser){
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("供应商用户id不能为空");
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         return shopService.updateAllAuthImage(authUserId);
         return shopService.updateAllAuthImage(authUserId);
     }
     }
+
+    @ApiOperation("管理员生成供应商token")
+    @GetMapping("/token/generate")
+    public ResponseJson<String> generateShopToken(Integer authUserId, HttpServletRequest request) {
+        // 由管理员调用接口,无法通过@CurrentUser注解获取供应商用户id
+        // 对管理员身份进行校验
+        String token = request.getHeader("X-Token");
+        String cacheToken = null != token ? String.valueOf(redisService.get(token)) : null;
+        if (null != cacheToken && JwtUtil.isVerify(cacheToken)) {
+            int adminId = JwtUtil.parseTokenUid(cacheToken);
+            SysUser user = systemMapper.getUser(adminId);
+            if (null == user || 1 != user.getUserIdentity()) {
+                return ResponseJson.error("生成token失败", null);
+            } else {
+                // 生成token给用户
+                String shopToken = JwtUtil.createToken(authUserId);
+                // 为了过期续签,将token存入redis,并设置超时时间
+                redisService.set(shopToken, shopToken, JwtUtil.getExpireTime());
+                return ResponseJson.success(shopToken);
+            }
+        } else {
+            return ResponseJson.error("生成token失败", null);
+        }
+    }
 }
 }

+ 20 - 5
src/main/java/com/caimei/controller/admin/data/ArticleApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.data;
 package com.caimei.controller.admin.data;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.ArticleFormVo;
 import com.caimei.model.vo.ArticleFormVo;
 import com.caimei.model.vo.ArticleListVo;
 import com.caimei.model.vo.ArticleListVo;
 import com.caimei.service.auth.ArticleService;
 import com.caimei.service.auth.ArticleService;
@@ -35,7 +37,6 @@ public class ArticleApi {
     @ApiOperation("文章列表")
     @ApiOperation("文章列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1文章列表,2文章审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1文章列表,2文章审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "articleTitle", required = false, value = "文章标题"),
             @ApiImplicitParam(name = "articleTitle", required = false, value = "文章标题"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "status", required = false, value = "文章状态:0已下线,1已上线,2待上线"),
             @ApiImplicitParam(name = "status", required = false, value = "文章状态:0已下线,1已上线,2待上线"),
@@ -43,19 +44,33 @@ public class ArticleApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ArticleListVo>> getArticleList(Integer listType, Integer authUserId, String articleTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<ArticleListVo>> getArticleList(@CurrentUser SysUser sysUser, Integer listType, String articleTitle, Integer auditStatus, Integer status,
                                                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return articleService.getArticleList(listType, authUserId, articleTitle, auditStatus, status, pageNum, pageSize);
         return articleService.getArticleList(listType, authUserId, articleTitle, auditStatus, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("添加/编辑文章")
     @ApiOperation("添加/编辑文章")
-    @ApiImplicitParam(name = "params", value = "articleId:文章id;authUserId:供应商用户id;articleTitle:文章标题;articleImage:文章图片;articleContent:文章内容", required = true)
+    @ApiImplicitParam(name = "params", value = "articleId:文章id;articleTitle:文章标题;articleImage:文章图片;articleContent:文章内容", required = true)
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveArticle(@RequestBody String params) {
+    public ResponseJson saveArticle(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer articleId = paramsMap.getInteger("articleId");
         Integer articleId = paramsMap.getInteger("articleId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         String articleTitle = paramsMap.getString("articleTitle");
         String articleTitle = paramsMap.getString("articleTitle");
         String articleImage = paramsMap.getString("articleImage");
         String articleImage = paramsMap.getString("articleImage");
         String articleContent = paramsMap.getString("articleContent");
         String articleContent = paramsMap.getString("articleContent");

+ 20 - 5
src/main/java/com/caimei/controller/admin/data/FileApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.data;
 package com.caimei.controller.admin.data;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.CourseFileListVo;
 import com.caimei.model.vo.CourseFileListVo;
 import com.caimei.model.vo.FileListVo;
 import com.caimei.model.vo.FileListVo;
 import com.caimei.service.data.FileService;
 import com.caimei.service.data.FileService;
@@ -35,7 +37,6 @@ public class FileApi {
     @ApiOperation("文件列表")
     @ApiOperation("文件列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1文件列表,2文件审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1文件列表,2文件审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "fileType", required = false, value = "文件类型:1单个文件,2资料包"),
             @ApiImplicitParam(name = "fileType", required = false, value = "文件类型:1单个文件,2资料包"),
             @ApiImplicitParam(name = "fileTitle", required = false, value = "文件标题"),
             @ApiImplicitParam(name = "fileTitle", required = false, value = "文件标题"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
@@ -44,19 +45,33 @@ public class FileApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<FileListVo>> getFileList(Integer listType, Integer authUserId, Integer fileType, String fileTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<FileListVo>> getFileList(@CurrentUser SysUser sysUser, Integer listType, Integer fileType, String fileTitle, Integer auditStatus, Integer status,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                           @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return fileService.getFileList(listType, authUserId, fileType, fileTitle, auditStatus, status, pageNum, pageSize);
         return fileService.getFileList(listType, authUserId, fileType, fileTitle, auditStatus, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("添加/编辑文件")
     @ApiOperation("添加/编辑文件")
-    @ApiImplicitParam(name = "params", required = false, value = "fileId:文件id;authUserId:供应商用户id;fileType:文件类型:1单个文件,2资料包;fileTitle:文件标题;fileName:文件名称;filePreviewUrl:文件预览链接;fileDownloadUrl:oss名称")
+    @ApiImplicitParam(name = "params", required = false, value = "fileId:文件id;fileType:文件类型:1单个文件,2资料包;fileTitle:文件标题;fileName:文件名称;filePreviewUrl:文件预览链接;fileDownloadUrl:oss名称")
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveFile(@RequestBody String params) {
+    public ResponseJson saveFile(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer fileId = paramsMap.getInteger("fileId");
         Integer fileId = paramsMap.getInteger("fileId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         Integer fileType = paramsMap.getInteger("fileType");
         Integer fileType = paramsMap.getInteger("fileType");
         String fileTitle = paramsMap.getString("fileTitle");
         String fileTitle = paramsMap.getString("fileTitle");
         String fileName = paramsMap.getString("fileName");
         String fileName = paramsMap.getString("fileName");

+ 20 - 5
src/main/java/com/caimei/controller/admin/data/ImageApi.java

@@ -2,7 +2,9 @@ package com.caimei.controller.admin.data;
 
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.ImageFormVo;
 import com.caimei.model.vo.ImageFormVo;
 import com.caimei.model.vo.ImageListVo;
 import com.caimei.model.vo.ImageListVo;
 import com.caimei.service.data.ImageService;
 import com.caimei.service.data.ImageService;
@@ -36,7 +38,6 @@ public class ImageApi {
     @ApiOperation("图片列表")
     @ApiOperation("图片列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1图片列表,2图片审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1图片列表,2图片审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "imageTitle", required = false, value = "图片标题"),
             @ApiImplicitParam(name = "imageTitle", required = false, value = "图片标题"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "status", required = false, value = "图片状态:0已下线,1已上线,2待上线"),
             @ApiImplicitParam(name = "status", required = false, value = "图片状态:0已下线,1已上线,2待上线"),
@@ -44,19 +45,33 @@ public class ImageApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<ImageListVo>> getImageList(Integer listType, Integer authUserId, String imageTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<ImageListVo>> getImageList(@CurrentUser SysUser sysUser, Integer listType, String imageTitle, Integer auditStatus, Integer status,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return imageService.getImageList(listType, authUserId, imageTitle, auditStatus, status, pageNum, pageSize);
         return imageService.getImageList(listType, authUserId, imageTitle, auditStatus, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("添加/编辑图片")
     @ApiOperation("添加/编辑图片")
-    @ApiImplicitParam(name = "params", value = "imageId:图片id;authUserId:供应商用户id;imageTitle:图片标题;imageArr:图片数组", required = true)
+    @ApiImplicitParam(name = "params", value = "imageId:图片id;imageTitle:图片标题;imageArr:图片数组", required = true)
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveImage(@RequestBody String params) throws Exception {
+    public ResponseJson saveImage(@CurrentUser SysUser sysUser, @RequestBody String params) throws Exception {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer imageId = paramsMap.getInteger("imageId");
         Integer imageId = paramsMap.getInteger("imageId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         String imageTitle = paramsMap.getString("imageTitle");
         String imageTitle = paramsMap.getString("imageTitle");
         JSONArray imageArr = paramsMap.getJSONArray("imageArr");
         JSONArray imageArr = paramsMap.getJSONArray("imageArr");
         return imageService.saveImage(imageId, authUserId, imageTitle, imageArr);
         return imageService.saveImage(imageId, authUserId, imageTitle, imageArr);

+ 19 - 4
src/main/java/com/caimei/controller/admin/data/VideoApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.data;
 package com.caimei.controller.admin.data;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.VideoListVo;
 import com.caimei.model.vo.VideoListVo;
 import com.caimei.service.data.VideoService;
 import com.caimei.service.data.VideoService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
@@ -34,7 +36,6 @@ public class VideoApi {
     @ApiOperation("视频列表")
     @ApiOperation("视频列表")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1视频列表,2视频审核列表"),
             @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1视频列表,2视频审核列表"),
-            @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
             @ApiImplicitParam(name = "videoTitle", required = false, value = "视频标题"),
             @ApiImplicitParam(name = "videoTitle", required = false, value = "视频标题"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
             @ApiImplicitParam(name = "status", required = false, value = "视频状态:0已下线,1已上线,2待上线"),
             @ApiImplicitParam(name = "status", required = false, value = "视频状态:0已下线,1已上线,2待上线"),
@@ -42,19 +43,33 @@ public class VideoApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<VideoListVo>> getVideoList(Integer listType, Integer authUserId, String videoTitle, Integer auditStatus, Integer status,
+    public ResponseJson<PageInfo<VideoListVo>> getVideoList(@CurrentUser SysUser sysUser, Integer listType, String videoTitle, Integer auditStatus, Integer status,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                             @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return videoService.getVideoList(listType, authUserId, videoTitle, auditStatus, status, pageNum, pageSize);
         return videoService.getVideoList(listType, authUserId, videoTitle, auditStatus, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("添加/编辑视频")
     @ApiOperation("添加/编辑视频")
     @ApiImplicitParam(name = "params", required = false, value = "videoId:视频id;authUserId:供应商用户id;videoTitle:视频标题;videoName:视频名称;videoPreviewUrl:视频预览链接;videoDownloadUrl:oss名称")
     @ApiImplicitParam(name = "params", required = false, value = "videoId:视频id;authUserId:供应商用户id;videoTitle:视频标题;videoName:视频名称;videoPreviewUrl:视频预览链接;videoDownloadUrl:oss名称")
     @PostMapping("/save")
     @PostMapping("/save")
-    public ResponseJson saveVideo(@RequestBody String params) {
+    public ResponseJson saveVideo(@CurrentUser SysUser sysUser, @RequestBody String params) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         JSONObject paramsMap = JSONObject.parseObject(params);
         JSONObject paramsMap = JSONObject.parseObject(params);
         Integer videoId = paramsMap.getInteger("videoId");
         Integer videoId = paramsMap.getInteger("videoId");
-        Integer authUserId = paramsMap.getInteger("authUserId");
         String videoTitle = paramsMap.getString("videoTitle");
         String videoTitle = paramsMap.getString("videoTitle");
         String videoImage = paramsMap.getString("videoImage");
         String videoImage = paramsMap.getString("videoImage");
         String videoName = paramsMap.getString("videoName");
         String videoName = paramsMap.getString("videoName");

+ 10 - 1
src/main/java/com/caimei/controller/admin/sys/SysMenuApi.java

@@ -1,8 +1,10 @@
 package com.caimei.controller.admin.sys;
 package com.caimei.controller.admin.sys;
 
 
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysMenu;
 import com.caimei.model.po.SysMenu;
 import com.caimei.model.po.SysMenuTree;
 import com.caimei.model.po.SysMenuTree;
+import com.caimei.model.po.SysUser;
 import com.caimei.service.sys.SysMenuService;
 import com.caimei.service.sys.SysMenuService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -32,10 +34,17 @@ public class SysMenuApi {
      * @param pageSize 每页大小
      * @param pageSize 每页大小
      */
      */
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<SysMenu>> menuList(Integer authUserId, Integer status, Integer menuType,
+    public ResponseJson<PageInfo<SysMenu>> menuList(@CurrentUser SysUser sysUser, Integer status, Integer menuType,
                                                     @RequestParam(value = "parentId", defaultValue = "0") Integer parentId,
                                                     @RequestParam(value = "parentId", defaultValue = "0") Integer parentId,
                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        // 管理员/供应商公用接口,管理员不需要传authUserId
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return sysMenuService.getMenuList(authUserId, parentId, menuType, status, pageNum, pageSize);
         return sysMenuService.getMenuList(authUserId, parentId, menuType, status, pageNum, pageSize);
     }
     }
 
 

+ 9 - 1
src/main/java/com/caimei/controller/admin/sys/SysRoleApi.java

@@ -1,7 +1,9 @@
 package com.caimei.controller.admin.sys;
 package com.caimei.controller.admin.sys;
 
 
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysRole;
 import com.caimei.model.po.SysRole;
+import com.caimei.model.po.SysUser;
 import com.caimei.service.sys.SysRoleService;
 import com.caimei.service.sys.SysRoleService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import org.springframework.util.StringUtils;
 import org.springframework.util.StringUtils;
@@ -28,8 +30,14 @@ public class SysRoleApi {
      * @param pageSize 每页大小
      * @param pageSize 每页大小
      */
      */
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<SysRole>> roleList(Integer authUserId, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+    public ResponseJson<PageInfo<SysRole>> roleList(@CurrentUser SysUser sysUser, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return sysRoleService.getRoleList(authUserId, pageNum, pageSize);
         return sysRoleService.getRoleList(authUserId, pageNum, pageSize);
     }
     }
 
 

+ 17 - 2
src/main/java/com/caimei/controller/admin/sys/SysUserApi.java

@@ -1,5 +1,6 @@
 package com.caimei.controller.admin.sys;
 package com.caimei.controller.admin.sys;
 
 
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysUser;
 import com.caimei.model.po.SysUser;
 import com.caimei.service.sys.SysUserService;
 import com.caimei.service.sys.SysUserService;
@@ -25,9 +26,17 @@ public class SysUserApi {
      * 获取用户信息
      * 获取用户信息
      */
      */
     @GetMapping("/info")
     @GetMapping("/info")
-    public ResponseJson<SysUser> getUserInfo(Integer authUserId) {
+    public ResponseJson<SysUser> getUserInfo(@CurrentUser SysUser sysUser) {
 //        String token = request.getHeader(ConstantKey.TOKEN_NAME);
 //        String token = request.getHeader(ConstantKey.TOKEN_NAME);
 //        String username = jwtService.getUsername(token);
 //        String username = jwtService.getUsername(token);
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取用户信息,直接取id即可
+        Integer authUserId = sysUser.getId();
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return sysUserService.getInfoByUserId(authUserId);
         return sysUserService.getInfoByUserId(authUserId);
     }
     }
 
 
@@ -49,9 +58,15 @@ public class SysUserApi {
      * @param pageSize 每页大小
      * @param pageSize 每页大小
      */
      */
     @GetMapping("/list")
     @GetMapping("/list")
-    public ResponseJson<PageInfo<SysUser>> userList(Integer authUserId, String username, String linkMan,
+    public ResponseJson<PageInfo<SysUser>> userList(@CurrentUser SysUser sysUser, String username, String linkMan,
                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         return sysUserService.getUserList(authUserId, username, linkMan, pageNum, pageSize);
         return sysUserService.getUserList(authUserId, username, linkMan, pageNum, pageSize);
     }
     }
 
 

+ 31 - 6
src/main/java/com/caimei/controller/admin/vip/VipApi.java

@@ -1,8 +1,10 @@
 package com.caimei.controller.admin.vip;
 package com.caimei.controller.admin.vip;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.ResponseJson;
 import com.caimei.model.po.SysMenu;
 import com.caimei.model.po.SysMenu;
+import com.caimei.model.po.SysUser;
 import com.caimei.model.vo.*;
 import com.caimei.model.vo.*;
 import com.caimei.service.vip.VipService;
 import com.caimei.service.vip.VipService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
@@ -57,14 +59,19 @@ public class VipApi {
 
 
     @ApiOperation("在线支付开通会员")
     @ApiOperation("在线支付开通会员")
     @ApiImplicitParams({
     @ApiImplicitParams({
-            @ApiImplicitParam(required = false, name = "authUserId", value = "用户id"),
             @ApiImplicitParam(required = false, name = "packageId", value = "会员套餐id"),
             @ApiImplicitParam(required = false, name = "packageId", value = "会员套餐id"),
             @ApiImplicitParam(required = false, name = "services", value = "订制服务id,以,分开")
             @ApiImplicitParam(required = false, name = "services", value = "订制服务id,以,分开")
     })
     })
     @GetMapping("/pay")
     @GetMapping("/pay")
-    public ResponseJson<Integer> payVip(Integer authUserId, Integer packageId, String services) {
+    public ResponseJson<Integer> payVip(@CurrentUser SysUser sysUser, Integer packageId, String services) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
         if (null == authUserId) {
         if (null == authUserId) {
-            return ResponseJson.error("参数异常,用户id不能为空", null);
+            return ResponseJson.error("供应商用户id不能为空", null);
         }
         }
         if (null == packageId) {
         if (null == packageId) {
             return ResponseJson.error("参数异常,套餐id不能为空", null);
             return ResponseJson.error("参数异常,套餐id不能为空", null);
@@ -102,17 +109,35 @@ public class VipApi {
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
     })
     })
     @GetMapping("/history/list")
     @GetMapping("/history/list")
-    public ResponseJson<PageInfo<VipHistoryListVo>> vipHistoryList(Integer authUserId, Integer vipPackageId, Integer vipStatus, String payBeginTime,
+    public ResponseJson<PageInfo<VipHistoryListVo>> vipHistoryList(@CurrentUser SysUser sysUser, Integer authUserId, Integer vipPackageId, Integer vipStatus, String payBeginTime,
                                                                    String payEndTime, String endBeginTime, String endEndTime,
                                                                    String payEndTime, String endBeginTime, String endEndTime,
                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
                                                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        // 管理员/供应商公用接口,只有管理员需要传authUserId
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer tempAuthUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null != tempAuthUserId) {
+            authUserId = tempAuthUserId;
+        }
         return vipService.vipHistoryList(authUserId, vipPackageId, vipStatus, payBeginTime, payEndTime, endBeginTime, endEndTime, pageNum, pageSize);
         return vipService.vipHistoryList(authUserId, vipPackageId, vipStatus, payBeginTime, payEndTime, endBeginTime, endEndTime, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("会员数据")
     @ApiOperation("会员数据")
-    @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id")
     @GetMapping("/info")
     @GetMapping("/info")
-    public ResponseJson<VipInfoVo> vipInfo(Integer authUserId) {
+    public ResponseJson<VipInfoVo> vipInfo(@CurrentUser SysUser sysUser) {
+        if (null == sysUser) {
+            return ResponseJson.error("用户信息异常", null);
+        }
+        // 获取供应商用户id
+        Integer userIdentity = sysUser.getUserIdentity();
+        Integer authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+        if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         return vipService.getVipInfo(authUserId);
         return vipService.getVipInfo(authUserId);
     }
     }
 
 

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

@@ -36,9 +36,6 @@ public class ArticleServiceImpl implements ArticleService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<ArticleListVo>> 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;
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<ArticleListVo> articleList = articleMapper.getArticleList(listType, authUserId, articleTitle, auditStatus, status);
         List<ArticleListVo> articleList = articleMapper.getArticleList(listType, authUserId, articleTitle, auditStatus, status);

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

@@ -54,9 +54,6 @@ public class AuthClubServiceImpl implements AuthClubService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authUserId, String mobile, String name, Integer status, Integer pageNum, Integer pageSize) {
     public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authUserId, String mobile, String name, Integer status, Integer pageNum, Integer pageSize) {
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id", null);
-        }
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<ClubUserVo> clubUserList = clubMapper.getClubUserList(authUserId, mobile, name, status);
         List<ClubUserVo> clubUserList = clubMapper.getClubUserList(authUserId, mobile, name, status);
         PageInfo<ClubUserVo> pageData = new PageInfo<>(clubUserList);
         PageInfo<ClubUserVo> pageData = new PageInfo<>(clubUserList);

+ 0 - 6
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -107,9 +107,6 @@ public class AuthServiceImpl implements AuthService {
                                                       String mobile, Integer status, Integer auditStatus, Integer lowerAuditStatus,
                                                       String mobile, Integer status, Integer auditStatus, Integer lowerAuditStatus,
                                                       Integer shopAuditStatus, Integer sendStatus,
                                                       Integer shopAuditStatus, Integer sendStatus,
                                                       Integer pageNum, Integer pageSize) {
                                                       Integer pageNum, Integer pageSize) {
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id", null);
-        }
         listType = null == listType ? 1 : listType;
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, mobile, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus);
         List<AuthVo> authList = authMapper.getAuthList(listType, authUserId, authParty, mobile, status, auditStatus, lowerAuditStatus, shopAuditStatus, sendStatus);
@@ -232,9 +229,6 @@ public class AuthServiceImpl implements AuthService {
         }
         }
         Integer authUserId = auth.getAuthUserId();
         Integer authUserId = auth.getAuthUserId();
         String authParty = auth.getAuthParty();
         String authParty = auth.getAuthParty();
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id");
-        }
         if (StringUtils.isBlank(authParty)) {
         if (StringUtils.isBlank(authParty)) {
             return ResponseJson.error("参数异常,请输入授权机构名称");
             return ResponseJson.error("参数异常,请输入授权机构名称");
         }
         }

+ 0 - 9
src/main/java/com/caimei/service/auth/impl/DoctorServiceImpl.java

@@ -45,12 +45,6 @@ public class DoctorServiceImpl implements DoctorService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
     public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus, Integer pageNum, Integer pageSize) {
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id", null);
-        }
-        if (null == doctorType) {
-            return ResponseJson.error("参数异常,医师类型不能为空", null);
-        }
         listType = null == listType ? 1 : listType;
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<DoctorListVo> doctorList = doctorMapper.getDoctorList(listType, authUserId, doctorType, doctorName, certificateNo, status, auditStatus);
         List<DoctorListVo> doctorList = doctorMapper.getDoctorList(listType, authUserId, doctorType, doctorName, certificateNo, status, auditStatus);
@@ -123,9 +117,6 @@ public class DoctorServiceImpl implements DoctorService {
         Integer doctorId = doctor.getId();
         Integer doctorId = doctor.getId();
         Integer authUserId = doctor.getAuthUserId();
         Integer authUserId = doctor.getAuthUserId();
         String certificateNo = doctor.getCertificateNo();
         String certificateNo = doctor.getCertificateNo();
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,请输入供应商用户id");
-        }
         if (StringUtils.isBlank(doctor.getName())) {
         if (StringUtils.isBlank(doctor.getName())) {
             return ResponseJson.error("参数异常,请输入医师名称");
             return ResponseJson.error("参数异常,请输入医师名称");
         }
         }

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

@@ -388,9 +388,6 @@ public class ShopServiceImpl implements ShopService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<FeedbackVo>> getFeedbackList(Integer authUserId, String clubName, String mobile, Integer handleStatus, 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);
         PageHelper.startPage(pageNum, pageSize);
         List<FeedbackVo> feedbackList = shopMapper.getFeedbackList(authUserId, clubName, mobile, handleStatus);
         List<FeedbackVo> feedbackList = shopMapper.getFeedbackList(authUserId, clubName, mobile, handleStatus);
         PageInfo<FeedbackVo> pageData = new PageInfo<>(feedbackList);
         PageInfo<FeedbackVo> pageData = new PageInfo<>(feedbackList);
@@ -443,9 +440,6 @@ public class ShopServiceImpl implements ShopService {
 
 
     @Override
     @Override
     public ResponseJson changeMobile(Integer authUserId, String oldMobile, String verifyCode, String newMobile) {
     public ResponseJson changeMobile(Integer authUserId, String oldMobile, String verifyCode, String newMobile) {
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空");
-        }
         if (StringUtils.isEmpty(verifyCode)) {
         if (StringUtils.isEmpty(verifyCode)) {
             return ResponseJson.error("参数异常,验证码不能为空");
             return ResponseJson.error("参数异常,验证码不能为空");
         }
         }
@@ -476,9 +470,6 @@ public class ShopServiceImpl implements ShopService {
 
 
     @Override
     @Override
     public ResponseJson bindLoginAccount(Integer authUserId, String mobile, String verifyCode, String loginAccount) {
     public ResponseJson bindLoginAccount(Integer authUserId, String mobile, String verifyCode, String loginAccount) {
-        if (null == authUserId) {
-            return ResponseJson.error("参数异常,供应商用户id不能为空");
-        }
         if (StringUtils.isEmpty(verifyCode)) {
         if (StringUtils.isEmpty(verifyCode)) {
             return ResponseJson.error("参数异常,验证码不能为空");
             return ResponseJson.error("参数异常,验证码不能为空");
         }
         }

+ 3 - 3
src/main/java/com/caimei/service/auth/impl/UserServiceImpl.java

@@ -130,15 +130,15 @@ public class UserServiceImpl implements UserService {
     private ResponseJson<UserLoginVo> logonVerify(UserLoginVo loginUser) {
     private ResponseJson<UserLoginVo> logonVerify(UserLoginVo loginUser) {
         // 生成token给用户
         // 生成token给用户
         String token = JwtUtil.createToken(loginUser.getAuthUserId());
         String token = JwtUtil.createToken(loginUser.getAuthUserId());
-        // 为了过期续签,将token存入redis,并设置超时时间
-        redisService.set(token, token, JwtUtil.getExpireTime());
-        loginUser.setToken(token);
         // 供应商
         // 供应商
         if (null != loginUser.getShopStatus() && null != loginUser.getUserIdentity() && 2 == loginUser.getUserIdentity()) {
         if (null != loginUser.getShopStatus() && null != loginUser.getUserIdentity() && 2 == loginUser.getUserIdentity()) {
             if (0 == loginUser.getShopStatus()) {
             if (0 == loginUser.getShopStatus()) {
                 return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
                 return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
             }
             }
         }
         }
+        // 为了过期续签,将token存入redis,并设置超时时间
+        redisService.set(token, token, JwtUtil.getExpireTime());
+        loginUser.setToken(token);
         // 清除密码
         // 清除密码
         loginUser.setPassword(null);
         loginUser.setPassword(null);
         return ResponseJson.success("登录成功", loginUser);
         return ResponseJson.success("登录成功", loginUser);

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

@@ -48,9 +48,6 @@ public class ImageServiceImpl implements ImageService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<ImageListVo>> 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;
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<ImageListVo> imageList = imageMapper.getImageList(listType, authUserId, imageTitle, auditStatus, status);
         List<ImageListVo> imageList = imageMapper.getImageList(listType, authUserId, imageTitle, auditStatus, status);

+ 0 - 3
src/main/java/com/caimei/service/data/impl/VideoServiceImpl.java

@@ -53,9 +53,6 @@ public class VideoServiceImpl implements VideoService {
 
 
     @Override
     @Override
     public ResponseJson<PageInfo<VideoListVo>> 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;
         listType = null == listType ? 1 : listType;
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<VideoListVo> videoList = videoMapper.getVideoList(listType, authUserId, videoTitle, auditStatus, status);
         List<VideoListVo> videoList = videoMapper.getVideoList(listType, authUserId, videoTitle, auditStatus, status);

+ 2 - 2
src/main/java/com/caimei/utils/JwtUtil.java

@@ -106,8 +106,8 @@ public class JwtUtil {
      * @param token
      * @param token
      * @return
      * @return
      */
      */
-    /*public static String parseTokenAud(String token) {
+    public static String parseTokenAud(String token) {
         DecodedJWT jwt = JWT.decode(token);
         DecodedJWT jwt = JWT.decode(token);
         return jwt.getClaim("aud").asString();
         return jwt.getClaim("aud").asString();
-    }*/
+    }
 }
 }