/// <summary> /// 读取Form传过来的数据 /// </summary> /// <param name="data">数据</param> /// <param name="convert">转化器</param> protected override void ReadFormData(UserJobData data, FormConvert convert) { DefaultReadFormData(data, convert); data.FromUserId = LoginUser.Id; data.LinkId = GetIntArg("lid", 0); data.EntityType = GetIntArg("eid", 0); data.JobType = UserJobType.Audit; var users = GetIntArrayArg("ToUserIds"); if (users.Length == 0) { throw new AgebullBusinessException("必须有接收者"); } if (BusinessContext.Current.LoginUser.RoleId > 1 && users.Any(p => p == BusinessContext.Current.LoginUserId)) { throw new AgebullBusinessException("不得提交给自己"); } users = users.Where(p => p > 0).Distinct().ToArray(); if (users.Length == 0) { throw new AgebullBusinessException("必须有接收者"); } var ids = GetIntArrayArg("ids").Distinct().ToArray(); if (ids.Length == 0) { throw new AgebullBusinessException("必须有数据"); } bool first = true; var cpy = new UserJobData(); cpy.CopyValue(data); string title = data.Title; foreach (var user in users) { foreach (var id in ids) { var wd = WorkflowControler.LoadData(data.EntityType, id); if (first) { data.ToUserId = user; data.LinkId = id; if (title != null && wd != null) { data.Title = title.Replace("*", wd.Title); } first = false; } else { cpy.ToUserId = user; cpy.LinkId = id; if (title != null && wd != null) { cpy.Title = title.Replace("*", wd.Title); } Business.AddNew(cpy); } } } }