| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TInspectionReportDTO; |
| | | import com.ruoyi.system.mapper.SysUserMapper; |
| | |
| | | // 查询项目组 |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | if(Objects.isNull(projectTeamStaff)){ |
| | | return R.fail("当前用户未加入项目组,无法进行操作"); |
| | | } |
| | | // 查询项目的工艺工程师id |
| | | TProjectTeamStaff teamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getTeamId, projectTeamStaff.getTeamId()) |
| | |
| | | @PostMapping(value = "/api/t-inspection-report/add") |
| | | public R<Boolean> add(@RequestBody String param) { |
| | | TInspectionReportDTO dto = JSON.parseObject(param,TInspectionReportDTO.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | dto.setCommitUserId(userId); |
| | | inspectionReportService.save(dto); |
| | | // 通过当前用户查询项目组 |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | |
| | | @PostMapping(value = "/api/t-inspection-report/update") |
| | | public R<Boolean> update(@RequestBody String param) { |
| | | TInspectionReportDTO dto = JSON.parseObject(param,TInspectionReportDTO.class); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | TInspectionReport inspectionReport = inspectionReportService.getById(dto.getId()); |
| | | |
| | | if (Objects.equals(roleType, 1) |
| | | && Objects.nonNull(inspectionReport) |
| | | && Objects.equals(inspectionReport.getStatus(), 2)) { |
| | | return R.fail("化验师已提交的检验报告不允许编辑"); |
| | | } |
| | | |
| | | if (SecurityUtils.isAdmin(SecurityUtils.getUserId())) { |
| | | dto.setStatus(null); |
| | | } |
| | | |
| | | inspectionReportService.updateById(dto); |
| | | if(dto.getStatus() != -1){ |
| | | if(dto.getStatus() != null && dto.getStatus() != -1){ |
| | | // 通过当前用户查询项目组 |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | |
| | | BeanUtils.copyProperties(inspectionReport, inspectionReportVO); |
| | | // 查询实验调度 |
| | | TExperimentDispatch experimentDispatch = experimentDispatchService.getById(inspectionReportVO.getDispatchId()); |
| | | // 查询项目课题 |
| | | TProjectProposal projectProposal = projectProposalService.getById(experimentDispatch.getProposalId()); |
| | | experimentDispatch.setProjectName(projectProposal.getProjectName()); |
| | | |
| | | if (experimentDispatch != null) { |
| | | // 查询项目课题 |
| | | TProjectProposal projectProposal = projectProposalService.getById(experimentDispatch.getProposalId()); |
| | | experimentDispatch.setProjectName(projectProposal.getProjectName()); |
| | | experimentDispatch.setProjectCode(projectProposal.getProjectCode()); |
| | | } |
| | | // 查询实验调度人员 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getDispatchId, inspectionReportVO.getDispatchId())); |