1.Flowable是什么?

Flowable是一个使用Java编写的轻量级业务流程引擎。Flowable流程引擎可用于部署BPMN 2.0流程定义(用于定义流程的行业XML标准), 创建这些流程定义的流程实例,进行查询,访问运行中或历史的流程实例与相关数据,等等。这个章节将用一个可以在你自己的开发环境中使用的例子,逐步介绍各种概念与API。

Flowable可以十分灵活地加入你的应用/服务/构架。可以将JAR形式发布的Flowable库加入应用或服务,来嵌入引擎。 以JAR形式发布使Flowable可以轻易加入任何Java环境:Java SE;Tomcat、Jetty或Spring之类的servlet容器;JBoss或WebSphere之类的Java EE服务器,等等。 另外,也可以使用Flowable REST API进行HTTP调用。也有许多Flowable应用(Flowable Modeler, Flowable Admin, Flowable IDM 与 Flowable Task),提供了直接可用的UI示例,可以使用流程与任务。

所有使用Flowable方法的共同点是核心引擎。核心引擎是一组服务的集合,并提供管理与执行业务流程的API。 下面的教程从设置与使用核心引擎的介绍开始。后续章节都建立在之前章节中获取的知识之上。

2. Flowable与Activiti

Flowable是Activiti(Alfresco持有的注册商标)的fork。在下面的章节中,你会注意到包名,配置文件等等,都使用flowable

3.项目中简单使用

1). 根据原型图生成  ***.bpmn20.xml(bankBill.bpmn20.xml文件)

2) . 讲生成的文件导入到数据库中

import com.ilotterytech.component.flowable.utils.FlowDefineUtils;
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.ExtensionElement;
import org.flowable.bpmn.model.StartEvent;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.flowable.engine.parse.BpmnParseHandler;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.image.impl.DefaultProcessDiagramGenerator;
import org.flowable.task.api.Task;
import org.flowable.task.api.history.HistoricTaskInstance;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

/**
 * Created by Zhang on 2018/11/30.
 */
public class FlowableTest extends TestCase {
    private StandaloneProcessEngineConfiguration cfg;
    private ProcessEngine processEngine;

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        cfg = new StandaloneProcessEngineConfiguration();
        cfg.setJdbcUrl("jdbc:mysql://192.168.110.2:3306/bwlbis?useSSL=false")
                .setJdbcUsername("bwlbis")
                .setJdbcPassword("bwlbis1234")
                .setJdbcDriver("com.mysql.jdbc.Driver")
                .setDatabaseType(ProcessEngineConfiguration.DATABASE_TYPE_MYSQL)
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

        List<BpmnParseHandler> handlers = new ArrayList<>();
        //handlers.add(new ExtensionUserTaskParseHandler());
        //cfg.setCustomDefaultBpmnParseHandlers(handlers);

        processEngine = cfg.buildProcessEngine();
    }

    public void testDeploy(){
        RepositoryService repositoryService = processEngine.getRepositoryService();

        Deployment deployment = repositoryService.createDeployment()
                .addClasspathResource("bpmn/stationFee.bpmn20.xml")
                .deploy();
    }

    public void testQueryDeploy() throws IOException{
        RepositoryService repositoryService = processEngine.getRepositoryService();

        ProcessDefinition define = repositoryService.createProcessDefinitionQuery()
                .processDefinitionKey("holidayRequest")
                .singleResult();

        BpmnModel model = repositoryService.getBpmnModel(define.getId());
        List<UserTask> list = model.getMainProcess().findFlowElementsOfType(UserTask.class);
        UserTask task = list.);
        ExtensionElement ee = task.getExtensionElements().);
        System.out.println(ee.getAttributes());
        System.out.println(ee.getAttributeValue(null, "name"));

        System.out.println("Found process definition : " + define.getDiagramResourceName());

        List<StartEvent> events = model.getMainProcess().findFlowElementsOfType(StartEvent.class);
        StartEvent se = events.);
        ee = se.getExtensionElements().);
        System.out.println(ee.getAttributes());
        System.out.println(ee.getAttributeValue(null, "name"));

        ee = se.getExtensionElements().);
        List<ExtensionElement> ext = ee.getChildElements().get("invoke");
        ext.forEach(e ->{
            System.out.println(e.getElementText());
        });

        String value = FlowDefineUtils.getStartEventExtensionAttributeValue(define, "page", "name", repositoryService);
        System.out.println(value);
    }

    public void testStart(){
        RepositoryService repositoryService = processEngine.getRepositoryService();

        ProcessDefinition define =repositoryService.createProcessDefinitionQuery()
                .processDefinitionKey("holidayRequest")
                .singleResult();

        System.out.println("Found process definition : " + define.getName());

        RuntimeService runtimeService = processEngine.getRuntimeService();
        Map<String, Object> variables = new HashMap<>();
        variables.put("employee", "test");
        variables.put();
        variables.put("description", "年假");

        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("holidayRequest", variables);

        System.out.println("start up flow [" + processInstance.getId() + "]");
    }

    public void testQueryTask(){
        RepositoryService repositoryService = processEngine.getRepositoryService();

        TaskService taskService = processEngine.getTaskService();
        List<Task> tasks = taskService.createTaskQuery()
                .or()
                .taskAssignee(")
                .taskCandidateGroup("managers")
                .endOr()
                .list();
        System.out.println("你有 " + tasks.size() + " 个待办任务:");
        ; i < tasks.size(); i++) {
            Task t = tasks.get(i);
            System.out.println(t.getClass());
            Map<String, Object> processVariables = taskService.getVariables(t.getId());
            System., t.getName(), t.getId(), t.getAssignee(), t.getCategory(), t.getCreateTime(), processVariables.get("employee")));
        }
    }

    public void testSubmitTask(){
        TaskService taskService = processEngine.getTaskService();
        List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("managers").list();
        System.out.println("你有 " + tasks.size() + " 个待办任务:");
        Task task = tasks.);

        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("approved", true);
        taskService.complete(task.getId(), variables);
    }

    public void testExportProcessImg() throws IOException{
        HistoryService historyService = processEngine.getHistoryService();
        RepositoryService repositoryService = processEngine.getRepositoryService();
        RuntimeService runtimeService = processEngine.getRuntimeService();

        List<HistoricProcessInstance> his = historyService.createHistoricProcessInstanceQuery().processDefinitionKey("holidayRequest").list();
        for (HistoricProcessInstance ins : his){
            System.out.println(String.format("%s : %s", ins.getId(), ins.getDurationInMillis()));
        }

        HistoricProcessInstance instance = his.);
        BpmnModel bpmnModel = repositoryService.getBpmnModel(instance.getProcessDefinitionId());
        DefaultProcessDiagramGenerator defaultProcessDiagramGenerator = new DefaultProcessDiagramGenerator();

        List<String> highLightedActivities = runtimeService.getActiveActivityIds(instance.getId());

        List<String> highLightedFlows = Collections.emptyList();

        InputStream in = defaultProcessDiagramGenerator.generateDiagram(bpmnModel, "png", highLightedActivities, highLightedFlows, false);

        byte[] data = IOUtils.toByteArray(in);

        FileUtils.writeByteArrayToFile(new File("img.png"), data);
    }

    public void testQueryHisProcess() throws IOException{
        HistoryService historyService = processEngine.getHistoryService();
        RepositoryService repositoryService = processEngine.getRepositoryService();
        RuntimeService runtimeService = processEngine.getRuntimeService();

        List<HistoricTaskInstance> list = historyService
                .createHistoricTaskInstanceQuery()
                //.processDefinitionKey("holidayRequest")
                .processInstanceId(")
                .finished()
                .list();

        for (HistoricTaskInstance ins : list){
            System.out.println(String.format("%s : %s, %s, %s", ins.getId(), ins.getCreateTime(), ins.getEndTime(), ins.getAssignee()));
        }
    }

    public void testDefineUtils() throws Exception{
        RepositoryService service = processEngine.getRepositoryService();

        ProcessDefinition define = FlowDefineUtils.getFlowDefine("holidayRequest", service);
        System.out.println(FlowDefineUtils.getStartEventVariables(define, service));
        System.out.println(FlowDefineUtils.getUserTaskVariables(define, "approveTask", service));

        System.out.println(FlowDefineUtils.getStartEventService(define, service));
        System.out.println(FlowDefineUtils.getUserTaskService(define, "approveTask", service));

        System.out.println(FlowDefineUtils.getStartEventInitService(define, service));
        System.out.println(FlowDefineUtils.getUserTaskInitService(define, "approveTask", service));
    }
}

3.修改****.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:flowable="http://flowable.org/bpmn"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
             xmlns:ilot="http://ilotterytech.com/bpmn"
             typeLanguage="http://www.w3.org/2001/XMLSchema"
             expressionLanguage="http://www.w3.org/1999/XPath"
             targetNamespace="http://flowable.org/test">
  <!--<collaboration id="Collaboration">-->
  <!--<participant id="sid-FCF94A2B-138F-406B-BA6C-2860A5329290" name="银行对账文件流程" processRef="process"></participant>-->
  <!--</collaboration>-->
  <process id="stationFee" name="网点保险费流程" isExecutable="true">
    <extensionElements>
      <flowable:eventListener delegateExpression="${flowableMainEventListener}" events="TASK_COMPLETED,PROCESS_COMPLETED" />
    </extensionElements>
    <laneSet id="laneSet_process">
      <lane id="sid-FF8E9FD8-1C1B-4E2D-98BC-A083D4E947D1" name="市场(营销)管理部→技术管理部">
        <flowNodeRef>sid-0AA904C1-154A-43E8-B17D-1445DDD5A58B</flowNodeRef>
        <flowNodeRef>sid-5342E247-1EF8-413A-A28D-6AA281753F76</flowNodeRef>
        <flowNodeRef>sid-EFECD6EF-42DA-4AD5-AF28-36183BD182B1</flowNodeRef>
        <flowNodeRef>sid-946F88C4-6C74-494E-B27A-2490CF613F62</flowNodeRef>
        <flowNodeRef>sid-3EABB94F--42F0-AAC7-84BDDBC16BC3</flowNodeRef>
      </lane>
    </laneSet>
    <startEvent id="sid-0AA904C1-154A-43E8-B17D-1445DDD5A58B" name="导入网点保险费列表">
      <extensionElements>
        <ilot:init service="insuranceFeeService.getStartInitEvent" />
        <ilot:page name="startBank.html" route="startCheckAccount.financeStartCheck"/>
        <ilot:service form="InsurancePremiumForm" invoke="insuranceFeeService.saveInsuranceFee" />
      </extensionElements>
    </startEvent>
    <userTask id="sid-5342E247-1EF8-413A-A28D-6AA281753F76" name="主机系统处理" flowable:candidateGroups="技术管理部">
      <extensionElements>
        <ilot:init service="insuranceFeeService.getHostProcessing" />
        <ilot:page name="start.html" route="operCheckAccount.financeOperCheck"/>
        <ilot:service form="InsurancePremiumHostForm" invoke="insuranceFeeService.saveHostProcessingSubmit" />
      </extensionElements>
    </userTask>
    <endEvent id="sid-EFECD6EF-42DA-4AD5-AF28-36183BD182B1"></endEvent>
    <sequenceFlow id="sid-946F88C4-6C74-494E-B27A-2490CF613F62" sourceRef="sid-5342E247-1EF8-413A-A28D-6AA281753F76" targetRef="sid-EFECD6EF-42DA-4AD5-AF28-36183BD182B1"></sequenceFlow>
    <sequenceFlow id="sid-3EABB94F-3180-42F0-AAC7-84BDDBC16BC3" sourceRef="sid-0AA904C1-154A-43E8-B17D-1445DDD5A58B" targetRef="sid-5342E247-1EF8-413A-A28D-6AA281753F76"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Collaboration">
    <bpmndi:BPMNPlane bpmnElement="Collaboration" id="BPMNPlane_Collaboration">
      <bpmndi:BPMNShape bpmnElement="sid-6465C1B4-6357-4329-AD60-1FCAF7F68DA4" id="BPMNShape_sid-6465C1B4-6357-4329-AD60-1FCAF7F68DA4">
        <omgdc:Bounds height="249.0" width="937.8" x="0.0" y="15.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-FF8E9FD8-1C1B-4E2D-98BC-A083D4E947D1" id="BPMNShape_sid-FF8E9FD8-1C1B-4E2D-98BC-A083D4E947D1">
        <omgdc:Bounds height="249.0" width="907.8" x="30.0" y="15.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-0AA904C1-154A-43E8-B17D-1445DDD5A58B" id="BPMNShape_sid-0AA904C1-154A-43E8-B17D-1445DDD5A58B">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="124.5"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-5342E247-1EF8-413A-A28D-6AA281753F76" id="BPMNShape_sid-5342E247-1EF8-413A-A28D-6AA281753F76">
        <omgdc:Bounds height="80.0" width="100.0" x="495.0" y="99.5"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-EFECD6EF-42DA-4AD5-AF28-36183BD182B1" id="BPMNShape_sid-EFECD6EF-42DA-4AD5-AF28-36183BD182B1">
        <omgdc:Bounds height="28.0" width="28.0" x="706.8" y="125.5"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-946F88C4-6C74-494E-B27A-2490CF613F62" id="BPMNEdge_sid-946F88C4-6C74-494E-B27A-2490CF613F62">
        <omgdi:waypoint x="594.9499999999894" y="139.5"></omgdi:waypoint>
        <omgdi:waypoint x="706.8" y="139.5"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-3EABB94F-3180-42F0-AAC7-84BDDBC16BC3" id="BPMNEdge_sid-3EABB94F-3180-42F0-AAC7-84BDDBC16BC3">
        <omgdi:waypoint x="119.94999990555667" y="139.5"></omgdi:waypoint>
        <omgdi:waypoint x="494.999999999622" y="139.5"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

4.书写相应的entity , form , service,repository

package com.ilotterytech.bwlbis.station.insurance.entity;

import com.ilotterytech.common.core.entity.UseableEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @ Author : zhukaixin
 * @ Date : 2019-04-28-16:05
 * @ Desc :
 */
@Setter
@Getter
@Entity
@Table( name ="w_station_insurance_premium" )
public class InsurancePremium extends UseableEntity {

    /**
     * id主键
     */
    @Id
    @GeneratedValue
    @Column(name = "id" )
    private Long id;

    /**
     *  时间
     */
    @Column(name = "date" )
    private Timestamp date;
    /**
     *  保险费
     */
//    @Column(name = "money" )
//    private int money;
    /**
     * 备注
     */
    @Column(name = "remark" )
    private String remark;

    /**
     * station_code
     */
//    @Column(name = "station_code" )
//    private String stationCode;

    /**
     * dept
     */
    @Column(name = "dept" )
    private Long dept;
    /**
     * proc_instance_id
     */
    @Column(name = "proc_instance_id" )
    private String procInstanceId;

}
package com.ilotterytech.bwlbis.station.insurance.form;

import com.ilotterytech.bwlbis.flowable.entity.FlowStartForm;
import com.ilotterytech.component.flowable.form.FlowableVariableFormBase;
import lombok.Data;

/**
 * @ Author : zhukaixin
 * @ Date : 2019-04-28-16:47
 * @ Desc :
 */
@Data
public class InsurancePremiumForm extends FlowableVariableFormBase implements FlowStartForm {

    private Long file;

    /**
     *  备注
     */
    private String remark;

    @Override
    public String getTargetSiteName() {
        return null;
    }

    @Override
    public String getTargetSiteCode() {
        return null;
    }

    @Override
    public String getTargetAddress() {
        return null;
    }

    @Override
    public String getCategory() {
        return "网点保险费";
    }
}
package com.ilotterytech.bwlbis.station.insurance.form;

import com.ilotterytech.component.flowable.form.FlowableVariableFormBase;
import lombok.Data;

/**
 * @ Author : zhukaixin
 * @ Date : 2019-04-28-19:17
 * @ Desc :
 */
@Data
public class InsurancePremiumHostForm extends FlowableVariableFormBase {
    /**
     *  备注
     */
    private String remark;

    private Long insurancePremiumId;

    /**
     * 确认主机操作
     */
    private Boolean sureFlag;
}
package com.ilotterytech.bwlbis.station.insurance.repository;

import com.ilotterytech.bwlbis.station.insurance.entity.InsurancePremium;
import com.ilotterytech.framework.rest.repository.RestRepository;
import org.springframework.stereotype.Repository;

/**
 * @ Author : zhukaixin
 * @ Date : 2019-04-28-16:07
 * @ Desc :
 */
@Repository
public  interface InsurancePremiumRepository extends RestRepository<InsurancePremium, Long> {

    InsurancePremium getByProcInstanceId(String procInstanceId);

}
package com.ilotterytech.bwlbis.station.insurance.service;

import com.ilotterytech.bwlbis.base.attach.entity.Attach;
import com.ilotterytech.bwlbis.base.attach.service.AttachService;
import com.ilotterytech.bwlbis.base.hostsure.entity.HostSure;
import com.ilotterytech.bwlbis.base.hostsure.service.HostSureService;
import com.ilotterytech.bwlbis.station.insurance.entity.InsurancePremium;
import com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumForm;
import com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumHostForm;
import com.ilotterytech.bwlbis.station.insurance.repository.InsurancePremiumRepository;
import com.ilotterytech.component.flowable.entity.FlowableEntity;
import com.ilotterytech.component.flowable.service.FlowableTaskService;
import com.ilotterytech.component.flowable.service.ServiceInvokeContext;
import com.ilotterytech.framework.rest.service.DefaultRestService;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ Author : zhukaixin
 * @ Date : 2019-04-28-15:55
 * @ Desc :
 */
@Service
@Transactional
public class InsuranceFeeService extends DefaultRestService<InsurancePremium, Long, InsurancePremiumRepository> implements FlowableTaskService {

    @Resource
    private AttachService attachService;
    @Resource
    private HostSureService hostSureService;
    /**
     * 初始化页面
     */
    public Map<String,Object> getStartInitEvent(ServiceInvokeContext context){

       Map<String,Object> map= new HashedMap();
       map.put("person",context.getUserId());
       map.put("dept",context.getUserDeptId());

        return map;

    }

    /**
     * 提交修改
     * @param entity
     * @param context
     */
    public void saveInsuranceFee(FlowableEntity entity, ServiceInvokeContext context){

        InsurancePremiumForm insurancePremiumForm = (InsurancePremiumForm)context.getPageForm();
        InsurancePremium insurancePremium = new InsurancePremium();

        Attach attach = attachService.findOne(insurancePremiumForm.getFile());
        BeanUtils.copyProperties(insurancePremiumForm,insurancePremium);
        insurancePremium.setProcInstanceId(context.getProcessInstanceId());
        insurancePremium.setDept(context.getUserDeptId());
        insurancePremium.setRemark(insurancePremiumForm.getRemark());
        repository.save(insurancePremium);
        attach.setFId(insurancePremium.getId());
        attach.setFType(InsurancePremium.class.getSimpleName());
        attachService.save(attach);

    }

    /**
     * 技术部主机处理
     */
    public Map<String,Object> getHostProcessing(FlowableEntity entity, ServiceInvokeContext context){
        InsurancePremium insurancePremium = repository.getByProcInstanceId(entity.getProcInstanceId());

       List<Attach>  attach = attachService.getAttachByFidAndFType(insurancePremium.getId(),InsurancePremium.class);
        Map<String,Object> map = new HashMap<>();
        map.put("insurancePremium",insurancePremium);
        map.put("attach",attach);

        return map;

    }

    /**
     *      * 技术部主机处理提交修改
     * @param entity
     * @param context
     */
    public void saveHostProcessingSubmit(FlowableEntity entity, ServiceInvokeContext context){

        InsurancePremiumHostForm insurancePremiumsForm = (InsurancePremiumHostForm)context.getPageForm();

        InsurancePremium insurancePremium = repository.findOne(insurancePremiumsForm.getInsurancePremiumId());
        HostSure hostSure = new HostSure();
        BeanUtils.copyProperties(insurancePremiumsForm,hostSure);
        hostSure.setProcInstanceId(context.getProcessInstanceId());

        hostSure.setSid(insurancePremium.getId());
        hostSure.setStype(InsurancePremium.class.getSimpleName());
        hostSureService.saveHostSure(hostSure);

    }

}

5.根据service中的方法写相应的流程顺序

6.修改****.bpmn20.xml 每次修改都要重新修改数据库中的对应表数据

7.使用postman进行测试

1). http://localhost:8081/bwlbis/bwlbis/home/user/login

(登录系统)

(psot请求)

{
    "loginId":"admin",//用户名
    //密码 登录系统
}
{
    ,
    "content": {
        "logined": true,
        ,
        "errs": {},
        "user": {
            "useFlag": "USEFUL",
            "createDate": "2016-05-30",
            ,
            ,
            "name": "管理员",
            "loginId": "admin",
            "userCode": null,
            ,
            "companyId": null,
            ,
            "avatar": null,
            ",
            "address": "北京市海淀区",
            ",
            "email": "287340554@qq.com",
            ",
            "birthday": "2018-04-18",
            "nativeLocation": "北京市",
            "position": "职位",
            ",
            "deleteReason": null,
            "deleteDate": null,
            "remark": "无",
            ,
            "showOrder": null,
            "wechatOpenId": null,
            "pwd": null
        }
    }
}

2). http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/define

(初始化)

(get请求)

{
    ,
    "content": {
        "flowKey": "stationFee",
        "flowName": "网点保险费流程",
        "page": "startBank.html",
        "route": "startCheckAccount.financeStartCheck",
        "formClass": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumForm",
        "pageData": {
            ,
            "
        }
    }
}

3).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/start

(开启任务)

(post请求)

{"flowKey": "stationFee",
        "pageForm": {
            "class": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumForm",
            "remark":"beizhu",//提交参数
            "/提交参数
        }
}
{
    ,
    "content": {
        ,
        "flowName": "网点保险费流程",
        "flowKey": "stationFee",
        ",
        "creator": "管理员",
        ,
        "department": "市场部",
        ,
        "status": "Running",
        "category": "网点保险费",
        "targetName": null,
        "targetCode": null,
        "targetExt": null,
        "createTime": "2019-04-30 09:48:42",
        "completeTime": null,
        "taskId": null,
        "taskName": null,
        "taskOperator": null,
        "taskOperationTime": null,
        "taskDuration": null,
        "completedTasks": null,

    }
}

4).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task

(查看待办列表 )

(get请求)

//start 分页参数 (http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task?start=30){
    ,
    "content": {
        "content": [
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-29 18:24:40",
                "completeTime": null,
                ",
                "taskName": "设备配置、出库",
                "taskOperator": null,
                "taskOperationTime": null,
                "taskDuration": null,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-29 18:36:48",
                "completeTime": null,
                ",
                "taskName": "设备配置、出库",
                "taskOperator": null,
                "taskOperationTime": null,
                "taskDuration": null,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-30 09:32:10",
                "completeTime": null,
                ",
                "taskName": "配置31n1",
                "taskOperator": null,
                "taskOperationTime": null,
                "taskDuration": null,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点保险费流程",
                "flowKey": "stationFee",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点保险费",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-30 09:48:43",
                "completeTime": null,
                ",
                "taskName": "主机系统处理",
                "taskOperator": null,
                "taskOperationTime": null,
                "taskDuration": null,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-29 18:22:40",
                "completeTime": null,
                ",
                "taskName": "配置adsl",
                "taskOperator": null,
                "taskOperationTime": null,
                "taskDuration": null,
                "completedTasks": null,

            }
        ],
        ,
        ,
        "last": true,
        ,
        ,
        "sort": [
            {
                "direction": "DESC",
                "property": "id",
                "ignoreCase": false,
                "nullHandling": "NATIVE",
                "ascending": false,
                "descending": true
            }
        ],
        "first": false,

    }
}

5).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/task/565006

(回显这个任务的数据)

(get请求)

{
    ,
    "content": {
        "flowKey": "stationFee",
        "flowName": "网点保险费流程",
        "page": "start.html",
        "route": "operCheckAccount.financeOperCheck",
        "formClass": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumHostForm",
        "pageData": {
            "insurancePremium": {
                "useFlag": "USEFUL",
                "createDate": "2019-04-30",
                ,
                ,
                "date": null,
                "remark": "beizhu",
                ,
                "
            },
            "attach": [
                {
                    ,
                    "uploadUserId": null,
                    "sourceName": "系统范围说明 .xlsx",
                    "name": "17f5f4b6-b246-452b-983a-afc145e85e52",
                    "fileType": "xlsx",
                    "url": "81\\26\\17f5f4b6-b246-452b-983a-afc145e85e52",
                    "uploadTime": "2019-04-27 17:57:14",
                    ,
                    "remark": null,
                    "imgUrl": null,
                    ,
                    "ftype": "InsurancePremium"
                }
            ]
        },
        ",
        "flowEntity": {
            ,
            "flowName": "网点保险费流程",
            "flowKey": "stationFee",
            ",
            "creator": "管理员",
            ,
            "department": "市场部",
            ,
            "status": "Running",
            "category": "网点保险费",
            "targetName": null,
            "targetCode": null,
            "targetExt": null,
            "createTime": "2019-04-30 09:48:43",
            "completeTime": null,
            "taskId": null,
            "taskName": null,
            "taskOperator": null,
            "taskOperationTime": null,
            "taskDuration": null,
            "completedTasks": [
                {
                    ",
                    "taskName": null,
                    ",
                    "startTime": "2019-04-30 09:48:43",
                    "endTime": "2019-04-30 09:48:43",
                    "assignee": "管理员",
                    "department": "市场部",

                }
            ],

        }
    }
}

6).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/task/565006

(提交这个任务)

 (psot请求)

{"flowKey": "stationFee",
        "pageForm": {
            "class": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumHostForm",
            ",//参数
            "sureFlag":true,//参数
            ",//参数
            "//参数
        },
        "
}
{
    ,
    "content": {
        ,
        "flowName": "网点保险费流程",
        "flowKey": "stationFee",
        ",
        "creator": "管理员",
        ,
        "department": "市场部",
        ,
        "status": "Complete",
        "category": "网点保险费",
        "targetName": null,
        "targetCode": null,
        "targetExt": null,
        "createTime": "2019-04-30 09:48:43",
        "completeTime": "2019-04-30 09:58:15",
        "taskId": null,
        "taskName": null,
        "taskOperator": null,
        "taskOperationTime": null,
        "taskDuration": null,
        "completedTasks": null,

    }
}

7).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task/history

   (查询任务列表)

  (get请求)

//   start  分页参数    http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task/history?start=60{
    ,
    "content": {
        "content": [
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Complete",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 10:27:47",
                "completeTime": "2019-04-28 19:29:04",
                ",
                "taskName": "查看结果满意度回访",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:29:03.677+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Complete",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 10:27:47",
                "completeTime": "2019-04-28 19:29:04",
                ",
                "taskName": "查看结果满意度回访",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:29:03.677+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 16:16:26",
                "completeTime": null,
                ",
                "taskName": "填写处理结果",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:00:22.460+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 16:16:26",
                "completeTime": null,
                ",
                "taskName": "填写处理结果",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:00:22.460+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 16:16:26",
                "completeTime": null,
                ",
                "taskName": "填写处理结果",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:00:22.460+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 17:55:13",
                "completeTime": null,
                ",
                "taskName": "确认办理时限",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T10:18:23.030+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 14:56:18",
                "completeTime": null,
                ",
                "taskName": "填写处理结果",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:07:27.079+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "客服中心投诉转办",
                "flowKey": "complaintInfo",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "客服中心转办投诉",
                "targetName": null,
                "targetCode": null,
                "targetExt": null,
                "createTime": "2019-04-28 14:56:18",
                "completeTime": null,
                ",
                "taskName": "填写处理结果",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-28T11:07:27.079+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-28 16:59:46",
                "completeTime": null,
                ",
                "taskName": "配置cdma信息",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-29T05:57:14.048+0000",
                ,
                "completedTasks": null,

            },
            {
                ,
                "flowName": "网点升级流程",
                "flowKey": "stationUpgrade",
                ",
                "creator": "管理员",
                ,
                "department": "市场部",
                ,
                "status": "Running",
                "category": "网点升级",
                ",
                ",
                ",
                "createTime": "2019-04-28 16:59:46",
                "completeTime": null,
                ",
                "taskName": "配置cdma信息",
                "taskOperator": "管理员[1]",
                "taskOperationTime": "2019-04-29T05:57:14.048+0000",
                ,
                "completedTasks": null,

            }
        ],
        ,
        ,
        "last": false,
        ,
        ,
        "sort": [
            {
                "direction": "DESC",
                "property": "id",
                "ignoreCase": false,
                "nullHandling": "NATIVE",
                "ascending": false,
                "descending": true
            }
        ],
        "first": false,

    }
}

8.一个完整的流程完成

Flowable BPMN 简单使用的更多相关文章

  1. flowable一个简单的例子

    holiday-request.bpmn20.xml: <?xml version="1.0" encoding="UTF-8"?> <def ...

  2. flowable笔记 - 简单的通用流程

    简介 通用流程可以用于一些基本的申请,例如请假.加班. 大致过程是: 1. 创建申请 2. 分配给审批人(需要审批人列表,当前审批人) -> 有下一个审批人 -> 3 -> 无 -& ...

  3. Flowable学习入门

    一.Flowable简介 1.Flowable是什么 Flowable是一个使用Java编写的轻量级业务流程引擎.Flowable流程引擎可用于部署BPMN 2.0流程定义(用于定义流程的行业XML标 ...

  4. Flowable实战(一)启动第一个完整流程

    一.前言:   发现网上关于Flowable的资料基本都是浅尝辄止,对如何构建一个企业级的流程应用说明很少,所以写个实战系列,希望对大家和自己,都有所帮助. 二.认识Flowable   Flowab ...

  5. flowable设计器插件安装

    原文地址:http://www.shareniu.com/ 工欲善其事必先利其器,要想使用flowable,必须搭建一套环境,本文以Eclipse中安装flowable插件为例详细说明整个安装过程. ...

  6. 公司采购 流程flowable例子

    Name: Flowable BPMN 2.0 designer Location: http://flowable.org/designer/update/ 业务描述:1. 公司采购,因为办公用品价 ...

  7. 真是没想到 Springboot + Flowable 工作流开发会这么简单

    本文收录在个人博客:www.chengxy-nds.top,技术资料共享,同进步 程序员是块砖,哪里需要哪里搬 公司内部的OA系统最近要升级改造,由于人手不够就把我借调过去了,但说真的我还没做过这方面 ...

  8. flowable学习笔记-简单流程概念介绍

    1 Flowable process engine允许我们创建ProcessEngine 对象和使用 Flowable 的API ProcessEngine是线程安全的,他是通过 ProcessEng ...

  9. 工作流引擎 Flowable 6.0.0.RC1 release,完全兼容Activi

    Flowable 6.0.0.RC1 release,第一个可流动的6引擎版本(6.0.0.RC1). Flowable 6.0.0.RC1 relase新增加的功能以及特色: 包重命名为org.Fl ...

随机推荐

  1. 2018.10.20 bzoj2748: [HAOI2012]音量调节(背包)

    传送门 这题是不是太sbsbsb了一点. 难度直逼普及-. 直接背包判存在性就行了. 代码: #include<bits/stdc++.h> using namespace std; bo ...

  2. 2018.07.10NOIP模拟 Knapsack(单调队列优化dp)

    Knapsack 题目背景 SOURCE:NOIP2016-RZZ-4 T2 题目描述 有 n 个物品,第 i 个物品的重量为 ai . 设 f(i,j,k,l,m) 为满足以下约束的物品集合数量: ...

  3. VHDL的库

    STD_LOGIC_ARITH 扩展了UNSIGNED.SIGNED.SMALL_INT(短整型)三个数据类型,并定义了相关的算术运算和转换函数. --======================== ...

  4. [ IE浏览器兼容问题 ] Web Uploader 在IE、FireFox下点击上传没反应

    一.项目源码: > html > js 初始化插件: 事件绑定:avalon > web > 报错: - IE: 脚本缺少对象 - FireFox: js业务逻辑代码部分事件正 ...

  5. BSD Socket 通信

    Berkeley sockets is an application programming interface (API) for Internet sockets and Unix domain ...

  6. 城市边界线预测(根据灯光指数)(PUL)

    1.EXEALL.m function EXEALL(FilePath, FileName)%执行所有流程% FilePath: 文件夹所在路径% FileName: 文件夹名称 FullPath = ...

  7. linux cpu过高原因及代码定位

    1. top命令查看CPU和内存占用率 top回车,然后按1 发现进程PID 35163 CPU和内存占用率都很高 top - 06:13:47 up  5:31,  1 user,  load av ...

  8. hdu 4946 凸包注意重点

    http://acm.hdu.edu.cn/showproblem.php?pid=4946 给你n个点的坐标和速度,如果一个点能够到达无穷远处,且花费的时间是最少的,则此点输出1,否则输出0. 每个 ...

  9. The Activities of September

  10. Android-fragment-ListView展示-v4支持包

    昨天写的这几篇博客,Android-fragment简介-fragment的简单使用,Activity-fragment-ListView展示,Android-fragment生命周期,Android ...