Commit 857a9ee6 authored by 黄奎's avatar 黄奎

上课记录调整

parent ef186369
......@@ -49,6 +49,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public int IsQRoot { get; set; }
/// <summary>
/// 课程等级倒序,章节升序
/// </summary>
public int QOrderBy { get; set; }
}
[Serializable]
......
......@@ -122,6 +122,12 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_Student_StudyRepository studentStudyRepository = new RB_Student_StudyRepository();
/// <summary>
/// 订单课程仓储层
/// </summary>
private readonly RB_Order_CourseRepository order_CourseRepository = new RB_Order_CourseRepository();
#region 班次
......@@ -3691,6 +3697,8 @@ namespace Edu.Module.Course
//获取所有的订单信息
string orderIds = string.Join(",", ogList.Select(x => x.OrderId));
var orderList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel() { Group_Id = demodel.Group_Id, QOrderIds = orderIds });
//订单课程关联表
List<RB_Order_Course_ViewModel> orderCourseList = order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel() { QOrderIds = orderIds });
//查询订单Guest
string orderGuestIds = string.Join(",", ogList.Select(x => x.OrderId));
var orderGuestList = order_GuestRepository.GetSingleListRepository(new RB_Order_Guest_ViewModel() { Group_Id = demodel.Group_Id, OrderGuestIds = orderGuestIds });
......@@ -3701,28 +3709,32 @@ namespace Edu.Module.Course
foreach (var item in orderList)
{
int TotalChapterNo = 0;//总课次
int CourseChapterNo = 0;//已上课次
List<object> ChapterList = new List<object>();
var ogModel = ogList.Where(x => x.OrderId == item.OrderId).FirstOrDefault();
var oguestModel = orderGuestList.Where(x => x.Id == ogModel.GuestId).FirstOrDefault();
//根据课程Id 查询 上课课程
var cList = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseId = item.CourseId });
List<int> courseIdList = new List<int>();
courseIdList.Add(item.CourseId);
var tempCourseList = orderCourseList?.Where(qitem => qitem.OrderId == item.OrderId)?.Select(qitem=>qitem.CourseId)?.ToList()?.Distinct();
if (tempCourseList != null && tempCourseList.Count() > 0)
{
courseIdList.AddRange(tempCourseList);
}
var cList = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseIds = string.Join(",", courseIdList.Distinct()),QOrderBy=1 })?.ToList();
if (item.ClassScrollType == 2)
{
var achildList = AppointList.Where(x => x.GuestId == ogModel.GuestId).ToList();//当前课程的
//预约课
int CourseChapterNo = achildList.Any() ? achildList.Max(x => x.ChapterNo) : 0;
int CourseChapterNo2 = SkipList.Any() ? SkipList.Max(x => x.ChapterNo) : 0;
CourseChapterNo = CourseChapterNo < CourseChapterNo2 ? CourseChapterNo2 : CourseChapterNo;
cList.ForEach(x =>
foreach (var sItem in cList)
{
x.SortNum = Convert.ToDouble(x.ChapterNo);
});
cList.Where(x => x.SortNum <= CourseChapterNo).OrderByDescending(x => x.SortNum).ToList().ForEach(x =>
{
var AppointModel = achildList.Where(y => y.ChapterNo == x.SortNum && y.AppointType != 3 && y.LearnCourseId == item.CourseId).FirstOrDefault();
var SkipModel = SkipList.Where(y => y.ChapterNo == x.SortNum && y.CourseId == item.CourseId).FirstOrDefault();
int AgainNum = achildList.Where(y => y.ChapterNo == x.SortNum && y.AppointType == 3 && y.LearnCourseId == item.CourseId).Count();
int State = 3;
var AppointModel = achildList.Where(y => y.CourseGradeId == sItem.CourseRate && y.CourseGradeNo==sItem.ChapterGradeNo).FirstOrDefault();
//var SkipModel = SkipList.Where(y => y.ChapterNo == x.SortNum && y.CourseId == item.CourseId).FirstOrDefault();
int AgainNum = achildList.Where(y => y.CourseGradeId == sItem.CourseRate && y.CourseGradeNo == sItem.ChapterGradeNo && y.AppointType == 3).Count();
int State = 0;
int AppointState = 0;
string ClassDate = "";
if (AppointModel != null)
......@@ -3732,6 +3744,7 @@ namespace Edu.Module.Course
if (AppointModel.AppointType == 1)
{
State = 1;//正常上课
CourseChapterNo++;
}
else if (AppointModel.AppointType == 2)
{
......@@ -3739,30 +3752,31 @@ namespace Edu.Module.Course
}
AppointState = (int)AppointModel.State;
}
if (SkipModel != null && SkipModel.State == 1)
{
State = 3;//跳课
}
//if (SkipModel != null && SkipModel.State == 1)
//{
// State = 3;//跳课
//}
ChapterList.Add(new
{
x.ChapterNo,
x.ChapterName,
x.CourseRate,
CourseRateName = x.CourseRate.ToName(),
x.ChapterGradeNo,
sItem.ChapterNo,
sItem.ChapterName,
sItem.CourseRate,
CourseRateName = sItem.CourseRate.ToName(),
sItem.ChapterGradeNo,
State,
AppointState,
AgainNum,
ClassDate
});
});
}
}
else
{
//跟班
int CourseChapterNo = oguestModel?.CourseChapterNo ?? 0;
int tempCourseChapterNo = oguestModel?.CourseChapterNo ?? 0;
cList.ForEach(x => { x.SortNum = Convert.ToDouble(x.ChapterNo); });
ChapterList.AddRange(cList.Where(x => x.SortNum <= CourseChapterNo).OrderByDescending(x => x.SortNum).Select(x => new
ChapterList.AddRange(cList.Where(x => x.SortNum <= tempCourseChapterNo).OrderByDescending(x => x.SortNum).Select(x => new
{
x.ChapterNo,
x.ChapterName,
......@@ -3775,14 +3789,24 @@ namespace Edu.Module.Course
ClassDate = ""
}));
}
if (item.ClassScrollType == 1)
{
TotalChapterNo = oguestModel?.TotalChapterNo ?? 0;
CourseChapterNo = oguestModel?.CourseChapterNo ?? 0;
}
else
{
TotalChapterNo = cList?.Count() ?? 0;
}
Rlist.Add(new
{
item.OrderId,
item.CourseId,
item.CourseName,
item.ClassScrollType,
CourseChapterNo = oguestModel?.CourseChapterNo ?? 0,
TotalChapterNo = oguestModel?.TotalChapterNo ?? 0,
CourseChapterNo,
TotalChapterNo,
ChapterList
});
}
......
......@@ -61,6 +61,10 @@ namespace Edu.Repository.Course
builder.AppendFormat(" AND {0}=0 ", nameof(RB_Course_Chapter_ViewModel.ParentId));
}
}
if (query.QOrderBy == 1)
{
builder.AppendFormat(" ORDER BY CourseRate ASC,ChapterGradeNo ASC ");
}
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
......
......@@ -1279,7 +1279,10 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetStuLearnChapterList()
{
var userInfo = base.UserInfo;
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
RB_Scroll_Appointment_ViewModel demodel = new RB_Scroll_Appointment_ViewModel()
{
StuId=base.ParmJObj.GetInt("StuId"),
};
demodel.Group_Id = userInfo.Group_Id;
var list = scrollClassModule.GetStuLearnChapterList(demodel);
return ApiResult.Success("", list);
......
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