| | |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if (roleType != 1){ |
| | | query.setUserId(userId); |
| | | 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(samplingRecordService.pageList(query)); |
| | |
| | | public R<Boolean> batchSendSamples(@RequestBody String param) { |
| | | BatchSendSamplesDTO batchSendSamplesDTO = JSON.parseObject(param, BatchSendSamplesDTO.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | List<String> ids = batchSendSamplesDTO.getRecordOperationId(); |
| | | // 批量送样 |
| | | samplingRecordOperationService.update(Wrappers.lambdaUpdate(TSamplingRecordOperation.class) |
| | | .eq(TSamplingRecordOperation::getId, batchSendSamplesDTO.getRecordOperationId()) |
| | | .set(TSamplingRecordOperation::getStatus, 2) |
| | | .set(TSamplingRecordOperation::getSendSign, batchSendSamplesDTO.getSendSign()) |
| | | .set(TSamplingRecordOperation::getSendTime, LocalDateTime.now()) |
| | | .set(TSamplingRecordOperation::getSendPersonId, userId)); |
| | | List<TSamplingRecordOperation> samplingRecordOperations = samplingRecordOperationService.list(Wrappers.lambdaQuery(TSamplingRecordOperation.class) |
| | | .in(TSamplingRecordOperation::getId, ids)); |
| | | for (TSamplingRecordOperation samplingRecordOperation : samplingRecordOperations) { |
| | | samplingRecordOperation.setStatus(2); |
| | | samplingRecordOperation.setSendPersonId(userId); |
| | | samplingRecordOperation.setSendSign(samplingRecordOperation.getSendSign()); |
| | | samplingRecordOperation.setSendTime(LocalDateTime.now()); |
| | | } |
| | | samplingRecordOperationService.updateBatchById(samplingRecordOperations); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | public R<Boolean> batchCollectSamples(@RequestBody String param) { |
| | | BatchCollectSamplesDTO batchCollectSamplesDTO = JSON.parseObject(param, BatchCollectSamplesDTO.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | List<String> ids = batchCollectSamplesDTO.getRecordOperationId(); |
| | | // 批量送样 |
| | | samplingRecordOperationService.update(Wrappers.lambdaUpdate(TSamplingRecordOperation.class) |
| | | .eq(TSamplingRecordOperation::getId, batchCollectSamplesDTO.getRecordOperationId()) |
| | | .set(TSamplingRecordOperation::getStatus, 3) |
| | | .set(TSamplingRecordOperation::getReceiptsSign, batchCollectSamplesDTO.getReceiptsSign()) |
| | | .set(TSamplingRecordOperation::getReceiptsTime, LocalDateTime.now()) |
| | | .set(TSamplingRecordOperation::getReceiptsPersonId, userId)); |
| | | List<TSamplingRecordOperation> samplingRecordOperations = samplingRecordOperationService.list(Wrappers.lambdaQuery(TSamplingRecordOperation.class) |
| | | .in(TSamplingRecordOperation::getId, ids)); |
| | | for (TSamplingRecordOperation samplingRecordOperation : samplingRecordOperations) { |
| | | samplingRecordOperation.setStatus(3); |
| | | samplingRecordOperation.setSendPersonId(userId); |
| | | samplingRecordOperation.setSendSign(samplingRecordOperation.getReceiptsSign()); |
| | | samplingRecordOperation.setSendTime(LocalDateTime.now()); |
| | | } |
| | | samplingRecordOperationService.updateBatchById(samplingRecordOperations); |
| | | return R.ok(); |
| | | } |
| | | |