aiapi
This commit is contained in:
parent
c13e3a8ca3
commit
d42a18c64c
@ -163,7 +163,7 @@ namespace VOL.Ai.IServices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 心率成绩上传
|
/// 心率成绩上传
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void HeartRateResultUpload(AddHeartRateResultUploadRequest paramDto);
|
Task HeartRateResultUpload(AddHeartRateResultUploadRequest paramDto);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新增课堂记录
|
/// 新增课堂记录
|
||||||
|
@ -114,7 +114,7 @@ namespace VOL.Ai.Services
|
|||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (res == null)
|
if (res == null)
|
||||||
throw new ArgumentNullException(nameof(res));
|
return new Ai_SchoolDto();
|
||||||
|
|
||||||
var gIds = await _studentRepository.DbContext.Set<S_SchoolAssocGrade>().Where(x => x.SchoolCode == res.SchoolCode).Select(x => x.GradeId).ToListAsync();
|
var gIds = await _studentRepository.DbContext.Set<S_SchoolAssocGrade>().Where(x => x.SchoolCode == res.SchoolCode).Select(x => x.GradeId).ToListAsync();
|
||||||
|
|
||||||
@ -247,71 +247,79 @@ namespace VOL.Ai.Services
|
|||||||
|
|
||||||
public async Task<Ai_StudentFaceInfo> StudentFace(GetFaceParam paramDto)
|
public async Task<Ai_StudentFaceInfo> StudentFace(GetFaceParam paramDto)
|
||||||
{
|
{
|
||||||
var body = await ALiYunFace.SearchFace(paramDto.Base64);
|
var faces = await ALiYunFace.SearchFace(paramDto.Base64, false);
|
||||||
|
|
||||||
if (body != null && body.Confidence >= 72.62)
|
foreach (var body in faces)
|
||||||
{
|
{
|
||||||
var student = await (from s in _studentRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.StudentNo == body.EntityId)
|
if (body != null && body.Confidence >= 72.62)
|
||||||
join c in _studentRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
{
|
||||||
select new Ai_StudentFaceInfo
|
var student = await (from s in _studentRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.StudentNo == body.EntityId)
|
||||||
{
|
join c in _studentRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
||||||
ClassId = c.Id,
|
select new Ai_StudentFaceInfo
|
||||||
ClassName = c.ClassName,
|
{
|
||||||
Age = s.Age,
|
ClassId = c.Id,
|
||||||
Sex = s.Sex,
|
ClassName = c.ClassName,
|
||||||
StudentName = s.StudentName,
|
Age = s.Age,
|
||||||
StudentCode = s.StudentNo,
|
Sex = s.Sex,
|
||||||
GradeId = c.GradeId,
|
StudentName = s.StudentName,
|
||||||
GradeName = c.GradeName,
|
StudentCode = s.StudentNo,
|
||||||
Photo = s.Photo
|
GradeId = c.GradeId,
|
||||||
}).FirstOrDefaultAsync();
|
GradeName = c.GradeName,
|
||||||
|
Photo = s.Photo
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (student == null)
|
||||||
|
throw new Exception("未查询到学生信息");
|
||||||
|
|
||||||
if (student != null)
|
|
||||||
return student;
|
return student;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("未查询到学生信息"); ;
|
throw new Exception("未查询到学生信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Ai_TeacherFaceInfo> TeacherFace(GetFaceParam paramDto)
|
public async Task<Ai_TeacherFaceInfo> TeacherFace(GetFaceParam paramDto)
|
||||||
{
|
{
|
||||||
var body = await ALiYunFace.SearchFace(paramDto.Base64, false);
|
var faces = await ALiYunFace.SearchFace(paramDto.Base64, false);
|
||||||
|
|
||||||
if (body != null && body.Confidence >= 72.62)
|
foreach (var body in faces)
|
||||||
{
|
{
|
||||||
var teacher = await _teacherRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.TeacherStatus != TeacherStatus.Depart && x.TeacherPhoneNo == body.EntityId)
|
if (body != null && body.Confidence >= 72.62)
|
||||||
.Select(x =>
|
{
|
||||||
new Ai_TeacherFaceInfo()
|
var teacher = await _teacherRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.TeacherStatus != TeacherStatus.Depart && x.TeacherPhoneNo == body.EntityId)
|
||||||
{
|
.Select(x =>
|
||||||
Id = x.Id,
|
new Ai_TeacherFaceInfo()
|
||||||
Age = x.Age,
|
{
|
||||||
//SchoolCode = x.SchoolCode,
|
Id = x.Id,
|
||||||
Sex = x.Sex,
|
Age = x.Age,
|
||||||
Phone = x.TeacherPhoneNo,
|
//SchoolCode = x.SchoolCode,
|
||||||
TeacherName = x.TeacherName,
|
Sex = x.Sex,
|
||||||
Photo = x.TeacherPhoto,
|
Phone = x.TeacherPhoneNo,
|
||||||
}).FirstOrDefaultAsync();
|
TeacherName = x.TeacherName,
|
||||||
|
Photo = x.TeacherPhoto,
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (teacher == null)
|
if (teacher == null)
|
||||||
throw new Exception("未查询到老师信息");
|
continue;
|
||||||
|
|
||||||
var grades = await (
|
var grades = await (
|
||||||
from t in _studentRepository.DbContext.Set<S_ClassAssocTeacher>()
|
from t in _studentRepository.DbContext.Set<S_ClassAssocTeacher>()
|
||||||
join c in _studentRepository.DbContext.Set<S_Class>() on t.ClassId equals c.Id into classGroup
|
join c in _studentRepository.DbContext.Set<S_Class>() on t.ClassId equals c.Id into classGroup
|
||||||
from c in classGroup.DefaultIfEmpty()
|
from c in classGroup.DefaultIfEmpty()
|
||||||
where t.TeacherId == teacher.Id && c != null
|
where t.TeacherId == teacher.Id && c != null
|
||||||
select new Classes()
|
select new Classes()
|
||||||
{
|
{
|
||||||
Id = c.Id,
|
Id = c.Id,
|
||||||
Name = $"{c.GradeName}-{c.ClassName}",
|
Name = $"{c.GradeName}-{c.ClassName}",
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
teacher.GradeAndClassList = grades;
|
teacher.GradeAndClassList = grades;
|
||||||
|
|
||||||
return teacher;
|
return teacher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("人脸识别失败!");
|
throw new Exception("未查询到老师信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<Ai_StudentListDto>> Ai_StudentList(Ai_StudentListRequest paramDto)
|
public async Task<List<Ai_StudentListDto>> Ai_StudentList(Ai_StudentListRequest paramDto)
|
||||||
@ -320,6 +328,8 @@ namespace VOL.Ai.Services
|
|||||||
join c in _studentRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
join c in _studentRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
||||||
join g in _studentRepository.DbContext.Set<S_Grade>() on c.GradeId equals g.Id
|
join g in _studentRepository.DbContext.Set<S_Grade>() on c.GradeId equals g.Id
|
||||||
where s.SchoolCode == paramDto.SchoolCode && s.ClassId == paramDto.Id && s.StudentStatus == StudentStatus.Normal
|
where s.SchoolCode == paramDto.SchoolCode && s.ClassId == paramDto.Id && s.StudentStatus == StudentStatus.Normal
|
||||||
|
orderby s.OrderNo ascending
|
||||||
|
|
||||||
select new Ai_StudentListDto()
|
select new Ai_StudentListDto()
|
||||||
{
|
{
|
||||||
Code = paramDto.Code,
|
Code = paramDto.Code,
|
||||||
@ -373,8 +383,7 @@ namespace VOL.Ai.Services
|
|||||||
select new Ai_ItemTypeModel()
|
select new Ai_ItemTypeModel()
|
||||||
{
|
{
|
||||||
ItemCode = s.Id,
|
ItemCode = s.Id,
|
||||||
ItemTypeName = s.SpecialName,
|
ItemTypeName = s.SpecialName
|
||||||
ImageUrl = s.ImageUrl
|
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@ -386,7 +395,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task<Ai_TeachingItemsDetailModel> TeachingItemsDetail(Ai_TeachingItemsRequest paramDto)
|
public async Task<Ai_TeachingItemsDetailModel> TeachingItemsDetail(Ai_TeachingItemsRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null || paramDto.ItemCode <= 0)
|
if (paramDto == null || paramDto.ItemCode <= 0)
|
||||||
throw new Exception("参数错误");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return new Ai_TeachingItemsDetailModel();
|
||||||
|
}
|
||||||
|
|
||||||
var result = await (
|
var result = await (
|
||||||
from s in _studentRepository.DbContext.Set<Ai_Special>()
|
from s in _studentRepository.DbContext.Set<Ai_Special>()
|
||||||
@ -703,7 +715,10 @@ namespace VOL.Ai.Services
|
|||||||
//await _studentRepository.SaveChangesAsync();
|
//await _studentRepository.SaveChangesAsync();
|
||||||
|
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = _mapper.Map<Ai_TrainingData>(paramDto);
|
var entity = _mapper.Map<Ai_TrainingData>(paramDto);
|
||||||
|
|
||||||
@ -720,7 +735,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task SportsTestResultUpload(SportsTestResultUploadRequest paramDto)
|
public async Task SportsTestResultUpload(SportsTestResultUploadRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = _mapper.Map<Ai_SportsTestData>(paramDto);
|
var entity = _mapper.Map<Ai_SportsTestData>(paramDto);
|
||||||
|
|
||||||
@ -737,7 +755,10 @@ namespace VOL.Ai.Services
|
|||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (student == null)
|
if (student == null)
|
||||||
throw new ArgumentNullException($"未找到学生信息");
|
{
|
||||||
|
Console.WriteLine("未找到学生信息,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SemesterDto semesterDto = new SemesterDto();
|
SemesterDto semesterDto = new SemesterDto();
|
||||||
entity.Year = semesterDto.Year;
|
entity.Year = semesterDto.Year;
|
||||||
@ -752,6 +773,7 @@ namespace VOL.Ai.Services
|
|||||||
entity.ClassName = student.ClassName;
|
entity.ClassName = student.ClassName;
|
||||||
entity.StudentName = student.StudentName;
|
entity.StudentName = student.StudentName;
|
||||||
entity.Sex = student.Sex;
|
entity.Sex = student.Sex;
|
||||||
|
entity.IsDisplay = true;
|
||||||
|
|
||||||
var categoryEnum = Tool.GetEnumNameByValue(paramDto.CategoryValue);
|
var categoryEnum = Tool.GetEnumNameByValue(paramDto.CategoryValue);
|
||||||
var healthStandards = await _healthStandardsRepository.FindAsync(x => x.CategoryEnum == categoryEnum);
|
var healthStandards = await _healthStandardsRepository.FindAsync(x => x.CategoryEnum == categoryEnum);
|
||||||
@ -785,7 +807,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task ActivitiestResultUpload(Ai_ActivitiestResultUploadRequest paramDto)
|
public async Task ActivitiestResultUpload(Ai_ActivitiestResultUploadRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = _mapper.Map<Ai_ActivitiestData>(paramDto);
|
var entity = _mapper.Map<Ai_ActivitiestData>(paramDto);
|
||||||
|
|
||||||
@ -806,7 +831,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task LevelExamResultUpload(LevelExamDataUploadRequest paramDto)
|
public async Task LevelExamResultUpload(LevelExamDataUploadRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var entity = _mapper.Map<Ai_LevelExamData>(paramDto);
|
var entity = _mapper.Map<Ai_LevelExamData>(paramDto);
|
||||||
|
|
||||||
@ -826,7 +854,11 @@ namespace VOL.Ai.Services
|
|||||||
}).FirstOrDefaultAsync();
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (student == null)
|
if (student == null)
|
||||||
throw new ArgumentNullException($"未找到学生信息");
|
{
|
||||||
|
Console.WriteLine("未找到学生信息,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
entity.ScoreTime = paramDto.StartTime;
|
entity.ScoreTime = paramDto.StartTime;
|
||||||
entity.StartTime = paramDto.StartTime;
|
entity.StartTime = paramDto.StartTime;
|
||||||
@ -837,6 +869,7 @@ namespace VOL.Ai.Services
|
|||||||
entity.ClassName = student.ClassName;
|
entity.ClassName = student.ClassName;
|
||||||
entity.StudentName = student.StudentName;
|
entity.StudentName = student.StudentName;
|
||||||
entity.Sex = student.Sex;
|
entity.Sex = student.Sex;
|
||||||
|
entity.IsDisplay = true;
|
||||||
|
|
||||||
await _levelExamDataRepository.AddAsync(entity);
|
await _levelExamDataRepository.AddAsync(entity);
|
||||||
await _levelExamDataRepository.SaveChangesAsync();
|
await _levelExamDataRepository.SaveChangesAsync();
|
||||||
@ -848,16 +881,22 @@ namespace VOL.Ai.Services
|
|||||||
/// <param name="paramDto"></param>
|
/// <param name="paramDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public async void HeartRateResultUpload(AddHeartRateResultUploadRequest paramDto)
|
public async Task HeartRateResultUpload(AddHeartRateResultUploadRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null || paramDto.Datas == null || paramDto.Datas.Count == 0)
|
if (paramDto == null || paramDto.Datas == null || paramDto.Datas.Count == 0)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空或数据为空,跳过处理。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var heartRateDatas = _mapper.Map<List<Ai_HeartRateData>>(paramDto.Datas);
|
var heartRateDatas = _mapper.Map<List<Ai_HeartRateData>>(paramDto.Datas);
|
||||||
|
heartRateDatas = heartRateDatas.Where(data => data.Value != 0).ToList();
|
||||||
|
|
||||||
var classIds = paramDto.Datas.Select(x => x.ClassId).ToList();
|
var classIds = paramDto.Datas.Select(x => x.ClassId).ToList();
|
||||||
var classList = await _classRepository.FindAsync(x => x.SchoolCode == paramDto.SchoolCode && classIds.Contains(x.Id));
|
var classList = await _classRepository.FindAsync(x => x.SchoolCode == paramDto.SchoolCode && classIds.Contains(x.Id));
|
||||||
|
|
||||||
|
var timeNow = DateTime.Now;
|
||||||
|
|
||||||
heartRateDatas.ForEach(heartRateData =>
|
heartRateDatas.ForEach(heartRateData =>
|
||||||
{
|
{
|
||||||
var classInfo = classList.Where(x => x.Id == heartRateData.ClassId).First();
|
var classInfo = classList.Where(x => x.Id == heartRateData.ClassId).First();
|
||||||
@ -868,11 +907,13 @@ namespace VOL.Ai.Services
|
|||||||
heartRateData.TeacherId = paramDto.TeacherId;
|
heartRateData.TeacherId = paramDto.TeacherId;
|
||||||
heartRateData.GradeId = classInfo.GradeId;
|
heartRateData.GradeId = classInfo.GradeId;
|
||||||
heartRateData.GradeName = classInfo.GradeName;
|
heartRateData.GradeName = classInfo.GradeName;
|
||||||
heartRateData.ScoreTime = DateTime.Now;
|
heartRateData.ScoreTime = timeNow;
|
||||||
|
heartRateData.IsDisplay = true;
|
||||||
|
//HeartRateQueueData.Add(heartRateData);
|
||||||
HeartRateQueueData.Add(heartRateData);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await _heartRateDataRepository.AddRangeAsync(heartRateDatas);
|
||||||
|
await _heartRateDataRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -884,7 +925,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task FastJumpRopeResultUpload(AddFastJumpRopeResultUploadRequest paramDto)
|
public async Task FastJumpRopeResultUpload(AddFastJumpRopeResultUploadRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null || paramDto.Datas == null || paramDto.Datas.Count == 0)
|
if (paramDto == null || paramDto.Datas == null || paramDto.Datas.Count == 0)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空或数据为空,跳过处理。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var fastJumpRopeDatas = _mapper.Map<List<Ai_FastJumpRopeData>>(paramDto.Datas);
|
var fastJumpRopeDatas = _mapper.Map<List<Ai_FastJumpRopeData>>(paramDto.Datas);
|
||||||
|
|
||||||
@ -898,6 +942,7 @@ namespace VOL.Ai.Services
|
|||||||
data.Code = paramDto.Code;
|
data.Code = paramDto.Code;
|
||||||
data.SchoolCode = paramDto.SchoolCode;
|
data.SchoolCode = paramDto.SchoolCode;
|
||||||
data.ClassRoomRecordId = paramDto.ClassRoomRecordId;
|
data.ClassRoomRecordId = paramDto.ClassRoomRecordId;
|
||||||
|
data.GroupId = paramDto.GroupId;
|
||||||
data.TeacherId = paramDto.TeacherId;
|
data.TeacherId = paramDto.TeacherId;
|
||||||
data.GradeId = classInfo.GradeId;
|
data.GradeId = classInfo.GradeId;
|
||||||
data.GradeName = classInfo.GradeName;
|
data.GradeName = classInfo.GradeName;
|
||||||
@ -907,7 +952,6 @@ namespace VOL.Ai.Services
|
|||||||
data.ModelName = paramDto.ModeType.GetDescription();
|
data.ModelName = paramDto.ModeType.GetDescription();
|
||||||
data.UniqueId = paramDto.UniqueId;
|
data.UniqueId = paramDto.UniqueId;
|
||||||
});
|
});
|
||||||
|
|
||||||
await _fastJumpRopeDataRepository.AddRangeAsync(fastJumpRopeDatas);
|
await _fastJumpRopeDataRepository.AddRangeAsync(fastJumpRopeDatas);
|
||||||
await _fastJumpRopeDataRepository.SaveChangesAsync();
|
await _fastJumpRopeDataRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
@ -922,16 +966,17 @@ namespace VOL.Ai.Services
|
|||||||
{
|
{
|
||||||
var res = new PageDataDto<Ai_FastJumpRopeDto>();
|
var res = new PageDataDto<Ai_FastJumpRopeDto>();
|
||||||
|
|
||||||
// 查询数据并根据 UniqueId 分组
|
|
||||||
var groupedQuery = from a in _fastJumpRopeDataRepository.FindAsIQueryable(x =>
|
var groupedQuery = from a in _fastJumpRopeDataRepository.FindAsIQueryable(x =>
|
||||||
//x.ClassId == paramDto.ClassId &&
|
x.SchoolCode == paramDto.SchoolCode &&
|
||||||
x.SchoolCode == paramDto.SchoolCode)
|
(paramDto.ClassRoomRecordId == null || paramDto.ClassRoomRecordId <= 0 || x.ClassRoomRecordId == paramDto.ClassRoomRecordId))
|
||||||
group a by a.GroupId into g
|
group a by a.GroupId into g
|
||||||
select new
|
select new
|
||||||
{
|
{
|
||||||
GroupId = g.Key,
|
GroupId = g.Key,
|
||||||
ModelName = g.FirstOrDefault().ModelName,
|
g.FirstOrDefault().MotionDuration,
|
||||||
MotionDuration = g.FirstOrDefault().MotionDuration,
|
g.FirstOrDefault().ModeType,
|
||||||
|
g.FirstOrDefault().ModelName,
|
||||||
|
//MotionDuration = g.FirstOrDefault().MotionDuration,
|
||||||
ScoreTime = g.Max(x => x.ScoreTime),
|
ScoreTime = g.Max(x => x.ScoreTime),
|
||||||
TestItem = Ai_TrainingModuleEnum.FastJumpRope.GetDescription()
|
TestItem = Ai_TrainingModuleEnum.FastJumpRope.GetDescription()
|
||||||
};
|
};
|
||||||
@ -947,6 +992,7 @@ namespace VOL.Ai.Services
|
|||||||
.Select(x => new Ai_FastJumpRopeDto
|
.Select(x => new Ai_FastJumpRopeDto
|
||||||
{
|
{
|
||||||
GroupId = x.GroupId,
|
GroupId = x.GroupId,
|
||||||
|
ModeType = x.ModeType,
|
||||||
ModelName = x.ModelName,
|
ModelName = x.ModelName,
|
||||||
MotionDuration = x.MotionDuration,
|
MotionDuration = x.MotionDuration,
|
||||||
ScoreTime = x.ScoreTime,
|
ScoreTime = x.ScoreTime,
|
||||||
@ -969,11 +1015,16 @@ namespace VOL.Ai.Services
|
|||||||
{
|
{
|
||||||
var res = new PageDataDto<Ai_FastJumpRopeStudentList>();
|
var res = new PageDataDto<Ai_FastJumpRopeStudentList>();
|
||||||
|
|
||||||
|
|
||||||
// 构建查询
|
// 构建查询
|
||||||
|
//var query = _fastJumpRopeDataRepository.FindAsIQueryable(x =>
|
||||||
|
// x.ClassRoomRecordId == paramDto.ClassRoomRecordId &&
|
||||||
|
// x.SchoolCode == paramDto.SchoolCode &&
|
||||||
|
// (paramDto.ModeType != Ai_FastJumpRopeModeEnum.FollowMode || x.GroupId == paramDto.GroupId)
|
||||||
|
// );
|
||||||
|
|
||||||
var query = _fastJumpRopeDataRepository.FindAsIQueryable(x =>
|
var query = _fastJumpRopeDataRepository.FindAsIQueryable(x =>
|
||||||
x.ClassRoomRecordId == paramDto.ClassRoomRecordId &&
|
x.ClassRoomRecordId == paramDto.ClassRoomRecordId &&
|
||||||
x.SchoolCode == paramDto.SchoolCode);
|
x.SchoolCode == paramDto.SchoolCode && x.GroupId == paramDto.GroupId);
|
||||||
|
|
||||||
// 异步获取数据列表
|
// 异步获取数据列表
|
||||||
var rawData = await query.ToListAsync();
|
var rawData = await query.ToListAsync();
|
||||||
@ -1022,7 +1073,10 @@ namespace VOL.Ai.Services
|
|||||||
public async Task<Ai_ClassRoomRecordDto> AddClassRoomRecord(Ai_ClassRoomRecordRequest paramDto)
|
public async Task<Ai_ClassRoomRecordDto> AddClassRoomRecord(Ai_ClassRoomRecordRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空或数据为空,跳过处理。");
|
||||||
|
return new Ai_ClassRoomRecordDto();
|
||||||
|
}
|
||||||
|
|
||||||
var entity = _mapper.Map<Ai_ClassRoomRecord>(paramDto);
|
var entity = _mapper.Map<Ai_ClassRoomRecord>(paramDto);
|
||||||
|
|
||||||
@ -1032,7 +1086,10 @@ namespace VOL.Ai.Services
|
|||||||
var classInfos = await _classRepository.FindAsync(x => ids.Contains(x.Id) && x.SchoolCode == paramDto.SchoolCode);
|
var classInfos = await _classRepository.FindAsync(x => ids.Contains(x.Id) && x.SchoolCode == paramDto.SchoolCode);
|
||||||
var classInfo = classInfos.FirstOrDefault(x => x.Id == paramDto.ClassId);
|
var classInfo = classInfos.FirstOrDefault(x => x.Id == paramDto.ClassId);
|
||||||
if (classInfo == null)
|
if (classInfo == null)
|
||||||
throw new ArgumentNullException($"班级信息为空");
|
{
|
||||||
|
Console.WriteLine("班级信息数据为空,跳过处理。");
|
||||||
|
return new Ai_ClassRoomRecordDto();
|
||||||
|
}
|
||||||
|
|
||||||
entity.ClassName = classInfo.ClassName;
|
entity.ClassName = classInfo.ClassName;
|
||||||
entity.GradeId = classInfo.GradeId;
|
entity.GradeId = classInfo.GradeId;
|
||||||
@ -1046,7 +1103,10 @@ namespace VOL.Ai.Services
|
|||||||
{
|
{
|
||||||
var StuClass = classInfos.First(x => x.Id == student.ClassId);
|
var StuClass = classInfos.First(x => x.Id == student.ClassId);
|
||||||
if (StuClass == null)
|
if (StuClass == null)
|
||||||
throw new ArgumentNullException($"班级信息为空");
|
{
|
||||||
|
Console.WriteLine("班级信息数据为空,跳过处理。");
|
||||||
|
return new Ai_ClassRoomRecordDto();
|
||||||
|
}
|
||||||
|
|
||||||
student.ClassName = StuClass.ClassName;
|
student.ClassName = StuClass.ClassName;
|
||||||
student.GradeId = StuClass.GradeId;
|
student.GradeId = StuClass.GradeId;
|
||||||
@ -1072,7 +1132,11 @@ namespace VOL.Ai.Services
|
|||||||
public async Task EndTeaching(EndTeachingRequest paramDto)
|
public async Task EndTeaching(EndTeachingRequest paramDto)
|
||||||
{
|
{
|
||||||
if (paramDto == null)
|
if (paramDto == null)
|
||||||
throw new ArgumentNullException($"参数为空");
|
{
|
||||||
|
Console.WriteLine("参数为空,跳过...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var entity = await _classRoomRecordRepository.FindAsyncFirst(x => x.Id == paramDto.ClassRoomRecordId && x.SchoolCode == paramDto.SchoolCode);
|
var entity = await _classRoomRecordRepository.FindAsyncFirst(x => x.Id == paramDto.ClassRoomRecordId && x.SchoolCode == paramDto.SchoolCode);
|
||||||
|
|
||||||
|
@ -134,9 +134,9 @@ namespace VOL.Core.Utilities
|
|||||||
catch (Exception _error)
|
catch (Exception _error)
|
||||||
{
|
{
|
||||||
TeaException error = new TeaException(new Dictionary<string, object>
|
TeaException error = new TeaException(new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "message", _error.Message }
|
{ "message", _error.Message }
|
||||||
});
|
});
|
||||||
throw new Exception($"系统异常:人脸数据添加失败。可能原因包括图片格式或内容不符合要求。请确保图片为正面人脸清晰无遮挡,分辨率不少于 640x480,大小不超过 2MB。错误详情:{error.Message}");
|
throw new Exception($"系统异常:人脸数据添加失败。可能原因包括图片格式或内容不符合要求。请确保图片为正面人脸清晰无遮挡,分辨率不少于 640x480,大小不超过 2MB。错误详情:{error.Message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ namespace VOL.Core.Utilities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="faceDbName"></param>
|
/// <param name="faceDbName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task<SearchFaceResponseBodyDataMatchListFaceItems> SearchFace(string base64, bool isStudent = true)
|
public static async Task<List<SearchFaceResponseBodyDataMatchListFaceItems>> SearchFace(string base64, bool isStudent = true)
|
||||||
{
|
{
|
||||||
AlibabaCloud.SDK.Facebody20191230.Client client = CreateClient();
|
AlibabaCloud.SDK.Facebody20191230.Client client = CreateClient();
|
||||||
try
|
try
|
||||||
@ -161,7 +161,7 @@ namespace VOL.Core.Utilities
|
|||||||
var searchFaceAdvanceRequest = new SearchFaceAdvanceRequest
|
var searchFaceAdvanceRequest = new SearchFaceAdvanceRequest
|
||||||
{
|
{
|
||||||
ImageUrlObject = stream,
|
ImageUrlObject = stream,
|
||||||
Limit = 1,
|
Limit = 10,
|
||||||
DbName = isStudent ? AppSetting.ALiYunFaceDetect.StudeneDb : AppSetting.ALiYunFaceDetect.TeacherDb
|
DbName = isStudent ? AppSetting.ALiYunFaceDetect.StudeneDb : AppSetting.ALiYunFaceDetect.TeacherDb
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ namespace VOL.Core.Utilities
|
|||||||
|
|
||||||
var res = await client.SearchFaceAdvanceAsync(searchFaceAdvanceRequest, runtime);
|
var res = await client.SearchFaceAdvanceAsync(searchFaceAdvanceRequest, runtime);
|
||||||
|
|
||||||
return res.Body.Data.MatchList.Count > 0 && res.Body.Data.MatchList[0].FaceItems.Count > 0 ? res.Body.Data.MatchList[0].FaceItems[0] : null;
|
return res.Body.Data.MatchList.Count > 0 && res.Body.Data.MatchList[0].FaceItems.Count > 0 ? res.Body.Data.MatchList[0].FaceItems : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (TeaException error)
|
catch (TeaException error)
|
||||||
|
@ -48,6 +48,7 @@ namespace VOL.Model.Ai.Request
|
|||||||
public DateTime? TodayTime { get; set; }
|
public DateTime? TodayTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ai速度跳绳成绩排行
|
/// Ai速度跳绳成绩排行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -64,9 +65,9 @@ namespace VOL.Model.Ai.Request
|
|||||||
public string SchoolCode { get; set; }
|
public string SchoolCode { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 班级Id
|
/// 课堂记录Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//public int ClassId { get; set; }
|
public int? ClassRoomRecordId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,9 +86,24 @@ namespace VOL.Model.Ai.Request
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string SchoolCode { get; set; }
|
public string SchoolCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GroupId
|
||||||
|
/// </summary>
|
||||||
|
public string GroupId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 课堂记录Id
|
/// 课堂记录Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ClassRoomRecordId { get; set; }
|
public int ClassRoomRecordId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模式类型
|
||||||
|
/// </summary>
|
||||||
|
//public Ai_FastJumpRopeModeEnum ModeType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///运动时长/分钟
|
||||||
|
/// </summary>
|
||||||
|
//public int? MotionDuration { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,12 +34,16 @@ namespace VOL.Model.Ai
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string StudentNo { get; set; }
|
public string StudentNo { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ai速度跳绳
|
/// Ai速度跳绳
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Ai_FastJumpRopeDto
|
public class Ai_FastJumpRopeDto
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备上传成绩时唯一标识
|
||||||
|
/// </summary>
|
||||||
|
//public string UniqueId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GroupId
|
/// GroupId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -60,6 +64,11 @@ namespace VOL.Model.Ai
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? MotionDuration { get; set; }
|
public int? MotionDuration { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模式类型
|
||||||
|
/// </summary>
|
||||||
|
public Ai_FastJumpRopeModeEnum ModeType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模式名称
|
/// 模式名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user