Commit f661183b authored by 罗超's avatar 罗超

教室终端相关接口调整

parent 615582ae
......@@ -98,6 +98,12 @@ namespace Edu.Common.SignalR
await Clients.Group("LIVER").SendAsync("PULL_CLASSROOM_LIVE", msg);
}
public async void DownSaveLiveVideo(string msg)
{
await Clients.Group("LIVER").SendAsync("CLOSE_PULL_CLASSROOM_LIVE", msg);
}
/// <summary>
/// 监听客户端掉线
/// </summary>
......
......@@ -1963,6 +1963,11 @@ namespace Edu.Module.Course
return order_GuestRepository.GetOrderGuestListRepository(model);
}
public int GetStudentOrderGuestIdByClassTimeIDModule(int stuId, int timeId)
{
return class_TimeRepository.GetStudentOrderGuestIdByClassTimeID(stuId,timeId);
}
/// <summary>
/// 根据上课id获取订单学员信息
/// </summary>
......
......@@ -225,7 +225,7 @@ where a.`Status`=0 and b.ClassStatus<>2 and c.ClassStatus in(1,2) and c.`Status
public List<RB_Class_Time_Extend> GetClassTimeByRoomIdV2(int RoomId, int Group_Id, int Tid)
{
string sql = "select * from (select a.ClassPlanId,c.TeacherName,b.ClassTimeId,c.TeacherHead,a.TeacherId,d.RoomName,b.StartTime,b.EndTime,a.PlanType,(case a.PlanType when 1 then (select CourseName from rb_course where CourseId=e.CouseId) when 2 then (select func_course_rate(CourseGradeId) from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) END) as CourseName,(case a.PlanType when 1 then (select (Count(0)+1) from rb_class_plan where `status`=0 and ClassId=a.ClassId and TO_Days(ClassDate)<TO_Days(a.ClassDate)) when 2 then (select CourseGradeNo from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) end) as Progress,(case a.PlanType when 1 then (select CourseRate from rb_course where CourseId=e.CouseId) when 2 then (select CourseGradeId from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) END) as CourseRate from rb_class_plan a left join rb_class_time b on a.ClassPlanId=b.ClassPlanId left join rb_teacher c on a.TeacherId=c.TId left join rb_class_room d on a.ClassRoomId = d.RoomId left join rb_class e on a.ClassId=e.ClassId where TO_Days(a.ClassDate)=TO_Days(now()) and c.TId=@tid and a.`status`=0 and b.EndTime>=DATE_FORMAT(now(),'%H:%i') and a.Group_Id=@gid and a.ClassRoomId=@roomId union all select ReserveClassId as ClassPlanId,b.TeacherName,ReserveClassId as ClassTimeId,b.TeacherHead,a.TeacherId,c.RoomName,a.ClassTime as StartTime,a.EndTime,3 as PlanType,a.ClassContent as CourseName,1 as Progress,1 as CourseRate from rb_reserve_class a left join rb_teacher b on a.TeacherId=b.TId left join rb_class_room c on a.ClassRoomId=c.RoomId where TO_Days(a.ClassDate)=TO_Days(now()) and b.TId=@tid and a.EndTime>=DATE_FORMAT(now(),'%H:%i') and a.`Status`=0 and a.Group_Id=@gid and a.ClassRoomId=@roomId) as aa order by aa.StartTime";
string sql = "select * from (select a.ClassId,b.ClassStatus,a.ClassPlanId,c.TeacherName,b.ClassTimeId,c.TeacherHead,a.TeacherId,d.RoomName,b.StartTime,b.EndTime,a.PlanType,(case a.PlanType when 1 then (select CourseName from rb_course where CourseId=e.CouseId) when 2 then (select func_course_rate(CourseGradeId) from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) END) as CourseName,(case a.PlanType when 1 then (select (Count(0)+1) from rb_class_plan where `status`=0 and ClassId=a.ClassId and TO_Days(ClassDate)<TO_Days(a.ClassDate)) when 2 then (select CourseGradeNo from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) end) as Progress,(case a.PlanType when 1 then (select CourseRate from rb_course where CourseId=e.CouseId) when 2 then (select CourseGradeId from rb_scroll_appointment where ClassPlanId=a.ClassPlanId group by ClassPlanId) END) as CourseRate from rb_class_plan a left join rb_class_time b on a.ClassPlanId=b.ClassPlanId left join rb_teacher c on a.TeacherId=c.TId left join rb_class_room d on a.ClassRoomId = d.RoomId left join rb_class e on a.ClassId=e.ClassId where TO_Days(a.ClassDate)=TO_Days(now()) and c.TId=@tid and a.`status`=0 and b.EndTime>=DATE_FORMAT(now(),'%H:%i') and a.Group_Id=@gid and a.ClassRoomId=@roomId union all select 0 as ClassId,0 as ClassStatus,ReserveClassId as ClassPlanId,b.TeacherName,ReserveClassId as ClassTimeId,b.TeacherHead,a.TeacherId,c.RoomName,a.ClassTime as StartTime,a.EndTime,3 as PlanType,a.ClassContent as CourseName,1 as Progress,1 as CourseRate from rb_reserve_class a left join rb_teacher b on a.TeacherId=b.TId left join rb_class_room c on a.ClassRoomId=c.RoomId where TO_Days(a.ClassDate)=TO_Days(now()) and b.TId=@tid and a.EndTime>=DATE_FORMAT(now(),'%H:%i') and a.`Status`=0 and a.Group_Id=@gid and a.ClassRoomId=@roomId) as aa order by aa.StartTime";
DynamicParameters parameters = new DynamicParameters();
parameters.Add("gid", Group_Id);
parameters.Add("roomId", RoomId);
......@@ -234,6 +234,17 @@ where a.`Status`=0 and b.ClassStatus<>2 and c.ClassStatus in(1,2) and c.`Status
return Get<RB_Class_Time_Extend>(sql, parameters).ToList();
}
public int GetStudentOrderGuestIdByClassTimeID(int stuId,int timeId)
{
var sql = "select IFNULL(MAX(GuestId),0) as GuestId from rb_student_orderguest a where Student_Id=@stuId and a.GuestId in(select IF(b.PlanType=2,c.GuestId,e.Id) as GuestId from rb_class_time a left join rb_class_plan b on a.ClassPlanId=b.ClassPlanId left join rb_scroll_appointment c on b.ClassPlanId=c.ClassPlanId and b.PlanType=2 left join rb_class d on a.ClassId=d.ClassId and b.PlanType!=2 left join rb_order_guest e on e.ClassId=d.ClassId where ClassTimeId=@timeId)";
DynamicParameters parameters = new DynamicParameters();
parameters.Add("stuId", stuId);
parameters.Add("timeId", timeId);
return Convert.ToInt32(ExecuteScalar(sql, parameters));
}
/// <summary>
/// 获取班级上课时间
......
......@@ -1194,15 +1194,46 @@ namespace Edu.WebApi.Controllers.Course
CheckStatus = obj.GetInt("CheckStatus"),
ClassDate = obj.GetDateTime("ClassDate"),
ClassRoomId = obj.GetInt("ClassRoomId"),
OrderGuestId = obj.GetInt("OrderGuestId"),
OrderGuestId = obj.GetInt("OrderGuestId",0),
School_Id = obj.GetInt("School_Id"),
StudyNum = obj.GetInt("StudyNum"),
TeacherId = obj.GetInt("TeacherId"),
ClassId = obj.GetInt("classId"),
ClassTimeId = obj.GetInt("ClassTimeId"),
StuId = obj.GetInt("StuId")
});
}
}
//判断当天是否有已签到数据
var checkLogList = classModule.GetClassCheckList(new RB_Class_Check_ViewModel
{
Group_Id = base.UserInfo.Group_Id,
ClassId = list.FirstOrDefault().ClassId,
StartDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"),
EndDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"),
ClassTimeId = list.FirstOrDefault().ClassTimeId,
});
#region 验证是否存在学员编号
if (list.Count == 1) {
if (list[0].OrderGuestId == 0)
{
var guestId = classModule.GetStudentOrderGuestIdByClassTimeIDModule(list[0].StuId, list[0].ClassTimeId);
if (guestId == 0)
{
return ApiResult.ParamIsNull(message: "当前课程不是你的上课内容,请联系前台");
}
else
{
list[0].OrderGuestId = guestId;
}
}
if (checkLogList.Where(x => x.OrderGuestId == list[0].OrderGuestId && x.CheckStatus == list[0].CheckStatus).Any())
{
return ApiResult.Success(message: "check_repeat");
}
}
#endregion
if (list == null || !list.Any())
{
return ApiResult.ParamIsNull(message: "请选择签到学员!");
......@@ -1236,15 +1267,7 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Failed("今日无课程,无须签到");
}
//判断当天是否有已签到数据
var checkLogList = classModule.GetClassCheckList(new RB_Class_Check_ViewModel
{
Group_Id = base.UserInfo.Group_Id,
ClassId = list.FirstOrDefault().ClassId,
StartDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"),
EndDate = list.FirstOrDefault().ClassDate.ToString("yyyy-MM-dd HH:mm:ss"),
ClassTimeId = list.FirstOrDefault().ClassTimeId,
});
foreach (var item in list)
{
......@@ -1285,7 +1308,7 @@ namespace Edu.WebApi.Controllers.Course
{
classModule.SetClassProcessModule(list.FirstOrDefault().ClassId);
}
return result ? ApiResult.Success() : ApiResult.Failed("签到失败");
return result ? ApiResult.Success(message:"check_success") : ApiResult.Failed("签到失败");
}
/// <summary>
......@@ -2359,7 +2382,9 @@ namespace Edu.WebApi.Controllers.Course
x.CourseName,
x.Progress,
x.CourseRate,
x.ClassTimeId
x.ClassTimeId,
x.ClassStatus,
x.ClassId
});
return ApiResult.Success(data: result);
......
{
"ConnectionStrings": {
"DefaultConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=test_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=test_edu3;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.10.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
......
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