From 18134889d59825b6682e94e257f91a3b81d756b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=A4=20=E6=A2=81?= Date: Sat, 3 Dec 2022 15:58:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B8=85=E7=90=86=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AF=84=E6=95=99=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Eval_MainController.cs | 8 +++ .../Views/Eval_Main/AnswerIndex.cshtml | 3 +- .../Views/Eval_Main/AnswerIndex.js | 5 ++ .../EvaluationTeach/Eval_Main/Eval_MainBLL.cs | 20 +++++++ .../Eval_Main/Eval_MainIBLL.cs | 1 + .../Eval_Main/Eval_MainService.cs | 55 +++++++++++++++++++ 6 files changed, 91 insertions(+), 1 deletion(-) 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 ed1c7bb8a..98b0010ae 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 @@ -237,6 +237,14 @@ namespace Learun.Application.Web.Areas.EvaluationTeach.Controllers return Success("删除成功!"); } + [HttpPost] + [AjaxOnly] + public ActionResult CleanForm(string VID) + { + ask_MainIBLL.Clean(VID); + return Success("操作成功!"); + } + [HttpPost] [AjaxOnly] public ActionResult SubmitForm(string keyValue) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.cshtml index ab5c047a8..98699c2d9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EvaluationTeach/Views/Eval_Main/AnswerIndex.cshtml @@ -40,8 +40,9 @@
 查看答卷 -
+  清理重复数据 +
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 99413464d..047e87502 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 @@ -43,6 +43,11 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); + $('#lr_clean').on('click', function() { + learun.postForm(top.$.rootUrl + '/EvaluationTeach/Eval_Main/CleanForm', { VID: VID }, function () { + refreshGirdData(); + }); + }); // 答题情况 $('#lr_view').on('click', function () { var keyValue = $('#gridtable_stu').jfGridValue('VID'); 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 a189748a0..3f1048959 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 @@ -304,6 +304,26 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach } } } + + public void Clean(string vid) + { + try + { + ask_MainService.Clean(vid); + } + 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 038d7a035..2cf3aee37 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 @@ -75,5 +75,6 @@ namespace Learun.Application.TwoDevelopment.EvaluationTeach IEnumerable GetQuestionResultCount(string keyValue, string stuno, string EmpNo, string LessonNo); + void Clean(string vid); } } 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 f9224e0c6..3745e87c3 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 @@ -600,5 +600,60 @@ where 1=1 "); } } + public void Clean(string vid) + { + try + { + var misdbname = BaseRepository("CollegeMIS").getDbConnection().Database; + string sql = @" + +select aa.LessonNo,aa.EmpNo,aa.VID,aa.StuNo,bb.IScore,bb.UID,cc.EmpName,aa.LessonName,ee.StuName +from +( +select a.LessonNo,a.LessonName,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='"+ vid + @"' +and a.StuNo is not null and a.StuNo <> '' +and a.StuNo not in (select StuNo from " + misdbname + @".dbo.StuInfoBasic where ChangeStatus=1) +) 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='"+ 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.StuInfoBasic ee on aa.StuNo = ee.StuNo +where 1=1 and iscore>100 order by IScore desc"; + var list= this.BaseRepository().FindList(sql); + foreach (var item in list) + { + var questionlist= this.BaseRepository().FindList("select * from Eval_Question where vid='"+ vid + "'"); + foreach (var questionEntity in questionlist) + { + string sql2 = @"select b.* from Eval_Question a left join Eval_QuestionResult b on a.QID=b.QID +where a.vid='"+ vid + "' and b.LessonNo='" + item.LessonNo + "'" + + " and b.EmpNo='" + item.EmpNo + "' and b.uid='" + item.StuNo + "' and b.qid='"+questionEntity.QID+"'"; + List Eval_QuestionResultlist = this.BaseRepository().FindList(sql2).ToList(); + for (int i = 0; i < Eval_QuestionResultlist.Count()-1; i++) + { + string rid = Eval_QuestionResultlist[i].RID; + BaseRepository().Delete(t=>t.RID== rid); + } + } + } + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + } } }