/// <summary>
        /// 描述:根据退费订单的Id获取退费订单的课程明细
        /// <para>作    者:瞿  琦</para>
        /// <para>创建时间:2018-12-20</para>
        /// </summary>
        /// <param name="refundOrderId">退费订单表Id</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>休学订单课程明细</returns>
        internal static List <RefundOrderTransactDetailListResponse> GetRefundCourseAmountDetail(long refundOrderId, string companyId)
        {
            //获取所有的课程信息
            var courseList = CourseService.GetAllAsync().Result;
            //获取所有的学期类型
            var termTypeList = new TermTypeService().GetAll();
            //获取所有的课程级别集合
            var courseLevelList = new CourseLevelService(companyId).GetList().Result;

            var refundCourseList        = new TblOdrRefundOrdeEnrollRepository().GetRefundOrderByOrderEnroll(refundOrderId);
            var leaveSchoolCourseIdList = refundCourseList.Select(x => x.EnrollOrderItemId);

            var courseOrderDetailList = EnrollOrderService.GetEnrollOrderItemIdByEnroOrderList(leaveSchoolCourseIdList);
            var refundCourseDetail    = new List <RefundOrderTransactDetailListResponse>();

            foreach (var item in courseOrderDetailList)
            {
                var refundCourseInfo = refundCourseList.FirstOrDefault(k => k.EnrollOrderItemId == item.EnrollOrderItemId);
                //获取上课课次
                var haveClassLesson = refundCourseInfo?.UseLessonCount ?? 0;
                //获取扣除费用
                var deductAmount = haveClassLesson * (item.MaterialFee + item.TuitionFee);
                //获取休学/退班课次
                var leaveSchoolLessons = refundCourseInfo?.LessonCount ?? 0;
                //获取退费金额
                var refundAmount = refundCourseInfo?.Amount ?? 0;

                var entity = new RefundOrderTransactDetailListResponse
                {
                    Year               = item.Year,
                    TermTypeId         = item.TermTypeId,
                    TermTypeName       = termTypeList.FirstOrDefault(k => k.TermTypeId == item.TermTypeId)?.TermTypeName,
                    EnrollOrderItemId  = item.EnrollOrderItemId,
                    CourseId           = item.CourseId,
                    CourseName         = courseList.FirstOrDefault(k => k.CourseId == item.CourseId)?.CourseCnName,
                    CourseLevelId      = item.CourseLevelId,
                    CourseLevelName    = courseLevelList.FirstOrDefault(k => k.CourseLevelId == item.CourseLevelId)?.LevelCnName,
                    ClassTimes         = item.ClassTimes,
                    PaidAmount         = item.PayAmount,
                    HaveClassLesson    = haveClassLesson,    //上课课次
                    DeductAmount       = deductAmount,       //扣除费用
                    LeaveSchoolLessons = leaveSchoolLessons, //休学/退班课次
                    RefundAmount       = refundAmount,       //退费金额
                    TuitionFee         = item.TuitionFee,
                    MaterialFee        = item.MaterialFee,
                    DiscountFee        = item.DiscountFee,
                };
                refundCourseDetail.Add(entity);
            }

            return(refundCourseDetail);
        }
Beispiel #2
0
        /// <summary>
        /// 根据转校订单获取一个课次销毁对象
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-02-19</para>
        /// </summary>
        /// <param name="refundOrderId">转校订单ID</param>
        /// <param name="unitOfWork">工作单元</param>
        public ChangeSchoolLessonFinisher(long refundOrderId, UnitOfWork unitOfWork)
        {
            this._refundOrderId = refundOrderId;

            _viewChangeSchoolOrderRepository =
                unitOfWork.GetCustomRepository <ViewChangeSchooolOrderRepository, ViewChangeSchooolOrder>();

            _refundOrdeEnrollRepository =
                unitOfWork.GetCustomRepository <TblOdrRefundOrdeEnrollRepository, TblOdrRefundOrdeEnroll>();

            _lessonRepository =
                unitOfWork.GetCustomRepository <TblTimLessonRepository, TblTimLesson>();
        }