Commit 9f6db887 authored by 黄奎's avatar 黄奎

新增约课设置

parent 306873b5
......@@ -334,12 +334,35 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public string OrderCourseIds { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 学员报名所有课程等级
/// </summary>
public List<ShowRateItem> AllReteList { get; set; }
public string
/// <summary>
/// 学员排课配置Id
/// </summary>
public int PlanShowId { get; set; }
/// <summary>
/// 设置学员显示课程等级
/// </summary>
public string ShowRetes { get; set; }
/// <summary>
/// 显示课程等级名称
/// </summary>
public string ShowRateName { get; set; }
/// <summary>
/// 显示课程等级
/// </summary>
public List<int> ShowReteList { get; set; }
}
/// <summary>
......
......@@ -60,7 +60,7 @@ namespace Edu.Module.Course
List<RB_Order_Course_ViewModel> orderCourseList = new List<RB_Order_Course_ViewModel>();
//员工列表
List<RB_Account_ViewModel> empList = new List<RB_Account_ViewModel>();
List<RB_Scroll_PlanShow_ViewModel> stuPlanShowList = new List<RB_Scroll_PlanShow_ViewModel>();
//教室列表
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
string guestIds = string.Join(",", list.Select(qitem => qitem.GuestId).Distinct());
......@@ -75,6 +75,7 @@ namespace Edu.Module.Course
if (!string.IsNullOrEmpty(orderIds))
{
orderCourseList = order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel() { QOrderIds = orderIds });
stuPlanShowList= scroll_PlanShowRepository.GetScrollPlanShowListRepository(new RB_Scroll_PlanShow_ViewModel() { QOrderIds = orderIds, QGuestIds = guestIds });
}
foreach (var item in list)
{
......@@ -182,30 +183,14 @@ namespace Edu.Module.Course
}
#region 判断前面课程等级是否约满
//判断N5是否约完
//if (query.QCourseRate == CourseRateEnum.N4)
#region 判断是否显示当前约课等级
//var tempPlanShow = stuPlanShowList?.FirstOrDefault(qitem => qitem.OrderId == item.OrderId);
//if (tempPlanShow != null && tempPlanShow.Id > 0)
//{
// bool isHaveN5Course = false;
// if (tempChapterList != null && tempChapterList.Count > 0)
// {
// isHaveN5Course=(tempChapterList?.Where(qitem => qitem.CourseRate == CourseRateEnum.N5)?.Count() ?? 0) > 0;
// }
// //判断学员是否报了N5的课程
// if (isHaveN5Course)
// var tempPlanShowRateList = Common.Plugin.StringHelper.StringToListInt((tempPlanShow?.ShowRetes ?? ""));
// if (tempPlanShowRateList != null && tempPlanShowRateList.Count > 0)
// {
// //判断学员N5课程预约情况是否大于配置比例
// var percent = Common.Config.ScrollAppointPercent;
// decimal n5FinishHours = 0;
// decimal n5TotalHours = 42;
// var tempN5AppointList = appointmentList?.Where(qitem => qitem.GuestId == item.GuestId && qitem.CourseGradeId == CourseRateEnum.N5)?.ToList();
// if (tempN5AppointList != null && tempN5AppointList.Count > 0)
// {
// n5FinishHours = tempN5AppointList.Count * 2;
// }
// if (n5FinishHours / n5TotalHours >= percent)
// if (tempPlanShowRateList.Any(x => x == query.QCourseRate.ToInt()))
// {
// dataList.Add(item);
// }
......@@ -230,14 +215,86 @@ namespace Edu.Module.Course
/// <summary>
/// 查询学员排课设置结果
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<ScrollPlanShowResult> GetStuPlanShowListModule(ScrollPlanShowQuery query)
public List<ScrollPlanShowResult> GetStuPlanShowPageModule(int pageIndex,int pageSize,out long rowsCount, ScrollPlanShowQuery query)
{
var list = scheduleCourseRepository.GetStuPlanShowListRepository(query);
var list = scheduleCourseRepository.GetStuPlanShowPageRepository(pageIndex,pageSize,out rowsCount, query);
if (list != null && list.Count > 0)
{
{
List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>();
List<RB_Course_Chapter_ViewModel> chapterRateList = new List<RB_Course_Chapter_ViewModel>();
List<int> courseIdList = new List<int>();
foreach(var item in list)
{
courseIdList.Add(item.CourseId);
var tempCourseIdList = Common.ConvertHelper.StringToList(item.OrderCourseIds);
if(tempCourseIdList!=null && tempCourseIdList.Count>0)
{
courseIdList.AddRange(tempCourseIdList);
}
}
if (courseIdList != null && courseIdList.Count > 0)
{
string QCourseIds = string.Join(",", courseIdList.Distinct());
courseList = courseRepository.GetCourseListRepository(new RB_Course_ViewModel() { QCourseIds = QCourseIds });
chapterRateList= course_ChapterRepository.GetMaxMinChapterRepository(QCourseIds);
}
foreach (var item in list)
{
item.AllReteList = new List<ShowRateItem>();
var tempCourseIdList = Common.ConvertHelper.StringToList(item.OrderCourseIds);
if (tempCourseIdList != null && tempCourseIdList.Count > 0)
{
string tempName = "";
foreach (var sItem in tempCourseIdList)
{
tempName += "、" + courseList?.FirstOrDefault(qitem => qitem.CourseId == sItem)?.CourseName ?? "";
var tempChapterList = chapterRateList?.Where(qitem => qitem.CourseId == sItem)?.OrderBy(qitem => qitem.CourseRate)?.ToList();
foreach (var rItem in tempChapterList)
{
var rateItem = new ShowRateItem()
{
RateId = rItem.CourseRate.ToInt(),
RateName = rItem.CourseRate.ToName().Replace("课程",""),
};
if (!item.AllReteList.Contains(rateItem))
{
item.AllReteList.Add(rateItem);
}
}
}
item.CourseName = tempName.TrimStart('、');
}
else
{
item.CourseName = courseList?.FirstOrDefault(qitem => qitem.CourseId == item.CourseId)?.CourseName ?? "";
var tempChapterList = chapterRateList?.Where(qitem => qitem.CourseId == item.CourseId)?.OrderBy(qitem=>qitem.CourseRate)?.ToList();
foreach (var rItem in tempChapterList)
{
item.AllReteList.Add(new ShowRateItem()
{
RateId = rItem.CourseRate.ToInt(),
RateName = rItem.CourseRate.ToName().Replace("课程",""),
});
}
}
item.ShowRateName = "";
item.ShowReteList = Common.ConvertHelper.StringToList(item.ShowRetes);
if (item.ShowReteList != null && item.ShowReteList.Count > 0)
{
string tempRateName = "";
foreach (var sItem in item.ShowReteList)
{
tempRateName += "、" + item?.AllReteList?.FirstOrDefault(qitem => qitem.RateId == sItem)?.RateName ?? "";
}
item.ShowRateName = tempRateName.TrimStart('、');
}
}
}
return list;
}
......
......@@ -159,20 +159,23 @@ WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
/// <summary>
/// 查询学员排课设置结果
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<ScrollPlanShowResult> GetStuPlanShowListRepository(ScrollPlanShowQuery query)
public List<ScrollPlanShowResult> GetStuPlanShowPageRepository(int pageIndex,int pageSize,out long rowsCount, ScrollPlanShowQuery query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT s.StuName,sog.Student_Id AS StuId,sog.OrderId,sog.GuestId,o.CourseId,IFNULL(oc.OrderCourseIds,'') AS OrderCourseIds,IFNULL(sps.ShowRetes,'') AS ShowRetes
SELECT s.StuName,sog.Student_Id AS StuId,sog.OrderId,sog.GuestId,o.CourseId,IFNULL(oc.OrderCourseIds,'') AS OrderCourseIds,IFNULL(sps.ShowRetes,'') AS ShowRetes,IFNULL(sps.Id,0) AS PlanShowId
FROM rb_student_orderguest AS sog LEFT JOIN rb_order_guest AS og ON sog.GuestId=og.Id
LEFT JOIN rb_order AS O ON sog.OrderId=o.OrderId
LEFT JOIN rb_student AS s ON sog.Student_Id=s.StuId
LEFT JOIN (SELECT OrderId,GROUP_CONCAT(CourseId) AS OrderCourseIds FROM rb_order_course GROUP BY OrderId) AS oc ON sog.OrderId=oc.OrderId
LEFT JOIN rb_class AS E ON O.ClassId=E.ClassId
LEFT JOIN rb_scroll_planshow AS sps ON sog.Student_Id=sps.StuId AND sog.GuestId=sps.OrderId AND sog.GuestId=sps.GuestId and sps.Status=0
LEFT JOIN rb_scroll_planshow AS sps ON sog.Student_Id=sps.StuId AND sog.OrderId=sps.OrderId AND sog.GuestId=sps.GuestId and sps.Status=0
WHERE 1=1 AND O.OrderState=1 AND O.OrderType=1 AND E.ClassScrollType=2
");
if (query != null)
......@@ -183,7 +186,8 @@ WHERE 1=1 AND O.OrderState=1 AND O.OrderType=1 AND E.ClassScrollType=2
parameters.Add("StuName", "%" + query.StuName.Trim() + "%");
}
}
var list = Get<ScrollPlanShowResult>(builder.ToString(), parameters).ToList();
builder.AppendFormat(" ORDER BY sog.OrderId DESC ");
var list = GetPage<ScrollPlanShowResult>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
return list;
}
}
......
......@@ -6,6 +6,7 @@ using Edu.Module.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Generic;
......@@ -121,14 +122,22 @@ namespace Edu.WebApi.Controllers.Course
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStuPlanShow()
public ApiResult GetStuPlanShowPage()
{
var pageModel = new ResultPageModel()
{
PageIndex=base.ParmJObj.GetInt("PageIndex"),
PageSize=base.ParmJObj.GetInt("PageSize"),
};
var query = new ScrollPlanShowQuery()
{
StuName=base.ParmJObj.GetStringValue("StuName"),
};
var list = scheduleCourse.GetStuPlanShowListModule(query);
return ApiResult.Success(data: list);
var list = scheduleCourse.GetStuPlanShowPageModule(pageModel.PageIndex,pageModel.PageSize,out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
......@@ -282,9 +291,15 @@ namespace Edu.WebApi.Controllers.Course
{
StuId=base.ParmJObj.GetInt("StuId"),
GuestId=base.ParmJObj.GetInt("GuestId"),
OrderId=base.ParmJObj.GetInt("OrderId"),
ShowRetes=base.ParmJObj.GetStringValue("ShowRetes"),
OrderId=base.ParmJObj.GetInt("OrderId"),
};
var showReteListStr = base.ParmJObj.GetStringValue("ShowReteList");
List<int> rateList = new List<int>();
if (!string.IsNullOrEmpty(showReteListStr))
{
rateList = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(showReteListStr);
}
model.ShowRetes = string.Join(",", rateList);
model.Status = Common.Enum.DateStateEnum.Normal;
model.CreateBy = userInfo.Id;
model.CreateTime = DateTime.Now;
......
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