Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
WendyYang 1 year ago
parent
commit
e661ce80b5
4 changed files with 41 additions and 31 deletions
  1. +8
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java
  2. +7
    -10
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java
  3. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java
  4. +24
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java

+ 8
- 11
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/ConstructionPlanReviewHandle.java View File

@@ -64,23 +64,20 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle
ProcessProgressVo instanceDetail = null; ProcessProgressVo instanceDetail = null;
// 未找到当前版本项目的建设方案审核流程且当前项目版本号大于1(是被驳回重新申报的项目) // 未找到当前版本项目的建设方案审核流程且当前项目版本号大于1(是被驳回重新申报的项目)
if (Objects.isNull(projectInst)) { if (Objects.isNull(projectInst)) {
if (project.getVersion() > CommonConst.VERSION_ONE){
if (project.getVersion() > CommonConst.VERSION_ONE ){
// 获取上个版本的信息 // 获取上个版本的信息
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId);
if (Objects.isNull(instanceDetail)){
throw new BizException("未获取到历史版本的流程详情!");
}
}else {
// 版本号为1
processDetailVO.setStepStatus(StepStatusEnum.NOT_START);
processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW);
processSchedule.add(processDetailVO);
return;
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.CONSTRUCTION_PLAN_REVIEW);
} }
}else { }else {
String instCode = projectInst.getInstCode(); String instCode = projectInst.getInstCode();
instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode);
} }
if (Objects.isNull(instanceDetail)){
processDetailVO.setStepStatus(StepStatusEnum.NOT_START);
processDetailVO.setProcessName(CommonConst.CONSTRUCTION_PLAN_REVIEW);
processSchedule.add(processDetailVO);
return;
}
String status = instanceDetail.getStatus(); String status = instanceDetail.getStatus();
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING);


+ 7
- 10
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/PreliminaryPreviewHandle.java View File

@@ -68,21 +68,18 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle {
if (Objects.isNull(projectInst)) { if (Objects.isNull(projectInst)) {
if (project.getVersion() > CommonConst.VERSION_ONE){ if (project.getVersion() > CommonConst.VERSION_ONE){
// 获取上个版本的信息 // 获取上个版本的信息
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId);
if (Objects.isNull(instanceDetail)){
throw new BizException("未获取到历史版本的流程详情!");
}
}else {
// 版本号为1
processDetailVO.setStepStatus(StepStatusEnum.NOT_START);
processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW);
processSchedule.add(processDetailVO);
return;
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId,InstTypeEnum.PRELIMINARY_PREVIEW);
} }
}else { }else {
String instCode = projectInst.getInstCode(); String instCode = projectInst.getInstCode();
instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode);
} }
if (Objects.isNull(instanceDetail)){
processDetailVO.setStepStatus(StepStatusEnum.NOT_START);
processDetailVO.setProcessName(CommonConst.PRELIMINARY_PREVIEW);
processSchedule.add(processDetailVO);
return;
}
String status = instanceDetail.getStatus(); String status = instanceDetail.getStatus();
if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); processDetailVO.setStepStatus(StepStatusEnum.ON_GOING);


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handle/UnitInnerAuditHandle.java View File

@@ -4,6 +4,7 @@ import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;


import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -71,7 +72,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle {
if (Objects.isNull(projectInst)) { if (Objects.isNull(projectInst)) {
if (project.getVersion() > CommonConst.VERSION_ONE){ if (project.getVersion() > CommonConst.VERSION_ONE){
// 获取上个版本的信息 // 获取上个版本的信息
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId);
instanceDetail = projectVersionUtil.getPreVerProcessInfo(projectId, InstTypeEnum.UNIT_INNER_AUDIT);
} }
}else { }else {
String instCode = projectInst.getInstCode(); String instCode = projectInst.getInstCode();


+ 24
- 9
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java View File

@@ -1,9 +1,14 @@
package com.ningdatech.pmapi.projectlib.utils; package com.ningdatech.pmapi.projectlib.utils;


import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project; 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.projectlib.service.IProjectService;
import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.service.ProcessInstanceService; import com.wflow.workflow.service.ProcessInstanceService;
@@ -13,8 +18,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;


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


/** /**
* 根据项目版本获取流程详情工具类 * 根据项目版本获取流程详情工具类
@@ -29,13 +37,14 @@ public class ProjectVersionUtil {


private final IProjectService projectService; private final IProjectService projectService;
private final ProcessInstanceService processInstanceService; private final ProcessInstanceService processInstanceService;
private final IProjectInstService projectInstService;


/** /**
* 根据最新的项目ID获取临近项目版本的审核记录信息 * 根据最新的项目ID获取临近项目版本的审核记录信息
* @param projectId * @param projectId
* @return * @return
*/ */
public ProcessProgressVo getPreVerProcessInfo(Long projectId){
public ProcessProgressVo getPreVerProcessInfo(Long projectId, InstTypeEnum instTypeEnum){
Project project = projectService.getById(projectId); Project project = projectService.getById(projectId);
if (Objects.isNull(project)){ if (Objects.isNull(project)){
throw new BizException("当前项目不存在!"); throw new BizException("当前项目不存在!");
@@ -46,22 +55,28 @@ public class ProjectVersionUtil {
} }
// 获取相同项目编号的项目 // 获取相同项目编号的项目
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class) List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class)
.eq(Project::getProjectCode, projectCode)
.orderByDesc(Project::getVersion));
.eq(Project::getProjectCode, projectCode));
if (projectList.size() < CommonConst.VERSION_SIZE){ if (projectList.size() < CommonConst.VERSION_SIZE){
throw new BizException("未发现该项目的历史版本!"); throw new BizException("未发现该项目的历史版本!");
} }
// 获取上个版本的项目 // 获取上个版本的项目
int index = projectList.size() - CommonConst.VERSION_SIZE;
int index = projectList.size() - 1;
ProcessProgressVo instanceDetail = null; ProcessProgressVo instanceDetail = null;
while (index > 0){ while (index > 0){
index = index - 1; index = index - 1;
Project preProject = projectList.get(index); Project preProject = projectList.get(index);
// 获取上个版本的项目关联的流程实例ID
String preInstCode = preProject.getInstCode();
instanceDetail = processInstanceService.getProgressInstanceDetail(null, preInstCode);
if (Objects.nonNull(instanceDetail)){
return instanceDetail;
// 从项目流程实例关联表中查出实例详情
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, preProject.getId())
.eq(ProjectInst::getInstType,instTypeEnum.getCode()));
if (CollUtil.isNotEmpty(projectInstList)) {
// 获取最新一个对应审核类型的项目关联实例
ProjectInst projectInst = projectInstList.get(projectInstList.size() - 1);
// 获取流程详情
instanceDetail = processInstanceService.getProgressInstanceDetail(null, projectInst.getInstCode());
if (Objects.nonNull(instanceDetail)){
return instanceDetail;
}
} }
} }
return null; return null;


Loading…
Cancel
Save