/// <summary>
        /// 申请单流程状态转换
        /// </summary>
        /// <param name="order">申请单</param>
        /// <param name="nextStep">流程下一步</param>
        /// <param name="operation">流程操作</param>
        /// <returns>流程下一步状态</returns>
        private OrderStatus SwitchStatus(OrderModel order, WorkflowStepModel nextStep, OperateOrderModel operation)
        {
            var nextStatus = OrderStatus.Apply;

            //1, 申请
            if (operation.Operation == WorkflowOperation.Apply)
            {
                nextStatus = OrderStatus.Apply;
            }
            //2, 拒绝
            else if (operation.Operation == WorkflowOperation.Rejecte)
            {
                nextStatus = OrderStatus.Rejected;
            }
            //3, 流程未完成
            else if (nextStep != null && nextStep.Id > 0)
            {
                //3.1, 行政、财务审阅(领导已批准)
                if (nextStep.IsAdminReviewing() || nextStep.IsFinanceReviewing())
                {
                    //nextStatus = OrderStatus.Reviewing;
                    nextStatus = (order.RefOrderId == null || order.RefOrderId.Value < 1
                        ? OrderStatus.Approved
                        : OrderStatus.Revoked);
                }
                //3.2, 领导审批
                else if (nextStep.IsLeaderApproving())
                {
                    nextStatus = OrderStatus.Approving;
                }
            }
            //4, 流程结束
            else
            {
                nextStatus = (order.RefOrderId == null || order.RefOrderId.Value < 1
                    ? OrderStatus.Approved
                    : OrderStatus.Revoked);
            }

            return(nextStatus);
        }
        /// <summary>
        /// 更新假期信息
        /// </summary>
        /// <param name="dbContext">数据库上下文</param>
        /// <param name="order">申请单</param>
        /// <param name="workflow">申请单流程</param>
        /// <param name="nextStep">流程下一步</param>
        /// <param name="nextStatus">申请单状态</param>
        private void UpdateAttendanceSummary(MissionskyOAEntities dbContext, OrderModel order, WorkflowModel workflow,
                                             WorkflowStepModel nextStep, OrderStatus nextStatus)
        {
            var detail = order.OrderDets.FirstOrDefault(); //申请单详细

            if (detail == null || detail.IOHours == null || Math.Abs(detail.IOHours.Value) <= 0.0)
            {
                Log.Error("申请单无效");
                throw new InvalidOperationException("申请单无效。");
            }

            var curStep = order.NextStep == Constant.WORKFLOW_DIRECT_SUPERVISOR_APPROVE_NODE
                ? workflow.GetDirectSupervisorApproveStep()
                : workflow.WorkflowSteps.FirstOrDefault(it => it.Id == order.NextStep); //当前步骤

            var isUpdated = false;
            var times     = detail.IOHours.Value;

            //1, 拒绝
            if (nextStatus == OrderStatus.Rejected)
            {
                if (curStep != null && curStep.IsFinanceReviewing()) //当前是[财务审阅]: [行政审批]完成,已经更新了假期,需要[财务审阅]时,取消扣除的假期
                {
                    isUpdated = true;
                    times     = -times;
                }
            }
            //2, 流程结束(只能在没有财务审批节点才更新,避免重复更新(原始需求:完成行政审批就已经更新假期))
            else if (!workflow.NeedFinanceApprove() && nextStep == null)
            {
                isUpdated = true;
            }
            //3, 流程未结束, 转到[财务审阅](完成行政审批就更新)
            else if (nextStep != null && nextStep.IsFinanceReviewing())
            {
                isUpdated = true;
            }

            if (isUpdated)
            {
                order.OrderUsers.ToList().ForEach(user =>
                {
                    var summary = new UpdateAttendanceSummaryModel()
                    {
                        UserId      = user.Id,
                        SummaryYear = DateTime.Now.Year,
                        Times       = times,
                        Type        = order.OrderType
                    };

                    double beforeUpdated = 0.0;
                    double afterUpdated  = 0.0;
                    string auditMsg      = string.Empty;

                    this._attendanceSummaryService.UpdateAttendanceSummary(dbContext, summary, ref beforeUpdated,
                                                                           ref afterUpdated); //更新假期

                    #region 更新剩余结果

                    if (order.OrderType == OrderType.AnnualLeave)
                    {
                        auditMsg = string.Format("剩余年假: 申请前{0}小时,申请后{1}小时", beforeUpdated, afterUpdated);
                    }

                    else if (order.OrderType == OrderType.Overtime)
                    {
                        auditMsg = string.Format("累计加班: 申请前{0}小时,申请后{1}小时", beforeUpdated, afterUpdated);
                    }
                    else if (order.OrderType == OrderType.DaysOff)
                    {
                        auditMsg = string.Format("剩余调休: 申请前{0}小时,申请后{1}小时", beforeUpdated, afterUpdated);
                    }
                    else
                    {
                        auditMsg = string.Format("累计休假: 申请前{0}小时,申请后{1}小时", beforeUpdated, afterUpdated);
                    }

                    if (!string.IsNullOrEmpty(auditMsg))
                    {
                        detail.Audit = auditMsg;
                    }

                    #endregion
                });
            }
        }