diff --git a/VOL.Business/IServices/SportsHall/ISportsHallService.cs b/VOL.Business/IServices/SportsHall/ISportsHallService.cs index 0f16717..288da11 100644 --- a/VOL.Business/IServices/SportsHall/ISportsHallService.cs +++ b/VOL.Business/IServices/SportsHall/ISportsHallService.cs @@ -34,6 +34,13 @@ namespace VOL.Business.IServices.SportsHall /// Task SportsHallImportStudentsTestData(IFormFile file); + /// + /// 导入体测成绩管理学生体测成绩 + /// + /// + /// + Task SummaryOfGradesImportStudentsTestData(IFormFile file); + /// /// 运动馆体测成绩分页列表 /// diff --git a/VOL.Business/Services/SportsHall/SportsHallService.cs b/VOL.Business/Services/SportsHall/SportsHallService.cs index d167dc5..d238dc5 100644 --- a/VOL.Business/Services/SportsHall/SportsHallService.cs +++ b/VOL.Business/Services/SportsHall/SportsHallService.cs @@ -228,6 +228,22 @@ namespace VOL.Business.Services.SportsHall /// /// public async Task SportsHallImportStudentsTestData(IFormFile file) + { + await ImportStudentsTestData(file, false); + } + + /// + /// 导入体测成绩管理学生体测成绩 + /// + /// + /// + /// + public async Task SummaryOfGradesImportStudentsTestData(IFormFile file) + { + await ImportStudentsTestData(file, true); + } + + private async Task ImportStudentsTestData(IFormFile file, bool isDisplay) { if (file == null || file.Length <= 0) throw new Exception("操作失败"); @@ -275,22 +291,22 @@ namespace VOL.Business.Services.SportsHall // 为每个学生添加多条体测数据 if (data.BMIValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.BMI, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.BMI, student, data.GradeId, timeNow, isDisplay)); //if (data.Sit_And_ReachValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.Sit_And_Reach, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.Sit_And_Reach, student, data.GradeId, timeNow, isDisplay)); if (data.VitalCapacityValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.VitalCapacity, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.VitalCapacity, student, data.GradeId, timeNow, isDisplay)); if (data.OneMinuteJumpRopeValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.OneMinuteJumpRope, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.OneMinuteJumpRope, student, data.GradeId, timeNow, isDisplay)); if (data.One_Minute_Sit_UpValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.One_Minute_Sit_Up, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.One_Minute_Sit_Up, student, data.GradeId, timeNow, isDisplay)); if (data.StandingLongJumpValue > 0) - entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.StandingLongJump, student, data.GradeId, timeNow)); + entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.StandingLongJump, student, data.GradeId, timeNow, isDisplay)); } // 批量添加数据 @@ -300,7 +316,7 @@ namespace VOL.Business.Services.SportsHall await _sportsTestResultRepository.SaveChangesAsync(); } - public async Task AddSportsHallEnumStudentsTestData(SportsHallImportStudentsTestDataParam data, SportsTestItemType type, dynamic student, int gradeId, DateTime timeNow) + public async Task AddSportsHallEnumStudentsTestData(SportsHallImportStudentsTestDataParam data, SportsTestItemType type, dynamic student, int gradeId, DateTime timeNow, bool isDisplay = false) { var entity = new N_SportsTestValue { @@ -318,7 +334,7 @@ namespace VOL.Business.Services.SportsHall StudentName = student.StudentName, Creator = UserContext.Current.UserId, CreateDate = timeNow, - IsDisplay = false + IsDisplay = isDisplay }; SexType sexType = student.Sex; diff --git a/VOL.WebApi/Controllers/SportsHall/SportsHallController.cs b/VOL.WebApi/Controllers/SportsHall/SportsHallController.cs index 47b38fe..201697d 100644 --- a/VOL.WebApi/Controllers/SportsHall/SportsHallController.cs +++ b/VOL.WebApi/Controllers/SportsHall/SportsHallController.cs @@ -68,6 +68,19 @@ namespace VOL.WebApi.Controllers.SportsHall return Ok("导入成功"); } + /// + /// 导入体测成绩管理学生体测数据 + /// + /// + /// + /// + [HttpPost(nameof(SummaryOfGradesImportStudentsTestData))] + public async Task SummaryOfGradesImportStudentsTestData(IFormFile file) + { + await _sportsHallService.SummaryOfGradesImportStudentsTestData(file); + return Ok("导入成功"); + } + /// /// 运动馆体测成绩分页列表 ///