运动馆成绩导入
This commit is contained in:
parent
61e0d9c30a
commit
3661747123
@ -3,11 +3,13 @@ using Microsoft.AspNetCore.Http;
|
||||
using VOL.Model;
|
||||
using VOL.Model.Norm.Request;
|
||||
using VOL.Model.Norm.Response;
|
||||
using VOL.Model.School.Request;
|
||||
using VOL.Model.School.Response;
|
||||
|
||||
namespace VOL.Business.IServices
|
||||
namespace VOL.Business.IServices
|
||||
{
|
||||
public interface IN_SportsTestResultService
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// 导入学生体测成绩
|
||||
/// </summary>
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Model;
|
||||
using VOL.Model.School.Request;
|
||||
using VOL.Model.School.Response;
|
||||
using VOL.Model.SportsHall;
|
||||
|
||||
namespace VOL.Business.IServices.SportsHall
|
||||
@ -23,5 +26,26 @@ namespace VOL.Business.IServices.SportsHall
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
Task ModifyClass(ModifySportsHallClassParam paramDto);
|
||||
|
||||
/// <summary>
|
||||
/// 导入运动馆学生体测成绩
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
Task SportsHallImportStudentsTestData(IFormFile file);
|
||||
|
||||
/// <summary>
|
||||
/// 运动馆体测成绩分页列表
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
Task<PageDataDto<SportsHallStudentsTestModel>> GetSportsHallStudentsTestPageList(SportsHallStudentsTestParam paramDto);
|
||||
|
||||
/// <summary>
|
||||
/// 成绩推送
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
Task ScorePush(SportsHallStudentsTestParam paramDto);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +1,11 @@
|
||||
using AutoMapper;
|
||||
using Castle.DynamicProxy.Generators;
|
||||
using Confluent.Kafka;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.ML;
|
||||
using OfficeOpenXml.ConditionalFormatting;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
||||
using SkiaSharp;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Business.IServices;
|
||||
using VOL.Business.IServices.Norm;
|
||||
using VOL.Core.CacheManager;
|
||||
using VOL.Core.Configuration;
|
||||
using VOL.Core.Extensions;
|
||||
using VOL.Core.Extensions.AutofacManager;
|
||||
using VOL.Core.ManageUser;
|
||||
@ -32,15 +14,11 @@ using VOL.Entity.DomainModels;
|
||||
using VOL.Entity.DomainModels.Business.People;
|
||||
using VOL.Entity.Enum;
|
||||
using VOL.Model;
|
||||
using VOL.Model.Ai;
|
||||
using VOL.Model.IOT.Request;
|
||||
using VOL.Model.Norm.Request;
|
||||
using VOL.Model.Norm.Response;
|
||||
using VOL.Model.School.Request;
|
||||
using VOL.Model.School.Response;
|
||||
using VOL.System.IRepositories;
|
||||
using VOL.System.Repositories;
|
||||
using static Dapper.SqlMapper;
|
||||
using static System.Formats.Asn1.AsnWriter;
|
||||
|
||||
namespace VOL.Business.Services
|
||||
{
|
||||
@ -180,6 +158,7 @@ namespace VOL.Business.Services
|
||||
await _sportsTestResultRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<N_SportsTestValue> AddEnumStudentsTestData(ImportStudentsTestDataParam data, SportsTestItemType type, dynamic student, DateTime timeNow)
|
||||
{
|
||||
int classId = student.ClassId;
|
||||
@ -2032,7 +2011,6 @@ namespace VOL.Business.Services
|
||||
return scoreToAdditionalPoints[score];
|
||||
}
|
||||
|
||||
|
||||
//获取引体向上和仰卧起坐附加分
|
||||
public int GetPullUpSitUpsAdditionalScore(string gender, int score)
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
@ -15,10 +16,13 @@ using VOL.Business.Services.School;
|
||||
using VOL.Core.CacheManager;
|
||||
using VOL.Core.Extensions.AutofacManager;
|
||||
using VOL.Core.ManageUser;
|
||||
using VOL.Core.Utilities;
|
||||
using VOL.Entity.DomainModels;
|
||||
using VOL.Entity.Enum;
|
||||
using VOL.Model;
|
||||
using VOL.Model.IOT.Request;
|
||||
using VOL.Model.School.Request;
|
||||
using VOL.Model.School.Response;
|
||||
using VOL.Model.SportsHall;
|
||||
using VOL.System.IRepositories;
|
||||
using VOL.System.Repositories;
|
||||
@ -35,14 +39,23 @@ namespace VOL.Business.Services.SportsHall
|
||||
private readonly IS_GradeRepository _gradeRepository;
|
||||
private readonly IS_ClassAssocTeacherRepository _classAssocTeacherRepository;
|
||||
private readonly IS_StudentRepository _studentRepository;
|
||||
IN_HealthStandardsRepository _healthStandardsRepository;
|
||||
IN_SportsTestResultRepository _sportsTestResultRepository;
|
||||
|
||||
[ActivatorUtilitiesConstructor]
|
||||
public SportsHallService(IS_ClassRepository classRepository, IS_GradeRepository gradeRepository, IS_ClassAssocTeacherRepository classAssocTeacherRepository, IS_StudentRepository studentRepository)
|
||||
public SportsHallService(IS_ClassRepository classRepository,
|
||||
IS_GradeRepository gradeRepository,
|
||||
IS_ClassAssocTeacherRepository classAssocTeacherRepository,
|
||||
IS_StudentRepository studentRepository,
|
||||
IN_HealthStandardsRepository healthStandardsRepository,
|
||||
IN_SportsTestResultRepository sportsTestResultRepository)
|
||||
{
|
||||
_classRepository = classRepository;
|
||||
_gradeRepository = gradeRepository;
|
||||
_classAssocTeacherRepository = classAssocTeacherRepository;
|
||||
_studentRepository = studentRepository;
|
||||
_healthStandardsRepository = healthStandardsRepository;
|
||||
_sportsTestResultRepository = sportsTestResultRepository;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -188,7 +201,7 @@ namespace VOL.Business.Services.SportsHall
|
||||
}
|
||||
else
|
||||
{
|
||||
student.ClassId = 0;
|
||||
student.ClassId = 0;
|
||||
student.OrderNo = 0;
|
||||
}
|
||||
}
|
||||
@ -206,5 +219,374 @@ namespace VOL.Business.Services.SportsHall
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入运动馆学生体测成绩
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task SportsHallImportStudentsTestData(IFormFile file)
|
||||
{
|
||||
if (file == null || file.Length <= 0)
|
||||
throw new Exception("操作失败");
|
||||
|
||||
List<SportsHallImportStudentsTestDataParam> dataObjects;
|
||||
|
||||
using (var fileStream = file.OpenReadStream())
|
||||
{
|
||||
dataObjects = Tool.ConvertExcelToList<SportsHallImportStudentsTestDataParam>(fileStream);
|
||||
}
|
||||
|
||||
var studentNos = dataObjects.Select(x => x.StudentNo).Distinct().ToList();
|
||||
|
||||
// 用一个查询一次性获取所有学生信息
|
||||
var students = await (from s in _studentRepository.DbContext.Set<S_Student>()
|
||||
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
|
||||
where c.SchoolCode.Equals(UserContext.Current.TenantId)
|
||||
select new
|
||||
{
|
||||
s.Id,
|
||||
s.Age,
|
||||
s.ClassId,
|
||||
c.ClassName,
|
||||
s.StudentName,
|
||||
GradeId = g.Id,
|
||||
g.GradeName,
|
||||
s.Sex,
|
||||
s.StudentNo
|
||||
}).ToListAsync();
|
||||
|
||||
// 将学生信息存入字典,快速查找
|
||||
var studentsDict = students.ToDictionary(x => x.StudentNo);
|
||||
|
||||
var entityList = new List<N_SportsTestValue>();
|
||||
|
||||
foreach (var data in dataObjects)
|
||||
{
|
||||
if (!studentsDict.TryGetValue(data.StudentNo, out var student))
|
||||
{
|
||||
throw new Exception($"未找到此编号为{data.StudentNo}的学生");
|
||||
}
|
||||
|
||||
var timeNow = Convert.ToDateTime(data.ScoreTime);
|
||||
|
||||
// 为每个学生添加多条体测数据
|
||||
if (data.BMIValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.BMI, student, timeNow));
|
||||
|
||||
if (data.Sit_And_ReachValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.Sit_And_Reach, student, timeNow));
|
||||
|
||||
if (data.VitalCapacityValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.VitalCapacity, student, timeNow));
|
||||
|
||||
if (data.OneMinuteJumpRopeValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.OneMinuteJumpRope, student, timeNow));
|
||||
|
||||
if (data.One_Minute_Sit_UpValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.One_Minute_Sit_Up, student, timeNow));
|
||||
|
||||
if (data.StandingLongJumpValue > 0)
|
||||
entityList.Add(await AddSportsHallEnumStudentsTestData(data, SportsTestItemType.StandingLongJump, student, timeNow));
|
||||
}
|
||||
|
||||
// 批量添加数据
|
||||
await _sportsTestResultRepository.AddRangeAsync(entityList);
|
||||
|
||||
// 一次性保存所有修改
|
||||
await _sportsTestResultRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task<N_SportsTestValue> AddSportsHallEnumStudentsTestData(SportsHallImportStudentsTestDataParam data, SportsTestItemType type, dynamic student, DateTime timeNow)
|
||||
{
|
||||
var entity = new N_SportsTestValue
|
||||
{
|
||||
TeacherId = 0,
|
||||
TeacherName = "",
|
||||
DataSource = DataSource.IOT,
|
||||
ScoreTime = timeNow,
|
||||
GradeId = student.GradeId,
|
||||
ClassId = student.ClassId,
|
||||
GradeName = student.GradeName,
|
||||
ClassName = student.ClassName,
|
||||
SchoolCode = UserContext.Current.TenantId,
|
||||
Sex = student.Sex,
|
||||
StudentNo = data.StudentNo,
|
||||
StudentName = student.StudentName,
|
||||
Creator = UserContext.Current.UserId,
|
||||
CreateDate = timeNow,
|
||||
IsDisplay = false
|
||||
};
|
||||
|
||||
int gradeId = student.GradeId;
|
||||
SexType sexType = student.Sex;
|
||||
|
||||
string sex = sexType == SexType.Male ? "男" : "女";
|
||||
|
||||
string typeStr = type.ToString();
|
||||
|
||||
// 根据测试项目类型设置对应的值
|
||||
if (type == SportsTestItemType.BMI)
|
||||
{
|
||||
entity.Value = data.BMIValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.BMIValue >= x.MinValue &&
|
||||
data.BMIValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
|
||||
}
|
||||
else if (type == SportsTestItemType.Sit_And_Reach)
|
||||
{
|
||||
entity.Value = data.Sit_And_ReachValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.Sit_And_ReachValue >= x.MinValue &&
|
||||
data.Sit_And_ReachValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
}
|
||||
else if (type == SportsTestItemType.VitalCapacity)
|
||||
{
|
||||
entity.Value = data.VitalCapacityValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.VitalCapacityValue >= x.MinValue &&
|
||||
data.VitalCapacityValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
}
|
||||
|
||||
else if (type == SportsTestItemType.OneMinuteJumpRope)
|
||||
{
|
||||
entity.Value = data.OneMinuteJumpRopeValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.OneMinuteJumpRopeValue >= x.MinValue &&
|
||||
data.OneMinuteJumpRopeValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
}
|
||||
else if (type == SportsTestItemType.One_Minute_Sit_Up)
|
||||
{
|
||||
entity.Value = data.One_Minute_Sit_UpValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.One_Minute_Sit_UpValue >= x.MinValue &&
|
||||
data.One_Minute_Sit_UpValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
}
|
||||
|
||||
else if (type == SportsTestItemType.StandingLongJump)
|
||||
{
|
||||
entity.Value = data.StandingLongJumpValue;
|
||||
|
||||
// 根据测试项目查找标准
|
||||
var standard = await _healthStandardsRepository.FindFirstAsync(x =>
|
||||
x.CategoryEnum.Equals(typeStr) &&
|
||||
x.GradeId == gradeId &&
|
||||
x.Sex == sexType &&
|
||||
data.StandingLongJumpValue >= x.MinValue &&
|
||||
data.StandingLongJumpValue < x.MaxValue
|
||||
);
|
||||
|
||||
if (standard != null)
|
||||
{
|
||||
entity.Score = standard.Score;
|
||||
entity.Rank = standard.Rank;
|
||||
}
|
||||
}
|
||||
|
||||
entity.CategoryEnum = type.ToString();
|
||||
entity.CategoryValue = (int)type;
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 运动馆体测成绩分页列表
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<PageDataDto<SportsHallStudentsTestModel>> GetSportsHallStudentsTestPageList(SportsHallStudentsTestParam paramDto)
|
||||
{
|
||||
var res = new PageDataDto<SportsHallStudentsTestModel>();
|
||||
|
||||
var query = _sportsTestResultRepository.DbContext.Set<N_SportsTestValue>()
|
||||
.Where(s => s.SchoolCode == UserContext.Current.TenantId);
|
||||
|
||||
// 条件过滤
|
||||
if (paramDto.StartTime.HasValue)
|
||||
query = query.Where(x => x.CreateDate >= paramDto.StartTime.Value);
|
||||
|
||||
if (paramDto.EndTime.HasValue)
|
||||
query = query.Where(x => x.CreateDate <= paramDto.EndTime.Value);
|
||||
|
||||
if (paramDto.ClassId.HasValue)
|
||||
query = query.Where(x => x.ClassId == paramDto.ClassId.Value);
|
||||
|
||||
if (paramDto.Sex.HasValue)
|
||||
query = query.Where(x => (int)x.Sex == paramDto.Sex);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(paramDto.ResultLevel))
|
||||
query = query.Where(x => x.Rank == paramDto.ResultLevel);
|
||||
|
||||
// ✅ 正确分组(去掉 Id)
|
||||
var groupedQuery = query.GroupBy(x => new
|
||||
{
|
||||
x.StudentNo,
|
||||
x.StudentName,
|
||||
x.Sex,
|
||||
x.ClassName,
|
||||
x.GradeName,
|
||||
x.ScoreTime,
|
||||
x.IsDisplay
|
||||
});
|
||||
|
||||
res.Total = await groupedQuery.CountAsync();
|
||||
|
||||
var list = await groupedQuery
|
||||
.Select(g => new SportsHallStudentsTestModel
|
||||
{
|
||||
// 👉 可以取组内任意一条的Id
|
||||
Id = g.Max(x => x.Id),
|
||||
|
||||
StudentNo = g.Key.StudentNo,
|
||||
StudentName = g.Key.StudentName,
|
||||
SexName = g.Key.Sex.GetDescription(),
|
||||
|
||||
GradeAndClass = g.Key.GradeName + "_" + g.Key.ClassName,
|
||||
|
||||
ScoreTime = g.Key.ScoreTime,
|
||||
IsDisplay = g.Key.IsDisplay,
|
||||
|
||||
// 👇 pivot(用 Max 比 FirstOrDefault 更稳)
|
||||
BMIValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.BMI)
|
||||
.Max(x => (float?)x.Value) ?? 0,
|
||||
|
||||
VitalCapacityValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.VitalCapacity)
|
||||
.Max(x => (float?)x.Value) ?? 0,
|
||||
|
||||
Sit_And_ReachValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.Sit_And_Reach)
|
||||
.Max(x => (float?)x.Value) ?? 0,
|
||||
|
||||
OneMinuteJumpRopeValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.OneMinuteJumpRope)
|
||||
.Max(x => (int?)x.Value) ?? 0,
|
||||
|
||||
One_Minute_Sit_UpValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.One_Minute_Sit_Up)
|
||||
.Max(x => (int?)x.Value) ?? 0,
|
||||
|
||||
StandingLongJumpValue = g.Where(x => x.CategoryValue == (int)SportsTestItemType.StandingLongJump)
|
||||
.Max(x => (float?)x.Value) ?? 0
|
||||
})
|
||||
.OrderByDescending(x => x.ScoreTime)
|
||||
.Skip((paramDto.PageIndex - 1) * paramDto.PageSize)
|
||||
.Take(paramDto.PageSize)
|
||||
.ToListAsync();
|
||||
|
||||
res.Datas = list;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成绩推送
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task ScorePush(SportsHallStudentsTestParam paramDto)
|
||||
{
|
||||
var sql = new StringBuilder();
|
||||
sql.Append("UPDATE N_SportsTestValue SET IsDisplay = 1 WHERE SchoolCode = {0} ");
|
||||
|
||||
var parameters = new List<object>
|
||||
{
|
||||
UserContext.Current.TenantId
|
||||
};
|
||||
|
||||
if (paramDto.StartTime.HasValue)
|
||||
{
|
||||
sql.Append(" AND CreateDate >= {1} ");
|
||||
parameters.Add(paramDto.StartTime.Value);
|
||||
}
|
||||
|
||||
if (paramDto.EndTime.HasValue)
|
||||
{
|
||||
sql.Append(" AND CreateDate <= {2} ");
|
||||
parameters.Add(paramDto.EndTime.Value);
|
||||
}
|
||||
|
||||
if (paramDto.ClassId > 0)
|
||||
{
|
||||
sql.Append(" AND ClassId = {3} ");
|
||||
parameters.Add(paramDto.ClassId.Value);
|
||||
}
|
||||
|
||||
if (paramDto.Sex > 0)
|
||||
{
|
||||
sql.Append(" AND Sex = {4} ");
|
||||
parameters.Add(paramDto.Sex.Value);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(paramDto.ResultLevel))
|
||||
{
|
||||
sql.Append(" AND Rank = {5} ");
|
||||
parameters.Add(paramDto.ResultLevel);
|
||||
}
|
||||
|
||||
await _sportsTestResultRepository.DbContext.Database
|
||||
.ExecuteSqlRawAsync(sql.ToString(), parameters.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +152,5 @@ namespace VOL.Model
|
||||
/// </summary>
|
||||
[Display(Name = "引体向上")]
|
||||
public int Pull_UpValue { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
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 SportsHallImportStudentsTestDataParam
|
||||
{
|
||||
/// <summary>
|
||||
///学号
|
||||
/// </summary>
|
||||
[Display(Name = "学号")]
|
||||
public string StudentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[Display(Name = "姓名")]
|
||||
|
||||
public string StudentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///年级Id
|
||||
/// </summary>
|
||||
[Display(Name = "年级Id")]
|
||||
public int GradeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///性别
|
||||
/// </summary>
|
||||
[Display(Name = "性别")]
|
||||
public string SexName { 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; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试时间
|
||||
/// </summary>
|
||||
[Display(Name = "测试时间")]
|
||||
public string ScoreTime { get; set; }
|
||||
}
|
||||
}
|
||||
39
VOL.Model/School/Request/SportsHallStudentsTestParam.cs
Normal file
39
VOL.Model/School/Request/SportsHallStudentsTestParam.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VOL.Model.School.Request
|
||||
{
|
||||
/// <summary>
|
||||
/// 运动馆体测成绩查询
|
||||
/// </summary>
|
||||
public class SportsHallStudentsTestParam : PageDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 班级Id
|
||||
/// </summary>
|
||||
public int? ClassId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public int? Sex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
public string? ResultLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
95
VOL.Model/School/Response/SportsHallStudentsTestModel.cs
Normal file
95
VOL.Model/School/Response/SportsHallStudentsTestModel.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VOL.Model.School.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// 运动馆体测成绩查询
|
||||
/// </summary>
|
||||
public class SportsHallStudentsTestModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///学号
|
||||
/// </summary>
|
||||
[Display(Name = "学号")]
|
||||
public string StudentNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[Display(Name = "姓名")]
|
||||
|
||||
public string StudentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///年级班级
|
||||
/// </summary>
|
||||
[Display(Name = "年级班级")]
|
||||
public string GradeAndClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///性别
|
||||
/// </summary>
|
||||
[Display(Name = "性别")]
|
||||
public string SexName { 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; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试时间
|
||||
/// </summary>
|
||||
[Display(Name = "测试时间")]
|
||||
public DateTime ScoreTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示
|
||||
/// </summary>
|
||||
[Display(Name = "是否显示")]
|
||||
public bool IsDisplay { get; set; }
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,6 @@ namespace VOL.WebApi.Controllers.Business
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 学生成绩分页
|
||||
/// </summary>
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Business.IServices.School;
|
||||
using VOL.Business.IServices.SportsHall;
|
||||
using VOL.Business.Services.School;
|
||||
using VOL.Core.Filters;
|
||||
using VOL.Model;
|
||||
using VOL.Model.School.Request;
|
||||
using VOL.Model.School.Response;
|
||||
using VOL.Model.SportsHall;
|
||||
|
||||
namespace VOL.WebApi.Controllers.SportsHall
|
||||
@ -50,5 +53,43 @@ namespace VOL.WebApi.Controllers.SportsHall
|
||||
await _sportsHallService.ModifyClass(paramDto);
|
||||
return Ok("更新成功");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导入运动馆学生体测数据
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
[HttpPost(nameof(SportsHallImportStudentsTestData))]
|
||||
public async Task<ActionResult> SportsHallImportStudentsTestData(IFormFile file)
|
||||
{
|
||||
await _sportsHallService.SportsHallImportStudentsTestData(file);
|
||||
return Ok("导入成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 运动馆体测成绩分页列表
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet(nameof(GetSportsHallStudentsTestPageList))]
|
||||
public async Task<PageDataDto<SportsHallStudentsTestModel>> GetSportsHallStudentsTestPageList(SportsHallStudentsTestParam paramDto)
|
||||
{
|
||||
return await _sportsHallService.GetSportsHallStudentsTestPageList(paramDto);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成绩推送
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost(nameof(ScorePush))]
|
||||
public async Task<ActionResult> ScorePush([FromBody] SportsHallStudentsTestParam paramDto)
|
||||
{
|
||||
await _sportsHallService.ScorePush(paramDto);
|
||||
return Ok("推送成功");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user