@@ -27,4 +27,7 @@ public abstract class AbstractProcessBusinessHandle { | |||||
*/ | */ | ||||
abstract void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule); | abstract void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule); | ||||
abstract Integer getOrder(); | |||||
abstract void setOrder(Integer order); | |||||
} | } |
@@ -34,6 +34,8 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | private final INdProjectStatusChangeService projectStatusChangeService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 5; | |||||
/** | /** | ||||
* 项目状态为:年度计划中之前的状态 | * 项目状态为:年度计划中之前的状态 | ||||
*/ | */ | ||||
@@ -110,4 +112,14 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); | processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -30,6 +30,8 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | private final INdProjectStatusChangeService projectStatusChangeService; | ||||
private Integer order = 11; | |||||
public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ | public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ | ||||
this.projectService = projectService; | this.projectService = projectService; | ||||
this.projectStatusChangeService = projectStatusChangeService; | this.projectStatusChangeService = projectStatusChangeService; | ||||
@@ -63,4 +65,14 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||||
} | } | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -43,6 +43,8 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||||
private final ProjectVersionUtil projectVersionUtil; | private final ProjectVersionUtil projectVersionUtil; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 6; | |||||
public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ | public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ | ||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
@@ -109,4 +111,14 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||||
processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); | processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -43,6 +43,8 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||||
private final BuildUserUtils buildUserUtils; | private final BuildUserUtils buildUserUtils; | ||||
private final ProjectVersionUtil projectVersionUtil; | private final ProjectVersionUtil projectVersionUtil; | ||||
private Integer order = 4; | |||||
public DeptUnitedReviewHandle(IProjectInstService projectInstService,IProjectService projectService | public DeptUnitedReviewHandle(IProjectInstService projectInstService,IProjectService projectService | ||||
, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, | , ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, | ||||
ProjectVersionUtil projectVersionUtil){ | ProjectVersionUtil projectVersionUtil){ | ||||
@@ -102,4 +104,14 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); | processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -42,6 +42,8 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||||
private final ProjectVersionUtil projectVersionUtil; | private final ProjectVersionUtil projectVersionUtil; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 3; | |||||
public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) { | public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) { | ||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
@@ -109,4 +111,14 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); | processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -1,10 +1,22 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | package com.ningdatech.pmapi.projectlib.handle; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||||
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.wflow.bean.entity.WflowModels; | |||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.service.ProcessModelService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.Comparator; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* 流程执行链 | * 流程执行链 | ||||
@@ -15,10 +27,16 @@ import java.util.List; | |||||
@Component | @Component | ||||
public class ProcessExecuteChainHandle { | public class ProcessExecuteChainHandle { | ||||
@Autowired | |||||
private IProjectService projectService; | |||||
@Autowired | |||||
private ProcessModelService processModelService; | |||||
/** | /** | ||||
* 具体处理者的集合 | * 具体处理者的集合 | ||||
*/ | */ | ||||
private final List<AbstractProcessBusinessHandle> processBusinessHandles; | |||||
private List<AbstractProcessBusinessHandle> processBusinessHandles; | |||||
public ProcessExecuteChainHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) { | public ProcessExecuteChainHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) { | ||||
this.processBusinessHandles = processBusinessHandles; | this.processBusinessHandles = processBusinessHandles; | ||||
@@ -32,8 +50,43 @@ public class ProcessExecuteChainHandle { | |||||
* @since 2023/02/26 | * @since 2023/02/26 | ||||
*/ | */ | ||||
public List<ProcessDetailVO> handle(Long projectId, List<ProcessDetailVO> processSchedule){ | public List<ProcessDetailVO> handle(Long projectId, List<ProcessDetailVO> processSchedule){ | ||||
if (processBusinessHandles.size() > 0) { | |||||
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { | |||||
Project project = projectService.getById(projectId); | |||||
List<AbstractProcessBusinessHandle> handles = Lists.newArrayList(); | |||||
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { | |||||
if(Objects.nonNull(project) && RegionContant.LS_LQ_CODE.equals(project.getAreaCode())) { | |||||
if(processBusinessHandle instanceof AnnualPlanHandle){ | |||||
processBusinessHandle.setOrder(5); | |||||
}else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ | |||||
processBusinessHandle.setOrder(6); | |||||
} | |||||
}else{ | |||||
if(processBusinessHandle instanceof AnnualPlanHandle){ | |||||
processBusinessHandle.setOrder(6); | |||||
}else if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ | |||||
processBusinessHandle.setOrder(5); | |||||
} | |||||
} | |||||
if(processBusinessHandle instanceof ConstructionPlanReviewHandle){ | |||||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||||
.eq(WflowModels::getRegionCode, project.getAreaCode()) | |||||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(model)){ | |||||
if(!model.getIsStop()){ | |||||
handles.add(processBusinessHandle); | |||||
} | |||||
} | |||||
continue; | |||||
} | |||||
handles.add(processBusinessHandle); | |||||
} | |||||
handles = handles.stream() | |||||
.sorted(Comparator.comparing(AbstractProcessBusinessHandle::getOrder)) | |||||
.collect(Collectors.toList()); | |||||
if (handles.size() > 0) { | |||||
for (AbstractProcessBusinessHandle processBusinessHandle : handles) { | |||||
processBusinessHandle.businessHandle(projectId, processSchedule); | processBusinessHandle.businessHandle(projectId, processSchedule); | ||||
} | } | ||||
return processSchedule; | return processSchedule; | ||||
@@ -32,6 +32,8 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final AnnualPlanLibManage annualPlanLibManage; | private final AnnualPlanLibManage annualPlanLibManage; | ||||
private Integer order = 7; | |||||
/** | /** | ||||
* 项目状态为:待立项批复之前的状态 | * 项目状态为:待立项批复之前的状态 | ||||
*/ | */ | ||||
@@ -101,4 +103,14 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -28,6 +28,8 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { | |||||
this.projectService = projectService; | this.projectService = projectService; | ||||
} | } | ||||
private Integer order = 1; | |||||
@Override | @Override | ||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | ||||
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 | // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 | ||||
@@ -40,4 +42,14 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); | processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -36,6 +36,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
private final BuildUserUtils buildUserUtils; | private final BuildUserUtils buildUserUtils; | ||||
private Integer order = 10; | |||||
public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | ||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
@@ -92,4 +93,14 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||||
processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); | processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -32,6 +32,8 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | private final INdProjectStatusChangeService projectStatusChangeService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 9; | |||||
/** | /** | ||||
* 项目状态为:建设中及之后的状态 | * 项目状态为:建设中及之后的状态 | ||||
*/ | */ | ||||
@@ -77,4 +79,14 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH | |||||
processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); | processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -3,7 +3,9 @@ package com.ningdatech.pmapi.projectlib.handle; | |||||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | ||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | import com.wflow.workflow.enums.StepStatusEnum; | ||||
import org.springframework.core.annotation.Order; | import org.springframework.core.annotation.Order; | ||||
@@ -31,6 +33,8 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | private final INdProjectStatusChangeService projectStatusChangeService; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 8; | |||||
/** | /** | ||||
* 项目状态为:建设中及之后的状态 | * 项目状态为:建设中及之后的状态 | ||||
*/ | */ | ||||
@@ -51,7 +55,10 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | ||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
// 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 | // 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 | ||||
Project project = projectService.getById(projectId); | |||||
Project project = projectService.getNewProject(projectId); | |||||
List<Long> projectIds = projectService.list(Wrappers.lambdaQuery(Project.class) | |||||
.in(Project::getProjectCode, project.getProjectCode())).stream() | |||||
.map(Project::getId).collect(Collectors.toList()); | |||||
Integer status = project.getStatus(); | Integer status = project.getStatus(); | ||||
// 未进行立项批复 | // 未进行立项批复 | ||||
if (Objects.isNull(project.getApprovalDate())){ | if (Objects.isNull(project.getApprovalDate())){ | ||||
@@ -68,12 +75,22 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
// 根据采购备案的时间获取 | // 根据采购备案的时间获取 | ||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | ||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.in(ProjectStatusChange::getProjectId, projectIds) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) | .eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) | ||||
.last("limit 1")); | |||||
.last(BizConst.LIMIT_1)); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
} | } | ||||
processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); | processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE); | ||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
} | } |
@@ -47,6 +47,8 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
private final ProjectVersionUtil projectVersionUtil; | private final ProjectVersionUtil projectVersionUtil; | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private Integer order = 2; | |||||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ | public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){ | ||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
@@ -112,6 +114,16 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
processSchedule.add(processDetailVO); | processSchedule.add(processDetailVO); | ||||
} | } | ||||
@Override | |||||
Integer getOrder() { | |||||
return order; | |||||
} | |||||
@Override | |||||
void setOrder(Integer order) { | |||||
this.order = order; | |||||
} | |||||
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | ||||
for (ProgressNode progressNode : progressInfo) { | for (ProgressNode progressNode : progressInfo) { | ||||
progressNode.setUser(userMap.get(progressNode.getUserId())); | progressNode.setUser(userMap.get(progressNode.getUserId())); | ||||