Kaynağa Gözat

修改项目列表查询

tags/24080901
WendyYang 10 ay önce
ebeveyn
işleme
44fffc6483
1 değiştirilmiş dosya ile 13 ekleme ve 9 silme
  1. +13
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java

+ 13
- 9
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/DeclaredRecordManage.java Dosyayı Görüntüle

@@ -12,6 +12,7 @@ import com.hz.pm.api.common.enumeration.CommonEnum;
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum;
import com.hz.pm.api.common.model.constant.BizConst;
import com.hz.pm.api.common.statemachine.event.ProjectStatusChangeEvent;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
import com.hz.pm.api.external.model.enumeration.MhUnitTypeEnum;
import com.hz.pm.api.projectdeclared.manage.DefaultDeclaredProjectManage;
@@ -104,26 +105,29 @@ public class DeclaredRecordManage {

public PageVo<DeclaredProjectListVO> pageDeclaredProject(DeclaredProjectListReq req) {
LambdaQueryWrapper<MhProject> query = buildQuery(req);
// 查询审核中、失败、待立项备案的项目信息
LambdaQueryWrapper<Project> pQuery = Wrappers.lambdaQuery(Project.class)
.in(Project::getStatus, ProjectStatusEnum.DECLARED_APPROVED_RECORD_FAILED.getCode(),
ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode(),
ProjectStatusEnum.DECLARED_APPROVED_RECORD_AUDITING.getCode())
.select(Project::getId, Project::getProjectCode, Project::getStage, Project::getStatus, Project::getCreateOn);
List<Project> projects = projectService.list(pQuery);
Map<String, Project> projectMap = BizUtils.groupFirstMap(projects, Project::getProjectCode,
Comparator.comparing(Project::getCreateOn).reversed());
query.and(q1 -> q1.isNull(MhProject::getProjectCode)
.or(!projects.isEmpty(), q2 -> q2.in(MhProject::getProjectCode, projectMap.keySet())));
Page<MhProject> page = mhProjectService.page(req.page(), query);
if (page.getTotal() == 0) {
return PageVo.empty();
}
List<MhProject> records = page.getRecords();
List<String> projectCodes = CollUtils.fieldList(records, MhProject::getProjectCode);
Map<String, Project> projectMap;
if (!projectCodes.isEmpty()) {
List<Project> projects = projectService.listNewestByProjectCodes(projectCodes);
projectMap = CollUtils.listToMap(projects, Project::getProjectCode);
} else {
projectMap = Collections.emptyMap();
}
List<DeclaredProjectListVO> data = records.stream().map(w -> {
DeclaredProjectListVO item = new DeclaredProjectListVO();
item.setMhProjectId(w.getId());
Project project = projectMap.get(w.getProjectCode());
if (project == null) {
item.setStatus(ProjectStatusEnum.DECLARED_APPROVED_TO_BE_RECORD.getCode());
item.setStage(ProjectStatusEnum.TO_BE_APPROVED.getCode());
item.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
} else {
item.setStatus(project.getStatus());
item.setStage(project.getStage());


Yükleniyor…
İptal
Kaydet