Pārlūkot izejas kodu

【修改】评教管理:学生评教情况、教师被评情况加载慢进行代码优化;

新疆影视学院高职
dyy pirms 2 gadiem
vecāks
revīzija
733cb571f8
6 mainītis faili ar 164 papildinājumiem un 19 dzēšanām
  1. +4
    -3
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs
  2. +4
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js
  3. +24
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs
  4. +9
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs
  5. +105
    -12
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs
  6. +18
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs

+ 4
- 3
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Controllers/Eval_MainController.cs Parādīt failu

@@ -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);


+ 4
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.js Parādīt failu

@@ -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();
},


+ 24
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainBLL.cs Parādīt failu

@@ -253,6 +253,30 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach
}
}
}
/// <summary>
/// 评教:按教师、课程统计上课人数、评教人数、评教平均分
/// </summary>
/// <param name="paginationobj"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
public IEnumerable<Eval_QuestionResultEntity> 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



+ 9
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainIBLL.cs Parādīt failu

@@ -56,5 +56,14 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach

IEnumerable<Eval_QuestionResultEntity> GetAnswerPageList(Pagination paginationobj, string queryJson);
IEnumerable<Eval_QuestionResultEntity> GetTeacherIndexPageList(Pagination paginationobj, string queryJson);
/// <summary>
/// 评教:按教师、课程统计上课人数、评教人数、评教平均分
/// </summary>
/// <param name="paginationobj"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
IEnumerable<Eval_QuestionResultEntity> GetTeacherIndexPageList2(Pagination paginationobj, string queryJson);


}
}

+ 105
- 12
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_Main/Eval_MainService.cs Parādīt failu

@@ -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
}
}
}
/// <summary>
/// 评教:按教师、课程统计上课人数、评教人数、评教平均分
/// </summary>
/// <param name="paginationobj"></param>
/// <param name="queryJson"></param>
/// <returns></returns>
public IEnumerable<Eval_QuestionResultEntity> 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<Eval_QuestionResultEntity>(strSql.ToString());
}
catch (Exception ex)
{
if (ex is ExceptionEx)
{
throw;
}
else
{
throw ExceptionEx.ThrowServiceException(ex);
}
}
}

}
}

+ 18
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EvaluationTeach/Eval_QuestionResult/Eval_QuestionResultEntity.cs Parādīt failu

@@ -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; }
/// <summary>
/// 分数
/// </summary>
[NotMapped] public decimal? IScore { get; set; }
/// <summary>
/// 评教平均分(评教总分/评教人数)
/// </summary>
[NotMapped] public decimal? AverageScore { get; set; }
[NotMapped] public int StudentCount { get; set; }
[NotMapped] public int EvalCount { get; set; }
/// <summary>
/// 上课人数
/// </summary>
[NotMapped] public int? StudentCount { get; set; }
/// <summary>
/// 评教人数
/// </summary>
[NotMapped] public int? EvalCount { get; set; }
/// <summary>
/// 评教总分
/// </summary>
[NotMapped] public decimal? EvalTotalScore { get; set; }
#endregion

#region 扩展操作


Notiek ielāde…
Atcelt
Saglabāt