| | |
| | | private final TExperimentDispatchService experimentDispatchService; |
| | | private final TProjectProposalService projectProposalService; |
| | | private final TExperimentDispatchGroupService experimentDispatchGroupService; |
| | | private final TProjectTeamStaffService projectTeamStaffService; |
| | | @Autowired |
| | | public TExperimentSchemeController(TExperimentSchemeService experimentSchemeService, TokenService tokenService, ISysUserService sysUserService, SysUserMapper sysUserMapper, TExperimentSchemePersonService experimentSchemePersonService, TExperimentDispatchParticipantsService experimentDispatchParticipantsService, TExperimentDispatchService experimentDispatchService, TProjectProposalService projectProposalService, TExperimentDispatchGroupService experimentDispatchGroupService) { |
| | | public TExperimentSchemeController(TExperimentSchemeService experimentSchemeService, TokenService tokenService, ISysUserService sysUserService, SysUserMapper sysUserMapper, TExperimentSchemePersonService experimentSchemePersonService, TExperimentDispatchParticipantsService experimentDispatchParticipantsService, TExperimentDispatchService experimentDispatchService, TProjectProposalService projectProposalService, TExperimentDispatchGroupService experimentDispatchGroupService, TProjectTeamStaffService projectTeamStaffService) { |
| | | this.experimentSchemeService = experimentSchemeService; |
| | | this.tokenService = tokenService; |
| | | this.sysUserService = sysUserService; |
| | |
| | | this.experimentDispatchService = experimentDispatchService; |
| | | this.projectProposalService = projectProposalService; |
| | | this.experimentDispatchGroupService = experimentDispatchGroupService; |
| | | this.projectTeamStaffService = projectTeamStaffService; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(experimentSchemeService.pageList(query)); |