Esempio n. 1
0
        protected override async Task <IQueryable <FlowInstance> > BuildSearchQueryAsync(IDictionary <string, string> searchKeys, IQueryable <FlowInstance> query)
        {
            var userId = AbpSession.GetUserId();

            if (searchKeys.ContainsKey("type"))
            {
                var type = searchKeys["type"];
                if (type == "all")//我的流程
                {
                    query = query.Where(o => o.CreatorUserId == userId);
                }
                else if (type == "disposed") //已办事项(即我参与过的流程)
                {
                    var intanceIds = FlowInstanceTransitionHistoryRepository.GetAll().Where(o => o.CreatorUserId == userId)
                                     .Select(o => o.FlowInstanceId).Distinct();

                    query = from flowinstance in query
                            join instanceId in intanceIds on flowinstance.Id equals instanceId
                            select flowinstance;
                }
                else if (type == "processing") //待办事项
                {
                    query = query.Where(o => (o.InstanceStatus == InstanceStatus.Processing || o.InstanceStatus == InstanceStatus.Reject) && (o.MakerList == "ALL" || o.MakerList.Contains($",{userId},")));
                }
            }
            return(query);
        }
Esempio n. 2
0
 /// <summary>
 /// 添加扭转记录
 /// </summary>
 private async Task AddTransHistory(FlowRuntime wfruntime)
 {
     await FlowInstanceTransitionHistoryRepository.InsertAsync(new FlowInstanceTransitionHistory
     {
         FlowInstanceId = wfruntime.flowInstanceId,
         FromNodeId     = wfruntime.currentNodeId,
         FromNodeName   = wfruntime.currentNode.name,
         FromNodeType   = wfruntime.currentNodeType,
         ToNodeId       = wfruntime.nextNodeId,
         ToNodeName     = wfruntime.nextNode.name,
         ToNodeType     = wfruntime.nextNodeType,
         InstanceStatus = wfruntime.nextNodeType == 4 ? InstanceStatus.Finish : InstanceStatus.Processing,
         TransitionSate = 0
     });
 }