From 47d1a01a168254aec6c56a7a4ce5ff57db5c70fe Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 17 Mar 2023 11:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BC=9A=E8=AE=AE=E5=85=B3?= =?UTF-8?q?=E8=81=94=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting/controller/MeetingController.java | 8 +++++ .../pmapi/meeting/manage/MeetingManage.java | 37 +++++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java index 7afcac3..1fc83a0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java @@ -12,10 +12,12 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; +import lombok.Getter; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.List; /** *

@@ -179,4 +181,10 @@ public class MeetingController { return meetingManage.optionProject(req); } + @GetMapping("/{meetingId}/projects") + @ApiOperation("会议关联项目列表") + public List projectsByMeetingId(@PathVariable Long meetingId) { + return meetingManage.projectsByMeetingId(meetingId); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 261f4a1..7455044 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -727,21 +727,36 @@ public class MeetingManage { Page page = projectService.page(req.page(), query); PageVo result = PageVo.of(null, page.getTotal()); if (result.getTotal() > 0) { - List projects = CollUtils.convert(page.getRecords(), - w -> ProjectLibListItemVO - .builder() - .id(w.getId()) - .projectName(w.getProjectName()) - .declaredAmount(w.getDeclareAmount()) - .projectType(w.getProjectType()) - .projectYear(w.getProjectYear()) - .buildOrg(w.getBuildOrgName()) - .build()); - result.setRecords(projects); + result.setRecords(CollUtils.convert(page.getRecords(), this::buildProjectList)); } return result; } + public List projectsByMeetingId(Long meetingId) { + Meeting meeting = meetingService.getById(meetingId); + if (meeting.getIsInnerProject()) { + List projects = meetingInnerProjectService.listByMeetingId(meetingId); + List projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId); + List projectList = projectService.listByIds(projectIdList); + return CollUtils.convert(projectList, this::buildProjectList); + } else { + List projects = meetingOuterProjectService.listByMeetingId(meetingId); + return BeanUtil.copyToList(projects, ProjectLibListItemVO.class); + } + } + + private ProjectLibListItemVO buildProjectList(Project project) { + return ProjectLibListItemVO + .builder() + .id(project.getId()) + .projectName(project.getProjectName()) + .declaredAmount(project.getDeclareAmount()) + .projectType(project.getProjectType()) + .projectYear(project.getProjectYear()) + .buildOrg(project.getBuildOrgName()) + .build(); + } + private void buildOptionProjectQuery(LambdaQueryWrapper query, String meetingType, ProjectStatusEnum status) { String sql = String.format("select 1 from meeting m inner join meeting_inner_project mip on" + " m.is_inner_project = true and m.id = mip.meeting_id and m.type = %s and m.status != 3", meetingType);