Browse Source

项目库流程处理进度详情

tags/24080901
CMM 1 year ago
parent
commit
52b6e62d61
10 changed files with 362 additions and 0 deletions
  1. +11
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java
  2. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java
  3. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java
  4. +41
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java
  5. +43
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java
  6. +70
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java
  7. +44
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java
  8. +65
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java
  9. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java
  10. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 11
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java View File

@@ -18,4 +18,15 @@ public class CommonConstant {
public static final Integer SUB_COMMENT_SIZE_MIN = 0;
public static final Integer SUB_COMMENT_SIZE_MAX = 160;

public static final String PROJECT_DECLARE_PREFIX = "projectDeclare";
public static final String UNIT_INNER_AUDIT_PREFIX = "unitInnerAudit";
public static final String PRELIMINARY_PREVIEW_PREFIX = "preliminaryPreview";
public static final String DEPT_UNITED_REVIEW_PREFIX = "deptUnitedReview";
public static final String ANNUAL_PLAN_PREFIX = "annualPlan";
public static final String CONSTRUCTION_PLAN_REVIEW_PREFIX = "constructionPlanReview";
public static final String PROJECT_APPROVAL_PREFIX = "projectApproval";
public static final String TENDER_PURCHASE_PREFIX = "tenderPurchase";
public static final String PROJECT_PRELIMINARY_INSPECTION_PREFIX = "projectPreliminaryInspection";
public static final String PROJECT_FINAL_INSPECTION_PREFIX = "projectFinalInspection";

}

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java View File

@@ -5,6 +5,7 @@ import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;

import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import io.swagger.annotations.Api;
@@ -40,4 +41,10 @@ public class ProjectLibController {
return projectLibManage.getProjectDetail(id);
}

@GetMapping("/totalProcessDetail/{projectId}")
@ApiOperation("获取流程当前进度")
private ProcessDetailVO totalProcessDetail(@PathVariable Long projectId){
return projectLibManage.totalProcessDetail(projectId);
}

}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java View File

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.projectlib.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
*
* 实例类型枚举
* @author CMM
* @since 2023/02/24 16:14
*/
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum InstTypeEnum {
/**
* 流程实例类型
*/
UNIT_INNER_AUDIT(1, "单位内部审批流程"),
PRELIMINARY_PREVIEW(2, "项目预审审批流程"),
DEPT_UNITED_REVIEW(3,"部门联合审批流程"),
CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"),
PROJECT_FINAL_INSPECTION(5,"验收申报审批流程");

private Integer code;
private String desc;

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (InstTypeEnum t : InstTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 41
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java View File

@@ -0,0 +1,41 @@
package com.ningdatech.pmapi.projectlib.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@Getter
@AllArgsConstructor
@NoArgsConstructor
/**
* 环节状态枚举
* @author CMM
* @since 2023/02/24 11:51
*/
public enum StepStatusEnum {
/**
* 环节状态
*/
NOT_START(1, "未开始"),
ON_GOING(2, "进行中"),
REJECTED(3,"被驳回"),
COMPLETED(4,"已完成");

private Integer code;
private String desc;

public static String getDescByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (StepStatusEnum t : StepStatusEnum.values()) {
if (code.equals(t.getCode())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}
}

+ 43
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java View File

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.projectlib.handler;

import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;

/**
* 流程业务抽象处理类
*
* @author CMM
* @since 2023/02/24 14:22
*/

public abstract class AbstractProcessBusinessHandler {
/**
* 前缀,用于区分是什么业务
*/
private String prefix;

/**
* 构造,子类必须实现
*/
public AbstractProcessBusinessHandler(){}

/**
* 操作前缀属性的公开方法
*/
public String getPrefix(){
return prefix;
}

public void setPrefix(String prefix){
this.prefix = prefix;
}

/**
* 抽象的,所有具体处理者应该实现的处理逻辑
* @param projectId 项目ID
* @return void
* @author CMM
* @since 2023/02/24 14:33
*/
abstract ProcessDetailVO businessHandle(Long projectId);

}

+ 70
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java View File

@@ -0,0 +1,70 @@
package com.ningdatech.pmapi.projectlib.handler;

import java.time.LocalDateTime;
import java.util.Objects;

import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.enums.ProcessStatusEnum;
import com.wflow.workflow.service.ProcessInstanceService;

/**
* 单位内部审核处理
*
* @author CMM
* @since 2023/02/24 14:35
*/
@Component
public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandler{

private final IProjectInstService projectInstService;

private final ProcessInstanceService processInstanceService;

/**
* 设置该业务前缀
*/
private static final String PREFIX = CommonConstant.DEPT_UNITED_REVIEW_PREFIX;

public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){
setPrefix(PREFIX);
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
}

@Override
ProcessDetailVO businessHandle(Long projectId) {
ProcessDetailVO processDetailVO = new ProcessDetailVO();
// 根据项目ID查询出单位内部审核流程的流程状态
// 注意:已经在项目库中的项目,一定是已经开始的项目
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, projectId)
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()));
if (Objects.isNull(projectInst)){
processDetailVO.setStepStatus(StepStatusEnum.NOT_START);
return processDetailVO;
}
String instCode = projectInst.getInstCode();
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode);
String status = instanceDetail.getStatus();
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING);
} else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) {
processDetailVO.setStepStatus(StepStatusEnum.REJECTED);
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) {
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
}
// 根据流程处理详情获取流程完成时间
LocalDateTime finishTime = processDetailVO.getFinishTime();
processDetailVO.setFinishTime(finishTime);
return processDetailVO;
}
}

+ 44
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java View File

@@ -0,0 +1,44 @@
package com.ningdatech.pmapi.projectlib.handler;

import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

/**
* 项目申报处理
*
* @author CMM
* @since 2023/02/24 14:35
*/

public class ProjectDeclareHandle extends AbstractProcessBusinessHandler{

@Autowired
private IProjectService projectService;

/**
* 设置该业务前缀
*/
private static final String PREFIX = CommonConstant.PROJECT_DECLARE_PREFIX;

public ProjectDeclareHandle(){
setPrefix(PREFIX);
}

@Override
ProcessDetailVO businessHandle(Long projectId) {
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成
ProcessDetailVO processDetailVO = new ProcessDetailVO();
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
// 项目库中查出申报完成时间
Project project = projectService.getById(projectId);
LocalDateTime createOn = project.getCreateOn();
processDetailVO.setFinishTime(createOn);
return processDetailVO;
}
}

+ 65
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java View File

@@ -0,0 +1,65 @@
package com.ningdatech.pmapi.projectlib.handler;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;

import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum;
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.enums.ProcessStatusEnum;
import com.wflow.workflow.service.ProcessInstanceService;
import org.springframework.stereotype.Component;

/**
* 单位内部审核处理
*
* @author CMM
* @since 2023/02/24 14:35
*/
@Component
public class UnitInnerAuditHandle extends AbstractProcessBusinessHandler{

private final IProjectInstService projectInstService;

private final ProcessInstanceService processInstanceService;

/**
* 设置该业务前缀
*/
private static final String PREFIX = CommonConstant.UNIT_INNER_AUDIT_PREFIX;

public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){
setPrefix(PREFIX);
this.projectInstService = projectInstService;
this.processInstanceService = processInstanceService;
}

@Override
ProcessDetailVO businessHandle(Long projectId) {
ProcessDetailVO processDetailVO = new ProcessDetailVO();
// 根据项目ID查询出单位内部审核流程的流程状态
// 注意:已经在项目库中的项目,一定是已经开始的项目
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, projectId)
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()));
String instCode = projectInst.getInstCode();
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode);
String status = instanceDetail.getStatus();
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING);
} else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) {
processDetailVO.setStepStatus(StepStatusEnum.REJECTED);
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) {
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED);
}
// 项目库中查出申报完成时间
LocalDateTime finishTime = processDetailVO.getFinishTime();
processDetailVO.setFinishTime(finishTime);
return processDetailVO;
}
}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java View File

@@ -0,0 +1,37 @@
package com.ningdatech.pmapi.projectlib.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* 流程进度详情VO
*
* @author CMM
* @since 2023/02/24 11:25
*/
@ApiModel(value = "ProcessDetailVO", description = "流程进度详情VO")
@Data
public class ProcessDetailVO implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("环节状态")
private StepStatusEnum stepStatus;

@ApiModelProperty("完成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime finishTime;

@ApiModelProperty("流程处理进度详情")
private ProcessProgressVo processProgressVo;


}

+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -291,6 +291,7 @@ public class TodoCenterManage {
break;
// 盖章并通过
case SEAL_PASS:
// TODO 调用盖章接口,返回盖章后的文件流
// 通过该任务,流程到下一审核人处
processTaskService.handleTask(param, userId);
break;


Loading…
Cancel
Save