/** * 开始流程 * * @return */ @RequestMapping(value = "/start.do") public String startProcessDefinition( HttpServletRequest request, @RequestParam("processDefId") String processDefId, @RequestParam("userId") String userId) { // 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中 identityService.setAuthenticatedUserId(userId); Map map = new HashMap(); map.put("owner", userId); runtimeService.startProcessInstanceById(processDefId, map); return "redirect:/simple/index.do"; }
/** * @param taskId * @param processInstanceId * @param message */ @Override public void saveComment(String taskId, String processInstanceId, String message) { identityService.setAuthenticatedUserId(UserUtils.getUserFromSession().getNatrualkey()); taskService.addComment(taskId, processInstanceId, message); }