/// <summary>
        /// 订单交易信息构造函数
        /// <para>作    者:Huang GaoLiang</para>
        /// <para>创建时间:2018.9.19</para>
        /// </summary>
        /// <param name="entity">报名信息</param>
        public EnrollOrderTrade(TblOdrEnrollOrder entity)
        {
            this._entity = entity;
            switch (entity.OrderStatus)
            {
            case (int)OrderStatus.Paid:
                this._remark = "报班支出";
                break;

            case (int)OrderStatus.Cancel:
                this._remark = "报班作废";
                break;
            }
        }
예제 #2
0
        /// <summary>
        /// 获取的排课详情
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="enrollOrderItemId">报名课程订单Id</param>
        /// <returns>学生报名一个课程的排课详细信息</returns>
        public MakeLessonDetailResponse GetMakeLessonDetail(long enrollOrderItemId)
        {
            MakeLessonDetailResponse res = new MakeLessonDetailResponse
            {
                CourseInfos = new List <CourseInformation>()
            };

            TblOdrEnrollOrderItem enrollOrderItem = _enrollOrderItemRepository.Load(enrollOrderItemId);
            TblOdrEnrollOrder     enrollOrder     = _enrollOrderRepository.Load(enrollOrderItem.EnrollOrderId);

            TblDatCourse course = CourseService.GetByCourseId(enrollOrderItem.CourseId);

            res.RegisterInfo = new RegisterInformation()
            {
                ClassTimes    = enrollOrderItem.ClassTimes,
                ClassTimesUse = enrollOrderItem.ClassTimesUse,
                CourseName    = string.Empty,
                LevelName     = CourseLevelService.GetById(enrollOrderItem.CourseLevelId)?.LevelCnName ?? string.Empty,
                Year          = enrollOrderItem.Year,
                CourseType    = CourseType.Elective,
                TermTypeId    = enrollOrderItem.TermTypeId,
                TermTypeName  = TermTypeService.GetTermTypeName(enrollOrderItem.TermTypeId),
                EnrollDate    = enrollOrder.CreateTime
            };

            if (course != null)
            {
                res.RegisterInfo.CourseName = course.ShortName;
                res.RegisterInfo.CourseType = CourseType.Compulsory;
            }

            List <TblTimMakeLesson> makeLessons =
                _makeLessonRepository.GetUnconfirmedMakeLessonList(enrollOrderItem.EnrollOrderItemId);

            if (makeLessons.Any())
            {
                List <long> classIds = makeLessons.Select(x => x.ClassId).ToList();

                List <TblDatClass> classes = DefaultClassService.GetClassByClassIdAsync(classIds).Result;

                List <ViewRoomCourse> classRooms = ClassRoomService.GetClassRoomBySchoolId(enrollOrder.SchoolId);

                //老师
                var teacherList = TeachService.GetTeachers();

                foreach (var makeLesson in makeLessons)
                {
                    var classInfo        = classes.FirstOrDefault(x => x.ClassId == makeLesson.ClassId);
                    var classSchoolTimes = new DefaultClassService(classInfo.ClassId).ClassSchoolTimes;
                    //老师信息
                    var teacher = teacherList.FirstOrDefault(x => x.TeacherId == classInfo.TeacherId);

                    CourseInformation courseInformation = new CourseInformation
                    {
                        ClassId        = classInfo.ClassId,
                        Year           = enrollOrderItem.Year,
                        ClassNo        = classInfo.ClassNo,
                        ClassTimesUse  = makeLesson.ClassTimes,
                        CourseName     = course?.ShortName ?? string.Empty,
                        FirstClassTime = makeLesson.FirstClassTime,
                        RoomNo         = classRooms.FirstOrDefault(x => x.ClassRoomId == classInfo.ClassRoomId)?.RoomNo ?? string.Empty,
                        LevelName      = CourseLevelService.GetById(classInfo.CourseLeveId)?.LevelCnName ?? string.Empty,
                        TeacherName    = teacher?.TeacherName ?? string.Empty,
                        TermName       = TermService.GetTermByTermId(classInfo.TermId)?.TermName ?? string.Empty,
                        Week           = classSchoolTimes.Select(x => x.WeekDay)
                                         .Distinct()
                                         .OrderBy(x => x)
                                         .Select(x => WeekDayConvert.IntToString(x))
                                         .ToList(),
                        PeriodTime = new List <string>()
                    };

                    foreach (var item in classSchoolTimes)
                    {
                        string time = item.BeginTime + "-" + item.EndTime;
                        if (courseInformation.PeriodTime.Any(x => x == time))
                        {
                            continue;
                        }
                        courseInformation.PeriodTime.Add(time);
                    }

                    res.CourseInfos.Add(courseInformation);
                }
            }

            return(res);
        }
예제 #3
0
        /// <summary>
        /// 获取排课课次信息列表
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-02-19</para>
        /// </summary>
        /// <returns>课次信息列表</returns>
        public List <LessonCreatorInfo> GetLessonCreatorInfo()
        {
            List <LessonCreatorInfo> res = new List <LessonCreatorInfo>();

            //校验排课信息是否为空
            ValidateObject(_makeLesson);

            if (_makeLesson.IsConfirm)
            {
                throw new BussinessException(ModelType.SignUp, 9);
            }

            //1.获取学期信息
            var termInfo = TermService.GetTermByTermId(_classService.TblDatClass.TermId);

            ValidateObject(termInfo);

            //订单明细
            TblOdrEnrollOrderItem orderItem =
                _enrollOrderItemRepository.Load(_makeLesson.EnrollOrderItemId);
            //订单
            TblOdrEnrollOrder order =
                _enrollOrderRepository.Load(orderItem.EnrollOrderId);

            //2.获取停课日
            List <SchoolHolidayResponse> schoolHoliday = TermService.GetSchoolHoliday(termInfo);

            //上课时间
            DateTime classDate = _makeLesson.FirstClassTime;

            //首次上课日期大于学期结束日期则没有课次
            if (classDate > termInfo.EndDate)
            {
                return(res);
            }

            //首次上课日期未到学期开始时间取学期设置开始日期
            if (classDate < termInfo.BeginDate)
            {
                classDate = termInfo.BeginDate;
            }

            bool     isStandard180 = this.IsStandard180(_classService.ClassSchoolTimes);                 //180分钟
            TimeType duration      = (TimeType)_classService.ClassSchoolTimes.FirstOrDefault().Duration; //时长

            int standard180     = termInfo.Classes180;                                                   //设置180分钟标准
            int makeLessonTotal = _makeLesson.ClassTimes;                                                //设置排课总数

            if (isStandard180)
            {
                //180分钟设置的标准是否是奇数
                bool class180IsOddNumber = Convert.ToBoolean(termInfo.Classes180 % 2);
                standard180 = class180IsOddNumber ? termInfo.Classes180 - 1 : termInfo.Classes180;

                //排课是否是奇数
                bool makeIsOddNumber = Convert.ToBoolean(_makeLesson.ClassTimes % 2);
                //报名课次数量 考虑180分钟排2个课次的完整性
                makeLessonTotal = makeIsOddNumber ? _makeLesson.ClassTimes - 1 : _makeLesson.ClassTimes;
            }

            //上课日期大于学期结束日期停止排课
            while (classDate <= termInfo.EndDate)
            {
                //当天是否停课
                bool isClosed = SchoolHolidayService.TodayIsSuspendClasses(schoolHoliday, classDate);

                if (isClosed)
                {
                    classDate = classDate.AddDays(1);
                    continue;
                }

                int week = WeekDayConvert.DayOfWeekToInt(classDate);

                List <TblDatSchoolTime> classTimes = _classService.ClassSchoolTimes
                                                     .Where(x => x.WeekDay == week)
                                                     .OrderBy(x => x.BeginTime)
                                                     .ToList();

                //处理上课时间发生变化
                var changeTimes = _viewChangeClassTimeDates
                                  .Where(x => x.OldClassDate == classDate)
                                  .OrderBy(x => x.NewClassBeginTime)
                                  .ToList();

                if (!classTimes.Any() && !changeTimes.Any())
                {
                    classDate = classDate.AddDays(1);
                    continue;
                }

                //180分钟课程
                if (duration == TimeType.Ninety && isStandard180 == true)
                {
                    if (!changeTimes.Any())
                    {
                        var ct1 = classTimes[0];
                        var ct2 = classTimes[1];

                        res.Add(this.GetCreatorInfo(classDate, ct1.BeginTime, ct1.EndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                        res.Add(this.GetCreatorInfo(classDate, ct2.BeginTime, ct2.EndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                    }
                    else
                    {
                        var ct1 = changeTimes[0];
                        var ct2 = changeTimes[1];

                        res.Add(this.GetCreatorInfo(ct1.NewClassDate, ct1.NewClassBeginTime, ct1.NewClassEndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                        res.Add(this.GetCreatorInfo(ct2.NewClassDate, ct2.NewClassBeginTime, ct2.NewClassEndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                    }

                    _lessonCount += 2;
                }
                else
                {
                    if (!changeTimes.Any())
                    {
                        var ct1 = classTimes[0];
                        res.Add(this.GetCreatorInfo(classDate, ct1.BeginTime, ct1.EndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                    }
                    else
                    {
                        var ct1 = changeTimes[0];
                        res.Add(this.GetCreatorInfo(ct1.NewClassDate, ct1.NewClassBeginTime, ct1.NewClassEndTime, termInfo.SchoolId, order.StudentId, termInfo.TermId));
                    }

                    _lessonCount += 1;
                }

                //上课时间大于学期结束时间停止排课或者预计排课课次等于实际排课课次停止排课
                if (this._lessonCount == makeLessonTotal)
                {
                    return(res);
                }
                //执行60分钟标准
                else if (duration == TimeType.Sixty && this._lessonCount == termInfo.Classes60)
                {
                    return(res);
                }
                //执行90分钟标准
                else if (duration == TimeType.Ninety && isStandard180 == false && this._lessonCount == termInfo.Classes90)
                {
                    return(res);
                }
                //执行180分钟标准
                else if (duration == TimeType.Ninety && isStandard180 == true && this._lessonCount == standard180)
                {
                    return(res);
                }

                classDate = classDate.AddDays(1);
            }

            return(res);
        }
예제 #4
0
        /// <summary>
        /// 添加已核对的未交接核对信息
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2018-11-16</para>
        /// </summary>
        /// <param name="request">核对未交接数据对象</param>
        /// <param name="status">订单状态</param>
        /// <param name="orderInfo">订单信息对象</param>
        /// <returns>订单交接核对明细Id</returns>
        private long AddEnrollUnhandover(OrderHandleAddRequest request, HandoverStatus status, TblOdrEnrollOrder orderInfo)
        {
            var entity = new TblFinOrderHandoverDetail
            {
                OrderHandoverDetailId = IdGenerator.NextId(),
                OrderId          = orderInfo.EnrollOrderId,
                OrderNo          = orderInfo.OrderNo,
                OrderTradeType   = request.OrderTradeType,
                PayType          = request.PayType,
                PayAmount        = request.PayAmount.Value,
                HandoverStatus   = (int)status,
                PersonalId       = request.PersonalId,
                PayDate          = request.PayDate,
                SchoolId         = request.SchoolId,
                UseBalanceAmount = request.UseBalanceAmount ?? 0,
                CreateTime       = DateTime.Now,
                CreatorId        = request.CreatorId,
                CreatorName      = request.CreatorName,
                StudentId        = orderInfo.StudentId,
                Remark           = orderInfo.Remark,
                TotalDiscountFee = orderInfo.TotalDiscountFee
            };

            _detailRepository.Value.Add(entity);

            return(entity.OrderHandoverDetailId);
        }