/// <summary> /// 描述:审核终审通过 /// <para>作 者:瞿琦</para> /// <para>创建时间:2018.9.19</para> /// </summary> /// <returns>无</returns> public override void ProcessAuditSuccess() { TermService termService = new TermService(this._schoolId, this._year); var query = _tblAutTermRepository.LoadList(x => x.AuditId == this.TblAutAudit.AuditId); //1先删除原来的数据 termService.Remove(); //2增加审核后的数据 var datTermModel = query.Select(x => new TblDatTerm { TermId = x.TermId, TermName = x.TermName, TermTypeId = x.TermTypeId, SchoolId = x.SchoolId, Year = x.Year, BeginDate = x.BeginDate, EndDate = x.EndDate, Classes60 = x.Classes60, Classes90 = x.Classes90, Classes180 = x.Classes180, TuitionFee = x.TuitionFee, MaterialFee = x.MaterialFee, CreateTime = x.CreateTime, UpdateTime = DateTime.Now }).ToList(); termService.ResetTermList(datTermModel); //3同步报名时的学习计划数据 StudyPlanService.AsyncSchoolTermType(this._schoolId).Wait(); }
/// <summary> /// 单个授权 /// <para>作 者: Huang GaoLiang </para> /// <para>创建时间: 2018-10-18</para> /// </summary> /// <param name="courseIds">课程编号集合</param> public async Task SaveAsync(List <long> courseIds) { List <TblDatSchoolCourse> schoolCourseList = SchoolCouseDataConstructe(ref courseIds); // 1、添加之前先删除对应的数据 await _schoolCourseRepository.Value.BatchDeleteBySchoolId(_schoolId); // 2、添加 await _schoolCourseRepository.Value.AddTask(schoolCourseList); // 3、重新授权后,需要重新生成学习计划 await StudyPlanService.AsyncSchoolCourse(_schoolId); }
/// <summary> /// 修改课程 /// <para>作 者:zhiwei.Tang</para> /// <para>创建时间:2018-09-14</para> /// </summary> /// <param name="dto">课程修改的数据</param> /// <exception cref="BussinessException"> /// 异常ID:1,异常描述:课程对象为空 /// </exception> public async Task ModifyAsync(CourseAddRequest dto) { //校验 var oldCourse = await _courseRepository.Value.LoadTaskByCourseId(_companyId, dto.CourseId); if (oldCourse == null) { throw new BussinessException(ModelType.Default, 1); } Validate(dto, dto.CourseId); bool isAsyncCourseName = !dto.ShortName.Equals(oldCourse.ShortName); //准备课程数据 TblDatCourse course = AutoMapper.Mapper.Map <TblDatCourse>(dto); course.CreateTime = oldCourse.CreateTime; course.UpdateTime = DateTime.Now; course.IsDisabled = oldCourse.IsDisabled; course.CourseId = oldCourse.CourseId; //准备课程级别数据 List <TblDatCourseLevelMiddle> courseLevelMiddles = dto.CourseLevels.Select(c => new TblDatCourseLevelMiddle { CourseLevelMiddleId = IdGenerator.NextId(), CourseId = course.CourseId, BeginAge = c.SAge, EndAge = c.EAge, CourseLevelId = c.CourseLevelId, Duration = c.Duration, CreateTime = DateTime.Now, UpdateTime = DateTime.Now, }).ToList(); await _courseRepository.Value.UpdateTask(course); await _courseLevelMiddleRepository.Value.BatchDeleteByCourseId(course.CourseId); await _courseLevelMiddleRepository.Value.AddTask(courseLevelMiddles); //课程简称发生变化,则学习计划同步课程简称 if (isAsyncCourseName) { Dictionary <long, string> keyValues = new Dictionary <long, string>(); keyValues.Add(course.CourseId, course.ShortName); //学习计划同步课程简称 StudyPlanService.AsyncCourseName(keyValues); } }
/// <summary> /// 批量增加授权 /// <para>作 者: Huang GaoLiang </para> /// <para>创建时间: 2018-09-18 </para> /// </summary> /// <param name="dto">校区批量授权课程数据</param> public static async Task BatchSaveAsync(SchoolCourseSaveBatchRequest dto) { var schools = dto.Schools; // 1、获取所有校区编号 foreach (string schoolId in schools) { SchoolCourseAccessService service = new SchoolCourseAccessService(schoolId, dto.CompanyId); // 处理后数据 var course = dto.Course; await service.SaveCoverAsync(course); // 重新授权后,需要重新生成学习计划 await StudyPlanService.AsyncSchoolCourse(schoolId); } }
/// <summary> /// 修改一个课程级别 /// <para>作 者:Huang GaoLiang </para> /// <para>创建时间:2018-09-14 </para> /// </summary> /// <param name="dto">课程等级实体</param> /// <exception cref="BussinessException"> /// 异常ID:11,课程级别编号不能为空 /// </exception> public async Task Modify(CourseLevelAddRequest dto) { if (dto.CourseLevelId <= 0) { throw new BussinessException((byte)ModelType.Datum, 11); } // 1、数据校验 await CourseLeaveVerification(dto); // 2、根据课程级别id查询课程级别信息 TblDatCourseLevel courseLevel = new TblDatCourseLevelRepository().GetCourseLevelById(dto.CompanyId, dto.CourseLevelId); bool isAsyncCourseLevelName = !dto.LevelCnName.Equals(courseLevel.LevelCnName); if (courseLevel != null) { courseLevel.LevelCode = dto.LevelCode; courseLevel.LevelCnName = dto.LevelCnName; courseLevel.LevelEnName = dto.LevelEnName; courseLevel.UpdateTime = DateTime.Now; } // 3、修改数据库数据 await new TblDatCourseLevelRepository().UpdateTask(courseLevel); // 4、级别中文名称发生变化,则同步学习计划级别中文名称 if (isAsyncCourseLevelName) { Dictionary <long, string> keyValues = new Dictionary <long, string>(); keyValues.Add(courseLevel.CourseLevelId, courseLevel.LevelCnName); // 学习计划同步级别中文名称 StudyPlanService.AsyncCourseLevelName(keyValues); } }