This commit is contained in:
杜建超 2020-11-10 17:40:21 +08:00
parent da7f9f0c88
commit 46b7a7591c

View File

@ -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<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
if (CollectionUtils.isNotEmpty(staffRoleDepartments)) {
List<String> allDepart = new ArrayList<>();
staffRoleDepartments.forEach(staffRoleDepartment -> {
List<String> strings = staffService.selectAllDeparmentIdsByDepartmentParentId(staffRoleDepartment.getDepartmentId());
allDepart.addAll(strings);
});
List<String> collect = allDepart.stream().distinct().collect(Collectors.toList());
log.info("获取到权限对应的部门 " + JSON.toJSONString(collect));
return collect;
if (staffRole.getDepartmentId() == 1) {
DepartmentsStaffRelateEntity entity = departmentsStaffRelateService.selectByStaffId(staffId);
List<String> 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<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
if (CollectionUtils.isNotEmpty(staffRoleDepartments)) {
List<String> allDepart = new ArrayList<>();
staffRoleDepartments.forEach(staffRoleDepartment -> {
List<String> strings = staffService.selectAllDeparmentIdsByDepartmentParentId(staffRoleDepartment.getDepartmentId());
allDepart.addAll(strings);
});
List<String> collect = allDepart.stream().distinct().collect(Collectors.toList());
log.info("获取到权限对应的部门 " + JSON.toJSONString(collect));
return collect;
}
}
}
log.info("未获取到用户权限对应的部门 roleID: " + staffRole.getId());
return Collections.EMPTY_LIST;
}
}