@@ -65,7 +65,7 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = getAllVersionProjectId(project); | |||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | |||
// 项目状态为年度计划中之前的状态 | |||
if (fieldList.contains(status)){ | |||
@@ -79,44 +79,35 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||
if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ | |||
// 根据部门联审通过的时间获取 | |||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getProjectId, projectId) | |||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) | |||
.last(BizConst.LIMIT_1)); | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||
if(Objects.nonNull(projectStatusChange)){ | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||
} | |||
} else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { | |||
// 根据年度计划暂缓的时间获取 | |||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getProjectId, projectId) | |||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) | |||
.last(BizConst.LIMIT_1)); | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | |||
if(Objects.nonNull(projectStatusChange)){ | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | |||
} | |||
} else { | |||
// 根据开启方案申报的时间获取 | |||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) | |||
.last(BizConst.LIMIT_1)); | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
if(Objects.nonNull(projectStatusChange)){ | |||
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()); | |||
} | |||
} |
@@ -2,6 +2,9 @@ package com.ningdatech.pmapi.projectlib.handle; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -37,6 +40,8 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
Integer status = project.getStage(); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | |||
// 根据项目阶段判断是否已归档 | |||
// 项目阶段不为已归档 | |||
if (!ProjectStatusEnum.ARCHIVED.getCode().equals(status)){ | |||
@@ -49,11 +54,13 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
// 根据项目终验获取归档时间 | |||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||
.eq(ProjectStatusChange::getProjectId, projectId) | |||
.in(ProjectStatusChange::getProjectId, allVersionProjectIds) | |||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) | |||
.last("limit 1")); | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setProcessName(CommonConst.ARCHIVED); | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(projectStatusChange)){ | |||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||
processDetailVO.setProcessName(CommonConst.ARCHIVED); | |||
} | |||
processSchedule.add(processDetailVO); | |||
} | |||
} |
@@ -55,6 +55,8 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||
Project project = projectService.getById(projectId); | |||
//查出历史版本的 所有项目ID | |||
List<Long> allVersionProjectIds = projectService.getAllVersionProjectId(project); | |||
// 根据项目ID查询出建设方案评审流程的流程状态 | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getProjectId, projectId) | |||
@@ -613,8 +613,4 @@ public class ProjectLibManage { | |||
} | |||
return user; | |||
} | |||
private void copyProperties(ProjectDTO projecDto, Project project) { | |||
} | |||
} |
@@ -3,6 +3,8 @@ package com.ningdatech.pmapi.projectlib.service; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* 服务类 | |||
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||
*/ | |||
public interface IProjectService extends IService<Project> { | |||
public List<Long> getAllVersionProjectId(Project project); | |||
} |
@@ -1,11 +1,17 @@ | |||
package com.ningdatech.pmapi.projectlib.service.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.mapper.ProjectMapper; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
@@ -17,4 +23,18 @@ import org.springframework.stereotype.Service; | |||
@Service | |||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService { | |||
@Override | |||
public List<Long> getAllVersionProjectId(Project project) { | |||
//查出 项目code | |||
String projectCode = project.getProjectCode(); | |||
List<Project> projects = 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()); | |||
} | |||
} |