Exemplo n.º 1
0
        /// <summary>
        /// 获取包含课程和等级的课程信息 必修课
        /// <para>作    者: Huang GaoLiang </para>
        /// <para>创建时间: 2018-11-07 </para>
        /// </summary>
        /// <returns>返回必修课的课程信息</returns>
        public List <CourseAndLevelResponse> GetCompulsoryCourseAndLevel(string companyId)
        {
            // 1、获取该校区所有授权通过的课程编号
            List <long> courseSchoolIds = _schoolCourseRepository.Value.LoadList(m => m.SchoolId == _schoolId).Select(m => m.CourseId).Distinct().ToList();

            // 2、根据课程编号获取课程所有必修课的课程信息
            List <TblDatCourse> courseList = CourseService.GetAllAsync().Result.Where(m => courseSchoolIds.Contains(m.CourseId) && m.CourseType == (int)CourseType.Compulsory).ToList();

            // 3、根据课程编号查询课程等级中间表中的相关等级编号
            List <long> courseIds = courseList.Select(m => m.CourseId).Distinct().ToList();
            List <TblDatCourseLevelMiddle> courseLeaveId = _datCourseLevelMiddleRepository.Value.LoadList(m => courseIds.Contains(m.CourseId)).ToList();

            // 4、获取课程对应的等级信息
            List <TblDatCourseLevel> courseLeaves = new CourseLevelService(companyId).GetList().Result.Select(m => new TblDatCourseLevel
            {
                CourseLevelId = m.CourseLevelId,
                LevelCnName   = m.LevelCnName
            }).ToList();

            // 5、组合数据
            var result = (from c in courseList
                          join m in courseLeaveId on c.CourseId equals m.CourseId
                          join l in courseLeaves on m.CourseLevelId equals l.CourseLevelId
                          select new CourseAndLevelResponse
            {
                CourseId = c.CourseId,
                CourseType = c.CourseType,
                ShortName = c.ShortName,
                CourseLeaveId = l.CourseLevelId,
                CourseLeaveName = l.LevelCnName
            }).ToList();

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取学生课次费用明细(已排课+未排课)
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-8</para>
        /// </summary>
        /// <param name="leaveTime">休学日期</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>报名课次费用明细</returns>
        /// <exception cref="AMS.Core.BussinessException">无</exception>
        internal List <RefundOrderTransactDetailListResponse> GetCourseLessonList(DateTime leaveTime, string companyId)
        {
            //获取所有的课程信息
            var courseList = CourseService.GetAllAsync().Result;
            //获取所有的学期类型
            var termTypeList = new TermTypeService().GetAll();
            //获取所有的课程级别集合
            var courseLevelList = new CourseLevelService(companyId).GetList().Result;

            var enrollOrderTrade = new EnrollOrderService(this._schoolId);
            //已排课的信息
            var studentTimetableService = new StudentTimetableService(this._schoolId, this._studentId);
            var hasLessonList           = studentTimetableService.GetLeaveSchoolLessonCount(leaveTime); //获取休学课次信息

            var enroOrderList = new List <RefundOrderTransactDetailListResponse>();

            var enroOrderItemList = enrollOrderTrade.GetStudentEnroOrderItem(this._studentId, leaveTime);

            foreach (var item in enroOrderItemList)
            {
                var lessonArray = hasLessonList.FirstOrDefault(x => x.EnrollOrderItemId == item.EnrollOrderItemId);
                var lessonCount = lessonArray?.Count ?? 0;                                                    //休学课次
                //上课课次
                var haveClassLesson = item.ClassTimes - (item.ClassTimes - item.ClassTimesUse) - lessonCount; //上课课次=报名课次-未排课次-休学课次
                var refundNum       = item.PayAmount - (haveClassLesson * (item.TuitionFee + item.MaterialFee));
                var refundAmount    = refundNum > 0 ? refundNum : 0;                                          //退费金额=实收金额-扣除金额  退费金额为负数时等于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       = haveClassLesson * (item.TuitionFee + item.MaterialFee), //扣除费用=上课课次*原课次单价
                    LeaveSchoolLessons = lessonCount,                                            //排课部分休学课次
                    RefundAmount       = refundAmount,                                           ////退费金额=实收金额-扣除金额  退费金额为负数时等于0  没有排课时退费金额=实收金额
                    TuitionFee         = item.TuitionFee,
                    MaterialFee        = item.MaterialFee,
                    DiscountFee        = item.DiscountFee,
                    Status             = item.Status
                };
                enroOrderList.Add(entity);
            }

            return(enroOrderList);
        }
        /// <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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取排课基础数据
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-02-19</para>
        /// </summary>
        /// <param name="classId">班级Id</param>
        /// <remarks>排课基础数据</remarks>
        private CourseBasicData GetCourseBasicData(IEnumerable <long> classId)
        {
            CourseBasicData courseBasicData = new CourseBasicData
            {
                Classs = DefaultClassService.GetClassByClassIdAsync(classId).Result //班级
            };

            //学期
            courseBasicData.Terms = TermService.GetTermByTermId(courseBasicData.Classs.Select(x => x.TermId));

            //所有课程
            courseBasicData.Courses = CourseService.GetAllAsync().Result;

            //所有课程等级
            courseBasicData.CourseLvs = CourseLevelService.GetAll();

            //老师
            courseBasicData.Teachers = TeachService.GetTeachers();

            return(courseBasicData);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取教室查看课表
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-11-06</para>
        /// </summary>
        /// <param name="termId">学期Id</param>
        /// <param name="companyId">公司编号</param>
        /// <returns>教室查看课表数据列表</returns>
        public async Task <List <ClassRoomCourseTimetableResponse> > GetCourseTimetable(long termId, string companyId)
        {
            List <ClassRoomCourseTimetableResponse> res = new List <ClassRoomCourseTimetableResponse>();

            //1.获取教室下有哪些班级
            List <TblDatClass> classes = _classRepository.Value.GetClassByTermIdAsync(termId)
                                         .Result
                                         .Where(x => x.ClassRoomId == _classRoomId)
                                         .ToList();

            //2.获取班级上课时间
            List <TblTimClassTime> classTimes = await _classTimeRepository.Value.GetByClassId(classes.Select(x => x.ClassId));

            //3.获取基础数据
            //3.1 课程
            List <TblDatCourse> courses = CourseService.GetAllAsync().Result;

            //3.2 课程等级
            List <CourseLevelResponse> courseLevels = new CourseLevelService(companyId).GetList().Result;

            //3.3 获取老师
            List <ClassTimetableTeacherResponse> teachers = TeachService.GetTeachers();

            //3.4.获取上课时间段基础数据
            List <TblDatSchoolTime> schoolTimes = new SchoolTimeService(termId).TblDatSchoolTime;

            int maxLength = 0;

            //4.整合数据
            for (int i = 1; i <= 7; i++)
            {
                ClassRoomCourseTimetableResponse classRoom = new ClassRoomCourseTimetableResponse
                {
                    Week       = WeekDayConvert.IntToString(i),
                    ClassTimes = new List <ClassRoomClassTime>()
                };

                var cts = (from a in classTimes                                                 //教室下的班级上课时间段
                           join b in classes on a.ClassId equals b.ClassId                      //教室下的班级
                           join c in schoolTimes on a.SchoolTimeId equals c.SchoolTimeId        //基础数据 学期下所有上课时间段
                           join d in courseLevels on b.CourseLeveId equals d.CourseLevelId      //基础数据 课程等级
                           join e in courses on b.CourseId equals e.CourseId                    //基础数据 课程
                           join f in teachers on b.TeacherId equals f.TeacherId                 //基础数据 老师信息
                           where c.WeekDay == i
                           select new ClassRoomClassTime
                {
                    BeginTime = c.BeginTime,
                    EndTime = c.EndTime,
                    CourseName = e.ShortName,
                    LevelCnName = d.LevelCnName,
                    TeacherName = f.TeacherName
                }).OrderBy(x => x.BeginTime);

                classRoom.ClassTimes.AddRange(cts);

                if (cts.Count() > maxLength)
                {
                    maxLength = cts.Count();
                }

                res.Add(classRoom);
            }

            //补齐
            foreach (var item in res)
            {
                if (item.ClassTimes.Count >= maxLength)
                {
                    continue;
                }

                while (item.ClassTimes.Count < maxLength)
                {
                    item.ClassTimes.Add(new ClassRoomClassTime());
                }
            }

            return(res);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取不同时间段的课表信息
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-09-21</para>
        /// </summary>
        /// <param name="duration">60分钟或90分钟</param>
        /// <returns>课表信息</returns>
        private TermCourseTimetableResponse GetTermCourseTimetable(TimeType duration)
        {
            TermCourseTimetableResponse res = new TermCourseTimetableResponse();

            var schTimeRes = this.GetTimetableSchoolTimeResponse(duration);

            res.SchoolTimes = schTimeRes.TimetableSchoolTimeResponses;        //上课时间表
            res.ClassRooms  = new List <TimetableClassRoomResponse>();        //教室信息

            //审核中所有班级
            var classes = _tblAutClassRepository.Value.GetByAuditId(base.TblAutAudit.AuditId).Result;

            //校区
            var schoolId = TermService.GetTermByTermId(_termId)?.SchoolId;

            //班级上课时间表
            var classTimes = new TblAutClassTimeRepository()
                             .GetBySchoolTimeId(schTimeRes.TblDatSchoolTimes.Select(x => x.SchoolTimeId), base.TblAutAudit.AuditId)
                             .Result;

            //获取老师用户信息
            var teachers = TeachService.GetTeachers();

            //所有的课程
            var courses = CourseService.GetAllAsync().Result;

            //课程等级
            var courseLv = CourseLevelService.GetCourseLevelList().Result;

            //获取校区教室
            var durationClassId = classTimes.Select(x => x.ClassId).ToList();
            SchoolClassRoomService    schoolClassRoomService = new SchoolClassRoomService(schoolId);
            List <RoomCourseResponse> roomCourseResponses    = schoolClassRoomService.RoomCourseList;

            List <long> classRoomIds = classes.Where(x => durationClassId.Contains(x.ClassId)).Select(x => x.ClassRoomId).ToList();

            classRoomIds.AddRange(roomCourseResponses.Where(x => !x.IsDisabled).Select(x => x.ClassRoomId));

            List <TblDatClassRoom> classRooms = schoolClassRoomService
                                                .ClassRoomList
                                                .Where(x => classRoomIds.Contains(x.ClassRoomId))
                                                .OrderBy(o => o.RoomNo, new NaturalStringComparer())
                                                .ToList();

            //渲染教室
            foreach (var classRoom in classRooms)
            {
                TimetableClassRoomResponse ttcrr = new TimetableClassRoomResponse
                {
                    ClassRoomId = classRoom.ClassRoomId,
                    RoomNo      = classRoom.RoomNo,
                    Classes     = new List <TimetableClassResponse>()
                };

                int lessonIndex = 0;

                int weekDay = -1;

                //教室对应的上课时间段的班级
                foreach (var schoolTime in schTimeRes.TblDatSchoolTimes)
                {
                    if (weekDay != schoolTime.WeekDay)
                    {
                        weekDay     = schoolTime.WeekDay;
                        lessonIndex = 0;
                    }

                    lessonIndex++;

                    TimetableClassResponse ttcr = new TimetableClassResponse
                    {
                        SchoolTimeId    = schoolTime.SchoolTimeId,
                        ClassId         = 0,
                        CourseId        = 0,
                        CourseName      = string.Empty,
                        CourseLeveId    = 0,
                        CourseLevelName = string.Empty,
                        TeacherId       = string.Empty,
                        TeacherName     = string.Empty,
                        WeekDay         = schoolTime.WeekDay,
                        LessonIndex     = lessonIndex
                    };

                    var classIds = (from a in classTimes
                                    join b in classes on a.ClassId equals b.ClassId
                                    where a.SchoolTimeId == schoolTime.SchoolTimeId && b.ClassRoomId == classRoom.ClassRoomId
                                    select a.ClassId).ToList();

                    if (classIds.Any())
                    {
                        var classInfo = classes.FirstOrDefault(x => x.ClassId == classIds.First());
                        ttcr.ClassId         = classInfo.ClassId;
                        ttcr.CourseId        = classInfo.CourseId;
                        ttcr.CourseName      = courses.FirstOrDefault(x => x.CourseId == classInfo.CourseId)?.ShortName;
                        ttcr.CourseLeveId    = classInfo.CourseLeveId;
                        ttcr.CourseLevelName = courseLv.FirstOrDefault(x => x.CourseLevelId == classInfo.CourseLeveId)?.LevelCnName;
                        ttcr.TeacherId       = classInfo.TeacherId;
                        ttcr.TeacherName     = teachers.FirstOrDefault(x => x.TeacherId == classInfo.TeacherId)?.TeacherName;
                    }

                    ttcrr.Classes.Add(ttcr);
                }

                res.ClassRooms.Add(ttcrr);
            }

            return(res);
        }