@@ -1,5 +1,6 @@ | |||
package com.hz.pm.api.projectlib.handle; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import java.util.List; | |||
@@ -15,19 +16,17 @@ public abstract class AbstractProcessBusinessHandle { | |||
/** | |||
* 构造,子类必须实现 | |||
*/ | |||
protected AbstractProcessBusinessHandle(){ | |||
protected AbstractProcessBusinessHandle() { | |||
} | |||
/** | |||
* 抽象的,所有具体处理者应该实现的处理逻辑 | |||
* @param projectId | |||
* @param processSchedule | |||
* @return void | |||
* @author CMM | |||
* @since 2023/02/27 9:01 | |||
* | |||
* @param project \ | |||
* @param processSchedule \ | |||
*/ | |||
abstract void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule); | |||
abstract void businessHandle(Project project, List<ProcessDetailVO> processSchedule); | |||
abstract Integer getOrder(); | |||
@@ -59,10 +59,9 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
// 根据项目状态判断年度计划是否开始 | |||
Project project = projectService.getById(projectId); | |||
Integer status = project.getStatus(); | |||
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); | |||
@@ -38,9 +38,8 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
Integer status = project.getStage(); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
@@ -54,10 +54,10 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
//查出历史版本的 所有项目ID | |||
Long projectId = project.getId(); | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
// 根据项目ID查询出建设方案评审流程的流程状态 | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
@@ -54,8 +55,9 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO retProcessDetail = new ProcessDetailVO(); | |||
Long projectId = project.getId(); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(projectId); | |||
@@ -45,7 +45,11 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
private Integer order = 4; | |||
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.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
@@ -54,13 +58,12 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
if (Objects.isNull(project)){ | |||
throw new BizException("当前项目不存在!"); | |||
} | |||
Long projectId = project.getId(); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(projectId); | |||
// 根据项目ID查询项目预审流程的流程状态 | |||
@@ -8,6 +8,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.manage.ProcessModelManage; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
@@ -30,7 +31,7 @@ import java.util.Objects; | |||
@RequiredArgsConstructor | |||
public class ProcessExecuteChainHandle { | |||
private final ProcessModelService processModelService; | |||
private final ProcessModelManage processModelManage; | |||
/** | |||
* 具体处理者的集合 | |||
@@ -45,7 +46,7 @@ public class ProcessExecuteChainHandle { | |||
* @author CMM | |||
* @since 2023/02/26 | |||
*/ | |||
public List<ProcessDetailVO> handle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
public List<ProcessDetailVO> handle(Project project, List<ProcessDetailVO> processSchedule) { | |||
List<AbstractProcessBusinessHandle> handles = Lists.newArrayList(); | |||
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { | |||
if (processBusinessHandle instanceof AnnualPlanHandle) { | |||
@@ -56,15 +57,13 @@ public class ProcessExecuteChainHandle { | |||
//建设方案 | |||
if (processBusinessHandle instanceof ConstructionPlanReviewHandle) { | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.nonNull(model) && (Boolean.FALSE.equals(model.getIsStop()))) { | |||
ProjectProcessStageEnum processType = ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS; | |||
WflowModels wflowModels = processModelManage.getWflowModels(processType, project.getId()); | |||
if (Objects.nonNull(wflowModels) && (Boolean.FALSE.equals(wflowModels.getIsStop()))) { | |||
handles.add(processBusinessHandle); | |||
} | |||
} else if (processBusinessHandle instanceof ProvinceUnitedReviewHandle) { | |||
//省级联审 | |||
// TODO | |||
// TODO 省级联审 | |||
} else { | |||
handles.add(processBusinessHandle); | |||
} | |||
@@ -73,7 +72,7 @@ public class ProcessExecuteChainHandle { | |||
if (!handles.isEmpty()) { | |||
handles.sort(Comparator.comparing(AbstractProcessBusinessHandle::getOrder)); | |||
for (AbstractProcessBusinessHandle processBusinessHandle : handles) { | |||
processBusinessHandle.businessHandle(projectId, processSchedule); | |||
processBusinessHandle.businessHandle(project, processSchedule); | |||
} | |||
for (int i = processSchedule.size() - 1; i >= 1; i--) { | |||
ProcessDetailVO curr = processSchedule.get(i); | |||
@@ -37,12 +37,10 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetail = new ProcessDetailVO(); | |||
processDetail.setProcessName(CommonConst.PROJECT_APPROVAL); | |||
processSchedule.add(processDetail); | |||
Project project = projectService.getNewProject(projectId); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
Integer status = project.getStatus(); | |||
@@ -31,12 +31,11 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { | |||
private Integer order = 1; | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
// 项目库中查出申报完成时间 | |||
Project project = projectService.getById(projectId); | |||
LocalDateTime createOn = project.getCreateOn(); | |||
processDetailVO.setFinishTime(createOn); | |||
processDetailVO.setProcessName(CommonConst.PROJECT_DECLARE); | |||
@@ -52,9 +52,8 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
// 根据项目ID查询出项目终验流程的流程状态 | |||
@@ -54,11 +54,10 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
// 根据项目状态是否在建设中及之后的状态判断项目初验是否开始 | |||
List<Integer> fieldList = CollUtils.fieldList(PROJECT_PRELIMINARY_INSPECTION_LIST_STATUS, ProjectStatusEnum::getCode); | |||
Project project = projectService.getNewProject(projectId); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
Integer status = project.getStatus(); | |||
@@ -37,11 +37,11 @@ public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
//查询项目 | |||
Project project = projectService.getNewProject(projectId); | |||
Long projectId = project.getId(); | |||
List<Long> allVersionProjectId = projectService.allVersionProjectIds(projectId); | |||
// 根据项目ID查询出部门联审流程的流程状态 | |||
@@ -53,10 +53,9 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
// 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 | |||
Project project = projectService.getNewProject(projectId); | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
Integer status = project.getStatus(); | |||
// 未进行立项批复 | |||
@@ -57,10 +57,10 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
} | |||
@Override | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
void businessHandle(Project project, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | |||
Project project = projectService.getById(projectId); | |||
Long projectId = project.getId(); | |||
List<Long> allVersionProjectIds = projectService.allVersionProjectIds(project.getProjectCode()); | |||
// 根据项目ID查询出单位内部审核流程的流程状态 | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
@@ -1258,7 +1258,8 @@ public class ProjectLibManage { | |||
public List<ProcessDetailVO> processScheduleDetail(Long projectId) { | |||
List<ProcessDetailVO> processDetailVOS = new ArrayList<>(); | |||
return processExecuteHandle.handle(projectId, processDetailVOS); | |||
Project project = projectService.getById(projectId); | |||
return processExecuteHandle.handle(project, processDetailVOS); | |||
} | |||
private boolean checkCanRead(Set<String> subOrgSet, Project project) { | |||
@@ -303,7 +303,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
} | |||
//得出 对应待提交的项目状态 | |||
Integer projectStutas = operationTypeEnum.getProjectStutas(); | |||
Integer projectStatus = operationTypeEnum.getProjectStutas(); | |||
String path = operationTypeEnum.getPath(); | |||
String areaCode = warning.getAreaCode(); | |||
//测试先用分钟 | |||
@@ -311,7 +311,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
List<Project> needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getAreaCode, areaCode) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus, projectStutas)); | |||
.eq(Project::getStatus, projectStatus)); | |||
List<String> projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
@@ -324,7 +324,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { | |||
if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStatus)) { | |||
List<Long> allVersionProjectId = projectService.allVersionProjectIds(p.getProjectCode()); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
// 初验提醒 | |||
@@ -0,0 +1,55 @@ | |||
package com.hz.pm.api.sys.manage; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.workflow.service.ProcessModelService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* WflowModelManage | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 15:07 2024/3/5 | |||
*/ | |||
@Slf4j | |||
@Component | |||
@RequiredArgsConstructor | |||
public class ProcessModelManage { | |||
private final MhUnitCache mhUnitCache; | |||
private final ProcessModelService processModelService; | |||
/** | |||
* 获取单位对应的流程配置 | |||
* | |||
* @param processStage 流程类型 | |||
* @param unitId 单位ID | |||
* @return 流程配置 | |||
*/ | |||
public WflowModels getWflowModels(ProjectProcessStageEnum processStage, Long unitId) { | |||
List<Long> unitIdPaths = mhUnitCache.getUnitIdPaths(unitId); | |||
if (unitIdPaths.isEmpty()) { | |||
log.error("该单位无法进行项目申报:{}", unitId); | |||
return null; | |||
} | |||
List<String> unitIdPathsStr = CollUtils.convert(unitIdPaths, String::valueOf); | |||
String orderSql = String.format(" order by field(region_code, %s) desc limit 1", | |||
CollUtils.join(unitIdPaths, w -> "'" + w + "'", StrUtil.COMMA)); | |||
return processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getProcessType, processStage.getCode()) | |||
.in(WflowModels::getRegionCode, unitIdPathsStr) | |||
.last(orderSql)); | |||
} | |||
} |