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 07d0b303b..31ee5c1b8 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 @@ -121,6 +121,15 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return View(); } /// + /// 全院班级成绩查看页面 + /// + /// + [HttpGet] + public ActionResult StuScoreRank() + { + return View(); + } + /// /// 新版成绩录入 /// /// @@ -855,6 +864,23 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers return Success(data); } + /// + /// 学生成绩排名 + /// + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetScoreListRank(string queryJson) + { + var data = stuScoreIBLL.GetScoreListRank(queryJson); + if (data.Any()) + { + data = data.OrderByDescending(x => x.AcademicYearNo).ThenByDescending(x => x.Semester).ThenBy(x => x.LessonSortNo).ThenBy(x => x.LessonNo); + } + return Success(data); + } + public ActionResult GetScoreCharts(string AcademicYearNo, string Semester, string ClassNo, string LessonNo) { var data = stuScoreIBLL.GetScoreCharts(AcademicYearNo, Semester, ClassNo, LessonNo); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.cshtml new file mode 100644 index 000000000..577aaaf8a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.cshtml @@ -0,0 +1,50 @@ +@{ ViewBag.Title = "全院学生成绩查看"; Layout = "~/Views/Shared/_Index.cshtml"; } + +
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ + 0 +
+
+
+
+ + 0 +
+
+
+
+  打印 +
+
+ +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.js") \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.js new file mode 100644 index 000000000..7576ef0c9 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScore/StuScoreRank.js @@ -0,0 +1,126 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-06-14 11:02 + * 描 述:全院学生成绩查看 + */ +var selectedRow; +var refreshGirdData; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.bind(); + page.bindSelect(); + }, + bind: function () { + // 查询 + $('#btn_Search').on('click', function () { + var p = {}; + p.AcademicYearNo = $('#AcademicYearNo').lrselectGet(); + p.Semester = $('#Semester').lrselectGet(); + p.StuNo = $.trim($('#StuNo').val()); + if (p.StuNo == null || p.StuNo == "") { + learun.alert.warning("请输入学号!"); + return; + } + + page.initGird(); + page.search(p); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //打印 + $('#lr_print').on('click', function () { + var AcademicYearNo = $('#AcademicYearNo').lrselectGet(); + var Semester = $('#Semester').lrselectGet(); + var StuNo = $.trim($('#StuNo').val()); + if (StuNo == null || StuNo == "") { + learun.alert.warning("请输入学号!"); + return; + } + learun.layerForm({ + id: 'AllStuScoreQueryPrint', + title: '学生成绩单', + url: top.$.rootUrl + '/EducationalAdministration/StuScore/AllStuScoreQueryPrint?StuNo=' + StuNo + '&AcademicYearNo=' + AcademicYearNo + '&Semester=' + Semester, + width: 1200, + height: 800, + btn: null + }); + }); + }, + bindSelect: function () { + //学年 + $('#AcademicYearNo').lrselect({ + placeholder: "请选择学年", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetAcademicYearNoData', + value: 'value', + text: 'text' + }); + //学期 + $('#Semester').lrselect({ + placeholder: "请选择学期", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData', + value: 'value', + text: 'text' + }); + }, + initGird: function () { + $('#gridtable').lrAuthorizeJfGridLei({ + url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetScoreListRank', + headData: [ + { label: '学号', name: 'StuNo', width: 100, align: "left" }, + { label: '姓名', name: 'StuName', width: 200, 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: 'LessonTypeName', width: 100, align: "left" }, + { label: '科目', name: 'LessonName', width: 300, 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" }, + { label: '系排名', name: 'RankIndept', width: 100, align: "left" }, + ], + mainId: 'StuNo', + isPage: false, + sidx: '', + sord: '', + onRenderComplete: function (data) { + var studyscoreall = 0; + var studyscore = 0; + for (var i = 0; i < data.length; i++) { + if (!!data[i].LessonSortNo && data[i].LessonSortNo == "1") { + if (!!data[i].StudyScore) { + studyscoreall += data[i].StudyScore; + } + } + if (!!data[i].Score && data[i].Score >= 60) { + studyscore += data[i].StudyScore; + } + } + $("#spanstudyscoreall").html(studyscoreall + 10); + $("#spanstudyscore").html(studyscore); + } + }); + + //page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + page.search(); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index becfc810e..6f33b265c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1044,6 +1044,7 @@ + @@ -8296,6 +8297,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs index 4c6b10392..17bc7e65d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreBLL.cs @@ -782,6 +782,30 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListRank(string queryJson) + { + try + { + return stuScoreService.GetScoreListRank(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetStuGraduateInfo(string queryJson) { try 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 e261630d5..736a66358 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 @@ -440,6 +440,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [NotMapped] public int RankInMajor { get; set; } /// + /// 系排名 + /// + [NotMapped] + public int RankIndept { get; set; } + /// /// 班级排名 /// [NotMapped] diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs index 4d9020b34..08317fcce 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScore/StuScoreIBLL.cs @@ -192,6 +192,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// IEnumerable GetScoreListByStuInfo(string queryJson); + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + IEnumerable GetScoreListRank(string queryJson); + /// /// 获取个人成绩列表 /// 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 793e7669f..0d8c88027 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 @@ -2339,6 +2339,139 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad } } + + /// + /// 根据学号/姓名获取学生成绩列表 + /// + /// + /// + public IEnumerable GetScoreListRank(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + var tableName = "StuScore"; + if (!queryParam["TableName"].IsEmpty()) + { + 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,bb.MajorNo,bb.ClassNo,bb.DeptNo,li.StudyScore,ls.LessonSortName,lt.LessonTypeName,bb.Score,(case when sp.Score>=60 then 60 else sp.score end) as ScoreOfNotPass,(case when spt.Score>=60 then 60 else spt.Score end) 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,s.MajorNo,s.ClassNo,s.DeptNo,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()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" and s.AcademicYearNo=@AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" and s.Semester=@Semester "); + } + if (!queryParam["StuNo"].IsEmpty()) + { + dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); + strSql.Append(" and s.StuNo=@StuNo "); + } + if (!queryParam["StuName"].IsEmpty()) + { + 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,s.MajorNo,s.ClassNo,s.DeptNo ) 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' "); + strSql.Append(" left join CdLessonType lt on li.LessonTypeId=lt.ltid and lt.LTEnabled='1' "); + + 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, + DeptNo = x.FirstOrDefault().DeptNo, + }).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; + } + //系排名 + var dl = this.BaseRepository("CollegeMIS").FindList(x => x.AcademicYearNo == item.AcademicYearNo && x.Semester == item.Semester && x.LessonSortNo == "1" && x.DeptNo == item.DeptNo && x.CheckMark == "1"); + var dlGroup = dl.GroupBy(x => x.StuNo).Select(x => new + { + StuNo = x.Key, + TotalScore = x.Select(y => y.Score).Sum() + }).OrderByDescending(x => x.TotalScore); + if (dlGroup.Any()) + { + var rank = dlGroup.Select(x => x.StuNo).ToList().IndexOf(item.StuNo); + item.RankIndept = 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; + ii.RankIndept = temp.FirstOrDefault(x => x.AcademicYearNo == ii.AcademicYearNo && x.Semester == ii.Semester).RankIndept; + } + + } + + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 成绩导入--必修课 选修课 ///