This commit is contained in:
tanglong 2026-01-07 14:49:02 +08:00
parent 922cd4beca
commit 09ddbc0005
23 changed files with 40 additions and 35 deletions

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f9f4a53c41a5029c82bfb442fd4e2b9f2980218f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+922cd4beca32dd7110c41a523d23b114176a3a0b")]
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Commons")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
74c4dd81c8aa3b83c88922809ca51fe25d7816fdf64b1c08a9bf0d7628572ab1
f98fc273dcd7d743144a77bbe89c38aafb9c6660ae1cf7e7ea16bcac6dd155ec

View File

@ -19,7 +19,7 @@ namespace YD_XinWei.Api
{
serverOptions.Limits.MaxRequestBodySize = 10485760;
});
webBuilder.UseKestrel().UseUrls("http://*:9995");
webBuilder.UseKestrel().UseUrls("http://*:9994");
webBuilder.UseIIS();
webBuilder.UseStartup<Startup>();
}).UseServiceProviderFactory(new AutofacServiceProviderFactory());

View File

@ -166,39 +166,44 @@ namespace YD_XinWei.Api.Services.Impl
.ToList();
var projectResults = sportsTestData
.GroupBy(x => x.CategoryValue)
.Select(g => new ItemDataDto
{
CategoryValue = g.Key,
.GroupBy(x => x.CategoryValue)
.Select(g => new ItemDataDto
{
CategoryValue = g.Key,
// 优良率计算:分数 > 80 的人数 ÷ 总人数
ExcellentRate = (int)Math.Round(sportsTestData.Count(x => x.CategoryValue == g.Key && x.Score > 80) * 100.0 / Math.Max(sportsTestData.Count(x => x.CategoryValue == g.Key), 1), MidpointRounding.AwayFromZero),
// 优良率计算:分数 > 80 的人数 ÷ 总人数
ExcellentRate = (int)Math.Round(
sportsTestData.Count(x => x.CategoryValue == g.Key && x.Score > 80) * 100.0 /
Math.Max(sportsTestData.Count(x => x.CategoryValue == g.Key), 1),
MidpointRounding.AwayFromZero
),
// 男生前十名
MaleRankList = g.Where(x => x.Sex == 1)
.OrderByDescending(x => x.Value)
.Take(10)
.Select((x, index) => new StudentScoreRankingDto
{
Rank = index + 1,
StudentNo = x.StudentNo,
StudentName = x.StudentName,
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
}).ToList(),
// 男生前十名
MaleRankList = (g.Where(x => x.Sex == 1)
.OrderBy(x => g.Key == 3 ? x.Value : -x.Value) // 条件排序
.Take(10)
.Select((x, index) => new StudentScoreRankingDto
{
Rank = index + 1,
StudentNo = x.StudentNo,
StudentName = x.StudentName,
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
})).ToList(),
// 女生前十名
FemaleRankList = (g.Where(x => x.Sex == 2)
.OrderBy(x => g.Key == 3 ? x.Value : -x.Value) // 条件排序
.Take(10)
.Select((x, index) => new StudentScoreRankingDto
{
Rank = index + 1,
StudentNo = x.StudentNo,
StudentName = x.StudentName,
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
})).ToList()
})
.ToList();
// 女生前十名
FemaleRankList = g.Where(x => x.Sex == 2)
.OrderByDescending(x => x.Value)
.Take(10)
.Select((x, index) => new StudentScoreRankingDto
{
Rank = index + 1,
StudentNo = x.StudentNo,
StudentName = x.StudentName,
Value = x.CategoryValue == 1 ? $"{x.Height}cm/{x.Weight}kg" : $"{x.Value}{((SportsTestItemType)x.CategoryValue).GetUnit()}"
}).ToList()
})
.ToList();
res.ItemDatalist = projectResults;

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("YD_XinWei.Api")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f9f4a53c41a5029c82bfb442fd4e2b9f2980218f")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+922cd4beca32dd7110c41a523d23b114176a3a0b")]
[assembly: System.Reflection.AssemblyProductAttribute("YD_XinWei.Api")]
[assembly: System.Reflection.AssemblyTitleAttribute("YD_XinWei.Api")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
3ee2a4997ca5a7a114829a3edd61a9285483441b9edac8b0338989a7c9e658a8
7e5321acb1dd2df00cdf92241817af42b08287146feb91b5a34d93b70138def9