| | |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if (roleType != 1){ |
| | | query.setUserId(userId); |
| | | // 查询实验参与人员 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getUserId, userId)); |
| | | if(!CollectionUtils.isEmpty(experimentDispatchParticipants)){ |
| | | List<String> dispatchIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getDispatchId).distinct().collect(Collectors.toList()); |
| | | query.setDispatchIds(dispatchIds); |
| | | if(roleType ==2){ |
| | | // 查询项目组 |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | // 查询项目的工艺工程师id |
| | | TProjectTeamStaff teamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getTeamId, projectTeamStaff.getTeamId()) |
| | | .eq(TProjectTeamStaff::getRoleType, 3) |
| | | .last("LIMIT 1")); |
| | | // 查询实验参与人员 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getUserId, teamStaff.getUserId())); |
| | | if(!CollectionUtils.isEmpty(experimentDispatchParticipants)){ |
| | | List<String> dispatchIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getDispatchId).distinct().collect(Collectors.toList()); |
| | | query.setDispatchIds(dispatchIds); |
| | | } |
| | | }else { |
| | | // 查询实验参与人员 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getUserId, userId)); |
| | | if(!CollectionUtils.isEmpty(experimentDispatchParticipants)){ |
| | | List<String> dispatchIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getDispatchId).distinct().collect(Collectors.toList()); |
| | | query.setDispatchIds(dispatchIds); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(experimentDispatchService.pageList(query)); |