diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/RoleNameAndSelectTypeVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/RoleNameAndSelectTypeVO.java index bb82e57..a84880b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/RoleNameAndSelectTypeVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/RoleNameAndSelectTypeVO.java @@ -8,4 +8,6 @@ public class RoleNameAndSelectTypeVO { private String roleName; //值 private Long value; + // + private Long deptId; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index c583515..cacc613 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -478,6 +478,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 仅自己权限 roleNameAndSelectTypeVO.setRoleName("self"); roleNameAndSelectTypeVO.setValue(loginUserId); + roleNameAndSelectTypeVO.setDeptId(user.getDeptId()); } } else { //如果岗位不存在查询角色 @@ -501,6 +502,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 仅自己权限 roleNameAndSelectTypeVO.setRoleName("self"); roleNameAndSelectTypeVO.setValue(loginUserId); + roleNameAndSelectTypeVO.setDeptId(user.getDeptId()); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java index 01a0980..78b7293 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterpriseinspections/EnterpriseInspectionsServiceImpl.java @@ -187,19 +187,21 @@ public class EnterpriseInspectionsServiceImpl implements EnterpriseInspectionsSe public PageResult getEnterpriseInspectionsPage(EnterpriseInspectionsPageReqVO pageReqVO) { RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId(); - if ("self".equals(typeVO.getRoleName())) { - pageReqVO.setUserId(typeVO.getValue()); - } - - if ("queue".equals(typeVO.getRoleName())) { - pageReqVO.setDepartmentId(typeVO.getValue()); - final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", typeVO.getValue())); - if (adminUserDOS != null || adminUserDOS.size() > 0) { - final List collect = adminUserDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); - pageReqVO.setUserIds(collect); + if ("self".equals(typeVO.getRoleName()) || "queue".equals(typeVO.getRoleName()) ) { + if (pageReqVO.getUserId() == null) { + pageReqVO.setUserId(getLoginUserId()); } } +// if ("queue".equals(typeVO.getRoleName())) { +// pageReqVO.setDepartmentId(typeVO.getValue()); +// final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", typeVO.getValue())); +// if (adminUserDOS != null || adminUserDOS.size() > 0) { +// final List collect = adminUserDOS.stream().map(item -> item.getId()).collect(Collectors.toList()); +// pageReqVO.setUserIds(collect); +// } +// } + //按照部门查询 if (pageReqVO.getDepartmentId() != null) { final List adminUserDOS = adminUserMapper.selectList(new QueryWrapper().eq("dept_id", pageReqVO.getDepartmentId())); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java index e6698d1..a6c8e53 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.system.service.home; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.auth.vo.RoleNameAndSelectTypeVO; import cn.iocoder.yudao.module.system.controller.admin.home.vo.*; import cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo.TaskInfoPageReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO; @@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO; import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper; import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper; import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper; +import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; @@ -27,14 +29,26 @@ public class HomeServiceImpl implements HomeService{ @Resource private EnterpriseMapper enterpriseMapper; - @Resource - private TaskInfoService taskInfoService; @Resource private TaskInfoMapper taskInfoMapper; + @Resource + private AdminAuthService authService; @Override public HomeCountResVO appCount1(HomeSelectVO homeSelectVO) { + //如果不传部门id 上来就是根据用户的所在的部门查询 + RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId(); + + if (homeSelectVO.getDeptId() == null) { + if ("self".equals(typeVO.getRoleName())) { + homeSelectVO.setDeptId(typeVO.getDeptId()); + } + if ("queue".equals(typeVO.getRoleName())) { + homeSelectVO.setDeptId(typeVO.getValue()); + } + } + HomeCountResVO homeCountResVO = new HomeCountResVO(); //查企业 @@ -117,6 +131,16 @@ public class HomeServiceImpl implements HomeService{ @Override public List appCount2(HomeSelectVO homeSelectVO) { + RoleNameAndSelectTypeVO typeVO = authService.roleTypeByUserId(); + if (homeSelectVO.getDeptId() == null) { + if ("self".equals(typeVO.getRoleName())) { + homeSelectVO.setDeptId(typeVO.getDeptId()); + } + if ("queue".equals(typeVO.getRoleName())) { + homeSelectVO.setDeptId(typeVO.getValue()); + } + } + if (homeSelectVO.getSelectWeek() != null) { homeSelectVO.setTime(this.getWeekDate(homeSelectVO.getSelectWeek())); }