From 733cb571f8af3c259c71b4c9a10b4fb6a4a9de79 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Thu, 30 Jun 2022 14:20:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E8=AF=84?= =?UTF-8?q?=E6=95=99=E7=AE=A1=E7=90=86=EF=BC=9A=E5=AD=A6=E7=94=9F=E8=AF=84?= =?UTF-8?q?=E6=95=99=E6=83=85=E5=86=B5=E3=80=81=E6=95=99=E5=B8=88=E8=A2=AB?= =?UTF-8?q?=E8=AF=84=E6=83=85=E5=86=B5=E5=8A=A0=E8=BD=BD=E6=85=A2=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Eval_MainController.cs | 7 +- .../Views/Eval_Main/AnswerIndex.js | 6 +- .../EvaluationTeach/Eval_Main/Eval_MainBLL.cs | 24 ++++ .../Eval_Main/Eval_MainIBLL.cs | 9 ++ .../Eval_Main/Eval_MainService.cs | 117 ++++++++++++++++-- .../Eval_QuestionResultEntity.cs | 20 ++- 6 files changed, 164 insertions(+), 19 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs index 3d73333ec..10130448b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs @@ -182,7 +182,7 @@ namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers [AjaxOnly] public ActionResult GetTeacherIndexPageList(string pagination, string queryJson) { - var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson); + var data = ask_MainIBLL.GetTeacherIndexPageList2(null, queryJson); return Success(data); } @@ -190,7 +190,7 @@ namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers [AjaxOnly] public ActionResult GetTeacherIndexPageList2(string pagination, string queryJson) { - var data = ask_MainIBLL.GetTeacherIndexPageList(null, queryJson); + var data = ask_MainIBLL.GetTeacherIndexPageList2(null, queryJson); var data2 = data.GroupBy(x => x.EmpNo).Select(x => new Eval_QuestionResultEntity() { @@ -199,7 +199,8 @@ namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers LessonNo = String.Join(",", x.Select(y => y.LessonNo).ToArray()), StudentCount = x.Select(y => y.StudentCount).Sum(), EvalCount = x.Select(y => y.EvalCount).Sum(), - AverageScore = x.Select(y => y.AverageScore).Sum() + EvalTotalScore = x.Select(y => y.EvalTotalScore).Sum(), + AverageScore = x.Select(y => y.EvalCount).Sum() > 0 ? Math.Round((x.Select(y => y.EvalTotalScore).Sum() / x.Select(y => y.EvalCount).Sum()).ToDecimal(), 2, MidpointRounding.AwayFromZero) : 0 }); return Success(data2); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js index 866dbf297..99413464d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js @@ -116,7 +116,7 @@ var bootstrap = function ($, learun) { }, { label: "教师", name: "EmpName", width: 80, align: "left" }, { - label: "课程", name: "LessonName", width: 150, align: "left", formatter: function (cellvalue, row) { + label: "课程", name: "LessonName", width: 200, align: "left", formatter: function (cellvalue, row) { return cellvalue + "(" + row.LessonNo + ")"; } }, @@ -128,7 +128,9 @@ var bootstrap = function ($, learun) { { label: "得分", name: "IScore", width: 80, align: "left" } ], mainId: 'StuNo', - isPage: true + isPage: true, + sidx: 'LessonNo,StuNo', + sord:'asc' }); page.search(); }, diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs index e8fbd7078..856e59034 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs @@ -253,6 +253,30 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach } } } + /// + /// 评教:按教师、课程统计上课人数、评教人数、评教平均分 + /// + /// + /// + /// + public IEnumerable GetTeacherIndexPageList2(Pagination paginationobj, string queryJson) + { + try + { + return ask_MainService.GetTeacherIndexPageList2(paginationobj, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs index dffb738f1..4c155b3c2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs @@ -56,5 +56,14 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach IEnumerable GetAnswerPageList(Pagination paginationobj, string queryJson); IEnumerable GetTeacherIndexPageList(Pagination paginationobj, string queryJson); + /// + /// 评教:按教师、课程统计上课人数、评教人数、评教平均分 + /// + /// + /// + /// + IEnumerable GetTeacherIndexPageList2(Pagination paginationobj, string queryJson); + + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs index 90d3a1151..831652470 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs @@ -344,17 +344,43 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach var queryParam = queryJson.ToJObject(); var dp = new DynamicParameters(new { }); var strSql = new StringBuilder(); - strSql.Append("select aa.*,bb.UID,cc.EmpName,dd.LessonName,ee.StuName,ee.DeptNo,ee.MajorNo,ee.ClassNo,ff.Iscore from (select a.LessonNo,a.EmpNo,a.AcademicYearNo,a.Semester,b.VID,a.StuNo from " + misdbname + ".dbo.StuSelectLessonList a "); - strSql.Append("left join Eval_Main b on a.AcademicYearNo=b.AcademicYearNo and a.Semester=b.Semester where b.Status=1 ) aa "); - strSql.Append("left join (select distinct b.EmpNo, b.LessonNo, b.UID from Eval_Question a left join Eval_QuestionResult b on a.QID=b.QID) bb on aa.EmpNo=bb.EmpNo and aa.LessonNo=bb.LessonNo and aa.StuNo=bb.UID "); - strSql.Append("left join " + misdbname + ".dbo.EmpInfo cc on aa.EmpNo=cc.EmpNo left join " + misdbname + ".dbo.LessonInfo dd on aa.LessonNo = dd.LessonNo "); - strSql.Append("left join " + misdbname + ".dbo.StuInfoBasic ee on aa.StuNo=ee.StuNo "); - strSql.Append(@" left join ( - select sum(IScore) as IScore, EmpNo, LessonNo, UID from Eval_QuestionResult a left - join Eval_QuestionItems b on a.IID = b.IID - group by EmpNo, LessonNo, UID - ) ff on bb.UID = ff.UID and bb.EmpNo = ff.EmpNo and bb.LessonNo = ff.LessonNo "); - strSql.Append(" where aa.VID='" + queryParam["VID"] + "'"); + //strSql.Append("select aa.*,bb.UID,cc.EmpName,dd.LessonName,ee.StuName,ee.DeptNo,ee.MajorNo,ee.ClassNo,ff.Iscore from (select a.LessonNo,a.EmpNo,a.AcademicYearNo,a.Semester,b.VID,a.StuNo from " + misdbname + ".dbo.StuSelectLessonList a "); + //strSql.Append("left join Eval_Main b on a.AcademicYearNo=b.AcademicYearNo and a.Semester=b.Semester where b.Status=1 ) aa "); + //strSql.Append("left join (select distinct b.EmpNo, b.LessonNo, b.UID from Eval_Question a left join Eval_QuestionResult b on a.QID=b.QID) bb on aa.EmpNo=bb.EmpNo and aa.LessonNo=bb.LessonNo and aa.StuNo=bb.UID "); + //strSql.Append("left join " + misdbname + ".dbo.EmpInfo cc on aa.EmpNo=cc.EmpNo left join " + misdbname + ".dbo.LessonInfo dd on aa.LessonNo = dd.LessonNo "); + //strSql.Append("left join " + misdbname + ".dbo.StuInfoBasic ee on aa.StuNo=ee.StuNo "); + //strSql.Append(@" left join ( + //select sum(IScore) as IScore, EmpNo, LessonNo, UID from Eval_QuestionResult a left + // join Eval_QuestionItems b on a.IID = b.IID + //group by EmpNo, LessonNo, UID + // ) ff on bb.UID = ff.UID and bb.EmpNo = ff.EmpNo and bb.LessonNo = ff.LessonNo "); + //strSql.Append(" where aa.VID='" + queryParam["VID"] + "'"); + + strSql.Append(@" +select aa.LessonNo,aa.EmpNo,aa.AcademicYearNo,aa.Semester,aa.VID,aa.StuNo,bb.IScore,bb.UID,cc.EmpName,dd.LessonName,ee.StuName,ee.DeptNo,ee.MajorNo,ee.ClassNo +from +( +select a.LessonNo,a.EmpNo,a.AcademicYearNo,a.Semester,b.VID,a.StuNo +from " + misdbname + @".dbo.StuSelectLessonList a +left join Eval_Main b on a.AcademicYearNo=b.AcademicYearNo and a.Semester=b.Semester +where b.Status=1 and b.VID='" + queryParam["VID"] + @"' +and a.StuNo is not null and a.StuNo <> '' +) aa +left join +( +select sum(b.IScore) as IScore, a.EmpNo, a.LessonNo, a.UID +from Eval_QuestionResult a +left join Eval_QuestionItems b on a.IID = b.IID +left join Eval_Question c on a.QID=c.QID +where c.VID='" + queryParam["VID"] + @"' +and a.EmpNo is not null and a.EmpNo <> '' and a.LessonNo is not null and a.LessonNo <> '' and a.UID is not null and a.UID <> '' +group by a.EmpNo, a.LessonNo, a.UID +) bb +on aa.EmpNo=bb.EmpNo and aa.LessonNo=bb.LessonNo and aa.StuNo=bb.UID +left join " + misdbname + @".dbo.EmpInfo cc on aa.EmpNo=cc.EmpNo +left join " + misdbname + @".dbo.LessonInfo dd on aa.LessonNo = dd.LessonNo +left join " + misdbname + @".dbo.StuInfoBasic ee on aa.StuNo = ee.StuNo +where 1=1 "); if (!queryParam["StuNo"].IsEmpty()) { @@ -396,7 +422,7 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach else //多课程 { //dp.Add("LessonNo", "(" + queryParam["LessonNo"].ToString() + ")", DbType.String); - strSql.Append(" AND aa.LessonNo in (" + queryParam["LessonNo"].ToString() + ") "); + //strSql.Append(" AND aa.LessonNo in (" + queryParam["LessonNo"].ToString() + ") "); } } @@ -477,5 +503,72 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach } } } + /// + /// 评教:按教师、课程统计上课人数、评教人数、评教平均分 + /// + /// + /// + /// + public IEnumerable GetTeacherIndexPageList2(Pagination paginationobj, string queryJson) + { + try + { + //取库名 + var misdbname = BaseRepository("CollegeMIS").getDbConnection().Database; + var queryParam = queryJson.ToJObject(); + var strSql = new StringBuilder(); + strSql.Append(@" +select ee.*,ss.*,cc.EmpName,dd.LessonName from +( +select a.LessonNo,a.EmpNo,count(a.StuNo) as StudentCount +from " + misdbname + @".dbo.StuSelectLessonList a +left join Eval_Main b on a.AcademicYearNo=b.AcademicYearNo and a.Semester=b.Semester +where b.Status=1 and b.VID='" + queryParam["VID"] + @"' +and a.StuNo is not null and a.StuNo <> '' +group by a.LessonNo,a.EmpNo +) ss +left join +( +select aa.EmpNo,aa.LessonNo,sum(aa.IScore) as EvalTotalScore,count(aa.UID) as EvalCount,Convert(decimal(18,2),sum(aa.IScore)/count(aa.UID)) as AverageScore from +( +select sum(b.IScore) as IScore, a.EmpNo, a.LessonNo, a.UID +from Eval_QuestionResult a +left join Eval_QuestionItems b on a.IID = b.IID +left join Eval_Question c on a.QID=c.QID +where c.VID='" + queryParam["VID"] + @"' +and a.EmpNo is not null and a.EmpNo <> '' and a.LessonNo is not null and a.LessonNo <> '' and a.UID is not null and a.UID <> '' +group by a.EmpNo, a.LessonNo, a.UID +) aa +group by aa.EmpNo,aa.LessonNo +) ee +on ee.EmpNo=ss.EmpNo and ee.LessonNo=ss.LessonNo +left join " + misdbname + @".dbo.EmpInfo cc on ss.EmpNo=cc.EmpNo +left join " + misdbname + @".dbo.LessonInfo dd on ss.LessonNo = dd.LessonNo +where 1=1 "); + if (!queryParam["EmpNo"].IsEmpty()) + { + strSql.Append(" and ss.EmpNo='" + queryParam["EmpNo"] + "' "); + } + if (!queryParam["keyword"].IsEmpty()) + { + strSql.Append(" and cc.EmpName like '%" + queryParam["keyword"] + "%' "); + } + strSql.Append(" order by ss.EmpNo,ss.LessonNo"); + + return this.BaseRepository().FindList(strSql.ToString()); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs index b4901f5a2..bbedcc62c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs @@ -79,10 +79,26 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach [NotMapped] public string MajorNo { get; set; } [NotMapped] public string ClassNo { get; set; } [NotMapped] public string StuNo { get; set; } + /// + /// 分数 + /// [NotMapped] public decimal? IScore { get; set; } + /// + /// 评教平均分(评教总分/评教人数) + /// [NotMapped] public decimal? AverageScore { get; set; } - [NotMapped] public int StudentCount { get; set; } - [NotMapped] public int EvalCount { get; set; } + /// + /// 上课人数 + /// + [NotMapped] public int? StudentCount { get; set; } + /// + /// 评教人数 + /// + [NotMapped] public int? EvalCount { get; set; } + /// + /// 评教总分 + /// + [NotMapped] public decimal? EvalTotalScore { get; set; } #endregion #region 扩展操作