轉子:https://my.oschina.net/zhuwawa/blog/394653數據庫
activiti:initiator 屬性的做用: 能夠把啓動流程實例的操做人名稱「applyUserId」保存到數據庫中,須要配合使用app
identifyService.setAuthenticated-UserId(String userId) 引擎會把setAuthenitcatedUserId() 方法的參數做爲流程啓動人,經過調用HistoricProcessInstance 實例的 getStartUserId() 能夠獲取歷史(也多是正在運行)流程實例由那個用戶啓動的。ide
processEngine.getIdentityService().setAuthenticatedUserId(userId);
/** * 個人申請 */ public Criteria findPersonalTasks(String userid, Criteria criteria) { if(userid==null||"".equals(userid)){ return criteria; } // 若是是辦理過的簽名確定是本人 HistoricProcessInstanceQuery todoQuery = historyService.createHistoricProcessInstanceQuery() .orderByProcessDefinitionId().desc().orderByProcessInstanceEndTime().desc(); List<HistoricProcessInstance> todoList = todoQuery.startedBy(userid).listPage((criteria.getPageNum()-1), criteria.getNumPerPage()); criteria.setTotal((int)(todoQuery.count())); criteria.setList(todoList); return criteria; }