Browse Source

no message

FengChaoYu 3 weeks ago
parent
commit
b5c269b7fe

+ 0 - 8
src/main/java/com/gree/mall/manager/bean/admin/AdminDeptWebsitVO.java

@@ -1,9 +1,5 @@
 package com.gree.mall.manager.bean.admin;
 
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.gree.mall.manager.annotation.ZfireField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -27,19 +23,15 @@ public class AdminDeptWebsitVO {
     private String adminDeptId;
 
     @ApiModelProperty(value = "创建人")
-    @TableField(fill = FieldFill.INSERT)
     private String createBy;
 
     @ApiModelProperty(value = "创建时间")
-    @TableField(fill = FieldFill.INSERT)
     private Date createTime;
 
     @ApiModelProperty(value = "更新人")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
     private String updateBy;
 
     @ApiModelProperty(value = "更新时间")
-    @TableField(fill = FieldFill.INSERT_UPDATE)
     private Date updateTime;
 
     @ApiModelProperty(value = "网点编号")

+ 1 - 2
src/main/java/com/gree/mall/manager/controller/admin/AdminDeptController.java

@@ -58,8 +58,7 @@ public class AdminDeptController {
     public ResponseHelper<IPage<AdminDeptWebsitVO>> list(
             @RequestBody ZfireParamBean zfireParamBean
     ) throws RemoteServiceException {
-        ZfireParamBean zfireParam = FieldUtils.supplyParam(zfireParamBean);
-        IPage<AdminDeptWebsitVO> adminDeptVOIPage = adminDeptLogic.list(new Page(zfireParam.getPageNum(), zfireParam.getPageSize()), zfireParam);
+        IPage<AdminDeptWebsitVO> adminDeptVOIPage = adminDeptLogic.list(new Page(zfireParamBean.getPageNum(), zfireParamBean.getPageSize()), zfireParamBean);
         return ResponseHelper.success(adminDeptVOIPage, new TypeReference<AdminDeptWebsitVO>() {});
     }
 

+ 33 - 10
src/main/java/com/gree/mall/manager/logic/admin/AdminDeptLogic.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gree.mall.manager.bean.admin.AdminDeptTree;
 import com.gree.mall.manager.bean.admin.AdminDeptWebsitVO;
 import com.gree.mall.manager.bean.admin.AdminUserCom;
-import com.gree.mall.manager.bean.admin.reqDto.AdminUserPermissions;
 import com.gree.mall.manager.commonmapper.AdminMapper;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.logic.common.CommonLogic;
@@ -19,6 +18,7 @@ import com.gree.mall.manager.plus.service.AdminDeptWebsitService;
 import com.gree.mall.manager.plus.service.AdminUserPermissionsRelaService;
 import com.gree.mall.manager.plus.service.AdminWebsitService;
 import com.gree.mall.manager.utils.StringUtil;
+import com.gree.mall.manager.zfire.bean.QueryParamBean;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import com.gree.mall.manager.zfire.util.FieldUtils;
 import lombok.RequiredArgsConstructor;
@@ -51,17 +51,10 @@ public class AdminDeptLogic {
     public List<AdminDeptTree> tree(HttpServletRequest request) {
         final AdminUserCom adminUser = commonLogic.getAdminUser();
 
-        List<AdminDept> list;
-        if (adminUser.getType() == 0) {
-            list = adminDeptService.lambdaQuery()
+        List<AdminDept> list = adminDeptService.lambdaQuery()
+                    .in(CollectionUtil.isNotEmpty(adminUser.getAdminCompanyIds()), AdminDept::getCompanyWechatId, adminUser.getAdminCompanyIds())
                     .eq(AdminDept::getAdminDeptId, "1")
                     .list();
-        } else {
-            list = adminDeptService.lambdaQuery()
-                    .eq(AdminDept::getCompanyWechatId, adminUser.getLoginCompanyWechatId())
-                    .eq(AdminDept::getPId, "1")
-                    .list();
-        }
 
         List<AdminDeptTree> trees = new ArrayList<>();
         for (AdminDept adminDept : list) {
@@ -101,10 +94,40 @@ public class AdminDeptLogic {
         //获取当前登录企业id
         AdminUserCom adminUser = commonLogic.getAdminUser();
 
+        boolean isAll = false;
+        if (CollectionUtil.isNotEmpty(zfireParam.getParams())) {
+            for (QueryParamBean param : zfireParam.getParams()) {
+                if (param.getParam().equals("admin_dept_id") && param.getValue().equals("1")) {
+                    isAll = true;
+                    break;
+                }
+            }
+        }
+
         //1.组装查询条件
         FieldUtils.supplyParam(zfireParam, AdminDeptWebsitVO.class);
 
         IPage<AdminDeptWebsitVO> adminDeptWebsitVOIPage = adminMapper.list(page, zfireParam);
+        if (isAll) {
+            final List<AdminWebsit> websitList = adminWebsitService.lambdaQuery()
+                    .list();
+            if (CollectionUtil.isNotEmpty(websitList)) {
+                List<AdminDeptWebsitVO> voList = new ArrayList<>();
+                for (AdminWebsit websit : websitList) {
+                    AdminDeptWebsitVO vo = new AdminDeptWebsitVO();
+                    vo.setAdminDeptId("1");
+                    vo.setDeptName("平台");
+                    vo.setWebsitId(websit.getWebsitId());
+                    vo.setWebsitName(websit.getName());
+                    voList.add(vo);
+                }
+                if (CollectionUtil.isNotEmpty(voList)) {
+                    adminDeptWebsitVOIPage.setTotal(voList.size());
+                    adminDeptWebsitVOIPage.setPages(1);
+                    adminDeptWebsitVOIPage.setRecords(voList);
+                }
+            }
+        }
         return adminDeptWebsitVOIPage;
     }
 

+ 18 - 11
src/main/java/com/gree/mall/manager/logic/common/CommonLogic.java

@@ -117,10 +117,24 @@ public class CommonLogic {
     public AdminUserCom queryUserSysRela(AdminUserCom adminUserCom) {
         String userId = adminUserCom.getAdminUserId();
 
-        // 商户
+
         final List<AdminUserPermissionsRela> permissionsRelas = adminUserPermissionsRelaService.lambdaQuery()
                 .eq(AdminUserPermissionsRela::getAdminUserId, userId)
                 .list();
+
+        // 部门
+        final List<String> deptList = permissionsRelas.stream()
+                .filter(AdminUserPermissionsRela::getIsDept)
+                .map(AdminUserPermissionsRela::getAdminUserPermissionsId)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (CollectionUtil.isNotEmpty(deptList) && deptList.contains("1")) {
+            // 有平台权限,直接返回
+            return adminUserCom;
+        }
+
+        // 商户
         final List<String> companyList = permissionsRelas.stream()
                 .map(AdminUserPermissionsRela::getCompanyWechatId)
                 .distinct()
@@ -128,18 +142,13 @@ public class CommonLogic {
         adminUserCom.setAdminCompanyIds(companyList);
 
         // 商家
-        final List<String> websitList = permissionsRelas.stream()
+        List<String> websitList = permissionsRelas.stream()
                 .filter(v -> !v.getIsDept())
                 .map(AdminUserPermissionsRela::getAdminUserPermissionsId)
                 .distinct()
                 .collect(Collectors.toList());
+        adminUserCom.setAdminWebsitIds(websitList);
 
-        // 部门
-        final List<String> deptList = permissionsRelas.stream()
-                .filter(AdminUserPermissionsRela::getIsDept)
-                .map(AdminUserPermissionsRela::getAdminUserPermissionsId)
-                .distinct()
-                .collect(Collectors.toList());
         adminUserCom.setAdminDeptIds(deptList);
 
         if (CollectionUtil.isNotEmpty(deptList)) {
@@ -153,11 +162,9 @@ public class CommonLogic {
                         .collect(Collectors.toList());
                 websitList.addAll(websitIdList);
             }
+            adminUserCom.setAdminWebsitIds(websitList.stream().distinct().sorted().collect(Collectors.toList()));
         }
 
-        adminUserCom.setAdminWebsitIds(websitList.stream().distinct().sorted().collect(Collectors.toList()));
-//        adminUserCom.setOnlyRead(companyList.size() > 1);
-
         return adminUserCom;
     }