diff --git a/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java index 7ee3b094..bc991250 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/AssessServiceImpl.java @@ -5,7 +5,9 @@ import com.google.common.collect.Lists; import com.lz.common.utils.DateUtils; import com.lz.common.utils.PageUtils; import com.lz.common.utils.StringUtil; +import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.service.DepartmentsStaffRelateService; import com.lz.modules.app.service.StaffService; import com.lz.modules.flow.entity.FlowStart; import com.lz.modules.flow.entity.StaffRole; @@ -52,6 +54,8 @@ public class AssessServiceImpl implements AssessService { private StaffRoleService staffRoleService; @Autowired private FlowStartService flowStartService; + @Autowired + private DepartmentsStaffRelateService departmentsStaffRelateService; @Override public PageUtils userTaskList(AssessTaskReq req,Long userId) { @@ -101,21 +105,29 @@ public class AssessServiceImpl implements AssessService { return null; } else { - List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); - if (CollectionUtils.isNotEmpty(staffRoleDepartments)) { - List allDepart = new ArrayList<>(); - staffRoleDepartments.forEach(staffRoleDepartment -> { - List strings = staffService.selectAllDeparmentIdsByDepartmentParentId(staffRoleDepartment.getDepartmentId()); - allDepart.addAll(strings); - }); - - List collect = allDepart.stream().distinct().collect(Collectors.toList()); - log.info("获取到权限对应的部门 " + JSON.toJSONString(collect)); - return collect; + if (staffRole.getDepartmentId() == 1) { + DepartmentsStaffRelateEntity entity = departmentsStaffRelateService.selectByStaffId(staffId); + List strings = staffService.selectAllDeparmentIdsByDepartmentParentId(entity.getDepartmentId()); + log.info("获取到权限对应的部门 " + JSON.toJSONString(strings)); + return strings; } - log.info("未获取到用户权限对应的部门 roleID: " + staffRole.getId()); - return Collections.EMPTY_LIST; - } + else if(staffRole.getDepartmentId() == 2){ + List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); + if (CollectionUtils.isNotEmpty(staffRoleDepartments)) { + List allDepart = new ArrayList<>(); + staffRoleDepartments.forEach(staffRoleDepartment -> { + List strings = staffService.selectAllDeparmentIdsByDepartmentParentId(staffRoleDepartment.getDepartmentId()); + allDepart.addAll(strings); + }); + List collect = allDepart.stream().distinct().collect(Collectors.toList()); + log.info("获取到权限对应的部门 " + JSON.toJSONString(collect)); + return collect; + } + + } + } + log.info("未获取到用户权限对应的部门 roleID: " + staffRole.getId()); + return Collections.EMPTY_LIST; } }