From 416d91a7d4224982eba187539eae917b9feb4b4c Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 30 Jun 2023 10:07:23 +0800 Subject: [PATCH] debug --- .../projectlib/handle/ConstructionPlanReviewHandle.java | 5 +++-- .../pmapi/projectlib/handle/PreliminaryPreviewHandle.java | 1 + .../pmapi/projectlib/handle/ProjectApprovalHandle.java | 7 +++++-- .../projectlib/handle/ProjectFinalInspectionHandle.java | 14 +++++++++++--- .../handle/ProjectPreliminaryInspectionHandle.java | 10 +++++++--- .../pmapi/projectlib/handle/TenderPurchaseHandle.java | 6 ++---- .../pmapi/projectlib/handle/UnitInnerAuditHandle.java | 3 ++- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java index 5d7aded..c5ac2e7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java @@ -8,6 +8,7 @@ import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Lists; import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.util.NdDateUtils; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.utils.ProjectVersionUtil; @@ -61,10 +62,10 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle List allVersionProjectIds = projectService.getAllVersionProjectId(project); // 根据项目ID查询出建设方案评审流程的流程状态 ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, projectId) + .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) .orderByDesc(ProjectInst::getCreatOn) - .last("limit 1")); + .last(BizConst.LIMIT_1)); ProcessProgressVo instanceDetail = null; // 未找到当前版本项目的建设方案审核流程且当前项目版本号大于1(是被驳回重新申报的项目) if (Objects.isNull(projectInst)) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java index a529178..31c6392 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java @@ -56,6 +56,7 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { void businessHandle(Long projectId, List processSchedule) { ProcessDetailVO processDetailVO = new ProcessDetailVO(); Project project = projectService.getById(projectId); + if (Objects.isNull(project)){ throw new BizException("当前项目不存在!"); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java index aea63a8..c3782ac 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectlib.handle; import java.util.*; import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.enums.StepStatusEnum; @@ -68,6 +69,8 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { ProcessDetailVO processDetailVO = new ProcessDetailVO(); Project project = projectService.getById(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); Integer status = project.getStatus(); List fieldList = CollUtils.fieldList(PROJECT_APPROVAL_LIST_STATUS, ProjectStatusEnum::getCode); @@ -83,9 +86,9 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ // 根据建设方案评审通过的时间获取 ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getProjectId, projectId) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) - .last("limit 1")); + .last(BizConst.LIMIT_1)); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java index 93160ce..e61217d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java @@ -8,8 +8,10 @@ import cn.hutool.core.collection.CollUtil; import com.google.common.collect.Lists; import com.ningdatech.basic.util.NdDateUtils; import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; import com.ningdatech.pmapi.projectlib.service.IProjectInstService; +import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; import com.wflow.workflow.bean.process.ProgressNode; import com.wflow.workflow.bean.vo.ProcessDetailVO; @@ -36,20 +38,26 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle private final ProcessInstanceService processInstanceService; private final BuildUserUtils buildUserUtils; + private final IProjectService projectService; + private Integer order = 10; - public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ + public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, + BuildUserUtils buildUserUtils,IProjectService projectService){ this.projectInstService = projectInstService; this.processInstanceService = processInstanceService; this.buildUserUtils = buildUserUtils; + this.projectService = projectService; } @Override void businessHandle(Long projectId, List processSchedule) { ProcessDetailVO processDetailVO = new ProcessDetailVO(); - + Project project = projectService.getById(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); // 根据项目ID查询出项目终验流程的流程状态 ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, projectId) + .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) .orderByDesc(ProjectInst::getCreatOn) .last("limit 1")); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java index 8a95a4f..fef8a08 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java @@ -4,7 +4,9 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; +import com.ningdatech.pmapi.common.constant.BizConst; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.enums.StepStatusEnum; import org.springframework.core.annotation.Order; @@ -55,7 +57,9 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH ProcessDetailVO processDetailVO = new ProcessDetailVO(); // 根据项目状态是否在建设中及之后的状态判断项目初验是否开始 List fieldList = CollUtils.fieldList(PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS, ProjectStatusEnum::getCode); - Project project = projectService.getById(projectId); + Project project = projectService.getNewProject(projectId); + //查出历史版本的 所有项目ID + List allVersionProjectIds = projectService.getAllVersionProjectId(project); Integer status = project.getStatus(); // 项目状态不在建设中及之后的状态 if (!fieldList.contains(status)){ @@ -71,9 +75,9 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); // 根据初验备案的时间获取 ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .eq(ProjectStatusChange::getProjectId, projectId) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) - .last("limit 1")); + .last(BizConst.LIMIT_1)); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); } processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java index 2c7988c..00be16a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java @@ -56,9 +56,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { ProcessDetailVO processDetailVO = new ProcessDetailVO(); // 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 Project project = projectService.getNewProject(projectId); - List projectIds = projectService.list(Wrappers.lambdaQuery(Project.class) - .in(Project::getProjectCode, project.getProjectCode())).stream() - .map(Project::getId).collect(Collectors.toList()); + List allVersionProjectIds = projectService.getAllVersionProjectId(project); Integer status = project.getStatus(); // 未进行立项批复 if (Objects.isNull(project.getApprovalDate())){ @@ -75,7 +73,7 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); // 根据采购备案的时间获取 ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) - .in(ProjectStatusChange::getProjectId, projectIds) + .in(ProjectStatusChange::getProjectId, allVersionProjectIds) .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) .last(BizConst.LIMIT_1)); processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java index 83920a5..34fcc73 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java @@ -61,9 +61,10 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { void businessHandle(Long projectId, List processSchedule) { ProcessDetailVO processDetailVO = new ProcessDetailVO(); Project project = projectService.getById(projectId); + List allVersionProjectIds = projectService.getAllVersionProjectId(project); // 根据项目ID查询出单位内部审核流程的流程状态 ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) - .eq(ProjectInst::getProjectId, projectId) + .in(ProjectInst::getProjectId, allVersionProjectIds) .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) .orderByDesc(ProjectInst::getCreatOn) .last("limit 1"));