Browse Source

debug

tags/24080901
PoffyZhang 1 year ago
parent
commit
6d009e9e7d
13 changed files with 199 additions and 7 deletions
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AbstractProcessBusinessHandle.java
  2. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java
  3. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java
  4. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java
  5. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java
  6. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java
  7. +57
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java
  8. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java
  9. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java
  10. +11
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java
  11. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java
  12. +20
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java
  13. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AbstractProcessBusinessHandle.java View File

@@ -27,4 +27,7 @@ public abstract class AbstractProcessBusinessHandle {
*/
abstract void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule);

abstract Integer getOrder();

abstract void setOrder(Integer order);
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/AnnualPlanHandle.java View File

@@ -34,6 +34,8 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle {
private final INdProjectStatusChangeService projectStatusChangeService;
private final IProjectService projectService;

private Integer order = 5;

/**
* 项目状态为:年度计划中之前的状态
*/
@@ -110,4 +112,14 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle {
processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ArchivedHandle.java View File

@@ -30,6 +30,8 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle {
private final IProjectService projectService;
private final INdProjectStatusChangeService projectStatusChangeService;

private Integer order = 11;

public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){
this.projectService = projectService;
this.projectStatusChangeService = projectStatusChangeService;
@@ -63,4 +65,14 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle {
}
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java View File

@@ -43,6 +43,8 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle
private final ProjectVersionUtil projectVersionUtil;
private final IProjectService projectService;

private Integer order = 6;

public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
@@ -109,4 +111,14 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle
processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/DeptUnitedReviewHandle.java View File

@@ -43,6 +43,8 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle {
private final BuildUserUtils buildUserUtils;
private final ProjectVersionUtil projectVersionUtil;

private Integer order = 4;

public DeptUnitedReviewHandle(IProjectInstService projectInstService,IProjectService projectService
, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils,
ProjectVersionUtil projectVersionUtil){
@@ -102,4 +104,14 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle {
processDetailVO.setProcessName(CommonConst.DEPT_UNITED_REVIEW);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java View File

@@ -42,6 +42,8 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle {
private final ProjectVersionUtil projectVersionUtil;
private final IProjectService projectService;

private Integer order = 3;

public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService) {
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
@@ -109,4 +111,14 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle {
processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 57
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProcessExecuteChainHandle.java View File

@@ -1,10 +1,22 @@
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.service.ProcessModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
* 流程执行链
@@ -15,10 +27,16 @@ import java.util.List;
@Component
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) {
this.processBusinessHandles = processBusinessHandles;
@@ -32,8 +50,43 @@ public class ProcessExecuteChainHandle {
* @since 2023/02/26
*/
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);
}
return processSchedule;


+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectApprovalHandle.java View File

@@ -32,6 +32,8 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle {
private final IProjectService projectService;
private final AnnualPlanLibManage annualPlanLibManage;

private Integer order = 7;

/**
* 项目状态为:待立项批复之前的状态
*/
@@ -101,4 +103,14 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle {
processDetailVO.setProcessName(CommonConst.PROJECT_APPROVAL);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectDeclareHandle.java View File

@@ -28,6 +28,8 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle {
this.projectService = projectService;
}

private Integer order = 1;

@Override
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) {
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成
@@ -40,4 +42,14 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle {
processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 11
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectFinalInspectionHandle.java View File

@@ -36,6 +36,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle
private final ProcessInstanceService processInstanceService;
private final BuildUserUtils buildUserUtils;

private Integer order = 10;
public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
@@ -92,4 +93,14 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle
processDetailVO.setProcessName(CommonConst.PROJECT_FINAL_INSPECTION);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ProjectPreliminaryInspectionHandle.java View File

@@ -32,6 +32,8 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH
private final INdProjectStatusChangeService projectStatusChangeService;
private final IProjectService projectService;

private Integer order = 9;

/**
* 项目状态为:建设中及之后的状态
*/
@@ -77,4 +79,14 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH
processDetailVO.setProcessName(CommonConst.PROJECT_PRELIMINARY_INSPECTION);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 20
- 3
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/TenderPurchaseHandle.java View File

@@ -3,7 +3,9 @@ package com.ningdatech.pmapi.projectlib.handle;
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*;

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.enums.StepStatusEnum;
import org.springframework.core.annotation.Order;
@@ -31,6 +33,8 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle {
private final INdProjectStatusChangeService projectStatusChangeService;
private final IProjectService projectService;

private Integer order = 8;

/**
* 项目状态为:建设中及之后的状态
*/
@@ -51,7 +55,10 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle {
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) {
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();
// 未进行立项批复
if (Objects.isNull(project.getApprovalDate())){
@@ -68,12 +75,22 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle {
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
// 根据采购备案的时间获取
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())
.last("limit 1"));
.last(BizConst.LIMIT_1));
processDetailVO.setFinishTime(projectStatusChange.getCreateOn());
}
processDetailVO.setProcessName(CommonConst.TENDER_PURCHASE);
processSchedule.add(processDetailVO);
}

@Override
Integer getOrder() {
return order;
}

@Override
void setOrder(Integer order) {
this.order = order;
}
}

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java View File

@@ -47,6 +47,8 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle {
private final ProjectVersionUtil projectVersionUtil;
private final IProjectService projectService;

private Integer order = 2;

public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils, ProjectVersionUtil projectVersionUtil, IProjectService projectService){
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
@@ -112,6 +114,16 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle {
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) {
for (ProgressNode progressNode : progressInfo) {
progressNode.setUser(userMap.get(progressNode.getUserId()));


Loading…
Cancel
Save