update:学校导入成绩

This commit is contained in:
ltx 2026-07-10 17:30:46 +08:00
parent d643daa3b9
commit ec71427e13
3 changed files with 44 additions and 8 deletions

View File

@ -34,6 +34,13 @@ namespace VOL.Business.IServices.SportsHall
/// <returns></returns>
Task SportsHallImportStudentsTestData(IFormFile file);
/// <summary>
/// 导入体测成绩管理学生体测成绩
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
Task SummaryOfGradesImportStudentsTestData(IFormFile file);
/// <summary>
/// 运动馆体测成绩分页列表
/// </summary>

View File

@ -228,6 +228,22 @@ namespace VOL.Business.Services.SportsHall
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task SportsHallImportStudentsTestData(IFormFile file)
{
await ImportStudentsTestData(file, false);
}
/// <summary>
/// 导入体测成绩管理学生体测成绩
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
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<N_SportsTestValue> AddSportsHallEnumStudentsTestData(SportsHallImportStudentsTestDataParam data, SportsTestItemType type, dynamic student, int gradeId, DateTime timeNow)
public async Task<N_SportsTestValue> 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;

View File

@ -68,6 +68,19 @@ namespace VOL.WebApi.Controllers.SportsHall
return Ok("导入成功");
}
/// <summary>
/// 导入体测成绩管理学生体测数据
/// </summary>
/// <param name="file"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
[HttpPost(nameof(SummaryOfGradesImportStudentsTestData))]
public async Task<ActionResult> SummaryOfGradesImportStudentsTestData(IFormFile file)
{
await _sportsHallService.SummaryOfGradesImportStudentsTestData(file);
return Ok("导入成功");
}
/// <summary>
/// 运动馆体测成绩分页列表
/// </summary>