@@ -1,2 +1,12 @@ | |||||
ALTER TABLE PUBLIC."nd_project" ADD "org_credit_code" VARCHAR(60); | ALTER TABLE PUBLIC."nd_project" ADD "org_credit_code" VARCHAR(60); | ||||
comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码'; | |||||
comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码'; | |||||
ALTER TABLE nd_project ADD COLUMN is_super_org int2 NOT NULL DEFAULT 0; | |||||
comment ON COLUMN nd_project.is_super_org IS '是否有主管单位'; | |||||
ALTER TABLE nd_project ADD COLUMN is_higher_super_org int2 NOT NULL DEFAULT 0; | |||||
comment ON COLUMN nd_project.is_higher_super_org IS '是否有上级条线主管单位'; | |||||
ALTER TABLE nd_project_draft ADD COLUMN is_super_org int2 NOT NULL DEFAULT 0; | |||||
comment ON COLUMN nd_project_draft.is_super_org IS '是否有主管单位'; | |||||
ALTER TABLE nd_project_draft ADD COLUMN is_higher_super_org int2 NOT NULL DEFAULT 0; | |||||
comment ON COLUMN nd_project_draft.is_higher_super_org IS '是否有上级条线主管单位'; |
@@ -41,6 +41,21 @@ public class StateMachineUtils { | |||||
@Resource(name = "projectDeclareStateMachinePersister") | @Resource(name = "projectDeclareStateMachinePersister") | ||||
private StateMachinePersister projectDeclareStateMachinePersister; | private StateMachinePersister projectDeclareStateMachinePersister; | ||||
//通过审核 | |||||
public void pass(Project project) throws Exception { | |||||
execute(project,getProjectStatusPassEvent(project.getStatus())); | |||||
} | |||||
//拒绝 | |||||
public void reject(Project project) throws Exception { | |||||
execute(project,getProjectStatusRejectEvent(project.getStatus())); | |||||
} | |||||
//撤回 | |||||
public void withDraw(Project project) throws Exception { | |||||
execute(project,getProjectStatusWithdrawEvent(project.getStatus())); | |||||
} | |||||
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()); | ||||
// 将状态变更记录保存到项目状态变更表中 | // 将状态变更记录保存到项目状态变更表中 | ||||
@@ -118,7 +118,7 @@ public class ConstructionPlanManage { | |||||
); | ); | ||||
params.setFormData(dto.getFormData()); | params.setFormData(dto.getFormData()); | ||||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId); | |||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo); | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("建设方案项目申报成功 【{}】", instanceId); | log.info("建设方案项目申报成功 【{}】", instanceId); | ||||
@@ -141,7 +141,7 @@ public class ConstructionPlanManage { | |||||
project.setInstCode(instanceId); | project.setInstCode(instanceId); | ||||
project.setConstructionPlanFile(constructionPlanFile); | project.setConstructionPlanFile(constructionPlanFile); | ||||
//调用状态机 进入下一个通过状态 | //调用状态机 进入下一个通过状态 | ||||
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); | |||||
stateMachineUtils.pass(project); | |||||
projectService.updateById(project); | projectService.updateById(project); | ||||
//保存项目和实例的关系 | //保存项目和实例的关系 | ||||
@@ -144,7 +144,9 @@ public class DeclaredProjectManage { | |||||
params.setFormData(dto.getFormData()); | params.setFormData(dto.getFormData()); | ||||
//开始申报 | //开始申报 | ||||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId); | |||||
Project project = new Project(); | |||||
BeanUtils.copyProperties(projectInfo,project); | |||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("申报项目成功 【{}】", instanceId); | log.info("申报项目成功 【{}】", instanceId); | ||||
@@ -208,7 +210,9 @@ public class DeclaredProjectManage { | |||||
); | ); | ||||
params.setFormData(dto.getFormData()); | params.setFormData(dto.getFormData()); | ||||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId); | |||||
Project project = new Project(); | |||||
BeanUtils.copyProperties(projectInfo,project); | |||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("重新申报项目成功 【{}】", instanceId); | log.info("重新申报项目成功 【{}】", instanceId); | ||||
@@ -317,8 +321,9 @@ public class DeclaredProjectManage { | |||||
ProjectDTO projectInfo = dto.getProjectInfo(); | ProjectDTO projectInfo = dto.getProjectInfo(); | ||||
ProjectDraft draft = new ProjectDraft(); | ProjectDraft draft = new ProjectDraft(); | ||||
BeanUtils.copyProperties(projectInfo, draft); | BeanUtils.copyProperties(projectInfo, draft); | ||||
draft.setUserId(dto.getUser().getUserId()); | |||||
draft.setUserId(String.valueOf(userId)); | |||||
draft.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | draft.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | ||||
draft.setBuildOrgName(userInfoDetails.getOrganizationName()); | |||||
draft.setAreaCode(userInfoDetails.getRegionCode()); | draft.setAreaCode(userInfoDetails.getRegionCode()); | ||||
if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ | if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ | ||||
@@ -67,7 +67,7 @@ public class DefaultDeclaredProjectManage { | |||||
.build(); | .build(); | ||||
} | } | ||||
public Map<String, OrgInfoDTO> getOrgModelInfo(Long userId) { | |||||
public Map<String, OrgInfoDTO> getOrgModelInfo(Long userId,Project project) { | |||||
Map<String, OrgInfoDTO> orgMap = new HashMap<>(); | Map<String, OrgInfoDTO> orgMap = new HashMap<>(); | ||||
// 查出所有的单位流程配置 | // 查出所有的单位流程配置 | ||||
@@ -80,13 +80,13 @@ public class DefaultDeclaredProjectManage { | |||||
String startOrgName = startOrg.getOrganizationName(); | String startOrgName = startOrg.getOrganizationName(); | ||||
String startOrgParentCode; | String startOrgParentCode; | ||||
String startOrgParentName; | String startOrgParentName; | ||||
// 如果没有上级主管单位,由该单位自己审核 | |||||
if (Objects.isNull(startOrg.getParentCode())){ | |||||
// 如果申报时 上级主管单位,由该单位自己审核 | |||||
if (Objects.isNull(project.getSuperOrgCode())){ | |||||
startOrgParentCode = startOrgCode; | startOrgParentCode = startOrgCode; | ||||
startOrgParentName = startOrgName; | startOrgParentName = startOrgName; | ||||
}else { | }else { | ||||
startOrgParentCode = startOrg.getParentCode(); | |||||
startOrgParentName = startOrg.getParentName(); | |||||
startOrgParentCode = project.getSuperOrgCode(); | |||||
startOrgParentName = project.getSuperOrg(); | |||||
} | } | ||||
//查询 当前发起人及主管单位所在区域的 单位流程配置 | //查询 当前发起人及主管单位所在区域的 单位流程配置 | ||||
OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); | OrgInfoDTO startOrgInfoDto = new OrgInfoDTO(); | ||||
@@ -113,8 +113,6 @@ public class DefaultDeclaredProjectManage { | |||||
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); | orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); | ||||
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); | orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); | ||||
// TODO 上级条线主管单位信息(可能是多个) | |||||
// 如果是指定单位,直接根据流程定义ID放入map | // 如果是指定单位,直接根据流程定义ID放入map | ||||
OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); | OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); | ||||
orgInfoDTO.setOrgModelMap(orgModelsList.stream() | orgInfoDTO.setOrgModelMap(orgModelsList.stream() | ||||
@@ -107,7 +107,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
//使用状态机 进入下一步 看看需不需要走省级审批 | //使用状态机 进入下一步 看看需不需要走省级审批 | ||||
try { | try { | ||||
stateMachineUtils.execute(projectInfo,stateMachineUtils.getProjectStatusPassEvent(projectInfo.getStatus())); | |||||
stateMachineUtils.pass(projectInfo); | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
log.error("项目 调用状态机出错:",e); | log.error("项目 调用状态机出错:",e); | ||||
throw new BusinessException(projectInfo.getId() + "项目 调用状态机出错 :" + e.getMessage()); | throw new BusinessException(projectInfo.getId() + "项目 调用状态机出错 :" + e.getMessage()); | ||||
@@ -140,7 +140,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
params.setFormData(dto.getFormData()); | params.setFormData(dto.getFormData()); | ||||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId); | |||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,projectInfo); | |||||
instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("提交预审项目成功 【{}】", instanceId); | log.info("提交预审项目成功 【{}】", instanceId); | ||||
@@ -166,7 +166,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
project.setUpdateOn(LocalDateTime.now()); | project.setUpdateOn(LocalDateTime.now()); | ||||
project.setInstCode(instanceId); | project.setInstCode(instanceId); | ||||
//调用状态机 进入下一个通过状态 | //调用状态机 进入下一个通过状态 | ||||
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); | |||||
stateMachineUtils.pass(project); | |||||
projectService.updateById(project); | projectService.updateById(project); | ||||
//保存项目和实例的关系 | //保存项目和实例的关系 | ||||
@@ -105,7 +105,7 @@ public class ReviewByDeptJointManage { | |||||
params.setFormData(formData); | params.setFormData(formData); | ||||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | // 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | ||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId); | |||||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.getOrgModelInfo(userId,project); | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("部门联审申报成功 【{}】", instanceId); | log.info("部门联审申报成功 【{}】", instanceId); | ||||
@@ -43,6 +43,7 @@ public class ReviewByProvincialDeptManage { | |||||
Boolean sucessProvince = Boolean.FALSE; | Boolean sucessProvince = Boolean.FALSE; | ||||
if(sucessProvince){ | if(sucessProvince){ | ||||
//成功了后 | //成功了后 | ||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
@@ -30,8 +30,4 @@ public class ProjectDraftSaveDTO implements Serializable { | |||||
@ApiModelProperty("项目信息") | @ApiModelProperty("项目信息") | ||||
private ProjectDTO projectInfo; | private ProjectDTO projectInfo; | ||||
@NotNull | |||||
@ApiModelProperty("用户信息") | |||||
private ProcessInstanceUserDto user; | |||||
} | } |
@@ -269,12 +269,18 @@ public class ProjectDraft implements Serializable { | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||||
private Integer isHigherSuperOrg; | |||||
@ApiModelProperty("上级主管部门") | @ApiModelProperty("上级主管部门") | ||||
private String higherSuperOrg; | private String higherSuperOrg; | ||||
@ApiModelProperty("上级主管部门Code") | @ApiModelProperty("上级主管部门Code") | ||||
private String higherSuperOrgCode; | private String higherSuperOrgCode; | ||||
@ApiModelProperty("是否有主管部门 0没有 1有") | |||||
private Integer isSuperOrg; | |||||
@ApiModelProperty("主管部门名称") | @ApiModelProperty("主管部门名称") | ||||
private String superOrg; | private String superOrg; | ||||
@@ -270,12 +270,18 @@ public class ProjectDraftVO implements Serializable { | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||||
private Integer isHigherSuperOrg; | |||||
@ApiModelProperty("上级主管部门") | @ApiModelProperty("上级主管部门") | ||||
private String higherSuperOrg; | private String higherSuperOrg; | ||||
@ApiModelProperty("上级主管部门Code") | @ApiModelProperty("上级主管部门Code") | ||||
private String higherSuperOrgCode; | private String higherSuperOrgCode; | ||||
@ApiModelProperty("是否有主管部门 0没有 1有") | |||||
private Integer isSuperOrg; | |||||
@ApiModelProperty("主管部门名称") | @ApiModelProperty("主管部门名称") | ||||
private String superOrg; | private String superOrg; | ||||
@@ -122,7 +122,7 @@ public class AnnualPlanLibManage { | |||||
}); | }); | ||||
projects.forEach(project -> { | projects.forEach(project -> { | ||||
try { | try { | ||||
stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE); | |||||
stateMachine.pass(project); | |||||
} catch (Exception e) { | } catch (Exception e) { | ||||
throw new BizException("开启方案申报失败"); | throw new BizException("开启方案申报失败"); | ||||
} | } | ||||
@@ -133,7 +133,7 @@ public class AnnualPlanLibManage { | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public void projectApproved(ProjectApprovedReq req) throws Exception { | public void projectApproved(ProjectApprovedReq req) throws Exception { | ||||
Project project = projectService.getById(req.getProjectId()); | Project project = projectService.getById(req.getProjectId()); | ||||
stateMachine.execute(project, ProjectStatusChangeEvent.PROJECT_APPROVAL); | |||||
stateMachine.pass(project); | |||||
LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class) | LambdaUpdateWrapper<Project> update = Wrappers.lambdaUpdate(Project.class) | ||||
.set(Project::getApprovalAmount, req.getApprovedAmount()) | .set(Project::getApprovalAmount, req.getApprovedAmount()) | ||||
.set(Project::getApprovedFile, req.getApprovedFileId()) | .set(Project::getApprovedFile, req.getApprovedFileId()) | ||||
@@ -147,7 +147,7 @@ public class AnnualPlanLibManage { | |||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public void suspendAnnualPlan(ProjectIdReq req) throws Exception { | public void suspendAnnualPlan(ProjectIdReq req) throws Exception { | ||||
Project project = projectService.getById(req.getProjectId()); | Project project = projectService.getById(req.getProjectId()); | ||||
stateMachine.execute(project, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND); | |||||
stateMachine.reject(project); | |||||
projectService.updateById(project); | projectService.updateById(project); | ||||
} | } | ||||
@@ -252,12 +252,18 @@ public class ProjectDTO implements Serializable { | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||||
private Integer isHigherSuperOrg; | |||||
@ApiModelProperty("上级主管部门") | @ApiModelProperty("上级主管部门") | ||||
private String higherSuperOrg; | private String higherSuperOrg; | ||||
@ApiModelProperty("上级主管部门Code") | @ApiModelProperty("上级主管部门Code") | ||||
private String higherSuperOrgCode; | private String higherSuperOrgCode; | ||||
@ApiModelProperty("是否有主管部门 0没有 1有") | |||||
private Integer isSuperOrg; | |||||
@ApiModelProperty("主管部门名称") | @ApiModelProperty("主管部门名称") | ||||
private String superOrg; | private String superOrg; | ||||
@@ -267,12 +267,18 @@ public class Project implements Serializable { | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@ApiModelProperty("上级主管部门") | |||||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||||
private Integer isHigherSuperOrg; | |||||
@ApiModelProperty("上级条线主管部门") | |||||
private String higherSuperOrg; | private String higherSuperOrg; | ||||
@ApiModelProperty("上级主管部门Code") | @ApiModelProperty("上级主管部门Code") | ||||
private String higherSuperOrgCode; | private String higherSuperOrgCode; | ||||
@ApiModelProperty("是否有主管部门 0没有 1有") | |||||
private Integer isSuperOrg; | |||||
@ApiModelProperty("主管部门名称") | @ApiModelProperty("主管部门名称") | ||||
private String superOrg; | private String superOrg; | ||||
@@ -256,12 +256,18 @@ public class ProjectDetailVO { | |||||
@ApiModelProperty("批复金额") | @ApiModelProperty("批复金额") | ||||
private BigDecimal approvedTotalInvestmentIncrease; | private BigDecimal approvedTotalInvestmentIncrease; | ||||
@ApiModelProperty("是否有上级条线主管部门 0没有 1有") | |||||
private Integer isHigherSuperOrg; | |||||
@ApiModelProperty("上级主管部门") | @ApiModelProperty("上级主管部门") | ||||
private String higherSuperOrg; | private String higherSuperOrg; | ||||
@ApiModelProperty("上级主管部门Code") | @ApiModelProperty("上级主管部门Code") | ||||
private String higherSuperOrgCode; | private String higherSuperOrgCode; | ||||
@ApiModelProperty("是否有主管部门 0没有 1有") | |||||
private Integer isSuperOrg; | |||||
@ApiModelProperty("主管部门名称") | @ApiModelProperty("主管部门名称") | ||||
private String superOrg; | private String superOrg; | ||||
@@ -47,7 +47,7 @@ public class ProjectStatusFlowTask { | |||||
//1. 定时取 项目暂存表的数据 去进行状态继续流转 | //1. 定时取 项目暂存表的数据 去进行状态继续流转 | ||||
List<ProjectStaging> stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) | List<ProjectStaging> stagingList = projectStagingService.list(Wrappers.lambdaQuery(ProjectStaging.class) | ||||
.eq(ProjectStaging::getDead,Boolean.FALSE) | .eq(ProjectStaging::getDead,Boolean.FALSE) | ||||
.ge(ProjectStaging::getNextTime, LocalDateTime.now()) | |||||
.le(ProjectStaging::getNextTime, LocalDateTime.now()) | |||||
.le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) | .le(ProjectStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) | ||||
.orderByAsc(ProjectStaging::getProjectId)); | .orderByAsc(ProjectStaging::getProjectId)); | ||||
@@ -422,12 +422,8 @@ public class TodoCenterManage { | |||||
* @since 2023/02/08 | * @since 2023/02/08 | ||||
*/ | */ | ||||
private void updateRejectProjectStatus(Long userId, Project declaredProject) { | private void updateRejectProjectStatus(Long userId, Project declaredProject) { | ||||
// 获取当前流程项目状态 | |||||
Integer status = declaredProject.getStatus(); | |||||
// 根据当前状态获取对应的通过事件 | |||||
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusRejectEvent(status); | |||||
try { | try { | ||||
stateMachineUtils.execute(declaredProject, event); | |||||
stateMachineUtils.reject(declaredProject); | |||||
declaredProject.setUpdateOn(LocalDateTime.now()); | declaredProject.setUpdateOn(LocalDateTime.now()); | ||||
declaredProject.setUpdateBy(userId); | declaredProject.setUpdateBy(userId); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -483,12 +479,8 @@ public class TodoCenterManage { | |||||
* @since 2023/02/08 | * @since 2023/02/08 | ||||
*/ | */ | ||||
private void updatePassProjectStatus(Long userId, Project declaredProject) { | private void updatePassProjectStatus(Long userId, Project declaredProject) { | ||||
// 获取当前流程项目状态 | |||||
Integer status = declaredProject.getStatus(); | |||||
// 根据当前状态获取对应的通过事件 | |||||
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(status); | |||||
try { | try { | ||||
stateMachineUtils.execute(declaredProject, event); | |||||
stateMachineUtils.pass(declaredProject); | |||||
declaredProject.setUpdateOn(LocalDateTime.now()); | declaredProject.setUpdateOn(LocalDateTime.now()); | ||||
declaredProject.setUpdateBy(userId); | declaredProject.setUpdateBy(userId); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -574,12 +566,8 @@ public class TodoCenterManage { | |||||
* @since 2023/02/08 | * @since 2023/02/08 | ||||
*/ | */ | ||||
private void updateWithdrawProjectStatus(Long userId, Project declaredProject) { | private void updateWithdrawProjectStatus(Long userId, Project declaredProject) { | ||||
// 获取当前流程项目状态 | |||||
Integer projectStatusSecond = declaredProject.getStatus(); | |||||
// 根据当前状态获取对应的撤回事件 | |||||
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusWithdrawEvent(projectStatusSecond); | |||||
try { | try { | ||||
stateMachineUtils.execute(declaredProject, event); | |||||
stateMachineUtils.withDraw(declaredProject); | |||||
declaredProject.setUpdateOn(LocalDateTime.now()); | declaredProject.setUpdateOn(LocalDateTime.now()); | ||||
declaredProject.setUpdateBy(userId); | declaredProject.setUpdateBy(userId); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -27,7 +27,7 @@ public class StateMachineTest extends AppTests { | |||||
project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | project.setStage(ProjectStatusEnum.PROJECT_APPROVED.getCode()); | ||||
project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | project.setStatus(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()); | ||||
project.setDeclareAmount(BigDecimal.valueOf(2000)); | project.setDeclareAmount(BigDecimal.valueOf(2000)); | ||||
stateMachineUtils.execute(project, stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); | |||||
stateMachineUtils.pass(project); | |||||
System.out.println(String.format("project:%s", JSON.toJSONString(project))); | System.out.println(String.format("project:%s", JSON.toJSONString(project))); | ||||
} | } | ||||
} | } |
@@ -38,7 +38,7 @@ public class ProjectStateTest extends AppTests { | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | ||||
project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | project.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | ||||
//调用状态机 进入下一个通过状态 | //调用状态机 进入下一个通过状态 | ||||
stateMachineUtils.execute(project,stateMachineUtils.getProjectStatusPassEvent(project.getStatus())); | |||||
stateMachineUtils.pass(project); | |||||
stopWatch.stop(); | stopWatch.stop(); | ||||
System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); | System.out.println("调用状态机结束 :" + stopWatch.getTotalTimeSeconds()); | ||||