/// <summary>
        /// 描述:查询出转班时需要销毁的课次
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <returns>要销毁的课次集合</returns>
        public List <LessonFinisherInfo> GetLessonFinisherInfo()
        {
            //根据转出班级ID,查询出要销毁的课次
            var service = new StudentTimetableService(base._entity.SchoolId, base._entity.StudentId);

            //var outLessonNum = service.GetRollOutClassLessons(base._entity.OutClassId, base._entity.OutDate, base._unitOfWork);

            List <int> lessonTypeList = new List <int> {
                (int)LessonType.RegularCourse
            };

            //获取学生转出班级课次列表
            var stuTransferOutClassLessonList =
                service.GetStudentTransferOutClassLessonList(base._entity.OutClassId,
                                                             base._entity.OutDate, lessonTypeList, base._unitOfWork);

            var outLessonNumEntity = stuTransferOutClassLessonList.FirstOrDefault();

            if (outLessonNumEntity != null)
            {
                this.EnrollOrderItemId = outLessonNumEntity.EnrollOrderItemId;
            }

            var result = stuTransferOutClassLessonList.Select(x => new LessonFinisherInfo
            {
                LessonId     = x.LessonId,
                BusinessId   = base._entity.ChangeClassId,
                BusinessType = BusinessType,
                Remark       = LessonProcessConstants.ChangeClassLessonReamrk
            }).ToList();

            return(result);
        }
Example #2
0
        /// <summary>
        /// 描述: 获取可转班的学期和班级数据
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <returns>可转班的学期和班级列表</returns>
        public List <StudentTermResponse> GetChangeClassTermClass()
        {
            var service = new StudentTimetableService(this._schoolId, this._studentId);
            var result  = service.GetStudentClass();

            return(result);
        }
        public PageResult <StudentAttendanceLessonSkResponse> GetStudentAttendanceLessonList(
            long studentId, int pageIndex, int pageSize)
        {
            var service = new StudentTimetableService(base.SchoolId, studentId);

            return(service.GetStudentAttendanceLessonList(base.CurrentUser.UserId, pageIndex, pageSize));
        }
Example #4
0
        /// <summary>
        /// 描述:获取转出的课次
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <param name="outClassId">转出班级</param>
        /// <param name="outDate">停课日期</param>
        /// <returns>可以转出的课次</returns>

        public int GetChangeOutClassCount(long outClassId, DateTime outDate)
        {
            var        service        = new StudentTimetableService(this._schoolId, this._studentId);
            List <int> lessonTypeList = new List <int> {
                (int)LessonType.RegularCourse
            };
            var outLessonNum = service.GetStudentTransferOutClassLessonCount(outClassId, outDate, lessonTypeList);

            return(outLessonNum);
        }
Example #5
0
        /// <summary>
        /// 获取家长的学生
        /// <para>作    者:蔡亚康</para>
        /// <para>创建时间:2019-03-08</para>
        /// </summary>
        /// <returns>学生信息集合</returns>
        public List <StudentsResponse> GetStudents()
        {
            List <StudentsResponse> result = new List <StudentsResponse>();

            //1、获取家长的学生信息
            List <TblCstStudent> students = StudentService.GetStudentList(this._userCode)
                                            .Distinct()
                                            .ToList();
            List <long> studentIds = students.Select(t => t.StudentId).ToList();


            //2、取学生对应的校区
            List <TblCstSchoolStudent> schoolStudents = StudentService.GetStudentSchoolList(studentIds);

            //3、获取校区信息
            OrgService            orgService = new OrgService();
            List <SchoolResponse> allSchools = orgService.GetAllSchoolList();

            //4、按学生最近要上的课程进行排序
            List <ViewCompleteStudentAttendance> studentAttendance = StudentTimetableService.GetStudentAttendLately(studentIds);

            //5、整合学生的数据到输出结果
            students.ForEach(item =>
            {
                StudentsResponse resultItem = new StudentsResponse()
                {
                    HeadFaceUrl = item.HeadFaceUrl,
                    StudentId   = item.StudentId,
                    StudentName = item.StudentName,
                };
                resultItem.SchoolList = new List <StudentSchoolListResponse>();
                var query             = from ss in schoolStudents
                                        join school in allSchools on ss.SchoolId equals school.SchoolId
                                        where ss.StudentId == item.StudentId
                                        select new StudentSchoolListResponse()
                {
                    CompanyId       = school.CompanyId,
                    CompanyName     = school.Company,
                    SchoolId        = school.SchoolId,
                    SchoolName      = school.SchoolName,
                    ServerDateTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    ClassLatelyTime = this.GetClassLatelyTime(school.SchoolId, item.StudentId, studentAttendance)
                };
                resultItem.SchoolList = query.ToList();
                result.Add(resultItem);
            });

            //6、按最近上课时间排序
            result = result.Where(t => t.SchoolList.Count > 0).OrderBy(t => t.SchoolList.OrderBy(x => x.ClassLatelyTime, new EmptyStringsAreLast())
                                                                       .FirstOrDefault()
                                                                       .ClassLatelyTime, new EmptyStringsAreLast())
                     .ToList();
            return(result);
        }
Example #6
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);
        }
Example #7
0
        /// <summary>
        /// 描述:获取退费要销毁的课次
        /// <para>作   者:瞿琦</para>
        /// <para>创建时间:2018-11-9</para>
        /// </summary>
        /// <returns>要销毁的课次信息集合</returns>
        public List <LessonFinisherInfo> GetLessonFinisherInfo()
        {
            //传入学生Id和休学日期,获取要销毁的课次Id
            var service   = new StudentTimetableService(this._tblOdrRefundOrder.SchoolId, this._tblOdrRefundOrder.StudentId);
            var leaveList = service.GetLeaveSchoolLessonsList(_tblOdrLeaveClassOrder.StopClassDate, _unitOfWork).Where(x => _refundEnllorCourseId.Contains(x.EnrollOrderItemId));
            var result    = leaveList.Select(x => new LessonFinisherInfo
            {
                LessonId     = x.LessonId,
                BusinessId   = this._tblOdrRefundOrder.RefundOrderId,
                BusinessType = (int)ProcessBusinessType.F_Refund,
                Remark       = LessonProcessConstants.LeaveClassLessonRemark
            }).ToList();

            return(result);
        }
        /// <summary>
        /// 描述:获取要销毁的课次列表
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <returns>要销毁的课次Id集合</returns>
        /// <returns>无</returns>
        /// <exception cref="AMS.Core.BussinessException">无</exception>
        public List <LessonFinisherInfo> GetLessonFinisherInfo()
        {
            //传入学生Id和休学日期,获取要销毁的课次Id
            var service   = new StudentTimetableService(this._tblOdrRefundOrder.SchoolId, this._tblOdrRefundOrder.StudentId);
            var leaveList = service.GetLeaveSchoolLessonsList(_tblOdrLeaveSchoolOrder.LeaveTime, _unitOfWork);
            var result    = leaveList.Select(x => new LessonFinisherInfo
            {
                LessonId     = x.LessonId,
                BusinessId   = this._tblOdrRefundOrder.RefundOrderId,
                BusinessType = (int)ProcessBusinessType.F_LeaveSchool,   //没有枚举类型
                Remark       = LessonProcessConstants.LeaveSchoolRemark,
            }).ToList();

            return(result);
        }
Example #9
0
        /// <summary>
        /// 描述:添加转班记录
        /// <para>作    者:瞿琦</para>
        /// <para>创建时间:2018-11-7</para>
        /// </summary>
        /// <param name="dto">要添加的状态信息</param>
        /// <param name="outClassTimes">转出课次</param>
        /// <param name="unitOfWork">工作单元事务</param>
        /// <exception cref="AMS.Core.BussinessException">
        /// 异常Id:40,异常描述:找不到该报名订单课程
        /// </exception>
        /// <returns>转班信息</returns>
        private TblTimChangeClass AddTimChangeClass(ChangeClassAddRequest dto, int outClassTimes, UnitOfWork unitOfWork)
        {
            //所属报名订单课程Id
            long       enrollOrderItemId = 0;
            var        service           = new StudentTimetableService(this._schoolId, this._studentId);
            List <int> lessonTypeList    = new List <int> {
                (int)LessonType.RegularCourse
            };
            //获取转出班级课次信息
            var outClassLessonList = service.GetStudentTransferOutClassLessonList(dto.OutClassId, dto.OutDate, lessonTypeList, unitOfWork);

            if (outClassLessonList.FirstOrDefault() != null)  //如果转出班级课次信息不为空,则找到报名订单Id,否则抛出异常
            {
                enrollOrderItemId = outClassLessonList.FirstOrDefault().EnrollOrderItemId;
            }
            else
            {
                throw new BussinessException((byte)ModelType.Timetable, 40);
            }

            var entity = new TblTimChangeClass
            {
                ChangeClassId     = IdGenerator.NextId(),
                SchoolId          = _schoolId,
                StudentId         = _studentId,
                EnrollOrderItemId = enrollOrderItemId,
                OutClassId        = dto.OutClassId,
                InClassId         = dto.InClassId,
                InDate            = dto.InDate,
                OutDate           = dto.OutDate,
                ClassTimes        = outClassTimes,
                Remark            = dto.Remark,
                CreateTime        = DateTime.Now
            };
            var tblTimChangeClassRepository = unitOfWork.GetCustomRepository <TblTimChangeClassRepository, TblTimChangeClass>();

            tblTimChangeClassRepository.Add(entity);
            return(entity);
        }
Example #10
0
        /// <summary>
        /// 描述:撤销排课
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-11</para>
        /// </summary>
        /// <param name="iRequest">撤销排课请求参数</param>
        /// <exception>
        /// 异常ID:1,未找到数据
        /// 异常ID:46,该课程已考勤,不能撤销!
        /// </exception>
        public override void Adjust(IAdjustLessonRequest iRequest)
        {
            AdjustRevokeRequest request = iRequest as AdjustRevokeRequest;

            lock (LocalThreadLock.GetLockKeyName(LockKeyNames.LOCK_AMSSCHOOLSTUDENT, this._schoolId, request.StudentId.ToString()))
            {
                LessonFinisherInfo info = new LessonFinisherInfo();

                // 根据课次编号获取学生课次信息
                var timLessonStudent = new StudentTimetableService(this._schoolId, request.StudentId).GetStudentTimLessonByLessId(request.LessonId);
                if (timLessonStudent == null)
                {
                    throw new BussinessException(ModelType.Default, 1);
                }

                // 如果考勤状态是已考勤或者是已补签
                if (timLessonStudent.AttendStatus == (int)AttendStatus.Normal || timLessonStudent.AdjustType == (int)AdjustType.SUPPLEMENTCONFIRMED)
                {
                    throw new BussinessException(ModelType.Timetable, 46);
                }

                // 根据课次编号获取学生排课记录信息
                TblTimLesson       timLesson       = new StudentTimetableService(this._schoolId, request.StudentId).GetTimLessonById(request.LessonId);
                TblTimAdjustLesson timAdjustLesson = new TblTimAdjustLesson
                {
                    AdjustLessonId = IdGenerator.NextId(),
                    SchoolId       = this._schoolId,
                    BatchNo        = IdGenerator.NextId(),
                    FromLessonId   = timLesson.LessonId,
                    FromTeacherId  = timLesson.TeacherId,
                    ToTeacherId    = "",
                    StudentId      = request.StudentId,
                    ClassRoomId    = timLesson.ClassRoomId,
                    ClassId        = timLesson.ClassId,
                    SchoolTimeId   = 0,
                    ClassDate      = timLesson.ClassDate,
                    ClassBeginTime = timLesson.ClassBeginTime,
                    ClassEndTime   = timLesson.ClassEndTime,
                    BusinessType   = (int)LessonBusinessType.CancelMakeLess,
                    Remark         = LessonProcessConstants.Remark,
                    Status         = (int)TimAdjustLessonStatus.Invalid,
                    CreateTime     = DateTime.Now,
                };

                using (var unitOfWork = new UnitOfWork())
                {
                    try
                    {
                        unitOfWork.BeginTransaction();

                        // 1、写入调整课次业务表
                        unitOfWork.GetCustomRepository <TblTimAdjustLessonRepository, TblTimAdjustLesson>().Add(timAdjustLesson);

                        // 2、调用课次服务
                        var           adjustLessonRevokeFinisher = new AdjustLessonRevokeFinisher(this._schoolId, request.StudentId, request.LessonId, unitOfWork);
                        LessonService lessonService = new LessonService(unitOfWork);
                        lessonService.Finish(adjustLessonRevokeFinisher);

                        unitOfWork.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.RollbackTransaction();
                        throw ex;
                    }
                }
            }
        }
 public void ConfirmReplenishLesson(string replenishCode)
 {
     StudentTimetableService.ConfirmReplenishLesson(replenishCode);
 }
        public void ReplenishLesson(AdjustReplenishRequest request)
        {
            var service = new StudentTimetableService(base.SchoolId, request.StudentId);

            service.ReplenishLesson(request);
        }
        public void ChangeLesson(AdjustChangeRequest request)
        {
            var service = new StudentTimetableService(base.SchoolId, request.StudentId);

            service.ChangeLesson(request);
        }