更新成绩
This commit is contained in:
parent
10993a8e04
commit
632036d358
@ -47,5 +47,12 @@ namespace VOL.Business.IServices.SportsHall
|
|||||||
/// <param name="paramDto"></param>
|
/// <param name="paramDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task ScorePush(SportsHallStudentsTestParam paramDto);
|
Task ScorePush(SportsHallStudentsTestParam paramDto);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成绩修正
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task ScoreUpdate(SportsHallStudentsTestDataUpdateParam paramDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -587,5 +587,52 @@ namespace VOL.Business.Services.SportsHall
|
|||||||
await _sportsTestResultRepository.DbContext.Database
|
await _sportsTestResultRepository.DbContext.Database
|
||||||
.ExecuteSqlRawAsync(sql.ToString(), parameters.ToArray());
|
.ExecuteSqlRawAsync(sql.ToString(), parameters.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成绩修成
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task ScoreUpdate(SportsHallStudentsTestDataUpdateParam paramDto)
|
||||||
|
{
|
||||||
|
// 获取该学生每个项目的最新一条记录
|
||||||
|
var list = await _sportsTestResultRepository.DbContext.Set<N_SportsTestValue>()
|
||||||
|
.Where(s => s.SchoolCode == "202506170049" && s.StudentNo == paramDto.StudentNo)
|
||||||
|
.GroupBy(x => x.CategoryValue)
|
||||||
|
.Select(g => g.OrderByDescending(x => x.ScoreTime).FirstOrDefault())
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (list == null || !list.Any())
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var entity in list)
|
||||||
|
{
|
||||||
|
switch (entity.CategoryValue)
|
||||||
|
{
|
||||||
|
case (int)SportsTestItemType.BMI:
|
||||||
|
entity.Value = paramDto.BMIValue;
|
||||||
|
break;
|
||||||
|
case (int)SportsTestItemType.VitalCapacity:
|
||||||
|
entity.Value = paramDto.VitalCapacityValue;
|
||||||
|
break;
|
||||||
|
case (int)SportsTestItemType.Sit_And_Reach:
|
||||||
|
entity.Value = paramDto.Sit_And_ReachValue;
|
||||||
|
break;
|
||||||
|
case (int)SportsTestItemType.OneMinuteJumpRope:
|
||||||
|
entity.Value = paramDto.OneMinuteJumpRopeValue;
|
||||||
|
break;
|
||||||
|
case (int)SportsTestItemType.One_Minute_Sit_Up:
|
||||||
|
entity.Value = paramDto.One_Minute_Sit_UpValue;
|
||||||
|
break;
|
||||||
|
case (int)SportsTestItemType.StandingLongJump:
|
||||||
|
entity.Value = paramDto.StandingLongJumpValue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_sportsTestResultRepository.UpdateRange(list);
|
||||||
|
|
||||||
|
await _sportsTestResultRepository.DbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VOL.Model.School.Request
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 运动馆体测成绩修正
|
||||||
|
/// </summary>
|
||||||
|
public class SportsHallStudentsTestDataUpdateParam
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///学号
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "学号")]
|
||||||
|
public string StudentNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 体重指数(BMI)
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "BMI")]
|
||||||
|
public float BMIValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 肺活量
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "肺活量")]
|
||||||
|
public float VitalCapacityValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 坐位体前屈
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "坐位体前屈")]
|
||||||
|
public float Sit_And_ReachValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1分钟跳绳
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "一分钟跳绳")]
|
||||||
|
public int OneMinuteJumpRopeValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 1分钟仰卧起坐(女)
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "一分钟仰卧起坐")]
|
||||||
|
public int One_Minute_Sit_UpValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 立定跳远
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "立定跳远")]
|
||||||
|
public float StandingLongJumpValue { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -91,5 +91,16 @@ namespace VOL.WebApi.Controllers.SportsHall
|
|||||||
return Ok("推送成功");
|
return Ok("推送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成绩修正
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost(nameof(ScoreUpdate))]
|
||||||
|
public async Task<ActionResult> ScoreUpdate([FromBody] SportsHallStudentsTestDataUpdateParam paramDto)
|
||||||
|
{
|
||||||
|
await _sportsHallService.ScoreUpdate(paramDto);
|
||||||
|
return Ok("更新成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user