Commit 1cd7d4e5 authored by 黄奎's avatar 黄奎

排课调整

parent be759252
......@@ -1020,5 +1020,19 @@ namespace Edu.Common
return list;
}
}
/// <summary>
/// 学员约课百分比达到指定比例才显示下一等级的课程
/// 比如(N5约课到80%,才显示N4的课程)
/// </summary>
public static decimal ScrollAppointPercent
{
get
{
decimal.TryParse(ReadConfigKey("ScrollAppointPercent"), out decimal ScrollAppointPercent);
return ScrollAppointPercent;
}
}
}
}
\ No newline at end of file
using System;
using Edu.Common.Enum.Course;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Course
......@@ -58,6 +59,11 @@ namespace Edu.Model.ViewModel.Course
/// 根据订单查询课程
/// </summary>
public int QOrderId { get; set; }
/// <summary>
/// 最大课程等级
/// </summary>
public CourseRateEnum MaxCourseRate {get;set;}
}
[Serializable]
......
......@@ -84,5 +84,6 @@ namespace Edu.Model.ViewModel.Sell
/// 订单学员编号
/// </summary>
public int Student_Id { get; set; }
}
}
\ No newline at end of file
......@@ -4233,12 +4233,14 @@ namespace Edu.Module.Course
}
}
}
var tempChatper = chatperList?.Where(qitem => qitem.CourseId == item.Key.CourseId && qitem.ChapterNo == item.Key.ChapterNo.ToString())?.FirstOrDefault();
string ChapterName = "";
int CourseGradeId = 0;
if (tempChatper != null)
{
CourseGradeId = tempChatper.CourseRate.ToInt();
ChapterName = tempChatper?.ChapterName ?? "";
}
subList.Add(new
{
......@@ -4253,6 +4255,7 @@ namespace Edu.Module.Course
item.Key.TeacherName,
CourseGradeId,
item.Key.ChapterNo,
ChapterName,
CourseGradeName = subAppointList.FirstOrDefault().CourseGradeId.ToName(),
Ranks = item.Key.ChapterNo,
TotalPlanNum = subAppointList.FirstOrDefault().TotalChapterNo,
......
......@@ -60,19 +60,22 @@ namespace Edu.Module.Course
{
StartTime = "09:30",
EndTime = "11:00",
Sort = 1
Sort = 1,
ClassHours=2,
});
timeList.Add(new CourseTimeModel()
{
StartTime = "11:10",
EndTime = "12:40",
Sort = 2
Sort = 2,
ClassHours = 2,
});
timeList.Add(new CourseTimeModel()
{
StartTime = "13:30",
EndTime = "15:00",
Sort = 3
Sort = 3,
ClassHours = 2,
});
timeList.Add(new CourseTimeModel()
{
......@@ -84,13 +87,15 @@ namespace Edu.Module.Course
{
StartTime = "16:50",
EndTime = "18:20",
Sort = 5
Sort = 5,
ClassHours = 2,
});
timeList.Add(new CourseTimeModel()
{
StartTime = "19:00",
EndTime = "20:30",
Sort = 6
Sort = 6,
ClassHours = 2,
});
}
return timeList;
......
......@@ -13,6 +13,8 @@ using Edu.Repository.Grade;
using Edu.Repository.Scroll;
using Edu.Repository.Sell;
using Edu.Repository.User;
using Microsoft.AspNetCore.SignalR.Protocol;
using NPOI.XSSF.UserModel;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Generic;
......@@ -47,12 +49,27 @@ namespace Edu.Module.Course
/// <returns></returns>
public List<SchedulePlanResult> GetScheduleCourseStuListModule(ScheduleQuery query)
{
List<SchedulePlanResult> dataList = new List<SchedulePlanResult>();
var list = scheduleCourseRepository.GetScheduleCourseStuListRepository(query);
if (list != null && list.Count > 0)
{
//学员所有约课
List<RB_Scroll_Appointment_ViewModel> appointmentList = new List<RB_Scroll_Appointment_ViewModel>();
//订单课程关联列表
List<RB_Order_Course_ViewModel> orderCourseList = new List<RB_Order_Course_ViewModel>();
//员工列表
List<RB_Account_ViewModel> empList = new List<RB_Account_ViewModel>();
//教室列表
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
string guestIds = string.Join(",", list.Select(qitem => qitem.GuestId).Distinct());
if (!string.IsNullOrEmpty(guestIds))
{
appointmentList=appointmentRepository.GetStuScrollAppointmentAllRepository(guestIds);
}
List<int> IdList = new List<int>();
List<int> roomIdList = new List<int>();
List<RB_Order_Course_ViewModel> orderCourseList = new List<RB_Order_Course_ViewModel>();
string orderIds = string.Join(",", list.Select(qitem => qitem.OrderId));
if (!string.IsNullOrEmpty(orderIds))
{
......@@ -84,13 +101,13 @@ namespace Edu.Module.Course
{
IdList.AddRange(tempEnterId);
}
List<RB_Account_ViewModel> empList = new List<RB_Account_ViewModel>();
if (IdList != null && IdList.Count > 0)
{
string Ids = string.Join(",", IdList.Distinct());
empList = accountRepository.GetAccountListExtRepository(new Model.ViewModel.User.RB_Account_ViewModel() { QIds = Ids });
}
List<RB_Class_Room_ViewModel> roomList = new List<RB_Class_Room_ViewModel>();
if (roomIdList != null && roomIdList.Count > 0)
{
string roomIds = string.Join(",", roomIdList.Distinct());
......@@ -101,7 +118,6 @@ namespace Edu.Module.Course
}
//获取章节信息
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));
......@@ -115,16 +131,37 @@ namespace Edu.Module.Course
}
foreach (var item in list)
{
if (item.GuestName == "测试甲")
{
string str = "";
}
List<int> tempCourseIdList = new List<int>();
tempCourseIdList.Add(item.CourseId);
var tempOrderCourse = orderCourseList?.Where(qitem => qitem.OrderId == item.OrderId)?.ToList();
if (tempOrderCourse != null && tempOrderCourse.Count > 0)
{
string NewCourseName = string.Join("、", tempOrderCourse.Select(qitem => qitem.CourseName));
var orderCourseIdList = tempOrderCourse.Select(qitem => qitem.CourseId).ToList();
if (orderCourseIdList != null && orderCourseIdList.Count > 0)
{
tempCourseIdList.AddRange(orderCourseIdList);
}
if (!string.IsNullOrEmpty(NewCourseName))
{
item.CourseName = NewCourseName;
}
}
item.NewCourseName = GetNewCourseName(tempOrderCourse, chapterList?.FirstOrDefault(x => x.CourseId == item.CourseId) ?? new RB_Course_Chapter_ViewModel());
//获取课程所有章节等级
var tempChapterList = chapterList?.Where(qitem => tempCourseIdList.Any(sItem => sItem == qitem.CourseId))?.ToList()??new List<RB_Course_Chapter_ViewModel> ();
var tempChapter = new RB_Course_Chapter_ViewModel() { CourseId = tempCourseIdList.FirstOrDefault() };
if (tempChapterList != null && tempChapterList.Count > 0)
{
tempChapter.MaxCourseRate = tempChapterList.Max(qitem => qitem.CourseRate);
tempChapter.CourseRate = tempChapterList.Min(qitem => qitem.CourseRate);
}
item.NewCourseName = GetNewCourseName(tempOrderCourse, tempChapter);
if (item.HeadMasterId > 0)
{
item.HeadMasterName = empList?.FirstOrDefault(qitem => qitem.Id == item.HeadMasterId)?.AccountName ?? "";
......@@ -133,7 +170,6 @@ namespace Edu.Module.Course
{
item.EnterName = empList?.FirstOrDefault(qitem => qitem.Id == item.EnterID)?.AccountName ?? "";
}
if (item.CourseItems != null && item.CourseItems.Count > 0)
{
foreach (var subItem in item.CourseItems)
......@@ -146,9 +182,50 @@ namespace Edu.Module.Course
}
}
}
#region 判断前面课程等级是否约满
//判断N5是否约完
//if (query.QCourseRate == CourseRateEnum.N4)
//{
// bool isHaveN5Course = false;
// if (tempChapterList != null && tempChapterList.Count > 0)
// {
// isHaveN5Course=(tempChapterList?.Where(qitem => qitem.CourseRate == CourseRateEnum.N5)?.Count() ?? 0) > 0;
// }
// //判断学员是否报了N5的课程
// if (isHaveN5Course)
// {
// //判断学员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)
// {
// dataList.Add(item);
// }
// }
// else
// {
// dataList.Add(item);
// }
//}
//else
//{
// dataList.Add(item);
//}
dataList.Add(item);
#endregion
}
}
return list;
return dataList;
}
/// <summary>
......@@ -173,13 +250,13 @@ namespace Edu.Module.Course
}
else if ((model?.CourseId ?? 0) > 0)
{
if (model.MaxLength == (int)model.CourseRate)
if (model.MaxCourseRate == model.CourseRate)
{
name = EnumHelper.ToName(model.CourseRate);
}
else
{
name = EnumHelper.ToName(model.CourseRate) + "~" + EnumHelper.ToName((CourseRateEnum)model.MaxLength);
name = EnumHelper.ToName(model.CourseRate) + "~" + EnumHelper.ToName(model.MaxCourseRate);
}
}
return name.Replace("课程","");
......
......@@ -2496,7 +2496,7 @@ namespace Edu.Module.Course
//验证都OK了 插入预约数据
if (demodel.Id <= 0)
{
var notFinishList = scroll_AppointmentRepository.GetStuScrollAppointmentNotFinishRepository(demodel.GuestId);
var notFinishList = scroll_AppointmentRepository.GetStuScrollAppointmentNotFinishRepository(demodel.GuestId.ToString());
decimal notFinishHours = 0;
if (notFinishList != null && notFinishList.Count > 0)
{
......
......@@ -205,10 +205,9 @@ namespace Edu.Repository.Course
{
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(@" SELECT CourseRate,CourseId FROM rb_course_chapter WHERE 1=1");
builder.AppendFormat(" AND {0} in({1})", nameof(RB_Course_Chapter_ViewModel.CourseId), courseIds);
builder.AppendFormat(" GROUP BY CourseId ");
builder.AppendFormat(" GROUP BY CourseId,CourseRate ");
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
......
......@@ -94,9 +94,9 @@ ORDER BY r.Id asc ";
/// <summary>
/// 查询学员 已预约,且为上课 次数,用于计算是否约满课程
/// </summary>
/// <param name="GuestId"></param>
/// <param name="GuestIds"></param>
/// <returns></returns>
public List<RB_Scroll_Appointment_ViewModel> GetStuScrollAppointmentNotFinishRepository(int GuestId)
public List<RB_Scroll_Appointment_ViewModel> GetStuScrollAppointmentNotFinishRepository(string GuestIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
......@@ -104,7 +104,24 @@ SELECT r.*
FROM RB_Scroll_Appointment r
WHERE 1=1 AND r.Status=0 AND Date>='{0}' AND r.State IN(1,2,6)
", Common.ConvertHelper.FormatDate(DateTime.Now));
builder.AppendFormat(" AND r.GuestId IN({0}) ", GuestId);
builder.AppendFormat(" AND r.GuestId IN({0}) ", GuestIds);
return Get<RB_Scroll_Appointment_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 查询学员的所有约课
/// </summary>
/// <param name="GuestIds"></param>
/// <returns></returns>
public List<RB_Scroll_Appointment_ViewModel> GetStuScrollAppointmentAllRepository(string GuestIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT r.*
FROM RB_Scroll_Appointment r
WHERE 1=1 AND r.Status=0 AND r.State IN(1,2,6)
");
builder.AppendFormat(" AND r.GuestId IN({0}) ", GuestIds);
return Get<RB_Scroll_Appointment_ViewModel>(builder.ToString()).ToList();
}
......
......@@ -26,7 +26,7 @@
"IsSendMsg": 2,
"AllowedHosts": "*",
"OpenValidation": "False",
"UploadSiteUrl": "http://192.168.5.128:8120",
"UploadSiteUrl": "http://192.168.5.46:8120",
"ViewFileSiteUrl": "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com",
"ErpViewFileSiteUrl": "http://imgfile.oytour.com",
"ErpUrl": "http://localhost:8181",
......@@ -34,7 +34,7 @@
"WorkAPPDomain": "http://m.kookaku.com/pages",
"Mongo": "mongodb://47.96.23.199:27017",
"MongoDBName": "Edu",
"WkHtmlToPdfPath": "D:/wkhtmltopdf/bin/",
"WkHtmlToPdfPath": "D:/Tools/wkhtmltopdf/bin/",
"FinanceKey": "FinanceMallInsertToERPViitto2020",
"PaymentFinanceApi": "http://192.168.10.46/api/Mall/InsertFinanceBatchForMallOut",
"IncomeFinanceApi": "http://192.168.5.214/api/Mall/InsertFinanceBatchForMallIn",
......@@ -133,5 +133,7 @@
//1-下载Chrome,0-不下载Chrome
"IsDownLoadChrome": "1",
//需要清0的订单编号
"FinishOrderIds": "1229,1191,1219,1366,1371,1399,1173,1238,1264,1380,1066"
"FinishOrderIds": "1229,1191,1219,1366,1371,1399,1173,1238,1264,1380,1066",
//判断学员约了比例
"ScrollAppointPercent": 0.01
}
\ 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