From 4afcd102fd49874b304ce1ef4ba506c77cc7c397 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 26 六月 2025 19:32:45 +0800 Subject: [PATCH] bug修改 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTestMethodConfirmSheetController.java | 42 +++++++++++++++++++++++++++++++----------- 1 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTestMethodConfirmSheetController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTestMethodConfirmSheetController.java index a079a3d..e3a7333 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTestMethodConfirmSheetController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTestMethodConfirmSheetController.java @@ -123,18 +123,29 @@ public R<Boolean> add(@RequestBody String param) { TTestMethodConfirmSheetDTO dto = JSON.parseObject(param,TTestMethodConfirmSheetDTO.class); Long userId = tokenService.getLoginUser().getUserId(); - dto.setCommitUserId(userId); - testMethodConfirmSheetService.save(dto); - List<TTestMethodConfirmSheetTerm> testMethodConfirmSheetTerms = dto.getTestMethodConfirmSheetTerms(); - testMethodConfirmSheetTerms.forEach(testMethodConfirmSheetTerm -> { - testMethodConfirmSheetTerm.setTestId(dto.getId()); - testMethodConfirmSheetTerm.setStatus(1); - }); - testMethodConfirmSheetTermService.saveBatch(testMethodConfirmSheetTerms); - // 通过当前用户查询项目组 - TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) - .eq(TProjectTeamStaff::getUserId, userId) + + TExperimentDispatch experimentDispatch = experimentDispatchService.getOne(Wrappers.lambdaQuery(TExperimentDispatch.class) + .eq(TExperimentDispatch::getId, dto.getDispatchId())); + if(Objects.isNull(experimentDispatch)){ + return R.fail("实验调度不存在"); + } + + // 查询调度的参与人员 + TExperimentDispatchParticipants experimentDispatchParticipant = experimentDispatchParticipantsService.getOne(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) + .eq(TExperimentDispatchParticipants::getDispatchId, dto.getDispatchId()) + .eq(TExperimentDispatchParticipants::getRoleType,3) .last("LIMIT 1")); + if(Objects.isNull(experimentDispatchParticipant)){ + return R.fail("实验调度参与人员不存在"); + } + + // 查询工艺工程师所在的项目组 + TProjectTeamStaff projectTeamStaff = projectTeamStaffService.getOne(Wrappers.lambdaQuery(TProjectTeamStaff.class) + .eq(TProjectTeamStaff::getUserId, experimentDispatchParticipant.getUserId()) + .eq(TProjectTeamStaff::getRoleType, 3) + .last("LIMIT 1")); + + // 通过当前用户查询项目组 if(Objects.isNull(projectTeamStaff)){ return R.fail("当前用户未分配项目组,无法创建项目课题方案"); } @@ -146,6 +157,15 @@ if(projectTeam.getStatus() == 2){ return R.fail("项目组已封存,无法创建项目课题方案"); } + + dto.setCommitUserId(userId); + testMethodConfirmSheetService.save(dto); + List<TTestMethodConfirmSheetTerm> testMethodConfirmSheetTerms = dto.getTestMethodConfirmSheetTerms(); + testMethodConfirmSheetTerms.forEach(testMethodConfirmSheetTerm -> { + testMethodConfirmSheetTerm.setTestId(dto.getId()); + testMethodConfirmSheetTerm.setStatus(1); + }); + testMethodConfirmSheetTermService.saveBatch(testMethodConfirmSheetTerms); // 生成原始记录编号 String format = new SimpleDateFormat("yyyyMMdd").format(new Date()); String originalCode = projectTeam.getTeamName() + format.substring(2) + "-JL"; -- Gitblit v1.7.1