Commit 64c586f3 authored by 黄奎's avatar 黄奎

页面修改

parent 0eff12b8
......@@ -592,16 +592,19 @@ namespace Edu.Module.Course
}
#endregion
//班级上课计划列表
List<RB_Class_Plan_ViewModel> classPlanList = CreateClassPlanList(model, defaultPlanTimeList, BasicMinutes);
model.ClassPlanList = classPlanList;
if (model.Teacher_Id > 0 && model.ClassRoomId > 0)
{
//班级上课计划列表
List<RB_Class_Plan_ViewModel> classPlanList = CreateClassPlanList(model, defaultPlanTimeList, BasicMinutes);
model.ClassPlanList = classPlanList;
}
else
{
model.ClassPlanList = new List<RB_Class_Plan_ViewModel>();
}
#region 同步班级到甲鹤小程序 Add by:W 2021-08-02 09:49
SetGoodsSpecificationValue(model);
#endregion
return flag;
}
......@@ -947,25 +950,53 @@ namespace Edu.Module.Course
/// <param name="message"></param>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool SetClassStatusModule(RB_Class_ViewModel model, out string message, out bool result)
public virtual bool SetClassStatusModule(RB_Class_ViewModel model, UserInfo user,out string message, out bool result)
{
var oldModel = GetClassModule(model.ClassId);
result = false;
bool flag = false;
message = "";
var newTeacherId = oldModel.Teacher_Id > 0 ? oldModel.Teacher_Id : model.Teacher_Id;
var newClassRoomId = oldModel.ClassRoomId > 0 ? oldModel.ClassRoomId : model.ClassRoomId;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Class_ViewModel.ClassStatus),(int)model.ClassStatus},
};
//上课计划
Dictionary<string, object> planFileds = new Dictionary<string, object>();
if (model.ClassRoomId > 0)
{
fileds.Add(nameof(RB_Class_ViewModel.ClassRoomId), model.ClassRoomId);
planFileds.Add(nameof(RB_Class_Plan.ClassRoomId), model.ClassRoomId);
}
if (model.Teacher_Id > 0)
{
fileds.Add(nameof(RB_Class_ViewModel.Teacher_Id), model.Teacher_Id);
Dictionary<string, object> planFileds = new Dictionary<string, object>()
{
{nameof(RB_Class_Plan.TeacherId),model.Teacher_Id },
};
planFileds.Add(nameof(RB_Class_Plan.TeacherId), model.Teacher_Id);
}
if (planFileds != null && planFileds.Count > 0)
{
class_PlanRepository.Update(planFileds, new WhereHelper(nameof(RB_Class_Plan.ClassId), model.ClassId));
class_PlanRepository.CheckClassPlanRepeatRepository(model.ClassId, out result);
}
if (model.ClassStatus == ClassStatusEnum.StudyIng)
{
if (oldModel.Teacher_Id > 0 && oldModel.ClassRoomId > 0)
{
class_PlanRepository.CheckClassPlanRepeatRepository(model.ClassId, out result);
}
else
{
oldModel.Teacher_Id = newTeacherId;
oldModel.ClassRoomId = newClassRoomId;
var BasicMinutes = GetBasicMinutesModule(oldModel.Group_Id);
if (!string.IsNullOrEmpty(oldModel.DefaultTimeJson))
{
oldModel.DefaultTimeList = Common.Plugin.JsonHelper.DeserializeObject<List<ClassTimeItem>>(oldModel.DefaultTimeJson);
}
List<RB_Class_Plan_ViewModel> classPlanList = CreateClassPlanList(oldModel, oldModel.DefaultTimeList, BasicMinutes);
model.ClassPlanList = classPlanList;
AddClassPlanModule(model.ClassId, classPlanList, user, out result);
}
}
//结课验证课时
if (model.ClassStatus == ClassStatusEnum.EndClass)
......
......@@ -78,6 +78,8 @@ namespace Edu.WebApi.Controllers.Course
item.CouseId,
item.CourseName,
item.Teacher_Id,
item.ClassRoomId,
item.RoomName,
item.TeacherName,
item.ClassPersion,
item.OrderStudentCount,
......@@ -196,6 +198,7 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost]
public ApiResult SetClass()
{
var oldClassId = base.ParmJObj.GetInt("ClassId");
var extModel = new RB_Class_ViewModel()
{
ClassId = base.ParmJObj.GetInt("ClassId"),
......@@ -309,6 +312,10 @@ namespace Edu.WebApi.Controllers.Course
{
Common.Plugin.LogHelper.Write(ex, "SetClass_DefaultPlanTimeList");
}
if (oldClassId == 0 && (extModel.ClassDateList == null || (extModel.ClassDateList != null && extModel.ClassDateList.Count == 0)))
{
return ApiResult.Failed(message: "请选择开班日期!");
}
List<string> dayList = new List<string>();
if (extModel.DefaultTimeList != null && extModel.DefaultTimeList.Count > 0)
{
......@@ -379,7 +386,23 @@ namespace Edu.WebApi.Controllers.Course
{
extModel.DefaultTimeJson = "";
}
bool flag = classModule.SetClassModule(extModel);
bool flag = false;
if (oldClassId == 0)
{
foreach (var item in extModel.ClassDateList)
{
extModel.OpenTime = Convert.ToDateTime(item);
if (oldClassId == 0)
{
extModel.ClassId = 0;
}
flag = classModule.SetClassModule(extModel);
}
}
else
{
flag = classModule.SetClassModule(extModel);
}
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
......@@ -558,7 +581,8 @@ namespace Edu.WebApi.Controllers.Course
{
ClassId = base.ParmJObj.GetInt("ClassId"),
ClassStatus = (ClassStatusEnum)base.ParmJObj.GetInt("ClassStatus"),
Teacher_Id = base.ParmJObj.GetInt("Teacher_Id")
Teacher_Id = base.ParmJObj.GetInt("Teacher_Id"),
ClassRoomId = base.ParmJObj.GetInt("ClassRoomId"),
};
if (extModel.ClassId <= 0)
{
......@@ -571,10 +595,14 @@ namespace Edu.WebApi.Controllers.Course
}
if (model.ClassStatus == ClassStatusEnum.NonOpenClass && extModel.ClassStatus == ClassStatusEnum.StudyIng && model.Teacher_Id <= 0 && extModel.Teacher_Id <= 0)
{
return ApiResult.ParamIsNull(message: "未找到此班级,请刷新页面重试!");
return ApiResult.ParamIsNull(message: "请选择班级上课老师!");
}
if (model.ClassStatus == ClassStatusEnum.NonOpenClass && extModel.ClassStatus == ClassStatusEnum.StudyIng && model.ClassRoomId <= 0 && extModel.ClassRoomId <= 0)
{
return ApiResult.ParamIsNull(message: "请选择班级上课教室!");
}
extModel.CouseId = model.CouseId;
bool flag = classModule.SetClassStatusModule(extModel, out string message, out bool result);
bool flag = classModule.SetClassStatusModule(extModel,base.UserInfo,out string message, out bool result);
return flag ? ApiResult.Success(message: message, data: result) : ApiResult.Failed(message: message, data: result);
}
......@@ -1447,7 +1475,7 @@ namespace Edu.WebApi.Controllers.Course
Name = "不限"
});
}
return ApiResult.Success(data: list);
return ApiResult.Success(data: list.OrderBy(qitem => qitem.Id));
}
#endregion
......
......@@ -75,6 +75,8 @@ namespace Edu.WebApi.Controllers.Course
item.CourseName,
item.Teacher_Id,
item.TeacherName,
item.ClassRoomId,
item.RoomName,
item.ClassPersion,
item.TotalPlanNum,
item.UsePlanNum,
......
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