| | |
| | | public PageInfo<TExperimentResultReportVO> evaluatePageList(TExperimentResultReportQuery query) { |
| | | PageInfo<TExperimentResultReportVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TExperimentResultReportVO> list = this.baseMapper.evaluatePageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | List<String> dispatchIds = list.stream().map(TExperimentResultReportVO::getDispatchId).distinct().collect(Collectors.toList()); |
| | | // 查询参与人员 |
| | | List<TExperimentDispatchParticipants> tExperimentDispatchParticipants = experimentDispatchParticipantsMapper.selectList(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .in(TExperimentDispatchParticipants::getDispatchId, dispatchIds)); |
| | | |
| | | // 设置参与人员名称 |
| | | 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()); |
| | | tExperimentDispatchParticipant.setAvatar(sysUser.getAvatar()); |
| | | } |
| | | }); |
| | | |
| | | List<String> ids = list.stream().map(TExperimentResultReportVO::getId).distinct().collect(Collectors.toList()); |
| | | // 查询结果汇报评价 |
| | | List<TResultWorkEvaluate> resultWorkEvaluates = resultWorkEvaluateMapper.selectList(Wrappers.lambdaQuery(TResultWorkEvaluate.class) |
| | | .in(TResultWorkEvaluate::getResultReportId, ids)); |
| | | for (TExperimentResultReportVO experimentResultReportVO : list) { |
| | | experimentResultReportVO.setExperimentDispatchParticipants(tExperimentDispatchParticipants.stream().filter(participants -> participants.getDispatchId().equals(experimentResultReportVO.getDispatchId())).collect(Collectors.toList())); |
| | | experimentResultReportVO.setResultWorkEvaluates(resultWorkEvaluates.stream().filter(evaluate -> evaluate.getResultReportId().equals(experimentResultReportVO.getId())).collect(Collectors.toList())); |
| | | // 设置工艺工程师名称 |
| | | TExperimentDispatchParticipants dispatchParticipants = tExperimentDispatchParticipants.stream() |
| | | .filter(participants -> participants.getDispatchId().equals(experimentResultReportVO.getDispatchId()) |
| | | && participants.getRoleType().equals(3)).findFirst().orElse(null); |
| | | if(dispatchParticipants != null){ |
| | | experimentResultReportVO.setProcessEngineerName(dispatchParticipants.getNickName()); |
| | | } |
| | | // 设置化验师名称 |
| | | List<TExperimentDispatchParticipants> laboratoryChemist = tExperimentDispatchParticipants.stream() |
| | | .filter(participants -> participants.getDispatchId().equals(experimentResultReportVO.getDispatchId()) |
| | | && participants.getRoleType().equals(4)).collect(Collectors.toList()); |
| | | List<TResultWorkEvaluate> chemistEvaluates = resultWorkEvaluates.stream() |
| | | .filter(workEvaluate -> workEvaluate.getDispatchId().equals(experimentResultReportVO.getDispatchId()) |
| | | && workEvaluate.getEvaluateType().equals(2)).collect(Collectors.toList()); |
| | | if(laboratoryChemist.size() == chemistEvaluates.size()){ |
| | | experimentResultReportVO.setLaboratoryChemistEvaluate(1); |
| | | } |
| | | if(!CollectionUtils.isEmpty(laboratoryChemist)){ |
| | | String laboratoryChemistName = laboratoryChemist.stream().map(TExperimentDispatchParticipants::getNickName).collect(Collectors.joining(",")); |
| | | experimentResultReportVO.setLaboratoryChemistName(laboratoryChemistName); |
| | | } |
| | | // 设置实验员名称 |
| | | List<TExperimentDispatchParticipants> experimenter = tExperimentDispatchParticipants.stream() |
| | | .filter(participants -> participants.getDispatchId().equals(experimentResultReportVO.getDispatchId()) |
| | | && participants.getRoleType().equals(5)).collect(Collectors.toList()); |
| | | List<TResultWorkEvaluate> experimenterEvaluates = resultWorkEvaluates.stream() |
| | | .filter(workEvaluate -> workEvaluate.getDispatchId().equals(experimentResultReportVO.getDispatchId()) |
| | | && workEvaluate.getEvaluateType().equals(3)).collect(Collectors.toList()); |
| | | if(experimenter.size() == experimenterEvaluates.size()){ |
| | | experimentResultReportVO.setExperimenterEvaluate(1); |
| | | } |
| | | if(!CollectionUtils.isEmpty(experimenter)){ |
| | | String experimenterName = experimenter.stream().map(TExperimentDispatchParticipants::getNickName).collect(Collectors.joining(",")); |
| | | experimentResultReportVO.setExperimenterName(experimenterName); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |