Commit 0793c1bb authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 5c0b3d5c 51cfab61
...@@ -88,6 +88,12 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -88,6 +88,12 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary> /// </summary>
public string CourseName { get; set; } public string CourseName { get; set; }
/// <summary>
/// 报名课程名称(缩写) 2024-09-11 add by:W
/// </summary>
public string NewCourseName { get; set; }
/// <summary> /// <summary>
/// 课程等级 /// 课程等级
/// </summary> /// </summary>
......
using Edu.Common.Plugin; using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.Entity.Grade; using Edu.Model.Entity.Grade;
using Edu.Model.Entity.Sell; using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
...@@ -37,6 +38,7 @@ namespace Edu.Module.Course ...@@ -37,6 +38,7 @@ namespace Edu.Module.Course
private RB_Class_RoomRepository class_RoomRepository = new RB_Class_RoomRepository(); private RB_Class_RoomRepository class_RoomRepository = new RB_Class_RoomRepository();
private RB_Scroll_AppointmentRepository appointmentRepository = new RB_Scroll_AppointmentRepository(); private RB_Scroll_AppointmentRepository appointmentRepository = new RB_Scroll_AppointmentRepository();
private RB_Order_CourseRepository order_CourseRepository = new RB_Order_CourseRepository(); private RB_Order_CourseRepository order_CourseRepository = new RB_Order_CourseRepository();
private RB_Course_ChapterRepository course_ChapterRepository = new RB_Course_ChapterRepository();
/// <summary> /// <summary>
/// 排课计划表 /// 排课计划表
...@@ -54,7 +56,7 @@ namespace Edu.Module.Course ...@@ -54,7 +56,7 @@ namespace Edu.Module.Course
string orderIds = string.Join(",", list.Select(qitem => qitem.OrderId)); string orderIds = string.Join(",", list.Select(qitem => qitem.OrderId));
if (!string.IsNullOrEmpty(orderIds)) if (!string.IsNullOrEmpty(orderIds))
{ {
orderCourseList= order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel() { QOrderIds = orderIds }); orderCourseList = order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel() { QOrderIds = orderIds });
} }
foreach (var item in list) foreach (var item in list)
{ {
...@@ -86,22 +88,35 @@ namespace Edu.Module.Course ...@@ -86,22 +88,35 @@ namespace Edu.Module.Course
if (IdList != null && IdList.Count > 0) if (IdList != null && IdList.Count > 0)
{ {
string Ids = string.Join(",", IdList.Distinct()); string Ids = string.Join(",", IdList.Distinct());
empList= accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { QIds = Ids }); empList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { QIds = Ids });
} }
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>(); List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
if(roomIdList!=null && roomIdList.Count > 0) if (roomIdList != null && roomIdList.Count > 0)
{ {
string roomIds = string.Join(",", roomIdList.Distinct()); string roomIds = string.Join(",", roomIdList.Distinct());
if (!string.IsNullOrEmpty(roomIds)) if (!string.IsNullOrEmpty(roomIds))
{ {
roomList= class_RoomRepository.GetClassRoomListExtRepository(roomIds); roomList = class_RoomRepository.GetClassRoomListExtRepository(roomIds);
} }
} }
//获取章节信息
List<RB_Course_Chapter_ViewModel> chapterList = new List<RB_Course_Chapter_ViewModel>();
List<int> courseIdList = new List<int>();
courseIdList.AddRange(list.Select(x => x.CourseId));
if (orderCourseList != null && orderCourseList.Any())
{
courseIdList.AddRange(orderCourseList.Select(x => x.CourseId));
}
if (courseIdList != null && courseIdList.Any())
{
chapterList = course_ChapterRepository.GetMaxMinChapterRepository(string.Join(",", courseIdList.Select(x => x).Distinct()));
}
foreach (var item in list) foreach (var item in list)
{ {
var tempOrderCourse = orderCourseList?.Where(qitem => qitem.OrderId == item.OrderId)?.ToList(); var tempOrderCourse = orderCourseList?.Where(qitem => qitem.OrderId == item.OrderId)?.ToList();
if(tempOrderCourse!=null&& tempOrderCourse.Count > 0) if (tempOrderCourse != null && tempOrderCourse.Count > 0)
{ {
string NewCourseName = string.Join("、", tempOrderCourse.Select(qitem => qitem.CourseName)); string NewCourseName = string.Join("、", tempOrderCourse.Select(qitem => qitem.CourseName));
if (!string.IsNullOrEmpty(NewCourseName)) if (!string.IsNullOrEmpty(NewCourseName))
...@@ -109,6 +124,7 @@ namespace Edu.Module.Course ...@@ -109,6 +124,7 @@ namespace Edu.Module.Course
item.CourseName = NewCourseName; item.CourseName = NewCourseName;
} }
} }
item.NewCourseName = GetNewCourseName(tempOrderCourse, chapterList?.FirstOrDefault(x => x.CourseId == item.CourseId) ?? new RB_Course_Chapter_ViewModel());
if (item.HeadMasterId > 0) if (item.HeadMasterId > 0)
{ {
item.HeadMasterName = empList?.FirstOrDefault(qitem => qitem.Id == item.HeadMasterId)?.AccountName ?? ""; item.HeadMasterName = empList?.FirstOrDefault(qitem => qitem.Id == item.HeadMasterId)?.AccountName ?? "";
...@@ -120,7 +136,7 @@ namespace Edu.Module.Course ...@@ -120,7 +136,7 @@ namespace Edu.Module.Course
if (item.CourseItems != null && item.CourseItems.Count > 0) if (item.CourseItems != null && item.CourseItems.Count > 0)
{ {
foreach(var subItem in item.CourseItems) foreach (var subItem in item.CourseItems)
{ {
subItem.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountName ?? ""; subItem.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountName ?? "";
subItem.TeacherId = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountId ?? 0; subItem.TeacherId = empList?.FirstOrDefault(qitem => qitem.Id == subItem.AccountId)?.AccountId ?? 0;
...@@ -135,13 +151,47 @@ namespace Edu.Module.Course ...@@ -135,13 +151,47 @@ namespace Edu.Module.Course
return list; return list;
} }
/// <summary>
/// 获取课程名称缩写
/// </summary>
/// <param name="orderCourseList"></param>
/// <param name="model"></param>
/// <returns></returns>
public string GetNewCourseName(List<RB_Order_Course_ViewModel> orderCourseList, RB_Course_Chapter_ViewModel model)
{
string name = "";
if (orderCourseList != null && orderCourseList.Any())
{
if (orderCourseList.Count > 1)
{
name = (orderCourseList.FirstOrDefault()?.CourseName ?? "") + "~" + orderCourseList.LastOrDefault()?.CourseName ?? "";
}
else
{
name = orderCourseList.FirstOrDefault()?.CourseName ?? "";
}
}
else if ((model?.CourseId ?? 0) > 0)
{
if (model.MaxLength == (int)model.CourseRate)
{
name = EnumHelper.ToName(model.CourseRate);
}
else
{
name = EnumHelper.ToName(model.CourseRate) + "~" + EnumHelper.ToName((CourseRateEnum)model.MaxLength);
}
}
return name;
}
/// <summary> /// <summary>
/// 修改学员,排课状态 /// 修改学员,排课状态
/// </summary> /// </summary>
/// <param name="GuestId"></param> /// <param name="GuestId"></param>
/// <param name="ScheduleStatus"></param> /// <param name="ScheduleStatus"></param>
/// <returns></returns> /// <returns></returns>
public bool SetGuestScheduleStatusModule(int GuestId, int ScheduleStatus,string ScheduleRemark,DateTime StopDeadline) public bool SetGuestScheduleStatusModule(int GuestId, int ScheduleStatus, string ScheduleRemark, DateTime StopDeadline)
{ {
bool flag = false; bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object> Dictionary<string, object> fileds = new Dictionary<string, object>
...@@ -151,7 +201,7 @@ namespace Edu.Module.Course ...@@ -151,7 +201,7 @@ namespace Edu.Module.Course
}; };
if (ScheduleStatus == 0) if (ScheduleStatus == 0)
{ {
fileds.Add(nameof(RB_Order_Guest_Extend.StopDeadline),null); fileds.Add(nameof(RB_Order_Guest_Extend.StopDeadline), null);
} }
else if (ScheduleStatus == 1) else if (ScheduleStatus == 1)
{ {
...@@ -204,7 +254,7 @@ namespace Edu.Module.Course ...@@ -204,7 +254,7 @@ namespace Edu.Module.Course
public bool CancelGuestCheckModule(int GuestId) public bool CancelGuestCheckModule(int GuestId)
{ {
bool flag = false; bool flag = false;
var list= checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { OrderGuestId = GuestId }); var list = checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { OrderGuestId = GuestId });
return flag; return flag;
} }
...@@ -250,7 +300,7 @@ namespace Edu.Module.Course ...@@ -250,7 +300,7 @@ namespace Edu.Module.Course
{ {
courseList = courseRepository.GetCourseListRepository(new Model.ViewModel.Course.RB_Course_ViewModel() { QCourseIds = courseIds }); courseList = courseRepository.GetCourseListRepository(new Model.ViewModel.Course.RB_Course_ViewModel() { QCourseIds = courseIds });
} }
var checkList= checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { QOrderGuestIds = guestIds, StartDate = minDate, EndDate = maxDate }); var checkList = checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { QOrderGuestIds = guestIds, StartDate = minDate, EndDate = maxDate });
foreach (var item in list) foreach (var item in list)
{ {
item.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == item.AccountId)?.EmployeeName ?? ""; item.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == item.AccountId)?.EmployeeName ?? "";
...@@ -291,17 +341,17 @@ namespace Edu.Module.Course ...@@ -291,17 +341,17 @@ namespace Edu.Module.Course
firstModel.ChapterNo, firstModel.ChapterNo,
ChooseStuList = tempList.Select(qitem => new ChooseStuList = tempList.Select(qitem => new
{ {
CourseId= qitem.LearnCourseId, CourseId = qitem.LearnCourseId,
qitem.AccountId, qitem.AccountId,
qitem.StuId, qitem.StuId,
qitem.CourseGradeId, qitem.CourseGradeId,
qitem.GuestId, qitem.GuestId,
qitem.CourseGradeNo, qitem.CourseGradeNo,
AppointmentId= qitem.Id, AppointmentId = qitem.Id,
qitem.StuName, qitem.StuName,
qitem.IsCalcStuCheck, qitem.IsCalcStuCheck,
qitem.State, qitem.State,
StateName=qitem.State.ToName() StateName = qitem.State.ToName()
}), }),
}; };
} }
......
...@@ -196,6 +196,22 @@ namespace Edu.Repository.Course ...@@ -196,6 +196,22 @@ namespace Edu.Repository.Course
} }
/// <summary>
/// 查询符合的课程章节最大以及最小
/// </summary>
/// <param name="courseIds"></param>
/// <returns></returns>
public List<RB_Course_Chapter_ViewModel> GetMaxMinChapterRepository(string courseIds)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" select max(CourseRate) as MaxLength,min(CourseRate) as CourseRate,CourseId from rb_course_chapter where 1=1");
builder.AppendFormat(" AND {0}={1}", nameof(RB_Course_Chapter_ViewModel.Status), EnumHelper.ToInt(DateStateEnum.Normal));
builder.AppendFormat(" AND {0} in({1})", nameof(RB_Course_Chapter_ViewModel.CourseId), courseIds);
builder.AppendFormat(" GROUP BY CourseId ");
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary> /// <summary>
/// 查询符合的课程章节 /// 查询符合的课程章节
/// </summary> /// </summary>
......
...@@ -57,6 +57,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -57,6 +57,7 @@ namespace Edu.WebApi.Controllers.Course
jobj.Add("GuestName", item.GuestName); jobj.Add("GuestName", item.GuestName);
jobj.Add("GuestState", (int)item.GuestState); jobj.Add("GuestState", (int)item.GuestState);
jobj.Add("CourseName", item.CourseName); jobj.Add("CourseName", item.CourseName);
jobj.Add("NewCourseName", item.NewCourseName);
jobj.Add("CourseRate", (int)item.CourseRate); jobj.Add("CourseRate", (int)item.CourseRate);
jobj.Add("GuestStateName", item.GuestState.ToName()); jobj.Add("GuestStateName", item.GuestState.ToName());
jobj.Add("HeadMasterId", item.HeadMasterId); jobj.Add("HeadMasterId", item.HeadMasterId);
......
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