Przeglądaj źródła

feat:

1. 休取消会议修改使用状态机进行状态变更;
tags/24121201
WendyYang 1 miesiąc temu
rodzic
commit
b7cc7f6d26
2 zmienionych plików z 18 dodań i 15 usunięć
  1. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java
  2. +15
    -12
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java

+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/req/MeetingAppendProjectReq.java Wyświetl plik

@@ -22,8 +22,8 @@ public class MeetingAppendProjectReq {
@ApiModelProperty("会议ID")
private Long meetingId;

@NotEmpty(message = "项目编码列表不能为空")
@ApiModelProperty("项目编码列表")
private List<String> projectCodes;
@NotEmpty(message = "项目ID列表不能为空")
@ApiModelProperty("项目ID列表")
private List<Long> projectIds;

}

+ 15
- 12
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java Wyświetl plik

@@ -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<MeetingInnerProject> innerProjList = meetingInnerProjectService.listByMeetingId(meetingId);
if (CollUtil.anyMatch(innerProjList, w -> w.getReviewResult() != null)) {
throw ReturnException.wrap("已上传项目评审结果,会议无法取消!");
}
List<Long> projectIds = CollUtils.fieldList(innerProjList, MeetingInnerProject::getProjectId);
List<Project> projects = projectService.listByIds(projectIds);
projects.forEach(projectStateMachineUtil::withDraw);
projectService.updateBatchById(projects);
}
Wrapper<Meeting> 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<MeetingInnerProject> meetingInnerProjects = meetingInnerProjectService.listByMeetingId(meetingId);
List<Long> projectIds = CollUtils.fieldList(meetingInnerProjects, MeetingInnerProject::getProjectId);
List<Project> 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<String> projectCodes = req.getProjectCodes();
List<String> projectCodes = CollUtils.convert(req.getProjectIds(), ProjectIdCodeCacheUtil::get);
Wrapper<MeetingInnerProject> query = Wrappers.lambdaQuery(MeetingInnerProject.class)
.select(MeetingInnerProject::getMeetingId, MeetingInnerProject::getProjectCode,
MeetingInnerProject::getId, MeetingInnerProject::getReviewResult)
.in(MeetingInnerProject::getProjectCode, projectCodes);
Collection<MeetingInnerProject> 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<String> projectCodes = req.getProjectCodes();
List<String> projectCodes = CollUtils.convert(req.getProjectIds(), ProjectIdCodeCacheUtil::get);
Wrapper<MeetingInnerProject> query = Wrappers.lambdaQuery(MeetingInnerProject.class)
.select(MeetingInnerProject::getId, MeetingInnerProject::getProjectCode, MeetingInnerProject::getReviewResult)
.in(MeetingInnerProject::getProjectCode, projectCodes)


Ładowanie…
Anuluj
Zapisz