Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
57b7de9d45
2 changed files with 34 additions and 11 deletions
  1. +8
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  2. +26
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java

+ 8
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java View File

@@ -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;

/**
* <p>
@@ -179,4 +181,10 @@ public class MeetingController {
return meetingManage.optionProject(req);
}

@GetMapping("/{meetingId}/projects")
@ApiOperation("会议关联项目列表")
public List<ProjectLibListItemVO> projectsByMeetingId(@PathVariable Long meetingId) {
return meetingManage.projectsByMeetingId(meetingId);
}

}

+ 26
- 11
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -727,21 +727,36 @@ public class MeetingManage {
Page<Project> page = projectService.page(req.page(), query);
PageVo<ProjectLibListItemVO> result = PageVo.of(null, page.getTotal());
if (result.getTotal() > 0) {
List<ProjectLibListItemVO> 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<ProjectLibListItemVO> projectsByMeetingId(Long meetingId) {
Meeting meeting = meetingService.getById(meetingId);
if (meeting.getIsInnerProject()) {
List<MeetingInnerProject> projects = meetingInnerProjectService.listByMeetingId(meetingId);
List<Long> projectIdList = CollUtils.fieldList(projects, MeetingInnerProject::getProjectId);
List<Project> projectList = projectService.listByIds(projectIdList);
return CollUtils.convert(projectList, this::buildProjectList);
} else {
List<MeetingOuterProject> 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<Project> 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);


Loading…
Cancel
Save