Commit d8c7edee authored by 黄奎's avatar 黄奎

老师排课表和学员发课表下载调整

parent e3dfad48
......@@ -4400,7 +4400,7 @@ namespace Edu.Module.Course
/// <summary>
/// 预约课管理
/// 预约课管理导出
/// </summary>
/// <param name="StartDate"></param>
/// <param name="EndDate"></param>
......@@ -4410,7 +4410,7 @@ namespace Edu.Module.Course
/// <param name="appointState"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Teacher_ViewModel> GetAppointmentPlanStatExport(string StartDate, string EndDate, int teacherId, int classRoomId, int ClassType, int appointState, int group_Id, out List<RB_Class_Plan_ViewModel> list, out List<RB_Reserve_Class_Extend> reserveList, out List<RB_Scroll_Appointment_ViewModel> appointList, out List<RB_Class_Time_ViewModel> timeList, out List<RB_Order_Guest_ViewModel> guestList, out List<RB_Order_Guest_ViewModel> tempGuestList, out List<RB_Visitor_Reserve_Extend> visitorList, out List<RB_Course_Chapter_ViewModel> chatperList)
public List<RB_Teacher_ViewModel> GetAppointmentPlanStatExport(string StartDate, string EndDate, int teacherId, int classRoomId, int ClassType, int appointState, int group_Id, out List<RB_Class_Plan_ViewModel> list, out List<RB_Reserve_Class_Extend> reserveList, out List<RB_Scroll_Appointment_ViewModel> appointList, out List<RB_Class_Time_ViewModel> timeList, out List<RB_Order_Guest_ViewModel> guestList, out List<RB_Order_Guest_ViewModel> tempGuestList, out List<RB_Visitor_Reserve_Extend> visitorList, out List<RB_Course_Chapter_ViewModel> chatperList,out List<RB_Course_ViewModel> courseList)
{
var sDTime = Convert.ToDateTime(StartDate);
var eDTime = Convert.ToDateTime(EndDate);
......@@ -4428,6 +4428,7 @@ namespace Edu.Module.Course
tempGuestList = new List<RB_Order_Guest_ViewModel>();//2021-07-20 Add By:W临时上课邀请
visitorList = new List<RB_Visitor_Reserve_Extend>();
chatperList = new List<RB_Course_Chapter_ViewModel>();
courseList = new List<RB_Course_ViewModel>();
List<RB_Teacher_ViewModel> TeacherList = new List<RB_Teacher_ViewModel>();
var reserveQuery = new RB_Reserve_Class_Extend()
{
......@@ -4515,15 +4516,15 @@ namespace Edu.Module.Course
item.OrderCourseList = orderCourseList?.Where(qitem => qitem.OrderId == item.OrderId)?.ToList() ?? new List<RB_Order_Course_ViewModel>();
}
List<int> courseList = Common.ConvertHelper.StringToList(courseIds);
List<int> courseIdList = Common.ConvertHelper.StringToList(courseIds);
List<int> newList = new List<int>();
if (learnList != null)
{
newList.AddRange(learnList);
}
if (courseList != null)
if (courseIdList != null)
{
newList.AddRange(courseList);
newList.AddRange(courseIdList);
}
if (orderCourseIdList != null && orderCourseIdList.Count > 0)
{
......@@ -4536,6 +4537,7 @@ namespace Edu.Module.Course
{
CourseIds = string.Join(",", newList.Distinct())
}); ;
courseList = courseRepository.GetCourseListRepository(new RB_Course_ViewModel() { QCourseIds = string.Join(",", courseIdList.Distinct()) });
}
}
//获取所有老师的列表
......
......@@ -549,21 +549,22 @@ namespace Edu.WebApi.Controllers.Course
var visitorList = new List<Model.ViewModel.Reserve.RB_Visitor_Reserve_Extend>();
var chatperList = new List<RB_Course_Chapter_ViewModel>();
List<RB_Teacher_ViewModel> TeacherList = new List<RB_Teacher_ViewModel>();
TeacherList = classModule.GetAppointmentPlanStatExport(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id, out list, out reserveList, out appointList, out timeList, out guestList, out tempGuestList, out visitorList, out chatperList);
List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>();
TeacherList = classModule.GetAppointmentPlanStatExport(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id, out list, out reserveList, out appointList, out timeList, out guestList, out tempGuestList, out visitorList, out chatperList,out courseList);
TeacherList = TeacherList?.Where(qitem => qitem.Dept_Id == 8)?.OrderBy(qitem => qitem.SortNum)?.ToList();
try
{
ExcelDataSource headerTimeFrist = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value:"第一节课:9:30~11:00"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第二节课:11:10~12:40"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第三节课:13:30~15:00"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){Colspan=(9+TeacherList.Count)>12?(9+TeacherList.Count-12):0, CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER }
}
{
new ExcelColumn(value:"第一节课:9:30~11:00"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第二节课:11:10~12:40"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第三节课:13:30~15:00"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){Colspan=(9+TeacherList.Count)>12?(9+TeacherList.Count-12):0, CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER }
}
};
slist.Add(headerTimeFrist);
ExcelDataSource headerTimeLast = new ExcelDataSource()
......@@ -571,7 +572,7 @@ namespace Edu.WebApi.Controllers.Course
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value:"第四节课:15:10~16:40"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第五节课:16:50~18:20"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"第六节课:19:00~20:30"){Colspan=3,CellWidth=10,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
......@@ -589,13 +590,11 @@ namespace Edu.WebApi.Controllers.Course
{
var DayList = new List<object>();
var ClassDate = sDTime.AddDays(i);
ExcelDataSource classDs = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value:ClassDate.ToString("MM月dd日")){Colspan=2,CellWidth=30,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
}
};//日期老师名字
foreach (var itemTeacher in TeacherList)
......@@ -691,7 +690,7 @@ namespace Edu.WebApi.Controllers.Course
timeClassInfo1 += subItem.LessonName;
}
#region 试听
#region 预约
var tempAppointList = appointList.Where(x => x.TeacherId == itemTime.TId && x.Date == ClassDate && x.CourseSTime == startTime)
.GroupBy(x => new
{
......@@ -718,28 +717,50 @@ namespace Edu.WebApi.Controllers.Course
qitem.RoomId == item.Key.RoomId &&
qitem.RoomName == item.Key.RoomName &&
qitem.CourseId == item.Key.CourseId &&
qitem.ChapterNo == item.Key.ChapterNo &&
qitem.ShiftSort == item.Key.ShiftSort &&
qitem.CourseSTime == item.Key.CourseSTime
).ToList();
var tempChatper = chatperList?.Where(qitem => qitem.CourseId == item.Key.CourseId && qitem.ChapterNo == item.Key.ChapterNo.ToString())?.FirstOrDefault();
string ChapterName = "";
int CourseGradeId = 0;
if (tempChatper != null)
{
CourseGradeId = tempChatper.CourseRate.ToInt();
ChapterName = tempChatper?.ChapterName ?? "";
}
var tempCourse = courseList?.FirstOrDefault(qitem => qitem.CourseId == item.Key.CourseId) ?? new RB_Course_ViewModel();
if (CourseGradeId == 0 && (tempCourse?.CourseRate ?? 0) > 0)
{
CourseGradeId = (int)tempCourse.CourseRate;
if (string.IsNullOrEmpty(ChapterName) && (tempCourse.CourseRate == CourseRateEnum.OneFor || tempCourse.CourseRate == CourseRateEnum.OneCH))
{
ChapterName = string.Format("第{0}次课", item.Key.ChapterNo);
}
}
if (CourseGradeId > 0)
{
CourseRateEnum CourseGradeIdRate = (CourseRateEnum)CourseGradeId;
if (!ChapterName.Contains(CourseGradeIdRate.ToName().Replace("课程", "")))
{
ChapterName = CourseGradeIdRate.ToName().Replace("课程", "") + "-" + ChapterName;
}
}
if (!string.IsNullOrWhiteSpace(guestClassInfo1))
{
guestClassInfo1 += "\r\n";
}
guestClassInfo1 += item.Key.CourseName + "-" + item.Key.ChapterNo + ":" + string.Join("、", subAppointList?.Select(qitem => qitem.StuName));
guestClassInfo1 += ChapterName + ":" + string.Join("、", subAppointList?.Select(qitem => qitem.StuName));
if (!string.IsNullOrWhiteSpace(timeClassInfo1))
{
timeClassInfo1 += "\r\n";
}
timeClassInfo1 += item.Key.CourseName + "-" + item.Key.ChapterNo;
timeClassInfo1 += ChapterName;
}
#endregion
......@@ -750,7 +771,6 @@ namespace Edu.WebApi.Controllers.Course
}
}
}
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
......@@ -798,7 +818,8 @@ namespace Edu.WebApi.Controllers.Course
var visitorList = new List<Model.ViewModel.Reserve.RB_Visitor_Reserve_Extend>();
var chatperList = new List<RB_Course_Chapter_ViewModel>();
List<RB_Teacher_ViewModel> TeacherList = new List<RB_Teacher_ViewModel>();
TeacherList = classModule.GetAppointmentPlanStatExport(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id, out list, out reserveList, out appointList, out timeList, out guestList, out tempGuestList, out visitorList, out chatperList);
var courseList = new List<RB_Course_ViewModel>();
TeacherList = classModule.GetAppointmentPlanStatExport(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id, out list, out reserveList, out appointList, out timeList, out guestList, out tempGuestList, out visitorList, out chatperList,out courseList);
try
{
ExcelDataSource headerTimeLast = new ExcelDataSource()
......@@ -810,7 +831,6 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value:"星期"){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"时间"){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:"章节"){CellWidth=50,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
//new ExcelColumn(value:"上课地点"){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
}
};
slist.Add(headerTimeLast);
......@@ -826,24 +846,38 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: Common.ConvertHelper.GetWeekDay(itemGuest.Date)) { CellWidth = 24, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: (itemGuest.CourseSTime ?? "") + "-" + (itemGuest.CourseETime ?? "")) { CellWidth = 24, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
};
var tempChapter =new RB_Course_Chapter_ViewModel();
if (itemGuest.OrderCourseList != null && itemGuest.OrderCourseList.Count > 0)
string CourseChapterNoName = "";
if (itemGuest.CourseGradeId == CourseRateEnum.OneCH || itemGuest.CourseGradeId == CourseRateEnum.OneFor)
{
tempChapter = chatperList.FirstOrDefault(qitem => itemGuest.OrderCourseList.Any(sItem => sItem.CourseId == qitem.CourseId) && qitem.CourseRate == itemGuest.CourseGradeId && qitem.ChapterNo == itemGuest.CourseGradeNo.ToString()) ?? new RB_Course_Chapter_ViewModel();
CourseChapterNoName = string.Format("{0}-第{1}次课", itemGuest.CourseGradeId.ToName(), itemGuest.CourseGradeNo);
}
else
{
tempChapter = chatperList.FirstOrDefault(qitem => qitem.CourseId == itemGuest.LearnCourseId && qitem.ChapterNo == itemGuest.CourseGradeNo.ToString()) ?? new RB_Course_Chapter_ViewModel();
}
string chapterName = itemGuest.CourseName + "-" + itemGuest.CourseGradeNo;
if (tempChapter != null && tempChapter.ChapterId > 0)
{
chapterName = tempChapter.ChapterName;
var chapterCurrent = new RB_Course_Chapter_ViewModel();
//新订单
if (itemGuest.OrderCourseList != null && itemGuest.OrderCourseList.Count > 0)
{
chapterCurrent = chatperList.FirstOrDefault(qitem => itemGuest.OrderCourseList.Any(sItem => sItem.CourseId == qitem.CourseId) && qitem.CourseRate == itemGuest.CourseGradeId && qitem.ChapterNo == itemGuest.CourseGradeNo.ToString()) ?? new RB_Course_Chapter_ViewModel();
}
//老订单
else
{
chapterCurrent = chatperList.FirstOrDefault(qitem => qitem.CourseId == itemGuest.LearnCourseId && qitem.ChapterNo == itemGuest.CourseGradeNo.ToString()) ?? new RB_Course_Chapter_ViewModel();
}
if (chapterCurrent != null && chapterCurrent.ChapterId > 0)
{
if (chapterCurrent.ChapterName.Contains(chapterCurrent.CourseRate.ToName().Replace("课程", "")))
{
CourseChapterNoName = chapterCurrent?.ChapterName;
}
else
{
CourseChapterNoName = chapterCurrent?.CourseRate.ToName().Replace("课程", "") + "-" + chapterCurrent?.ChapterName;
}
}
}
excelColumns.Add(new ExcelColumn(value: chapterName) { CellWidth = 50, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
excelColumns.Add(new ExcelColumn(value: CourseChapterNoName) { CellWidth = 50, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
ExcelDataSource rowGuest = new ExcelDataSource()
{
ExcelRows = excelColumns
......@@ -853,14 +887,13 @@ namespace Edu.WebApi.Controllers.Course
ExcelDataSource rowKGuest = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=50,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
//new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
}
{
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=24,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
new ExcelColumn(value:""){CellWidth=50,HAlignmentEnum= HAlignmentEnum.CENTER,VAlignmentEnum= VAlignmentEnum.CENTER },
}
};
slist.Add(rowKGuest);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment