@@ -26,14 +26,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
public class ArrangeLessonTermController : MvcControllerBase | public class ArrangeLessonTermController : MvcControllerBase | ||||
{ | { | ||||
private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | ||||
private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); | |||||
private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | private Sys_InformationPushIBLL sys_InformationPushIBLL = new Sys_InformationPushBLL(); | ||||
private UserIBLL userIbll = new UserBLL(); | private UserIBLL userIbll = new UserBLL(); | ||||
private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); | private WeChatConfigIBLL weChatConfigIbll = new WeChatConfigBLL(); | ||||
private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); | private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); | ||||
private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL(); | |||||
private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); | |||||
private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); | |||||
#region 视图功能 | #region 视图功能 | ||||
@@ -78,48 +74,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
[HttpGet] | |||||
public ActionResult IndexLessonTerm() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | |||||
/// 学生课表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[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(); | |||||
} | |||||
/// <summary> | |||||
/// 教师课表 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[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 | #endregion | ||||
#region 获取数据 | #region 获取数据 | ||||
@@ -156,19 +110,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
}; | }; | ||||
return Success(jsonData); | return Success(jsonData); | ||||
} | } | ||||
/// <summary> | |||||
/// 排课管理 获取左侧树结构 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetTree() | |||||
{ | |||||
var data = arrangeLessonTermIBLL.GetTree(); | |||||
return Success(data); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取表单数据 | /// 获取表单数据 | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -181,225 +122,22 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
var data = arrangeLessonTermIBLL.GetEntity(keyValue); | var data = arrangeLessonTermIBLL.GetEntity(keyValue); | ||||
return Success(data); | return Success(data); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 获取周次 | |||||
/// 获取调度时间数据 | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpGet] | [HttpGet] | ||||
[AjaxOnly] | [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<Object>(); | |||||
for (int i = 1; i <= weekTimes; i++) | |||||
{ | |||||
listObj.Add(new { text = i + "周", value = i }); | |||||
} | |||||
var jsonData = new | |||||
{ | |||||
weekList = listObj, | |||||
curWeek = curWeek, | |||||
}; | |||||
return Success(jsonData); | |||||
} | |||||
/// <summary> | |||||
/// 有多少周 | |||||
/// 返回 int | |||||
/// </summary> | |||||
/// <returns>int</returns> | |||||
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; | |||||
} | |||||
/// <summary> | |||||
/// 求当前日期是第几周 | |||||
/// </summary> | |||||
/// <param name="date"></param> | |||||
/// <returns></returns> | |||||
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; | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 课程表【教务】 | |||||
/// </summary> | |||||
/// <param name="classNo">班级</param> | |||||
/// <param name="curWeek">当前第几周</param> | |||||
/// <returns></returns> | |||||
[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<TimeTable>(); | |||||
//课程表 | |||||
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 | #endregion | ||||
#region 提交数据 | #region 提交数据 | ||||
@@ -429,41 +167,6 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
arrangeLessonTermIBLL.SaveEntity(keyValue, entity); | arrangeLessonTermIBLL.SaveEntity(keyValue, entity); | ||||
return Success("保存成功!"); | return Success("保存成功!"); | ||||
} | } | ||||
/// <summary> | |||||
/// 删除课程 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult DeleteLessonTerm(string keyValue, string WeekTime) | |||||
{ | |||||
arrangeLessonTermIBLL.DeleteLessonTerm(keyValue, WeekTime); | |||||
return Success("删除成功!"); | |||||
} | |||||
/// <summary> | |||||
///修改课程 | |||||
/// <param name="keyValue">主键</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult UpdateLessonTerm(string keyValue, string postdata) | |||||
{ | |||||
UpdateLessonTermEntity model = postdata.ToObject<UpdateLessonTermEntity>(); | |||||
var res = arrangeLessonTermIBLL.UpdateLessonTerm(keyValue, model); | |||||
if (!string.IsNullOrEmpty(res)) | |||||
{ | |||||
return Fail(res); | |||||
} | |||||
return Success("操作成功!"); | |||||
} | |||||
#endregion | #endregion | ||||
/// <summary> | /// <summary> | ||||
@@ -588,11 +291,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers | |||||
"\"template_id\":\"" + weixintasktempid + "\"," + | "\"template_id\":\"" + weixintasktempid + "\"," + | ||||
"\"url\":\"" + weixintaskurl + "\"," + | "\"url\":\"" + weixintaskurl + "\"," + | ||||
"\"data\":{" + | "\"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); | string pushresult = Util.HttpMethods.HttpPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, jsondata); | ||||
@@ -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 | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-06-22 10:04 | |||||
/// 描 述:计算项目管理 | |||||
/// </summary> | |||||
public class DataCollectionController : MvcControllerBase | |||||
{ | |||||
private DataCollectionIBLL dataCollectionIBLL = new DataCollectionBLL(); | |||||
#region 视图功能 | |||||
/// <summary> | |||||
/// 主页面 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult Index() | |||||
{ | |||||
return View(); | |||||
} | |||||
#endregion | |||||
/// <summary> | |||||
/// 校区基础信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncCompany() | |||||
{ | |||||
dataCollectionIBLL.SaveXqjbsj(); | |||||
return Success("操作成功"); | |||||
} | |||||
/// <summary> | |||||
/// 校区基础信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncLesson() | |||||
{ | |||||
dataCollectionIBLL.SyncLesson(); | |||||
return Success("操作成功"); | |||||
} | |||||
/// <summary> | |||||
/// 教材信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncTextBook() | |||||
{ | |||||
dataCollectionIBLL.SyncTextBook(); | |||||
return Success("操作成功"); | |||||
} | |||||
/// <summary> | |||||
/// 排课数据 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncArrangeLessonTerm() | |||||
{ | |||||
dataCollectionIBLL.SyncArrangeLessonTerm(); | |||||
return Success("操作成功"); | |||||
} | |||||
/// <summary> | |||||
/// 教师进修培训数据 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncTeacherTrain() | |||||
{ | |||||
dataCollectionIBLL.SyncTeacherTrain(); | |||||
return Success("操作成功"); | |||||
} | |||||
/// <summary> | |||||
/// 教师进修培训数据 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpPost] | |||||
[AjaxOnly] | |||||
public ActionResult SyncTeacherQualifications() | |||||
{ | |||||
dataCollectionIBLL.SyncTeacherQualifications(); | |||||
return Success("操作成功"); | |||||
} | |||||
} | |||||
} |
@@ -85,6 +85,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
return View(); | return View(); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 班级课程表【教务】 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult ClassIndexInEducation() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | |||||
/// 课程表【教学调度】 | /// 课程表【教学调度】 | ||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -93,6 +102,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
/// <summary> | |||||
/// 课程表【教学调度】--调课 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult IndexInEducationSelect_() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 课程表--修改教师所带的课程【教务】 | /// 课程表--修改教师所带的课程【教务】 | ||||
@@ -112,6 +130,85 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
{ | { | ||||
return View(); | return View(); | ||||
} | } | ||||
/// <summary> | |||||
/// 表单--修改教师所带的课程【教务】 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
public ActionResult SchoolLesson() | |||||
{ | |||||
return View(); | |||||
} | |||||
/// <summary> | |||||
/// 表单--修改教师所带的课程【教务】 | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
[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<WeekDate>(); | |||||
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 { }); | |||||
} | |||||
/// <summary> | |||||
/// 获取当前日期是第几周 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[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); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取表单数据 | /// 获取表单数据 | ||||
@@ -217,70 +314,76 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
{ | { | ||||
return JsonResult(noDataResult); | 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) | //foreach (var item in formatData.list) | ||||
//{ | //{ | ||||
@@ -297,7 +400,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpGet] | [HttpGet] | ||||
[AjaxOnly] | [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(); | var userInfo = LoginUserInfo.Get(); | ||||
//开始时间 | //开始时间 | ||||
@@ -311,11 +414,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
var timeTableList = new List<TimeTable>(); | var timeTableList = new List<TimeTable>(); | ||||
//课程表 | //课程表 | ||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | |||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, classroomNo); | |||||
timeTableList.AddRange(data); | 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 timeTables = timeTableList.ToList(); | ||||
var noDataResult = new | var noDataResult = new | ||||
@@ -324,6 +428,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
{ | { | ||||
return JsonResult(noDataResult); | 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 | var formatData = from d in timeTables | ||||
let tt = d.LessonTime.Substring(1) | let tt = d.LessonTime.Substring(1) | ||||
group d by tt into g | 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(), | classRoomNo = string.IsNullOrEmpty(e.ClassRoomNo) ? "" : e.ClassRoomNo.Trim(), | ||||
lessonSortNo = e.LessonSortNo, | lessonSortNo = e.LessonSortNo, | ||||
e?.OLPEId, | 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 | var result = new | ||||
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = formatData }; | |||||
{ schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", maxlessontime, classinfolist, weekList = formatData }; | |||||
return JsonResult(result); | return JsonResult(result); | ||||
} | } | ||||
@@ -380,7 +490,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
var timeTableList = new List<TimeTable>(); | var timeTableList = new List<TimeTable>(); | ||||
//课程表 | //课程表 | ||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | |||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, ""); | |||||
timeTableList.AddRange(data); | timeTableList.AddRange(data); | ||||
//选修课课程表 | //选修课课程表 | ||||
//var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | //var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | ||||
@@ -405,6 +515,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
where ee == g.Key | where ee == g.Key | ||||
select new | select new | ||||
{ | { | ||||
AltId = e.AltId, | |||||
day = e.LessonTime.ToCharArray()[0], | day = e.LessonTime.ToCharArray()[0], | ||||
lessonTime = e.LessonTime, | lessonTime = e.LessonTime, | ||||
lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), | lessonDate = e.LessonDate.ToString("yyyy-MM-dd"), | ||||
@@ -412,6 +523,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
academicyear = semesterAndYear.AcademicYearShort, | academicyear = semesterAndYear.AcademicYearShort, | ||||
semester = strSemester, | semester = strSemester, | ||||
deptNo = e?.DeptNo, | deptNo = e?.DeptNo, | ||||
deptname = "", | |||||
majorNo = e?.MajorNo, | majorNo = e?.MajorNo, | ||||
lessonNo = e?.LessonNo, | lessonNo = e?.LessonNo, | ||||
curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, | curriculum = e.LessonSortNo == "2" ? e.LessonName + "[选修]" : e.LessonName, | ||||
@@ -457,6 +569,19 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||||
return Success(data); | return Success(data); | ||||
} | } | ||||
/// <summary> | |||||
/// 课程表【教务】--教室下拉框信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
[HttpGet] | |||||
[AjaxOnly] | |||||
public ActionResult GetClassroomData(string schoolId = "") | |||||
{ | |||||
var data = arrangeLessonTermIBLL.GetClassroomData(schoolId); | |||||
return Success(data); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 表单--修改教师所带的课程【教务】--课程下拉框信息 | /// 表单--修改教师所带的课程【教务】--课程下拉框信息 | ||||
/// </summary> | /// </summary> | ||||
@@ -423,7 +423,6 @@ | |||||
<Compile Include="Areas\LR_CRMModule\Controllers\ReceivableController.cs" /> | <Compile Include="Areas\LR_CRMModule\Controllers\ReceivableController.cs" /> | ||||
<Compile Include="Areas\LR_CRMModule\Controllers\TrailRecordController.cs" /> | <Compile Include="Areas\LR_CRMModule\Controllers\TrailRecordController.cs" /> | ||||
<Compile Include="Areas\LR_CRMModule\LR_CRMModuleAreaRegistration.cs" /> | <Compile Include="Areas\LR_CRMModule\LR_CRMModuleAreaRegistration.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DataCollectionController.cs" /> | |||||
<Compile Include="Areas\LR_Desktop\Controllers\DTChartController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTChartController.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DTListController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTListController.cs" /> | ||||
<Compile Include="Areas\LR_Desktop\Controllers\DTSettingController.cs" /> | <Compile Include="Areas\LR_Desktop\Controllers\DTSettingController.cs" /> | ||||
@@ -13,7 +13,7 @@ using Nancy; | |||||
namespace Learun.Application.WebApi.Modules | namespace Learun.Application.WebApi.Modules | ||||
{ | { | ||||
public class TimeTable : BaseNoLoginApi | |||||
public class TimeTable : BaseApi | |||||
{ | { | ||||
public TimeTable() | public TimeTable() | ||||
: base("/learun/adms/timetable") | : base("/learun/adms/timetable") | ||||
@@ -22,15 +22,70 @@ namespace Learun.Application.WebApi.Modules | |||||
Get["/StuList"] = GetStuInfo; | Get["/StuList"] = GetStuInfo; | ||||
Get["/StuLessonInfo"] = GetStuLessonInfo; | Get["/StuLessonInfo"] = GetStuLessonInfo; | ||||
Get["/timeTableData"] = GetTimeTableData; | Get["/timeTableData"] = GetTimeTableData; | ||||
Get["/TenDay"] = GetTenDay; | |||||
Get["/weeklist"] = GetWeeksData; | |||||
Get["/currentweek"] = GetCurrentWeek; | |||||
} | } | ||||
private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); | ||||
private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); | private ArrangeLessonTermOfElectiveIBLL arrangeLessonTermOfElectiveIBLL = new ArrangeLessonTermOfElectiveBLL(); | ||||
private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL(); | private StuAttendanceLeaveIBLL stuAttendanceLeaveIBLL = new StuAttendanceLeaveBLL(); | ||||
private StuAttendanceIBLL stuAttendanceIBLL = new StuAttendanceBLL(); | 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<WeekDate>(); | |||||
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 { }); | |||||
} | |||||
/// <summary> | |||||
/// 获取当前日期是第几周 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
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}); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 课程表【教师功能、学生功能】 | /// 课程表【教师功能、学生功能】 | ||||
@@ -88,8 +143,7 @@ namespace Learun.Application.WebApi.Modules | |||||
public Response GetStuLessonInfo(dynamic _) | public Response GetStuLessonInfo(dynamic _) | ||||
{ | { | ||||
var param = this.GetReqData<TimeParameter>(); | |||||
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 empNos = lessonInfos.Select(a => a.EmpNo).ToList(); | ||||
var lessonTerms = arrangeLessonTermIBLL.GetListByEmpNo(empNos); | var lessonTerms = arrangeLessonTermIBLL.GetListByEmpNo(empNos); | ||||
@@ -97,7 +151,7 @@ namespace Learun.Application.WebApi.Modules | |||||
{ | { | ||||
a.LessonName, | a.LessonName, | ||||
LessonDate = Convert.ToDateTime(a.LessonDate).ToString("yyyy-MM-dd"), | 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.LessonTime, | ||||
a.EmpNo, | a.EmpNo, | ||||
a.ClassRoomName, | a.ClassRoomName, | ||||
@@ -123,6 +177,7 @@ namespace Learun.Application.WebApi.Modules | |||||
/// </summary> | /// </summary> | ||||
/// <param name="_"></param> | /// <param name="_"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
private Response GetTimeTableData(dynamic _) | private Response GetTimeTableData(dynamic _) | ||||
{ | { | ||||
var param = this.GetReq<TimeParameter>(); | var param = this.GetReq<TimeParameter>(); | ||||
@@ -143,7 +198,7 @@ namespace Learun.Application.WebApi.Modules | |||||
//课程表数据 | //课程表数据 | ||||
var timeTableList = new List<Learun.Application.TwoDevelopment.EducationalAdministration.TimeTable>(); | var timeTableList = new List<Learun.Application.TwoDevelopment.EducationalAdministration.TimeTable>(); | ||||
//必修课课程表 | //必修课课程表 | ||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); | |||||
var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, "", ""); | |||||
timeTableList.AddRange(data); | timeTableList.AddRange(data); | ||||
//选修课课程表 | //选修课课程表 | ||||
var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); | var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, param.ClassNo, param.EmpNo, ""); | ||||
@@ -180,96 +235,6 @@ namespace Learun.Application.WebApi.Modules | |||||
} | } | ||||
/// <summary> | |||||
/// 课程表【教师功能、学生功能】 | |||||
/// </summary> | |||||
/// <param name="_"></param> | |||||
/// <returns></returns> | |||||
public Response GetTenDay(dynamic _) | |||||
{ | |||||
var param = this.GetReqData<TimeParameter>(); | |||||
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); | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 数字转中文 | /// 数字转中文 | ||||
/// </summary> | /// </summary> | ||||
@@ -314,37 +279,6 @@ namespace Learun.Application.WebApi.Modules | |||||
} | } | ||||
return res; | return res; | ||||
} | } | ||||
/// <summary> | |||||
/// 换算周次 | |||||
/// </summary> | |||||
/// <param name="curDay"></param> | |||||
/// <param name="startTime"></param> | |||||
/// <param name="endTime"></param> | |||||
/// <returns></returns> | |||||
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 | |||||
/// 教师编号 | /// 教师编号 | ||||
/// </summary> | /// </summary> | ||||
public string EmpNo { get; set; } | public string EmpNo { get; set; } | ||||
public string Description { get; set; } | |||||
public string Account { get; set; } | |||||
} | } | ||||
public class TimeTableData | public class TimeTableData | ||||
{ | { | ||||
@@ -18,9 +18,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
public class ArrangeLessonTermBLL : ArrangeLessonTermIBLL | public class ArrangeLessonTermBLL : ArrangeLessonTermIBLL | ||||
{ | { | ||||
private ArrangeLessonTermService arrangeLessonTermService = new ArrangeLessonTermService(); | private ArrangeLessonTermService arrangeLessonTermService = new ArrangeLessonTermService(); | ||||
private CdDeptService cdDeptService = new CdDeptService(); | |||||
private CdMajorService cdMajorService = new CdMajorService(); | |||||
private ClassInfoService classInfoService = new ClassInfoService(); | |||||
#region 获取数据 | #region 获取数据 | ||||
@@ -46,17 +43,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 获取列表分页数据 | |||||
/// <param name="pagination">分页参数</param> | |||||
/// <summary> | |||||
/// <returns></returns> | |||||
public IEnumerable<ArrangeLessonTermEntity> GetPageList(Pagination pagination, string queryJson) | |||||
public IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
return arrangeLessonTermService.GetPageList(pagination, queryJson); | |||||
return arrangeLessonTermService.GetListForTimeTable(queryJson); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -70,63 +61,16 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 获取左侧树形数据 | |||||
/// 获取列表分页数据 | |||||
/// <param name="pagination">分页参数</param> | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public List<TreeModel> GetTree() | |||||
public IEnumerable<ArrangeLessonTermEntity> GetPageList(Pagination pagination, string queryJson) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
DataTable cdDeptlist = cdDeptService.GetSqlTree(); | |||||
DataTable cdMajorlist = cdMajorService.GetSqlTree(); | |||||
DataTable classInfolist = classInfoService.GetSqlTree(); | |||||
List<TreeModel> treeList = new List<TreeModel>(); | |||||
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) | 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); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 保存实体数据(新增、修改) | /// 保存实体数据(新增、修改) | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -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<StuInfoBasicEntity> GetStudents() | public IEnumerable<StuInfoBasicEntity> GetStudents() | ||||
{ | { | ||||
try | try | ||||
@@ -548,12 +454,13 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <param name="endDate">查询截止时间</param> | /// <param name="endDate">查询截止时间</param> | ||||
/// <param name="classNo">班级编号</param> | /// <param name="classNo">班级编号</param> | ||||
/// <param name="empNo">教师编号</param> | /// <param name="empNo">教师编号</param> | ||||
/// <param name="classroomNo">教室编号</param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
public IEnumerable<TimeTable> GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId) | |||||
public IEnumerable<TimeTable> GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
return arrangeLessonTermService.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId); | |||||
return arrangeLessonTermService.GetTimeTableInEducation(startDate, endDate, classNo, empNo, schoolId, classroomNo); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -615,6 +522,29 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
} | } | ||||
/// <summary> | |||||
/// 课程表【教务】--教室下拉框信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public IEnumerable<SelectModel> GetClassroomData(string schoolId) | |||||
{ | |||||
try | |||||
{ | |||||
return arrangeLessonTermService.GetClassroomData(schoolId); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowBusinessException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 教学调度【教务】--课程下拉框信息 | /// 教学调度【教务】--课程下拉框信息 | ||||
/// </summary> | /// </summary> | ||||
@@ -13,6 +13,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// </summary> | /// </summary> | ||||
public class ArrangeLessonTermEntity | public class ArrangeLessonTermEntity | ||||
{ | { | ||||
#region 实体成员 | #region 实体成员 | ||||
/// <summary> | /// <summary> | ||||
/// 标识列 | /// 标识列 | ||||
@@ -106,7 +107,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
public string JoinLessonNum { get; set; } | public string JoinLessonNum { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 合上班 | /// 合上班 | ||||
///(教学班中对应的所有行政班号 ,以逗号隔开) | |||||
///(教学班中对应的所有行政班号 ,以逗号隔开) | |||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[Column("RELATEDCLASSNO")] | [Column("RELATEDCLASSNO")] | ||||
@@ -157,6 +158,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// </summary> | /// </summary> | ||||
[NotMapped] public string SyncType { get; set; } | [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 | #endregion | ||||
#region 扩展操作 | #region 扩展操作 | ||||
@@ -48,6 +48,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<ArrangeLessonTermEntity> GetList(string queryJson); | IEnumerable<ArrangeLessonTermEntity> GetList(string queryJson); | ||||
IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson); | |||||
Task<bool> AsyncArrangeLessonData(); | Task<bool> AsyncArrangeLessonData(); | ||||
Task<bool> AsyncModifyArrangeLessonData(); | Task<bool> AsyncModifyArrangeLessonData(); | ||||
@@ -68,8 +70,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<ArrangeLessonTermEntity> GetPageList(Pagination pagination, string queryJson); | IEnumerable<ArrangeLessonTermEntity> GetPageList(Pagination pagination, string queryJson); | ||||
List<TreeModel> GetTree(); | |||||
/// <summary> | /// <summary> | ||||
/// 获取实体数据 | /// 获取实体数据 | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -86,8 +86,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
void DeleteEntity(string keyValue); | void DeleteEntity(string keyValue); | ||||
void DeleteLessonTerm(string keyValue,string WeekTime); | |||||
string UpdateLessonTerm(string keyValue, UpdateLessonTermEntity model); | |||||
/// <summary> | /// <summary> | ||||
/// 保存实体数据(新增、修改) | /// 保存实体数据(新增、修改) | ||||
/// <param name="keyValue">主键</param> | /// <param name="keyValue">主键</param> | ||||
@@ -109,8 +107,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <param name="endDate">查询截止时间</param> | /// <param name="endDate">查询截止时间</param> | ||||
/// <param name="classNo">班级编号</param> | /// <param name="classNo">班级编号</param> | ||||
/// <param name="empNo">教师编号</param> | /// <param name="empNo">教师编号</param> | ||||
/// <param name="classroomNo">教室编号</param> | |||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<TimeTable> GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId); | |||||
IEnumerable<TimeTable> GetTimeTableInEducation(string startDate, string endDate, string classNo, string empNo, string schoolId, string classroomNo); | |||||
/// <summary> | /// <summary> | ||||
/// 课程表【教务】--班级下拉框信息 | /// 课程表【教务】--班级下拉框信息 | ||||
@@ -124,6 +123,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <param name="startDate"></param> | /// <param name="startDate"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
IEnumerable<SelectModel> GetTeacherData(string schoolId); | IEnumerable<SelectModel> GetTeacherData(string schoolId); | ||||
/// <summary> | |||||
/// 课程表【教务】--教室下拉框信息 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
IEnumerable<SelectModel> GetClassroomData(string schoolId); | |||||
bool GetAny(); | bool GetAny(); | ||||
IEnumerable<CdDeptEntity> GetDepts(string academicYearNo, string semester); | IEnumerable<CdDeptEntity> GetDepts(string academicYearNo, string semester); | ||||
IEnumerable<CdDeptEntity> GetDeptsNotRecord(string academicYearNo, string semester); | IEnumerable<CdDeptEntity> GetDeptsNotRecord(string academicYearNo, string semester); | ||||
@@ -270,12 +270,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// </summary> | /// </summary> | ||||
[Column("ISALLOWEDIT")] | [Column("ISALLOWEDIT")] | ||||
public bool? IsAllowEdit { get; set; } | public bool? IsAllowEdit { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 排课标识 | /// 排课标识 | ||||
/// </summary> | /// </summary> | ||||
[Column("STATE")] | [Column("STATE")] | ||||
public int? State { get; set; } | public int? State { get; set; } | ||||
/// <summary> | |||||
/// 考试类型 | |||||
/// </summary> | |||||
[Column("EXAMTYPE")] | |||||
public string ExamType { get; set; } | |||||
#endregion | #endregion | ||||
#region 扩展操作 | #region 扩展操作 | ||||
@@ -311,12 +316,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// </summary> | /// </summary> | ||||
[NotMapped] | [NotMapped] | ||||
public string MajorName { get; set; } | public string MajorName { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 教师 | /// 教师 | ||||
/// </summary> | /// </summary> | ||||
[NotMapped] | [NotMapped] | ||||
public string TeachNo { get; set; } | public string TeachNo { get; set; } | ||||
/// <summary> | |||||
/// 课程类型 | |||||
/// </summary> | |||||
[NotMapped] | |||||
public string LessonTypeId { get; set; } | |||||
#endregion | #endregion | ||||
} | } | ||||
} | } | ||||
@@ -130,11 +130,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
} | } | ||||
public List<StuAttendanceEntity> GetStuLessonInfo(string account,string startTime,string endTime) | |||||
public List<StuAttendanceEntity> GetStuLessonInfo(string account) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
return stuAttendanceService.GetStuLessonInfo(account,startTime,endTime); | |||||
return stuAttendanceService.GetStuLessonInfo(account); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -13,6 +13,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// </summary> | /// </summary> | ||||
public class StuAttendanceEntity | public class StuAttendanceEntity | ||||
{ | { | ||||
#region 实体成员 | #region 实体成员 | ||||
/// <summary> | /// <summary> | ||||
/// 学年度 | /// 学年度 | ||||
@@ -70,7 +70,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
/// <summary> | /// <summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
void SaveEntity(string keyValue, StuAttendanceEntity entity); | void SaveEntity(string keyValue, StuAttendanceEntity entity); | ||||
List<StuAttendanceEntity> GetStuLessonInfo(string account,string startTime,string endTime); | |||||
List<StuAttendanceEntity> GetStuLessonInfo(string account); | |||||
#endregion | #endregion | ||||
} | } | ||||
@@ -237,24 +237,11 @@ and t.Status=2"); | |||||
} | } | ||||
} | } | ||||
internal List<StuAttendanceEntity> GetStuLessonInfo(string account,string starTime,string endTime) | |||||
internal List<StuAttendanceEntity> GetStuLessonInfo(string account) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var expression = LinqExtensions.True<StuAttendanceEntity>(); | |||||
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<StuAttendanceEntity>(expression).ToList(); | |||||
return this.BaseRepository("CollegeMIS").FindList<StuAttendanceEntity>(a => a.StuNo == account).ToList(); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -107,22 +107,22 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||||
[Column("LESSONSORTNO")] | [Column("LESSONSORTNO")] | ||||
public string LessonSortNo { get; set; } | public string LessonSortNo { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 学校主键Week | |||||
/// 学校主键 | |||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[Column("F_SCHOOLID")] | [Column("F_SCHOOLID")] | ||||
public string F_SchoolId { get; set; } | public string F_SchoolId { get; set; } | ||||
[NotMapped] | |||||
public int? StartWeek { get; set; } | |||||
[NotMapped] | |||||
public int? EndWeek { get; set; } | |||||
[NotMapped] | [NotMapped] | ||||
public string LessonName { get; set; } | public string LessonName { get; set; } | ||||
[NotMapped] | [NotMapped] | ||||
public string LessonSortDetailNo { get; set; } | public string LessonSortDetailNo { get; set; } | ||||
[NotMapped] | [NotMapped] | ||||
public int? ClassHour { get; set; } | |||||
public int? StartWeek { get; set; } | |||||
[NotMapped] | |||||
public int? EndWeek { get; set; } | |||||
[NotMapped] | |||||
public string ExamType { get; set; } | |||||
#endregion | #endregion | ||||
#region 扩展操作 | #region 扩展操作 | ||||
@@ -1,167 +0,0 @@ | |||||
using Learun.Util; | |||||
using System; | |||||
using System.Data; | |||||
using System.Collections.Generic; | |||||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||||
{ | |||||
/// <summary> | |||||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||||
/// 创 建:超级管理员 | |||||
/// 日 期:2021-06-22 10:04 | |||||
/// 描 述:计算项目管理 | |||||
/// </summary> | |||||
public class DataCollectionBLL : DataCollectionIBLL | |||||
{ | |||||
private DataCollectionService dataCollectionService = new DataCollectionService(); | |||||
#region 获取数据 | |||||
///// <summary> | |||||
///// 获取页面显示列表数据 | |||||
///// </summary> | |||||
///// <param name="pagination">分页参数</param> | |||||
///// <param name="queryJson">查询参数</param> | |||||
///// <returns></returns> | |||||
//public IEnumerable<CalculateProjectEntity> 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); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -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(); | |||||
} | |||||
} |
@@ -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 | |||||
{ | |||||
/// <summary> | |||||
/// 智慧大脑数据采集 | |||||
/// </summary> | |||||
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<string>("refresh_token") == "null" ? "" : _redis.Read<string>("refresh_token"); | |||||
var access_token = _redis.Read<string>("access_token") == "null" ? "" : _redis.Read<string>("access_token"); | |||||
if (string.IsNullOrEmpty(refresh_token) || string.IsNullOrEmpty(_redis.Read<string>("access_token"))) | |||||
{ | |||||
//用户授权 | |||||
login(); | |||||
} | |||||
else if (!string.IsNullOrEmpty(refresh_token) && string.IsNullOrEmpty(_redis.Read<string>("access_token"))) | |||||
{ | |||||
//刷新token | |||||
refresh(); | |||||
} | |||||
} | |||||
catch (ExceptionEx ex) | |||||
{ | |||||
if (ex is ExceptionEx) | |||||
{ | |||||
throw; | |||||
} | |||||
else | |||||
{ | |||||
throw ExceptionEx.ThrowServiceException(ex); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 用户授权 | |||||
/// </summary> | |||||
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<InsResult>(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)); | |||||
} | |||||
/// <summary> | |||||
/// 刷新token | |||||
/// </summary> | |||||
private void refresh() | |||||
{ | |||||
var client_secret = (_redis.Read<string>("client_secret"))?.Replace("\"", ""); | |||||
var refresh_token = (_redis.Read<string>("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<InsResult>(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)); | |||||
} | |||||
/// <summary> | |||||
/// 校区基础数据 | |||||
/// </summary> | |||||
public void SaveXqjbsj() | |||||
{ | |||||
try | |||||
{ | |||||
var connect = (_redis.Read<string>("access_token")).Replace("\"", ""); | |||||
//校区信息 | |||||
var entity = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
var pro = entity.F_ProvinceId.Substring(0, 2); | |||||
//区域信息 | |||||
var area = this.BaseRepository() | |||||
.FindList<AreaEntity>($"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<object>(); | |||||
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); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 课程信息数据 | |||||
/// </summary> | |||||
public void SyncLesson() | |||||
{ | |||||
try | |||||
{ | |||||
//校区信息 | |||||
var company = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
//课程数据 | |||||
var lessonInfo = this.BaseRepository("CollegeMIS").FindList<LessonInfoEntity>($@"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<object>(); | |||||
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<string>("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); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 教材信息数据 | |||||
/// </summary> | |||||
public void SyncTextBook() | |||||
{ | |||||
try | |||||
{ | |||||
//校区信息 | |||||
var company = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
//教材数据 | |||||
var textBookInfo = this.BaseRepository("CollegeMIS").FindList<TextBookInfoEntity>(x => x.IsValid == true && x.IsDel == 0); | |||||
ParamModel paramModel = new ParamModel(); | |||||
paramModel.dataObjName = "ods_jcxysj"; | |||||
var list = new List<object>(); | |||||
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<string>("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); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 排课数据 | |||||
/// </summary> | |||||
public void SyncArrangeLessonTerm() | |||||
{ | |||||
try | |||||
{ | |||||
//校区信息 | |||||
var company = this.BaseRepository().FindList<CompanyEntity>(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<TimeTable>(sql); | |||||
ParamModel paramModel = new ParamModel(); | |||||
paramModel.dataObjName = "ods_zzxkpksj"; | |||||
var list = new List<object>(); | |||||
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<string>("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; | |||||
} | |||||
/// <summary> | |||||
/// 教师进修培训 | |||||
/// </summary> | |||||
public void SyncTeacherTrain() | |||||
{ | |||||
try | |||||
{ | |||||
//校区信息 | |||||
var company = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
//教师培训数据 | |||||
var teacherTrain = this.BaseRepository().FindList<TeacherTrainEntity>(); | |||||
ParamModel paramModel = new ParamModel(); | |||||
paramModel.dataObjName = "ods_jxpxsj"; | |||||
var list = new List<object>(); | |||||
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<string>("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); | |||||
} | |||||
} | |||||
} | |||||
/// <summary> | |||||
/// 教师资质证书 | |||||
/// </summary> | |||||
public void SyncTeacherQualifications() | |||||
{ | |||||
try | |||||
{ | |||||
//校区信息 | |||||
var company = this.BaseRepository().FindList<CompanyEntity>(x => x.F_DeleteMark == 0 && x.F_EnabledMark == 1).FirstOrDefault(); | |||||
//教师数据 | |||||
var teacherTrain = this.BaseRepository("CollegeMIS").FindList<TeacherQualificationsEntity>($@"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<object>(); | |||||
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<string>("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<object> 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 | |||||
} | |||||
} |
@@ -429,9 +429,6 @@ | |||||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderBLL.cs" /> | <Compile Include="LR_CodeDemo\WorkOrder\WorkOrderBLL.cs" /> | ||||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderIBLL.cs" /> | <Compile Include="LR_CodeDemo\WorkOrder\WorkOrderIBLL.cs" /> | ||||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderService.cs" /> | <Compile Include="LR_CodeDemo\WorkOrder\WorkOrderService.cs" /> | ||||
<Compile Include="LR_Desktop\DataCollection\DataCollectionBLL.cs" /> | |||||
<Compile Include="LR_Desktop\DataCollection\DataCollectionIBLL.cs" /> | |||||
<Compile Include="LR_Desktop\DataCollection\DataCollectionService.cs" /> | |||||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildBLL.cs" /> | <Compile Include="LR_Desktop\QualityReportChild\QualityReportChildBLL.cs" /> | ||||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildEntity.cs" /> | <Compile Include="LR_Desktop\QualityReportChild\QualityReportChildEntity.cs" /> | ||||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildIBLL.cs" /> | <Compile Include="LR_Desktop\QualityReportChild\QualityReportChildIBLL.cs" /> | ||||
@@ -1,4 +1,5 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | |||||
using System.Globalization; | using System.Globalization; | ||||
namespace Learun.Util | namespace Learun.Util | ||||
@@ -368,9 +369,10 @@ namespace Learun.Util | |||||
//当年的第一天是星期几 | //当年的第一天是星期几 | ||||
int firstOfWeek = Convert.ToInt32(firstDay.DayOfWeek); | 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; | int dayAdd = 7 - firstOfWeek; | ||||
firstDate = firstDay.AddDays(dayDiff).Date; | firstDate = firstDay.AddDays(dayDiff).Date; | ||||
@@ -503,6 +505,64 @@ namespace Learun.Util | |||||
return strDate; | return strDate; | ||||
} | } | ||||
#endregion | #endregion | ||||
/// <summary> | |||||
/// 获取当前日期在指定时间范围内是第几周 | |||||
/// </summary> | |||||
/// <param name="start"></param> | |||||
/// <param name="end"></param> | |||||
/// <returns></returns> | |||||
public static int GetWeekOfDay(DateTime start, DateTime end) | |||||
{ | |||||
//总周数 | |||||
var weekCount = Math.Ceiling(Convert.ToDouble((end - start).Days / 7)); | |||||
//用于存储日期 | |||||
var weekDic = new Dictionary<DateTime, int>(); | |||||
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; | |||||
} | |||||
/// <summary> | |||||
/// 根据开始日期和结束日期返回这段时间的周数 | |||||
/// 过周日算一周 | |||||
/// </summary> | |||||
/// <param name="startTime">开始日期</param> | |||||
/// <param name="endTime">结束日期</param> | |||||
/// <returns></returns> | |||||
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; | |||||
} | |||||
/// <summary> | /// <summary> | ||||
/// 获取当前日期是星期几 | /// 获取当前日期是星期几 | ||||
/// </summary> | /// </summary> | ||||
@@ -3,7 +3,7 @@ | |||||
"appid" : "__UNI__E4958C9", | "appid" : "__UNI__E4958C9", | ||||
"description" : "智慧校园移动端", | "description" : "智慧校园移动端", | ||||
"versionName" : "1.0.0", | "versionName" : "1.0.0", | ||||
"versionCode" : 3, | |||||
"versionCode" : 4, | |||||
"transformPx" : false, | "transformPx" : false, | ||||
/* 5+App特有相关 */ | /* 5+App特有相关 */ | ||||
"app-plus" : { | "app-plus" : { | ||||
@@ -6,45 +6,49 @@ | |||||
<text>{{ semester }}</text> | <text>{{ semester }}</text> | ||||
</view> | </view> | ||||
<!--<span class="tSec1Line"></span>--> | <!--<span class="tSec1Line"></span>--> | ||||
<view class="tSec1Box" id="weekTime"> | |||||
<!-- <view class="tSec1Box" id="weekTime"> | |||||
<text class="text-xxl cuIcon cuIcon-back" @click="timeTap(1)"></text> | <text class="text-xxl cuIcon cuIcon-back" @click="timeTap(1)"></text> | ||||
<text>{{todayWeek.Monday}}</text> | <text>{{todayWeek.Monday}}</text> | ||||
- | - | ||||
<text>{{todayWeek.Sunday}}</text> | <text>{{todayWeek.Sunday}}</text> | ||||
<text class="text-xxl cuIcon cuIcon-right" @click="timeTap(2)"></text> | |||||
<text class="text-xxl cuIcon cuIcon-right" @click="timeTap(2)"></text> | |||||
</view> --> | |||||
<view class="timeSelectBox"> | |||||
<!-- 单选和选择 radio select --> | |||||
<l-select | |||||
@input="timeChange" | |||||
:value="timeValue" | |||||
:range="timeOptions" | |||||
title="" | |||||
/> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="timeTable_sec2"> | <view class="timeTable_sec2"> | ||||
<view class="tSec2Top"> | <view class="tSec2Top"> | ||||
<view class="tSec2TopUl"> | |||||
<view class="tSec2TopLi" v-for="(item, ind) in weekArr" :key="item.en" @click="liTap(ind)" | |||||
:class="ind == num? 'active' : ''"> | |||||
<text>{{ item.en }}</text> | |||||
<text>{{ item.cn }}</text> | |||||
</view> | |||||
<view class="tSec2TopLi" v-for="(item, ind) in weekArr" :key="item.en" @click="liTap(ind)" :class="ind == num? 'active' : ''"> | |||||
<text>{{ item.en }}</text> | |||||
<text>{{ item.cn }}</text> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="tSec2Box"> | <view class="tSec2Box"> | ||||
<view class="tSec2Con" v-for="(items, i) in weekArr" :key="items.num" v-show="i == num"> | |||||
<view class="tSec2Con" v-for="(items, i) in dataArr" :key="items.num" v-show="i == num"> | |||||
<view class="tSec2List"> | <view class="tSec2List"> | ||||
<view v-if="dataArr[i+1]&&dataArr[i+1].length <= 0" class="tSec2ListLi"> | |||||
<view class="noHtml">该时间段没有课表</view> | |||||
</view> | |||||
<view v-if="dataArr[i+1]&&dataArr[i+1].length > 0"> | |||||
<view class="tSec2ListLi" v-for="(k, j) in dataArr[i+1]" :key="j" @click="classTap(k)"> | |||||
<view class="tSec2ListL">第 {{ k.jc }} 节</view> | |||||
<view v-if="items.lessonData.length <= 0" class="tSec2ListLi"><view class="noHtml">该时间段没有课表</view></view> | |||||
<view v-if="items.lessonData.length > 0"> | |||||
<view class="tSec2ListLi" v-for="(k, j) in items.lessonData" :key="j" @click="classTap(k)"> | |||||
<view class="tSec2ListL">第 {{ k.sectionTime }} 节</view> | |||||
<view class="tSec2ListR"> | <view class="tSec2ListR"> | ||||
<view class="tSec2ListBox"> | <view class="tSec2ListBox"> | ||||
<view class="tSec2ListT">{{ k.curriculum }}</view> | |||||
<view class="tSec2ListT">{{ k.LessonName }}</view> | |||||
<view class="tSec2ListTxt">{{ k.ClassName }}</view> | |||||
<view class="tSec2ListTxt"> | <view class="tSec2ListTxt"> | ||||
<text class="text-xxl cuIcon cuIcon-profile"></text> | <text class="text-xxl cuIcon cuIcon-profile"></text> | ||||
{{ k.teacher }} | |||||
{{ k.EmpName }} | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="tSec2Location"> | <view class="tSec2Location"> | ||||
<text class="text-xxl cuIcon cuIcon-location"></text> | <text class="text-xxl cuIcon cuIcon-location"></text> | ||||
{{ k.className }} | |||||
{{ k.ClassroomName }} | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
@@ -57,364 +61,362 @@ | |||||
</template> | </template> | ||||
<script> | <script> | ||||
import common from '@/common/js/common.js' | |||||
export default { | |||||
data() { | |||||
return { | |||||
semester: '', | |||||
num: 0, | |||||
user: null, | |||||
weekDayTime: 0, | |||||
noClassTime:0, | |||||
todayWeek: {}, | |||||
dataArr: [], | |||||
weekArr: [{ | |||||
en: 'ONE', | |||||
cn: '星期一' | |||||
}, | |||||
{ | |||||
en: 'TWO', | |||||
cn: '星期二' | |||||
}, | |||||
{ | |||||
en: 'THREE', | |||||
cn: '星期三' | |||||
}, | |||||
{ | |||||
en: 'FOUR', | |||||
cn: '星期四' | |||||
}, | |||||
{ | |||||
en: 'FIVE', | |||||
cn: '星期五' | |||||
}, | |||||
{ | |||||
en: 'SIX', | |||||
cn: '星期六' | |||||
}, | |||||
{ | |||||
en: 'SEVEN', | |||||
cn: '星期七' | |||||
}, | |||||
{ | |||||
en: 'EIGHT', | |||||
cn: '星期八' | |||||
}, | |||||
{ | |||||
en: 'NINE', | |||||
cn: '星期九' | |||||
}, | |||||
{ | |||||
en: 'TEN', | |||||
cn: '星期十' | |||||
} | |||||
] | |||||
}; | |||||
import common from '@/common/js/common.js' | |||||
export default { | |||||
data() { | |||||
return { | |||||
timeValue:'', | |||||
timeOptions:[], | |||||
semester: '', | |||||
num: 0, | |||||
user: null, | |||||
weekDayTime: 0, | |||||
todayWeek: {}, | |||||
dataArr: [], | |||||
weekArr: [ | |||||
{ | |||||
en: 'MON', | |||||
cn: '星期一' | |||||
}, | |||||
{ | |||||
en: 'TUE', | |||||
cn: '星期二' | |||||
}, | |||||
{ | |||||
en: 'WED', | |||||
cn: '星期三' | |||||
}, | |||||
{ | |||||
en: 'THU', | |||||
cn: '星期四' | |||||
}, | |||||
{ | |||||
en: 'FRI', | |||||
cn: '星期五' | |||||
}, | |||||
{ | |||||
en: 'SAT', | |||||
cn: '星期六' | |||||
}, | |||||
{ | |||||
en: 'SUN', | |||||
cn: '星期日' | |||||
} | |||||
] | |||||
}; | |||||
}, | |||||
onUnload() { | |||||
this.OFF('timeTable'); | |||||
}, | |||||
methods: { | |||||
async init(obj) { | |||||
let _this = this; | |||||
_this.todayWeek = common.weekday(obj); | |||||
_this.semester = common.judgeDate(obj); | |||||
_this.weekDayTime = 7 * common.oneDayTime(); | |||||
_this.user = _this.GET_GLOBAL('loginUser'); | |||||
_this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday); | |||||
}, | }, | ||||
onUnload() { | |||||
this.OFF('timeTable'); | |||||
liTap(ind) { | |||||
this.num = ind; | |||||
}, | }, | ||||
methods: { | |||||
// 初始化数据 | |||||
async init() { | |||||
let _this = this; | |||||
// _this.todayWeek = common.weekday2(); | |||||
_this.weekDayTime = 14 * common.oneDayTime(); | |||||
_this.noClassTime = 4 * common.oneDayTime(); | |||||
_this.loadData(); | |||||
}, | |||||
liTap(ind) { | |||||
this.num = ind; | |||||
}, | |||||
// 切换时间 | |||||
timeTap(num) { | |||||
let _this = this; | |||||
if (num == 1) { | |||||
_this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime ; | |||||
_this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime; | |||||
} else { | |||||
_this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime; | |||||
_this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime; | |||||
timeTap(num) { | |||||
let _this = this; | |||||
if (num == 1) { | |||||
_this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime; | |||||
_this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime; | |||||
} else { | |||||
_this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime; | |||||
_this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime; | |||||
} | |||||
_this.num = 0; | |||||
_this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime); | |||||
_this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime); | |||||
_this.semester = common.judgeDate(_this.todayWeek.SundayTime); | |||||
_this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday); | |||||
}, | |||||
async loadData(start, end) { | |||||
// let param = { StartDate: start, EndDate: end }; | |||||
let _this = this; | |||||
_this.LOADING('加载数据中…'); | |||||
if(!this.timeValue){ | |||||
// 加载下拉框 | |||||
let timeOptionRes = await this.HTTP_GET('learun/adms/timetable/weeklist', {}, '加载数据时出错') | |||||
if(!timeOptionRes){ | |||||
this.HIDE_LOADING(); | |||||
return | |||||
} | } | ||||
_this.num = 0; | |||||
_this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime); | |||||
_this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime); | |||||
_this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday); | |||||
}, | |||||
// 获取数据 | |||||
loadData(start, end) { | |||||
if(!this.user) return | |||||
let { | |||||
Description, | |||||
account: Account | |||||
} = this.user | |||||
let param = { | |||||
StartDate: start, | |||||
EndDate: end, | |||||
Description, | |||||
Account, | |||||
}; | |||||
let _this = this; | |||||
_this.LOADING('加载数据中…'); | |||||
_this.HTTP_GET('learun/adms/timetable/TenDay', param, '加载数据时出错').then(res => { | |||||
this.timeOptions = timeOptionRes.map(e=>{return {value:e.startdate+'~'+e.enddate,text:e.textweek}}) | |||||
// 加载当前周次 | |||||
let currentWeekres = await this.HTTP_GET('learun/adms/timetable/currentweek', {}, '加载数据时出错') | |||||
if(!currentWeekres){ | |||||
this.HIDE_LOADING(); | this.HIDE_LOADING(); | ||||
_this.semester = res.semester | |||||
_this.dataArr = _this.ProcessingData(res.weekList); | |||||
// 回显日期 | |||||
if (!start) { | |||||
_this.todayWeek.MondayTime = new Date(res.startDate).valueOf(); | |||||
_this.todayWeek.SundayTime = new Date(res.endDate).valueOf() + _this.noClassTime; | |||||
_this.num = 0; | |||||
_this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime); | |||||
_this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime); | |||||
} | |||||
}); | |||||
}, | |||||
// 处理课程数据 | |||||
ProcessingData(res) { | |||||
let courseCateByDay = {} | |||||
for (let i = 1; i < 11; i++) { | |||||
courseCateByDay[i] = [] | |||||
return | |||||
} | } | ||||
res.forEach((item) => { | |||||
item.list.sort((a, b) => { | |||||
return a.jc - b.jc | |||||
}) | |||||
courseCateByDay[item.time] = item.list | |||||
}) | |||||
return courseCateByDay; | |||||
}, | |||||
classTap(data) { | |||||
return "" | |||||
let _this = this; | |||||
// console.log(_this.user) | |||||
if (_this.user.Description == "教师") { | |||||
//console.log("教师"); | |||||
} else if (_this.user.Description == "学生") { | |||||
let LeaveType = data.LeaveType; | |||||
//console.log(LeaveType); | |||||
let IsCheck = data.IsCheck; | |||||
//console.log(IsCheck); | |||||
if (LeaveType == "1") { | |||||
let msg = "请假申请中"; | |||||
if (IsCheck == "1") { | |||||
msg = "请假通过"; | |||||
} | |||||
if (IsCheck == "2") { | |||||
msg = "请假未通过"; | |||||
} | |||||
_this.TOAST(msg); | |||||
} else { | |||||
// var param = { | |||||
// AcademicYearNo: data.AcademicYear, | |||||
// ClassRoomNo: data.ClassRoomNo, | |||||
// EmpNo: data.EmpNo, | |||||
// LessonDate: data.LessonDate, | |||||
// LessonNo: data.LessonNo, | |||||
// LessonSortNo: data.LessonSortNo, | |||||
// LessonTime: data.LessonTime, | |||||
// Semester: data.Semester | |||||
// }; | |||||
this.NAV_TO('./leaveFrom', data, true); | |||||
} | |||||
let currentweek = currentWeekres.currentweek | |||||
let obj = timeOptionRes.find(e=>e.week == currentweek) | |||||
this.timeValue = obj.startdate + '~' + obj.enddate | |||||
} | |||||
let param = { StartDate: this.timeValue.split('~')[0], EndDate: this.timeValue.split('~')[1] }; | |||||
_this.HTTP_GET('learun/adms/timetable/list', param, '加载数据时出错').then(res => { | |||||
this.HIDE_LOADING(); | |||||
_this.ProcessingData(res); | |||||
}); | |||||
}, | |||||
ProcessingData(data) { | |||||
let dataM = [ | |||||
{ | |||||
weekTime: 1, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 2, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 3, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 4, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 5, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 6, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
}, | |||||
{ | |||||
weekTime: 7, | |||||
num: Math.floor(Math.random() * 100000000), | |||||
lessonData: [] | |||||
} | } | ||||
]; | |||||
data.forEach((n, i) => { | |||||
n.sectionTime = n.LessonTime.slice(1); | |||||
dataM.forEach((k, j) => { | |||||
if (k.weekTime == n.LessonTime.slice(0, 1)) { | |||||
k.lessonData.push(n); | |||||
} | |||||
}); | |||||
}); | |||||
dataM.forEach((n, i) => { | |||||
n.lessonData.sort(common.compare('sectionTime')); | |||||
}); | |||||
this.dataArr = dataM; | |||||
}, | |||||
classTap(data) { | |||||
let _this = this; | |||||
if (_this.user.Description == "教师") { | |||||
} else if (_this.user.Description == "学生") { | |||||
let LeaveType = data.LeaveType; | |||||
let IsCheck = data.IsCheck; | |||||
if (LeaveType == "1") { | |||||
let msg = "请假申请中"; | |||||
if (IsCheck == "1") { | |||||
msg = "请假通过"; | |||||
} | |||||
if (IsCheck == "2") { | |||||
msg = "请假未通过"; | |||||
} | |||||
_this.TOAST(msg); | |||||
} | |||||
else { | |||||
this.NAV_TO('./leaveFrom', data, true); | |||||
} | |||||
} | } | ||||
}, | }, | ||||
created() { | |||||
this.ON('timeTable', this.init); | |||||
this.user = this.GET_GLOBAL('loginUser'); | |||||
this.init() | |||||
onfun(obj){ | |||||
this.init(obj); | |||||
}, | |||||
getTimeOptions(){ | |||||
return this.HTTP_GET('learun/adms/timetable/weeklist', {}, '加载数据时出错') | |||||
}, | |||||
timeChange(e){ | |||||
this.timeValue = e | |||||
this.loadData() | |||||
} | } | ||||
}; | |||||
}, | |||||
created() { | |||||
//this.ON('timeTable', this.init); | |||||
this.ON('timeTable', this.onfun); | |||||
this.init() | |||||
} | |||||
}; | |||||
</script> | </script> | ||||
<style lang="less" scoped> | <style lang="less" scoped> | ||||
.page { | |||||
background: #fff; | |||||
} | |||||
.timeTable_sec1 { | |||||
padding: 14px 12px; | |||||
text-align: center; | |||||
background: #0075c4; | |||||
color: #94d4ff; | |||||
font-size: 0; | |||||
} | |||||
.tSec1Box>* { | |||||
display: inline-block; | |||||
vertical-align: middle; | |||||
} | |||||
.tSec1Line { | |||||
height: 13px; | |||||
width: 1px; | |||||
background: #94d4ff; | |||||
margin: 0 10px; | |||||
} | |||||
.tSec1Box { | |||||
font-size: 15px; | |||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
} | |||||
#semester { | |||||
margin-bottom: 10px; | |||||
} | |||||
#weekTime {} | |||||
#weekTime text { | |||||
margin: 0 10px; | |||||
} | |||||
.tSec1Box>text { | |||||
width: auto; | |||||
text-align: center; | |||||
line-height: 22px; | |||||
} | |||||
.tSec1Box image { | |||||
width: 15px; | |||||
margin-right: 2px; | |||||
} | |||||
.tSec1Box text:after { | |||||
display: none; | |||||
} | |||||
.timeTable_sec2 { | |||||
margin-bottom: 30px; | |||||
} | |||||
.tSec2Top { | |||||
padding: 0 12px; | |||||
background: #0075c4; | |||||
height: 55px; | |||||
text-align: center; | |||||
overflow: auto; | |||||
} | |||||
.tSec2TopUl { | |||||
width: 800px; | |||||
} | |||||
.tSec2TopLi { | |||||
width: 10%; | |||||
float: left; | |||||
line-height: 18px; | |||||
padding: 9px 0 9px; | |||||
color: #fff; | |||||
font-size: 13px; | |||||
border-right: 1px solid #1084d2; | |||||
border-top: 1px solid #1084d2; | |||||
} | |||||
.tSec2TopLi:first-child { | |||||
border-left: 1px solid #1084d2; | |||||
} | |||||
.tSec2TopLi.active { | |||||
color: #0075c4; | |||||
background: #fff; | |||||
border-color: #fff; | |||||
} | |||||
.tSec2TopLi text { | |||||
display: block; | |||||
} | |||||
.tSec2TopLi text:first-child { | |||||
letter-spacing: 2px; | |||||
text-transform: uppercase; | |||||
} | |||||
.tSec2Box { | |||||
padding: 0 12px; | |||||
margin-top: 10px; | |||||
} | |||||
.tSec2Con { | |||||
border-left: 1px solid #d5eaf7; | |||||
border-right: 1px solid #d5eaf7; | |||||
border-top: 1px solid #d5eaf7; | |||||
// display: none; | |||||
} | |||||
.tSec2Con:first-child { | |||||
display: block; | |||||
} | |||||
.tSec2List { | |||||
margin-top: 10px; | |||||
} | |||||
.tSec2List:first-child { | |||||
margin-top: 0; | |||||
} | |||||
.tSec2ListLi { | |||||
border-bottom: 1px solid #d5eaf7; | |||||
overflow: hidden; | |||||
height: 60px; | |||||
} | |||||
.tSec2ListL { | |||||
float: left; | |||||
background: #e8f6ff; | |||||
height: 100%; | |||||
width: 20%; | |||||
text-align: center; | |||||
line-height: 36px; | |||||
padding: 11px 0; | |||||
font-size: 14px; | |||||
color: #646464; | |||||
} | |||||
.tSec2ListR { | |||||
float: left; | |||||
width: 80%; | |||||
height: 100%; | |||||
line-height: 18px; | |||||
padding: 4px 0; | |||||
overflow: hidden; | |||||
} | |||||
.tSec2ListBox { | |||||
width: 62%; | |||||
float: left; | |||||
padding-left: 5px; | |||||
} | |||||
.tSec2ListT { | |||||
color: #3e3e3e; | |||||
font-size: 15px; | |||||
margin: 5px 0; | |||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
} | |||||
.tSec2ListTxt { | |||||
color: #888888; | |||||
font-size: 13px; | |||||
} | |||||
.tSec2Location { | |||||
width: 38%; | |||||
float: left; | |||||
line-height: 44px; | |||||
font-size: 13px; | |||||
color: #888888; | |||||
} | |||||
.noHtml { | |||||
height: 100%; | |||||
line-height: 60px; | |||||
text-align: center; | |||||
font-size: 14px; | |||||
} | |||||
.page{ | |||||
background: #fff; | |||||
} | |||||
.timeTable_sec1 { | |||||
padding: 14px 12px; | |||||
text-align: center; | |||||
background: #0075c4; | |||||
color: #94d4ff; | |||||
font-size: 0; | |||||
} | |||||
.tSec1Box > * { | |||||
display: inline-block; | |||||
vertical-align: middle; | |||||
} | |||||
.tSec1Line { | |||||
height: 13px; | |||||
width: 1px; | |||||
background: #94d4ff; | |||||
margin: 0 10px; | |||||
} | |||||
.tSec1Box { | |||||
font-size: 15px; | |||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
} | |||||
#semester { | |||||
margin-bottom: 10px; | |||||
} | |||||
#weekTime { | |||||
} | |||||
#weekTime text { | |||||
margin: 0 10px; | |||||
} | |||||
.tSec1Box > text { | |||||
width: auto; | |||||
text-align: center; | |||||
line-height: 22px; | |||||
} | |||||
.tSec1Box image { | |||||
width: 15px; | |||||
margin-right: 2px; | |||||
} | |||||
.tSec1Box text:after { | |||||
display: none; | |||||
} | |||||
.timeTable_sec2 { | |||||
margin-bottom: 30px; | |||||
} | |||||
.tSec2Top { | |||||
padding: 0 12px; | |||||
background: #0075c4; | |||||
height: 55px; | |||||
text-align: center; | |||||
overflow: hidden; | |||||
} | |||||
.tSec2TopLi { | |||||
width: 14.285714%; | |||||
float: left; | |||||
line-height: 18px; | |||||
padding: 9px 0 9px; | |||||
color: #fff; | |||||
font-size: 13px; | |||||
border-right: 1px solid #1084d2; | |||||
border-top: 1px solid #1084d2; | |||||
} | |||||
.tSec2TopLi:first-child { | |||||
border-left: 1px solid #1084d2; | |||||
} | |||||
.tSec2TopLi.active { | |||||
color: #0075c4; | |||||
background: #fff; | |||||
border-color: #fff; | |||||
} | |||||
.tSec2TopLi text { | |||||
display: block; | |||||
} | |||||
.tSec2TopLi text:first-child { | |||||
letter-spacing: 2px; | |||||
text-transform: uppercase; | |||||
} | |||||
.tSec2Box { | |||||
padding: 0 12px; | |||||
margin-top: 10px; | |||||
} | |||||
.tSec2Con { | |||||
border-left: 1px solid #d5eaf7; | |||||
border-right: 1px solid #d5eaf7; | |||||
border-top: 1px solid #d5eaf7; | |||||
// display: none; | |||||
} | |||||
.tSec2Con:first-child { | |||||
display: block; | |||||
} | |||||
.tSec2List { | |||||
margin-top: 10px; | |||||
} | |||||
.tSec2List:first-child { | |||||
margin-top: 0; | |||||
} | |||||
.tSec2ListLi { | |||||
border-bottom: 1px solid #d5eaf7; | |||||
overflow: hidden; | |||||
height: 64px; | |||||
} | |||||
.tSec2ListL { | |||||
float: left; | |||||
background: #e8f6ff; | |||||
height: 100%; | |||||
width: 25%; | |||||
text-align: center; | |||||
line-height: 36px; | |||||
padding: 11px 0; | |||||
font-size: 14px; | |||||
color: #646464; | |||||
} | |||||
.tSec2ListR { | |||||
float: left; | |||||
width: 75%; | |||||
height: 100%; | |||||
line-height: 18px; | |||||
padding: 4px 0; | |||||
overflow: hidden; | |||||
} | |||||
.tSec2ListBox { | |||||
width: 70%; | |||||
float: left; | |||||
padding-left: 5px; | |||||
} | |||||
.tSec2ListT { | |||||
color: #3e3e3e; | |||||
font-size: 15px; | |||||
margin: 2px 0; | |||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
} | |||||
.tSec2ListTxt { | |||||
color: #888888; | |||||
font-size: 13px; | |||||
} | |||||
.tSec2Location { | |||||
width: 30%; | |||||
float: left; | |||||
line-height: 44px; | |||||
font-size: 13px; | |||||
color: #888888; | |||||
} | |||||
.noHtml { | |||||
height: 100%; | |||||
line-height: 60px; | |||||
text-align: center; | |||||
font-size: 14px; | |||||
} | |||||
.timeSelectBox .cu-form-group{ | |||||
background-color: unset; | |||||
border-bottom:none; | |||||
width: calc(100% - 80px); | |||||
margin: 0 auto; | |||||
} | |||||
</style> | </style> |