@@ -17,7 +17,7 @@ public class GeneratorCodeKingbaseConfig { | |||||
private static final String PATH_YYD = "/Users/wendy/code project/java/project-management/pmapi/src/main/java"; | private static final String PATH_YYD = "/Users/wendy/code project/java/project-management/pmapi/src/main/java"; | ||||
private static final String PATH_LS = ""; | private static final String PATH_LS = ""; | ||||
private static final String PATH_ZPF = "D:\\ningda\\project-management\\pmapi\\src\\main\\java"; | private static final String PATH_ZPF = "D:\\ningda\\project-management\\pmapi\\src\\main\\java"; | ||||
private static final String PATH_CMM = ""; | |||||
private static final String PATH_CMM = "D:\\work\\project-management\\project-management\\pmapi\\src\\main\\java"; | |||||
private static final String URL = "jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; | private static final String URL = "jdbc:kingbase8://120.26.44.207:54321/nd_project_management?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8"; | ||||
private static final String USER_NAME = "SYSTEM"; | private static final String USER_NAME = "SYSTEM"; | ||||
@@ -18,15 +18,19 @@ public class CommonConstant { | |||||
public static final Integer SUB_COMMENT_SIZE_MIN = 0; | public static final Integer SUB_COMMENT_SIZE_MIN = 0; | ||||
public static final Integer SUB_COMMENT_SIZE_MAX = 160; | 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"; | |||||
public static final String PROJECT_DECLARE = "项目申报"; | |||||
public static final String UNIT_INNER_AUDIT = "单位内部审核"; | |||||
public static final String PRELIMINARY_PREVIEW = "项目预审"; | |||||
public static final String DEPT_UNITED_REVIEW = "部门联审"; | |||||
public static final String ANNUAL_PLAN = "年度计划"; | |||||
public static final String CONSTRUCTION_PLAN_REVIEW = "建设方案评审"; | |||||
public static final String PROJECT_APPROVAL = "立项批复"; | |||||
public static final String TENDER_PURCHASE = "招标采购"; | |||||
public static final String PROJECT_PRELIMINARY_INSPECTION = "项目初验"; | |||||
public static final String PROJECT_FINAL_INSPECTION = "项目终验"; | |||||
public static final String ARCHIVED = "归档"; | |||||
} | } |
@@ -6,7 +6,9 @@ import com.ningdatech.pmapi.common.constant.StateMachineConstants; | |||||
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.messaging.Message; | import org.springframework.messaging.Message; | ||||
@@ -16,6 +18,7 @@ import org.springframework.statemachine.persist.StateMachinePersister; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
import java.time.LocalDateTime; | |||||
import java.util.Objects; | import java.util.Objects; | ||||
/** | /** | ||||
@@ -33,17 +36,28 @@ public class StateMachineUtils { | |||||
private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; | private final ProjectDeclareStateMachineBuilder projectDeclareStateMachineBuilder; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
@Resource(name = "projectDeclareStateMachinePersister") | @Resource(name = "projectDeclareStateMachinePersister") | ||||
private StateMachinePersister projectDeclareStateMachinePersister; | private StateMachinePersister projectDeclareStateMachinePersister; | ||||
public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { | public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { | ||||
log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); | log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); | ||||
// 将状态变更记录保存到项目状态变更表中 | |||||
NdProjectStatusChange projectStatusChange = new NdProjectStatusChange(); | |||||
projectStatusChange.setBeforeStatus(project.getStatus()); | |||||
//获取TO状态机 | //获取TO状态机 | ||||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build(); | StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build(); | ||||
Message message = MessageBuilder.withPayload(event).setHeader(PROJECT_DECLARE, project).build(); | Message message = MessageBuilder.withPayload(event).setHeader(PROJECT_DECLARE, project).build(); | ||||
//初始化状态机 | //初始化状态机 | ||||
projectDeclareStateMachinePersister.restore(stateMachine, project); | projectDeclareStateMachinePersister.restore(stateMachine, project); | ||||
stateMachine.sendEvent(message); | stateMachine.sendEvent(message); | ||||
projectStatusChange.setProjectId(project.getId()); | |||||
projectStatusChange.setAfterStatus(project.getStatus()); | |||||
projectStatusChange.setEvent(event.name()); | |||||
projectStatusChange.setCreateOn(LocalDateTime.now()); | |||||
// 插入项目状态变更表中 | |||||
projectStatusChangeService.save(projectStatusChange); | |||||
log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); | log.info("调用状态机后的项目状态为>>>>>>>>>>{}" + project.getStatus()); | ||||
} | } | ||||
@@ -13,6 +13,8 @@ import io.swagger.annotations.ApiOperation; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.List; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* ProjectLibController | * ProjectLibController | ||||
@@ -41,10 +43,9 @@ public class ProjectLibController { | |||||
return projectLibManage.getProjectDetail(id); | return projectLibManage.getProjectDetail(id); | ||||
} | } | ||||
@GetMapping("/totalProcessDetail/{projectId}") | |||||
@ApiOperation("获取流程当前进度") | |||||
private ProcessDetailVO totalProcessDetail(@PathVariable Long projectId){ | |||||
return projectLibManage.totalProcessDetail(projectId); | |||||
@GetMapping("/processSchedule/{projectId}") | |||||
@ApiOperation("项目库申报项目当前进度详情") | |||||
private List<ProcessDetailVO> processScheduleDetail(@PathVariable("projectId") Long projectId){ | |||||
return projectLibManage.processScheduleDetail(projectId); | |||||
} | } | ||||
} | } |
@@ -1,10 +1,13 @@ | |||||
package com.ningdatech.pmapi.projectlib.enumeration; | package com.ningdatech.pmapi.projectlib.enumeration; | ||||
import com.google.common.collect.Lists; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import lombok.Getter; | import lombok.Getter; | ||||
import lombok.NoArgsConstructor; | import lombok.NoArgsConstructor; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Objects; | import java.util.Objects; | ||||
@Getter | @Getter | ||||
@@ -38,4 +41,12 @@ public enum StepStatusEnum { | |||||
} | } | ||||
return StringUtils.EMPTY; | return StringUtils.EMPTY; | ||||
} | } | ||||
public boolean eq(String val) { | |||||
return this.name().equals(val); | |||||
} | |||||
public static boolean contains (StepStatusEnum e, List<StepStatusEnum> enums){ | |||||
return enums.contains(e); | |||||
} | |||||
} | } |
@@ -0,0 +1,30 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import java.util.List; | |||||
/** | |||||
* 流程业务抽象处理类 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:22 | |||||
*/ | |||||
public abstract class AbstractProcessBusinessHandle { | |||||
/** | |||||
* 构造,子类必须实现 | |||||
*/ | |||||
public AbstractProcessBusinessHandle(){} | |||||
/** | |||||
* 抽象的,所有具体处理者应该实现的处理逻辑 | |||||
* @param projectId | |||||
* @param processSchedule | |||||
* @return void | |||||
* @author CMM | |||||
* @since 2023/02/27 9:01 | |||||
*/ | |||||
abstract void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule); | |||||
} |
@@ -0,0 +1,100 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.util.Collection; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Objects; | |||||
import java.util.stream.Collectors; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
/** | |||||
* 年度计划处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(5) | |||||
@Component | |||||
public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||||
private final AnnualPlanLibManage annualPlanLibManage; | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
public AnnualPlanHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService){ | |||||
this.annualPlanLibManage = annualPlanLibManage; | |||||
this.projectStatusChangeService = projectStatusChangeService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据年度计划库列表是否包含该项目以及是否开启方案申报判断年度计划是否开始 | |||||
ProjectListReq req = new ProjectListReq(); | |||||
PageVo<AnnualPlanListItemVO> planLibList = annualPlanLibManage.annulPlanLibList(req); | |||||
Collection<AnnualPlanListItemVO> records = planLibList.getRecords(); | |||||
Map<Long, AnnualPlanListItemVO> itemVOMap = records.stream() | |||||
.collect(Collectors.toMap(AnnualPlanListItemVO::getProjectId, v -> v)); | |||||
AnnualPlanListItemVO itemVO = itemVOMap.get(projectId); | |||||
// 年度计划库中不包含当前项目 | |||||
if (Objects.isNull(itemVO)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
Boolean isStartDeclaredProject = itemVO.getIsStartDeclaredProject(); | |||||
// 年度计划库中包含当前项目但未开启方案申报 | |||||
if (Boolean.FALSE.equals(isStartDeclaredProject)) { | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
// 年度计划库包含当前项目且开启了方案申报 | |||||
Integer status = itemVO.getStatus(); | |||||
if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ | |||||
// 根据部门联审通过的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||||
} else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { | |||||
// 根据年度计划暂缓的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | |||||
} else { | |||||
// 根据开启方案申报的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | |||||
processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -0,0 +1,59 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.util.List; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
/** | |||||
* 归档处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(11) | |||||
@Component | |||||
public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectService projectService; | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
public ArchivedHandle( IProjectService projectService, INdProjectStatusChangeService projectStatusChangeService){ | |||||
this.projectService = projectService; | |||||
this.projectStatusChangeService = projectStatusChangeService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
Project project = projectService.getById(projectId); | |||||
Integer status = project.getStage(); | |||||
// 根据项目阶段判断是否已归档 | |||||
// 项目阶段不为已归档 | |||||
if (!ProjectStatusEnum.ARCHIVED.getCode().equals(status)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.ARCHIVED); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
// 项目阶段为已归档 | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
// 根据项目终验获取归档时间 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setProcessName(CommonConstant.ARCHIVED); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -0,0 +1,82 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.wflow.workflow.bean.process.ProgressNode; | |||||
import org.springframework.core.annotation.Order; | |||||
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 | |||||
*/ | |||||
@Order(6) | |||||
@Component | |||||
public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | |||||
private final ProcessInstanceService processInstanceService; | |||||
public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||||
this.projectInstService = projectInstService; | |||||
this.processInstanceService = processInstanceService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据项目ID查询出建设方案评审流程的流程状态 | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getProjectId, projectId) | |||||
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) | |||||
.orderByDesc(ProjectInst::getCreatOn) | |||||
.last("limit 1")); | |||||
if (Objects.isNull(projectInst)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.CONSTRUCTION_PLAN_REVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
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); | |||||
} | |||||
// 根据流程处理详情获取流程完成时间 | |||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||||
StepStatusEnum.COMPLETED))){ | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
} | |||||
processDetailVO.setProcessProgressVo(instanceDetail); | |||||
processDetailVO.setProcessName(CommonConstant.CONSTRUCTION_PLAN_REVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -1,8 +1,13 @@ | |||||
package com.ningdatech.pmapi.projectlib.handler; | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | |||||
import java.util.Objects; | import java.util.Objects; | ||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.wflow.workflow.bean.process.ProgressNode; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
@@ -22,35 +27,32 @@ import com.wflow.workflow.service.ProcessInstanceService; | |||||
* @author CMM | * @author CMM | ||||
* @since 2023/02/24 14:35 | * @since 2023/02/24 14:35 | ||||
*/ | */ | ||||
@Order(4) | |||||
@Component | @Component | ||||
public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandler{ | |||||
public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
/** | |||||
* 设置该业务前缀 | |||||
*/ | |||||
private static final String PREFIX = CommonConstant.DEPT_UNITED_REVIEW_PREFIX; | |||||
public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | ||||
setPrefix(PREFIX); | |||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
} | } | ||||
@Override | @Override | ||||
ProcessDetailVO businessHandle(Long projectId) { | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
// 根据项目ID查询出单位内部审核流程的流程状态 | |||||
// 注意:已经在项目库中的项目,一定是已经开始的项目 | |||||
// 根据项目ID查询出部门联审流程的流程状态 | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | ||||
.eq(ProjectInst::getProjectId, projectId) | .eq(ProjectInst::getProjectId, projectId) | ||||
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode())); | |||||
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) | |||||
.orderByDesc(ProjectInst::getCreatOn) | |||||
.last("limit 1")); | |||||
if (Objects.isNull(projectInst)){ | if (Objects.isNull(projectInst)){ | ||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | ||||
return processDetailVO; | |||||
processDetailVO.setProcessName(CommonConstant.DEPT_UNITED_REVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | } | ||||
String instCode = projectInst.getInstCode(); | String instCode = projectInst.getInstCode(); | ||||
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | ||||
@@ -63,8 +65,16 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandler{ | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
LocalDateTime finishTime = processDetailVO.getFinishTime(); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
return processDetailVO; | |||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||||
StepStatusEnum.COMPLETED))){ | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
} | |||||
processDetailVO.setProcessProgressVo(instanceDetail); | |||||
processDetailVO.setProcessName(CommonConstant.DEPT_UNITED_REVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,79 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
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.process.ProgressNode; | |||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||||
import com.wflow.workflow.service.ProcessInstanceService; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* 项目预审处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/27 10:09 | |||||
*/ | |||||
@Order(3) | |||||
@Component | |||||
public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | |||||
private final ProcessInstanceService processInstanceService; | |||||
public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService) { | |||||
this.projectInstService = projectInstService; | |||||
this.processInstanceService = processInstanceService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
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()) | |||||
.orderByDesc(ProjectInst::getCreatOn) | |||||
.last("limit 1")); | |||||
if (Objects.isNull(projectInst)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
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); | |||||
} | |||||
// 根据流程处理详情获取流程完成时间 | |||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||||
StepStatusEnum.COMPLETED))){ | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
} | |||||
processDetailVO.setProcessProgressVo(instanceDetail); | |||||
processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -0,0 +1,52 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.BeansException; | |||||
import org.springframework.beans.factory.BeanFactoryUtils; | |||||
import org.springframework.beans.factory.InitializingBean; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.context.ApplicationContext; | |||||
import org.springframework.context.ApplicationContextAware; | |||||
import org.springframework.stereotype.Component; | |||||
import java.util.ArrayList; | |||||
import java.util.Collections; | |||||
import java.util.List; | |||||
/** | |||||
* 流程执行链 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/26 21:36 | |||||
*/ | |||||
@Component | |||||
public class ProcessExecuteHandle { | |||||
/** | |||||
* 具体处理者的集合 | |||||
*/ | |||||
private final List<AbstractProcessBusinessHandle> processBusinessHandles; | |||||
public ProcessExecuteHandle(List<AbstractProcessBusinessHandle> processBusinessHandles) { | |||||
this.processBusinessHandles = processBusinessHandles; | |||||
} | |||||
/** | |||||
* 遍历处理链,通过前缀判断能否处理逻辑,如果不能继续遍历 | |||||
* @param projectId | |||||
* @return void | |||||
* @author CMM | |||||
* @since 2023/02/26 | |||||
*/ | |||||
public List<ProcessDetailVO> handle(Long projectId, List<ProcessDetailVO> processSchedule){ | |||||
if (processBusinessHandles.size() > 0) { | |||||
for (AbstractProcessBusinessHandle processBusinessHandle : processBusinessHandles) { | |||||
processBusinessHandle.businessHandle(projectId, processSchedule); | |||||
} | |||||
return processSchedule; | |||||
} | |||||
return Collections.emptyList(); | |||||
} | |||||
} |
@@ -0,0 +1,114 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | |||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||||
/** | |||||
* 立项批复处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(7) | |||||
@Component | |||||
public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
private final AnnualPlanLibManage annualPlanLibManage; | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | |||||
/** | |||||
* 项目状态为:待立项批复及之后的状态 | |||||
*/ | |||||
private static final List<ProjectStatusEnum> ANNUAL_PLAN_LIST_STATUS = Arrays.asList( | |||||
TO_BE_APPROVED, | |||||
PROJECT_APPROVED, | |||||
TO_BE_PURCHASED, | |||||
UNDER_CONSTRUCTION, | |||||
TO_BE_FINALLY_INSPECTED, | |||||
FINAL_ACCEPTANCE_IS_UNDER_REVIEW, | |||||
FINAL_ACCEPTANCE_REVIEW_FAILED, | |||||
ARCHIVED | |||||
); | |||||
public ProjectApprovalHandle(AnnualPlanLibManage annualPlanLibManage, INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||||
this.annualPlanLibManage = annualPlanLibManage; | |||||
this.projectStatusChangeService = projectStatusChangeService; | |||||
this.projectService = projectService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据年度计划库列表是否包含该项目以及建设方案评审流程是否通过来判断立项批复是否开始 | |||||
ProjectListReq req = new ProjectListReq(); | |||||
PageVo<AnnualPlanListItemVO> planLibList = annualPlanLibManage.annulPlanLibList(req); | |||||
Collection<AnnualPlanListItemVO> records = planLibList.getRecords(); | |||||
Map<Long, AnnualPlanListItemVO> itemVOMap = records.stream() | |||||
.collect(Collectors.toMap(AnnualPlanListItemVO::getProjectId, v -> v)); | |||||
AnnualPlanListItemVO itemVO = itemVOMap.get(projectId); | |||||
// 年度计划库中不包含当前项目 | |||||
if (Objects.isNull(itemVO)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.PROJECT_APPROVAL); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
Integer projectStatus = itemVO.getStatus(); | |||||
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); | |||||
// 年度计划库中包含当前项目,但当前项目状态在待立项批复之前 | |||||
if (!fieldList.contains(projectStatus)) { | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.ANNUAL_PLAN); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
// 年度计划库包含当前项目且当前项目状态为待立项批复 | |||||
Integer status = itemVO.getStatus(); | |||||
if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ | |||||
// 根据建设方案评审通过的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||||
} else { | |||||
// 年度计划库包含当前项目且当前项目状态为待立项批复之后的状态 | |||||
// 根据立项批复的时间获取 | |||||
Project project = projectService.getById(projectId); | |||||
LocalDate approvalDate = project.getApprovalDate(); | |||||
LocalDateTime approvalDateTime = approvalDate.atStartOfDay(); | |||||
processDetailVO.setFinishTime(approvalDateTime); | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
} | |||||
processDetailVO.setProcessName(CommonConstant.PROJECT_APPROVAL); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -1,13 +1,15 @@ | |||||
package com.ningdatech.pmapi.projectlib.handler; | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | import com.ningdatech.pmapi.common.constant.CommonConstant; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 项目申报处理 | * 项目申报处理 | ||||
@@ -16,22 +18,18 @@ import java.time.LocalDateTime; | |||||
* @since 2023/02/24 14:35 | * @since 2023/02/24 14:35 | ||||
*/ | */ | ||||
public class ProjectDeclareHandle extends AbstractProcessBusinessHandler{ | |||||
@Order(1) | |||||
@Component | |||||
public class ProjectDeclareHandle extends AbstractProcessBusinessHandle { | |||||
@Autowired | |||||
private IProjectService projectService; | |||||
private final IProjectService projectService; | |||||
/** | |||||
* 设置该业务前缀 | |||||
*/ | |||||
private static final String PREFIX = CommonConstant.PROJECT_DECLARE_PREFIX; | |||||
public ProjectDeclareHandle(){ | |||||
setPrefix(PREFIX); | |||||
public ProjectDeclareHandle(IProjectService projectService){ | |||||
this.projectService = projectService; | |||||
} | } | ||||
@Override | @Override | ||||
ProcessDetailVO businessHandle(Long projectId) { | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
// 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 | // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 | ||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
@@ -39,6 +37,7 @@ public class ProjectDeclareHandle extends AbstractProcessBusinessHandler{ | |||||
Project project = projectService.getById(projectId); | Project project = projectService.getById(projectId); | ||||
LocalDateTime createOn = project.getCreateOn(); | LocalDateTime createOn = project.getCreateOn(); | ||||
processDetailVO.setFinishTime(createOn); | processDetailVO.setFinishTime(createOn); | ||||
return processDetailVO; | |||||
processDetailVO.setProcessName(CommonConstant.PROJECT_DECLARE); | |||||
processSchedule.add(processDetailVO); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,82 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||||
import com.wflow.workflow.bean.process.ProgressNode; | |||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||||
import com.wflow.workflow.service.ProcessInstanceService; | |||||
import org.springframework.core.annotation.Order; | |||||
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.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
/** | |||||
* 项目终验处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(10) | |||||
@Component | |||||
public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | |||||
private final ProcessInstanceService processInstanceService; | |||||
public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||||
this.projectInstService = projectInstService; | |||||
this.processInstanceService = processInstanceService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据项目ID查询出项目终验流程的流程状态 | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||||
.eq(ProjectInst::getProjectId, projectId) | |||||
.eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) | |||||
.orderByDesc(ProjectInst::getCreatOn) | |||||
.last("limit 1")); | |||||
if (Objects.isNull(projectInst)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.PROJECT_FINAL_INSPECTION); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
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); | |||||
} | |||||
// 根据流程处理详情获取流程完成时间 | |||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||||
StepStatusEnum.COMPLETED))){ | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
} | |||||
processDetailVO.setProcessProgressVo(instanceDetail); | |||||
processDetailVO.setProcessName(CommonConstant.PRELIMINARY_PREVIEW); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -0,0 +1,82 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||||
import java.util.Arrays; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
/** | |||||
* 项目初验处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(9) | |||||
@Component | |||||
public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessHandle { | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | |||||
/** | |||||
* 项目状态为:建设中及之后的状态 | |||||
*/ | |||||
private static final List<ProjectStatusEnum> ANNUAL_PLAN_LIST_STATUS = Arrays.asList( | |||||
UNDER_CONSTRUCTION, | |||||
TO_BE_FINALLY_INSPECTED, | |||||
FINAL_ACCEPTANCE_IS_UNDER_REVIEW, | |||||
FINAL_ACCEPTANCE_REVIEW_FAILED, | |||||
ARCHIVED | |||||
); | |||||
public ProjectPreliminaryInspectionHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||||
this.projectStatusChangeService = projectStatusChangeService; | |||||
this.projectService = projectService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据项目状态是否在建设中及之后的状态判断项目初验是否开始 | |||||
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); | |||||
Project project = projectService.getById(projectId); | |||||
Integer status = project.getStatus(); | |||||
// 项目状态不在建设中及之后的状态 | |||||
if (!fieldList.contains(status)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.PROJECT_PRELIMINARY_INSPECTION); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
// 项目状态为建设中或之后的状态 | |||||
if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(project.getStatus())){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||||
}else { | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
// 根据初验备案的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
} | |||||
processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -0,0 +1,86 @@ | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | |||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.basic.util.CollUtils; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
/** | |||||
* 招标采购处理 | |||||
* | |||||
* @author CMM | |||||
* @since 2023/02/24 14:35 | |||||
*/ | |||||
@Order(8) | |||||
@Component | |||||
public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final IProjectService projectService; | |||||
/** | |||||
* 项目状态为:建设中及之后的状态 | |||||
*/ | |||||
private static final List<ProjectStatusEnum> ANNUAL_PLAN_LIST_STATUS = Arrays.asList( | |||||
UNDER_CONSTRUCTION, | |||||
TO_BE_FINALLY_INSPECTED, | |||||
FINAL_ACCEPTANCE_IS_UNDER_REVIEW, | |||||
FINAL_ACCEPTANCE_REVIEW_FAILED, | |||||
ARCHIVED | |||||
); | |||||
public TenderPurchaseHandle(INdProjectStatusChangeService projectStatusChangeService, IProjectService projectService){ | |||||
this.projectStatusChangeService = projectStatusChangeService; | |||||
this.projectService = projectService; | |||||
} | |||||
@Override | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | |||||
// 根据项目是否通过立项批复(立项批复时间)来判断招标采购是否开始 | |||||
Project project = projectService.getById(projectId); | |||||
Integer status = project.getStatus(); | |||||
// 未进行立项批复 | |||||
if (Objects.isNull(project.getApprovalDate())){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.NOT_START); | |||||
processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); | |||||
processSchedule.add(processDetailVO); | |||||
return; | |||||
} | |||||
List<Integer> fieldList = CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode); | |||||
// 进行了立项批复且项目状态是待采购 | |||||
if (ProjectStatusEnum.TO_BE_PURCHASED.getCode().equals(project.getStatus())){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | |||||
}else if (fieldList.contains(status)){ | |||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||||
// 根据采购备案的时间获取 | |||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) | |||||
.last("limit 1")); | |||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | |||||
} | |||||
processDetailVO.setProcessName(CommonConstant.TENDER_PURCHASE); | |||||
processSchedule.add(processDetailVO); | |||||
} | |||||
} |
@@ -1,8 +1,11 @@ | |||||
package com.ningdatech.pmapi.projectlib.handler; | |||||
package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | ||||
@@ -10,9 +13,11 @@ import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | import com.ningdatech.pmapi.common.constant.CommonConstant; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.bean.process.ProgressNode; | |||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | import com.wflow.workflow.bean.vo.ProcessProgressVo; | ||||
import com.wflow.workflow.enums.ProcessStatusEnum; | import com.wflow.workflow.enums.ProcessStatusEnum; | ||||
import com.wflow.workflow.service.ProcessInstanceService; | import com.wflow.workflow.service.ProcessInstanceService; | ||||
import org.springframework.core.annotation.Order; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
/** | /** | ||||
@@ -21,32 +26,29 @@ import org.springframework.stereotype.Component; | |||||
* @author CMM | * @author CMM | ||||
* @since 2023/02/24 14:35 | * @since 2023/02/24 14:35 | ||||
*/ | */ | ||||
@Order(2) | |||||
@Component | @Component | ||||
public class UnitInnerAuditHandle extends AbstractProcessBusinessHandler{ | |||||
public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
/** | |||||
* 设置该业务前缀 | |||||
*/ | |||||
private static final String PREFIX = CommonConstant.UNIT_INNER_AUDIT_PREFIX; | |||||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | ||||
setPrefix(PREFIX); | |||||
this.projectInstService = projectInstService; | this.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
} | } | ||||
@Override | @Override | ||||
ProcessDetailVO businessHandle(Long projectId) { | |||||
void businessHandle(Long projectId, List<ProcessDetailVO> processSchedule) { | |||||
ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ProcessDetailVO processDetailVO = new ProcessDetailVO(); | ||||
// 根据项目ID查询出单位内部审核流程的流程状态 | // 根据项目ID查询出单位内部审核流程的流程状态 | ||||
// 注意:已经在项目库中的项目,一定是已经开始的项目 | |||||
// 注意:已经在项目库中的项目,一定是单位内部审核已经开始的项目 | |||||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | ||||
.eq(ProjectInst::getProjectId, projectId) | .eq(ProjectInst::getProjectId, projectId) | ||||
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode())); | |||||
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) | |||||
.orderByDesc(ProjectInst::getCreatOn) | |||||
.last("limit 1")); | |||||
String instCode = projectInst.getInstCode(); | String instCode = projectInst.getInstCode(); | ||||
ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); | ||||
String status = instanceDetail.getStatus(); | String status = instanceDetail.getStatus(); | ||||
@@ -57,9 +59,17 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandler{ | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 项目库中查出申报完成时间 | |||||
LocalDateTime finishTime = processDetailVO.getFinishTime(); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
return processDetailVO; | |||||
// 根据流程处理详情获取流程完成时间 | |||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||||
StepStatusEnum.COMPLETED))){ | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||||
processDetailVO.setFinishTime(finishTime); | |||||
} | |||||
processDetailVO.setProcessProgressVo(instanceDetail); | |||||
processDetailVO.setProcessName(CommonConstant.UNIT_INNER_AUDIT); | |||||
processSchedule.add(processDetailVO); | |||||
} | } | ||||
} | } |
@@ -1,43 +0,0 @@ | |||||
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); | |||||
} |
@@ -89,6 +89,7 @@ public class AnnualPlanLibManage { | |||||
page.getRecords().forEach(w -> { | page.getRecords().forEach(w -> { | ||||
AnnualPlanListItemVO item = new AnnualPlanListItemVO(); | AnnualPlanListItemVO item = new AnnualPlanListItemVO(); | ||||
item.setProjectId(w.getId()); | item.setProjectId(w.getId()); | ||||
item.setProjectId(w.getId()); | |||||
item.setProjectName(w.getProjectName()); | item.setProjectName(w.getProjectName()); | ||||
item.setStage(w.getStage()); | item.setStage(w.getStage()); | ||||
item.setStatus(w.getStatus()); | item.setStatus(w.getStatus()); | ||||
@@ -7,6 +7,7 @@ import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteHandle; | |||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
@@ -23,10 +24,7 @@ import lombok.RequiredArgsConstructor; | |||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import java.util.Arrays; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
import java.util.Optional; | |||||
import java.util.*; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -41,10 +39,9 @@ import java.util.Optional; | |||||
public class ProjectLibManage { | public class ProjectLibManage { | ||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | ||||
private final ProcessExecuteHandle processExecuteHandle; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
@@ -126,7 +123,8 @@ public class ProjectLibManage { | |||||
return vo; | return vo; | ||||
} | } | ||||
public ProcessDetailVO totalProcessDetail(Long projectId) { | |||||
return null; | |||||
public List<ProcessDetailVO> processScheduleDetail(Long projectId) { | |||||
List<ProcessDetailVO> processDetailVOS = new ArrayList<>(); | |||||
return processExecuteHandle.handle(projectId, processDetailVOS); | |||||
} | } | ||||
} | } |
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.projectlib.mapper; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
public interface NdProjectStatusChangeMapper extends BaseMapper<NdProjectStatusChange> { | |||||
} |
@@ -0,0 +1,5 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper"> | |||||
</mapper> |
@@ -0,0 +1,95 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
@TableName("nd_project_status_change") | |||||
@ApiModel(value = "NdProjectStatusChange对象", description = "") | |||||
public class NdProjectStatusChange implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
private Long id; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
@ApiModelProperty("状态机执行前的项目状态") | |||||
private Integer beforeStatus; | |||||
@ApiModelProperty("状态机执行后的项目状态") | |||||
private Integer afterStatus; | |||||
@ApiModelProperty("状态变更对应的事件") | |||||
private String event; | |||||
@ApiModelProperty("状态变更发生的时间") | |||||
private LocalDateTime createOn; | |||||
public Long getId() { | |||||
return id; | |||||
} | |||||
public void setId(Long id) { | |||||
this.id = id; | |||||
} | |||||
public Long getProjectId() { | |||||
return projectId; | |||||
} | |||||
public void setProjectId(Long projectId) { | |||||
this.projectId = projectId; | |||||
} | |||||
public Integer getBeforeStatus() { | |||||
return beforeStatus; | |||||
} | |||||
public void setBeforeStatus(Integer beforeStatus) { | |||||
this.beforeStatus = beforeStatus; | |||||
} | |||||
public Integer getAfterStatus() { | |||||
return afterStatus; | |||||
} | |||||
public void setAfterStatus(Integer afterStatus) { | |||||
this.afterStatus = afterStatus; | |||||
} | |||||
public String getEvent() { | |||||
return event; | |||||
} | |||||
public void setEvent(String event) { | |||||
this.event = event; | |||||
} | |||||
public LocalDateTime getCreateOn() { | |||||
return createOn; | |||||
} | |||||
public void setCreateOn(LocalDateTime createOn) { | |||||
this.createOn = createOn; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "NdProjectStatusChange{" + | |||||
"id=" + id + | |||||
", projectId=" + projectId + | |||||
", beforeStatus=" + beforeStatus + | |||||
", afterStatus=" + afterStatus + | |||||
", event=" + event + | |||||
", createOn=" + createOn + | |||||
"}"; | |||||
} | |||||
} |
@@ -26,6 +26,9 @@ public class ProcessDetailVO implements Serializable { | |||||
@ApiModelProperty("环节状态") | @ApiModelProperty("环节状态") | ||||
private StepStatusEnum stepStatus; | private StepStatusEnum stepStatus; | ||||
@ApiModelProperty("流程名称") | |||||
private String processName; | |||||
@ApiModelProperty("完成时间") | @ApiModelProperty("完成时间") | ||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") | ||||
private LocalDateTime finishTime; | private LocalDateTime finishTime; | ||||
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.projectlib.service; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
public interface INdProjectStatusChangeService extends IService<NdProjectStatusChange> { | |||||
} |
@@ -0,0 +1,20 @@ | |||||
package com.ningdatech.pmapi.projectlib.service.impl; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; | |||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
@Service | |||||
public class NdProjectStatusChangeServiceImpl extends ServiceImpl<NdProjectStatusChangeMapper, NdProjectStatusChange> implements INdProjectStatusChangeService { | |||||
} |
@@ -252,7 +252,7 @@ public class TodoCenterManage { | |||||
// 如果流程状态是被退回状态,流程通过后,进入下一个审核人, | // 如果流程状态是被退回状态,流程通过后,进入下一个审核人, | ||||
// 当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 | // 当前通过审核人一定不是最后一个审核人(下一个审核人至多是最后一个),更新流程状态为审核中 | ||||
if (ProcessStatusEnum.BE_BACKED.getCode().equals(currentProcessStatus)) { | |||||
if (ProcessStatusEnum.BE_BACKED.getDesc().equals(currentProcessStatus)) { | |||||
// 更新流程状态为审核中 | // 更新流程状态为审核中 | ||||
declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); | declaredProject.setProcessStatus(ProcessStatusEnum.UNDER_REVIEW.getCode()); | ||||
declaredProject.setUpdateOn(LocalDateTime.now()); | declaredProject.setUpdateOn(LocalDateTime.now()); | ||||