运行流程

  • SDK调用
WorkflowEngineClient client = new WorkflowEngineClient();
client.setUrl(URL+"/engine");  //引擎客户端
String procId = "20181229000001";
int taskId = 1;
WorkflowRequest workflowRequest = new WorkflowRequest();
workflowRequest.setBusinessDataId(UUID.randomUUID().toString().replace("-", ""));
workflowRequest.setImportant(1);
workflowRequest.setSecret(1);
workflowRequest.setOpinionContent("opinionContent1");
workflowRequest.setOpinionArea("1");
workflowRequest.setExtendedFieldOne("extendedFieldOne");
workflowRequest.setExtendedFieldTwo("extendedFieldTwo");
workflowRequest.setExtendedFieldThree("extendedFieldThree");
workflowRequest.setAppCode("test001");
workflowRequest.setProcName("测试流程");
workflowRequest.setProcId(procId);
workflowRequest.setTaskId(taskId);

//构建下一步处理人
ChoiceStep choiceStep = new ChoiceStep();
choiceStep.setResponseType("all");
choiceStep.setStepLabel("开始步骤->审批步骤");
choiceStep.setStepName("部门经理审批");
ChoiceStepUser choicestepUser = new ChoiceStepUser();
choicestepUser.setOrgId("e3d414ea-2393-4306-9bfb-bd4a96f9832a");
choicestepUser.setUserId("a7b26d12-91dc-407b-822d-84110999f18b");
List<ChoiceStepUser> choiceStepUsers = new ArrayList<ChoiceStepUser>();
choiceStepUsers.add(choicestepUser);
choiceStep.setStepUsers(choiceStepUsers);
List<ChoiceStep> choices = new ArrayList<ChoiceStep>();
choices.add(choiceStep);
//构建表单参数
Map<String, Object> formData=new HashMap<String,Object>();
formData.put("userName", "userName");
formData.put("age", 1);
formData.put("weight", 1.23);
formData.put("enable", true);
formData.put("birthday", new Date());
Result result = client.runWorkflow(workflowRequest, formData, choices);
System.out.println(JSONObject.fromObject(result,JsonHelper.getJsonConfig(Result.class)));
  • CURL调用
curl -X  POST  "URL/engine/runWorkflow"  -H "accept: application/json" -H "Content-Type: application/json" -d \
"{  \
    \"procId\": \"20181229000001\"    \
    \"taskId\": 1    \
    \"opinionContent\": \"string\"    \
    \"opinionArea\": \"string\"    \
    \"appCode\": \"RS-00001\"    \
    \"procName\": \"string\"    \
    \"businessDataId\": \"string\"    \
    \"important\": 0    \
    \"secret\": 0    \
    \"extendedFieldOne\": \"string\"    \
    \"extendedFieldTwo\": \"string\"    \
    \"extendedFieldThree\": \"string\"    \
    \"formDataJsons\": \"\"    \
    \"choiceStepJsons\": \"[ \
        {   \
            \"stepName\": \"部门经理审批\"    \
            \"stepLabel\": \"开始步骤->审批步骤\"    \
            \"responseType\": \"all\"    \
            \"stepUsers\":    \
            [   \
                {   \
                    \"userId\": \"a7b26d12-91dc-407b-822d-84110999f18b\"    \
                    \"orgId\": \"e3d414ea-2393-4306-9bfb-bd4a96f9832a\"    \
                    \"userName\": \"钟欣\"   \
                }   \
            ]   \
        }   \
    ]   \"    \
}"
  • 响应示例
{
"businessObject":
   {
     "signal":"enter",
"signalPath":"流程开始:execute-exit-enter"
   },
   "message":"运行成功",
   "statusCode":200,
   "success":true
}