Flowable是一個使用Java編寫的輕量級業務流程引擎。Flowable流程引擎可用於部署BPMN 2.0流程定義(用於定義流程的行業XML標準), 建立這些流程定義的流程實例,進行查詢,訪問運行中或歷史的流程實例與相關數據,等等。這個章節將用一個能夠在你本身的開發環境中使用的例子,逐步介紹各類概念與API。html
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示例,能夠使用流程與任務。java
全部使用Flowable方法的共同點是核心引擎。核心引擎是一組服務的集合,並提供管理與執行業務流程的API。 下面的教程從設置與使用核心引擎的介紹開始。後續章節都創建在以前章節中獲取的知識之上。mysql
Flowable是Activiti(Alfresco持有的註冊商標)的fork。在下面的章節中,你會注意到包名,配置文件等等,都使用flowable。spring
3.項目中簡單使用sql
1). 根據原型圖生成 ***.bpmn20.xml(bankBill.bpmn20.xml文件)數據庫
2) . 講生成的文件導入到數據庫中express
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.get(0); ExtensionElement ee = task.getExtensionElements().get("page").get(0); 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.get(0); ee = se.getExtensionElements().get("page").get(0); System.out.println(ee.getAttributes()); System.out.println(ee.getAttributeValue(null, "name")); ee = se.getExtensionElements().get("service").get(0); 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("nrOfHolidays", 5); 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("10") .taskCandidateGroup("managers") .endOr() .list(); System.out.println("你有 " + tasks.size() + " 個待辦任務:"); for (int i = 0; i < tasks.size(); i++) { Task t = tasks.get(i); System.out.println(t.getClass()); Map<String, Object> processVariables = taskService.getVariables(t.getId()); System.out.println(String.format("%d) %s : %s - %s - %s - %s - %s", i + 1, 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.get(0); 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.get(0); 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("2501") .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.xmlapache
<?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-3180-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,repositoryapi
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",//用戶名 "password":1//密碼 登陸系統 }
{ "ret": 0, "content": { "logined": true, "locks": -1, "errs": {}, "user": { "useFlag": "USEFUL", "createDate": "2016-05-30", "creatorId": 2, "id": 1, "name": "管理員", "loginId": "admin", "userCode": null, "deptId": 6, "companyId": null, "topRegionId": 1, "avatar": null, "gender": "1", "address": "北京市海淀區", "mobile": "18701439456", "email": "287340554@qq.com", "identityNum": "370124199512166011", "birthday": "2018-04-18", "nativeLocation": "北京市", "position": "職位", "politicalStatus": "1", "deleteReason": null, "deleteDate": null, "remark": "無", "roleLevel": 1, "showOrder": null, "wechatOpenId": null, "pwd": null } } }
2). http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/define
(初始化)
(get請求)
{ "ret": 0, "content": { "flowKey": "stationFee", "flowName": "網點保險費流程", "page": "startBank.html", "route": "startCheckAccount.financeStartCheck", "formClass": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumForm", "pageData": { "dept": 6, "person": "1" } } }
3).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/start
(開啓任務)
(post請求)
{"flowKey": "stationFee", "pageForm": { "class": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumForm", "remark":"beizhu",//提交參數 "file":"101"/提交參數 } }
{ "ret": 0, "content": { "id": 659, "flowName": "網點保險費流程", "flowKey": "stationFee", "procInstanceId": "565001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "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, "duration": 5 } }
4).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task
(查看待辦列表 )
(get請求)
//start 分頁參數 (http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task?start=30)
{ "ret": 0, "content": { "content": [ { "id": 654, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "552612", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "333333333", "targetCode": "202", "targetExt": "333", "createTime": "2019-04-29 18:24:40", "completeTime": null, "taskId": "552642", "taskName": "設備配置、出庫", "taskOperator": null, "taskOperationTime": null, "taskDuration": null, "completedTasks": null, "duration": 930 }, { "id": 655, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "552644", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "333333333", "targetCode": "202", "targetExt": "333", "createTime": "2019-04-29 18:36:48", "completeTime": null, "taskId": "552674", "taskName": "設備配置、出庫", "taskOperator": null, "taskOperationTime": null, "taskDuration": null, "completedTasks": null, "duration": 918 }, { "id": 658, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "562538", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "1", "targetCode": "1", "targetExt": "1", "createTime": "2019-04-30 09:32:10", "completeTime": null, "taskId": "562556", "taskName": "配置31n1", "taskOperator": null, "taskOperationTime": null, "taskDuration": null, "completedTasks": null, "duration": 23 }, { "id": 659, "flowName": "網點保險費流程", "flowKey": "stationFee", "procInstanceId": "565001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點保險費", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-30 09:48:43", "completeTime": null, "taskId": "565006", "taskName": "主機系統處理", "taskOperator": null, "taskOperationTime": null, "taskDuration": null, "completedTasks": null, "duration": 6 }, { "id": 653, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "552592", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "1", "targetCode": "167150", "targetExt": "1", "createTime": "2019-04-29 18:22:40", "completeTime": null, "taskId": "552610", "taskName": "配置adsl", "taskOperator": null, "taskOperationTime": null, "taskDuration": null, "completedTasks": null, "duration": 932 } ], "totalElements": 35, "totalPages": 4, "last": true, "number": 3, "size": 10, "sort": [ { "direction": "DESC", "property": "id", "ignoreCase": false, "nullHandling": "NATIVE", "ascending": false, "descending": true } ], "first": false, "numberOfElements": 5 } }
5).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/task/565006
(回顯這個任務的數據)
(get請求)
{ "ret": 0, "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", "creatorId": 1, "id": 6, "date": null, "remark": "beizhu", "dept": 6, "procInstanceId": "565001" }, "attach": [ { "id": 101, "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", "size": 40341, "remark": null, "imgUrl": null, "fid": 6, "ftype": "InsurancePremium" } ] }, "taskId": "565006", "flowEntity": { "id": 659, "flowName": "網點保險費流程", "flowKey": "stationFee", "procInstanceId": "565001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "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": [ { "id": "565001", "taskName": null, "executeId": "565001", "startTime": "2019-04-30 09:48:43", "endTime": "2019-04-30 09:48:43", "assignee": "管理員", "department": "市場部", "duration": 0 } ], "duration": 7 } } }
6).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/stationFee/task/565006
(提交這個任務)
(psot請求)
{"flowKey": "stationFee", "pageForm": { "class": "com.ilotterytech.bwlbis.station.insurance.form.InsurancePremiumHostForm", "insurancePremiumId":"2",//參數 "sureFlag":true,//參數 "remark":"11222222222222222222222222",//參數 "file":"101"//參數 }, "taskId":"565006" }
{ "ret": 0, "content": { "id": 659, "flowName": "網點保險費流程", "flowKey": "stationFee", "procInstanceId": "565001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "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, "duration": 9 } }
7).http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task/history
(查詢任務列表)
(get請求)
// start 分頁參數 http://localhost:8081/bwlbis/bwlbis/ctrl/flow/task/history?start=60
{ "ret": 0, "content": { "content": [ { "id": 597, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "475001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Complete", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 10:27:47", "completeTime": "2019-04-28 19:29:04", "taskId": "515014", "taskName": "查看結果滿意度回訪", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:29:03.677+0000", "taskDuration": 66, "completedTasks": null, "duration": 541 }, { "id": 597, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "475001", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Complete", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 10:27:47", "completeTime": "2019-04-28 19:29:04", "taskId": "515014", "taskName": "查看結果滿意度回訪", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:29:03.677+0000", "taskDuration": 66, "completedTasks": null, "duration": 541 }, { "id": 607, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "487501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 16:16:26", "completeTime": null, "taskId": "515021", "taskName": "填寫處理結果", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:00:22.460+0000", "taskDuration": 0, "completedTasks": null, "duration": 2762 }, { "id": 607, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "487501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 16:16:26", "completeTime": null, "taskId": "515021", "taskName": "填寫處理結果", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:00:22.460+0000", "taskDuration": 0, "completedTasks": null, "duration": 2762 }, { "id": 607, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "487501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 16:16:26", "completeTime": null, "taskId": "515021", "taskName": "填寫處理結果", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:00:22.460+0000", "taskDuration": 0, "completedTasks": null, "duration": 2762 }, { "id": 611, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "497515", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 17:55:13", "completeTime": null, "taskId": "497521", "taskName": "確認辦理時限", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T10:18:23.030+0000", "taskDuration": 23, "completedTasks": null, "duration": 2663 }, { "id": 601, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "477501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 14:56:18", "completeTime": null, "taskId": "517507", "taskName": "填寫處理結果", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:07:27.079+0000", "taskDuration": 0, "completedTasks": null, "duration": 2842 }, { "id": 601, "flowName": "客服中心投訴轉辦", "flowKey": "complaintInfo", "procInstanceId": "477501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "客服中心轉辦投訴", "targetName": null, "targetCode": null, "targetExt": null, "createTime": "2019-04-28 14:56:18", "completeTime": null, "taskId": "517507", "taskName": "填寫處理結果", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-28T11:07:27.079+0000", "taskDuration": 0, "completedTasks": null, "duration": 2842 }, { "id": 608, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "492501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "1", "targetCode": "1", "targetExt": "1", "createTime": "2019-04-28 16:59:46", "completeTime": null, "taskId": "512514", "taskName": "配置cdma信息", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-29T05:57:14.048+0000", "taskDuration": 1152, "completedTasks": null, "duration": 2718 }, { "id": 608, "flowName": "網點升級流程", "flowKey": "stationUpgrade", "procInstanceId": "492501", "creator": "管理員", "creatorId": 1, "department": "市場部", "departmentId": 6, "status": "Running", "category": "網點升級", "targetName": "1", "targetCode": "1", "targetExt": "1", "createTime": "2019-04-28 16:59:46", "completeTime": null, "taskId": "512514", "taskName": "配置cdma信息", "taskOperator": "管理員[1]", "taskOperationTime": "2019-04-29T05:57:14.048+0000", "taskDuration": 1152, "completedTasks": null, "duration": 2718 } ], "totalElements": 75, "totalPages": 8, "last": false, "number": 6, "size": 10, "sort": [ { "direction": "DESC", "property": "id", "ignoreCase": false, "nullHandling": "NATIVE", "ascending": false, "descending": true } ], "first": false, "numberOfElements": 10 } }
8.一個完整的流程完成