|
|
@@ -1,9 +1,12 @@ |
|
|
|
package com.ningdatech.pmapi.projectlib.handle; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; |
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; |
|
|
@@ -60,6 +63,10 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { |
|
|
|
Project project = projectService.getById(projectId); |
|
|
|
Integer status = project.getStatus(); |
|
|
|
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); |
|
|
|
|
|
|
|
//查出历史版本的 所有项目ID |
|
|
|
List<Long> allVersionProjectIds = getAllVersionProjectId(project); |
|
|
|
|
|
|
|
// 项目状态为年度计划中之前的状态 |
|
|
|
if (fieldList.contains(status)){ |
|
|
|
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); |
|
|
@@ -74,7 +81,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { |
|
|
|
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) |
|
|
|
.eq(ProjectStatusChange::getProjectId, projectId) |
|
|
|
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) |
|
|
|
.last("limit 1")); |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); |
|
|
|
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); |
|
|
|
|
|
|
@@ -83,19 +90,33 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { |
|
|
|
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) |
|
|
|
.eq(ProjectStatusChange::getProjectId, projectId) |
|
|
|
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) |
|
|
|
.last("limit 1")); |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); |
|
|
|
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); |
|
|
|
} else { |
|
|
|
// 根据开启方案申报的时间获取 |
|
|
|
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) |
|
|
|
.eq(ProjectStatusChange::getProjectId, projectId) |
|
|
|
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) |
|
|
|
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) |
|
|
|
.last("limit 1")); |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); |
|
|
|
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); |
|
|
|
} |
|
|
|
processDetailVO.setProcessName(CommonConst.ANNUAL_PLAN); |
|
|
|
processSchedule.add(processDetailVO); |
|
|
|
} |
|
|
|
|
|
|
|
private List<Long> getAllVersionProjectId(Project project) { |
|
|
|
//查出 项目code |
|
|
|
String projectCode = project.getProjectCode(); |
|
|
|
|
|
|
|
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(Project::getProjectCode, projectCode)); |
|
|
|
|
|
|
|
if(CollUtil.isEmpty(projects)){ |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
|
|
|
|
return projects.stream().map(Project::getId).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |