| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | | import com.ruoyi.system.mapper.TExperimentDispatchParticipantsMapper; |
| | | import com.ruoyi.system.mapper.TSamplingRecordMapper; |
| | | import com.ruoyi.system.mapper.TSamplingRecordOperationMapper; |
| | | import com.ruoyi.system.model.TExperimentDispatchParticipants; |
| | | import com.ruoyi.system.model.TSamplingRecord; |
| | | import com.ruoyi.system.model.TSamplingRecordOperation; |
| | | import com.ruoyi.system.query.TSamplingRecordQuery; |
| | |
| | | |
| | | @Autowired |
| | | private TSamplingRecordOperationMapper samplingRecordOperationMapper; |
| | | @Autowired |
| | | private TExperimentDispatchParticipantsMapper experimentDispatchParticipantsMapper; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TSamplingRecordVO> pageList(TSamplingRecordQuery query) { |
| | |
| | | item.setReceivedCount(recordOperationList.stream().filter(recordOperation -> recordOperation.getSamplingId().equals(item.getId()) && recordOperation.getStatus() == 3).count()); |
| | | }); |
| | | |
| | | // 查询实验调度参与实验员 |
| | | List<String> dispatchIds = list.stream().map(TSamplingRecordVO::getDispatchId).collect(Collectors.toList()); |
| | | List<TExperimentDispatchParticipants> teamStaffs = experimentDispatchParticipantsMapper.selectList(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .in(TExperimentDispatchParticipants::getDispatchId, dispatchIds) |
| | | .eq(TExperimentDispatchParticipants::getRoleType, 5)); |
| | | List<Long> userIds = teamStaffs.stream().map(TExperimentDispatchParticipants::getUserId).collect(Collectors.toList()); |
| | | List<SysUser> sysUsers = sysUserMapper.selectUserByIds(userIds); |
| | | teamStaffs.stream().forEach(teamStaff -> { |
| | | sysUsers.stream().filter(sysUser -> sysUser.getUserId().equals(teamStaff.getUserId())).findFirst().ifPresent(sysUser -> { |
| | | teamStaff.setNickName(sysUser.getNickName()); |
| | | }); |
| | | }); |
| | | |
| | | for (TSamplingRecordVO tSamplingRecordVO : list) { |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = teamStaffs.stream().filter(teamStaff -> teamStaff.getDispatchId().equals(tSamplingRecordVO.getDispatchId())).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(experimentDispatchParticipants)){ |
| | | tSamplingRecordVO.setTesterNames(experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getNickName).collect(Collectors.joining(","))); |
| | | } |
| | | } |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |