From b7cc7f6d263e70e696f40b0216ea031e02c4d971 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 6 Dec 2024 13:42:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E4=BC=91=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E4=BC=9A=E8=AE=AE=E4=BF=AE=E6=94=B9=E4=BD=BF=E7=94=A8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9C=BA=E8=BF=9B=E8=A1=8C=E7=8A=B6=E6=80=81=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/req/MeetingAppendProjectReq.java | 6 ++--- .../hz/pm/api/meeting/manage/MeetingManage.java | 27 ++++++++++++---------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java index 42cfe91..4a9c4f1 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java @@ -22,8 +22,8 @@ public class MeetingAppendProjectReq { @ApiModelProperty("会议ID") private Long meetingId; - @NotEmpty(message = "项目编码列表不能为空") - @ApiModelProperty("项目编码列表") - private List projectCodes; + @NotEmpty(message = "项目ID列表不能为空") + @ApiModelProperty("项目ID列表") + private List projectIds; } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java index d806a90..873c826 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java @@ -752,11 +752,22 @@ public class MeetingManage { try { Meeting meeting = meetingService.getById(meetingId); if (MeetingStatusEnum.CANCEL.eq(meeting.getStatus())) { - throw ReturnException.wrap("会议已取消"); + return; } if (meeting.getStartTime().isBefore(LocalDateTime.now())) { throw ReturnException.wrap("会议已开始,暂时无法取消"); } + if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { + // 取消项目时候重置项目状态 + List innerProjList = meetingInnerProjectService.listByMeetingId(meetingId); + if (CollUtil.anyMatch(innerProjList, w -> w.getReviewResult() != null)) { + throw ReturnException.wrap("已上传项目评审结果,会议无法取消!"); + } + List projectIds = CollUtils.fieldList(innerProjList, MeetingInnerProject::getProjectId); + List projects = projectService.listByIds(projectIds); + projects.forEach(projectStateMachineUtil::withDraw); + projectService.updateBatchById(projects); + } Wrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) .set(Meeting::getStatus, MeetingStatusEnum.CANCEL.getCode()) .eq(Meeting::getId, meetingId); @@ -768,14 +779,6 @@ public class MeetingManage { if (!experts.isEmpty()) { meetingNotifyHelper.sendCancelMeetingMsg(experts, meeting); } - if (Boolean.TRUE.equals(meeting.getIsInnerProject())) { - // 取消项目时候重置项目状态 - List meetingInnerProjects = meetingInnerProjectService.listByMeetingId(meetingId); - List projectIds = CollUtils.fieldList(meetingInnerProjects, MeetingInnerProject::getProjectId); - List projects = projectService.listByIds(projectIds); - projects.forEach(w -> w.setStatus(ProjectStatus.WITHOUT_EXPERT_REVIEW.getCode())); - projectService.updateBatchById(projects); - } // 将取消的会议推送给MH mhApiClient.cancelMeetingToMh(meetingId); } finally { @@ -1010,13 +1013,13 @@ public class MeetingManage { Meeting meeting = meetingService.getById(req.getMeetingId()); Assert.notNull(meeting, "会议不存在"); Assert.isTrue(MeetingStatusEnum.NORMAL.eq(meeting.getStatus()), "当前会议无法添加项目"); - List projectCodes = req.getProjectCodes(); + List projectCodes = CollUtils.convert(req.getProjectIds(), ProjectIdCodeCacheUtil::get); Wrapper query = Wrappers.lambdaQuery(MeetingInnerProject.class) .select(MeetingInnerProject::getMeetingId, MeetingInnerProject::getProjectCode, MeetingInnerProject::getId, MeetingInnerProject::getReviewResult) .in(MeetingInnerProject::getProjectCode, projectCodes); Collection linkedProjList = BizUtils.groupFirst(meetingInnerProjectService.list(query), - MeetingInnerProject::getProjectId, Comparator.comparing(MeetingInnerProject::getId).reversed()); + MeetingInnerProject::getProjectCode, Comparator.comparing(MeetingInnerProject::getId).reversed()); // 移除已关联当前会议的项目 projectCodes.removeIf(w -> CollUtil.anyMatch(linkedProjList, x -> x.getProjectCode().equals(w) && x.getMeetingId().equals(meeting.getId()))); @@ -1059,7 +1062,7 @@ public class MeetingManage { Meeting meeting = meetingService.getById(req.getMeetingId()); Assert.notNull(meeting, "会议不存在"); Assert.isTrue(MeetingStatusEnum.NORMAL.eq(meeting.getStatus()), "当前会议无法移除项目"); - List projectCodes = req.getProjectCodes(); + List projectCodes = CollUtils.convert(req.getProjectIds(), ProjectIdCodeCacheUtil::get); Wrapper query = Wrappers.lambdaQuery(MeetingInnerProject.class) .select(MeetingInnerProject::getId, MeetingInnerProject::getProjectCode, MeetingInnerProject::getReviewResult) .in(MeetingInnerProject::getProjectCode, projectCodes)