Commit 10a15c1b authored by 黄奎's avatar 黄奎

页面修改

parent 211d1d75
...@@ -68,122 +68,38 @@ namespace Edu.Module.EduTask ...@@ -68,122 +68,38 @@ namespace Edu.Module.EduTask
public List<object> GetRepeatListModule(int ClassId, List<ChangePlanItem> changeList, List<TimeItem> timeList) public List<object> GetRepeatListModule(int ClassId, List<ChangePlanItem> changeList, List<TimeItem> timeList)
{ {
List<object> list = new List<object>(); List<object> list = new List<object>();
if (timeList != null && timeList.Count > 0) var planList = new List<RB_Class_Plan_ViewModel>();
{ if (changeList != null && changeList.Count > 0)
var repeatList = CheckClassPlanModule(ClassId, timeList);
if (repeatList != null && repeatList.Count > 0)
{ {
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
List<RB_Teacher_ViewModel> teacherList = new List<RB_Teacher_ViewModel>();
string roomIds = string.Join(",", changeList.Where(qitem => qitem.ClassRoomId > 0).Select(qitem => qitem.ClassRoomId));
string teacherIds = string.Join(",", changeList.Where(qitem => qitem.TeacherId > 0).Select(qitem => qitem.TeacherId));
//冲突的上课计划编号
List<int> ids = new List<int>();
foreach (var item in changeList) foreach (var item in changeList)
{ {
var tempRepeatList = repeatList?.Where(qitem => qitem.ClassDate == item.ClassDate)?.ToList(); var planModel = new RB_Class_Plan_ViewModel()
if (tempRepeatList != null && tempRepeatList.Count > 0)
{
if (item.TeacherId > 0)
{
var tempTeacherList = tempRepeatList?.Where(qitem => qitem.TeacherId == item.TeacherId)?.ToList();
if (tempTeacherList != null && tempTeacherList.Count > 0)
{
var tempIds = Common.ConvertHelper.StringToList(string.Join(",", tempTeacherList.GroupBy(qitem => qitem.ClassPlanId).Select(qitem => qitem.Key)));
if (tempIds != null && tempIds.Count > 0)
{
ids.AddRange(tempIds);
}
}
}
if (item.ClassRoomId > 0)
{ {
var classroomList = tempRepeatList?.Where(qitem => qitem.ClassRoomId == item.ClassRoomId)?.ToList(); ClassPlanId=0,
if (classroomList != null && classroomList.Count > 0) ClassId=ClassId,
{ ClassDate=item.ClassDate,
var tempIds = Common.ConvertHelper.StringToList(string.Join(",", classroomList.GroupBy(qitem => qitem.ClassPlanId).Select(qitem => qitem.Key))); ClassRoomId=item.ClassRoomId,
if (tempIds != null && tempIds.Count > 0) TeacherId=item.TeacherId,
{ PlanTimeList=new List<RB_Class_Time_ViewModel> (),
ids.AddRange(tempIds); };
} if (timeList != null && timeList.Count > 0)
}
}
}
}
var planList = new List<RB_Class_Plan_ViewModel>();
var classTimeList = new List<RB_Class_Time_ViewModel>();
if (ids != null && ids.Count > 0)
{ {
if (!string.IsNullOrEmpty(roomIds)) foreach (var subItem in timeList)
{ {
roomList = class_RoomRepository.GetClassRoomListRepository(new RB_Class_Room_ViewModel() planModel.PlanTimeList.Add(new RB_Class_Time_ViewModel
{ {
QRoomIds = roomIds StartTime = subItem.StartTime,
EndTime = subItem.EndTime,
TimeHour = subItem.TimeHour,
}); });
} }
if (!string.IsNullOrEmpty(teacherIds))
{
teacherList = teacherRepository.GetTeacherListRepository(new Model.ViewModel.User.RB_Teacher_ViewModel()
{
QTIds = teacherIds
});
} }
planList = class_PlanRepository.GetClassPlanListRepository(new RB_Class_Plan_ViewModel() planList.Add(planModel);
{
QClassPlanIds = string.Join(",", ids)
});
classTimeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel()
{
QClassPlanIds = string.Join(",", ids)
});
foreach (var item in changeList)
{
List<object> PlanRepeatList = new List<object>();
var tempRepeatList = planList?.Where(qitem => qitem.ClassDate == item.ClassDate)?.ToList();
if (tempRepeatList != null && tempRepeatList.Count > 0)
{
foreach (var subItem in tempRepeatList)
{
var tempObj = new
{
subItem.ClassPlanId,
subItem.ClassId,
subItem.ClassName,
ClassDate = Common.ConvertHelper.FormatDate(subItem.ClassDate),
subItem.TeacherId,
subItem.TeacherName,
subItem.ClassRoomId,
subItem.RoomName,
PlanTimeList = classTimeList.Where(qitem => qitem.ClassPlanId == subItem.ClassPlanId).Select(qitem => new
{
qitem.StartTime,
qitem.EndTime,
qitem.TimeHour
}),
};
PlanRepeatList.Add(tempObj);
} }
} }
var obj = new if (timeList != null && timeList.Count > 0 && planList!=null && planList.Count>0)
{ {
item.ClassPlanId, list = GetRepeatDataModule(planList, 2);
ClassDate = Common.ConvertHelper.FormatDate(item.ClassDate),
item.TeacherId,
TeacherName = teacherList?.Where(qitem => qitem.TId == item.TeacherId)?.FirstOrDefault()?.TeacherName ?? "",
item.ClassRoomId,
RoomName = roomList?.Where(qitem => qitem.RoomId == item.ClassRoomId)?.FirstOrDefault()?.RoomName ?? "",
PlanTimeList = item.PlanTimeList.Select(qitem => new
{
qitem.StartTime,
qitem.EndTime,
}),
PlanRepeatList
};
list.Add(obj);
}
}
}
} }
return list; return list;
} }
......
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