Activiti工作流 任務的辦理 回退和拒絕

2021-10-24 22:19:48 字數 4633 閱讀 1354

/**

* @description 辦理任務

* @param taskid 需要辦理的任務id

* @author giserdev

* @email [email protected]

* @date 2020-10-17 11:18:13

*/@override

public

void

completetask

(string taskid)

任務的回退即將當前任務退回到上一次審批級別。

/**

* @description 駁回任務

* @param taskid 任務id

* @author giserdev

* @email [email protected]

* @date 2020-10-17 20:22:28

*/void

taskrollback

(string taskid)

;

@autowired

private processengine processengine;

@autowired

private taskservice taskservice;

@autowired

private historyservice historyservice;

@autowired

private runtimeservice runtimeservice;

@autowired

private repositoryservice repositoryservice;

@autowired

private managementservice managementservice;

/** * @description 任務回退

* @param taskid 當前任務id

* @author giserdev

* @email [email protected]

* @date 2020-10-18 02:04:03

*/public

void

taskrollback

(string taskid)

/** 取得流程定義 */

processdefinitionentity definition =

(processdefinitionentity)

(processengine.

getrepositoryservice()

.getprocessdefinition

(currtask

.getprocessdefinitionid()

));if

(definition == null)

/** 獲取前一步操作任務定義key */

string previoustaskdefkey = taskdefinitionkey.

getprevioustaskdefkey

(currtask.

gettaskdefinitionkey()

);if(previoustaskdefkey == null)

/** 取得上一步活動 */

activityimpl curractivity =

((processdefinitionimpl) definition)

.findactivity

(currtask.

gettaskdefinitionkey()

);list

nexttransitionlist = curractivity.

getincomingtransitions()

;/** 清除當前活動的出口 */

list

oripvmtransitionlist =

newarraylist

(); list

pvmtransitionlist = curractivity

.getoutgoingtransitions()

;for

(pvmtransition pvmtransition : pvmtransitionlist)

pvmtransitionlist.

clear()

;/** 建立新出口 */

list

newtransitions =

newarraylist

();for

(pvmtransition nexttransition : nexttransitionlist)

}/** 獲取當前流程例項的流程變數 */

mapcurrinstancevariables = currinstance.

getprocessvariables()

;/** 完成任務 */

list

tasks = taskservice.

createtaskquery()

.processinstanceid

(currinstance.

getid()

).taskdefinitionkey

(currtask.

gettaskdefinitionkey()

).list()

;for

(task task : tasks)

/** 恢復方向 */

for(transitionimpl transitionimpl : newtransitions)

for(pvmtransition pvmtransition : oripvmtransitionlist)

return;}

catch

(exception e)

}

package com.giser.activiti.constant;

/** * @description 任務狀態

* @author giserdev

* @email [email protected]

* @date 2020-10-18 02:09:07

*/public

enum taskdefinitionkey

public string getkey()

public

void

setkey

(string key)

public string getmessage()

public

void

setmessage

(string message)

/** * @description 獲取前一步任務

* @return

* @author giserdev

* @email [email protected]

* @date 2020-10-18 02:25:53

*/public

static string getprevioustaskdefkey

(string currenttaskdefkey)

taskdefinitionkey[

] taskdefinitionkeyarray = taskdefinitionkey.

values()

;for

(int i=taskdefinitionkeyarray.length -

1; i >=

0; i--)}

return null;

}}

任務的拒絕,即無論當前審批到哪乙個節點,都回到待提交審批的狀態。

/**

* @description 拒絕任務

* @param taskid 任務id

* @author giserdev

* @param processinstanceid

* @email [email protected]

* @date 2020-10-18 11:20:36

*/void

rejecttask

(string taskid, string processinstanceid)

;

/**

* @description 拒絕任務

* @param taskid 任務id

* @author giserdev

* @email [email protected]

* @date 2020-10-18 11:22:00

*/public

void

rejecttask

(string currtaskid, string processinstanceid)

public

class

jumpcmd

implements

command

@override

public executionentity execute

(commandcontext commandcontext)

}

Activiti工作流之任務

回顧 activiti工作流之簡介與環境搭建 activiti工作流之流程部署和相關操作 activiti工作流之任務的執行 查詢 完成 activiti工作流之流程變數 activiti工作流之歷史查詢 activiti工作流之流程分支 activiti工作流之閘道器 11張表 select fr...

Activiti工作流概述

一 概述 工作流 workflow 就是 業務過程的部分或整體在計算機應用環境下的自動化 它主要解決的是 使在多個參與者之間按照某種預定義的規則傳遞文件 資訊或任務的過程自動進行,從而實現某個預期的業務目標,或者促使此目標的實現 工作流管理系統 workflow management system,...

Activiti工作流課程

activiti5是由alfresco軟體在2010年5月17日發布的業務流程管理 bpm 框架,它是覆蓋了業務流程管理 工作流 服務協作等領域的乙個開源的 靈活的 易擴充套件的可執行流程語言框架。activiti基於apache許可的開源bpm平台,創始人tom baeyens是jboss jbp...