final ProcessInstance processInstance = procInstRep.findProcessInstance(processInstId);
if(StarFlowState.PROCESS_INST_RUNNING != processInstance.getCurrentState())
throw new ProcessEngineException("流程不处于运行状态,不能重启环节!");
final ProcessDefine processDefine = this.procDefRep.findProcessDefine(processInstance.getProcessDefId());
final ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityDefId);
if(activityXml == null)
throw new ProcessEngineException("指定启动环节【{}】不存在" + activityDefId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
String actType = activityXml.getType();
ActivityType type = ActivityTypeFactory.buildActivityType(actType);
//创建环节
ActivityCreateEvent event = new ActivityCreateEvent(processEngine);
event.setProcessInstance(processInstance);