public void BeginExam(BeginExamModel data) { var proxy = new WorkflowProxy(); string processName = data.ProcessName; //获取下一步的NodeName,用于获取该Node对应的Team和用户列表 string nodeName = proxy.GetFirstNodeName(processName); //获取node对应的用户 List<User> users = teamRepo.GetAllUsersByNodeName(processName, nodeName); foreach (User user in users) { var processInstance = new ProcessInstance { ProcessName = processName, Actor = user.UserID, ActorName = user.UserName }; var taskUser = new TaskUser(); taskUser.UserId = user.UserID; taskUser.UserName = user.UserName; taskUser.UserRole = "Student"; processInstance.IncludeActors.Add(taskUser); processInstance = proxy.CreateProcessInstance(processInstance); LogHelper.Instanse.WriteInfo( string.Format("发起流程,用户-{0},InstanceID-{1}", taskUser.UserId, processInstance.InstanceID)); } }
public ApiResponse InitExam([FromBody] InitExamModel data) { taskService.InitExam(data); BeginExamModel begin = new BeginExamModel() { ProcessName = data.ProcessName, UserId = data.User.UserID, UserName = data.User.UserName }; taskService.BeginExam(begin); return ApiOk(); }