|
|
@ -225,20 +225,14 @@ public class ExecutorService extends BaseService{ |
|
|
|
if (processInstance.getState() == ExecutionStatus.READY_STOP) { |
|
|
|
if (processInstance.getState() == ExecutionStatus.READY_STOP) { |
|
|
|
putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); |
|
|
|
putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
processInstance.setCommandType(CommandType.STOP); |
|
|
|
result = updateProcessInstancePrepare(processInstance, CommandType.STOP, ExecutionStatus.READY_STOP); |
|
|
|
processInstance.addHistoryCmd(CommandType.STOP); |
|
|
|
|
|
|
|
processService.updateProcessInstance(processInstance); |
|
|
|
|
|
|
|
result = updateProcessInstanceState(processInstanceId, ExecutionStatus.READY_STOP); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case PAUSE: |
|
|
|
case PAUSE: |
|
|
|
if (processInstance.getState() == ExecutionStatus.READY_PAUSE) { |
|
|
|
if (processInstance.getState() == ExecutionStatus.READY_PAUSE) { |
|
|
|
putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); |
|
|
|
putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
processInstance.setCommandType(CommandType.PAUSE); |
|
|
|
result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, ExecutionStatus.READY_PAUSE); |
|
|
|
processInstance.addHistoryCmd(CommandType.PAUSE); |
|
|
|
|
|
|
|
processService.updateProcessInstance(processInstance); |
|
|
|
|
|
|
|
result = updateProcessInstanceState(processInstanceId, ExecutionStatus.READY_PAUSE); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
@ -308,22 +302,27 @@ public class ExecutorService extends BaseService{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* update process instance state |
|
|
|
* prepare to update process instance command type and status |
|
|
|
* |
|
|
|
* |
|
|
|
* @param processInstanceId process instance id |
|
|
|
* @param processInstance process instance |
|
|
|
|
|
|
|
* @param commandType command type |
|
|
|
* @param executionStatus execute status |
|
|
|
* @param executionStatus execute status |
|
|
|
* @return update result |
|
|
|
* @return update result |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<String, Object> updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) { |
|
|
|
private Map<String, Object> updateProcessInstancePrepare(ProcessInstance processInstance, CommandType commandType, ExecutionStatus executionStatus) { |
|
|
|
Map<String, Object> result = new HashMap<>(5); |
|
|
|
Map<String, Object> result = new HashMap<>(5); |
|
|
|
|
|
|
|
|
|
|
|
int update = processService.updateProcessInstanceState(processInstanceId, executionStatus); |
|
|
|
processInstance.setCommandType(commandType); |
|
|
|
|
|
|
|
processInstance.addHistoryCmd(commandType); |
|
|
|
|
|
|
|
processInstance.setState(executionStatus); |
|
|
|
|
|
|
|
int update = processService.updateProcessInstance(processInstance); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// determine whether the process is normal
|
|
|
|
if (update > 0) { |
|
|
|
if (update > 0) { |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); |
|
|
|
putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|