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

页面修改

parent 211d1d75
......@@ -68,123 +68,39 @@ namespace Edu.Module.EduTask
public List<object> GetRepeatListModule(int ClassId, List<ChangePlanItem> changeList, List<TimeItem> timeList)
{
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)
foreach (var item in changeList)
{
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)
var planModel = new RB_Class_Plan_ViewModel()
{
var tempRepeatList = repeatList?.Where(qitem => qitem.ClassDate == item.ClassDate)?.ToList();
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();
if (classroomList != null && classroomList.Count > 0)
{
var tempIds = Common.ConvertHelper.StringToList(string.Join(",", classroomList.GroupBy(qitem => qitem.ClassPlanId).Select(qitem => qitem.Key)));
if (tempIds != null && tempIds.Count > 0)
{
ids.AddRange(tempIds);
}
}
}
}
}
var planList = new List<RB_Class_Plan_ViewModel>();
var classTimeList = new List<RB_Class_Time_ViewModel>();
if (ids != null && ids.Count > 0)
ClassPlanId=0,
ClassId=ClassId,
ClassDate=item.ClassDate,
ClassRoomId=item.ClassRoomId,
TeacherId=item.TeacherId,
PlanTimeList=new List<RB_Class_Time_ViewModel> (),
};
if (timeList != null && timeList.Count > 0)
{
if (!string.IsNullOrEmpty(roomIds))
{
roomList = class_RoomRepository.GetClassRoomListRepository(new RB_Class_Room_ViewModel()
{
QRoomIds = roomIds
});
}
if (!string.IsNullOrEmpty(teacherIds))
foreach (var subItem in timeList)
{
teacherList = teacherRepository.GetTeacherListRepository(new Model.ViewModel.User.RB_Teacher_ViewModel()
planModel.PlanTimeList.Add(new RB_Class_Time_ViewModel
{
QTIds = teacherIds
StartTime = subItem.StartTime,
EndTime = subItem.EndTime,
TimeHour = subItem.TimeHour,
});
}
planList = class_PlanRepository.GetClassPlanListRepository(new RB_Class_Plan_ViewModel()
{
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
{
item.ClassPlanId,
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);
}
}
planList.Add(planModel);
}
}
if (timeList != null && timeList.Count > 0 && planList!=null && planList.Count>0)
{
list = GetRepeatDataModule(planList, 2);
}
return list;
}
......
......@@ -134,7 +134,7 @@ namespace Edu.WebApi.Controllers.EduTask
//var objList = changeClassPlanModule.GetRepeatListModule(model.ClassId, model.NewChangePlanItemList, timeList);
//if (objList != null && objList.Count > 0)
//{
// return ApiResult.Failed("存在上课计划冲突的数据!", data: objList);
// return ApiResult.Failed("存在上课计划冲突的数据!", data: objList);
//}
}
}
......
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