12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Configuration;
- using Autofac;
- using EMIS.DataLogic.SystemDAL;
- using EMIS.Entities;
- using Bowin.Common.Utility;
- using EMIS.CommonLogic.PlugworkflowServices;
- using System.Reflection;
- using EMIS.ViewModel.SystemView;
- using Bowin.Common.Linq.Entity;
- using System.Linq.Expressions;
- using EMIS.ViewModel.WorkflowManage;
- using EMIS.Utility.FormValidate;
- using EMIS.Utility;
- using Bowin.Common.Mobile;
- using System.Transactions;
- namespace EMIS.CommonLogic.SystemServices
- {
- public class WorkflowServices : BaseServices, IWorkflowServices
- {
- public ProcessWorkfloconfigDAL ProcessWorkfloconfigDAL { get; set; }
- public RoleDAL RoleDAL { get; set; }
- public Lazy<IProcessRelationServices> ProcessRelationServices { get; set; }
- public Lazy<IUserServices> UserServices { get; set; }
- private PlugworkflowServices.entreeSoapClient client = new PlugworkflowServices.entreeSoapClient();
- private PlugworkflowServices.VerificationModel vm = new PlugworkflowServices.VerificationModel();
- public Func<Guid, MessageBody> MessageFunc = null;
- /// <summary>
- /// 接入系统ID
- /// </summary>
- private static string sysID = ConfigurationSettings.AppSettings["sys_InsertingID"].ToString();
- /// <summary>
- /// 接入系统密码
- /// </summary>
- private static string sysPwd = ConfigurationSettings.AppSettings["sys_InsertingPwd"].ToString();
- /// <summary>
- /// 查询对应tableName的EntityType
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- private Type GetEntityType(string tableName)
- {
- var assembly = typeof(EMISNewContext).Assembly;
- return assembly.GetType("EMIS.Entities." + tableName, false, true);
- }
- /// <summary>
- /// 工作流验证
- /// </summary>
- private void InitVerificationModel()
- {
- vm.AppUID = sysID; // 接入系统ID
- vm.time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- vm.AppUPwd = (sysPwd + vm.time).MD5(); //验证密码
- }
- /// <summary>
- /// 查询对应的接入流程表中AppID(接入流程表ID)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- private string GetAppIDByTableName(string tableName)
- {
- string AppID = string.Empty; //流程ID
- Sys_Workfloconfig workfloconfig = ProcessWorkfloconfigDAL.GetWorkfloconfigQueryable()
- .Where(x => x.TableName == tableName).FirstOrDefault();
- if (workfloconfig != null)
- {
- AppID = workfloconfig.ProcessID.ToString();
- }
- return AppID;
- }
- /// <summary>
- /// 查询对应的接入流程表信息List
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- private List<NextDetailModel> GetStatusList(string tableName)
- {
- //接入流程表ID
- string AppID = this.GetAppIDByTableName(tableName);
- this.InitVerificationModel();
- PlugworkflowServices.ProcessItemAndActionResultModel piarm = client.FlowProcessAndActionSetting(AppID, vm);
- if (piarm.doNum == 1)
- {
- return piarm.resultDataList.ToList();
- }
- else
- {
- return new List<NextDetailModel>();
- }
- }
- /// <summary>
- /// 查询对应的接入流程表开始流程环节的信息List
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- private List<NextDetailModel> GetStartStatusList(string tableName)
- {
- //接入流程表ID
- string AppID = this.GetAppIDByTableName(tableName);
- this.InitVerificationModel();
- PlugworkflowServices.ProcessItemAndActionResultModel piarm = client.FlowProcessAndActionSetting(AppID, vm);
- if (piarm.doNum == 1)
- {
- return piarm.resultDataList.Where(x => x.Tp == "start").ToList();
- }
- else
- {
- return new List<NextDetailModel>();
- }
- }
- /// <summary>
- /// 查询对应的接入流程表开始流程环节的Pid(对应的流程环节Pid)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public int? GetStartStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => x.Tp == "start").Select(x => x.Pid).FirstOrDefault();
- }
- /// <summary>
- /// 查询对应的接入流程表已退回流程环节Pid(注:不包含开始环节、结束环节且为[BP]标识)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public int? GetSendBackStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => x.Tp == "auto" && (x.Description ?? "").Contains("[BP]")).Select(x => x.Pid).FirstOrDefault();
- }
- /// <summary>
- /// 查询对应的接入流程表已通过流程环节Pid(注:不包含开始环节、结束环节且为[PASS]标识)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public int? GetPassNoEndStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => x.Tp == "auto" && (x.Description ?? "").Contains("[PASS]")).Select(x => x.Pid).FirstOrDefault();
- }
- /// <summary>
- /// 查询对应的结束流程环节Pid
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<int?> GetEndStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => x.Tp == "end").Select(x => x.Pid).ToList();
- }
- /// <summary>
- /// 查询对应的结束流程环节且正常结束的流程环节Pid(注:结束环节且不为[BP]标识的)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public int? GetCorrectEndStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => x.Tp == "end" && !(x.Description ?? "").Contains("[BP]")).Select(x => x.Pid).FirstOrDefault();
- }
- /// <summary>
- /// 查询重录待审,重新录入环节Pid(用于期末设定学生名单背景颜色)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<int?> GetRebutStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => (x.Description ?? "").Contains("[Rebut]")).Select(x => x.Pid).ToList();
- }
- /// <summary>
- /// 查询对应的接入流程表非正常结束的流程环节Pid(注:通常为结束环节且为[BP]标识的)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<int?> GetBackpointStatus(string tableName)
- {
- var statusList = this.GetStatusList(tableName);
- return statusList.Where(x => (x.Description ?? "").Contains("[BP]")).Select(x => x.Pid).ToList();
- }
- /// <summary>
- /// 查询对应的接入流程表中开始环节、审核流程环节Pid(注:不包含结束、非正常[BP]结束环节)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<int?> GetStartApproveStatusList(string tableName)
- {
- try
- {
- return this.GetStatusList(tableName).Where(x => x.Tp != "end" && !(x.Description ?? "").Contains("[BP]"))
- .Select(x => x.Pid).ToList();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的接入流程表中全部流程环节信息(WorkflowStatusView)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<WorkflowStatusView> GetStatusViewList(string tableName)
- {
- return this.GetStatusList(tableName).Select(x => new WorkflowStatusView
- {
- ID = x.Pid,
- Name = x.PName,
- Description = x.Description ?? ""
- }).OrderBy(x => x.ID).ToList();
- }
- /// <summary>
- /// 查询对应的接入流程表中审核流程环节信息(WorkflowStatusView,不包含开始、结束、非正常[BP]结束环节)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<WorkflowStatusView> GetApproveStatusViewList(string tableName)
- {
- try
- {
- return this.GetStatusList(tableName).Where(x => x.Tp != "start" && x.Tp != "end" && !(x.Description ?? "").Contains("[BP]"))
- .Select(x => new WorkflowStatusView
- {
- ID = x.Pid,
- Name = x.PName,
- Description = x.Description ?? ""
- }).OrderBy(x => x.ID).ToList();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的接入流程表中全部非开始流程环节信息(WorkflowStatusView,不包含开始环节)
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<WorkflowStatusView> GetNoStartStatusViewList(string tableName)
- {
- try
- {
- return this.GetStatusList(tableName).Where(x => x.Tp != "start")
- .Select(x => new WorkflowStatusView
- {
- ID = x.Pid,
- Name = x.PName,
- Description = x.Description ?? ""
- })
- .OrderBy(x => x.ID).ToList();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询对应的接入流程表中全部结束流程环节信息
- /// </summary>
- /// <param name="tableName"></param>
- /// <returns></returns>
- public List<WorkflowStatusView> GetEndStatusViewList(string tableName)
- {
- try
- {
- return this.GetStatusList(tableName).Where(x => x.Tp == "end")
- .Select(x => new WorkflowStatusView
- {
- ID = x.Pid,
- Name = x.PName,
- Description = x.Description ?? ""
- }).OrderBy(x => x.ID).ToList();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 查询工作流程中是否有对应的权限(根据对应的信息-处理人、处理人标识)
- /// </summary>
- /// <param name="tableName"></param>
- /// <param name="userID"></param>
- /// <param name="formIDs"></param>
- /// <param name="dataRangeUserFunc"></param>
- /// <returns></returns>
- private bool IsCanSubmit(string tableName, Guid userID, List<Guid> formIDs,
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- bool isMatched = false;
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- this.InitVerificationModel();
- List<PlugworkflowServices.NextDetailModel> listNetxtDetail = this.GetStatusList(tableName)
- .Where(x => x.Tp == "start").ToList();
- var userAndRoleList = listNetxtDetail.SelectMany(x => x.PendingUserType.Split(',')).Distinct().ToList();
- var posibleUserList = UserServices.Value.GetUserListByLoginID(userAndRoleList);
- IList<Sys_Role> listrole = UserServices.Value.GetUserRoles(user.UserID);
- foreach (var listDetail in listNetxtDetail)
- {
- var pandingUserList = listDetail.PendingUserType.Split(',');
- for (int i = 0; i < pandingUserList.Length; i++)
- {
- string userAndrole = pandingUserList[i]; //获取工作流配置处理人的ID
- var userlist = posibleUserList.FirstOrDefault(x => x.LoginID == userAndrole);
- //判断工作流配置处理是否是用户操作还是角色操作处理
- if (userlist != null)
- {
- if (userlist.UserID == userID)
- {
- isMatched = true;
- }
- }
- else
- {
- //如果配置角色和当前登录人角色对应
- foreach (var role in listrole)
- {
- if (userAndrole == role.RoleName)
- {
- isMatched = true;
- }
- }
- }
- }
- }
- if (!isMatched)
- {
- return false;
- }
- if (dataRangeUserFunc != null)
- {
- return dataRangeUserFunc(formIDs, userID);
- }
- return true;
- }
- /// <summary>
- /// 查询工作流程中是否有对应的操作权限——动作(根据对应的信息-处理人、处理人标识)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="userID">用户ID</param>
- /// <param name="actionID">审核动作ID(路由ID)</param>
- /// <param name="formIDs">表单ID列表</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- /// <returns></returns>
- public bool IsCanApprove(string tableName, Guid userID, Guid actionID, List<Guid> formIDs,
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- List<string> instanceIDList = new List<string>();
- List<string> list = new List<string>();
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- var role = UserServices.Value.GetUserRoles(userID);
- this.InitVerificationModel();
- //流程关联表
- List<Sys_ProcessRelation> processRelationList = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && formIDs.Contains((Guid)x.formID)).ToList();
- if (processRelationList.Count > 0)
- instanceIDList = processRelationList.Select(x => x.InstanceID).ToList();
- PendingWorkResultModel pwrm = client.PendingWorkBatchList(AppID, instanceIDList.ToArray(), vm); //读取待办
- if (pwrm.doNum == 1)
- {
- var userPendingWorkList = pwrm.resultDataList.GroupBy(x => x.InstanceID)
- .Where(x => !x.Any(n => role.Any(w => w.RoleName == n.PendingUsers) || n.PendingUsers == user.LoginID)).ToList();
- if (userPendingWorkList.Count > 0)
- {
- return false;
- }
- }
- if (dataRangeUserFunc != null)
- {
- return dataRangeUserFunc.Invoke(formIDs, userID);
- }
- return true;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="tableName"></param>
- /// <param name="userID"></param>
- /// <param name="formIDs"></param>
- /// <returns></returns>
- public List<WorkflowPermissionView> IsCanApprove(string tableName, Guid userID, List<Guid> formIDs)
- {
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- List<string> instanceIDList = new List<string>();
- List<string> list = new List<string>();
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- var role = UserServices.Value.GetUserRoles(userID);
- this.InitVerificationModel();
- //流程关联表
- List<Sys_ProcessRelation> processRelationList = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && formIDs.Contains((Guid)x.formID)).ToList();
- if (processRelationList.Count > 0)
- instanceIDList = processRelationList.Select(x => x.InstanceID).ToList();
- PendingWorkResultModel pwrm = client.PendingWorkBatchList(AppID, instanceIDList.ToArray(), vm); //读取待办
- if (pwrm.doNum == 1)
- {
- var userPendingWorkList = pwrm.resultDataList.GroupBy(x => x.InstanceID)
- .Where(x => x.Any(n => role.Any(w => w.RoleName == n.PendingUsers) || n.PendingUsers == user.LoginID)).ToList();
- var permissionResult = (from fid in formIDs
- join pr in processRelationList on fid equals pr.formID into dpr
- from pr in dpr.DefaultIfEmpty()
- join upw in userPendingWorkList on pr.InstanceID equals upw.Key into dupw
- from upw in dupw.DefaultIfEmpty()
- select new { FormID = fid, IsCanApprove = (pr != null && upw != null) } into result
- group result by new { result.FormID, result.IsCanApprove } into g
- select new WorkflowPermissionView { FormID = g.Key.FormID, IsCanApprove = g.Key.IsCanApprove }).ToList();
- return permissionResult;
- }
- else
- {
- throw new Exception(pwrm.doMessage);
- }
- }
- /// <summary>
- /// 重载方法,启动对应的流程并执行指定的动作至下一环节(提交),适用于开始节点有两个以上动作时
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">需要提交的记录主键ID</param>
- /// <param name="userID">提交人ID</param>
- /// <param name="userID">动作ID</param>
- /// <param name="comment">提交意见</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- public void StartUp(string tableName, Guid formID, Guid userID, Guid actionID, string comment,
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- try
- {
- //查询接入流程表ID
- string AppID = this.GetAppIDByTableName(tableName);
- string instanceID = string.Empty;
- bool isCanSubmit = this.IsCanSubmit(tableName, userID, new List<Guid> { formID }, dataRangeUserFunc);
- if (!isCanSubmit)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- this.InitVerificationModel();
- PlugworkflowServices.NextDetailModel listNetxtDetail = this.GetStatusList(tableName)
- .Where(x => x.Tp == "start").FirstOrDefault();
- var pendingUserList = listNetxtDetail.PendingUserType.Split(',');
- //流程关联表
- Sys_ProcessRelation processRelation = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && x.formID == formID).FirstOrDefault();
- if (processRelation != null)
- instanceID = processRelation.InstanceID;
- if (string.IsNullOrEmpty(instanceID)) //判断是否已经存在流程如果存在就直接提交审核
- {
- var result = client.InstanceProcessStart(AppID, "", user.LoginID, vm); //启动流程
- if (result.doNum == 1)
- {
- PendingWorkItem pwi = result.resultDataList.FirstOrDefault(); //转换
- ProcessRelationServices.Value.ProcessRelationAdd(formID, pwi.InstanceID, tableName); //保存流程关联表
- }
- else
- {
- throw new Exception(result.doMessage);
- }
- }
- try
- {
- //判断是否卡在开始环节,否则不能随便审核
- var result = client.PendingWorkList("", "", AppID, instanceID, "", "", "A", "1", "100", vm);
- if (result.doNum == 1)
- {
- if (result.resultDataList.Length == 0)
- {
- throw new Exception("该环节并无后续动作,无法提交。");
- }
- var instanceProcessModel = result.resultDataList.FirstOrDefault();
- if (instanceProcessModel.PID == this.GetStartStatus(tableName))
- {
- Approve(tableName, formID, userID, actionID, comment, dataRangeUserFunc);
- }
- else
- {
- throw new Exception("该流程已经提交,不能重复提交。");
- }
- }
- else
- {
- throw new Exception(result.doMessage);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 启动对应的流程并执行指定的动作至下一环节(提交)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">需要提交的记录主键ID</param>
- /// <param name="userID">提交人ID</param>
- /// <param name="comment">提交意见</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- public void StartUp(string tableName, Guid formID, Guid userID, string comment = "",
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- this.StartUp(tableName, formID, userID, Guid.Empty, comment, dataRangeUserFunc);
- }
- /// <summary>
- /// 启动对应的流程并执行指定的动作至下一环节(提交)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formIDList">需要提交的记录主键ID</param>
- /// <param name="userID">提交人ID</param>
- /// <param name="actionID">动作ID</param>
- /// <param name="comment">提交意见</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- public void BatchStartUp(string tableName, List<Guid> formIDList, Guid userID, string comment,
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- try
- {
- //查询接入流程表ID
- if (formIDList.Count == 0)
- {
- return;
- }
- string AppID = this.GetAppIDByTableName(tableName);
- List<string> instanceIDList = new List<string>();
- bool isCanSubmit = this.IsCanSubmit(tableName, userID, formIDList, dataRangeUserFunc);
- if (!isCanSubmit)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- var newProcessRelationList = new List<BaseProcessRelationView>();
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- this.InitVerificationModel();
- PlugworkflowServices.NextDetailModel listNetxtDetail = this.GetStatusList(tableName)
- .Where(x => x.Tp == "start").FirstOrDefault();
- var pendingUserList = listNetxtDetail.PendingUserType.Split(',');
- //流程关联表
- List<Sys_ProcessRelation> processRelationList = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && formIDList.Contains((Guid)x.formID)).ToList();
- if (processRelationList.Count > 0)
- instanceIDList = processRelationList.Select(x => x.InstanceID).ToList();
- var newProcessList = (from fid in formIDList
- join pr in processRelationList on fid equals pr.formID into dpr
- from pr in dpr.DefaultIfEmpty()
- where pr == null
- select fid).ToList();
- if (newProcessList.Count > 0) //判断是否已经存在流程如果存在就直接提交审核
- {
- var result = client.InstanceProcessBatchStart(newProcessList.Count, AppID, "", user.LoginID, vm); //启动流程
- if (result.doNum == 1)
- {
- List<PendingWorkItem> pwi = result.resultDataList.ToList(); //转换
- for (var i = 0; i < newProcessList.Count; i ++ )
- {
- newProcessRelationList.Add(new BaseProcessRelationView { FormID = newProcessList[i], InstanceID = pwi[i].InstanceID });
- instanceIDList.Add(pwi[i].InstanceID);
- }
- ProcessRelationServices.Value.ProcessRelationAdd(newProcessRelationList, tableName); //保存流程关联表
- }
- else
- {
- throw new Exception(result.doMessage);
- }
- }
- try
- {
- //判断是否卡在开始环节,否则不能随便审核
- var result = client.PendingWorkBatchList(AppID, instanceIDList.ToArray(), vm);
- if (result.doNum == 1)
- {
- var noNextList = instanceIDList.Where(x => !result.resultDataList.Select(w => w.InstanceID).Contains(x)).ToList();
- if (noNextList.Count > 0)
- {
- throw new Exception("部分数据在该环节并无后续动作,无法提交,可能由于没有配置相应权限,请联系系统管理员检查。");
- }
- var instanceProcessModel = result.resultDataList.FirstOrDefault();
- if (instanceProcessModel.PID == this.GetStartStatus(tableName))
- {
- BatchApprove(tableName, formIDList, userID, Guid.Empty, comment, dataRangeUserFunc);
- }
- else
- {
- throw new Exception("该流程已经提交,不能重复提交。");
- }
- }
- else
- {
- throw new Exception(result.doMessage);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 审核流程(不包括提交——不包含流程启动)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">需要审核的记录主键ID</param>
- /// <param name="userID">审核人ID</param>
- /// <param name="actionID">审核动作ID</param>
- /// <param name="comment">提交意见</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- public void Approve(string tableName, Guid formID, Guid userID, Guid actionID, string comment = "",
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- try
- {
- //接入流程表ID
- string AppID = this.GetAppIDByTableName(tableName);
- string instanceID = string.Empty;
- List<string> nextWorkby = new List<string>();
- IList<Sys_User> dataRangeUserList = new List<Sys_User>();
- bool isCanApprove = this.IsCanApprove(tableName, userID, actionID, new List<Guid> { formID }, dataRangeUserFunc);
- //获取有权限审核的用户
- if (!isCanApprove)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- var roleList = UserServices.Value.GetUserRoles(userID);
- this.InitVerificationModel();
- var startStepList = this.GetStatusList(tableName).Where(x => x.Tp == "start").ToList();
- var endStepList = this.GetStatusList(tableName).Where(x => x.Tp == "end").ToList();
- //流程关联表
- Sys_ProcessRelation processRelation = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && x.formID == formID).FirstOrDefault();
- if (processRelation != null)
- instanceID = processRelation.InstanceID;
- PendingWorkResultModel pwrm = client.PendingWorkList("", "", AppID, instanceID, "",
- "", "A", "1", "100", vm); //读取待办
- if (pwrm.doNum == 1)
- {
- var userPendingWorkList = pwrm.resultDataList.Where(x => roleList.Any(w => w.RoleName == x.PendingUsers) || x.PendingUsers == user.LoginID).ToList();
- if (userPendingWorkList.Count == 0)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- foreach (var itempwi in userPendingWorkList)
- {
- if (itempwi.WorkTime == null)
- {
- List<NextStepModel> nextStepList = null;
- var processItemResultModel = client.ProcessLoadNextDetail(itempwi.InstanceProcessID, vm); //获取流程明细
- if (processItemResultModel.resultDataItem.Tp == "start")
- {
- throw new Exception("当前流程并未提交,请先提交再进行审核。");
- }
- if (processItemResultModel.resultDataItem.Tp == "end")
- {
- throw new Exception("当前流程已经结束,无法审核。");
- }
- //判断是否有指定下一步动作
- if (actionID != null && actionID != Guid.Empty)
- nextStepList = processItemResultModel.resultDataItem.NextSteps
- .Where(x => x.ActionID == actionID.ToString()).ToList(); //获取下一步用户
- else
- nextStepList = processItemResultModel.resultDataItem.NextSteps.ToList(); //获取下一步用户
- //根据角色ID 获取用户ID
- foreach (var itemnext in nextStepList)
- {
- string nextActionID = itemnext.ActionID.ToString();
- string methodName = itemnext.ActionFunc;
- int pid = itemnext.Pid;
- //if (startStepList.Any(x => x.Pid == itemnext.Pid)) //如果是提交到起始环节
- //{
- // ProcessDetailResultModel pdrm = client.LoadProcessDetails(AppID, instanceID, vm); //获取处理记录
- // if (pdrm.doNum == 1)
- // {
- // //获取开始环节信息
- // InstanceProcessModel ipm = pdrm.resultDataList.Where(x => x.tp == "start").FirstOrDefault();
- // if (ipm != null)
- // {
- // //获取下一步的待办名单
- // nextWorkby.Add(ipm.WorkBy);
- // }
- // }
- //}
- //else
- if (endStepList.Any(x => x.Pid == pid))
- {
- nextWorkby = new List<string>();
- }
- else
- {
- //获取下一步的待办名单
- nextWorkby = itemnext.PendingUserType.Split(',').ToList();
- }
- if (nextWorkby.Count == 0 && !endStepList.Any(x => x.Pid == pid))
- {
- throw new Exception("后续的流程环节并没有适合的审批人,无法提交。");
- }
- if (!string.IsNullOrEmpty(methodName))
- {
- ReflectorHelper.RunMethod(methodName, new List<Guid>() { formID }, userID);
- }
- //推送下一步流程
- ResultModel rm = client.ProcessMoveNext(itempwi.InstanceProcessID, nextActionID
- , new ActionFunc[] { }, nextWorkby.Distinct().ToArray(), comment, user.LoginID, new string[] { }, vm);
- if (rm.doNum != 1)
- throw new Exception(rm.doMessage);
- else
- {
- var entity = UnitOfWork.Set(this.GetEntityType(tableName)).Find(formID);
- dynamic dyEntity = entity;
- var entityType = entity.GetType();
- if (entityType.GetProperty("ApprovalStatus") != null)
- {
- dyEntity.ApprovalStatus = pid;
- }
- else if (entityType.GetProperty("RecordStatus") != null)
- {
- dyEntity.RecordStatus = pid;
- }
- UnitOfWork.Update(dyEntity);
- UnitOfWork.Commit();
- this.SendMobileMQ(formID, nextWorkby.ToArray());
- return;
- }
- }
- }
- }
- }
- else
- {
- throw new Exception(pwrm.doMessage);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 审核流程(不包括提交——不包含流程启动)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">需要审核的记录主键ID</param>
- /// <param name="userID">审核人ID</param>
- /// <param name="actionID">审核动作ID</param>
- /// <param name="comment">提交意见</param>
- /// <param name="dataRangeUserFunc">获取数据范围用户的方法</param>
- public void BatchApprove(string tableName, List<Guid> formIDList, Guid userID, Guid actionID, string comment = "",
- Func<List<Guid>, Guid, bool> dataRangeUserFunc = null)
- {
- try
- {
- if (formIDList.Count == 0)
- {
- return;
- }
- //接入流程表ID
- string AppID = this.GetAppIDByTableName(tableName);
- List<string> instanceIDList = new List<string>();
- List<string> nextWorkby = new List<string>();
- IList<Sys_User> dataRangeUserList = new List<Sys_User>();
- string approveMethodName = null;
- string nextActionID = null;
- int? pid = null;
- bool isCanApprove = this.IsCanApprove(tableName, userID, actionID, formIDList, dataRangeUserFunc);
- //获取有权限审核的用户
- if (!isCanApprove)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- //获取当前用户
- var user = UserServices.Value.GetUserByID(userID);
- var roleList = UserServices.Value.GetUserRoles(userID);
- this.InitVerificationModel();
- var startStepList = this.GetStatusList(tableName).Where(x => x.Tp == "start").ToList();
- var endStepList = this.GetStatusList(tableName).Where(x => x.Tp == "end").ToList();
- //流程关联表
- List<Sys_ProcessRelation> processRelationList = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && formIDList.Contains((Guid)x.formID)).ToList();
- if (processRelationList.Count == formIDList.Count)
- instanceIDList = processRelationList.Select(x => x.InstanceID).ToList();
- else
- throw new Exception("部分记录并未提交,无法直接审核。");
- PendingWorkResultModel pwrm = client.PendingWorkBatchList(AppID, instanceIDList.ToArray(), vm); //读取待办
- if (pwrm.doNum == 1)
- {
- var userPendingWorkList = pwrm.resultDataList.Where(x => roleList.Any(w => w.RoleName == x.PendingUsers) || x.PendingUsers == user.LoginID).ToList();
- if (userPendingWorkList.Select(x => x.InstanceID).Distinct().Count() != formIDList.Count)
- {
- throw new Exception("对不起,对于部分数据,您没权限进行操作,请重新选择数据提交。");
- }
- if (userPendingWorkList.GroupBy(x => new { x.AppID, x.PID }).Count() > 1)
- {
- throw new Exception("需要审批的数据状态不一致,不能批量审核,请重新选择数据提交。");
- }
- var processItemResultModelList = client.ProcessBatchLoadNextDetail(userPendingWorkList.Select(x => x.InstanceProcessID).ToArray(), vm);
- if (processItemResultModelList.doNum != 1)
- {
- throw new Exception("流程信息读取失败。", new Exception(processItemResultModelList.doMessage));
- }
- foreach (var itempwi in userPendingWorkList)
- {
- if (itempwi.WorkTime == null)
- {
- List<NextStepModel> nextStepList = null;
- var processItemResultModel = processItemResultModelList.resultDataItemList.FirstOrDefault(x => x.ID == itempwi.InstanceProcessID); //获取流程明细
- if (processItemResultModel == null)
- {
- throw new Exception("流程信息读取失败。");
- }
- if (processItemResultModel.Tp == "start")
- {
- throw new Exception("当前流程并未提交,请先提交再进行审核。");
- }
- if (processItemResultModel.Tp == "end")
- {
- throw new Exception("当前流程已经结束,无法审核。");
- }
- //判断是否有指定下一步动作
- if (actionID != null && actionID != Guid.Empty)
- nextStepList = processItemResultModel.NextSteps
- .Where(x => x.ActionID == actionID.ToString()).ToList(); //获取下一步用户
- else
- nextStepList = processItemResultModel.NextSteps.ToList(); //获取下一步用户
- //根据角色ID 获取用户ID
- foreach (var itemnext in nextStepList)
- {
- nextActionID = itemnext.ActionID.ToString();
- approveMethodName = itemnext.ActionFunc;
- pid = itemnext.Pid;
- if (endStepList.Any(x => x.Pid == pid))
- {
- nextWorkby = new List<string>();
- }
- else
- {
- //获取下一步的待办名单
- nextWorkby = itemnext.PendingUserType.Split(',').ToList();
- }
- if (nextWorkby.Count == 0 && !endStepList.Any(x => x.Pid == pid))
- {
- throw new Exception("后续的流程环节并没有适合的审批人,无法提交。");
- }
- }
- }
- }
- using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, new TimeSpan(1, 0, 0)))
- {
- if (!string.IsNullOrEmpty(approveMethodName))
- {
- ReflectorHelper.RunMethod(approveMethodName, formIDList, userID);
- }
- //推送下一步流程
- ResultModel rm = client.ProcessBatchMoveNext(userPendingWorkList.Select(x => x.InstanceProcessID).ToArray(), nextActionID
- , new ActionFunc[] { }, nextWorkby.Distinct().ToArray(), comment, user.LoginID, new string[] { }, vm);
- if (rm.doNum != 1)
- throw new Exception(rm.doMessage);
- else
- {
- IDictionary<string, object> updateKeyValueList = new Dictionary<string, object>();
- var entityType = this.GetEntityType(tableName);
- if (entityType.GetProperty("ApprovalStatus") != null)
- {
- updateKeyValueList.Add("ApprovalStatus", pid.Value);
- }
- else if (entityType.GetProperty("RecordStatus") != null)
- {
- updateKeyValueList.Add("RecordStatus", pid);
- }
- foreach (var formID in formIDList)
- {
- this.SendMobileMQ(formID, nextWorkby.ToArray());
- }
- UnitOfWork.BatchUpdate(tableName, updateKeyValueList, formIDList);
- scope.Complete();
- return;
- }
- }
- }
- else
- {
- throw new Exception(pwrm.doMessage);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 工作流流程状态修改(通常用于取消申请、撤销等环节)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">表单ID</param>
- /// <param name="status">状态:A为活动,D为结束、其他的自己定义</param>
- /// <param name="description">描述改变内容</param>
- public void ModifyProcessState(string tableName, Guid formID, string status, string description)
- {
- try
- {
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- string instanceID = string.Empty;
- List<string> list = new List<string>();
- //流程关联表
- Sys_ProcessRelation processRelation = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.TableName == tableName && x.formID == formID).FirstOrDefault();
- if (processRelation != null)
- instanceID = processRelation.InstanceID;
- this.InitVerificationModel();
- ResultModel rm = client.InstanceProcessChange(instanceID, status, description, vm);
- if (rm.doNum != 1)
- {
- throw new Exception(rm.doMessage);
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 根据当前流程环节ID获取下一步审批动作
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">表单ID</param>
- /// <param name="userID">当前用户ID</param>
- /// <returns></returns>
- public List<ActionView> GetActionView(string tableName, Guid formID, Guid userID)
- {
- try
- {
- List<ActionView> listAction = new List<ActionView>();
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- string instanceID = string.Empty;
- Sys_ProcessRelation processRelation = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.formID == formID && x.TableName == tableName).FirstOrDefault();
- if (processRelation != null)
- instanceID = processRelation.InstanceID;
- this.InitVerificationModel();
- var user = UserServices.Value.GetUserByID(userID);
- var role = UserServices.Value.GetUserRoles(userID);
- PendingWorkResultModel pwrm = client.PendingWorkList("", "", AppID, instanceID, "", "", "A", "1", "100", vm); //读取待办
- if (pwrm != null)
- {
- var userPendingWorkList = pwrm.resultDataList.Where(x => role.Any(w => w.RoleName == x.PendingUsers) || x.PendingUsers == user.LoginID).ToList();
- if (userPendingWorkList.Count == 0)
- {
- throw new Exception("对不起,您没权限进行操作。");
- }
- List<PendingWorkItem> listpwi = userPendingWorkList.Take(1).ToList();
- foreach (var itempwi in listpwi)
- {
- if (itempwi.WorkTime == null)
- {
- var processItemResultModel = client.ProcessLoadNextDetail(itempwi.InstanceProcessID, vm); //获取动作
- List<NextStepModel> listnext = processItemResultModel.resultDataItem.NextSteps.OrderBy(x => x.sort).ToList(); //获取下一步用户
- foreach (var item in listnext)
- {
- ActionView action = new ActionView();
- action.ActionID = new Guid(item.ActionID);
- action.ActionName = item.AName;
- action.PendingUser = item.PendingUserType;
- action.PendingUserName = item.PendingUser;
- action.StepName = item.PName;
- action.Sort = item.sort;
- action.Description = item.ADescription;
- listAction.Add(action);
- }
- }
- }
- }
- return listAction;
- }
- catch (Exception ex)
- {
- throw (new Exception(ex.Message));
- }
- }
- /// <summary>
- /// 重载方法,根据当前流程环节ID获取全部审批动作
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <returns></returns>
- public List<ActionView> GetActionView(string tableName)
- {
- try
- {
- List<NextDetailModel> statusLists = GetStatusList(tableName);
- List<ActionView> listAction = new List<ActionView>();
- foreach (var statusList in statusLists)
- {
- foreach (var item in statusList.NextSteps)
- {
- ActionView action = new ActionView();
- action.ActionID = new Guid(item.ActionID);
- action.ActionName = item.AName;
- action.PendingUser = item.PendingUserType;
- action.PendingUserName = item.PendingUser;
- action.StepName = item.PName;
- action.Pid = statusList.Pid;
- action.ToPid = item.Pid;
- action.Sort = item.sort;
- listAction.Add(action);
- }
- }
- return listAction;
- }
- catch (Exception ex)
- {
- throw (new Exception(ex.Message));
- }
- }
- /// <summary>
- /// 查询开始流程环节的动作列表List
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <returns></returns>
- public List<ActionView> GetStartActionView(string tableName)
- {
- return this.GetStartStatusList(tableName).FirstOrDefault().NextSteps.Select(x => new ActionView
- {
- ActionID = new Guid(x.ActionID),
- ActionName = x.AName,
- StepName = x.AName,
- Sort = x.sort,
- Description = x.ADescription
- }).ToList();
- }
- /// <summary>
- /// 查询对应的审核历史信息列表List(WorkflowApproveHistoryView)
- /// </summary>
- /// <param name="tableName">主表表名</param>
- /// <param name="formID">需要获取的记录主键ID</param>
- /// <returns></returns>
- public IList<ViewModel.SystemView.WorkflowApproveHistoryView> GetApproveHistoryViewList(string tableName, Guid formID)
- {
- try
- {
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- string InstanceID = string.Empty;
- List<WorkflowApproveHistoryView> list = new List<WorkflowApproveHistoryView>();
- this.InitVerificationModel();
- Sys_ProcessRelation processRelation = ProcessWorkfloconfigDAL.GetProcessRelationQueryable()
- .Where(x => x.formID == formID && x.TableName == tableName).FirstOrDefault();
- if (processRelation != null)
- InstanceID = processRelation.InstanceID;
- if (!string.IsNullOrEmpty(InstanceID))
- {
- ProcessDetailResultModel processDetailResultModel = client.LoadProcessDetails(AppID, InstanceID, vm);
- List<InstanceProcessModel> listipm = processDetailResultModel.resultDataList
- .Where(x => !string.IsNullOrEmpty(x.WorkBy))
- .OrderBy(x => x.CreateTime).ToList();
- foreach (var lt in listipm)
- {
- string userNo = string.Empty;
- string username = string.Empty;
- if (lt.WorkBy != null)
- {
- var userlist = UserServices.Value.GetUserByLoginID(lt.WorkBy);
- if (userlist != null)
- {
- userNo = userlist.LoginID;
- username = userlist.Name;
- }
- }
- if (!list.Any(x => x.PID == lt.PID && x.ApproveUserName == username
- && x.PName == lt.PName && x.ActionName == lt.ActionName
- && x.ApproveTime == lt.WorkTime.ParseStrTo<DateTime>() && x.Comment == lt.Comment))
- {
- WorkflowApproveHistoryView wahv = new WorkflowApproveHistoryView();
- wahv.ApproveHistoryID = lt.ID.ParseStrTo<Guid>();
- wahv.PID = lt.PID;
- wahv.ApproveUserNo = userNo;
- wahv.ApproveUserName = username;
- wahv.PName = lt.PName;
- wahv.ActionName = lt.ActionName;
- wahv.ApproveTime = lt.WorkTime.ParseStrTo<DateTime>();
- wahv.Comment = lt.Comment;
- list.Add(wahv);
- }
- }
- }
- return list;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 获取待办列表
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="tableName">主表表名</param>
- /// <param name="query">查询视图,指定一个IQueryable决定如何获取表单记录</param>
- /// <param name="userID">待办用户ID</param>
- /// <param name="pkSelector">指定主键列</param>
- /// <param name="pageIndex">页码</param>
- /// <param name="pageSize">每页行数</param>
- /// <returns></returns>
- public IGridResultSet<T> QueryByPendingJob<T, TOrder>(string tableName, IQueryable<T> query, Guid userID,
- Expression<Func<T, Guid>> pkSelector, Expression<Func<T, TOrder>> orderby, bool isDescending = false,
- int? pageIndex = null, int? pageSize = null)
- {
- try
- {
- string AppID = this.GetAppIDByTableName(tableName); //流程ID
- string InstanceID = string.Empty;
- var user = UserServices.Value.GetUserByID(userID); //获取提交人
- var role = UserServices.Value.GetUserRoles(userID);
- this.InitVerificationModel();
- var queryProessRelation = ProcessWorkfloconfigDAL.processRelationRepository.GetList(x => x.TableName == tableName);
- PendingWorkResultModel pwrm = client.PendingWorkList("", "", AppID, "", "", "", "A",
- ((pageIndex ?? 0) + 1).ToString(), "9999", vm);
- //访问接口成功
- if (pwrm.doNum == 1)
- {
- var instanceIDList = pwrm.resultDataList.Where(x => role.Any(w => w.RoleName == x.PendingUsers) || x.PendingUsers == user.LoginID)
- .Select(x => x.InstanceID).ToList();
- var queryprrm = queryProessRelation.Where(x => instanceIDList.Contains(x.InstanceID));
- var result = query.Join(queryprrm, pkSelector, (x => (x.formID ?? Guid.Empty)), ((x, y) => x));
- if (isDescending)
- {
- result = result.OrderByDescending(orderby);
- }
- else
- {
- result = result.OrderBy(orderby);
- }
- return result.ToGridResultSet(pageIndex, pageSize);
- }
- else
- {
- return new GridResultSet<T> { rows = new List<T>(), total = 0 };
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 推送下一个处理人标识
- /// </summary>
- /// <param name="formID"></param>
- /// <param name="nextWorkbyArray"></param>
- private void SendMobileMQ(Guid formID, string[] nextWorkbyArray)
- {
- if (this.MessageFunc == null)
- {
- return;
- }
- var userIDList = RoleDAL.RoleRepository.GetList(x => nextWorkbyArray.Contains(x.RoleName))
- .SelectMany(x => x.Sys_User).Where(x => x.CF_Student.UserID != null).Distinct()
- .Union(
- RoleDAL.UserRepository.GetList(x => nextWorkbyArray.Contains(x.LoginID))
- .Where(x => x.CF_Student.UserID != null))
- .Select(x => x.UserID).ToList();
- var message = this.MessageFunc.Invoke(formID);
- MobileMQ.SendMessage(userIDList.Select(x => x.ToString()).ToArray(), message);
- }
- }
- }
|