JiangChongBo 2 anni fa
parent
commit
9a3688f89f

+ 15 - 2
src/main/java/com/caimei/controller/admin/auth/DownloadApi.java

@@ -1,6 +1,8 @@
 package com.caimei.controller.admin.auth;
 
+import com.caimei.annotation.CurrentUser;
 import com.caimei.model.ResponseJson;
+import com.caimei.model.po.SysUser;
 import com.caimei.service.auth.DownloadService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -90,11 +92,22 @@ public class DownloadApi {
         return downloadService.downloadProductData(authIds, request, response);
     }
     @GetMapping("/Clubuser/excel")
-    public ResponseJson downloadClubuserlistInfo(String clubUserIds, HttpServletResponse response){
+    public ResponseJson downloadClubuserlistInfo(@CurrentUser SysUser sysUser,String clubUserIds, HttpServletResponse response){
 //        if (StringUtils.isEmpty(clubUserIds)) {
 //            return ResponseJson.error("用户id不能为空");
 //        }
+        Integer authUserId=null;
+        if (null != sysUser && 1 != sysUser.getId()) {
+            // 获取供应商用户id
+            Integer userIdentity = sysUser.getUserIdentity();
+            authUserId = 2 == userIdentity ? sysUser.getId() : 3 == userIdentity ? sysUser.getParentId() : null;
+            if (null == authUserId) {
+                return ResponseJson.error("供应商用户id不能为空", null);
+            }
+        } else if (null == authUserId) {
+            return ResponseJson.error("供应商用户id不能为空", null);
+        }
         //clubUserIds为空则导出全部数据
-        return downloadService.downloadClubuserlistInfo(clubUserIds,response);
+        return downloadService.downloadClubuserlistInfo(authUserId,clubUserIds,response);
     }
 }

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

@@ -220,5 +220,5 @@ public interface AuthMapper {
 
     String getAuthparty(Integer authUserId);
 
-    List<ClubUserVo> getclubuserInfo(@Param("clubUserIds")String clubUserIds);
+    List<ClubUserVo> getclubuserInfo(Integer authUserId,@Param("clubUserIds")String clubUserIds);
 }

+ 1 - 1
src/main/java/com/caimei/service/auth/DownloadService.java

@@ -47,5 +47,5 @@ public interface DownloadService {
      * @param response
      * @return
      */
-    ResponseJson downloadClubuserlistInfo(String clubUserIds, HttpServletResponse response);
+    ResponseJson downloadClubuserlistInfo(Integer authUserId,String clubUserIds, HttpServletResponse response);
 }

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

@@ -493,11 +493,11 @@ public class DownloadServiceImpl implements DownloadService {
      * @return
      */
     @Override
-    public ResponseJson downloadClubuserlistInfo(String clubUserIds, HttpServletResponse response) {
+    public ResponseJson downloadClubuserlistInfo(Integer authUserId,String clubUserIds, HttpServletResponse response) {
         //导出的用户表名
         String fileName=new String("用户信息.xlsx".getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1);
         //获取用户信息
-        List<ClubUserVo> clubUserVosList = authMapper.getclubuserInfo(clubUserIds);
+        List<ClubUserVo> clubUserVosList = authMapper.getclubuserInfo(authUserId,clubUserIds);
         try {
             OutputStream outputStream = response.getOutputStream();
             response.reset();
@@ -557,7 +557,7 @@ public class DownloadServiceImpl implements DownloadService {
                 if(null!=club.getStatus()&&club.getStatus()==1){
                     authData.add("启用");
 
-                }else if(null!=club.getStatus()&&club.getStatus()==1){
+                }else if(null!=club.getStatus()&&club.getStatus()==0){
                     authData.add("停用");
                 }
                 for (int j = 0; j < authData.size(); j++) {

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

@@ -924,8 +924,9 @@
                cu.status
         from cm_brand_club_user cu
         LEFT JOIN cm_brand_auth a ON cu.authId = a.id
+        where a.authUserId=#{authUserId}
         <if test="clubUserIds != null and clubUserIds!=''">
-            where find_in_set(cu.id,#{clubUserIds})
+           and  find_in_set(cu.id,#{clubUserIds})
         </if>
     </select>
 </mapper>