dd
This commit is contained in:
parent
c1a7f8a2ff
commit
61ad29d944
@ -1129,6 +1129,28 @@ namespace VOL.Ai.Services
|
||||
await _classRoomRecordRepository.AddAsync(entity);
|
||||
await _classRoomRecordRepository.SaveChangesAsync();
|
||||
|
||||
var classroomSettingList = new List<Ai_ClassroomSetting>();
|
||||
|
||||
if (entity.Id > 0)
|
||||
{
|
||||
foreach (var item in paramDto.ClassroomSettingList)
|
||||
{
|
||||
classroomSettingList.Add(new Ai_ClassroomSetting()
|
||||
{
|
||||
ClassRoomRecordId = entity.Id,
|
||||
ClassroomStageId = item.ClassroomStageId,
|
||||
Density = item.Density,
|
||||
Duration = item.Duration
|
||||
});
|
||||
}
|
||||
|
||||
if (classroomSettingList.Count > 0)
|
||||
{
|
||||
await _classroomSettingRepository.AddRangeAsync(classroomSettingList);
|
||||
await _classroomSettingRepository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
return new Ai_ClassRoomRecordDto()
|
||||
{
|
||||
ClassRoomRecordId = entity.Id,
|
||||
@ -1429,18 +1451,36 @@ namespace VOL.Ai.Services
|
||||
&& (paramDto.ClassRoomStageId <= 0 || hrd.ClassroomStageId == paramDto.ClassRoomStageId)
|
||||
select hrd;
|
||||
|
||||
|
||||
var heartRateDataList = await query.ToListAsync();
|
||||
|
||||
if (heartRateDataList.Count == 0)
|
||||
return res;
|
||||
|
||||
var classRoom = await _teacherRepository.DbContext.Set<Ai_ClassRoomRecord>().Include(x => x.ClassroomStudentRecord)
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomStageId)
|
||||
.FirstAsync();
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomRecordId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (classRoom == null)
|
||||
{
|
||||
throw new Exception("未找到对应的班级记录");
|
||||
}
|
||||
|
||||
var classroomStageList = await (from s in _classroomSettingRepository.DbContext.Set<Ai_ClassroomSetting>()
|
||||
join t in _classroomStageRepository.DbContext.Set<Ai_ClassroomStage>()
|
||||
on s.ClassroomStageId equals t.Id
|
||||
where s.ClassRoomRecordId == paramDto.ClassRoomRecordId
|
||||
select new ClassroomStageInfoDto
|
||||
{
|
||||
ClassroomStageId = s.ClassroomStageId,
|
||||
ClassroomStageName = t.Name,
|
||||
Duration = s.Duration,
|
||||
Density = s.Density
|
||||
}).ToListAsync();
|
||||
|
||||
res.ClassroomStageList = classroomStageList;
|
||||
|
||||
var classRoomStudent = await _teacherRepository.DbContext.Set<Ai_ClassroomStudentRecord>()
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomStageId)
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.ClassRoomRecordId == paramDto.ClassRoomRecordId)
|
||||
.ToListAsync();
|
||||
|
||||
res.GradeAndClass = $"{classRoom.GradeName}-{classRoom.ClassName}";
|
||||
@ -1499,10 +1539,8 @@ namespace VOL.Ai.Services
|
||||
{
|
||||
var res = new GetStudentClassReportDetailsModel();
|
||||
|
||||
var schoolCode = UserContext.Current.TenantId;
|
||||
|
||||
var query = from hrd in _teacherRepository.DbContext.Set<Ai_HeartRateData>()
|
||||
where hrd.SchoolCode == schoolCode &&
|
||||
where hrd.SchoolCode == paramDto.SchoolCode &&
|
||||
hrd.ClassRoomRecordId == paramDto.ClassRoomRecordId &&
|
||||
hrd.StudentNo == paramDto.StudentNo
|
||||
select hrd;
|
||||
@ -1525,7 +1563,7 @@ namespace VOL.Ai.Services
|
||||
res.Consumption = Math.Abs((int)heartRateDataList.Average(x => x.Consumption ?? 0));
|
||||
|
||||
//var baseTime = heartRateDataList.Min(x => x.ScoreTime);
|
||||
var baseTime = await _teacherRepository.DbContext.Set<Ai_HeartRateData>().Where(x => x.SchoolCode == schoolCode && x.ClassRoomRecordId == paramDto.ClassRoomRecordId).MinAsync(x => x.ScoreTime);
|
||||
var baseTime = await _teacherRepository.DbContext.Set<Ai_HeartRateData>().Where(x => x.SchoolCode == paramDto.SchoolCode && x.ClassRoomRecordId == paramDto.ClassRoomRecordId).MinAsync(x => x.ScoreTime);
|
||||
|
||||
var heartRateWithMinutes = heartRateDataList
|
||||
.Select(data => new
|
||||
|
@ -66,6 +66,11 @@ namespace VOL.Model.Ai.Request
|
||||
/// 课堂记录学生列表
|
||||
/// </summary>
|
||||
public List<ClassroomStudentRecordRequest> ClassroomStudentRecord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 课堂设置列表
|
||||
/// </summary>
|
||||
public List<ClassroomSettingDto> ClassroomSettingList { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -62,6 +65,11 @@ namespace VOL.Model.Ai.Response
|
||||
/// </summary>
|
||||
public string Consumption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 课堂阶段
|
||||
/// </summary>
|
||||
public List<ClassroomStageInfoDto> ClassroomStageList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 学生运动记录
|
||||
/// </summary>
|
||||
@ -77,4 +85,30 @@ namespace VOL.Model.Ai.Response
|
||||
/// </summary>
|
||||
public List<SportsProportionData> HeartRateTrend { get; set; } = new List<SportsProportionData>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 课堂阶段
|
||||
/// </summary>
|
||||
public class ClassroomStageInfoDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 阶段Id
|
||||
/// </summary>
|
||||
public int ClassroomStageId { get; set; }
|
||||
/// <summary>
|
||||
/// 阶段名称
|
||||
/// </summary>
|
||||
public string ClassroomStageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时长
|
||||
/// </summary>x
|
||||
public int Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密度
|
||||
/// </summary>
|
||||
public int Density { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Model.Ai;
|
||||
using VOL.Model.Norm.Response;
|
||||
|
||||
namespace VOL.Model.Training.Response
|
||||
@ -27,7 +28,7 @@ namespace VOL.Model.Training.Response
|
||||
/// <summary>
|
||||
/// 学生课堂记录详情
|
||||
/// </summary>
|
||||
public class GetStudentClassReportDetailsDto
|
||||
public class GetStudentClassReportDetailsDto : Ai_Request
|
||||
{
|
||||
/// <summary>
|
||||
/// 课堂Id
|
||||
|
@ -552,7 +552,7 @@ namespace VOL.WebApi.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取学生心率报告
|
||||
/// 获取跳绳报告
|
||||
/// </summary>
|
||||
[HttpGet(nameof(JumpRopeReport))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
|
Loading…
x
Reference in New Issue
Block a user