/// <summary> /// 增加流转信息(*******此方法适用于任何节点,正常调用一次即可******) /// </summary> /// <param name="flowInfoSearchViewModel"></param> /// <returns></returns> public FlowNodePreMiddlecs Work_FlowNodeAll_Add(FlowInfoSearchViewModel flowInfoSearchViewModel) { string RepairType = flowInfoSearchViewModel.RepairType;//表单类型,也就是相对应的角色类型 //当前节点的下一节点信息 List <Flow_CurrentNodeAndNextNode> nodeDefine_Infos = _IFlowNodeDefineInfoRepository .SearchNextNodeInfoByWhere(flowInfoSearchViewModel.Flow_NodeDefineId); //获取当前节点信息 var currentNodeInfo = _IFlowNodeDefineInfoRepository .GetInfoByNodeDefineId(flowInfoSearchViewModel.Flow_NodeDefineId); var currentAllInfo = _IMapper.Map <Flow_NodeDefine, FlowNodePreMiddlecs>(currentNodeInfo); if (nodeDefine_Infos.Count != 0) //没有到结束节点 { currentAllInfo.Flow_NextNodeDefineId = nodeDefine_Infos[0].Flow_NextNodeDefineId; //下一节点Id,也就是拟文Id } //请求信息存入流转信息表 var nodeByrepair_Info = _IMapper.Map <FlowInfoSearchViewModel, Flow_Node>(flowInfoSearchViewModel); currentAllInfo = _IMapper.Map <Flow_Node, FlowNodePreMiddlecs>(nodeByrepair_Info, currentAllInfo); if (nodeByrepair_Info.Parent_Flow_NodeDefineId != null)//说明是非开始节点,包括(普通节点和结束节点) { Work_FlowNodeOperate_Update(flowInfoSearchViewModel, nodeByrepair_Info, nodeDefine_Infos); } if (nodeByrepair_Info.operate != "2")//说明不是结束节点 { _IFlowNodeRepository.Add(nodeByrepair_Info); } _IFlowNodeRepository.SaveChanges(); if (nodeByrepair_Info.Parent_Flow_NodeDefineId == null) //说明是开始节点,需要再自动生成拟文和拟文下一步的流转信息 { var FirstFlow = _IMapper.Map <FlowNodePreMiddlecs, FlowInfoSearchViewModel>(currentAllInfo, flowInfoSearchViewModel); currentAllInfo = Work_FlowNodeAll_Add(FirstFlow);//生成拟文流转记录 //获得下一节点处理人id ,这里也就是管理员的 用户id RoleByNodeSearchSingleViewModel userLis = new RoleByNodeSearchSingleViewModel(); userLis.Flow_NextNodeDefineId = currentAllInfo.Flow_NextNodeDefineId.Value; //下一节点Id userLis.RoleType = RepairType; //表单的类型与角色类型必须一致 List <UserSearchMiddlecs> frn = User_By_Node_Search(userLis); if (frn.Count != 1) { return(null); } //生成管理员流转信息 var NiWenFlow = _IMapper.Map <FlowNodePreMiddlecs, FlowInfoSearchViewModel>(currentAllInfo, flowInfoSearchViewModel); NiWenFlow.User_InfoId = frn[0].id; currentAllInfo = Work_FlowNodeAll_Add(NiWenFlow);//生成拟文下一节点流转记录,也就是管理员未办记录 } return(currentAllInfo); }
public ActionResult <UserSearchResModel> Manage_Role_By_Search(RoleByNodeSearchSingleViewModel roleByNodeSearchSingleViewModel) { UserSearchResModel userSearchResModel = new UserSearchResModel(); userSearchResModel.user_Infos = _IWorkFlowService.User_By_Node_Search(roleByNodeSearchSingleViewModel); userSearchResModel.isSuccess = true; userSearchResModel.TotalNum = userSearchResModel.user_Infos.Count; userSearchResModel.baseViewModel.Message = "根据用户查询角色成功"; userSearchResModel.baseViewModel.ResponseCode = 200; _ILogger.Information("根据节点查用户列表成功"); return(Ok(userSearchResModel)); }
/// <summary> /// 根据节点查用户列表(重载内部使用) /// </summary> /// <param name="roleByNodeSearchSingleViewModel"></param> /// <returns></returns> public List <UserSearchMiddlecs> User_By_Node_Search(RoleByNodeSearchSingleViewModel roleByNodeSearchSingleViewModel) { List <Flow_Relate_NodeRole> node_Relate_Info_Roles = _IRelateRoleByNodeRepository.SearchRoleInfoByWhere(roleByNodeSearchSingleViewModel); List <int> RoleList = new List <int>(); for (int i = 0; i < node_Relate_Info_Roles.Count; i++) { int User_RoleId = node_Relate_Info_Roles[i].User_RoleId; RoleList.Add(User_RoleId); } List <User_Info> user_Relate_Info_Users = _IUserRelateInfoRoleRepository.SearchUserInfoByListWhere(RoleList); var userLsit_Info = _IMapper.Map <List <User_Info>, List <UserSearchMiddlecs> >(user_Relate_Info_Users); return(userLsit_Info); }
/// <summary> /// 根据节点查询角色(重载) /// </summary> /// <param name="roleByNodeSearchSingleViewModel"></param> /// <returns></returns> public List <Flow_Relate_NodeRole> SearchRoleInfoByWhere(RoleByNodeSearchSingleViewModel roleByNodeSearchSingleViewModel) { int id = roleByNodeSearchSingleViewModel.Flow_NextNodeDefineId; string roleType = roleByNodeSearchSingleViewModel.RoleType; if (roleType != null && roleType != "") { var queryResult = DbSet.Where(k => k.Flow_NodeDefineId == id && k.User_Role.Status == "0" && k.User_Role.RoleType == roleType) .Include(p => p.User_Role) .OrderBy(o => o.id) .ToList(); return(queryResult); } else { var queryResult = DbSet.Where(k => k.Flow_NodeDefineId == id && k.User_Role.Status == "0") .Include(p => p.User_Role) .OrderBy(o => o.id) .ToList(); return(queryResult); } }