Pārlūkot izejas kodu

增加会议关联项目列表

tags/24080901
WendyYang pirms 1 gada
vecāks
revīzija
47d1a01a16
2 mainītis faili ar 34 papildinājumiem un 11 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

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


Notiek ielāde…
Atcelt
Saglabāt