Пример #1
0
        public override ExtractExamFlowDto Handle(ExtractExamFlowDto flowDto)
        {
            Console.WriteLine("HandlerB执行");
            var list = Enumerable.Range(6, 3).ToList();

            flowDto.ExamIdList.AddRange(list);

            return(ExecuteNextHandler(flowDto));
        }
Пример #2
0
        /// <summary>
        /// 执行下一流程
        /// </summary>
        /// <param name="flowDto"></param>
        /// <returns></returns>
        protected ExtractExamFlowDto ExecuteNextHandler(ExtractExamFlowDto flowDto)
        {
            if (flowDto.ExtractCount <= 0 || NextHandler == null)
            {
                return(flowDto);
            }

            return(NextHandler.Handle(flowDto));
        }
Пример #3
0
        /// <summary>
        /// 抽取试题Id
        /// </summary>
        /// <param name="flowQueue"></param>
        /// <returns></returns>
        public List <int> GetExamIdList(Queue <HandlerEnum> flowQueue)
        {
            var flowDto = new ExtractExamFlowDto()
            {
                TotalCount = 10
            };

            if (flowQueue.Count == 0)
            {
                return(flowDto.ExamIdList);
            }

            var firstHandler = GetNextHandler(flowQueue.Dequeue());

            foreach (var nextHandler in flowQueue.Select(GetNextHandler))
            {
                SetNextHandler(firstHandler, nextHandler);
            }

            return(firstHandler.Handle(flowDto).ExamIdList.Take(flowDto.TotalCount).ToList());
        }
Пример #4
0
 public abstract ExtractExamFlowDto Handle(ExtractExamFlowDto flowDto);