diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs index b5530e75b..a527a3cc6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs @@ -26,14 +26,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers public class ArrangeLessonTermController : MvcControllerBase { private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); - private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); private UserIBLL userIbll = new UserBLL(); private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); - private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL(); - private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); - private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); #region 视图功能 @@ -78,48 +74,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { return View(); } - [HttpGet] - public ActionResult IndexLessonTerm() - { - return View(); - } - /// - /// 学生课表 - /// - /// - [HttpGet] - public ActionResult IndexLessonTermStu() - { - var LogInfo = LoginUserInfo.Get(); - if (LogInfo.Description == "学生") - { - var StuInfo = stuInfoBasicIbll.GetAllList().Where(x => x.StuNo == LogInfo.account); - if (StuInfo != null) - { - ViewBag.ClassNo = StuInfo.FirstOrDefault().ClassNo; - } - } - return View(); - } - /// - /// 教师课表 - /// - /// - [HttpGet] - public ActionResult IndexLessonTermTeach() - { - var LogInfo = LoginUserInfo.Get(); - if (LogInfo.Description == "教师") - { - var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == LogInfo.account); - if (empInfo != null) - { - ViewBag.EmpNo = empInfo.FirstOrDefault().EmpNo; - } - } - return View(); - } - #endregion #region 获取数据 @@ -156,19 +110,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers }; return Success(jsonData); } - - /// - /// 排课管理 获取左侧树结构 - /// - /// - [HttpGet] - [AjaxOnly] - public ActionResult GetTree() - { - var data = arrangeLessonTermIBLL.GetTree(); - return Success(data); - } - /// /// 获取表单数据 /// 主键 @@ -181,225 +122,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var data = arrangeLessonTermIBLL.GetEntity(keyValue); return Success(data); } - /// - /// 获取周次 + /// 获取调度时间数据 /// /// [HttpGet] [AjaxOnly] - public ActionResult GetWeekTime() - { - int weekTimes = 0; - int curWeek = 0; - //开始时间 - var startdate = DateTime.Today; - var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); - //var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); - - var semesterAndYear = Common.GetSemesterAndYear(startDate); - //var strAcademicYear = semesterAndYear.AcademicYearShort; - //var strSemester = semesterAndYear.Semester; - var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); - if (entity.StartTime.HasValue && entity.EndTime.HasValue) - { - weekTimes = GetYearWeekCount(entity.StartTime.Value, entity.EndTime.Value); - curWeek = WeekOfYear(startdate, entity.StartTime.Value, entity.EndTime.Value); - } - - var listObj = new List(); - for (int i = 1; i <= weekTimes; i++) - { - listObj.Add(new { text = i + "周", value = i }); - } - var jsonData = new - { - weekList = listObj, - curWeek = curWeek, - }; - return Success(jsonData); - } - /// - /// 有多少周 - /// 返回 int - /// - /// int - private static int GetYearWeekCount(DateTime startTime, DateTime endTime) + public ActionResult GetLessonDateList(string queryJson) { - string returnStr = ""; - var startDate = DateTime.Parse(Common.CalculateFirstDateOfWeek(startTime).ToString("yyyy-MM-dd")); - //int k = Convert.ToInt32(startTime.DayOfWeek);//得到开始时间的第一天是周几 - int countDay = endTime.Subtract(startDate).Days; - int countWeek = countDay / 14 + 1; - return countWeek; - - } - /// - /// 求当前日期是第几周 - /// - /// - /// - private static int WeekOfYear(DateTime curDay, DateTime startTime, DateTime endTime) - { - int firstdayofweek = Convert.ToInt32(startTime.DayOfWeek); - var startDate = DateTime.Parse(Common.CalculateFirstDateOfWeek(startTime).ToString("yyyy-MM-dd")); - int k = Convert.ToInt32(startTime.DayOfWeek);//得到开始时间的第一天是周几 - int days = curDay.Subtract(startTime).Days; - //int days = curDay.DayOfYear; - int daysOutOneWeek = days - (14 - firstdayofweek); - - if (daysOutOneWeek <= 0) - { - return 1; - } - else + var data = arrangeLessonTermIBLL.GetList(queryJson).Where(x => x.LessonDate.HasValue).Select(x => x.LessonDate).Distinct().Select(x => new { - int weeks = daysOutOneWeek / 14; - if (daysOutOneWeek % 14 != 0) - weeks++; + text = x, + value = x + }).OrderBy(x => x.value); - return weeks + 1; - - } - - } - - - /// - /// 课程表【教务】 - /// - /// 班级 - /// 当前第几周 - /// - [HttpGet] - [AjaxOnly] - public ActionResult GetDataInEducation(string classNo, int curWeek) - { - var userInfo = LoginUserInfo.Get(); - //开始时间 - var startdate = DateTime.Today; - var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); - var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); - - var semesterAndYear = Common.GetSemesterAndYear(startDate); - var strAcademicYear = semesterAndYear.AcademicYearLong; - var strSemester = semesterAndYear.Semester; - if (string.IsNullOrEmpty(classNo)) - { - if (userInfo.Description != "教师") - { - var res = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; - return JsonResult(res); - } - } - - //校历 - var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); - var StartTime = entity.StartTime.Value; - //根据第几周,计算查询的开始和结束日期 - startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).ToString("yyyy-MM-dd");//StartTime.AddDays(((curWeek - 1) * 14)).ToString("yyyy-MM-dd"); - if (curWeek == 1 && Convert.ToDateTime(startDate) < StartTime) - { - startDate = StartTime.ToString("yyyy-MM-dd"); - } - - endDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).AddDays(10) - .ToString("yyyy-MM-dd");// StartTime.AddDays(((curWeek - 1) * 14)).AddDays(10).ToString("yyyy-MM-dd"); - - var timeTableList = new List(); - - //课程表 - var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - if (!string.IsNullOrEmpty(classNo)) - { - var PKRoleId = Config.GetValue("PKRoleId"); - var loginInfoRoleIds = LoginUserInfo.Get().roleIds; - if (loginInfoRoleIds.IndexOf(',') == -1) - { - if (loginInfoRoleIds == PKRoleId) - { - data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - } - } - else - { - if (loginInfoRoleIds.Split(',').Contains(PKRoleId)) - { - data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - } - } - } - else - { - if (userInfo.Description == "学生") - { - data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - } - else if (userInfo.Description == "教师") - { - var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == userInfo.account); - if (empInfo != null) - { - data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, "", empInfo.FirstOrDefault().EmpNo, ""); - } - } - else - { - data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - } - } - - timeTableList.AddRange(data); - //选修课课程表 - //var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); - //timeTableList.AddRange(dataOfElective); - - var timeTables = timeTableList.ToList(); - var noDataResult = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; - if (!timeTables.Any()) - { - return JsonResult(noDataResult); - } - var formatData = from d in timeTables.AsEnumerable() - let tt = d.LessonTime.Split('-')[1] - group d by tt into g - orderby g.Key - select new - { - time = g.Key, - list = from e in timeTables.AsEnumerable() - let ee = e.LessonTime.Split('-')[1] - where ee == g.Key - select new - { - ALTId = e.ALTId, - day = e.LessonTime.Split('-')[0], - curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, - teacher = e?.EmpName, - classRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(), - academicyear = semesterAndYear.AcademicYearShort, - semester = strSemester, - lessonNo = e?.LessonNo, - teachClassNo = e?.TeachClassNo, - empno = e?.EmpNo, - lessonTime = e.LessonTime, - lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), - classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), - lessonSortNo = e.LessonSortNo, - e?.OLPEId, - className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName - } - } - ; - - var result = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; - return JsonResult(result); + return Success(data); } - - #endregion #region 提交数据 @@ -429,41 +167,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers arrangeLessonTermIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } - - - /// - /// 删除课程 - /// 主键 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult DeleteLessonTerm(string keyValue, string WeekTime) - { - arrangeLessonTermIBLL.DeleteLessonTerm(keyValue, WeekTime); - return Success("删除成功!"); - } - - /// - ///修改课程 - /// 主键 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult UpdateLessonTerm(string keyValue, string postdata) - { - UpdateLessonTermEntity model = postdata.ToObject(); - var res = arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model); - if (!string.IsNullOrEmpty(res)) - { - return Fail(res); - } - - return Success("操作成功!"); - } - - #endregion /// @@ -588,11 +291,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers "\"template_id\":\"" + weixintasktempid + "\"," + "\"url\":\"" + weixintaskurl + "\"," + "\"data\":{" + - "\"first\": {\"value\":\"您有新的课表同步\",\"color\":\"#173177\"}," + - "\"keyword1\":{\"value\":\"课表同步\",\"color\":\"#173177\"}," + - "\"keyword2\": {\"value\":\"" + title + "\",\"color\":\"#173177\"}," + - "\"keyword3\": {\"value\":\"待查看\",\"color\":\"#173177\"}," + - "\"keyword4\": {\"value\":\"您有新的课表同步【" + title + "】\",\"color\":\"#173177\"}" + + "\"thing2\": {\"value\":\"您有新的课表同步\",\"color\":\"#173177\"}," + + "\"thing8\":{\"value\":\"课表同步\",\"color\":\"#173177\"}," + + "\"time9\": {\"value\":\"" + DateTime.Now.ToString() + "\",\"color\":\"#173177\"}," + + "\"thing6\": {\"value\":\"待查看\",\"color\":\"#173177\"}" + "}" + "}"; string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs deleted file mode 100644 index 97b648ccc..000000000 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/DataCollectionController.cs +++ /dev/null @@ -1,101 +0,0 @@ -using Learun.Util; -using System.Data; -using Learun.Application.TwoDevelopment.LR_Desktop; -using System.Web.Mvc; -using System.Collections.Generic; - -namespace Learun.Application.Web.Areas.LR_Desktop.Controllers -{ - /// - /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 - /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 - /// 创 建:超级管理员 - /// 日 期:2021-06-22 10:04 - /// 描 述:计算项目管理 - /// - public class DataCollectionController : MvcControllerBase - { - private DataCollectionIBLL dataCollectionIBLL = new DataCollectionBLL(); - - #region 视图功能 - - /// - /// 主页面 - /// - /// - [HttpGet] - public ActionResult Index() - { - return View(); - } - #endregion - /// - /// 校区基础信息 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncCompany() - { - dataCollectionIBLL.SaveXqjbsj(); - return Success("操作成功"); - } - /// - /// 校区基础信息 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncLesson() - { - dataCollectionIBLL.SyncLesson(); - return Success("操作成功"); - } - - /// - /// 教材信息 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncTextBook() - { - dataCollectionIBLL.SyncTextBook(); - return Success("操作成功"); - } - /// - /// 排课数据 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncArrangeLessonTerm() - { - dataCollectionIBLL.SyncArrangeLessonTerm(); - return Success("操作成功"); - } - /// - /// 教师进修培训数据 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncTeacherTrain() - { - dataCollectionIBLL.SyncTeacherTrain(); - return Success("操作成功"); - } - /// - /// 教师进修培训数据 - /// - /// - [HttpPost] - [AjaxOnly] - public ActionResult SyncTeacherQualifications() - { - dataCollectionIBLL.SyncTeacherQualifications(); - return Success("操作成功"); - } - - } -} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs index 2b26e1d62..35a90c0e3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs @@ -85,6 +85,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers return View(); } /// + /// 班级课程表【教务】 + /// + /// + [HttpGet] + public ActionResult ClassIndexInEducation() + { + return View(); + } + /// /// 课程表【教学调度】 /// /// @@ -93,6 +102,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return View(); } + /// + /// 课程表【教学调度】--调课 + /// + /// + [HttpGet] + public ActionResult IndexInEducationSelect_() + { + return View(); + } /// /// 课程表--修改教师所带的课程【教务】 @@ -112,6 +130,85 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return View(); } + /// + /// 表单--修改教师所带的课程【教务】 + /// + /// + [HttpGet] + public ActionResult SchoolLesson() + { + return View(); + } + /// + /// 表单--修改教师所带的课程【教务】 + /// + /// + [HttpGet] + public ActionResult PrintSchedule() + { + return View(); + } + + public class WeekDate + { + public int week { get; set; } + public string startdate { get; set; } + public string enddate { get; set; } + public string textweek { get; set; } + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetWeeksData() + { + var weekdatelist = new List(); + var yearsemester = Common.GetSemesterAndYear(); + + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek)); + //总周数 + var weekCount = Math.Ceiling(Convert.ToDouble((sunday - monday).Days + 1) / 7); + for (var i = 0; i < weekCount; i++) + { + var wentity = new WeekDate(); + wentity.week = i + 1; + wentity.startdate = monday.AddDays(i * 7).ToString("yyyy-MM-dd"); + wentity.enddate = monday.AddDays(i * 7 + 6).ToString("yyyy-MM-dd"); + wentity.textweek = "第" + wentity.week + "周 (" + wentity.startdate + "~" + wentity.enddate + ")"; + weekdatelist.Add(wentity); + } + return Success(weekdatelist); + } + else + return Success(new { }); + } + + /// + /// 获取当前日期是第几周 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetCurrentWeek() + { + var yearsemester = Common.GetSemesterAndYear(); + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-(Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek)) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - (Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek))); + var currentweek = Util.Time.GetWeekOfDay(monday, sunday); + return Success(currentweek); + } + return Success(1); + } /// /// 获取表单数据 @@ -217,70 +314,76 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return JsonResult(noDataResult); } - var formatDataa = from d in timeTables - let tt = d.LessonTime.Substring(1) - group d by tt into g - orderby g.Key - select new - { - time = g.Key, - list = from e in timeTables - let ee = e.LessonTime.Substring(1) - where ee == g.Key - select new - { - day = e.LessonTime.ToCharArray()[0], - curriculum = string.IsNullOrEmpty(e.EnName) ? (e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName) : (e.LessonSortNo == "2" ? e.EnName + "[选修]" : e.EnName), - lessonName = e.LessonName, - teacher = e.EmpName, - classRoom = e.ClassroomName.Trim(), - academicyear = semesterAndYear.AcademicYearShort, - semester = strSemester, - lessonNo = e?.LessonNo, - teachClassNo = e?.TeachClassNo, - empno = e?.EmpNo, - lessonTime = e.LessonTime, - lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), - classRoomNo = e?.ClassRoomNo.Trim(), - lessonSortNo = e.LessonSortNo, - e.OLPEId, - className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName - } - } + var leaveList = stuAttendanceLeaveIBLL.GetList(); + var formatData = from d in timeTables + let tt = d.LessonTime.Substring(1) + group d by tt into g + orderby g.Key + select new + { + time = g.Key, + list = from e in timeTables + let ee = e.LessonTime.Substring(1) + where ee == g.Key + select new + { + day = e.LessonTime.ToCharArray()[0], + curriculum = string.IsNullOrEmpty(e.EnName) ? (e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName) : (e.LessonSortNo == "2" ? e.EnName + "[选修]" : e.EnName), + lessonName = e.LessonName, + teacher = e.EmpName, + classRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(), + academicyear = semesterAndYear.AcademicYearShort, + semester = strSemester, + lessonNo = e?.LessonNo, + teachClassNo = e?.TeachClassNo, + empno = e?.EmpNo, + lessonTime = e.LessonTime, + lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), + classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), + lessonSortNo = e.LessonSortNo, + e.OLPEId, + className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName, + lessonTypeCode = e.LessonTypeCode, + lessonTypeName = e.LessonTypeName, + leaveType = leaveList.Any(c => c.LessonNo == e.LessonNo && c.StuNo == userInfo.account && c.LessonDate == e.LessonDate && c.LessonTime == e.LessonTime) ? 1 : 0, + checkType = leaveList.FirstOrDefault(c => c.LessonNo == e.LessonNo && c.StuNo == userInfo.account && c.LessonDate == e.LessonDate && c.LessonTime == e.LessonTime)?.IsCheck, + + } + } ; - var leaveList = stuAttendanceLeaveIBLL.GetList(); - var formatData = timeTables.OrderBy(a => a.LessonTime.Substring(1)) - .Select(a => new - { - time = a.LessonTime.Substring(1), - list = timeTables.Where(b => b.LessonTime.Substring(1) == a.LessonTime.Substring(1)) - .Select(b => new - { - day = b.LessonTime.ToCharArray()[0], - curriculum = string.IsNullOrEmpty(b.EnName) ? (b.LessonSortNo == "2" ? b.LessonName + "[选修]" : b.LessonName) : (b.LessonSortNo == "2" ? b.EnName + "[选修]" : b.EnName), - lessonName = b.LessonName, - teacher = b.EmpName, - classRoom = b.ClassroomName.Trim(), - academicyear = semesterAndYear.AcademicYearShort, - semester = strSemester, - lessonNo = b?.LessonNo, - teachClassNo = b?.TeachClassNo, - empno = b?.EmpNo, - lessonTime = b.LessonTime, - lessonDate = b.LessonDate.ToString("yyyy-MM-dd"), - classRoomNo = b?.ClassRoomNo.Trim(), - lessonSortNo = b.LessonSortNo, - b.OLPEId, - className = string.IsNullOrEmpty(b.ClassName) ? "" : b.ClassName, - leaveType = leaveList.Any(c => c.LessonNo == b.LessonNo && c.StuNo == userInfo.account && c.LessonDate == b.LessonDate && c.LessonTime == b.LessonTime) ? 1 : 0, - checkType = leaveList.FirstOrDefault(c => c.LessonNo == b.LessonNo && c.StuNo == userInfo.account && c.LessonDate == b.LessonDate && c.LessonTime == b.LessonTime)?.IsCheck, - - }) - - }); + // var leaveList = stuAttendanceLeaveIBLL.GetList(); + //var formatData = timeTables.OrderBy(a => a.LessonTime.Substring(1)) + // .Select(a => new + // { + // time = a.LessonTime.Substring(1), + // list = timeTables.Where(b => b.LessonTime.Substring(1) == a.LessonTime.Substring(1)) + // .Select(b => new + // { + // day = b.LessonTime.ToCharArray()[0], + // curriculum = string.IsNullOrEmpty(b.EnName) ? (b.LessonSortNo == "2" ? b.LessonName + "[选修]" : b.LessonName) : (b.LessonSortNo == "2" ? b.EnName + "[选修]" : b.EnName), + // lessonName = b.LessonName, + // teacher = b.EmpName, + // classRoom = b.ClassroomName.Trim(), + // academicyear = semesterAndYear.AcademicYearShort, + // semester = strSemester, + // lessonNo = b?.LessonNo, + // teachClassNo = b?.TeachClassNo, + // empno = b?.EmpNo, + // lessonTime = b.LessonTime, + // lessonDate = b.LessonDate.ToString("yyyy-MM-dd"), + // classRoomNo = b?.ClassRoomNo.Trim(), + // lessonSortNo = b.LessonSortNo, + // b.OLPEId, + // className = string.IsNullOrEmpty(b.ClassName) ? "" : b.ClassName, + // leaveType = leaveList.Any(c => c.LessonNo == b.LessonNo && c.StuNo == userInfo.account && c.LessonDate == b.LessonDate && c.LessonTime == b.LessonTime) ? 1 : 0, + // checkType = leaveList.FirstOrDefault(c => c.LessonNo == b.LessonNo && c.StuNo == userInfo.account && c.LessonDate == b.LessonDate && c.LessonTime == b.LessonTime)?.IsCheck, + + // }) + + // }); //foreach (var item in formatData.list) //{ @@ -297,7 +400,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetDataInEducation(string startTime, string endTime, string classNo, string empNo, string schoolId) + public ActionResult GetDataInEducation(string startTime, string endTime, string classNo, string empNo, string schoolId, string classroomNo) { var userInfo = LoginUserInfo.Get(); //开始时间 @@ -311,11 +414,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers var timeTableList = new List(); //课程表 - var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); + var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, classroomNo); timeTableList.AddRange(data); //选修课课程表 - var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); - timeTableList.AddRange(dataOfElective); + //20220718因 更改教务课表显示格式为班级作为列头,选修课无班级所以不能显示在课表内 + //var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); + //timeTableList.AddRange(dataOfElective); var timeTables = timeTableList.ToList(); var noDataResult = new @@ -324,6 +428,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return JsonResult(noDataResult); } + //最大节次 + int maxlessontime = timeTables.Max(m => Convert.ToInt32(m.LessonTime.Substring(1))); + //班级列表 + var classinfolist = timeTables.Select(m => new { m.TeachClassNo, m.ClassName }).OrderBy(m => m.TeachClassNo).GroupBy(m => new { m.TeachClassNo, m.ClassName }); var formatData = from d in timeTables let tt = d.LessonTime.Substring(1) group d by tt into g @@ -350,13 +458,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), lessonSortNo = e.LessonSortNo, e?.OLPEId, - className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName + className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName, + lessonTypeCode = e.LessonTypeCode, + lessonTypeName = e.LessonTypeName } } ; var result = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; + { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", maxlessontime, classinfolist, weekList = formatData }; return JsonResult(result); } @@ -380,7 +490,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers var timeTableList = new List(); //课程表 - var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); + var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, ""); timeTableList.AddRange(data); //选修课课程表 //var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); @@ -405,6 +515,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers where ee == g.Key select new { + AltId = e.AltId, day = e.LessonTime.ToCharArray()[0], lessonTime = e.LessonTime, lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), @@ -412,6 +523,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers academicyear = semesterAndYear.AcademicYearShort, semester = strSemester, deptNo = e?.DeptNo, + deptname = "", majorNo = e?.MajorNo, lessonNo = e?.LessonNo, curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, @@ -457,6 +569,19 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers return Success(data); } + /// + /// 课程表【教务】--教室下拉框信息 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassroomData(string schoolId = "") + { + var data = arrangeLessonTermIBLL.GetClassroomData(schoolId); + + return Success(data); + } + /// /// 表单--修改教师所带的课程【教务】--课程下拉框信息 /// 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 d1f8bf029..31ccd14d7 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 @@ -423,7 +423,6 @@ - diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs index f4cec3a59..88738766e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/TimeTable.cs @@ -13,7 +13,7 @@ using Nancy; namespace Learun.Application.WebApi.Modules { - public class TimeTable : BaseNoLoginApi + public class TimeTable : BaseApi { public TimeTable() : base("/learun/adms/timetable") @@ -22,15 +22,70 @@ namespace Learun.Application.WebApi.Modules Get["/StuList"] = GetStuInfo; Get["/StuLessonInfo"] = GetStuLessonInfo; Get["/timeTableData"] = GetTimeTableData; - Get["/TenDay"] = GetTenDay; + Get["/weeklist"] = GetWeeksData; + Get["/currentweek"] = GetCurrentWeek; } private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL(); private StuAttendanceIBLL stuAttendanceIBLL = new StuAttendanceBLL(); - private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); - private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); - private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL(); + + + public class WeekDate + { + public int week { get; set; } + public string startdate { get; set; } + public string enddate { get; set; } + public string textweek { get; set; } + } + + public Response GetWeeksData(dynamic _) + { + var weekdatelist = new List(); + var yearsemester = Common.GetSemesterAndYear(); + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek)); + //总周数 + var weekCount = Math.Ceiling(Convert.ToDouble((sunday - monday).Days + 1) / 7); + for (var i = 0; i < weekCount; i++) + { + var wentity = new WeekDate(); + wentity.week = i + 1; + wentity.startdate = monday.AddDays(i * 7).ToString("yyyy-MM-dd"); + wentity.enddate = monday.AddDays(i * 7 + 6).ToString("yyyy-MM-dd"); + wentity.textweek = "第" + wentity.week + "周 (" + wentity.startdate + "~" + wentity.enddate + ")"; + weekdatelist.Add(wentity); + } + return Success(weekdatelist); + } + else + return Success(new { }); + } + + /// + /// 获取当前日期是第几周 + /// + /// + public Response GetCurrentWeek(dynamic _) + { + var yearsemester = Common.GetSemesterAndYear(); + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-(Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek)) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - (Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek))); + var currentweek = Util.Time.GetWeekOfDay(monday, sunday); + return Success(new {currentweek}); + } + return Success(new {currentweek=1}); + } /// /// 课程表【教师功能、学生功能】 @@ -88,8 +143,7 @@ namespace Learun.Application.WebApi.Modules public Response GetStuLessonInfo(dynamic _) { - var param = this.GetReqData(); - var lessonInfos = stuAttendanceIBLL.GetStuLessonInfo(userInfo.account, param.StartDate, param.EndDate); + var lessonInfos = stuAttendanceIBLL.GetStuLessonInfo(userInfo.account); var empNos = lessonInfos.Select(a => a.EmpNo).ToList(); var lessonTerms = arrangeLessonTermIBLL.GetListByEmpNo(empNos); @@ -97,7 +151,7 @@ namespace Learun.Application.WebApi.Modules { a.LessonName, LessonDate = Convert.ToDateTime(a.LessonDate).ToString("yyyy-MM-dd"), - Teacher = lessonTerms.FirstOrDefault(b => b.EmpNo == a.EmpNo)?.EmpName, + Teacher = lessonTerms.FirstOrDefault(b => b.EmpNo == a.EmpNo).EmpName, a.LessonTime, a.EmpNo, a.ClassRoomName, @@ -123,6 +177,7 @@ namespace Learun.Application.WebApi.Modules /// /// /// + private Response GetTimeTableData(dynamic _) { var param = this.GetReq(); @@ -143,7 +198,7 @@ namespace Learun.Application.WebApi.Modules //课程表数据 var timeTableList = new List(); //必修课课程表 - var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); + var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, "", ""); timeTableList.AddRange(data); //选修课课程表 var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); @@ -180,96 +235,6 @@ namespace Learun.Application.WebApi.Modules } - /// - /// 课程表【教师功能、学生功能】 - /// - /// - /// - public Response GetTenDay(dynamic _) - { - var param = this.GetReqData(); - var startdate = DateTime.Today; - var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); - var endDate = Common.CalculateLastDateOfWeek(startdate).ToString("yyyy-MM-dd"); - - // 获取学年,学期 - var semesterAndYear = Common.GetSemesterAndYear(startDate); - var strAcademicYear = semesterAndYear.AcademicYearLong; - var strSemester = semesterAndYear.Semester; - - if (param.StartDate.IsEmpty() && param.EndDate.IsEmpty()) - { - // 校历 - var entity = schoolCalendarIbll.GetSchoolCalendarEntityByNo(semesterAndYear.AcademicYearShort, semesterAndYear.Semester); - var StartTime = entity.StartTime.Value; - //获取第几周 - var curWeek = WeekOfYear(startdate, entity.StartTime.Value, entity.EndTime.Value); - ///获取当前周次开始时间 - startDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).ToString("yyyy-MM-dd"); - if (curWeek == 1 && Convert.ToDateTime(startDate) < StartTime)//判断第几周 - { - startDate = StartTime.ToString("yyyy-MM-dd"); - } - endDate = Common.CalculateFirstDateOfWeek(StartTime.AddDays(((curWeek - 1) * 14))).AddDays(9).ToString("yyyy-MM-dd"); - param.StartDate = startDate; - param.EndDate = endDate; - } - var Data = arrangeLessonTermIBLL.GetTimeTableInEducation("", "", "", "", ""); - if (param.Description == "学生") - { - var Stulist = stuInfoBasicIBLL.GetAllList().Where(x => x.StuNo == param.Account).FirstOrDefault(); - if (Stulist != null) - { - Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, Stulist.ClassNo, "", ""); - } - } - else if (param.Description == "教师") - { - //教师 - var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == param.Account).FirstOrDefault().EmpNo; - if (empInfo != null) - { - Data = arrangeLessonTermIBLL.GetTimeTableInEducation(param.StartDate, param.EndDate, "", param.Account, ""); - } - } - - var formatData = from d in Data.AsEnumerable() - let tt = d.LessonTime.Split('-')[0] - group d by tt into g - orderby g.Key - select new - { - time = g.Key, - list = from e in Data.AsEnumerable() - let ee = e.LessonTime.Split('-')[0] - where ee == g.Key - select new - { - ALTId = e.ALTId, - day = e.LessonTime.Split('-')[0], - jc = e.LessonTime.Split('-')[1], - curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, - teacher = e?.EmpName, - classRoom = string.IsNullOrEmpty(e.ClassroomName) ? "" : e.ClassroomName.Trim(), - academicyear = semesterAndYear.AcademicYearShort, - semester = strSemester, - lessonNo = e?.LessonNo, - teachClassNo = e?.TeachClassNo, - empno = e?.EmpNo, - lessonTime = e.LessonTime, - lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), - classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), - lessonSortNo = e.LessonSortNo, - e?.OLPEId, - className = string.IsNullOrEmpty(e.ClassName) ? "" : e.ClassName - } - } - ; - var result = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", startDate = startDate, endDate = endDate, weekList = formatData }; - return Success(result); - - } /// /// 数字转中文 /// @@ -314,37 +279,6 @@ namespace Learun.Application.WebApi.Modules } return res; } - /// - /// 换算周次 - /// - /// - /// - /// - /// - private static int WeekOfYear(DateTime curDay, DateTime startTime, DateTime endTime) - { - int firstdayofweek = Convert.ToInt32(startTime.DayOfWeek); - var startDate = DateTime.Parse(Common.CalculateFirstDateOfWeek(startTime).ToString("yyyy-MM-dd")); - int k = Convert.ToInt32(startTime.DayOfWeek);//得到开始时间的第一天是周几 - int days = curDay.Subtract(startTime).Days; - //int days = curDay.DayOfYear; - int daysOutOneWeek = days - (14 - firstdayofweek); - - if (daysOutOneWeek <= 0) - { - return 1; - } - else - { - int weeks = daysOutOneWeek / 14; - if (daysOutOneWeek % 14 != 0) - weeks++; - - return weeks + 1; - - } - - } } @@ -363,8 +297,6 @@ namespace Learun.Application.WebApi.Modules /// 教师编号 /// public string EmpNo { get; set; } - public string Description { get; set; } - public string Account { get; set; } } public class TimeTableData { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs index 7f3a3206b..0bd240547 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs @@ -18,9 +18,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public class ArrangeLessonTermBLL : ArrangeLessonTermIBLL { private ArrangeLessonTermService arrangeLessonTermService = new ArrangeLessonTermService(); - private CdDeptService cdDeptService = new CdDeptService(); - private CdMajorService cdMajorService = new CdMajorService(); - private ClassInfoService classInfoService = new ClassInfoService(); #region 获取数据 @@ -46,17 +43,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - - /// - /// 获取列表分页数据 - /// 分页参数 - /// - /// - public IEnumerable GetPageList(Pagination pagination, string queryJson) + public IEnumerable GetListForTimeTable(string queryJson) { try { - return arrangeLessonTermService.GetPageList(pagination, queryJson); + return arrangeLessonTermService.GetListForTimeTable(queryJson); } catch (Exception ex) { @@ -70,63 +61,16 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - - /// - /// 获取左侧树形数据 + /// 获取列表分页数据 + /// 分页参数 /// /// - public List GetTree() + public IEnumerable GetPageList(Pagination pagination, string queryJson) { try { - DataTable cdDeptlist = cdDeptService.GetSqlTree(); - DataTable cdMajorlist = cdMajorService.GetSqlTree(); - DataTable classInfolist = classInfoService.GetSqlTree(); - List treeList = new List(); - foreach (DataRow item in cdDeptlist.Rows) - { - TreeModel node = new TreeModel - { - id = item["DeptNo"].ToString(), - text = item["DeptName"].ToString(), - value = item["DeptNo"].ToString(), - showcheck = false, - checkstate = 0, - isexpand = false, - parentId = "0" - }; - treeList.Add(node); - } - foreach (DataRow item in cdMajorlist.Rows) - { - TreeModel node = new TreeModel - { - id = item["MajorNo"].ToString(), - text = item["MajorName"].ToString(), - value = item["MajorNo"].ToString(), - showcheck = false, - checkstate = 0, - isexpand = false, - parentId = item["DeptNo"].ToString() - }; - treeList.Add(node); - } - foreach (DataRow item in classInfolist.Rows) - { - TreeModel node = new TreeModel - { - id = item["ClassNo"].ToString(), - text = item["ClassName"].ToString(), - value = item["ClassNo"].ToString(), - showcheck = false, - checkstate = 0, - isexpand = false, - parentId = item["MajorNo"].ToString() - }; - treeList.Add(node); - } - return treeList.ToTree(); + return arrangeLessonTermService.GetPageList(pagination, queryJson); } catch (Exception ex) { @@ -213,25 +157,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - public void DeleteLessonTerm(string keyValue, string WeekTime) - { - try - { - arrangeLessonTermService.DeleteLessonTerm(keyValue,WeekTime); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - /// /// 保存实体数据(新增、修改) /// 主键 @@ -256,25 +181,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - public string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model) - { - try - { - return arrangeLessonTermService.UpdateLessonTerm(keyValue, model); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - public IEnumerable GetStudents() { try @@ -548,12 +454,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 查询截止时间 /// 班级编号 /// 教师编号 + /// 教室编号 /// - public IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId) + public IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo) { try { - return arrangeLessonTermService.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); + return arrangeLessonTermService.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, classroomNo); } catch (Exception ex) { @@ -615,6 +522,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + /// + /// 课程表【教务】--教室下拉框信息 + /// + /// + public IEnumerable GetClassroomData(string schoolId) + { + try + { + return arrangeLessonTermService.GetClassroomData(schoolId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 教学调度【教务】--课程下拉框信息 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs index c119ffef3..65767cb44 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs @@ -13,6 +13,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// public class ArrangeLessonTermEntity { + #region 实体成员 /// /// 标识列 @@ -106,7 +107,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public string JoinLessonNum { get; set; } /// /// 合上班 - ///(教学班中对应的所有行政班号 ,以逗号隔开) + ///(教学班中对应的所有行政班号 ,以逗号隔开) /// /// [Column("RELATEDCLASSNO")] @@ -157,6 +158,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [NotMapped] public string SyncType { get; set; } + [NotMapped] public string StuName { get; set; } + [NotMapped] public string Grade { get; set; } + [NotMapped] public string GenderNo { get; set; } + #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs index f869acc20..caa1deec0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs @@ -48,6 +48,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// IEnumerable GetList(string queryJson); + + IEnumerable GetListForTimeTable(string queryJson); Task AsyncArrangeLessonData(); Task AsyncModifyArrangeLessonData(); @@ -68,8 +70,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// IEnumerable GetPageList(Pagination pagination, string queryJson); - - List GetTree(); /// /// 获取实体数据 /// 主键 @@ -86,8 +86,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// void DeleteEntity(string keyValue); - void DeleteLessonTerm(string keyValue,string WeekTime); - string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model); /// /// 保存实体数据(新增、修改) /// 主键 @@ -109,8 +107,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 查询截止时间 /// 班级编号 /// 教师编号 + /// 教室编号 /// - IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId); + IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo); /// /// 课程表【教务】--班级下拉框信息 @@ -124,6 +123,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// IEnumerable GetTeacherData(string schoolId); + + /// + /// 课程表【教务】--教室下拉框信息 + /// + /// + IEnumerable GetClassroomData(string schoolId); bool GetAny(); IEnumerable GetDepts(string academicYearNo, string semester); IEnumerable GetDeptsNotRecord(string academicYearNo, string semester); 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 34d01cd18..4db127a9a 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 @@ -74,15 +74,126 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration try { //参考写法 - //var queryParam = queryJson.ToJObject(); + var queryParam = queryJson.ToJObject(); // 虚拟参数 - //var dp = new DynamicParameters(new { }); - //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + var dp = new DynamicParameters(new { }); + var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(fieldSql); - strSql.Append(" FROM ArrangeLessonTerm t "); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); + strSql.Append(" FROM ArrangeLessonTerm t where 1=1 "); + + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + if (!queryParam["MajorNo"].IsEmpty()) + { + dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); + strSql.Append(" AND t.MajorNo = @MajorNo "); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + strSql.Append(" AND t.LessonNo = @LessonNo "); + } + if (!queryParam["TeachClassNo"].IsEmpty()) + { + dp.Add("TeachClassNo", "%" + queryParam["TeachClassNo"].ToString(), DbType.String); + strSql.Append(" AND t.TeachClassNo like @TeachClassNo "); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + strSql.Append(" AND t.EmpNo = @EmpNo "); + } + if (!queryParam["ClassroomNo"].IsEmpty()) + { + dp.Add("ClassroomNo", queryParam["ClassroomNo"].ToString(), DbType.String); + strSql.Append(" AND t.ClassroomNo = @ClassroomNo "); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + public IEnumerable GetListForTimeTable(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + + var strSql = new StringBuilder(); + strSql.Append("SELECT LessonDate,AcademicYearNo,Semester"); + strSql.Append(" FROM ArrangeLessonTerm t where 1=1 "); + + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + if (!queryParam["MajorNo"].IsEmpty()) + { + dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); + strSql.Append(" AND t.MajorNo = @MajorNo "); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + strSql.Append(" AND t.LessonNo = @LessonNo "); + } + if (!queryParam["TeachClassNo"].IsEmpty()) + { + dp.Add("TeachClassNo", "%" + queryParam["TeachClassNo"].ToString(), DbType.String); + strSql.Append(" AND t.TeachClassNo like @TeachClassNo "); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + strSql.Append(" AND t.EmpNo = @EmpNo "); + } + if (!queryParam["ClassroomNo"].IsEmpty()) + { + dp.Add("ClassroomNo", queryParam["ClassroomNo"].ToString(), DbType.String); + strSql.Append(" AND t.ClassroomNo = @ClassroomNo "); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); } catch (Exception ex) { @@ -197,307 +308,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - /// - /// 删除课程 - /// - /// - public void DeleteLessonTerm(string keyValue, string WeekTime) - { - var db = this.BaseRepository("CollegeMIS"); - try - { - db.BeginTrans(); - var entity = db.FindEntity(keyValue); - - //周次 - - var weekTimeAry = WeekTime.Split(','); - foreach (var weekTime in weekTimeAry) - { - var weektime = Convert.ToInt32(weekTime); - var lessonDate = GetLessonDate(weektime, Convert.ToInt32(entity.LessonTime.Split('-')[0])); - - var model = - db.FindEntity(x => - x.LessonDate == lessonDate && x.LessonTime == entity.LessonTime); - - if (model != null) - { - - //更改课程表标记 - model.CheckMark = "0"; - model.Modify(keyValue); - db.Update(model); - - //新增修改记录表 - ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity(); - record.Create(); - record.ALTId = model.ALTId; - record.LessonNoOld = model.LessonNo; - record.LessonNoNew = ""; - record.EmpNoOld = model.EmpNo; - record.EmpNoNew = ""; - record.ClassroomNoOld = model.ClassroomNo; - record.ClassroomNoNew = ""; - record.Remark = "删除"; - db.Insert(record); - } - } - - db.Commit(); - } - catch (Exception ex) - { - db.Rollback(); - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - /// - /// 修改课程 - /// - /// - public string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model) - { - var db = this.BaseRepository("CollegeMIS"); - try - { - db.BeginTrans(); - //当前修改的课程数据 - var ArrangeLessonTerm = db.FindEntity(keyValue); - var LessonTimeOld = ArrangeLessonTerm?.LessonTime; - //周次 - var weekTimeAry = model.WeekTimeSelect.Split(','); - foreach (var weekTime in weekTimeAry) - { - //第几周 - var weektime = Convert.ToInt32(weekTime); - //原先星期几 - var LessonTimeOld_week = Convert.ToInt32(LessonTimeOld?.Split('-')[0]); - //需要修改周次的开课时间 - var lessonDate = GetLessonDate(weektime, LessonTimeOld_week); - - //最后调整到 - var lessonDateNew = GetLessonDate(weektime, model.WeekSelect); - - #region old - //var lessonDate = GetLessonDate(weektime, model.WeekSelect); - - //var lessiontime = model.WeekSelect + "-" + model.NodeSelect; - //var entity = - // db.FindEntity(x => - // x.LessonDate == lessonDate && x.LessonTime == lessiontime); - //if (entity == null) - //{ - // //不存在 新增 - // var classInfo = db.FindEntity(x => x.ClassNo == model.TeachClassNo); - - // entity = new ArrangeLessonTermEntity(); - // entity.Create(); - // entity.LessonDate = lessonDate; - // entity.AcademicYearNo = semesterAndYear.AcademicYearShort; - // entity.Semester = semesterAndYear.Semester; - // entity.LessonDate = lessonDate; - - // entity.DeptNo = classInfo?.DeptNo; - // entity.MajorNo = classInfo?.MajorNo; - - // entity.LessonNo = model.LessonNo; - // entity.LessonName = model.LessonName; - // entity.EmpNo = model.EmpNo; - // entity.EmpName = model.EmpName; - // entity.TeachClassNo = model.TeachClassNo; - // entity.ClassroomNo = model.ClassroomNo; - // entity.LessonTime = lessiontime; - // entity.CheckMark = "1"; - // entity.F_SchoolId = LoginUserInfo.Get().companyId; - // db.Insert(entity); - - // //新增修改记录表 - // ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity(); - // record.Create(); - // record.ALTId = entity.ALTId; - // record.LessonNoOld = ""; - // record.LessonNoNew = model.LessonNo; - // record.EmpNoOld = ""; - // record.EmpNoNew = model.EmpNo; - // record.ClassroomNoOld = ""; - // record.ClassroomNoNew = model.ClassroomNo; - // record.Remark = "新增"; - // db.Insert(record); - //} - //else - //{ - // //新增修改记录表 - // ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity(); - // record.Create(); - // record.ALTId = entity.ALTId; - // record.LessonNoOld = entity.LessonNo; - // record.LessonNoNew = model.LessonNo; - // record.EmpNoOld = entity.EmpNo; - // record.EmpNoNew = model.EmpNo; - // record.ClassroomNoOld = entity.ClassroomNo; - // record.ClassroomNoNew = model.ClassroomNo; - // record.Remark = "修改"; - // db.Insert(record); - - // //存在 修改 - // entity.TeachClassNo = model.TeachClassNo; - // entity.LessonNo = model.LessonNo; - // entity.LessonName = model.LessonName; - // entity.EmpNo = model.EmpNo; - // entity.EmpName = model.EmpName; - // entity.ClassroomNo = model.ClassroomNo; - // db.Update(entity); - //} - #endregion - - var entity = - db.FindEntity(x => - x.LessonDate == lessonDate && x.LessonTime == LessonTimeOld); - //当前星期-节次 - var lessiontimeNow = model.WeekSelect + "-" + model.NodeSelect; - if (LessonTimeOld_week == 0) - //if (entity == null) - { - //不存在则新增 - var startdate = DateTime.Today; - var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); - - var semesterAndYear = Common.GetSemesterAndYear(startDate); - var classInfo = db.FindEntity(x => x.ClassNo == model.TeachClassNo); - - entity = new ArrangeLessonTermEntity(); - entity.Create(); - entity.LessonDate = lessonDateNew; - entity.AcademicYearNo = semesterAndYear.AcademicYearShort; - entity.Semester = semesterAndYear.Semester; - - entity.DeptNo = classInfo?.DeptNo; - entity.MajorNo = classInfo?.MajorNo; - - entity.LessonNo = model.LessonNo; - entity.LessonName = model.LessonName; - entity.EmpNo = model.EmpNo; - entity.EmpName = model.EmpName; - entity.TeachClassNo = model.TeachClassNo; - entity.ClassroomNo = model.ClassroomNo; - entity.LessonTime = lessiontimeNow; - entity.CheckMark = "1"; - entity.F_SchoolId = LoginUserInfo.Get().companyId; - db.Insert(entity); - - //新增修改记录表 - ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity(); - record.Create(); - record.ALTId = entity.ALTId; - record.LessonDateNew = lessonDateNew; - record.LessonNoOld = ""; - record.LessonNoNew = model.LessonNo; - record.EmpNoOld = ""; - record.EmpNoNew = model.EmpNo; - record.ClassroomNoOld = ""; - record.ClassroomNoNew = model.ClassroomNo; - record.LessonTimeNew = lessiontimeNow; - record.Remark = "新增"; - db.Insert(record); - } - else - { - //直接修改 - //判断是否冲突(新时间是否存在课程) - if (db.FindList(x => - x.LessonDate == lessonDateNew && x.LessonTime == lessiontimeNow && x.CheckMark == "1" && x.TeachClassNo == model.TeachClassNo && x.ALTId != keyValue).Count() > 0) - { - return "第" + weektime + "周当前课程冲突!"; - } - - //新增修改记录表 - ArgLessonTermUpdRecordEntity record = new ArgLessonTermUpdRecordEntity(); - record.Create(); - record.ALTId = entity.ALTId; - record.LessonDateOld = entity.LessonDate; - record.LessonDateNew = lessonDateNew; - record.LessonNoOld = entity.LessonNo; - record.LessonNoNew = model.LessonNo; - record.EmpNoOld = entity.EmpNo; - record.EmpNoNew = model.EmpNo; - record.ClassroomNoOld = entity.ClassroomNo; - record.ClassroomNoNew = model.ClassroomNo; - record.LessonTimeOld = entity.LessonTime; - record.LessonTimeNew = lessiontimeNow; - record.Remark = "修改"; - db.Insert(record); - - //存在 修改 - entity.LessonDate = lessonDateNew; - entity.TeachClassNo = model.TeachClassNo; - entity.LessonNo = model.LessonNo; - entity.LessonName = model.LessonName; - entity.EmpNo = model.EmpNo; - entity.EmpName = model.EmpName; - entity.ClassroomNo = model.ClassroomNo; - entity.LessonTime = lessiontimeNow; - db.Update(entity); - } - } - - db.Commit(); - return ""; - } - catch (Exception ex) - { - db.Rollback(); - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - /// - /// 获取开课时间 - /// - /// 周次 - /// 星期几 - /// - private DateTime GetLessonDate(int weektime, int WeekSelect) - { - //开课时间 - DateTime lessonDate = DateTime.Now; - //开始时间 - var startdate = DateTime.Today; - var startDate = Common.CalculateFirstDateOfWeek(startdate).ToString("yyyy-MM-dd"); - - var semesterAndYear = Common.GetSemesterAndYear(startDate); - //学校日历 - var schoolCalendar = this.BaseRepository().FindEntity(x => - x.AcademicYearNo == semesterAndYear.AcademicYearShort && x.Semester == semesterAndYear.Semester); - if (weektime == 1) - { - //第一周 - lessonDate = Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value) - .AddDays(WeekSelect - 1); - } - else - { - var start = Common.CalculateFirstDateOfWeek(schoolCalendar.StartTime.Value).AddDays((weektime - 1) * 14); - lessonDate = start.AddDays(WeekSelect - 1); - } - - return lessonDate; - } - /// /// 保存实体数据(新增、修改) /// 主键 @@ -531,8 +341,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } - - internal bool GetAny() { try @@ -590,15 +398,14 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration ,a.[Grade] ,a.[ConflictLessonNo] ,a.[EmpNo] - ,a.[TeachPlanNo],b.ID as StuAttendanceNo,b.AttendOrNo,b.Sort,b.AttenCondition,b.AttenScore + ,a.[TeachPlanNo],b.ID as StuAttendanceNo,b.AttendOrNo,b.Sort,b.AttenCondition,b.AttenScore,b.LessonDate "); strSql.Append(" FROM StuSelectLessonList a left join StuAttendance b on a.AcademicYearNo=b.AcademicYearNo and a.StuNo=b.StuNo and a.Semester=b.Semester and a.EmpNo=b.EmpNo and a.LessonNo=b.LessonNo and a.TeachClassNo=b.TeachClassNo "); strSql.Append($" and b.LessonTime='{queryParam["lessonTime"]}'"); + strSql.Append($" and b.LessonDate='{queryParam["lessonDate"]}'"); strSql.Append(" WHERE 1=1 "); strSql.Append($"and a.AcademicYearNo='{ queryParam["year"]}' and a.Semester='{queryParam["semester"]}' and a.EmpNo='{queryParam["empno"]}' and a.LessonNo='{queryParam["lessonNo"]}' and a.TeachClassNo='{queryParam["teachClassNo"]}' "); return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), pagination); - - } catch (Exception ex) { @@ -644,7 +451,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration LessonDate = DateTime.Parse(item.times), AcademicYearNo = item.schoolYear, Semester = item.paike.semester, - //DeptNo = classinfo?.DeptNo, + DeptNo = classinfo?.DeptNo, MajorNo = classinfo?.MajorNo, LessonNo = item.paike.curriculunId, LessonName = item.paike.curriculunName, @@ -661,15 +468,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration strSemester = insertData.Semester; 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.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.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) @@ -680,12 +485,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var insertResult = await BaseRepository("CollegeMIS").InsertAsync(insertDataList); //TeachClass数据处理 - var arrangeLessonTermData = (await BaseRepository("CollegeMIS").FindListAsync(@"select AcademicYearNo,Semester,majorno,lessonno,replace(teachclassno,lessonname,'') as teachclassno,empno from [dbo].[ArrangeLessonTerm] - where (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemester + @"' - group by AcademicYearNo,Semester,majorno,lessonno,replace(teachclassno,lessonname,'') ,empno ")).ToList(); + var arrangeLessonTermData = (await BaseRepository("CollegeMIS").FindListAsync(@"select AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') as teachclassno,empno from [dbo].[ArrangeLessonTerm] +where (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemester + @"' +group by AcademicYearNo,Semester,DeptNo,majorno,lessonno,replace(teachclassno,lessonname,'') ,empno ")).ToList(); var TeachClassData = (await BaseRepository("CollegeMIS").FindListAsync(@"SELECT * - FROM TeachClass - WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemester + "' ")).ToList(); +FROM TeachClass +WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemester + "' ")).ToList(); var insertTeachClassDataList = new List(); if (arrangeLessonTermData.Any()) { @@ -695,7 +500,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration { AcademicYearNo = altitem.AcademicYearNo, Semester = altitem.Semester, - //DeptNo = altitem.DeptNo, + DeptNo = altitem.DeptNo, MajorNo = altitem.MajorNo, LessonNo = altitem.LessonNo, Grade = classData.FirstOrDefault(m => m.ClassNo == altitem.TeachClassNo)?.Grade, @@ -706,13 +511,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration }; //非空判断 if (TeachClassData.Count(m => m.AcademicYearNo == insertTeachClassData.AcademicYearNo && - m.Semester == insertTeachClassData.Semester && //m.DeptNo == insertTeachClassData.DeptNo && + 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.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 && @@ -795,7 +600,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration CheckMarkDept = "1", CheckMark = "1", TestMark = 0, - State = 0, F_SchoolId = item.schoolId }; if (openLessonPlanData.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && @@ -856,14 +660,12 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest insertDatastuselect.TermEndScoreScale = 1; insertDatastuselect.OtherScoreScale = 1; insertDatastuselect.TeachClassNo = stu.ClassNo; - insertDatastuselect.LessonSortNo = "1"; + insertDatastuselect.LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo)?.LessonSortNo; insertDatastuselect.StuSortNo = "02"; insertDatastuselect.Grade = stu.Grade; insertDatastuselect.StudyScore = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).StudyScore == null ? 0 : lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).StudyScore; insertDatastuselect.TotalStudyHour = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).TotalStudyHour == null ? 0 : lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo).TotalStudyHour; insertDatastuselect.IsInEffect = "1"; - insertDatastuselect.OpenLessonDeptNo = stu.DeptNo; - insertDatastuselect.OpenLessonMajorNo = stu.MajorNo; insertDatastuselect.EmpNo = itemteachclass.EmpNo; insertDatastuselect.IsPitchOn = "1"; insertDatastuselect.CheckMark = "0"; @@ -982,8 +784,10 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest var classroomData = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); if (entity.SyncType == "1") { + var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync($"select * from ArrangeLessonTerm t where t.AcademicYearNo='{entity.AcademicYearNo}' and t.Semester='{entity.Semester}' ")).ToList(); + 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', + @"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 @@ -992,10 +796,10 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest 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 s.year = '" + entity.AcademicYearNo + "' AND s.number ='" + entity.Semester + "' AND c.number IS NOT NULL "); + WHERE 1=1 AND c.number IS NOT NULL AND s.year = '" + entity.AcademicYearNo + "' AND s.number ='" + entity.Semester + "'"); + if (LessonList.Count() > 0) { - var oldArrangeLessonTermList = (await BaseRepository("CollegeMIS").FindListAsync()).ToList(); var insertDataList = new List(); foreach (var item in LessonList) { @@ -1013,84 +817,120 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest MajorNo = classinfo?.MajorNo, LessonNo = item.curriculunNumber, LessonName = item.curriculunName, - TeachClassNo = classinfo?.ClassNo, + 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, + 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 == - insertData.LessonDate - && 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.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) + 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); + } + + //实训课 + var LessonListOfPracticalTrain = 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',a.teachers_number AS 'teachersNumber',a.teachers_name AS 'teachersName' + FROM tb_practicaltraining_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 (LessonListOfPracticalTrain.Any()) + { + var insertDataList = new List(); + foreach (var item in LessonListOfPracticalTrain) + { + 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 insertData = new ArrangeLessonTermEntity + { + 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); + } + } + } + } + } else { //TeachClass数据处理 20211214改为直接读取mysql库 var teachclasslist = BaseRepository("paikeDbString").FindList(@"SELECT clazz.name AS 'clazzname', - clazz.number AS 'TeachClassNo', - curriculum.name AS 'curriculumname', - curriculum.number AS 'LessonNo', - semester.year AS 'AcademicYearNo', - semester.number AS 'Semester', - a.jointclass AS 'jointclass', - a.type AS 'LessonSortNo', - a.classhour AS 'classhour', - room.name AS 'roomname', - room.number AS 'roomnumber', - teacher.name AS 'teachername', - teacher.number AS 'EmpNo' - FROM tb_class_plan a - LEFT JOIN tb_clazz clazz ON clazz.id = a.clazzid - LEFT JOIN tb_semester semester ON semester.id = clazz.semester - 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 + "' and a.type='1' and teacher.number is not null "); + clazz.number AS 'TeachClassNo', + curriculum.name AS 'curriculumname', + curriculum.number AS 'LessonNo', + semester.year AS 'AcademicYearNo', + semester.number AS 'Semester', + a.jointclass AS 'jointclass', + a.type AS 'LessonSortNo', + a.classhour AS 'classhour', + room.name AS 'roomname', + room.number AS 'roomnumber', + teacher.name AS 'teachername', + teacher.number AS 'EmpNo' + FROM tb_class_plan a + LEFT JOIN tb_clazz clazz ON clazz.id = a.clazzid + LEFT JOIN tb_semester semester ON semester.id = clazz.semester + 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 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(); @@ -1107,7 +947,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest MajorNo = classitemEntity?.MajorNo, LessonNo = teachClassEntity.LessonNo, Grade = classitemEntity?.Grade, - LessonSortNo = "1", + LessonSortNo = teachClassEntity.LessonSortNo, TeachClassNo = teachClassEntity.TeachClassNo, EmpNo = teachClassEntity.EmpNo, F_SchoolId = entity.F_SchoolId @@ -1158,10 +998,10 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest try { var TeachList = BaseRepository("paikeDbString").FindList( - @"select m.name AS 'MajorName', m.number AS 'MajorNo', tt.EmpNo AS 'EmpNo', + @"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 + s.year AS 'AcademicYearNo', s.number AS 'Semester' ,cour.`assessmentmethod` AS 'ExamType' FROM tb_major_plan p LEFT JOIN ( SELECT t.teacher, @@ -1179,9 +1019,11 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest 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 curr.`ification` ='1' and tt.EmpNo is not null ORDER BY p.`major` "); + + "' 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 (TeachList.Count() > 0) { var openLessonPlanData = await BaseRepository("CollegeMIS").FindListAsync(); @@ -1190,8 +1032,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest foreach (var item in TeachList) { - var TeachClass = item.EmpNo.Split(','); - foreach (var itemTeach in TeachClass) + foreach (var itemTeach in item.EmpNo.Split(',')) { var insertData = new OpenLessonPlanEntity() { @@ -1205,12 +1046,12 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest LessonName = item.LessonName, PartCode = "", Grade = item.Grade, - LessonSortNo = "1", + LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == item.LessonNo) + ?.LessonSortNo, LessonSortDetailNo = lessonData .FirstOrDefault(m => m.LessonNo == item.LessonSortDetailNo)?.LessonSortDetailNo, StartWeek = item.StartWeek, EndWeek = item.EndWeek, - WeekLessonHour = item.ClassHour, CheckStyleNo = "1", ScoreRecordStyleNo = "1", TeachDeptNo = majorData.FirstOrDefault(m => m.MajorNo == item.MajorNo)?.DeptNo, @@ -1222,7 +1063,8 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest CheckMark = "1", TestMark = 0, F_SchoolId = item.F_SchoolId, - State = 1 + State = 1, + ExamType = item.ExamType }; if (openLessonPlanData.Count(m => m.AcademicYearNo == insertData.AcademicYearNo && m.Semester == insertData.Semester && @@ -1247,10 +1089,10 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest } await BaseRepository("CollegeMIS").InsertAsync(insertDataList); } - #region 学生选课数据 + //学生选课数据 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(); @@ -1272,8 +1114,8 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest insertDatastuselect.GenderNo = stu.GenderNo != null && stu.GenderNo.Value ? "1" : "0"; insertDatastuselect.AcademicYearNo = itemteachclass.AcademicYearNo; insertDatastuselect.Semester = itemteachclass.Semester; - insertDatastuselect.OpenLessonDeptNo = stu.DeptNo; - insertDatastuselect.OpenLessonMajorNo = stu.MajorNo; + insertDatastuselect.OpenLessonDeptNo = itemteachclass.DeptNo; + insertDatastuselect.OpenLessonMajorNo = itemteachclass.MajorNo; insertDatastuselect.LessonNo = itemteachclass.LessonNo; insertDatastuselect.LessonName = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo)?.LessonName; insertDatastuselect.PartCode = ""; @@ -1282,7 +1124,7 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest insertDatastuselect.TermEndScoreScale = 1; insertDatastuselect.OtherScoreScale = 1; insertDatastuselect.TeachClassNo = stu.ClassNo; - insertDatastuselect.LessonSortNo = "1"; + insertDatastuselect.LessonSortNo = lessonData.FirstOrDefault(m => m.LessonNo == itemteachclass.LessonNo)?.LessonSortNo; insertDatastuselect.StuSortNo = "02"; insertDatastuselect.Grade = stu.Grade; insertDatastuselect.StudyScore = 0; @@ -1322,7 +1164,6 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest } await BaseRepository("CollegeMIS").InsertAsync(insertStuSelectLessonListDataList); } - #endregion } catch (Exception ex) { @@ -1345,34 +1186,44 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest 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; @@ -1403,21 +1254,25 @@ WHERE (AcademicYearNo = '" + strAcademicYear + "') and semester='" + strSemest if (userType == "学生") { sql = @"SELECT - b.LessonNo,b.AcademicYearNo as AcademicYear,b.LessonName,b.LessonTime,b.LessonDate,b.Empname EmpName,b.EmpNo,c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,e.EnName from StuSelectLessonList a + b.LessonNo,b.AcademicYearNo as AcademicYear,b.LessonName,b.LessonTime,b.LessonDate,b.Empname EmpName,b.EmpNo,c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,e.EnName,f.LessonTypeName,f.LessonTypeCode + from StuSelectLessonList a left join ArrangeLessonTerm b on b.TeachClassNo=RTRIM(a.LessonName) + RTRIM(a.PartCode) + RTRIM(a.TeachClassNo) left join ClassroomInfo c on c.ClassroomNo=b.classroomNo left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo left join LessonInfo e on a.LessonNo=e.LessonNo + left join CdLessonType f on e.LessonTypeId=f.LTId where a.StuNo=@userAccount and a.AcademicYearNo=@strAcademicYear and a.Semester=@strSemester and b.AcademicYearNo=@strAcademicYear and b.Semester=@strSemester and b.LessonDate>=@startDate and b.LessonDate<=@endDate and b.CheckMark=1"; } else { - sql = @"select b.AcademicYearNo as AcademicYear,b.LessonNo,e.EnName,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace(b.TeachClassNo,b.LessonName,'') TeachClassNo, c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName from ArrangeLessonTerm b + sql = @"select b.AcademicYearNo as AcademicYear,b.LessonNo,e.EnName,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace(b.TeachClassNo,b.LessonName,'') TeachClassNo, c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,f.LessonTypeName,f.LessonTypeCode + from ArrangeLessonTerm b left join ClassroomInfo c on c.ClassroomNo=b.classroomNo left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo left join LessonInfo e on b.LessonNo=e.LessonNo + left join CdLessonType f on e.LessonTypeId=f.LTId where b.EmpNo=@userAccount and b.AcademicYearNo=@strAcademicYear and b.Semester=@strSemester and b.LessonDate>=@startDate and b.LessonDate<=@endDate and b.CheckMark=1"; } @@ -1873,16 +1728,19 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les /// 查询截止时间 /// 班级编号 /// 教师编号 + /// 教室编号 /// - public IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId) + public IEnumerable GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo) { var semesterAndYear = Common.GetSemesterAndYear(startDate); var strAcademicYear = semesterAndYear.AcademicYearShort; var strSemester = semesterAndYear.Semester; - string sql = @"select b.ALTId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName + string sql = @"select b.AltId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName,f.LessonTypeName,f.LessonTypeCode from ArrangeLessonTerm b left join ClassroomInfo c on c.ClassroomNo=b.classroomNo - left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo + left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo + left join LessonInfo e on b.LessonNo=e.LessonNo + left join CdLessonType f on e.LessonTypeId=f.LTId where b.AcademicYearNo=@strAcademicYear and b.Semester=@strSemester and b.LessonDate>=@startDate and b.LessonDate<=@endDate and b.CheckMark=1"; @@ -1891,7 +1749,14 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les var result = BaseRepository("CollegeMIS").FindList(sql, new { startDate, endDate, strAcademicYear, strSemester }); if (!string.IsNullOrEmpty(classNo)) { - result = result.Where(x => x.TeachClassNo == classNo); + if (classNo.Contains(",")) + { + result = result.Where(x => classNo.Contains(x.ClassName)); + } + else + { + result = result.Where(x => x.TeachClassNo == classNo); + } } if (!string.IsNullOrEmpty(empNo)) { @@ -1901,6 +1766,10 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { result = result.Where(x => x.F_SchoolId == schoolId); } + if (!string.IsNullOrEmpty(classroomNo)) + { + result = result.Where(x => x.ClassRoomNo == classroomNo); + } return result; } catch (Exception ex) @@ -1924,9 +1793,9 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { try { - //前三年-后三年 - var preYear = DateTime.Now.AddYears(-3).Year; - var nextYear = DateTime.Now.AddYears(3).Year; + //前五年-后五年 + var preYear = DateTime.Now.AddYears(-5).Year; + var nextYear = DateTime.Now.AddYears(5).Year; var yearList = new List(); for (int i = preYear; i <= nextYear; i++) { @@ -1968,17 +1837,19 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { try { - //前三年-后三年 - var preYear = DateTime.Now.AddYears(-3).Year; - var nextYear = DateTime.Now.AddYears(3).Year; + //前五年-后五年 + var preYear = DateTime.Now.AddYears(-1).Year; + var nextYear = DateTime.Now.AddYears(1).Year; var yearList = new List(); for (int i = preYear; i <= nextYear; i++) { - yearList.Add(string.Format("{0}-{1}", i.ToString().Substring(2), (i + 1).ToString().Substring(2))); + yearList.Add(string.Format("'{0}-{1}'", i.ToString().Substring(2), (i + 1).ToString().Substring(2))); } var aa = new List(); //必修课 - var teacherData = this.BaseRepository("CollegeMIS").FindList(x => yearList.Contains(x.AcademicYearNo)); + //var teacherData = this.BaseRepository("CollegeMIS").FindList(x => yearList.Contains(x.AcademicYearNo)); + var teacherData = this.BaseRepository("CollegeMIS").FindList("select EmpNo,EmpName,F_SchoolId from ArrangeLessonTerm where AcademicYearNo in(" + string.Join(",", yearList) + ") "); + if (!string.IsNullOrEmpty(schoolId)) { teacherData = teacherData.Where(x => x.F_SchoolId == schoolId); @@ -2026,6 +1897,49 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les } } + /// + /// 课程表【教务】--教室下拉框信息 + /// + /// + public IEnumerable GetClassroomData(string schoolId) + { + try + { + //前五年-后五年 + var preYear = DateTime.Now.AddYears(-5).Year; + var nextYear = DateTime.Now.AddYears(5).Year; + var yearList = new List(); + for (int i = preYear; i <= nextYear; i++) + { + yearList.Add(string.Format("'{0}-{1}'", i.ToString().Substring(2), (i + 1).ToString().Substring(2))); + } + var yearListStr = string.Join(",", yearList.ToArray()); + + var strSql = new StringBuilder(); + strSql.Append("select distinct a.ClassroomNo as value,c.ClassroomName as text from "); + strSql.Append("ArrangeLessonTerm a inner join ClassroomInfo c on a.ClassroomNo=c.ClassroomNo "); + strSql.Append("where a.AcademicYearNo in (" + yearListStr + ") "); + if (!string.IsNullOrEmpty(schoolId)) + { + strSql.Append(" and a.F_SchoolId = '" + schoolId + "' "); + } + + var result = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()).OrderBy(x => x.value); + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public IEnumerable GetDepts(string academicYearNo, string semester) { try @@ -2340,32 +2254,9 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les #region MyRegion - #region 编辑课程表 - - public class UpdateLessonTermEntity - { - public string TeachClassNo { get; set; } - public string LessonNo { get; set; } - public string LessonName { get; set; } - public string EmpNo { get; set; } - public string EmpName { get; set; } - public string ClassroomNo { get; set; } - //周次 - public string WeekTimeSelect { get; set; } - //星期 - public int WeekSelect { get; set; } - //节次 - public int NodeSelect { get; set; } - } - - - #endregion - public class TimeTable { - public string Grade { get; set; } - public string StuNum { get; set; } - public string ALTId { get; set; } + public string AltId { set; get; } public DateTime LessonDate { get; set; } public string EnName { get; set; } public string AcademicYear { get; set; } @@ -2394,6 +2285,12 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les public string F_SchoolId { get; set; } public string DeptNo { get; set; } public string MajorNo { get; set; } + /// + /// 课程类型 + /// + public string LessonTypeName { get; set; } + public string LessonTypeCode { get; set; } + } @@ -2731,7 +2628,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les public string message { get; set; } /// /// List - /// ListByCondition + /// public List list { get; set; } } public class ListByCondition @@ -3014,6 +2911,9 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les } + + #endregion + public class paikeList { public string week { get; set; } @@ -3030,11 +2930,15 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les public string year { get; set; } public string semester { get; set; } public string schoolno { get; set; } + /// + /// 副讲老师编号 + /// + public string teachersNumber { get; set; } + /// + /// 副讲老师名称 + /// + public string teachersName { get; set; } } - - #endregion - - #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlan/OpenLessonPlanEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlan/OpenLessonPlanEntity.cs index 0a08002cc..b935b9974 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlan/OpenLessonPlanEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/OpenLessonPlan/OpenLessonPlanEntity.cs @@ -270,12 +270,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("ISALLOWEDIT")] public bool? IsAllowEdit { get; set; } - /// /// 排课标识 /// [Column("STATE")] public int? State { get; set; } + /// + /// 考试类型 + /// + [Column("EXAMTYPE")] + public string ExamType { get; set; } + #endregion #region 扩展操作 @@ -311,12 +316,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [NotMapped] public string MajorName { get; set; } - /// /// 教师 /// [NotMapped] public string TeachNo { 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/StuAttendance/StuAttendanceBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceBLL.cs index 79e18b6ed..58eff4892 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceBLL.cs @@ -130,11 +130,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } - public List GetStuLessonInfo(string account,string startTime,string endTime) + public List GetStuLessonInfo(string account) { try { - return stuAttendanceService.GetStuLessonInfo(account,startTime,endTime); + return stuAttendanceService.GetStuLessonInfo(account); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceEntity.cs index c08ff9091..d37bb6f15 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceEntity.cs @@ -13,6 +13,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// public class StuAttendanceEntity { + #region 实体成员 /// /// 学年度 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceIBLL.cs index f6ec07035..9bc079a8c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceIBLL.cs @@ -70,7 +70,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// void SaveEntity(string keyValue, StuAttendanceEntity entity); - List GetStuLessonInfo(string account,string startTime,string endTime); + List GetStuLessonInfo(string account); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs index b7d9910d9..53b7a38c2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuAttendance/StuAttendanceService.cs @@ -237,24 +237,11 @@ and t.Status=2"); } } - internal List GetStuLessonInfo(string account,string starTime,string endTime) + internal List GetStuLessonInfo(string account) { try { - var expression = LinqExtensions.True(); - expression = expression.And(a => a.StuNo == account); - if (!string.IsNullOrEmpty(starTime)) - { - var aTime = starTime.ToDate(); - expression = expression.And(a => a.LessonDate >= aTime); - } - - if (!string.IsNullOrEmpty(endTime)) - { - var bTime = endTime.ToDate(); - expression = expression.And(a => a.LessonDate <= bTime); - } - return this.BaseRepository("CollegeMIS").FindList(expression).ToList(); + return this.BaseRepository("CollegeMIS").FindList(a => a.StuNo == account).ToList(); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassEntity.cs index 46e29051e..c6e8e9dd7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachClass/TeachClassEntity.cs @@ -107,22 +107,22 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("LESSONSORTNO")] public string LessonSortNo { get; set; } /// - /// 学校主键Week + /// 学校主键 /// /// [Column("F_SCHOOLID")] public string F_SchoolId { get; set; } - [NotMapped] - public int? StartWeek { get; set; } - [NotMapped] - public int? EndWeek { get; set; } + [NotMapped] public string LessonName { get; set; } [NotMapped] public string LessonSortDetailNo { get; set; } [NotMapped] - public int? ClassHour { get; set; } - + public int? StartWeek { get; set; } + [NotMapped] + public int? EndWeek { get; set; } + [NotMapped] + public string ExamType { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs deleted file mode 100644 index 362de6cf2..000000000 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs +++ /dev/null @@ -1,167 +0,0 @@ -using Learun.Util; -using System; -using System.Data; -using System.Collections.Generic; - -namespace Learun.Application.TwoDevelopment.LR_Desktop -{ - /// - /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 - /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 - /// 创 建:超级管理员 - /// 日 期:2021-06-22 10:04 - /// 描 述:计算项目管理 - /// - public class DataCollectionBLL : DataCollectionIBLL - { - private DataCollectionService dataCollectionService = new DataCollectionService(); - - #region 获取数据 - - ///// - ///// 获取页面显示列表数据 - ///// - ///// 分页参数 - ///// 查询参数 - ///// - //public IEnumerable GetPageList(Pagination pagination, string queryJson) - //{ - // try - // { - // return calculateProjectService.GetPageList(pagination, queryJson); - // } - // catch (Exception ex) - // { - // if (ex is ExceptionEx) - // { - // throw; - // } - // else - // { - // throw ExceptionEx.ThrowBusinessException(ex); - // } - // } - //} - - - #endregion - public void SaveXqjbsj() - { - try - { - dataCollectionService.SaveXqjbsj(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - public void SyncLesson() - { - try - { - dataCollectionService.SyncLesson(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - - public void SyncTextBook() - { - try - { - dataCollectionService.SyncTextBook(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - - public void SyncArrangeLessonTerm() - { - try - { - dataCollectionService.SyncArrangeLessonTerm(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - - public void SyncTeacherTrain() - { - try - { - dataCollectionService.SyncTeacherTrain(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - - public void SyncTeacherQualifications() - { - try - { - dataCollectionService.SyncTeacherQualifications(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowBusinessException(ex); - } - } - } - - } -} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs deleted file mode 100644 index 7e6a89b8b..000000000 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Learun.Util; -using System.Data; -using System.Collections.Generic; - -namespace Learun.Application.TwoDevelopment.LR_Desktop -{ - public interface DataCollectionIBLL - { - void SaveXqjbsj(); - void SyncLesson(); - void SyncTextBook(); - void SyncArrangeLessonTerm(); - void SyncTeacherTrain(); - void SyncTeacherQualifications(); - } -} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs deleted file mode 100644 index 5886d116a..000000000 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs +++ /dev/null @@ -1,585 +0,0 @@ -using Dapper; -using Learun.DataBase.Repository; -using Learun.Util; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Learun.Application.Organization; -using Learun.Application.Base.SystemModule; -using Learun.Application.TwoDevelopment.EducationalAdministration; -using Learun.Cache.Redis; -using Learun.Application.TwoDevelopment.PersonnelManagement; - -namespace Learun.Application.TwoDevelopment.LR_Desktop -{ - /// - /// 智慧大脑数据采集 - /// - public class DataCollectionService : RepositoryFactory - { - CacheByRedis _redis = new CacheByRedis(); - #region 获取数据 - //接口地址 - private static string InsUrl = ConfigurationManager.AppSettings["CYInsUrl"]; - //客户标识 - private static string client_id = ConfigurationManager.AppSettings["CYClient_id"]; - //用户名 - private static string username = ConfigurationManager.AppSettings["CYUsername"]; - //密码 - private static string password = ConfigurationManager.AppSettings["CYPassword"]; - //数据采集接口地址 - private static string saveIncrUrl = InsUrl + "/prod-api/api/web/collect/interface/saveIncrData"; - ////令牌 - //private string access_token; - ////刷新密钥 - //private string client_secret; - ////刷新令牌 - //private string refresh_token; - - public DataCollectionService() - { - try - { - var refresh_token = _redis.Read("refresh_token") == "null" ? "" : _redis.Read("refresh_token"); - var access_token = _redis.Read("access_token") == "null" ? "" : _redis.Read("access_token"); - if (string.IsNullOrEmpty(refresh_token) || string.IsNullOrEmpty(_redis.Read("access_token"))) - { - //用户授权 - login(); - } - else if (!string.IsNullOrEmpty(refresh_token) && string.IsNullOrEmpty(_redis.Read("access_token"))) - { - //刷新token - refresh(); - } - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - /// - /// 用户授权 - /// - private void login() - { - var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login?grant_type=password&client_id=" + client_id + "&username=" + username + "&password=" + password; - var login_res_str = HttpMethods.Post(login_url); - var login_res = JsonConvert.DeserializeObject(login_res_str); - var login_data = login_res.data; - string access_token = ((dynamic)login_data)?.access_token; - string client_secret = ((dynamic)login_data)?.client_secret; - string refresh_token = ((dynamic)login_data)?.refresh_token; - _redis.Write($"access_token", access_token, TimeSpan.FromSeconds(200)); - _redis.Write($"client_secret", client_secret, TimeSpan.FromSeconds(160000)); - _redis.Write($"refresh_token", refresh_token, TimeSpan.FromSeconds(250)); - } - /// - /// 刷新token - /// - private void refresh() - { - var client_secret = (_redis.Read("client_secret"))?.Replace("\"", ""); - var refresh_token = (_redis.Read("refresh_token"))?.Replace("\"", ""); - var refresh_url = - InsUrl + "/prod-api/api/web/collect/oauth2/refresh?grant_type=refresh_token&client_id=" + - client_id + "&client_secret=" + client_secret + "&refresh_token=" + refresh_token; - var refresh_res_str = HttpMethods.Post(refresh_url); - var refresh_res = JsonConvert.DeserializeObject(refresh_res_str); - if (refresh_res == null || ((dynamic)refresh_res)?.code != 200) - { - _redis.Write($"refresh_token", "", TimeSpan.FromSeconds(60)); - //接口返回失败重新调用授权接口 - login(); - return; - } - string atoken = ((dynamic)refresh_res)?.access_token; - string rtoken = ((dynamic)refresh_res)?.refresh_token; - _redis.Write($"access_token", atoken, TimeSpan.FromSeconds(200)); - _redis.Write($"refresh_token", rtoken, TimeSpan.FromSeconds(250)); - } - /// - /// 校区基础数据 - /// - public void SaveXqjbsj() - { - try - { - var connect = (_redis.Read("access_token")).Replace("\"", ""); - //校区信息 - var entity = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - var pro = entity.F_ProvinceId.Substring(0, 2); - //区域信息 - var area = this.BaseRepository() - .FindList($"select * from LR_Base_Area where F_AreaId like '{pro}%'"); - - var empCount = this.BaseRepository("CollegeMIS").FindObject($"select count(1) from EmpInfo where CheckMark = 1"); - var stuCount = this.BaseRepository("CollegeMIS").FindObject($"select count(1) from StuInfoBasic where CheckMark = 1"); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_xqjcsj"; - var list = new List(); - - var param = new - { - xygkjcsjid = entity.F_CompanyId, - provincejgbm = entity.F_ProvinceId, - provincejgmc = area.Where(x => x.F_AreaId == entity.F_ProvinceId).FirstOrDefault().F_AreaName, - cityjgbm = entity.F_CityId, - cityjgmc = area.Where(x => x.F_AreaId == entity.F_CityId).FirstOrDefault().F_AreaName, - countyjgbm = entity.F_CountyId, - countyjgmc = area.Where(x => x.F_AreaId == entity.F_CountyId).FirstOrDefault().F_AreaName, - //统一社会信用代码 - xxjgdm = entity.F_USCreditCode, - xxjgmc = entity.F_FullName, - xqbh = entity.F_EnCode, - xqmc = entity.F_FullName, - xqjc = entity.F_SortCode, - xqszdxzqh = "", - xqdz = "", - xqyzbm = "", - xqlxdh = "", - xqfzr = "", - //校区教职工总数 - xqjzgzs = empCount, - //校区学生总数 - xqxszs = stuCount, - xqclrq = "", - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - /// - /// 课程信息数据 - /// - public void SyncLesson() - { - try - { - //校区信息 - var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - //课程数据 - var lessonInfo = this.BaseRepository("CollegeMIS").FindList($@"SELECT a.*,b.LessonTypeName FROM [dbo].[LessonInfo] a - join [dbo].[CdLessonType] b on a.lessontypeid=b.ltid - where a.checkmark=1"); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_zzkcxxsj"; - - var list = new List(); - foreach (var lesson in lessonInfo) - { - var param = new - { - gzzyqksjid = lesson.LessonId, - xxjgdm = company.F_USCreditCode, - xxjgmc = company.F_FullName, - ssxqbh = company.F_EnCode, - kcmc = lesson.LessonName, - kcdm = lesson.LessonNo, - kclb = string.IsNullOrEmpty(lesson.LessonSortDetailNo) ? "1" : lesson.LessonSortDetailNo, - kcxz = lesson.LessonTypeName.Contains("公共") || lesson.LessonTypeName.Contains("公开") ? "1" : "2", - kcsx = lesson.LessonSortNo, - kcfl = "1", - xklb = "14", - sfzyhxkc = "0", - lvjxss = lesson.WeekStudyHour > 0 ? lesson.WeekStudyHour : 0, - sjjxsy = lesson.WeekPracticeHour > 0 ? lesson.WeekStudyHour : 0, - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - } - - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var connect = _redis.Read("access_token"); - connect = (connect).Replace("\"", ""); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - - /// - /// 教材信息数据 - /// - public void SyncTextBook() - { - try - { - //校区信息 - var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - //教材数据 - var textBookInfo = this.BaseRepository("CollegeMIS").FindList(x => x.IsValid == true && x.IsDel == 0); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_jcxysj"; - - var list = new List(); - foreach (var book in textBookInfo) - { - var param = new - { - gzzyqksjid = book.ID, - xxjgdm = company.F_USCreditCode, - xxjgmc = company.F_FullName, - jcmc = book.TextBookName, - jcbh = book.TextBookNo, - //教材性质 - jcxz = "1", - //ISBN号,必填 - isbn = "9787040195194", - zzxm = book.FirstAuthor, - cbrq = book.Pubdate, - cbs = book.Publisher, - //适用层次 - sycc = "1", - //价格 - jg = book.Price > 0 ? book.Price : 0, - //版次 - bc = string.IsNullOrEmpty(book.Edition) ? "1" : book.Edition, - //印次 - yc = string.IsNullOrEmpty(book.Impression) ? "1" : book.Impression, - //是否有练习册 - sfylxc = book.IsWorkBook == true ? 1 : 0, - //是否有教参教辅 - sfyjcjf = book.IsTeachConsult == true ? 1 : 0, - //获奖情况 - hjqk = "0", - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - } - - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var connect = _redis.Read("access_token"); - connect = (connect).Replace("\"", ""); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - - /// - /// 排课数据 - /// - public void SyncArrangeLessonTerm() - { - try - { - //校区信息 - var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - - var semesterAndYear = Common.GetSemesterAndYear(); - var strAcademicYear = semesterAndYear.AcademicYearShort; - var strSemester = semesterAndYear.Semester; - string sql = $@"select d.Grade,d.StuNum,b.ALTId,b.F_SchoolId,b.DeptNo,b.MajorNo,b.AcademicYearNo as AcademicYear,b.LessonNo,b.LessonName,b.LessonTime,b.LessonDate,b.EmpNo,b.Empname EmpName,replace (b.TeachClassNo,b.LessonName,'') TeachClassNo, c.ClassroomName,b.Semester,b.ClassroomNo as ClassRoomNo,b.LessonSortNo,d.ClassName - from ArrangeLessonTerm b - left join ClassroomInfo c on c.ClassroomNo=b.classroomNo - left join ClassInfo d on replace(b.TeachClassNo,b.LessonName,'')=d.ClassNo - where b.AcademicYearNo='{strAcademicYear}' and b.Semester='{strSemester}' - and b.LessonDate>='{DateTime.Now.AddDays(-30)}' and b.LessonDate<='{DateTime.Now}' - and b.CheckMark=1"; - var result = BaseRepository("CollegeMIS").FindList(sql); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_zzxkpksj"; - - var list = new List(); - foreach (var data in result) - { - var lessonTime = data.LessonTime.Split('-'); - var param = new - { - gzzyqksjid = data.ALTId, - xxjgdm = company.F_USCreditCode, - xxjgmc = company.F_FullName, - ssxqbh = company.F_EnCode, - nj = data.Grade, - bj = data.TeachClassNo, - xn = data.AcademicYear, - xq = data.Semester == "1" ? "第一学期" : "第二学期", - zc = "", - xqj = GetStr(lessonTime[0]), - skjc = lessonTime[1], - skrq = data.LessonDate, - kcmc = data.LessonName, - kcdm = data.LessonNo, - jgh = data.EmpNo, - jxbrs = data.StuNum, - skkssj = GetTime(lessonTime[1])[0], - skjssj = GetTime(lessonTime[1])[1], - sdxsrs = data.StuNum, - jsdkqk = "1", - xkr = "", - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - } - - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var connect = _redis.Read("access_token"); - connect = (connect).Replace("\"", ""); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - private string GetStr(string num) - { - var str = ""; - switch (num) - { - case "1": - str = "星期一"; break; - case "2": - str = "星期二"; break; - case "3": - str = "星期三"; break; - case "4": - str = "星期四"; break; - case "5": - str = "星期五"; break; - case "6": - str = "星期六"; break; - case "7": - str = "星期日"; break; - case "8": - str = "星期八"; break; - case "9": - str = "星期九"; break; - case "10": - str = "星期十"; break; - } - return str; - } - - private string GetTime(string jc) - { - var str = ""; - //06:55-07:30,08:10-08:55,09:05-09:50,10:20-11:05,11:15-12:00,14:30-15:15,15:25-16:10,16:20-17:05,18:20-19:05,19:15-20:00,20:10-20:55 - switch (jc) - { - case "1": - str = "06:55-07:30"; break; - case "2": - str = "08:10-08:55"; break; - case "3": - str = "09:05-09:50"; break; - case "4": - str = "10:20-11:05"; break; - case "5": - str = "11:15-12:00"; break; - case "6": - str = "14:30-15:15"; break; - case "7": - str = "15:25-16:10"; break; - case "8": - str = "16:20-17:05"; break; - case "9": - str = "18:20-19:05"; break; - case "10": - str = "19:15-20:00"; break; - case "11": - str = "20:10-20:55"; break; - } - - return str; - } - - /// - /// 教师进修培训 - /// - public void SyncTeacherTrain() - { - try - { - //校区信息 - var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - //教师培训数据 - var teacherTrain = this.BaseRepository().FindList(); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_jxpxsj"; - - var list = new List(); - foreach (var data in teacherTrain) - { - var param = new - { - gzzyqksjid = data.TTID, - xxjgdm = company.F_USCreditCode, - xxjgmc = company.F_FullName, - jxpxhdbh = data.TTEnCode, - jxpxhdmc = data.TTContent, - jxpxhdzt = "", - jxpxhdnrjj = "", - jxpxhdsj = data.TTStartTime, - zjr = "", - drpxhdcyjss = data.TTEmpNum, - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - } - - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var connect = _redis.Read("access_token"); - connect = (connect).Replace("\"", ""); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - - /// - /// 教师资质证书 - /// - public void SyncTeacherQualifications() - { - try - { - //校区信息 - var company = this.BaseRepository().FindList(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); - //教师数据 - var teacherTrain = this.BaseRepository("CollegeMIS").FindList($@"select min(empid) as gzzyqksjid,count(1) as jszgzrs, sum(case when JobRank in (1,2,3,4) then 1 else 0 end) as gjzcrs, -sum(case when JobRank in (5,6,7,8) then 1 else 0 end) as zjzcrs, -sum(case when JobRank not in (1,2,3,4,5,6,7,8) then 1 else 0 end) as cjzcrs - from empinfo "); - - ParamModel paramModel = new ParamModel(); - paramModel.dataObjName = "ods_zzzssj"; - - var list = new List(); - foreach (var data in teacherTrain) - { - var param = new - { - gzzyqksjid = company.F_CompanyId,// data.gzzyqksjid, - xxjgdm = company.F_USCreditCode, - xxjgmc = company.F_FullName, - jszgzrs = data.jszgzrs, - gjzcrs = data.gjzcrs, - zjzcrs = data.zjzcrs, - cjzcrs = data.cjzcrs, - sjcjsj = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") - }; - list.Add(param); - } - - paramModel.fileds = list; - var json = JsonConvert.SerializeObject(paramModel); - var connect = _redis.Read("access_token"); - connect = (connect).Replace("\"", ""); - var res = HttpMethods.HttpPostConnect(saveIncrUrl, json, connect); - } - catch (ExceptionEx ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - #endregion - - #region MyRegion - - public class InsResult - { - public int code { get; set; } - public string msg { get; set; } - public object data { get; set; } - } - - public class ParamModel - { - public string dataObjName { get; set; } - public List fileds { get; set; } - } - - public class TeacherQualificationsEntity - { - public string gzzyqksjid { get; set; } - public int jszgzrs { get; set; } - public int gjzcrs { get; set; } - public int zjzcrs { get; set; } - public int cjzcrs { get; set; } - } - - #endregion - } -} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 3892cb067..f52c9cd3a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -429,9 +429,6 @@ - - - diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs index f0eaa54f6..12e7f01aa 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; namespace Learun.Util @@ -368,9 +369,10 @@ namespace Learun.Util //当年的第一天是星期几 int firstOfWeek = Convert.ToInt32(firstDay.DayOfWeek); - + if (firstOfWeek == 0) + firstOfWeek = 7; //计算当年第一周的起止日期,可能跨年 - int dayDiff = (-1) * firstOfWeek + 1; + int dayDiff = (-1) * firstOfWeek-1; int dayAdd = 7 - firstOfWeek; firstDate = firstDay.AddDays(dayDiff).Date; @@ -503,6 +505,64 @@ namespace Learun.Util return strDate; } #endregion + + + /// + /// 获取当前日期在指定时间范围内是第几周 + /// + /// + /// + /// + public static int GetWeekOfDay(DateTime start, DateTime end) + { + //总周数 + var weekCount = Math.Ceiling(Convert.ToDouble((end - start).Days / 7)); + //用于存储日期 + var weekDic = new Dictionary(); + + var today = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); + + for (var i = 0; i < weekCount; i++) + { + for (var j = 0; j < 7; j++) + { + weekDic.Add(start.AddDays(i * 7 + j), i + 1); + } + } + + return weekDic.ContainsKey(today) ? weekDic[today] : 1; + } + + /// + /// 根据开始日期和结束日期返回这段时间的周数 + /// 过周日算一周 + /// + /// 开始日期 + /// 结束日期 + /// + public static int GetWeekCount(DateTime startTime, DateTime endTime) + { + //获取开始时间的星期一 + int startWeek = Convert.ToInt32(startTime.DayOfWeek); + //因为是以星期一为第一天,所以要判断weeknow等于0时,要向前推6天。 + startWeek = (startWeek == 0 ? (7 - 1) : (startWeek - 1)); + int daydiff = (-1) * startWeek; + string firstDay = startTime.AddDays(daydiff).ToString("yyyy-MM-dd"); + DateTime startMonday = Convert.ToDateTime(firstDay); + //获取结束时间的星期日 + int lastWeek = Convert.ToInt32(endTime.DayOfWeek); + int daydiff1 = 0; + if (lastWeek != 0) + { + daydiff1 = 7 - lastWeek; + } + //本周最后一天 + string lastDay = endTime.AddDays(daydiff1).ToString("yyyy-MM-dd"); + DateTime lastSunday = Convert.ToDateTime(lastDay); + TimeSpan timeSpan = (lastSunday - startMonday); + //返回总周数 + return Convert.ToInt32(timeSpan.Days + 1) / 7; + } /// /// 获取当前日期是星期几 /// diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json index 87577390d..34d89e913 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__E4958C9", "description" : "智慧校园移动端", "versionName" : "1.0.0", - "versionCode" : 3, + "versionCode" : 4, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue index 1bc43b77d..62976e4d9 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/timeTable/list.vue @@ -6,45 +6,49 @@ {{ semester }} - + + + + - - - {{ item.en }} - {{ item.cn }} - + + {{ item.en }} + {{ item.cn }} - - + - - 该时间段没有课表 - - - - 第 {{ k.jc }} 节 + 该时间段没有课表 + + + 第 {{ k.sectionTime }} 节 - {{ k.curriculum }} + {{ k.LessonName }} + {{ k.ClassName }} - {{ k.teacher }} + {{ k.EmpName }} - {{ k.className }} + {{ k.ClassroomName }} @@ -57,364 +61,362 @@