From a7c7a60dcb414c0a831824d4ad2061eca7768473 Mon Sep 17 00:00:00 2001
From: dyy <807692433@qq.com>
Date: Thu, 31 Mar 2022 12:11:29 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E5=85=A8?=
=?UTF-8?q?=E9=99=A2=E5=AD=A6=E6=A0=A1=E6=88=90=E7=BB=A9=E6=9F=A5=E7=9C=8B?=
=?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E4=B8=93=E4=B8=9A=E6=8E=92=E5=90=8D?=
=?UTF-8?q?=E5=88=97=E3=80=81=E7=8F=AD=E7=BA=A7=E6=8E=92=E5=90=8D=E5=88=97?=
=?UTF-8?q?=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Controllers/StuScoreController.cs | 6 +-
.../Views/StuScore/AllStuScoreQueryIndex.js | 21 ++++---
.../StuScore/StuScoreEntity.cs | 15 +++++
.../StuScore/StuScoreService.cs | 61 +++++++++++++++++--
4 files changed, 89 insertions(+), 14 deletions(-)
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs
index d5e16926b..a6bc47fdc 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreController.cs
@@ -731,12 +731,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
///
[HttpGet]
[AjaxOnly]
- public ActionResult GetScoreListByStuNo2(string queryJson)
+ public ActionResult GetScoreListByStuInfo(string queryJson)
{
- var data = stuScoreIBLL.GetScoreListByStuNo(queryJson);
+ var data = stuScoreIBLL.GetScoreListByStuInfo(queryJson);
if (data.Any())
{
- data = data.OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonNo);
+ data = data.OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x=>x.LessonSortNo).ThenBy(x => x.LessonNo);
}
return Success(data);
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/AllStuScoreQueryIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/AllStuScoreQueryIndex.js
index 48543e2f5..7ccca94d8 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/AllStuScoreQueryIndex.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/AllStuScoreQueryIndex.js
@@ -53,15 +53,22 @@ var bootstrap = function ($, learun) {
},
initGird: function () {
$('#gridtable').lrAuthorizeJfGridLei({
- url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetScoreListByStuNo2',
+ url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetScoreListByStuInfo',
headData: [
{ label: '学号', name: 'StuNo', width: 100, align: "left" },
- { label: '姓名', name: 'StuName', width: 100, align: "left" },
- { label: '学年', name: 'AcademicYearNo', width: 100, align: "left" },
- { label: '学期', name: 'Semester', width: 100, align: "left" },
- { label: '课程编号', name: 'LessonNo', width: 100, align: "left" },
- { label: '课程名称', name: 'LessonName', width: 200, align: "left" },
- { label: '总分', name: 'ScoreFormat', width: 100, align: "left" },
+ { label: '姓名', name: 'StuName', width: 150, align: "left" },
+ { label: '专业', name: 'MajorName', width: 100, align: "left" },
+ { label: '班级', name: 'ClassName', width: 100, align: "left" },
+ { label: '学年', name: 'AcademicYearNo', width: 50, align: "left" },
+ { label: '学期', name: 'Semester', width: 50, align: "left" },
+ { label: '科目类型', name: 'LessonSortName', width: 60, align: "left" },
+ { label: '科目', name: 'LessonName', width: 200, align: "left" },
+ { label: '学分', name: 'StudyScore', width: 50, align: "left" },
+ { label: '成绩', name: 'Score', width: 100, align: "left" },
+ { label: '第一次补考成绩', name: 'ScoreOfNotPass', width: 100, align: "left" },
+ { label: '第二次补考成绩', name: 'ScoreOfNotPassTwo', width: 100, align: "left" },
+ { label: '专业排名', name: 'RankInMajor', width: 100, align: "left" },
+ { label: '班级排名', name: 'RankInClass', width: 100, align: "left" },
],
mainId: 'StuNo',
isPage: false,
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs
index 8946527f4..4be5477b3 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreEntity.cs
@@ -409,6 +409,21 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration
///
[NotMapped]
public string LessonSortName { get; set; }
+ ///
+ /// 专业名称
+ ///
+ [NotMapped]
+ public string MajorName { get; set; }
+ ///
+ /// 专业排名
+ ///
+ [NotMapped]
+ public int RankInMajor { get; set; }
+ ///
+ /// 班级排名
+ ///
+ [NotMapped]
+ public int RankInClass { get; set; }
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs
index e0d7ba8e7..a1c5524e5 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreService.cs
@@ -1896,9 +1896,9 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
tableName = queryParam["TableName"].ToString();
}
var strSql = new StringBuilder();
- strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,li.StudyScore,ls.LessonSortName,bb.Score,sp.Score as ScoreOfNotPass,spt.Score as ScoreOfNotPassTwo ");
+ strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,bb.MajorNo,bb.ClassNo,li.StudyScore,ls.LessonSortName,bb.Score,sp.Score as ScoreOfNotPass,spt.Score as ScoreOfNotPassTwo,cm.MajorName,ci.ClassName ");
strSql.Append(" from ( ");
- strSql.Append($"select s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,Max(s.Score) as Score from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo ");
+ strSql.Append($"select s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo,Max(s.Score) as Score from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo ");
strSql.Append(" where 1=1 and s.CheckMark='1' ");
if (!queryParam["AcademicYearNo"].IsEmpty())
{
@@ -1920,13 +1920,66 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad
dp.Add("StuName", queryParam["StuName"].ToString(), DbType.String);
strSql.Append(" and s.StuName=@StuName ");
}
- strSql.Append(" group by s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName ) as bb ");
+ strSql.Append(" group by s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo ) as bb ");
strSql.Append(" left join StuScoreNotPass sp on bb.AcademicYearNo=sp.AcademicYearNo and bb.Semester=sp.Semester and bb.LessonSortNo=sp.LessonSortNo and bb.LessonNo=sp.LessonNo and bb.LessonName=sp.LessonName and bb.StuNo=sp.StuNo and sp.CheckMark = '1' ");
strSql.Append(" left join StuScoreNotPassTwo spt on bb.AcademicYearNo=spt.AcademicYearNo and bb.Semester=spt.Semester and bb.LessonSortNo=spt.LessonSortNo and bb.LessonNo=spt.LessonNo and bb.LessonName=spt.LessonName and bb.StuNo=spt.StuNo and spt.CheckMark = '1' ");
strSql.Append(" left join CdLessonSort ls on bb.LessonSortNo= ls.LessonSortNo ");
strSql.Append(" left join LessonInfo li on bb.LessonNo= li.LessonNo and li.CheckMark='1' ");
+ strSql.Append(" left join CdMajor cm on bb.MajorNo= cm.MajorNo and cm.CheckMark='1' ");
+ strSql.Append(" left join ClassInfo ci on bb.ClassNo= ci.ClassNo and ci.CheckMark='1' ");
- return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp);
+ var result = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp);
+
+ //计算专业排名,班级排名
+ if (result.Any())
+ {
+ var temp = result.GroupBy(x=>new { x.AcademicYearNo,x.Semester}).Select(x => new StuScoreEntity()
+ {
+ AcademicYearNo=x.Key.AcademicYearNo,
+ Semester=x.Key.Semester,
+ StuNo=x.FirstOrDefault().StuNo,
+ ClassNo=x.FirstOrDefault().ClassNo,
+ MajorNo=x.FirstOrDefault().MajorNo
+ }).ToList();
+ if (temp.Any())
+ {
+ foreach (var item in temp)
+ {
+ //专业排名
+ var ml = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == item.AcademicYearNo && x.Semester == item.Semester && x.LessonSortNo == "1" && x.MajorNo == item.MajorNo && x.CheckMark == "1");
+ var mlGroup = ml.GroupBy(x => x.StuNo).Select(x => new
+ {
+ StuNo = x.Key,
+ TotalScore = x.Select(y => y.Score).Sum()
+ }).OrderByDescending(x => x.TotalScore);
+ if (mlGroup.Any())
+ {
+ var rank = mlGroup.Select(x => x.StuNo).ToList().IndexOf(item.StuNo);
+ item.RankInMajor = rank + 1;
+ }
+ //班级排名
+ var cl = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == item.AcademicYearNo && x.Semester == item.Semester && x.LessonSortNo == "1" && x.ClassNo == item.ClassNo && x.CheckMark == "1");
+ var clGroup = cl.GroupBy(x => x.StuNo).Select(x => new
+ {
+ StuNo = x.Key,
+ TotalScore = x.Select(y => y.Score).Sum()
+ }).OrderByDescending(x => x.TotalScore);
+ if (clGroup.Any())
+ {
+ var rank = clGroup.Select(x => x.StuNo).ToList().IndexOf(item.StuNo);
+ item.RankInClass = rank + 1;
+ }
+ }
+ }
+ foreach (var ii in result)
+ {
+ ii.RankInMajor = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInMajor;
+ ii.RankInClass = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankInClass;
+ }
+
+ }
+
+ return result;
}
catch (Exception ex)
{