Commit 206e3edb authored by 吴春's avatar 吴春

提交代码

parent 10cac36b
......@@ -806,6 +806,52 @@ namespace Edu.Module.Course
return list;
}
/// <summary>
/// 获取班级计划列表
/// </summary>
/// <param name="classId">班级编号</param>
/// <param name="monthStr">月份</param>
/// <returns></returns>
public object GetClassPlan_V2(RB_Class_Plan_ViewModel model)
{
List<object> list = new List<object>();
var timeList = new List<RB_Class_Time_ViewModel>();
var planList = class_PlanRepository.GetClassPlanListRepository(model)?.OrderBy(qitem => qitem.ClassDate);
if (planList != null && planList.Count() > 0)
{
string Ids = string.Join(",", planList.Select(qitem => qitem.ClassPlanId));
if (!string.IsNullOrEmpty(Ids))
{
timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { QClassPlanIds = Ids });
}
DateTime today = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
foreach (var item in planList)
{
item.PlanTimeList = timeList?.Where(qitem => qitem.ClassPlanId == item.ClassPlanId)?.ToList();
list.Add(new
{
IsEndDate = item.ClassDate <= today,
item.ClassPlanId,
item.ClassId,
item.ClassDate,
ClassDateStr = Common.ConvertHelper.FormatDate(item.ClassDate),
item.ClassRoomId,
item.RoomName,
item.TeacherId,
item.TeacherName,
item.UserIcon,
TimeList = item?.PlanTimeList?.Select(qitem => new { qitem.ClassTimeId, qitem.StartTime, qitem.EndTime })?.OrderBy(qitem => qitem.StartTime)
});
}
}
return list;
}
/// <summary>
/// 根据计划编号删除上课计划
/// </summary>
......
......@@ -227,7 +227,7 @@ SELECT a.*,c.Teacher_Id,c.ClassName,c.ClassType,T.TeacherName
FROM rb_class_plan as a
LEFT JOIN rb_class c on a.ClassId = c.ClassId
LEFT JOIN rb_teacher AS T ON a.TeacherId=T.TId
where a.`Status`=0 ");
where a.`Status`=0 and c.ClassStatus=2 and c.`Status`=0");
if (query != null)
{
if (query.Group_Id > 0)
......@@ -316,7 +316,7 @@ WHERE a.`Status`=0 and DATE_FORMAT(a.ClassDate,'%Y-%m-%d')<=DATE_FORMAT(NOW(),'
return GetPage<RB_Class_Plan_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取班级累计上课时间(分钟)
/// </summary>
......@@ -336,7 +336,8 @@ WHERE p.`Status`=0 AND p.Group_Id={group_Id} AND p.ClassId ={classId}
{
return Convert.ToInt32(obj);
}
else {
else
{
return 0;
}
}
......
......@@ -161,7 +161,7 @@ WHERE 1=1
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT a.*,c.ClassName,b.ClassRoomId 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
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and b.`Status`=0 and c.`Status`=0 and c.ClassStatus=2 ");
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and c.`Status`=0 and c.ClassStatus=2 ");
if (query != null)
{
if (query.ClassPlanId > 0)
......
......@@ -506,7 +506,7 @@ namespace Edu.WebApi.Controllers.Course
Id = jobj.GetInt("Id"),
ClassId = jobj.GetInt("ClassId"),
CourseId = jobj.GetInt("CourseId"),
CourseName=jobj.GetStringValue("CourseName"),
CourseName = jobj.GetStringValue("CourseName"),
CreateBy = UserInfo.Id,
CreateTime = DateTime.Now,
UpdateBy = UserInfo.Id,
......@@ -522,7 +522,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull(message: "请选择要关联的课程!");
}
var groupList = list.GroupBy(qitem => new { qitem.CourseId,qitem.CourseName }).Where(qitem=>qitem.Count()>1).Select(qitem => new { qitem.Key.CourseId,qitem.Key.CourseName});
var groupList = list.GroupBy(qitem => new { qitem.CourseId, qitem.CourseName }).Where(qitem => qitem.Count() > 1).Select(qitem => new { qitem.Key.CourseId, qitem.Key.CourseName });
string message = "";
if (groupList != null && groupList.Count() > 0)
{
......@@ -582,13 +582,33 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull(message: "未获取到班级关联课程编号,请刷新页面重试!");
}
bool flag = classModule.RemoveClassCourseModule(extModel.Id,out string message);
return flag ? ApiResult.Success(message:message) : ApiResult.Failed(message:message);
bool flag = classModule.RemoveClassCourseModule(extModel.Id, out string message);
return flag ? ApiResult.Success(message: message) : ApiResult.Failed(message: message);
}
#endregion
#region 上课计划
/// <summary>
/// 获取上课计划
/// </summary>
/// <returns></returns>
public ApiResult GetAllClassPlan()
{
var query = new RB_Class_Plan_ViewModel()
{
ClassId = base.ParmJObj.GetInt("ClassId"),
QMonth = base.ParmJObj.GetStringValue("QMonth"),
TeacherId = base.ParmJObj.GetInt("TeacherId"),
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id",-1),
};
var data = classModule.GetClassPlan_V2(query);
return ApiResult.Success(data: data);
}
/// <summary>
/// 获取上课计划
/// </summary>
......
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