Commit 76dc48e3 authored by 黄奎's avatar 黄奎

VIP约课调整

parent 23a89d52
......@@ -142,11 +142,6 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public int CourseChapterNo { get; set; }
/// <summary>
/// 学员订单Id
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// 订单课程Id
/// </summary>
......
......@@ -4089,6 +4089,7 @@ namespace Edu.Module.Course
}
List<RB_Course_Chapter_ViewModel> chatperList = new List<RB_Course_Chapter_ViewModel>();
List<RB_Order_Course_ViewModel> orderCourseList = new List<RB_Order_Course_ViewModel>();
List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>();
if (appointList != null && appointList.Count > 0)
{
string learnIds = string.Join(",", appointList.Select(qitem => qitem.LearnCourseId).Distinct());
......@@ -4102,15 +4103,15 @@ namespace Edu.Module.Course
orderCourseList = order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel() { QOrderIds = orderIds });
}
List<int> courseList = Common.ConvertHelper.StringToList(courseIds);
List<int> courseIdList = Common.ConvertHelper.StringToList(courseIds);
List<int> newList = new List<int>();
if (learnList != null)
{
newList.AddRange(learnList);
}
if (courseList != null)
if (courseIdList != null)
{
newList.AddRange(courseList);
newList.AddRange(courseIdList);
}
if (newList != null && newList.Count > 0)
......@@ -4119,6 +4120,7 @@ namespace Edu.Module.Course
{
CourseIds = string.Join(",", newList)
}); ;
courseList= courseRepository.GetCourseListRepository(new RB_Course_ViewModel() { QCourseIds = string.Join(",", newList) });
}
}
......@@ -4221,6 +4223,8 @@ namespace Edu.Module.Course
qitem.ShiftSort == item.Key.ShiftSort &&
qitem.CourseSTime == item.Key.CourseSTime
).ToList();
List<object> appointGuestList = new List<object>();
foreach (var sItem in subAppointList)
{
var tempOrderCourse = orderCourseList?.Where(qitem => qitem.OrderId == sItem.OrderId)?.ToList();
......@@ -4232,6 +4236,46 @@ namespace Edu.Module.Course
sItem.LearnCourseName = NewCourseName;
}
}
//最近一次上课章节
string FinishChapterNoName = "";
//本次消课章节
string CourseChapterNoName = "";
if (sItem.CourseGradeId == CourseRateEnum.OneCH || sItem.CourseGradeId == CourseRateEnum.OneFor)
{
if (sItem.CourseChapterNo > 0)
{
FinishChapterNoName = string.Format("第{0}次课", sItem.CourseChapterNo);
}
else
{
FinishChapterNoName = "暂无";
}
CourseChapterNoName = string.Format("第{0}次课", sItem.CourseGradeNo);
}
else
{
FinishChapterNoName = chatperList?.FirstOrDefault(qitem => qitem.CourseId == sItem.LearnCourseId && qitem.ChapterNo == sItem.CourseChapterNo.ToString())?.ChapterName;
CourseChapterNoName = chatperList?.FirstOrDefault(qitem => qitem.CourseId == sItem.LearnCourseId && qitem.ChapterNo == sItem.CourseGradeNo.ToString())?.ChapterName;
}
appointGuestList.Add(new
{
GuestName = sItem.StuName,
sItem.StuId,
sItem.GuestId,
sItem.OrderId,
AppointmentId = sItem.Id,
sItem.AppointType,
sItem.CourseGradeId,
sItem.LearnCourseId,
sItem.LearnCourseName,
sItem.CourseGradeNo,
FinishChapterNoName,
CourseChapterNoName,
IsChecked = false,
sItem.IsCalcStuCheck,
sItem.State,
StateName = sItem.State.ToName(),
});
}
var tempChatper = chatperList?.Where(qitem => qitem.CourseId == item.Key.CourseId && qitem.ChapterNo == item.Key.ChapterNo.ToString())?.FirstOrDefault();
string ChapterName = "";
......@@ -4242,6 +4286,8 @@ namespace Edu.Module.Course
CourseGradeId = tempChatper.CourseRate.ToInt();
ChapterName = tempChatper?.ChapterName ?? "";
}
var tempCourse = courseList?.FirstOrDefault(qitem => qitem.CourseId == item.Key.CourseId) ?? new RB_Course_ViewModel();
subList.Add(new
{
ClassType = 3,
......@@ -4253,6 +4299,7 @@ namespace Edu.Module.Course
item.Key.RoomName,
item.Key.AccountId,
item.Key.TeacherName,
CourseRate = tempCourse?.CourseRate ?? 0,
CourseGradeId,
item.Key.ChapterNo,
ChapterName,
......@@ -4262,24 +4309,7 @@ namespace Edu.Module.Course
StartTime = STime,
EndTime = ETime,
CompleteProgress = -1,
GuestList = subAppointList.Select(qitem => new
{
GuestName = qitem.StuName,
qitem.StuId,
qitem.GuestId,
AppointmentId = qitem.Id,
qitem.AppointType,
qitem.CourseGradeId,
qitem.LearnCourseId,
qitem.LearnCourseName,
qitem.CourseGradeNo,
FinishChapterNoName = chatperList?.FirstOrDefault(sItem => sItem.CourseId == qitem.LearnCourseId && sItem.ChapterNo == qitem.CourseChapterNo.ToString())?.ChapterName,
CourseChapterNoName = chatperList?.FirstOrDefault(sItem => sItem.CourseId == qitem.LearnCourseId && sItem.ChapterNo == qitem.CourseGradeNo.ToString())?.ChapterName,
IsChecked = false,
qitem.IsCalcStuCheck,
qitem.State,
StateName = qitem.State.ToName(),
}),
GuestList= appointGuestList,
AppointState = item.Where(x => x.State == CourseAppointStateEnum.WaitSure).Any() ? 1 : 2,
item.Key.ShiftSort,
EnrollNum = item.Count(),
......
......@@ -127,6 +127,7 @@ namespace Edu.Module.Course
private readonly RB_Course_WordsRepository course_WordsRepository = new RB_Course_WordsRepository();
private readonly RB_Order_CourseRepository order_CourseRepository = new RB_Order_CourseRepository();
private readonly RB_Order_GuestRepository order_GuestRepository = new RB_Order_GuestRepository();
#region 课程管理
......@@ -454,6 +455,7 @@ namespace Edu.Module.Course
/// <returns></returns>
public List<RB_Course_Chapter_ViewModel> GetChapterListModuleNew(RB_Course_Chapter_ViewModel query)
{
int CourseId = query.CourseId;
if (query.QOrderId > 0)
{
var tempList = order_CourseRepository.GetOrderCourseListRepository(new Model.ViewModel.Sell.RB_Order_Course_ViewModel() { OrderId = query.QOrderId });
......@@ -463,7 +465,42 @@ namespace Edu.Module.Course
query.CourseId = 0;
}
}
var list = chapterRepository.GetChapterListRepository(query);
if (!list.Any())
{
var oldCourseModel = GetCourseModule(CourseId);
if (oldCourseModel != null && (oldCourseModel.CourseRate == Common.Enum.Course.CourseRateEnum.OneCH || oldCourseModel.CourseRate == Common.Enum.Course.CourseRateEnum.OneFor))
{
if (query.QOrderId > 0)
{
var guestModel = order_GuestRepository.GetSingleListRepository(new Model.ViewModel.Sell.RB_Order_Guest_ViewModel() { OrderId = query.QOrderId })?.FirstOrDefault() ?? new Model.ViewModel.Sell.RB_Order_Guest_ViewModel();
if (guestModel != null && guestModel.TotalHours > 0)
{
int totalTimes = 0;
if (guestModel.TotalHours % 2 == 0)
{
totalTimes = (int)guestModel.TotalHours / 2;
}
else {
totalTimes = (int)guestModel.TotalHours / 2 + 1;
}
for (var i = 1; i <= totalTimes; i++)
{
var chapterModel = new RB_Course_Chapter_ViewModel()
{
ChapterId=i,
ChapterNo=i.ToString(),
ChapterGradeNo=i,
ChapterName=string.Format("第{0}次课",i),
CourseRate=oldCourseModel.CourseRate,
};
list.Add(chapterModel);
}
}
}
}
}
return list;
}
......@@ -674,7 +711,15 @@ namespace Edu.Module.Course
Int32.TryParse(x.ChapterNo.Replace(".", ""), out int ChapterNo);
x.SerialNumber = ChapterNo;
});
List<ChapterTree_ViewModel> treeList = GetChapterChild(list, 0);
var courseModel= GetCourseModule(query.CourseId);
if (courseModel != null && courseModel.CourseId > 0 && treeList.Count == 0 && (courseModel.CourseRate == Common.Enum.Course.CourseRateEnum.OneCH || courseModel.CourseRate == Common.Enum.Course.CourseRateEnum.OneFor))
{
var totalTimes = (courseModel?.ChineseHours ?? 0) + (courseModel?.ForeignHours ?? 0);
}
return treeList;
}
......
......@@ -2251,13 +2251,13 @@ namespace Edu.Module.Course
#region 约课调整
/// <summary>
/// 获取可约课的学生列表(包括补课 重)
/// 获取可约课的学生列表(包括补课 重)
/// </summary>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuListModule_V2(string stuName, int NextChapterGradeNo, int CourseGradeId, int SchoolId, int group_Id)
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuListModule_V2(string stuName, int NextChapterGradeNo, int CourseGradeId, int SchoolId, int group_Id,int VipCourseId=0)
{
var list = student_OrderGuestRepository.GetCanAppointmentStuListRepository_V2(stuName, NextChapterGradeNo, CourseGradeId, SchoolId, group_Id);
var list = student_OrderGuestRepository.GetCanAppointmentStuListRepository_V2(stuName, NextChapterGradeNo, CourseGradeId, SchoolId, group_Id, VipCourseId: VipCourseId);
if (list != null && list.Count > 0)
{
List<RB_Order_Course_ViewModel> orderCourseList = new List<RB_Order_Course_ViewModel>();
......@@ -2344,13 +2344,16 @@ namespace Edu.Module.Course
demodel.AccountId = teacherModel?.AccountId ?? 0;
//验证当日老师的数据
var planList = scroll_PlanRepository.GetList(new RB_Scroll_Plan_ViewModel() { Group_Id = demodel.Group_Id, AccountId = demodel.AccountId, STime = Date, ETime = Date });
if (!planList.Any())
{
planList = new List<RB_Scroll_Plan_ViewModel>();
//没有排班就默认通班(HK2024-09-05添加)
planList.Add(new RB_Scroll_Plan_ViewModel() { ShiftId = 9 });
}
var planList = new List<RB_Scroll_Plan_ViewModel>();
planList.Add(new RB_Scroll_Plan_ViewModel() { ShiftId = 9 });
// planList= scroll_PlanRepository.GetList(new RB_Scroll_Plan_ViewModel() { Group_Id = demodel.Group_Id, AccountId = demodel.AccountId, STime = Date, ETime = Date });
//if (!planList.Any())
//{
// planList = new List<RB_Scroll_Plan_ViewModel>();
// //没有排班就默认通班(HK2024-09-05添加)
// planList.Add(new RB_Scroll_Plan_ViewModel() { ShiftId = 9 });
//}
//开始验证 此时段数据是否可以预约
......
......@@ -1003,19 +1003,24 @@ and og.TotalChapterNo > og.CourseChapterNo and (og.CourseChapterNo + 1 + IFNULL(
/// </summary>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuListRepository_V2(string stuName, int NextChapterGradeNo, int CourseGradeId, int SchoolId, int group_Id)
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuListRepository_V2(string stuName, int NextChapterGradeNo, int CourseGradeId, int SchoolId, int group_Id,int VipCourseId=0)
{
List<int> courseIdList = new List<int>();
courseIdList.Add(0);
string chapterSql = string.Format(" SELECT DISTINCT CourseId FROM rb_course_chapter WHERE Status=0 AND CourseRate ={0} ", CourseGradeId);
List<RB_Course_Chapter> chapterList = base.Get<RB_Course_Chapter>(chapterSql).ToList();
if (chapterList != null && chapterList.Count > 0)
{
courseIdList.AddRange(chapterList.Select(qitem => qitem.CourseId).ToList());
}
if (VipCourseId > 0)
{
courseIdList.Add(VipCourseId);
}
DynamicParameters parameters = new DynamicParameters();
string sql = $@"
SELECT sog.Student_Id,sog.GuestId,sog.OrderId,cou.CourseName,s.StuName as GuestName,og.CourseChapterNo,sa.AppointNum,ss.MakeUpNum
,o.CourseId
,o.CourseId,IFNULL(og.TotalHours,0) AS TotalHours,cou.CourseRate
FROM rb_student_orderguest sog
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
......
......@@ -375,6 +375,7 @@ namespace Edu.WebApi.Controllers.Course
qitem.SalePlatArr,
qitem.ClassHours,
qitem.ScrollMinNum,
qitem.CourseRate,
PreferentialList = qitem?.PreferentialList?.Select(sItem => new
{
sItem.Id,
......
......@@ -677,12 +677,12 @@ namespace Edu.WebApi.Controllers.Course
int CourseGradeId = base.ParmJObj.GetInt("CourseGradeId", 0);//上课等级ID
int NextCourseGradeNo = base.ParmJObj.GetInt("NextCourseGradeNo", 0);//上课等级ID对应的课次
int SchoolId = base.ParmJObj.GetInt("SchoolId", -1);//约课校区
if (CourseGradeId <= 0 || NextCourseGradeNo <= 0)
int VipCourseId = base.ParmJObj.GetInt("LearnCourseId");//VIP学员使用
if (VipCourseId == 0 && (CourseGradeId <= 0 || NextCourseGradeNo <= 0))
{
return ApiResult.ParamIsNull();
}
var list = scrollClassModule.GetCanAppointmentStuListModule_V2(StuName, NextCourseGradeNo, CourseGradeId, SchoolId, userInfo.Group_Id);
var list = scrollClassModule.GetCanAppointmentStuListModule_V2(StuName, NextCourseGradeNo, CourseGradeId, SchoolId, userInfo.Group_Id, VipCourseId: VipCourseId);
return ApiResult.Success("", list.Select(x => new
{
StuId = x.Student_Id,
......@@ -696,6 +696,7 @@ namespace Edu.WebApi.Controllers.Course
State = x.AppointNum > 0 ? 3 : 1,
x.CourseId,
x.CourseRate,
TotalTimes = ((x.CourseRate == CourseRateEnum.OneCH || x.CourseRate == CourseRateEnum.OneFor) ? x.TotalHours : 0) / 2
}));
}
......@@ -735,20 +736,25 @@ namespace Edu.WebApi.Controllers.Course
{
JObject sObj = JObject.Parse(JsonHelper.Serialize(item));
var newModel = Common.ConvertHelper.Clone<RB_Scroll_Appointment_ViewModel>(demodel);
newModel.LearnCourseId = sObj.GetInt("CourseId");
newModel.StuId = sObj.GetInt("StuId");
newModel.CourseGradeId = (CourseRateEnum)sObj.GetInt("CourseGradeId");
newModel.GuestId = sObj.GetInt("GuestId");
newModel.LearnCourseId = sObj.GetInt("CourseId");
newModel.CourseGradeId = (CourseRateEnum)sObj.GetInt("CourseGradeId");
newModel.CourseGradeNo = sObj.GetInt("CourseGradeNo");
newModel.CreateTime = DateTime.Now;
newModel.UpdateTime = DateTime.Now;
newModel.Id = sObj.GetInt("AppointmentId");
newModel.StuName = sObj.GetStringValue("StuName");
newModel.IsCalcStuCheck = sObj.GetInt("IsCalcStuCheck");
if (newModel.ChapterNo == 0 && newModel.CourseGradeNo > 0)
{
newModel.ChapterNo = newModel.CourseGradeNo;
}
list.Add(newModel);
}
}
}
if (!list.Any())
{
return ApiResult.ParamIsNull(message: "请选择学员");
......@@ -766,7 +772,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递学生ID");
}
string msg = "";
foreach (var item in 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