| | |
| | | * 查询化验师的通过签字的实验调度 |
| | | */ |
| | | @ApiOperation(value = "查询化验师的通过签字的实验调度") |
| | | @GetMapping(value = "/open/t-experiment-dispatch/chemistSignList") |
| | | public R<List<TExperimentDispatch>> chemistSignList() { |
| | | @PostMapping(value = "/api/t-experiment-dispatch/chemistSignList") |
| | | public R<PageInfo<TExperimentDispatch>> chemistSignList(@RequestBody String param) { |
| | | TExperimentDispatchQuery query = JSON.parseObject(param, TExperimentDispatchQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType != 4){ |
| | |
| | | return R.fail("您没有通过签字的实验调度"); |
| | | } |
| | | List<String> dispatchIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getDispatchId).distinct().collect(Collectors.toList()); |
| | | List<TExperimentDispatch> experimentDispatches = experimentDispatchService.list(Wrappers.lambdaQuery(TExperimentDispatch.class) |
| | | .in(TExperimentDispatch::getId, dispatchIds) |
| | | .in(TExperimentDispatch::getStatus, 1, 2)); |
| | | List<String> proposalIds = experimentDispatches.stream().map(TExperimentDispatch::getProposalId).collect(Collectors.toList()); |
| | | List<TProjectProposal> list = projectProposalService.list(Wrappers.lambdaQuery(TProjectProposal.class).in(TProjectProposal::getId, proposalIds)); |
| | | |
| | | // 查询参与人员 |
| | | List<String> ids = experimentDispatches.stream().map(TExperimentDispatch::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TExperimentDispatchParticipants> tExperimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .in(TExperimentDispatchParticipants::getDispatchId, ids)); |
| | | List<Long> userIds = tExperimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getUserId).collect(Collectors.toList()); |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(userIds); |
| | | tExperimentDispatchParticipants.forEach(tExperimentDispatchParticipant -> { |
| | | SysUser sysUser = sysUsers.stream().filter(user -> user.getUserId().equals(tExperimentDispatchParticipant.getUserId())).findFirst().orElse(null); |
| | | if(sysUser != null){ |
| | | tExperimentDispatchParticipant.setNickName(sysUser.getNickName()); |
| | | } |
| | | }); |
| | | experimentDispatches.forEach(experimentDispatch -> { |
| | | list.stream().filter(projectProposal -> projectProposal.getId().equals(experimentDispatch.getProposalId())).findFirst().ifPresent(projectProposal -> { |
| | | experimentDispatch.setProjectName(projectProposal.getProjectName()); |
| | | }); |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipantsList = tExperimentDispatchParticipants.stream().filter(tExperimentDispatchParticipant -> tExperimentDispatchParticipant.getDispatchId().equals(experimentDispatch.getId())).collect(Collectors.toList()); |
| | | String participantsName = experimentDispatchParticipantsList.stream().map(TExperimentDispatchParticipants::getNickName).collect(Collectors.joining(";")); |
| | | experimentDispatch.setParticipantsName(participantsName); |
| | | }); |
| | | } |
| | | |
| | | query.setDispatchIds(dispatchIds); |
| | | PageInfo<TExperimentDispatch> experimentDispatches = experimentDispatchService.chemistSignList(query); |
| | | return R.ok(experimentDispatches); |
| | | } |
| | | |