Commit 000cd81d authored by 黄奎's avatar 黄奎

新增开班计划接口

parent 832bcd11
...@@ -166,5 +166,10 @@ namespace Edu.Model.ViewModel.Course ...@@ -166,5 +166,10 @@ namespace Edu.Model.ViewModel.Course
/// 报名截止日期结束 /// 报名截止日期结束
/// </summary> /// </summary>
public string JoinEndTime { get; set; } public string JoinEndTime { get; set; }
/// <summary>
/// 课程分类编号
/// </summary>
public int CateId { get; set; }
} }
} }
\ No newline at end of file
...@@ -119,7 +119,8 @@ namespace Edu.Module.Course ...@@ -119,7 +119,8 @@ namespace Edu.Module.Course
public List<RB_Class_ViewModel> GetClassPruductList(int pageIndex, int pageSize, out long count, RB_Class_ViewModel dmodel) public List<RB_Class_ViewModel> GetClassPruductList(int pageIndex, int pageSize, out long count, RB_Class_ViewModel dmodel)
{ {
var list = classRepository.GetClassProductPageList(pageIndex, pageSize, out count, dmodel); var list = classRepository.GetClassProductPageList(pageIndex, pageSize, out count, dmodel);
if (list.Any()) { if (list.Any())
{
string classIds = string.Join(",", list.Select(x => x.ClassId)); string classIds = string.Join(",", list.Select(x => x.ClassId));
//查询阶梯价格 //查询阶梯价格
var stepList = class_StepPriceRepository.GetClassStepPriceListRepository(new RB_Class_StepPrice_ViewModel() { QClassIds = classIds }); var stepList = class_StepPriceRepository.GetClassStepPriceListRepository(new RB_Class_StepPrice_ViewModel() { QClassIds = classIds });
...@@ -146,7 +147,8 @@ namespace Edu.Module.Course ...@@ -146,7 +147,8 @@ namespace Edu.Module.Course
if (!string.IsNullOrEmpty(item.DateJson)) if (!string.IsNullOrEmpty(item.DateJson))
{ {
List<int> DayList = JsonHelper.DeserializeObject<List<int>>(item.DateJson); List<int> DayList = JsonHelper.DeserializeObject<List<int>>(item.DateJson);
foreach (var qitem in DayList) { foreach (var qitem in DayList)
{
item.ClassPlanList.Add(new RB_Class_Plan_ViewModel() item.ClassPlanList.Add(new RB_Class_Plan_ViewModel()
{ {
WeekDay = qitem WeekDay = qitem
......
...@@ -235,13 +235,13 @@ WHERE A.ClassId={0} ...@@ -235,13 +235,13 @@ WHERE A.ClassId={0}
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead,E.SName AS SchoolName,R.RoomName,IFNULL(t.GuestNum,0) as OrderStudentCount SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead,E.SName AS SchoolName,R.RoomName
FROM rb_class AS A ,IFNULL(t.GuestNum,0) AS OrderStudentCount
LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
LEFT JOIN rb_class_room AS R ON A.ClassRoomId=R.RoomId LEFT JOIN rb_class_room AS R ON A.ClassRoomId=R.RoomId
LEFT JOIN rb_school AS E ON A.School_Id=E.SId LEFT JOIN rb_school AS E ON A.School_Id=E.SId
left join (SELECT ClassId, SUM(GuestNum) AS GuestNum FROM rb_order WHERE OrderState in (1,2) GROUP BY ClassId)t on A.ClassId = t.ClassId LEFT JOIN (SELECT ClassId,SUM(GuestNum) AS GuestNum FROM rb_order WHERE OrderState IN (1,2) GROUP BY ClassId)t on A.ClassId = t.ClassId
WHERE 1=1 WHERE 1=1
"); ");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Status), 0); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Status), 0);
...@@ -264,6 +264,11 @@ WHERE 1=1 ...@@ -264,6 +264,11 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.CouseId), query.CouseId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.CouseId), query.CouseId);
} }
//课程分类编号
if (query.CateId > 0)
{
builder.AppendFormat(" AND B.{0}={1} ", nameof(RB_Class_ViewModel.CateId), query.CateId);
}
if (query.Teacher_Id > 0) if (query.Teacher_Id > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Teacher_Id), query.Teacher_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Teacher_Id), query.Teacher_Id);
......
...@@ -59,6 +59,11 @@ namespace Edu.WebApi.Controllers.Web ...@@ -59,6 +59,11 @@ namespace Edu.WebApi.Controllers.Web
/// </summary> /// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>(); private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary>
/// 订单处理类对象
/// </summary>
private readonly OrderModule orderModule = AOP.AOPHelper.CreateAOPObject<OrderModule>();
/// <summary> /// <summary>
/// 获取网站配置 /// 获取网站配置
/// </summary> /// </summary>
...@@ -165,7 +170,7 @@ namespace Edu.WebApi.Controllers.Web ...@@ -165,7 +170,7 @@ namespace Edu.WebApi.Controllers.Web
item.Content, item.Content,
item.Img, item.Img,
CreateByName, CreateByName,
CreateTime=Common.Plugin.StringHelper.DateFormatToString(item.CreateDate) CreateTime = Common.Plugin.StringHelper.DateFormatToString(item.CreateDate)
}); });
} }
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
...@@ -301,6 +306,7 @@ namespace Edu.WebApi.Controllers.Web ...@@ -301,6 +306,7 @@ namespace Edu.WebApi.Controllers.Web
extModel.CoverImg, extModel.CoverImg,
}; };
} }
//获取【教育相关产品】列表
var RandList = courseModule.GetCourseListModule(new RB_Course_ViewModel() var RandList = courseModule.GetCourseListModule(new RB_Course_ViewModel()
{ {
CourseId = CourseId, CourseId = CourseId,
...@@ -316,9 +322,53 @@ namespace Edu.WebApi.Controllers.Web ...@@ -316,9 +322,53 @@ namespace Edu.WebApi.Controllers.Web
return ApiResult.Success(data: result); return ApiResult.Success(data: result);
} }
/// <summary>
/// 官网开班计划
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetClassPruduct()
{
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var dmodel = new RB_Class_ViewModel()
{
ClassName = base.ParmJObj.GetStringValue("ClassName"),
CouseId = base.ParmJObj.GetInt("CouseId"),
StartTime = base.ParmJObj.GetStringValue("StartTime"),
EndTime = base.ParmJObj.GetStringValue("EndTime"),
JoinEndTime = base.ParmJObj.GetStringValue("JoinEndTime"),
JoinStartTime = base.ParmJObj.GetStringValue("JoinStartTime"),
Q_CanApply = base.ParmJObj.GetInt("Q_CanApply"),
Teacher_Id = base.ParmJObj.GetInt("Teacher_Id"),
Group_Id = base.ParmJObj.GetInt("Group_Id"),
CateId=base.ParmJObj.GetInt("CateId"),
};
if (dmodel.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
dmodel.Group_Id = groupId;
}
var list = orderModule.GetClassPruductList(pageModel.PageIndex, pageModel.PageSize, out long count, dmodel);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
{
x.ClassId,
x.ClassName,
x.CourseName,
x.ClassHours,
OpenTime = x.OpenTime.ToString("yyyy年MM月dd日"),
EndOrderTime = x.EndOrderTime.HasValue ? x.EndOrderTime.Value.ToString("yyyy年MM月dd日") : "",
IsCanApply = x.EndOrderTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")) && x.ClassPersion > x.OrderStudentCount ? 1 : 0,
x.ClassPersion,
x.OrderStudentCount,
SurplusNum = x.ClassPersion - x.OrderStudentCount,
x.SchoolName,
});
return ApiResult.Success("", pageModel);
}
#endregion #endregion
} }
} }
\ No newline at end of file
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