From b9867186f13dd8f7b91b30704618c5b7fb9962ab Mon Sep 17 00:00:00 2001 From: liangkun Date: Thu, 24 Mar 2022 16:36:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=80=89=E4=BF=AE?= =?UTF-8?q?=E8=AF=BE=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenLessonPlanOfElective/StudentIndex.js | 17 ++++++++++++++++- .../StuSelectLessonListOfElective/Index.js | 17 ++++++++++++++++- .../OpenLessonPlanOfElectiveEntity.cs | 2 ++ .../OpenLessonPlanOfElectiveService.cs | 4 ++-- .../StuSelectLessonListOfElectiveEntity.cs | 1 + .../StuSelectLessonListOfElectiveService.cs | 4 ++-- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js index c426e026f..3079bf4fd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/OpenLessonPlanOfElective/StudentIndex.js @@ -176,7 +176,7 @@ var bootstrap = function ($, learun) { }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfStudent', headData: [ { label: "学年", name: "AcademicYearNo", width: 100, align: "left" }, @@ -196,6 +196,21 @@ var bootstrap = function ($, learun) { }); } }, + { + label: "课程类型", name: "LessonTypeId", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + console.log(row.LessonTypeId); + + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType', + key: row.LessonTypeId, + keyId: 'ltid', + callback: function (_data) { + callback(_data['lessontypename']); + } + }); + } + }, { label: "上课节次", name: "LessonSection", width: 150, align: "left", formatter: function (cellvalue, row) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElective/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElective/Index.js index fa4d52a95..9da21e054 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElective/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuSelectLessonListOfElective/Index.js @@ -68,7 +68,7 @@ var bootstrap = function ($, learun) { }, // 初始化列表 initGird: function () { - $('#gridtable').lrAuthorizeJfGrid({ + $('#gridtable').jfGrid({ url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/GetPageList', headData: [ { label: "学年", name: "AcademicYearNo", width: 100, align: "left"}, @@ -87,6 +87,21 @@ var bootstrap = function ($, learun) { }); } }, + { + label: "课程类型", name: "LessonTypeId", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + console.log(row.LessonTypeId); + + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType', + key: row.LessonTypeId, + keyId: 'ltid', + callback: function (_data) { + callback(_data['lessontypename']); + } + }); + } + }, { label: "上课节次", name: "LessonSection", width: 150, align: "left", formatter: function (cellvalue, row) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveEntity.cs index 3f3730287..c7b3e472e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveEntity.cs @@ -222,6 +222,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [NotMapped] public string LessonNo2 { get; set; } [NotMapped] public string EmpNo2 { get; set; } + [NotMapped] public string LessonTypeId { get; set; } + /// /// 选课专业列表 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs index c2ec1f140..bc9b0ce60 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlanOfElective/OpenLessonPlanOfElectiveService.cs @@ -100,9 +100,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var EADateArrangeEntityAboutElective = this.BaseRepository("CollegeMIS").FindEntity(x => x.WorkName == "选课" && x.MakeDate <= now && x.EndDate >= now && x.CheckMark == "1"); var strSql = new StringBuilder(); - strSql.Append(@"select b.*,c.StuNo,c.StuName,c.Status,cp.Status as StatusPre from ElectiveMajor a left join OpenLessonPlanOfElective b on a.OLPOEId=b.Id + strSql.Append(@"select b.*,leif.LessonTypeId,c.StuNo,c.StuName,c.Status,cp.Status as StatusPre from ElectiveMajor a left join OpenLessonPlanOfElective b on a.OLPOEId=b.Id left join StuSelectLessonListOfElective c on b.Id=c.OLPEId and c.StuNo=@StuNo - left join StuSelectLessonListOfElectivePre cp on b.Id=cp.OLPEId and cp.StuNo=@StuNo + left join StuSelectLessonListOfElectivePre cp on b.Id=cp.OLPEId and cp.StuNo=@StuNo left join LessonInfo leif on b.LessonNo=leif.LessonNo where not exists ( "); //不显示与已选课程 相同课程名称相同教师的课程 strSql.Append(" select * from StuSelectLessonListOfElective s where s.AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and s.Semester='" + EADateArrangeEntityAboutElective.Semester + "' and s.StuNo=@StuNo and s.Status <>3 and s.LessonName=b.LessonName and s.EmpNo=b.EmpNo and s.OLPEId!=b.Id "); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveEntity.cs index 70f099fe1..d27073da4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveEntity.cs @@ -212,6 +212,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration #region 扩展字段 [NotMapped] public string F_SchoolId { get; set; } + [NotMapped] public string LessonTypeId { get; set; } #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveService.cs index 1ff93c134..9bff6fd34 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuSelectLessonListOfElective/StuSelectLessonListOfElectiveService.cs @@ -29,8 +29,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration try { var strSql = new StringBuilder(); - strSql.Append("SELECT t.* "); - strSql.Append(" FROM StuSelectLessonListOfElective t "); + strSql.Append("SELECT t.*,leif.LessonTypeId "); + strSql.Append(" FROM StuSelectLessonListOfElective t left join LessonInfo leif on t.LessonNo=leif.LessonNo "); strSql.Append(" WHERE 1=1 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 From 7c7b05d948e5c95597c6567ff16524abac0d89c1 Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 25 Mar 2022 10:12:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=BF=85=E4=BF=AE?= =?UTF-8?q?=E6=8E=92=E8=AF=BE=E6=96=B9=E6=B3=95=E5=86=85=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E9=80=89=E4=BF=AE=E8=AF=BE=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTermService.cs | 369 ++++++++---------- 1 file changed, 157 insertions(+), 212 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index 8cefc6d44..6b07e142f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -659,7 +659,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest } return result; } - + /// /// 按条件同步排课数据 /// @@ -674,169 +674,66 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest var classroomData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); if (entity.SyncType == "1") { - HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); - httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); - string apiData = await Client.PostAsync(Config.GetValue("ArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync(); - - if (!string.IsNullOrEmpty(apiData)) + var LessonList = BaseRepository("paikeDbString").FindList( + @"SELECT a.week AS 'week', a.section AS 'section',a.timetext AS 'timetext',c.name AS 'classname',c.number AS 'classnumber', + r.name AS 'roomname',r.number AS 'ClassroomNo',t.name AS 'teachername',t.number AS 'teacherNumber', cu.name AS 'curriculunName', + cu.number AS 'curriculunNumber', s.year AS 'year', s.number AS 'semester' + FROM tb_paike a + LEFT JOIN tb_clazz c ON c.id= a.`clazzid` + LEFT JOIN tb_classroom r ON r.id =a.`classroomid` + LEFT JOIN tb_teacher t ON t.id =a.`teacherid` + LEFT JOIN tb_curriculum cu ON cu.id=a.`curriculunid` + LEFT JOIN tb_semester s ON s.id=a.`semester` + WHERE 1=1 AND c.number IS NOT NULL AND s.year = '" + entity.AcademicYearNo + "' AND s.number ='" + entity.Semester + "'"); + + if (LessonList.Count() > 0) { - var data = JsonConvert.DeserializeObject(apiData); - var dataList = data.entity.list; - if (dataList.Any()) + var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); + var insertDataList = new List(); + foreach (var item in LessonList) { - var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); - var insertDataList = new List(); - - foreach (var item in dataList) + var classinfo = classData.FirstOrDefault(m => m.ClassNo == item.classnumber); + var timesArr = item.timetext.Substring(0, item.timetext.Length - 1).Split(','); + foreach (var timesItem in timesArr) { - var classinfo = classData.FirstOrDefault(m => m.ClassId == item.clazzSid); - - var timesArr = item.timeText.Substring(0, item.timeText.Length - 1).Split(','); - foreach (var timesItem in timesArr) + var insertData = new ArrangeLessonTermEntity { - if (item.section.Contains(",")) - { - foreach (var sec in item.section.Split(',')) - { - var insertData = new ArrangeLessonTermEntity - { - ALTId = Guid.NewGuid().ToString(), - LessonDate = DateTime.Parse(timesItem), - AcademicYearNo = item.year, - Semester = item.number, - DeptNo = classinfo?.DeptNo, - MajorNo = classinfo?.MajorNo, - LessonNo = item.curriculunNumber, - LessonName = item.curriculunName, - TeachClassNo = item.curriculunName + classinfo?.ClassNo, - EmpNo = item.teacherNumber, - EmpName = item.teacherName, - LessonSortNo = lessonData.FirstOrDefault(m => m.LessonId == item.curriculunSid)?.LessonSortNo, - ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomId == item.classRoomSid)?.ClassroomNo, - LessonTime = item.week + sec, - CheckMark = "1", - F_SchoolId = item.schoolSid - }; - if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - && m.F_SchoolId == insertData.F_SchoolId) == 0 - && insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - && m.F_SchoolId == insertData.F_SchoolId) == 0) - { - insertDataList.Add(insertData); - } - //if (!oldArrangeLessonTermList.Any(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - // && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - // && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - // && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - // && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - // && m.F_SchoolId == insertData.F_SchoolId) - // && !insertDataList.Any(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - // && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - // && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - // && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - // && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - // && m.F_SchoolId == insertData.F_SchoolId)) - //{ - // insertDataList.Add(insertData); - //} - } - } - else - { - var insertData = new ArrangeLessonTermEntity - { - ALTId = Guid.NewGuid().ToString(), - LessonDate = DateTime.Parse(timesItem), - AcademicYearNo = item.year, - Semester = item.number, - DeptNo = classinfo?.DeptNo, - MajorNo = classinfo?.MajorNo, - LessonNo = item.curriculunNumber, - LessonName = item.curriculunName, - TeachClassNo = item.curriculunName + classinfo?.ClassNo, - EmpNo = item.teacherNumber, - EmpName = item.teacherName, - LessonSortNo = lessonData.FirstOrDefault(m => m.LessonId == item.curriculunSid)?.LessonSortNo, - ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomId == item.classRoomSid)?.ClassroomNo, - LessonTime = item.week + item.section, - CheckMark = "1", - F_SchoolId = item.schoolSid - }; - if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - && m.F_SchoolId == insertData.F_SchoolId) == 0 - && insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester - && m.LessonNo == insertData.LessonNo && m.LessonDate == insertData.LessonDate - && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo - && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo - && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime - && m.F_SchoolId == insertData.F_SchoolId) == 0) - { - insertDataList.Add(insertData); - } - } + ALTId = Guid.NewGuid().ToString(), + LessonDate = DateTime.Parse(timesItem), + AcademicYearNo = item.year, + Semester = item.semester, + DeptNo = classinfo?.DeptNo, + MajorNo = classinfo?.MajorNo, + LessonNo = item.curriculunNumber, + LessonName = item.curriculunName, + TeachClassNo = item.curriculunName + classinfo?.ClassNo, + EmpNo = item.teacherNumber, + EmpName = item.teachername, + LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.curriculunNumber)?.LessonSortNo, + ClassroomNo = classroomData.FirstOrDefault(m => m.ClassroomNo == item.ClassroomNo)?.ClassroomNo, + LessonTime = item.week + item.section, + CheckMark = "1", + F_SchoolId = entity.F_SchoolId + }; + if (oldArrangeLessonTermList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester + && m.LessonNo == insertData.LessonNo && m.LessonDate.Value.Date == insertData.LessonDate.Value.Date + && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo + && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo + && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime + && m.F_SchoolId == insertData.F_SchoolId) == 0 + && insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester + && m.LessonNo == insertData.LessonNo && m.LessonDate.Value.Date == insertData.LessonDate.Value.Date + && m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo + && m.TeachClassNo == insertData.TeachClassNo && m.EmpNo == insertData.EmpNo + && m.ClassroomNo == insertData.ClassroomNo && m.LessonTime == insertData.LessonTime + && m.F_SchoolId == insertData.F_SchoolId) == 0) + { + insertDataList.Add(insertData); + BaseRepository("CollegeMIS").Insert(insertData); } } - await BaseRepository("CollegeMIS").InsertAsync(insertDataList); - - //TeachClass数据处理 - // var arrangeLessonTermData = (await BaseRepository("CollegeMIS").FindListAsync(@"select F_SchoolId,AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') as teachclassno,empno from [dbo].[ArrangeLessonTerm] - //where (AcademicYearNo = '" + stringAcademicYear + "') and semester='" + stringSemester + "' and F_SchoolId = '" + stringSchoolId + @"' - //group by F_SchoolId,AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') ,empno ")).ToList(); - // var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync(@"SELECT * - //FROM TeachClass - //WHERE (AcademicYearNo = '" + stringAcademicYear + "') and semester='" + stringSemester + "' and F_SchoolId='" + stringSchoolId + "' ")).ToList(); - // var insertTeachClassDataList = new List(); - // if (arrangeLessonTermData.Any()) - // { - // foreach (var altitem in arrangeLessonTermData) - // { - // var insertTeachClassData = new TeachClassEntity() - // { - // AcademicYearNo = altitem.AcademicYearNo, - // Semester = altitem.Semester, - // DeptNo = altitem.DeptNo, - // MajorNo = altitem.MajorNo, - // LessonNo = altitem.LessonNo, - // Grade = classData.FirstOrDefault(m => m.ClassNo == altitem.TeachClassNo)?.Grade, - // LessonSortNo ="1", - // TeachClassNo = altitem.TeachClassNo, - // EmpNo = altitem.EmpNo, - // F_SchoolId = altitem.F_SchoolId - // }; - // //非空判断 - // if (TeachClassData.Count(m => m.AcademicYearNo == insertTeachClassData.AcademicYearNo && - // m.Semester == insertTeachClassData.Semester && m.DeptNo == insertTeachClassData.DeptNo && - // m.MajorNo == insertTeachClassData.MajorNo && m.LessonNo == insertTeachClassData.LessonNo && - // m.Grade == insertTeachClassData.Grade && m.LessonSortNo == insertTeachClassData.LessonSortNo && - // m.TeachClassNo == insertTeachClassData.TeachClassNo && m.EmpNo == insertTeachClassData.EmpNo && - // m.F_SchoolId == insertTeachClassData.F_SchoolId) == 0 - // && insertTeachClassDataList.Count(m => m.AcademicYearNo == insertTeachClassData.AcademicYearNo && - // m.Semester == insertTeachClassData.Semester && m.DeptNo == insertTeachClassData.DeptNo && - // m.MajorNo == insertTeachClassData.MajorNo && m.LessonNo == insertTeachClassData.LessonNo && - // m.Grade == insertTeachClassData.Grade && m.LessonSortNo == insertTeachClassData.LessonSortNo && - // m.TeachClassNo == insertTeachClassData.TeachClassNo && m.EmpNo == insertTeachClassData.EmpNo && - // m.F_SchoolId == insertTeachClassData.F_SchoolId) == 0) - // { - // insertTeachClassDataList.Add(insertTeachClassData); - // } - - // } - // await BaseRepository("CollegeMIS").InsertAsync(insertTeachClassDataList); - // } - } + } } else @@ -861,7 +758,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest LEFT JOIN tb_curriculum curriculum ON curriculum.id = a.curriculum LEFT JOIN tb_classroom room ON room.id = a.classroom LEFT JOIN tb_teacher teacher ON teacher.id = a.teacher - WHERE semester.year = '" + entity.AcademicYearNo + "' AND semester.number = '" + entity.Semester + "'"); + WHERE a.type='1' and semester.year = '" + entity.AcademicYearNo + "' AND semester.number = '" + entity.Semester + "'"); var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync(@"SELECT * FROM TeachClass WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList(); @@ -928,41 +825,64 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest { try { - HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); - httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); - string apiData = await Client.PostAsync(Config.GetValue("OpenLessonPlanAPI"), httpContent).Result.Content.ReadAsStringAsync(); + var TeachList = BaseRepository("paikeDbString").FindList( + @"select m.name AS 'MajorName', m.number AS 'MajorNo', tt.EmpNo AS 'EmpNo', + tt.EmpName AS 'EmpName', sc.name AS 'F_SchoolName', sc.sid AS 'F_SchoolId', + p.grade AS 'Grade', p.classhour AS 'classhour', curr.name AS 'LessonName', curr.number AS 'LessonNo', + s.year AS 'AcademicYearNo', s.number AS 'Semester' FROM tb_major_plan p + LEFT JOIN ( + SELECT + t.teacher, + GROUP_CONCAT(DISTINCT c.`name`) AS 'EmpName', + GROUP_CONCAT(DISTINCT c.number) AS 'EmpNo' + FROM + tb_major_plan t + LEFT JOIN tb_teacher c ON FIND_IN_SET(c.id, t.teacher) > 0 + GROUP BY + t.teacher + ) tt ON tt.teacher = p.teacher + LEFT JOIN tb_semester s ON s.id=p.`semester` + LEFT JOIN tb_school sc ON sc.`id`= p.`school` + LEFT JOIN tb_major m ON m.id=p.major + LEFT JOIN tb_course cour ON cour.id= p.`course` + LEFT JOIN tb_curriculum curr ON curr.id=cour.`course` + WHERE s.year = '" + entity.AcademicYearNo + "' AND s.number = '" + entity.Semester + + "' AND sc.sid = '" + entity.F_SchoolId + "' AND curr.`ification` ='1' ORDER BY p.`major` "); + var majorData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); var lessonData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); - if (!string.IsNullOrEmpty(apiData)) + + if (TeachList.Count() > 0) { - var data = JsonConvert.DeserializeObject(apiData); - var dataList = data.entity.list; var openLessonPlanData = await BaseRepository("CollegeMIS").FindListAsync(); - if (dataList.Any()) + var now = DateTime.Now; + var insertDataList = new List(); + + foreach (var item in TeachList) { - var insertDataList = new List(); - - var now = DateTime.Now; - foreach (var item in dataList) + foreach (var itemTeach in item.EmpNo.Split(',')) { var insertData = new OpenLessonPlanEntity() { + TeachNo = itemTeach, MakeDate = now, - AcademicYearNo = item.semester.year, - Semester = item.semester.number, - DeptNo = majorData.FirstOrDefault(m => m.ID == item.major.sid)?.DeptNo, - MajorNo = item.major.number, - LessonNo = item.course.course.number, - LessonName = item.course.course.name, + AcademicYearNo = item.AcademicYearNo, + Semester = item.Semester, + DeptNo = majorData.FirstOrDefault(m => m.MajorNo == item.MajorNo)?.DeptNo, + MajorNo = item.MajorNo, + LessonNo = item.LessonNo, + LessonName = item.LessonName, PartCode = "", - Grade = item.grade, - LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.course.course.number)?.LessonSortNo, - LessonSortDetailNo = lessonData.FirstOrDefault(m => m.LessonNo == item.course.course.number)?.LessonSortDetailNo, - StartWeek = item.semester.yesNo, - EndWeek = item.semester.week, + Grade = item.Grade, + LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.LessonSortNo) + ?.LessonSortNo, + LessonSortDetailNo = lessonData + .FirstOrDefault(m => m.LessonNo == item.LessonSortDetailNo)?.LessonSortDetailNo, + StartWeek = item.StartWeek, + EndWeek = item.EndWeek, CheckStyleNo = "1", ScoreRecordStyleNo = "1", - TeachDeptNo = majorData.FirstOrDefault(m => m.ID == item.major.sid)?.DeptNo, + TeachDeptNo = majorData.FirstOrDefault(m => m.MajorNo == item.MajorNo)?.DeptNo, StudyScore = 0, AmendDate = now, ClassroomType = 1, @@ -970,36 +890,35 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest CheckMarkDept = "1", CheckMark = "1", TestMark = 0, - F_SchoolId = item.school.sid + F_SchoolId = item.F_SchoolId }; if (openLessonPlanData.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester && - m.DeptNo == insertData.DeptNo && m.MajorNo == insertData.MajorNo && m.LessonNo == insertData.LessonNo && m.Grade == insertData.Grade && m.LessonSortNo == insertData.LessonSortNo && m.LessonName == insertData.LessonName && - m.F_SchoolId == insertData.F_SchoolId) == 0 && insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && - m.Semester == insertData.Semester && - m.DeptNo == insertData.DeptNo && - m.MajorNo == insertData.MajorNo && - m.LessonNo == insertData.LessonNo && - m.Grade == insertData.Grade && - m.LessonSortNo == insertData.LessonSortNo && - m.LessonName == insertData.LessonName && - m.F_SchoolId == insertData.F_SchoolId) == 0) + m.F_SchoolId == insertData.F_SchoolId) == 0 && + insertDataList.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && + m.Semester == insertData.Semester && + m.MajorNo == insertData.MajorNo && + m.LessonNo == insertData.LessonNo && + m.Grade == insertData.Grade && + m.LessonSortNo == insertData.LessonSortNo && + m.LessonName == insertData.LessonName && + m.F_SchoolId == insertData.F_SchoolId) == 0) { insertDataList.Add(insertData); } } - await BaseRepository("CollegeMIS").InsertAsync(insertDataList); } + await BaseRepository("CollegeMIS").InsertAsync(insertDataList); } //学生选课数据 var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync(@"SELECT * -FROM TeachClass -WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList(); + FROM TeachClass + WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + entity.Semester + "' and F_SchoolId='" + entity.F_SchoolId + "' ")).ToList(); var stuinfobasicData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); var stuSelectLessonListEntityData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); var insertStuSelectLessonListDataList = new List(); @@ -1093,34 +1012,44 @@ WHERE (AcademicYearNo = '" + entity.AcademicYearNo + "') and semester='" + ent public async Task AsyncModifyArrangeLessonDataByCondition(ArrangeLessonTermEntity entity) { bool result = false; + var db = BaseRepository("CollegeMIS"); try { - HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); - httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); - string apiData = await Client.PostAsync(Config.GetValue("ModifyArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync(); - - if (!string.IsNullOrEmpty(apiData)) + if (entity.SyncType == "1") { - var data = JsonConvert.DeserializeObject(apiData); - if (data.success) + HttpContent httpContent = new StringContent("{\"school\":\"" + entity.F_SchoolId + "\",\"year\":\"" + entity.AcademicYearNo + "\",\"number\":\"" + entity.Semester + "\"}"); + httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); + string apiData = await Client.PostAsync(Config.GetValue("ModifyArrangeLessonAPI"), httpContent).Result.Content.ReadAsStringAsync(); + + if (!string.IsNullOrEmpty(apiData)) { - var executeResult = await BaseRepository("CollegeMIS").ExecuteAsyncBySql( - $"delete from ArrangeLessonTerm where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( - $"delete from TeachClass where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( - $"delete from OpenLessonPlan where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - await BaseRepository("CollegeMIS").ExecuteAsyncBySql( - $"delete from StuSelectLessonList where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); - if (executeResult > 0) + var data = JsonConvert.DeserializeObject(apiData); + if (data.success) { + db.BeginTrans(); + db.ExecuteBySql( + $"delete from ArrangeLessonTerm where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.Commit(); result = true; } } } + else + { + db.BeginTrans(); + db.ExecuteBySql( + $"delete from TeachClass where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.ExecuteBySql( + $"delete from OpenLessonPlan where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.ExecuteBySql( + $"delete from StuSelectLessonList where F_SchoolId='{entity.F_SchoolId}' and AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' "); + db.Commit(); + result = true; + } } catch (Exception ex) { + db.Rollback(); if (ex is ExceptionEx) { throw; @@ -2741,7 +2670,23 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les #endregion - + public class paikeList + { + public string week { get; set; } + public string section { get; set; } + public string timetext { get; set; } + public string classname { get; set; } + public string classnumber { get; set; } + public string roomname { get; set; } + public string ClassroomNo { get; set; } + public string teachername { get; set; } + public string teacherNumber { get; set; } + public string curriculunName { get; set; } + public string curriculunNumber { get; set; } + public string year { get; set; } + public string semester { get; set; } + public string schoolno { get; set; } + } #endregion } From cb3a56d5d51b2ddeb85bc751869c4a94ce5f996d Mon Sep 17 00:00:00 2001 From: liangkun Date: Fri, 25 Mar 2022 15:09:18 +0800 Subject: [PATCH 3/3] dbconfig --- .../Learun.Application.Web/XmlConfig/database.config | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config index f5dea059a..e6f6aa417 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/database.config @@ -13,9 +13,9 @@ --> - + - + \ No newline at end of file