dd
This commit is contained in:
parent
21d4c27fbf
commit
c1a7f8a2ff
@ -261,7 +261,7 @@ namespace VOL.Ai.IServices
|
||||
/// <summary>
|
||||
/// 获取课堂跳绳报告
|
||||
/// </summary>
|
||||
Task<Ai_JumpRopeReportDto> JumpRopeReport(HeartRateReportRequest paramDto);
|
||||
Task<List<Ai_JumpRopeReportDto>> JumpRopeReport(HeartRateReportRequest paramDto);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
|
||||
using System.Collections.Concurrent;
|
||||
using VOL.Core.Services;
|
||||
using VOL.Model.Training.Response;
|
||||
using VOL.Model.Norm.Response;
|
||||
|
||||
namespace VOL.Ai.Services
|
||||
{
|
||||
@ -1421,23 +1422,25 @@ namespace VOL.Ai.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Ai_HeartRateReportDto> HeartRateReport(HeartRateReportRequest paramDto)
|
||||
{
|
||||
var res = new GetClassReportDetailsModel();
|
||||
var res = new Ai_HeartRateReportDto();
|
||||
|
||||
var query = from hrd in _teacherRepository.DbContext.Set<Ai_HeartRateData>()
|
||||
where hrd.ClassRoomRecordId == paramDto.ClassRoomRecordId && hrd.
|
||||
where hrd.ClassRoomRecordId == paramDto.ClassRoomRecordId
|
||||
&& (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 == UserContext.Current.TenantId && x.Id == id)
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomStageId)
|
||||
.FirstAsync();
|
||||
|
||||
var classRoomStudent = await _teacherRepository.DbContext.Set<Ai_ClassroomStudentRecord>()
|
||||
.Where(x => x.SchoolCode == UserContext.Current.TenantId && x.ClassRoomRecordId == id)
|
||||
.Where(x => x.SchoolCode == paramDto.SchoolCode && x.Id == paramDto.ClassRoomStageId)
|
||||
.ToListAsync();
|
||||
|
||||
res.GradeAndClass = $"{classRoom.GradeName}-{classRoom.ClassName}";
|
||||
@ -1450,7 +1453,7 @@ namespace VOL.Ai.Services
|
||||
res.Consumption = $"{Math.Abs(heartRateDataList.Sum(x => x.Consumption ?? 0) / heartRateDataList.Count)} 千卡";
|
||||
//res.Density = $"{(int)(heartRateDataList.Where(x => x.Strength > 50).Sum(x => x.Strength) / heartRateDataList.Count)} %";
|
||||
|
||||
res.Density = $"{(int)CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||
res.Density = $"{(int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||
res.HighIntensity = $"{heartRateDataList.Where(x => x.Strength > 50).GroupBy(x => x.StudentNo).Count()} 人";
|
||||
|
||||
var studentTrainingRecordList = classRoom.ClassroomStudentRecord.ToList();
|
||||
@ -1472,7 +1475,7 @@ namespace VOL.Ai.Services
|
||||
student.StudentName = studentTrainingData[0].StudentName;
|
||||
|
||||
student.AvgHR = (int)(studentTrainingData.Sum(x => x.Value) / studentTrainingData.Count);
|
||||
student.Density = (int)CalculatePercentage(studentTrainingData.Count(x => x.Strength > 50), studentTrainingData.Count);
|
||||
student.Density = (int)Tool.CalculatePercentage(studentTrainingData.Count(x => x.Strength > 50), studentTrainingData.Count);
|
||||
student.Strength = (int)studentTrainingData.Average(x => x.Strength);
|
||||
student.Consumption = Math.Abs((int)studentTrainingData.Average(x => x.Consumption ?? 0));
|
||||
|
||||
@ -1480,29 +1483,123 @@ namespace VOL.Ai.Services
|
||||
}
|
||||
}
|
||||
|
||||
res.HeartRateNumber = GetHeartRateNumber(heartRateDataList);
|
||||
res.HeartRateTrend = GetHeartRateTrend(heartRateDataList);
|
||||
res.HeartRateNumber = Tool.GetHeartRateNumber(heartRateDataList);
|
||||
res.HeartRateTrend = Tool.GetHeartRateTrend(heartRateDataList);
|
||||
res.StudentTrainingRecordList = studentList;
|
||||
|
||||
//return new GetClassReportDetailsModel()
|
||||
//{
|
||||
// HeartRateNumber = GetHeartRateNumber(heartRateDataList),
|
||||
// HeartRateTrend = GetHeartRateTrend(heartRateDataList),
|
||||
// HeartRateIntensityNumber = GetHeartRateIntensityNumber(heartRateDataList),
|
||||
// TimeIntervalHeartRateIntensityNumber = GetTimeIntervalHeartRateIntensityNumber(heartRateDataList)
|
||||
//};
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public Task<GetStudentClassReportDetailsModel> StudentHeartRateReport(GetStudentClassReportDetailsDto paramDto)
|
||||
/// <summary>
|
||||
/// 获取学生心率报告
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<GetStudentClassReportDetailsModel> StudentHeartRateReport(GetStudentClassReportDetailsDto paramDto)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var res = new GetStudentClassReportDetailsModel();
|
||||
|
||||
var schoolCode = UserContext.Current.TenantId;
|
||||
|
||||
var query = from hrd in _teacherRepository.DbContext.Set<Ai_HeartRateData>()
|
||||
where hrd.SchoolCode == schoolCode &&
|
||||
hrd.ClassRoomRecordId == paramDto.ClassRoomRecordId &&
|
||||
hrd.StudentNo == paramDto.StudentNo
|
||||
select hrd;
|
||||
|
||||
var heartRateDataList = await query.ToListAsync();
|
||||
|
||||
if (heartRateDataList.Count == 0)
|
||||
return res;
|
||||
|
||||
var student = heartRateDataList[0];
|
||||
|
||||
res.StudentNo = student.StudentNo;
|
||||
res.StudentName = student.StudentName;
|
||||
res.Sex = student.Sex;
|
||||
res.GradeAndClass = $"{student.GradeName}-{student.ClassName}";
|
||||
|
||||
res.AvgHR = (int)(heartRateDataList.Sum(x => x.Value) / heartRateDataList.Count);
|
||||
res.Density = (int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count);
|
||||
res.Strength = (int)heartRateDataList.Average(x => x.Strength);
|
||||
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 heartRateWithMinutes = heartRateDataList
|
||||
.Select(data => new
|
||||
{
|
||||
Data = data,
|
||||
MinuteBucket = (int)(data.ScoreTime - baseTime).TotalMinutes
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var maxMinute = heartRateWithMinutes.Max(x => x.MinuteBucket);
|
||||
|
||||
for (int minute = 0; minute <= maxMinute; minute++)
|
||||
{
|
||||
var minuteData = heartRateWithMinutes
|
||||
.Where(x => x.MinuteBucket == minute)
|
||||
.Select(x => x.Data)
|
||||
.ToList();
|
||||
|
||||
if (minuteData.Any())
|
||||
{
|
||||
res.HeartRateTrend.Add(new SportsProportionData()
|
||||
{
|
||||
Name = $"{minute + 1} 分钟",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData {
|
||||
Title = "心率",
|
||||
Value = (int)minuteData.Average(x => x.Value)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Task<Ai_JumpRopeReportDto> JumpRopeReport(HeartRateReportRequest paramDto)
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 跳绳报告
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<Ai_JumpRopeReportDto>> JumpRopeReport(HeartRateReportRequest paramDto)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var rawData = await _fastJumpRopeDataRepository
|
||||
.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.ClassRoomRecordId == paramDto.ClassRoomRecordId)
|
||||
.ToListAsync();
|
||||
|
||||
var result = rawData
|
||||
.GroupBy(x => x.GroupId)
|
||||
.Select(group =>
|
||||
{
|
||||
var rankedStudents = group
|
||||
.OrderByDescending(x => x.JumpValue ?? 0)
|
||||
.Select((x, index) => new Ai_StudentJumpRopeReportListDto
|
||||
{
|
||||
StudentNo = x.StudentNo,
|
||||
StudentName = x.StudentName,
|
||||
Ranking = x.Rank ?? 0,
|
||||
JumpValue = x.JumpValue
|
||||
}).ToList();
|
||||
|
||||
return new Ai_JumpRopeReportDto
|
||||
{
|
||||
ModelType = (int)group.First().ModeType,
|
||||
ModelName = group.First().ModelName,
|
||||
MotionDuration = group.First().MotionDuration ?? 0,
|
||||
StudentCount = rankedStudents.Count,
|
||||
StudentList = rankedStudents
|
||||
};
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -2066,7 +2066,7 @@ namespace VOL.Business.Services.Training
|
||||
res.Consumption = $"{Math.Abs(heartRateDataList.Sum(x => x.Consumption ?? 0) / heartRateDataList.Count)} 千卡";
|
||||
//res.Density = $"{(int)(heartRateDataList.Where(x => x.Strength > 50).Sum(x => x.Strength) / heartRateDataList.Count)} %";
|
||||
|
||||
res.Density = $"{(int)CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||
res.Density = $"{(int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count)} %";
|
||||
res.HighIntensity = $"{heartRateDataList.Where(x => x.Strength > 50).GroupBy(x => x.StudentNo).Count()} 人";
|
||||
|
||||
var studentTrainingRecordList = classRoom.ClassroomStudentRecord.ToList();
|
||||
@ -2088,7 +2088,7 @@ namespace VOL.Business.Services.Training
|
||||
student.StudentName = studentTrainingData[0].StudentName;
|
||||
|
||||
student.AvgHR = (int)(studentTrainingData.Sum(x => x.Value) / studentTrainingData.Count);
|
||||
student.Density = (int)CalculatePercentage(studentTrainingData.Count(x => x.Strength > 50), studentTrainingData.Count);
|
||||
student.Density = (int)Tool.CalculatePercentage(studentTrainingData.Count(x => x.Strength > 50), studentTrainingData.Count);
|
||||
student.Strength = (int)studentTrainingData.Average(x => x.Strength);
|
||||
student.Consumption = Math.Abs((int)studentTrainingData.Average(x => x.Consumption ?? 0));
|
||||
|
||||
@ -2096,8 +2096,8 @@ namespace VOL.Business.Services.Training
|
||||
}
|
||||
}
|
||||
|
||||
res.HeartRateNumber = GetHeartRateNumber(heartRateDataList);
|
||||
res.HeartRateTrend = GetHeartRateTrend(heartRateDataList);
|
||||
res.HeartRateNumber = Tool.GetHeartRateNumber(heartRateDataList);
|
||||
res.HeartRateTrend = Tool.GetHeartRateTrend(heartRateDataList);
|
||||
res.StudentTrainingRecordList = studentList;
|
||||
|
||||
//return new GetClassReportDetailsModel()
|
||||
@ -2141,7 +2141,7 @@ namespace VOL.Business.Services.Training
|
||||
res.GradeAndClass = $"{student.GradeName}-{student.ClassName}";
|
||||
|
||||
res.AvgHR = (int)(heartRateDataList.Sum(x => x.Value) / heartRateDataList.Count);
|
||||
res.Density = (int)CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count);
|
||||
res.Density = (int)Tool.CalculatePercentage(heartRateDataList.Count(x => x.Strength > 50), heartRateDataList.Count);
|
||||
res.Strength = (int)heartRateDataList.Average(x => x.Strength);
|
||||
res.Consumption = Math.Abs((int)heartRateDataList.Average(x => x.Consumption ?? 0));
|
||||
|
||||
@ -2184,113 +2184,6 @@ namespace VOL.Business.Services.Training
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 心率个数
|
||||
/// </summary>
|
||||
/// <param name="heartRateDataList"></param>
|
||||
/// <returns></returns>
|
||||
public List<SportsProportionData> GetHeartRateNumber(List<Ai_HeartRateData> heartRateDataList)
|
||||
{
|
||||
var result = new List<SportsProportionData>();
|
||||
|
||||
var maleData = heartRateDataList.Where(x => x.Sex == SexType.Male).ToList();
|
||||
var femaleData = heartRateDataList.Where(x => x.Sex == SexType.Female).ToList();
|
||||
|
||||
var m_avg = maleData.Any() ? (int)maleData.Average(x => x.Value) : 0;
|
||||
var f_avg = femaleData.Any() ? (int)femaleData.Average(x => x.Value) : 0;
|
||||
|
||||
var avgData = new SportsProportionData
|
||||
{
|
||||
Name = "平均",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_avg },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_avg }
|
||||
}
|
||||
};
|
||||
|
||||
var m_max = maleData.Any() ? maleData.Max(x => x.Value) : 0;
|
||||
var f_max = femaleData.Any() ? femaleData.Max(x => x.Value) : 0;
|
||||
|
||||
var maxData = new SportsProportionData
|
||||
{
|
||||
Name = "最高",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_max },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_max }
|
||||
}
|
||||
};
|
||||
|
||||
var m_min = maleData.Any() ? maleData.Min(x => x.Value) : 0;
|
||||
var f_min = femaleData.Any() ? femaleData.Min(x => x.Value) : 0;
|
||||
|
||||
var minData = new SportsProportionData
|
||||
{
|
||||
Name = "最低",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_min },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_min }
|
||||
}
|
||||
};
|
||||
|
||||
result.Add(avgData);
|
||||
result.Add(minData);
|
||||
result.Add(maxData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 心率变化趋势
|
||||
/// </summary>
|
||||
/// <param name="heartRateDataList"></param>
|
||||
/// <returns></returns>
|
||||
public List<SportsProportionData> GetHeartRateTrend(List<Ai_HeartRateData> heartRateDataList)
|
||||
{
|
||||
var result = new List<SportsProportionData>();
|
||||
|
||||
if (heartRateDataList == null || !heartRateDataList.Any())
|
||||
return result;
|
||||
|
||||
var baseTime = heartRateDataList.Min(x => x.ScoreTime);
|
||||
|
||||
var heartRateWithMinutes = heartRateDataList
|
||||
.Select(data => new
|
||||
{
|
||||
Data = data,
|
||||
MinuteBucket = (int)(data.ScoreTime - baseTime).TotalMinutes
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var maxMinute = heartRateWithMinutes.Max(x => x.MinuteBucket);
|
||||
|
||||
for (int minute = 0; minute <= maxMinute; minute++)
|
||||
{
|
||||
var minuteData = heartRateWithMinutes
|
||||
.Where(x => x.MinuteBucket == minute)
|
||||
.Select(x => x.Data)
|
||||
.ToList();
|
||||
|
||||
if (minuteData.Any())
|
||||
{
|
||||
result.Add(new SportsProportionData()
|
||||
{
|
||||
Name = $"{minute + 1} 分钟", // Adding 1 to make it 1-based instead of 0-based
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData {
|
||||
Title = "心率",
|
||||
Value = (int)minuteData.Average(x => x.Value)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 心率各强度达成人数
|
||||
@ -2422,18 +2315,6 @@ namespace VOL.Business.Services.Training
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用百分比计算方法
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="totalCount"></param>
|
||||
/// <returns></returns>
|
||||
private double CalculatePercentage(int count, int totalCount)
|
||||
{
|
||||
if (totalCount == 0) return 0;
|
||||
return Math.Round((double)count / totalCount * 100, 0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 用户训练数据
|
||||
|
@ -14,7 +14,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Core.Extensions;
|
||||
using VOL.Core.Services;
|
||||
using VOL.Entity.DomainModels;
|
||||
using VOL.Entity.Enum;
|
||||
using VOL.Model.Norm.Response;
|
||||
|
||||
namespace VOL.Core.Utilities
|
||||
{
|
||||
@ -687,5 +689,127 @@ namespace VOL.Core.Utilities
|
||||
|
||||
return chineseNumbers[tens] + "十" + (units == 0 ? "" : chineseNumbers[units]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 心率个数
|
||||
/// </summary>
|
||||
/// <param name="heartRateDataList"></param>
|
||||
/// <returns></returns>
|
||||
public static List<SportsProportionData> GetHeartRateNumber(List<Ai_HeartRateData> heartRateDataList)
|
||||
{
|
||||
var result = new List<SportsProportionData>();
|
||||
|
||||
var maleData = heartRateDataList.Where(x => x.Sex == SexType.Male).ToList();
|
||||
var femaleData = heartRateDataList.Where(x => x.Sex == SexType.Female).ToList();
|
||||
|
||||
var m_avg = maleData.Any() ? (int)maleData.Average(x => x.Value) : 0;
|
||||
var f_avg = femaleData.Any() ? (int)femaleData.Average(x => x.Value) : 0;
|
||||
|
||||
var avgData = new SportsProportionData
|
||||
{
|
||||
Name = "平均",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_avg },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_avg }
|
||||
}
|
||||
};
|
||||
|
||||
var m_max = maleData.Any() ? maleData.Max(x => x.Value) : 0;
|
||||
var f_max = femaleData.Any() ? femaleData.Max(x => x.Value) : 0;
|
||||
|
||||
var maxData = new SportsProportionData
|
||||
{
|
||||
Name = "最高",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_max },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_max }
|
||||
}
|
||||
};
|
||||
|
||||
var m_min = maleData.Any() ? maleData.Min(x => x.Value) : 0;
|
||||
var f_min = femaleData.Any() ? femaleData.Min(x => x.Value) : 0;
|
||||
|
||||
var minData = new SportsProportionData
|
||||
{
|
||||
Name = "最低",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData { Title = "男", Value = m_min },
|
||||
new StudentSportsProportionData { Title = "女", Value = f_min }
|
||||
}
|
||||
};
|
||||
|
||||
result.Add(avgData);
|
||||
result.Add(minData);
|
||||
result.Add(maxData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 心率变化趋势
|
||||
/// </summary>
|
||||
/// <param name="heartRateDataList"></param>
|
||||
/// <returns></returns>
|
||||
public static List<SportsProportionData> GetHeartRateTrend(List<Ai_HeartRateData> heartRateDataList)
|
||||
{
|
||||
var result = new List<SportsProportionData>();
|
||||
|
||||
if (heartRateDataList == null || !heartRateDataList.Any())
|
||||
return result;
|
||||
|
||||
var baseTime = heartRateDataList.Min(x => x.ScoreTime);
|
||||
|
||||
var heartRateWithMinutes = heartRateDataList
|
||||
.Select(data => new
|
||||
{
|
||||
Data = data,
|
||||
MinuteBucket = (int)(data.ScoreTime - baseTime).TotalMinutes
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var maxMinute = heartRateWithMinutes.Max(x => x.MinuteBucket);
|
||||
|
||||
for (int minute = 0; minute <= maxMinute; minute++)
|
||||
{
|
||||
var minuteData = heartRateWithMinutes
|
||||
.Where(x => x.MinuteBucket == minute)
|
||||
.Select(x => x.Data)
|
||||
.ToList();
|
||||
|
||||
if (minuteData.Any())
|
||||
{
|
||||
result.Add(new SportsProportionData()
|
||||
{
|
||||
Name = $"{minute + 1} 分钟",
|
||||
Datas = new List<StudentSportsProportionData>
|
||||
{
|
||||
new StudentSportsProportionData {
|
||||
Title = "心率",
|
||||
Value = (int)minuteData.Average(x => x.Value)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用百分比计算方法
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="totalCount"></param>
|
||||
/// <returns></returns>
|
||||
public static double CalculatePercentage(int count, int totalCount)
|
||||
{
|
||||
if (totalCount == 0) return 0;
|
||||
return Math.Round((double)count / totalCount * 100, 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -45,6 +45,15 @@ namespace VOL.Entity.DomainModels
|
||||
[Column(TypeName = "int")]
|
||||
public int ClassRoomRecordId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阶段Id
|
||||
/// </summary>
|
||||
[Display(Name = "阶段Id")]
|
||||
[Comment("阶段Id")]
|
||||
[Column(TypeName = "int")]
|
||||
public int ClassroomStageId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 年级编号
|
||||
/// </summary>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -14,6 +15,7 @@ namespace VOL.Model.Ai
|
||||
/// <summary>
|
||||
/// AI设备的唯一编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "设备Code不能为空")]
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -15,6 +16,7 @@ namespace VOL.Model.Ai
|
||||
/// <summary>
|
||||
/// 学校Code
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "学校Code不能为空")]
|
||||
public string SchoolCode { get; set; }
|
||||
}
|
||||
public class Ai_StudentListRequest : Ai_Request
|
||||
|
@ -25,6 +25,7 @@ using VOL.Model.Ai.Request;
|
||||
using VOL.Model.Ai.Response;
|
||||
using VOL.Model.IOT.Request;
|
||||
using VOL.Model.IOT.Response;
|
||||
using VOL.Model.Training.Response;
|
||||
using VOL.Order;
|
||||
using VOL.WebApi.Filter;
|
||||
|
||||
@ -437,8 +438,10 @@ namespace VOL.WebApi.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
#region 2.0 接口
|
||||
|
||||
/// <summary>
|
||||
/// Ai一体机扫描那登录轮询
|
||||
/// Ai一体机扫描登录轮询
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
@ -450,6 +453,19 @@ namespace VOL.WebApi.Controllers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户名密码登录
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(nameof(Login))]
|
||||
public async Task<Ai_TeacherFaceInfo> Login([FromBody] Ai_LoginRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.Login(paramDto);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
@ -462,5 +478,90 @@ namespace VOL.WebApi.Controllers
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取课堂记录列表
|
||||
/// </summary>
|
||||
[HttpGet(nameof(ClassRoomRecordPageList))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<PageDataDto<Ai_ClassRoomRecordPageListDto>> ClassRoomRecordPageList([FromQuery] ClassRoomRecordPageListRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.ClassRoomRecordPageList(paramDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取课堂阶段列表
|
||||
/// </summary>
|
||||
[HttpGet(nameof(ClassroomStagePageList))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<List<ClassroomStageDto>> ClassroomStagePageList([FromQuery] Ai_Request paramDto)
|
||||
{
|
||||
var result = await _aiAppService.ClassroomStagePageList(paramDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加课堂设置
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(nameof(AddClassroomSetting))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<bool> AddClassroomSetting([FromBody] AddClassroomSettingRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.AddClassroomSetting(paramDto);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新课堂设置
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(nameof(UpdateClassroomSetting))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<bool> UpdateClassroomSetting([FromBody] UpdateClassroomSettingRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.UpdateClassroomSetting(paramDto);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取课堂心率报告
|
||||
/// </summary>
|
||||
[HttpGet(nameof(HeartRateReport))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<Ai_HeartRateReportDto> HeartRateReport([FromQuery] HeartRateReportRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.HeartRateReport(paramDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取学生心率报告
|
||||
/// </summary>
|
||||
[HttpGet(nameof(StudentHeartRateReport))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<GetStudentClassReportDetailsModel> StudentHeartRateReport([FromQuery] GetStudentClassReportDetailsDto paramDto)
|
||||
{
|
||||
var result = await _aiAppService.StudentHeartRateReport(paramDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取学生心率报告
|
||||
/// </summary>
|
||||
[HttpGet(nameof(JumpRopeReport))]
|
||||
[ServiceFilter(typeof(ValidateDeviceFilter))]
|
||||
public async Task<List<Ai_JumpRopeReportDto>> JumpRopeReport([FromQuery] HeartRateReportRequest paramDto)
|
||||
{
|
||||
var result = await _aiAppService.JumpRopeReport(paramDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace VOL.WebApi
|
||||
serverOptions.Limits.MaxRequestLineSize = 81920; // 8 KB
|
||||
// Set properties and call methods on options
|
||||
});
|
||||
webBuilder.UseKestrel().UseUrls("http://*:9991");
|
||||
webBuilder.UseKestrel().UseUrls("http://*:9993");
|
||||
webBuilder.UseIIS();
|
||||
webBuilder.UseStartup<Startup>();
|
||||
}).UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
|
@ -156,11 +156,11 @@ namespace VOL.WebApi
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
//分为2份接口文档
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "VOL.Core后台Api", Version = "v1", Description = "这是对文档的描述。。" });
|
||||
c.SwaggerDoc("v2", new OpenApiInfo { Title = "VOL.Core对外三方Api", Version = "v2", Description = "xxx接口文档" });
|
||||
c.SwaggerDoc("v3", new OpenApiInfo { Title = "SmartSportsServer-Api", Version = "v3", Description = "SmartSportsServer-Api接口文档" });
|
||||
c.SwaggerDoc("v4", new OpenApiInfo { Title = "IOT-Api", Version = "v4", Description = "物联网-Api接口文档" });
|
||||
c.SwaggerDoc("v5", new OpenApiInfo { Title = "Ai-Api", Version = "v5", Description = "Ai-Api接口文档" });
|
||||
//c.SwaggerDoc("v1", new OpenApiInfo { Title = "VOL.Core后台Api", Version = "v1", Description = "这是对文档的描述。。" });
|
||||
//c.SwaggerDoc("v2", new OpenApiInfo { Title = "VOL.Core对外三方Api", Version = "v2", Description = "xxx接口文档" });
|
||||
//c.SwaggerDoc("v3", new OpenApiInfo { Title = "SmartSportsServer-Api", Version = "v3", Description = "SmartSportsServer-Api接口文档" });
|
||||
//c.SwaggerDoc("v4", new OpenApiInfo { Title = "IOT-Api", Version = "v4", Description = "物联网-Api接口文档" });
|
||||
//c.SwaggerDoc("v5", new OpenApiInfo { Title = "Ai-Api", Version = "v5", Description = "Ai-Api接口文档" });
|
||||
c.SwaggerDoc("v6", new OpenApiInfo { Title = "AiApp-Api", Version = "v6", Description = "AiApp-Api接口文档" });
|
||||
|
||||
string xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
@ -318,18 +318,18 @@ namespace VOL.WebApi
|
||||
//配置HttpContext
|
||||
app.UseStaticHttpContext();
|
||||
|
||||
//app.UseSwagger();
|
||||
//app.UseSwaggerUI(c =>
|
||||
//{
|
||||
// //2个下拉框选项 选择对应的文档
|
||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "VOL.Core后台Api");
|
||||
// c.SwaggerEndpoint("/swagger/v2/swagger.json", "测试第三方Api");
|
||||
// c.SwaggerEndpoint("/swagger/v3/swagger.json", "SmartSportsServer-Api");
|
||||
// c.SwaggerEndpoint("/swagger/v4/swagger.json", "物联网-Api");
|
||||
// c.SwaggerEndpoint("/swagger/v5/swagger.json", "Ai-Api");
|
||||
// c.SwaggerEndpoint("/swagger/v6/swagger.json", "AiApp-Api");
|
||||
// c.RoutePrefix = "";
|
||||
//});
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
//2个下拉框选项 选择对应的文档
|
||||
//c.SwaggerEndpoint("/swagger/v1/swagger.json", "VOL.Core后台Api");
|
||||
//c.SwaggerEndpoint("/swagger/v2/swagger.json", "测试第三方Api");
|
||||
//c.SwaggerEndpoint("/swagger/v3/swagger.json", "SmartSportsServer-Api");
|
||||
//c.SwaggerEndpoint("/swagger/v4/swagger.json", "物联网-Api");
|
||||
//c.SwaggerEndpoint("/swagger/v5/swagger.json", "Ai-Api");
|
||||
c.SwaggerEndpoint("/swagger/v6/swagger.json", "AiApp-Api");
|
||||
c.RoutePrefix = "";
|
||||
});
|
||||
|
||||
app.UseRouting();
|
||||
app.UseCors();
|
||||
|
Loading…
x
Reference in New Issue
Block a user