Commit cea93481 authored by liudong1993's avatar liudong1993

教室记录调整

parent 661238ed
......@@ -4038,6 +4038,9 @@ namespace Edu.Module.Course
var list = new List<RB_Class_Plan_ViewModel>();
//试听课列表
var reserveList = new List<RB_Reserve_Class_Extend>();
//约课列表
var appointList = new List<RB_Scroll_Appointment_ViewModel>();
List<RB_Class_RoomUseLog_ViewModel> roomUserLogList = new List<RB_Class_RoomUseLog_ViewModel>();
var reserveQuery = new RB_Reserve_Class_Extend()
{
......@@ -4050,6 +4053,14 @@ namespace Edu.Module.Course
{
list = class_PlanRepository.GetClassPlanStatisticalRepository(query);
reserveList = reserve_ClassRepository.GetReserveClassListRepository(reserveQuery);
appointList = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel()
{
Group_Id = query.Group_Id,
StartTime = query.StartTime,
EntTime = query.EndTime,
TeacherId = query.TeacherId,
RoomId = query.ClassRoomId
});
}
else if (ClassType == 1)
{
......@@ -4059,8 +4070,19 @@ namespace Edu.Module.Course
{
reserveList = reserve_ClassRepository.GetReserveClassListRepository(reserveQuery);
}
else if (ClassType == 3)
{
appointList = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel()
{
Group_Id = query.Group_Id,
StartTime = query.StartTime,
EntTime = query.EndTime,
TeacherId = query.TeacherId,
RoomId = query.ClassRoomId
});
}
if (list != null || reserveList != null)
if (list != null || reserveList != null || appointList != null)
{
var timeList = new List<RB_Class_Time_ViewModel>();
var guestList = new List<RB_Order_Guest_ViewModel>();
......@@ -4076,6 +4098,10 @@ namespace Edu.Module.Course
{
classRoomId.AddRange(reserveList.Select(x => x.ClassRoomId).ToList());
}
if (appointList != null && appointList.Any())
{
classRoomId.AddRange(appointList.Select(x => x.RoomId).Distinct().ToList());
}
string roomIds = string.Join(",", classRoomId.Select(x => x).Distinct());
if (!string.IsNullOrWhiteSpace(roomIds))
......@@ -4176,8 +4202,41 @@ namespace Edu.Module.Course
CompleteProgress = -1,
GuestList = visitorList?.Where(qitem => qitem.ReserveClassId == subItem.ReserveClassId)?.Select(qitem => new { GuestName = qitem.VisitorName }),
Type = 0,// 0-班级,1-使用记录,2-异常记录
subItem.ReserveType,
subItem.ClassPlanId
});
}
// 约课
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.ChapterNo, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
var currentDate = Common.ConvertHelper.FormatDate(ClassDate) + " " + STime;
subList.Add(new
{
Id = 0,
ClassType = 3,
ClassId = 0,
ClassName = "约课",
item.Key.CourseName,
item.Key.RoomName,
item.Key.TeacherName,
Ranks = item.Key.ChapterNo,
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
TimeStr = Common.ConvertHelper.GetTimeStr(currentDate),
StartTime = STime,
EndTime = ETime,
CompleteProgress = -1,
GuestList = item.Select(qitem => new { GuestName = qitem.StuName, qitem.AppointType }),
Type = 0,// 0-班级,1-使用记录,2-异常记录
AppointState = item.Where(x => x.State == CourseAppointStateEnum.WaitSure).Any() ? 1 : 2,
item.FirstOrDefault().ScrollMinNum
});
});
var obj = new
{
ClassDate = Common.ConvertHelper.FormatDate(ClassDate),
......@@ -4544,6 +4603,7 @@ namespace Edu.Module.Course
var visitorList = new List<RB_Visitor_Reserve_Extend>();
if (reserveList != null && reserveList.Count > 0)
{
reserveList = reserveList.Where(x => x.ReserveType == 0).ToList();
string reserveClassIds = string.Join(",", reserveList.Select(qitem => qitem.ReserveClassId));
visitorList = visitor_ReserveRepository.GetVisitorReserveListRepository(new Model.ViewModel.Reserve.RB_Visitor_Reserve_Extend()
{
......
......@@ -164,10 +164,10 @@ WHERE 1=1
public List<RB_Class_Time_ViewModel> GetClassTimeList(RB_Class_Time_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT a.*,c.ClassName,b.ClassRoomId,t.TeacherName from rb_class_time as a LEFT JOIN rb_class_plan as b on a.ClassPlanId=b.ClassPlanId
builder.AppendFormat(@" SELECT a.*,if(b.PlanType=2,'预约课',c.ClassName) as ClassName,b.ClassRoomId,t.TeacherName from rb_class_time as a LEFT JOIN rb_class_plan as b on a.ClassPlanId=b.ClassPlanId
LEFT JOIN rb_class as c on a.ClassId=c.ClassId
LEFT JOIN rb_teacher as t on b.TeacherId=t.TId
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and t.`Status`=0 and c.`Status`=0 and c.ClassStatus in(1,2) ");
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and t.`Status`=0 and case when b.PlanType =2 then 1=1 else c.`Status`=0 and c.ClassStatus in(1,2) end ");
if (query != null)
{
if (query.ClassPlanId > 0)
......
......@@ -270,7 +270,7 @@ namespace Edu.WebApi.Controllers.Course
School_Id = base.ParmJObj.GetInt("SchoolId", -1),
ClassId = base.ParmJObj.GetInt("ClassId"),
};
//课程类型(0-全部,1-正常,2-试听课)
//课程类型(0-全部,1-正常,2-试听课) 3 预约课
int ClassType = base.ParmJObj.GetInt("ClassType");
var obj = classModule.GetClassUseStatisticalModule(query, ClassType: ClassType);
return ApiResult.Success(data: obj);
......
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