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

课消统计

parent 32901033
using Edu.Common.Enum.Course;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Query
{
/// <summary>
/// 学员课消统计查询条件
/// </summary>
public class StuCourseQuery
{
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// rb_account表Id(老师编号)
/// </summary>
public int TeacherAccountId { get; set; }
/// <summary>
/// 课程编号
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 对应专业
/// </summary>
public CourseRateEnum CourseRate { get; set; }
}
}
...@@ -12,6 +12,11 @@ namespace Edu.Model.ViewModel.User ...@@ -12,6 +12,11 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public class RB_Student_OrderGuest_ViewModel: RB_Student_OrderGuest public class RB_Student_OrderGuest_ViewModel: RB_Student_OrderGuest
{ {
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary> /// <summary>
/// 学员表编号【查询使用】 /// 学员表编号【查询使用】
/// </summary> /// </summary>
...@@ -158,5 +163,15 @@ namespace Edu.Model.ViewModel.User ...@@ -158,5 +163,15 @@ namespace Edu.Model.ViewModel.User
/// 订单号,学员名称、微信、电话 /// 订单号,学员名称、微信、电话
/// </summary> /// </summary>
public string KeyWords { get; set; } public string KeyWords { get; set; }
/// <summary>
/// 老师编号
/// </summary>
public int AssistId { get; set; }
/// <summary>
/// 对应专业
/// </summary>
public CourseRateEnum CourseRate { get; set; }
} }
} }
...@@ -6,10 +6,12 @@ using Edu.Model.CacheModel; ...@@ -6,10 +6,12 @@ using Edu.Model.CacheModel;
using Edu.Model.Entity.Grade; using Edu.Model.Entity.Grade;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Grade; using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Query;
using Edu.Model.ViewModel.Scroll; using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell; using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.Course; using Edu.Repository.Course;
using Edu.Repository.Customer;
using Edu.Repository.Grade; using Edu.Repository.Grade;
using Edu.Repository.Reserve; using Edu.Repository.Reserve;
using Edu.Repository.Scroll; using Edu.Repository.Scroll;
...@@ -85,6 +87,12 @@ namespace Edu.Module.Course ...@@ -85,6 +87,12 @@ namespace Edu.Module.Course
/// 学生 /// 学生
/// </summary> /// </summary>
private readonly RB_StudentRepository studentRepository = new RB_StudentRepository(); private readonly RB_StudentRepository studentRepository = new RB_StudentRepository();
/// <summary>
/// 学员协助人员信息
/// </summary>
private readonly RB_Student_AssistRepository student_AssistRepository = new RB_Student_AssistRepository();
/// <summary> /// <summary>
/// 正常上课计划 /// 正常上课计划
/// </summary> /// </summary>
...@@ -128,7 +136,8 @@ namespace Edu.Module.Course ...@@ -128,7 +136,8 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
/// <param name="dmodel"></param> /// <param name="dmodel"></param>
/// <returns></returns> /// <returns></returns>
public string SetScrollShift(RB_Scroll_Shift_ViewModel dmodel) { public string SetScrollShift(RB_Scroll_Shift_ViewModel dmodel)
{
if (dmodel.Id > 0) if (dmodel.Id > 0)
{ {
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
...@@ -149,7 +158,8 @@ namespace Edu.Module.Course ...@@ -149,7 +158,8 @@ namespace Edu.Module.Course
bool flag = scroll_ShiftRepository.Update(keyValues, wheres); bool flag = scroll_ShiftRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
bool flag = scroll_ShiftRepository.Insert(dmodel) > 0; bool flag = scroll_ShiftRepository.Insert(dmodel) > 0;
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
...@@ -161,7 +171,8 @@ namespace Edu.Module.Course ...@@ -161,7 +171,8 @@ namespace Edu.Module.Course
/// <param name="ShiftId"></param> /// <param name="ShiftId"></param>
/// <param name="userInfo"></param> /// <param name="userInfo"></param>
/// <returns></returns> /// <returns></returns>
public string DelScrollShift(int ShiftId, UserInfo userInfo) { public string DelScrollShift(int ShiftId, UserInfo userInfo)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Scroll_Shift_ViewModel.Status), 1}, { nameof(RB_Scroll_Shift_ViewModel.Status), 1},
{ nameof(RB_Scroll_Shift_ViewModel.UpdateBy), userInfo.Id}, { nameof(RB_Scroll_Shift_ViewModel.UpdateBy), userInfo.Id},
...@@ -194,7 +205,8 @@ namespace Edu.Module.Course ...@@ -194,7 +205,8 @@ namespace Edu.Module.Course
var teacherList = accountRepository.GetAccountListExtRepository(new RB_Account_ViewModel() { Group_Id = demodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Teacher, IsSelectLevelNor = 1 }); var teacherList = accountRepository.GetAccountListExtRepository(new RB_Account_ViewModel() { Group_Id = demodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Teacher, IsSelectLevelNor = 1 });
teacherList = teacherList.Where(x => x.IsShow == 1).ToList(); teacherList = teacherList.Where(x => x.IsShow == 1).ToList();
var list = scroll_PlanRepository.GetList(demodel); var list = scroll_PlanRepository.GetList(demodel);
if (list.Any() || teacherList.Any()) { if (list.Any() || teacherList.Any())
{
//查询班次 //查询班次
var shiftList = scroll_ShiftRepository.GetList(new RB_Scroll_Shift_ViewModel() { Group_Id = demodel.Group_Id }); var shiftList = scroll_ShiftRepository.GetList(new RB_Scroll_Shift_ViewModel() { Group_Id = demodel.Group_Id });
//查询教室 //查询教室
...@@ -205,9 +217,11 @@ namespace Edu.Module.Course ...@@ -205,9 +217,11 @@ namespace Edu.Module.Course
List<DateTime> DateList = new List<DateTime>(); List<DateTime> DateList = new List<DateTime>();
DateTime StartDate = Convert.ToDateTime(demodel.STime); DateTime StartDate = Convert.ToDateTime(demodel.STime);
DateTime EndDate = Convert.ToDateTime(demodel.ETime); DateTime EndDate = Convert.ToDateTime(demodel.ETime);
while (true) { while (true)
{
DateList.Add(StartDate); DateList.Add(StartDate);
if (StartDate == EndDate) { if (StartDate == EndDate)
{
break; break;
} }
StartDate = StartDate.AddDays(1); StartDate = StartDate.AddDays(1);
...@@ -216,9 +230,11 @@ namespace Edu.Module.Course ...@@ -216,9 +230,11 @@ namespace Edu.Module.Course
#endregion #endregion
#region 老师 #region 老师
foreach (var item in teacherList) { foreach (var item in teacherList)
{
List<object> RDateList = new List<object>(); List<object> RDateList = new List<object>();
foreach (var qitem in DateList) { foreach (var qitem in DateList)
{
var planModel = list.Where(x => x.AccountId == item.Id && x.Date == qitem).FirstOrDefault(); var planModel = list.Where(x => x.AccountId == item.Id && x.Date == qitem).FirstOrDefault();
if (planModel != null) if (planModel != null)
{ {
...@@ -237,7 +253,8 @@ namespace Edu.Module.Course ...@@ -237,7 +253,8 @@ namespace Edu.Module.Course
Color = shiftModel?.Color ?? "", Color = shiftModel?.Color ?? "",
}); });
} }
else { else
{
//未设定 //未设定
RDateList.Add(new RDateList.Add(new
{ {
...@@ -263,7 +280,8 @@ namespace Edu.Module.Course ...@@ -263,7 +280,8 @@ namespace Edu.Module.Course
#endregion #endregion
#region 班次 #region 班次
foreach (var item in shiftList) { foreach (var item in shiftList)
{
List<object> RDateList = new List<object>(); List<object> RDateList = new List<object>();
foreach (var qitem in DateList) foreach (var qitem in DateList)
{ {
...@@ -302,7 +320,8 @@ namespace Edu.Module.Course ...@@ -302,7 +320,8 @@ namespace Edu.Module.Course
}); });
#endregion #endregion
} }
return new { return new
{
TeacherList = RList, TeacherList = RList,
ShiftList = RList2 ShiftList = RList2
}; };
...@@ -335,7 +354,8 @@ namespace Edu.Module.Course ...@@ -335,7 +354,8 @@ namespace Edu.Module.Course
bool flag = scroll_PlanRepository.Update(keyValues, wheres); bool flag = scroll_PlanRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
else { else
{
bool flag = scroll_PlanRepository.Insert(demodel) > 0; bool flag = scroll_PlanRepository.Insert(demodel) > 0;
return flag ? "" : "出错了,请联系管理员"; return flag ? "" : "出错了,请联系管理员";
} }
...@@ -353,7 +373,8 @@ namespace Edu.Module.Course ...@@ -353,7 +373,8 @@ namespace Edu.Module.Course
public List<RB_Scroll_CourseTime_ViewModel> GetScrollCourseTimeList(int group_Id) public List<RB_Scroll_CourseTime_ViewModel> GetScrollCourseTimeList(int group_Id)
{ {
var list = scroll_CourseTimeRepository.GetList(new RB_Scroll_CourseTime_ViewModel() { Group_Id = group_Id }); var list = scroll_CourseTimeRepository.GetList(new RB_Scroll_CourseTime_ViewModel() { Group_Id = group_Id });
foreach (var item in list) { foreach (var item in list)
{
item.TimeList = new List<CourseTimeModel>(); item.TimeList = new List<CourseTimeModel>();
if (!string.IsNullOrEmpty(item.Content)) if (!string.IsNullOrEmpty(item.Content))
{ {
...@@ -435,7 +456,8 @@ namespace Edu.Module.Course ...@@ -435,7 +456,8 @@ namespace Edu.Module.Course
public List<RB_Scroll_Appointment_ViewModel> GetAppointPageList(int pageIndex, int pageSize, out long count, RB_Scroll_Appointment_ViewModel demodel) public List<RB_Scroll_Appointment_ViewModel> GetAppointPageList(int pageIndex, int pageSize, out long count, RB_Scroll_Appointment_ViewModel demodel)
{ {
var list = scroll_AppointmentRepository.GetAppointPageList(pageIndex, pageSize, out count, demodel); var list = scroll_AppointmentRepository.GetAppointPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) { if (list.Any())
{
//获取上课时段 //获取上课时段
string CourseTimeIds = string.Join(",", list.Select(x => x.CourseTimeId).Distinct()); string CourseTimeIds = string.Join(",", list.Select(x => x.CourseTimeId).Distinct());
var ctlist = scroll_CourseTimeRepository.GetList(new RB_Scroll_CourseTime_ViewModel() { Group_Id = demodel.Group_Id, CourseTimeIds = CourseTimeIds }); var ctlist = scroll_CourseTimeRepository.GetList(new RB_Scroll_CourseTime_ViewModel() { Group_Id = demodel.Group_Id, CourseTimeIds = CourseTimeIds });
...@@ -466,7 +488,8 @@ namespace Edu.Module.Course ...@@ -466,7 +488,8 @@ namespace Edu.Module.Course
/// <param name="userInfo"></param> /// <param name="userInfo"></param>
/// <param name="rmsg"></param> /// <param name="rmsg"></param>
/// <returns></returns> /// <returns></returns>
public object GetScrollAppointmentBaseInfo(AppletStudentInfo userInfo, out string rmsg) { public object GetScrollAppointmentBaseInfo(AppletStudentInfo userInfo, out string rmsg)
{
rmsg = ""; rmsg = "";
#region 学生的课程 #region 学生的课程
//获取正在上课的课程 //获取正在上课的课程
...@@ -502,7 +525,8 @@ namespace Edu.Module.Course ...@@ -502,7 +525,8 @@ namespace Edu.Module.Course
double NextAppointMinutes = 0; double NextAppointMinutes = 0;
double NextClassHours = 0; double NextClassHours = 0;
Common.Enum.Course.CourseRateEnum CourseGrade = 0; Common.Enum.Course.CourseRateEnum CourseGrade = 0;
if (MaxChapterNum > learnModel.CourseChapterNo + AppointNum) { if (MaxChapterNum > learnModel.CourseChapterNo + AppointNum)
{
//查询下一次课的耗时分钟数 前端需要根据这个分钟数 //查询下一次课的耗时分钟数 前端需要根据这个分钟数
var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = userInfo.Group_Id, CourseId = learnModel.CourseId, ChapterNo = (learnModel.CourseChapterNo + AppointNum + 1).ToString() }).FirstOrDefault(); var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = userInfo.Group_Id, CourseId = learnModel.CourseId, ChapterNo = (learnModel.CourseChapterNo + AppointNum + 1).ToString() }).FirstOrDefault();
NextAppointMinutes = chapterModel?.StudyMinutes ?? 0; NextAppointMinutes = chapterModel?.StudyMinutes ?? 0;
...@@ -528,7 +552,7 @@ namespace Edu.Module.Course ...@@ -528,7 +552,7 @@ namespace Edu.Module.Course
AppointNum, AppointNum,
NextAppointChapterNo = learnModel.CourseChapterNo + 1 + AppointNum, NextAppointChapterNo = learnModel.CourseChapterNo + 1 + AppointNum,
IsNextAppoint = MaxChapterNum > learnModel.CourseChapterNo + AppointNum, IsNextAppoint = MaxChapterNum > learnModel.CourseChapterNo + AppointNum,
CourseGradeId =(int) CourseGrade, CourseGradeId = (int)CourseGrade,
CourseGradeName = CourseGrade.ToName(), CourseGradeName = CourseGrade.ToName(),
NextAppointMinutes, NextAppointMinutes,
NextClassHours, NextClassHours,
...@@ -557,7 +581,7 @@ namespace Edu.Module.Course ...@@ -557,7 +581,7 @@ namespace Edu.Module.Course
#region 学生的课程 #region 学生的课程
//获取正在上课的课程 //获取正在上课的课程
var learnModel = student_OrderGuestRepository.GetStudentLearningCourse(userInfo.AccountId, userInfo.Group_Id); var learnModel = student_OrderGuestRepository.GetStudentLearningCourse(userInfo.AccountId, userInfo.Group_Id);
if (learnModel == null) { rmsg = "未查询有正在学习的课程,无法约课";return ""; } if (learnModel == null) { rmsg = "未查询有正在学习的课程,无法约课"; return ""; }
if (learnModel.ClassScrollType != 2) { rmsg = "不是预约学员,无法查看"; return ""; } if (learnModel.ClassScrollType != 2) { rmsg = "不是预约学员,无法查看"; return ""; }
//获取课程信息 //获取课程信息
var courseModel = courseRepository.GetEntity(learnModel.CourseId); var courseModel = courseRepository.GetEntity(learnModel.CourseId);
...@@ -602,11 +626,13 @@ namespace Edu.Module.Course ...@@ -602,11 +626,13 @@ namespace Edu.Module.Course
var planList = scroll_PlanRepository.GetTeacherPlanForDay(Date, SchoolId, userInfo.Group_Id); var planList = scroll_PlanRepository.GetTeacherPlanForDay(Date, SchoolId, userInfo.Group_Id);
//再查询这些老师 正常排课 + 试听课安排 需要排除这些课程 //再查询这些老师 正常排课 + 试听课安排 需要排除这些课程
var pcList = class_PlanRepository.GetClassPlanModelRepository(new RB_Class_Plan_ViewModel() { Group_Id = userInfo.Group_Id, QClassDateStr = Date }); var pcList = class_PlanRepository.GetClassPlanModelRepository(new RB_Class_Plan_ViewModel() { Group_Id = userInfo.Group_Id, QClassDateStr = Date });
if (pcList.Any()) { if (pcList.Any())
{
//查询计划的时间段 //查询计划的时间段
string planids = string.Join(",", pcList.Select(x => x.ClassPlanId)); string planids = string.Join(",", pcList.Select(x => x.ClassPlanId));
var ctList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planids }); var ctList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planids });
foreach (var item in pcList) { foreach (var item in pcList)
{
item.PlanTimeList = ctList.Where(x => x.ClassPlanId == item.ClassPlanId).ToList(); item.PlanTimeList = ctList.Where(x => x.ClassPlanId == item.ClassPlanId).ToList();
} }
} }
...@@ -617,27 +643,32 @@ namespace Edu.Module.Course ...@@ -617,27 +643,32 @@ namespace Edu.Module.Course
List<object> RList = new List<object>(); List<object> RList = new List<object>();
//开始遍历老师了 //开始遍历老师了
foreach (var item in planList) { foreach (var item in planList)
{
//查询班次 //查询班次
var shiftModel = shiftList.Where(x => x.Id == item.ShiftId).FirstOrDefault(); var shiftModel = shiftList.Where(x => x.Id == item.ShiftId).FirstOrDefault();
item.CourseTimeList = ctModel.TimeList.Where(x => Convert.ToDateTime("2020-01-01 " + x.StartTime) >= Convert.ToDateTime("2020-01-01 " + shiftModel.StartTime) && Convert.ToDateTime("2020-01-01 " + x.EndTime) <= Convert.ToDateTime("2020-01-01 " + shiftModel.EndTime)).RefMapperToList<CourseTimeExtend>(); item.CourseTimeList = ctModel.TimeList.Where(x => Convert.ToDateTime("2020-01-01 " + x.StartTime) >= Convert.ToDateTime("2020-01-01 " + shiftModel.StartTime) && Convert.ToDateTime("2020-01-01 " + x.EndTime) <= Convert.ToDateTime("2020-01-01 " + shiftModel.EndTime)).RefMapperToList<CourseTimeExtend>();
//查询该时段内 是否已有正常排课 //查询该时段内 是否已有正常排课
var pc2List = pcList.Where(x => x.TeacherId == item.TeacherId).ToList(); var pc2List = pcList.Where(x => x.TeacherId == item.TeacherId).ToList();
foreach (var qitem in pc2List) { foreach (var qitem in pc2List)
foreach (var citem in qitem.PlanTimeList) { {
foreach (var citem in qitem.PlanTimeList)
{
DateTime CSDate = Convert.ToDateTime("2022-01-01 " + citem.StartTime); DateTime CSDate = Convert.ToDateTime("2022-01-01 " + citem.StartTime);
DateTime CEDate = Convert.ToDateTime("2022-01-01 " + citem.EndTime); DateTime CEDate = Convert.ToDateTime("2022-01-01 " + citem.EndTime);
//开始验证重复数据 //开始验证重复数据
var HList = item.CourseTimeList.Where(x => (x.SDate <= CSDate && CSDate <= x.EDate) || (x.SDate <= CEDate && CEDate <= x.EDate)).ToList(); var HList = item.CourseTimeList.Where(x => (x.SDate <= CSDate && CSDate <= x.EDate) || (x.SDate <= CEDate && CEDate <= x.EDate)).ToList();
foreach (var hitem in HList) { foreach (var hitem in HList)
{
hitem.State = 2;//已有排课 不可预约 hitem.State = 2;//已有排课 不可预约
} }
} }
} }
//查询该时段内 是否已有正常试听 //查询该时段内 是否已有正常试听
var rc2List = rcList.Where(x => x.TeacherId == item.TeacherId).ToList(); var rc2List = rcList.Where(x => x.TeacherId == item.TeacherId).ToList();
foreach (var qitem in rc2List) { foreach (var qitem in rc2List)
{
DateTime CSDate = Convert.ToDateTime("2022-01-01 " + qitem.ClassTime); DateTime CSDate = Convert.ToDateTime("2022-01-01 " + qitem.ClassTime);
DateTime CEDate = Convert.ToDateTime("2022-01-01 " + qitem.EndTime); DateTime CEDate = Convert.ToDateTime("2022-01-01 " + qitem.EndTime);
//开始验证重复数据 //开始验证重复数据
...@@ -654,11 +685,13 @@ namespace Edu.Module.Course ...@@ -654,11 +685,13 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
if (x.Where(x => x.StuId == userInfo.AccountId).Any()) { if (x.Where(x => x.StuId == userInfo.AccountId).Any())
{
z.State = 4;//我预约的 z.State = 4;//我预约的
} }
z.CourseId = firstModel.CourseId; z.CourseId = firstModel.CourseId;
...@@ -668,16 +701,20 @@ namespace Edu.Module.Course ...@@ -668,16 +701,20 @@ namespace Edu.Module.Course
z.PeopleNum = x.Count(); z.PeopleNum = x.Count();
z.SortIdentify = x.Key.ShiftSort; z.SortIdentify = x.Key.ShiftSort;
z.Description = string.Join(",", x.Select(q => q.StuName)); z.Description = string.Join(",", x.Select(q => q.StuName));
if (z.State == 3) { if (z.State == 3)
if (CourseGrade != z.CourseGradeId) { {
if (CourseGrade != z.CourseGradeId)
{
//课次等级不一致 无法预约 //课次等级不一致 无法预约
z.State = 2; z.State = 2;
} }
if (z.CourseGradeNo != learnModel.CourseChapterNo + 1 + AppointNum) { if (z.CourseGradeNo != learnModel.CourseChapterNo + 1 + AppointNum)
{
//章节不一致 无法预约 //章节不一致 无法预约
z.State = 2; z.State = 2;
} }
if (z.MaxPeopleNum <= z.PeopleNum) { if (z.MaxPeopleNum <= z.PeopleNum)
{
//人数已报满 无法预约 //人数已报满 无法预约
z.State = 2; z.State = 2;
} }
...@@ -737,7 +774,7 @@ namespace Edu.Module.Course ...@@ -737,7 +774,7 @@ namespace Edu.Module.Course
//可预约的时间 (提前1天时启用) //可预约的时间 (提前1天时启用)
string ScrollETime = dictvalueRepository.GetList(new Model.ViewModel.User.RB_Dictvalue_Extend() { RB_Group_id = userInfo.Group_Id, DictKey = "Scroll_Time" }).FirstOrDefault()?.Content ?? ""; string ScrollETime = dictvalueRepository.GetList(new Model.ViewModel.User.RB_Dictvalue_Extend() { RB_Group_id = userInfo.Group_Id, DictKey = "Scroll_Time" }).FirstOrDefault()?.Content ?? "";
if (DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + ScrollETime)) { return "需要在当日" + ScrollETime + "之前约课"; } if (DateTime.Now > Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd") + " " + ScrollETime)) { return "需要在当日" + ScrollETime + "之前约课"; }
} }
#endregion #endregion
#region 学生的课程 #region 学生的课程
...@@ -854,7 +891,8 @@ namespace Edu.Module.Course ...@@ -854,7 +891,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
...@@ -892,13 +930,14 @@ namespace Edu.Module.Course ...@@ -892,13 +930,14 @@ namespace Edu.Module.Course
demodel.GuestId = learnModel.GuestId; demodel.GuestId = learnModel.GuestId;
demodel.OrderId = learnModel.OrderId; demodel.OrderId = learnModel.OrderId;
demodel.CourseSTime = timeList.Min(x => x.StartTime); demodel.CourseSTime = timeList.Min(x => x.StartTime);
demodel.CourseETime = timeList.Max(x => x.EndTime); demodel.CourseETime = timeList.Max(x => x.EndTime);
demodel.LearnCourseId = learnModel.CourseId; demodel.LearnCourseId = learnModel.CourseId;
demodel.AppointType = 1; demodel.AppointType = 1;
//验证都OK了 插入预约数据 //验证都OK了 插入预约数据
bool flag = scroll_AppointmentRepository.Insert(demodel) > 0; bool flag = scroll_AppointmentRepository.Insert(demodel) > 0;
if (flag) { if (flag)
{
string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? ""; string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? "";
if (!string.IsNullOrEmpty(Scroll_Notice)) if (!string.IsNullOrEmpty(Scroll_Notice))
{ {
...@@ -930,7 +969,7 @@ namespace Edu.Module.Course ...@@ -930,7 +969,7 @@ namespace Edu.Module.Course
{ {
rmsg = ""; rmsg = "";
var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseId = demodel.CourseId, ChapterNo = (demodel.ChapterNo).ToString() }).FirstOrDefault(); var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseId = demodel.CourseId, ChapterNo = (demodel.ChapterNo).ToString() }).FirstOrDefault();
if (chapterModel == null) { rmsg = "预约课程章节不存在"; return ""; } if (chapterModel == null) { rmsg = "预约课程章节不存在"; return ""; }
demodel.CourseGradeId = chapterModel?.CourseRate ?? 0; demodel.CourseGradeId = chapterModel?.CourseRate ?? 0;
string Date = demodel.Date.ToString("yyyy-MM-dd"); string Date = demodel.Date.ToString("yyyy-MM-dd");
//获取已有该次课程预约的情况 //获取已有该次课程预约的情况
...@@ -943,7 +982,8 @@ namespace Edu.Module.Course ...@@ -943,7 +982,8 @@ namespace Edu.Module.Course
State = 1 State = 1
}; };
} }
else { else
{
//验证其他时段 //验证其他时段
if (list.Where(x => x.AccountId != demodel.AccountId && x.ShiftSort == demodel.ShiftSort).Any()) if (list.Where(x => x.AccountId != demodel.AccountId && x.ShiftSort == demodel.ShiftSort).Any())
{ {
...@@ -995,7 +1035,8 @@ namespace Edu.Module.Course ...@@ -995,7 +1035,8 @@ namespace Edu.Module.Course
}) })
}; };
} }
else { else
{
return new return new
{ {
State = 0 State = 0
...@@ -1029,7 +1070,8 @@ namespace Edu.Module.Course ...@@ -1029,7 +1070,8 @@ namespace Edu.Module.Course
} }
}; };
bool flag = scroll_AppointmentRepository.Update(keyValues, wheres); bool flag = scroll_AppointmentRepository.Update(keyValues, wheres);
if (flag) { if (flag)
{
string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = userInfo.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? ""; string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = userInfo.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? "";
List<Employee_ViewModel> empList = new List<Employee_ViewModel>(); List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
string StuName = ""; string StuName = "";
...@@ -1219,7 +1261,8 @@ namespace Edu.Module.Course ...@@ -1219,7 +1261,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 2;//已预约了 z.State = 2;//已预约了
...@@ -1467,7 +1510,8 @@ namespace Edu.Module.Course ...@@ -1467,7 +1510,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
...@@ -1512,7 +1556,8 @@ namespace Edu.Module.Course ...@@ -1512,7 +1556,8 @@ namespace Edu.Module.Course
//验证都OK了 插入预约数据 //验证都OK了 插入预约数据
AppointId = scroll_AppointmentRepository.Insert(demodel); AppointId = scroll_AppointmentRepository.Insert(demodel);
bool flag = AppointId > 0; bool flag = AppointId > 0;
if (flag) { if (flag)
{
//后台多半是 陈兴梅自行约课, 暂时不推送消息 //后台多半是 陈兴梅自行约课, 暂时不推送消息
// string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? ""; // string Scroll_Notice = dictvalueRepository.GetList(new RB_Dictvalue_Extend() { RB_Group_id = demodel.Group_Id, DictKey = "Scroll_Notice" }).FirstOrDefault()?.Content ?? "";
// if (!string.IsNullOrEmpty(Scroll_Notice)) // if (!string.IsNullOrEmpty(Scroll_Notice))
...@@ -1579,7 +1624,8 @@ namespace Edu.Module.Course ...@@ -1579,7 +1624,8 @@ namespace Edu.Module.Course
} }
#endregion #endregion
foreach (var item in list) { foreach (var item in list)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Scroll_Appointment_ViewModel.State), Common.Enum.Course.CourseAppointStateEnum.Cancel}, { nameof(RB_Scroll_Appointment_ViewModel.State), Common.Enum.Course.CourseAppointStateEnum.Cancel},
{ nameof(RB_Scroll_Appointment_ViewModel.Remark), item.Remark +";后台管理取消"}, { nameof(RB_Scroll_Appointment_ViewModel.Remark), item.Remark +";后台管理取消"},
...@@ -1599,7 +1645,8 @@ namespace Edu.Module.Course ...@@ -1599,7 +1645,8 @@ namespace Edu.Module.Course
//给学生推送 取消课程的订阅消息 //给学生推送 取消课程的订阅消息
SendAppointmentCancelMsg(token, item.StuOpenId, item, item.Date.ToString("yyyy-MM-dd") + " " + item.CourseSTime, "老师操作取消预约"); SendAppointmentCancelMsg(token, item.StuOpenId, item, item.Date.ToString("yyyy-MM-dd") + " " + item.CourseSTime, "老师操作取消预约");
if (item.AppointType == 2) { if (item.AppointType == 2)
{
//更新补课 //更新补课
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() { Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Scroll_SkipCourse_ViewModel.State),1} { nameof(RB_Scroll_SkipCourse_ViewModel.State),1}
...@@ -1667,7 +1714,8 @@ namespace Edu.Module.Course ...@@ -1667,7 +1714,8 @@ namespace Edu.Module.Course
{ {
//给学生推送 取消课程的订阅消息 //给学生推送 取消课程的订阅消息
SendAppointmentCancelMsg(token, qitem.StuOpenId, qitem, qitem.Date.ToString("yyyy-MM-dd") + " " + qitem.CourseSTime, "老师操作取消预约"); SendAppointmentCancelMsg(token, qitem.StuOpenId, qitem, qitem.Date.ToString("yyyy-MM-dd") + " " + qitem.CourseSTime, "老师操作取消预约");
if (qitem.AppointType == 2) { if (qitem.AppointType == 2)
{
//更新补课 //更新补课
Dictionary<string, object> keyValues12 = new Dictionary<string, object>() { Dictionary<string, object> keyValues12 = new Dictionary<string, object>() {
{ nameof(RB_Scroll_SkipCourse_ViewModel.State),1} { nameof(RB_Scroll_SkipCourse_ViewModel.State),1}
...@@ -1702,11 +1750,13 @@ namespace Edu.Module.Course ...@@ -1702,11 +1750,13 @@ namespace Edu.Module.Course
} }
#endregion #endregion
} }
else { else
{
return "出错了,请联系管理员"; return "出错了,请联系管理员";
} }
} }
if (flag) { if (flag)
{
var firstModel = list.FirstOrDefault(); var firstModel = list.FirstOrDefault();
string CourseTime = firstModel.CourseSTime + "~" + firstModel.CourseETime; string CourseTime = firstModel.CourseSTime + "~" + firstModel.CourseETime;
string StuName = string.Join(",", list.Select(x => x.StuName)); string StuName = string.Join(",", list.Select(x => x.StuName));
...@@ -1869,7 +1919,8 @@ namespace Edu.Module.Course ...@@ -1869,7 +1919,8 @@ namespace Edu.Module.Course
if (inModel == null) { return "转入时段不存在预约"; } if (inModel == null) { return "转入时段不存在预约"; }
var list = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, AppointIds = appointmentIds }); var list = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, AppointIds = appointmentIds });
if (list.Any()) { if (list.Any())
{
if (list.Where(x => x.State != Common.Enum.Course.CourseAppointStateEnum.WaitSure).Any()) { return "只能未确认的转移"; } if (list.Where(x => x.State != Common.Enum.Course.CourseAppointStateEnum.WaitSure).Any()) { return "只能未确认的转移"; }
foreach (var item in list) foreach (var item in list)
{ {
...@@ -1895,7 +1946,8 @@ namespace Edu.Module.Course ...@@ -1895,7 +1946,8 @@ namespace Edu.Module.Course
if (vlist.Where(x => x.Date > inModel.Date && x.Date < list.FirstOrDefault().Date && x.CourseSTime.CompareTo(inModel.CourseSTime) > 0 && x.CourseSTime.CompareTo(list.FirstOrDefault().CourseSTime) < 0).Any()) { return "合并之间存在学生的其他时段预约,无法合并"; } if (vlist.Where(x => x.Date > inModel.Date && x.Date < list.FirstOrDefault().Date && x.CourseSTime.CompareTo(inModel.CourseSTime) > 0 && x.CourseSTime.CompareTo(list.FirstOrDefault().CourseSTime) < 0).Any()) { return "合并之间存在学生的其他时段预约,无法合并"; }
} }
} }
else { else
{
string StuIds = string.Join(",", list.Select(x => x.StuId)); string StuIds = string.Join(",", list.Select(x => x.StuId));
var vlist = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, EntTime = inModel.Date.ToString("yyyy-MM-dd"), StartTime = list.FirstOrDefault().Date.ToString("yyyy-MM-dd"), StuIds = StuIds }); var vlist = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, EntTime = inModel.Date.ToString("yyyy-MM-dd"), StartTime = list.FirstOrDefault().Date.ToString("yyyy-MM-dd"), StuIds = StuIds });
if (list.FirstOrDefault().Date < inModel.Date) if (list.FirstOrDefault().Date < inModel.Date)
...@@ -1914,7 +1966,8 @@ namespace Edu.Module.Course ...@@ -1914,7 +1966,8 @@ namespace Edu.Module.Course
} }
//开始合并 //开始合并
foreach (var item in list) { foreach (var item in list)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Scroll_Appointment_ViewModel.Date), inModel.Date}, { nameof(RB_Scroll_Appointment_ViewModel.Date), inModel.Date},
{ nameof(RB_Scroll_Appointment_ViewModel.AccountId), inModel.AccountId}, { nameof(RB_Scroll_Appointment_ViewModel.AccountId), inModel.AccountId},
...@@ -2026,7 +2079,7 @@ namespace Edu.Module.Course ...@@ -2026,7 +2079,7 @@ namespace Edu.Module.Course
{ {
thing1 = new thing1 = new
{ {
value = demodel.CourseName value = demodel.CourseName
}, },
thing3 = new thing3 = new
{ {
...@@ -2103,7 +2156,7 @@ namespace Edu.Module.Course ...@@ -2103,7 +2156,7 @@ namespace Edu.Module.Course
else { return "上课时段未配置"; } else { return "上课时段未配置"; }
double NextAppointMinutes = 0; double NextAppointMinutes = 0;
//查询下一次课的耗时分钟数 前端需要根据这个分钟数 //查询下一次课的耗时分钟数 前端需要根据这个分钟数
var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseId = makeupModel.CourseId, ChapterGradeNo = makeupModel.CourseGradeNo, CourseRate = makeupModel.CourseGradeId }).FirstOrDefault(); var chapterModel = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel() { Group_Id = demodel.Group_Id, CourseId = makeupModel.CourseId, ChapterGradeNo = makeupModel.CourseGradeNo, CourseRate = makeupModel.CourseGradeId }).FirstOrDefault();
NextAppointMinutes = chapterModel?.StudyMinutes ?? 0; NextAppointMinutes = chapterModel?.StudyMinutes ?? 0;
...@@ -2178,7 +2231,8 @@ namespace Edu.Module.Course ...@@ -2178,7 +2231,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
...@@ -2362,7 +2416,8 @@ namespace Edu.Module.Course ...@@ -2362,7 +2416,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
...@@ -2546,7 +2601,8 @@ namespace Edu.Module.Course ...@@ -2546,7 +2601,8 @@ namespace Edu.Module.Course
{ {
var firstModel = x.FirstOrDefault(); var firstModel = x.FirstOrDefault();
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]"); List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + x.Key.ShiftSort + "]");
item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z => { item.CourseTimeList.Where(y => SortList.Contains(y.Sort)).ToList().ForEach(z =>
{
z.MinPeopleNum = firstModel.ScrollMinNum; z.MinPeopleNum = firstModel.ScrollMinNum;
z.MaxPeopleNum = firstModel.ScrollMaxNum; z.MaxPeopleNum = firstModel.ScrollMaxNum;
z.State = 3;//已预约了 z.State = 3;//已预约了
...@@ -2594,7 +2650,8 @@ namespace Edu.Module.Course ...@@ -2594,7 +2650,8 @@ namespace Edu.Module.Course
demodel.AppointType = 1; demodel.AppointType = 1;
#region 验证补课 重上课 #region 验证补课 重上课
var appointList2 = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = demodel.Group_Id, GuestId = demodel.GuestId, CourseGradeId = demodel.CourseGradeId, CourseGradeNo = demodel.CourseGradeNo }); var appointList2 = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = demodel.Group_Id, GuestId = demodel.GuestId, CourseGradeId = demodel.CourseGradeId, CourseGradeNo = demodel.CourseGradeNo });
if (appointList2.Any()) { if (appointList2.Any())
{
if (appointList2.Where(x => x.State == Common.Enum.Course.CourseAppointStateEnum.WaitSure).Any()) if (appointList2.Where(x => x.State == Common.Enum.Course.CourseAppointStateEnum.WaitSure).Any())
{ {
return "预约的该次课已存在待确认的数据,无法再次预约"; return "预约的该次课已存在待确认的数据,无法再次预约";
...@@ -2617,7 +2674,8 @@ namespace Edu.Module.Course ...@@ -2617,7 +2674,8 @@ namespace Edu.Module.Course
//验证都OK了 插入预约数据 //验证都OK了 插入预约数据
AppointId = scroll_AppointmentRepository.Insert(demodel); AppointId = scroll_AppointmentRepository.Insert(demodel);
bool flag = AppointId > 0; bool flag = AppointId > 0;
if (flag) { if (flag)
{
//定时器 更新已上课时 再更新其上课课时 //定时器 更新已上课时 再更新其上课课时
//if (demodel.AppointType == 1 && demodel.ChapterNo > learnModel.CourseChapterNo + 1) { //if (demodel.AppointType == 1 && demodel.ChapterNo > learnModel.CourseChapterNo + 1) {
// Dictionary<string, object> keyValues = new Dictionary<string, object>() { // Dictionary<string, object> keyValues = new Dictionary<string, object>() {
...@@ -2724,7 +2782,8 @@ namespace Edu.Module.Course ...@@ -2724,7 +2782,8 @@ namespace Edu.Module.Course
bool flag = AppointId > 0; bool flag = AppointId > 0;
if (flag) if (flag)
{ {
if (demodel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed) { if (demodel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed)
{
//已上课 需更新课时 + 签到记录 //已上课 需更新课时 + 签到记录
var clist = JsonHelper.DeserializeObject<List<CourseTimeModel>>(demodel.CourseTime); var clist = JsonHelper.DeserializeObject<List<CourseTimeModel>>(demodel.CourseTime);
//更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的) //更新 order_guest 表 上课章节 请假也暂时先算完成课时(请假应该是有补课的)
...@@ -2882,7 +2941,8 @@ namespace Edu.Module.Course ...@@ -2882,7 +2941,8 @@ namespace Edu.Module.Course
scroll_SkipCourseRepository.Update(keyValues1, wheres1); scroll_SkipCourseRepository.Update(keyValues1, wheres1);
} }
if (item.State == Common.Enum.Course.CourseAppointStateEnum.Coursed) { if (item.State == Common.Enum.Course.CourseAppointStateEnum.Coursed)
{
//已上课 要删除 签到记录 //已上课 要删除 签到记录
var checkList = class_CheckRepository.GetClassCheckListRepository(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, OrderGuestId = item.GuestId, QClassPlanIds = item.ClassPlanId.ToString() }); var checkList = class_CheckRepository.GetClassCheckListRepository(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, OrderGuestId = item.GuestId, QClassPlanIds = item.ClassPlanId.ToString() });
foreach (var qitem in checkList) foreach (var qitem in checkList)
...@@ -2898,15 +2958,18 @@ namespace Edu.Module.Course ...@@ -2898,15 +2958,18 @@ namespace Edu.Module.Course
} }
if (flag) if (flag)
{ {
if (list.Count() == alllist.Count()) { if (list.Count() == alllist.Count())
{
//全部取消了 删除对应 计划 + 上课时段 //全部取消了 删除对应 计划 + 上课时段
string planIds = string.Join(",", list.Select(x => x.ClassPlanId).Distinct()); string planIds = string.Join(",", list.Select(x => x.ClassPlanId).Distinct());
var planlist = class_PlanRepository.GetClassPlanListRepository(new RB_Class_Plan_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planIds, PlanType = 2 }); var planlist = class_PlanRepository.GetClassPlanListRepository(new RB_Class_Plan_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planIds, PlanType = 2 });
var timelist = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planIds }); var timelist = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = planIds });
foreach (var item in planlist) { foreach (var item in planlist)
{
class_PlanRepository.Delete(item); class_PlanRepository.Delete(item);
var tlist = timelist.Where(x => x.ClassPlanId == item.ClassPlanId).ToList(); var tlist = timelist.Where(x => x.ClassPlanId == item.ClassPlanId).ToList();
foreach (var qitem in tlist) { foreach (var qitem in tlist)
{
class_TimeRepository.Delete(qitem); class_TimeRepository.Delete(qitem);
} }
} }
...@@ -2953,13 +3016,15 @@ namespace Edu.Module.Course ...@@ -2953,13 +3016,15 @@ namespace Edu.Module.Course
public async Task<string> SetScrollRoomAsync(int teacherId, string date, string shiftSort, int roomId, UserInfo userInfo) public async Task<string> SetScrollRoomAsync(int teacherId, string date, string shiftSort, int roomId, UserInfo userInfo)
{ {
var appointList = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, StartTime = date, EntTime = date, TeacherId = teacherId, ShiftSort = shiftSort }); var appointList = scroll_AppointmentRepository.GetList(new RB_Scroll_Appointment_ViewModel() { Group_Id = userInfo.Group_Id, StartTime = date, EntTime = date, TeacherId = teacherId, ShiftSort = shiftSort });
if (appointList.Any()) { if (appointList.Any())
{
if (appointList.Where(x => x.RoomId == roomId).Any()) if (appointList.Where(x => x.RoomId == roomId).Any())
{ {
return "请选择其他教室"; return "请选择其他教室";
} }
bool flag = false; bool flag = false;
foreach (var item in appointList) { foreach (var item in appointList)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Scroll_Appointment_ViewModel.RoomId), roomId} { nameof(RB_Scroll_Appointment_ViewModel.RoomId), roomId}
}; };
...@@ -2972,7 +3037,8 @@ namespace Edu.Module.Course ...@@ -2972,7 +3037,8 @@ namespace Edu.Module.Course
}; };
flag = scroll_AppointmentRepository.Update(keyValues, wheres); flag = scroll_AppointmentRepository.Update(keyValues, wheres);
} }
if (flag) { if (flag)
{
var appointModel = appointList.FirstOrDefault(); var appointModel = appointList.FirstOrDefault();
if (appointModel.State == Common.Enum.Course.CourseAppointStateEnum.WaitCourse || appointModel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed) if (appointModel.State == Common.Enum.Course.CourseAppointStateEnum.WaitCourse || appointModel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed)
{ {
...@@ -2989,10 +3055,12 @@ namespace Edu.Module.Course ...@@ -2989,10 +3055,12 @@ namespace Edu.Module.Course
}; };
class_PlanRepository.Update(keyValues, wheres); class_PlanRepository.Update(keyValues, wheres);
} }
if (appointModel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed) { if (appointModel.State == Common.Enum.Course.CourseAppointStateEnum.Coursed)
{
//已上课 需要更新 签到数据 class_check //已上课 需要更新 签到数据 class_check
var checkList = class_CheckRepository.GetClassCheckListRepository(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = appointModel.ClassPlanId.ToString() }); var checkList = class_CheckRepository.GetClassCheckListRepository(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = appointModel.ClassPlanId.ToString() });
foreach (var qitem in checkList) { foreach (var qitem in checkList)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Class_Check_ViewModel.ClassRoomId), roomId} { nameof(RB_Class_Check_ViewModel.ClassRoomId), roomId}
}; };
...@@ -3038,7 +3106,8 @@ namespace Edu.Module.Course ...@@ -3038,7 +3106,8 @@ namespace Edu.Module.Course
string server_path = rootBook + "/upfile/temporary/" + "约课数据.xlsx"; string server_path = rootBook + "/upfile/temporary/" + "约课数据.xlsx";
var list = Common.Data.AppointmentHelper.GetAppointmentData(server_path); var list = Common.Data.AppointmentHelper.GetAppointmentData(server_path);
list = list.Where(x => !string.IsNullOrEmpty(x.Date)).ToList(); list = list.Where(x => !string.IsNullOrEmpty(x.Date)).ToList();
if (list.Any()) { if (list.Any())
{
//根据所有的学生 //根据所有的学生
var stuList = student_OrderGuestRepository.GetAppointmentStudyList(group_Id); var stuList = student_OrderGuestRepository.GetAppointmentStudyList(group_Id);
//查询老师信息 //查询老师信息
...@@ -3210,7 +3279,8 @@ namespace Edu.Module.Course ...@@ -3210,7 +3279,8 @@ namespace Edu.Module.Course
}); });
//最后 更新 order_guest 表 完成课时 + 上课章节 //最后 更新 order_guest 表 完成课时 + 上课章节
foreach (var GuestId in ChapterNoList.Select(x => x.GuestId).Distinct()) { foreach (var GuestId in ChapterNoList.Select(x => x.GuestId).Distinct())
{
int CourseChapterNo = ChapterNoList.Where(x => x.GuestId == GuestId && x.RenewState == 1).Count();//每节课2课时 int CourseChapterNo = ChapterNoList.Where(x => x.GuestId == GuestId && x.RenewState == 1).Count();//每节课2课时
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Order_Guest_ViewModel.CompleteHours), CourseChapterNo * 2}, { nameof(RB_Order_Guest_ViewModel.CompleteHours), CourseChapterNo * 2},
...@@ -3234,11 +3304,13 @@ namespace Edu.Module.Course ...@@ -3234,11 +3304,13 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
/// <param name="group_Id"></param> /// <param name="group_Id"></param>
/// <returns></returns> /// <returns></returns>
public string InitializeAppointDataForGB(int group_Id) { public string InitializeAppointDataForGB(int group_Id)
{
string GuestIds = "77";//艾荻、张笑三、吴浪、周杰、邓骏、刘卡加 string GuestIds = "77";//艾荻、张笑三、吴浪、周杰、邓骏、刘卡加
var glist = order_GuestRepository.GetSingleListRepository(new RB_Order_Guest_ViewModel() { Group_Id = group_Id, OrderGuestIds = GuestIds }); var glist = order_GuestRepository.GetSingleListRepository(new RB_Order_Guest_ViewModel() { Group_Id = group_Id, OrderGuestIds = GuestIds });
if (glist.Any()) { if (glist.Any())
{
} }
return ""; return "";
...@@ -3260,10 +3332,12 @@ namespace Edu.Module.Course ...@@ -3260,10 +3332,12 @@ namespace Edu.Module.Course
var courseModel = courseRepository.GetEntity(demodel.CourseId); var courseModel = courseRepository.GetEntity(demodel.CourseId);
if (courseModel.IsScrollClass != 1) { return "改学员不是约课学生,无法跳课"; } if (courseModel.IsScrollClass != 1) { return "改学员不是约课学生,无法跳课"; }
//验证是否OK //验证是否OK
if (chapterNoList.Contains(1)) { if (chapterNoList.Contains(1))
{
//从第一次课开始跳 都成立 //从第一次课开始跳 都成立
var sList = scroll_SkipCourseRepository.GetList(new RB_Scroll_SkipCourse_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId, GuestId = demodel.GuestId }); var sList = scroll_SkipCourseRepository.GetList(new RB_Scroll_SkipCourse_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId, GuestId = demodel.GuestId });
if (sList.Any()) { if (sList.Any())
{
return "已有跳课数据,无法从第一次课开始跳"; return "已有跳课数据,无法从第一次课开始跳";
} }
} }
...@@ -3272,7 +3346,8 @@ namespace Edu.Module.Course ...@@ -3272,7 +3346,8 @@ namespace Edu.Module.Course
#region 验证是否有预约待确认的 #region 验证是否有预约待确认的
var sureList = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId, GuestId = demodel.GuestId, State = Common.Enum.Course.CourseAppointStateEnum.WaitSure }); var sureList = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId, GuestId = demodel.GuestId, State = Common.Enum.Course.CourseAppointStateEnum.WaitSure });
if (sureList.Any()) { if (sureList.Any())
{
return "改学生有待确认的预约,无法设置跳课"; return "改学生有待确认的预约,无法设置跳课";
} }
...@@ -3285,7 +3360,8 @@ namespace Edu.Module.Course ...@@ -3285,7 +3360,8 @@ namespace Edu.Module.Course
int AppointNum = myAppointModel?.ScrollMinNum ?? 0;//已预约的次数 int AppointNum = myAppointModel?.ScrollMinNum ?? 0;//已预约的次数
if (demodel.SChapterNo > 0) if (demodel.SChapterNo > 0)
{ {
if (demodel.SChapterNo != MinChapterNo) { if (demodel.SChapterNo != MinChapterNo)
{
return "开始课程有误"; return "开始课程有误";
} }
} }
...@@ -3297,7 +3373,8 @@ namespace Edu.Module.Course ...@@ -3297,7 +3373,8 @@ namespace Edu.Module.Course
} }
} }
if (ogModel.CourseChapterNo + chapterNoList.Count() + AppointNum > ogModel.TotalChapterNo) { if (ogModel.CourseChapterNo + chapterNoList.Count() + AppointNum > ogModel.TotalChapterNo)
{
return "总章节为" + ogModel.TotalChapterNo + ",当前跳课超过了最大章节"; return "总章节为" + ogModel.TotalChapterNo + ",当前跳课超过了最大章节";
} }
} }
...@@ -3326,7 +3403,8 @@ namespace Edu.Module.Course ...@@ -3326,7 +3403,8 @@ namespace Edu.Module.Course
scroll_SkipCourseRepository.Insert(demodel); scroll_SkipCourseRepository.Insert(demodel);
} }
if (chapterNoList.Contains(1) || demodel.SChapterNo > 0) { if (chapterNoList.Contains(1) || demodel.SChapterNo > 0)
{
//更新约课记录的章节 (依次增加) //更新约课记录的章节 (依次增加)
scroll_AppointmentRepository.UpdateAppointSkipCourse(demodel.StuId, demodel.GuestId, ChapterNum: chapterNoList.Count(), demodel.SChapterNo, demodel.Group_Id); scroll_AppointmentRepository.UpdateAppointSkipCourse(demodel.StuId, demodel.GuestId, ChapterNum: chapterNoList.Count(), demodel.SChapterNo, demodel.Group_Id);
} }
...@@ -3350,7 +3428,8 @@ namespace Edu.Module.Course ...@@ -3350,7 +3428,8 @@ namespace Edu.Module.Course
//获取学生所有的报名信息 //获取学生所有的报名信息
var ogList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel() { Student_Id = demodel.StuId }); var ogList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel() { Student_Id = demodel.StuId });
if (ogList.Any()) { if (ogList.Any())
{
//获取所有的订单信息 //获取所有的订单信息
string orderIds = string.Join(",", ogList.Select(x => x.OrderId)); string orderIds = string.Join(",", ogList.Select(x => x.OrderId));
var orderList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel() { Group_Id = demodel.Group_Id, QOrderIds = orderIds }); var orderList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel() { Group_Id = demodel.Group_Id, QOrderIds = orderIds });
...@@ -3362,7 +3441,8 @@ namespace Edu.Module.Course ...@@ -3362,7 +3441,8 @@ namespace Edu.Module.Course
//查询所有的 补课记录 //查询所有的 补课记录
var SkipList = scroll_SkipCourseRepository.GetList(new RB_Scroll_SkipCourse_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId }); var SkipList = scroll_SkipCourseRepository.GetList(new RB_Scroll_SkipCourse_ViewModel() { Group_Id = demodel.Group_Id, StuId = demodel.StuId });
foreach (var item in orderList) { foreach (var item in orderList)
{
List<object> ChapterList = new List<object>(); List<object> ChapterList = new List<object>();
var ogModel = ogList.Where(x => x.OrderId == item.OrderId).FirstOrDefault(); var ogModel = ogList.Where(x => x.OrderId == item.OrderId).FirstOrDefault();
...@@ -3374,7 +3454,7 @@ namespace Edu.Module.Course ...@@ -3374,7 +3454,7 @@ namespace Edu.Module.Course
var achildList = AppointList.Where(x => x.GuestId == ogModel.GuestId).ToList();//当前课程的 var achildList = AppointList.Where(x => x.GuestId == ogModel.GuestId).ToList();//当前课程的
//预约课 //预约课
int CourseChapterNo = achildList.Any() ? achildList.Max(x => x.ChapterNo) : 0; int CourseChapterNo = achildList.Any() ? achildList.Max(x => x.ChapterNo) : 0;
int CourseChapterNo2 = SkipList.Any()? SkipList.Max(x => x.ChapterNo) : 0; int CourseChapterNo2 = SkipList.Any() ? SkipList.Max(x => x.ChapterNo) : 0;
CourseChapterNo = CourseChapterNo < CourseChapterNo2 ? CourseChapterNo2 : CourseChapterNo; CourseChapterNo = CourseChapterNo < CourseChapterNo2 ? CourseChapterNo2 : CourseChapterNo;
cList.ForEach(x => cList.ForEach(x =>
{ {
...@@ -3405,7 +3485,7 @@ namespace Edu.Module.Course ...@@ -3405,7 +3485,7 @@ namespace Edu.Module.Course
if (SkipModel != null && SkipModel.State == 1) if (SkipModel != null && SkipModel.State == 1)
{ {
State = 3;//跳课 State = 3;//跳课
} }
ChapterList.Add(new ChapterList.Add(new
{ {
x.ChapterNo, x.ChapterNo,
...@@ -3420,7 +3500,8 @@ namespace Edu.Module.Course ...@@ -3420,7 +3500,8 @@ namespace Edu.Module.Course
}); });
}); });
} }
else { else
{
//跟班 //跟班
int CourseChapterNo = oguestModel?.CourseChapterNo ?? 0; int CourseChapterNo = oguestModel?.CourseChapterNo ?? 0;
cList.ForEach(x => { x.SortNum = Convert.ToDouble(x.ChapterNo); }); cList.ForEach(x => { x.SortNum = Convert.ToDouble(x.ChapterNo); });
...@@ -3453,6 +3534,140 @@ namespace Edu.Module.Course ...@@ -3453,6 +3534,140 @@ namespace Edu.Module.Course
return Rlist; return Rlist;
} }
/// <summary>
/// 获取学员课消统计
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public object GetStuLearnChapterStaticModule(StuCourseQuery demodel)
{
List<object> Rlist = new List<object>();
//获取学生所有的报名信息
var dataList = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel()
{
Group_Id = demodel.Group_Id,
AssistId = demodel.TeacherAccountId,
CourseId = demodel.CourseId,
CourseRate = demodel.CourseRate,
});
if (dataList.Any())
{
//获取所有的订单信息
string orderIds = string.Join(",", dataList.Select(x => x.OrderId).Distinct());
var orderList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel() { Group_Id = demodel.Group_Id, QOrderIds = orderIds });
//查询订单Guest
var orderGuestList = order_GuestRepository.GetSingleListRepository(new RB_Order_Guest_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds });
//根据学生 查询所有的约课数据
var AppointList = scroll_AppointmentRepository.GetAppointList(new RB_Scroll_Appointment_ViewModel() { Group_Id = demodel.Group_Id });
//查询所有的 补课记录
var SkipList = scroll_SkipCourseRepository.GetList(new RB_Scroll_SkipCourse_ViewModel() { Group_Id = demodel.Group_Id });
string courseIds = string.Join(",", dataList.Select(qitem => qitem.CourseId).Distinct());
//获取所有课程章节信息
var totalChapterList = course_ChapterRepository.GetChapterListRepository(new RB_Course_Chapter_ViewModel()
{
Group_Id = demodel.Group_Id,
CourseIds = courseIds
});
string stuIds = string.Join(",", dataList.Select(qitem => qitem.Student_Id).Distinct());
var assistList = student_AssistRepository.GetStudentAssistListRepository(new Model.ViewModel.Customer.RB_Student_Assist_Extend()
{
QStuIds = stuIds
});
foreach (var item in orderList)
{
List<object> ChapterList = new List<object>();
var ogModel = dataList.Where(x => x.OrderId == item.OrderId).FirstOrDefault();
var oguestModel = orderGuestList.Where(x => x.Id == ogModel.GuestId).FirstOrDefault();
var teacherModel = assistList?.FirstOrDefault(qitem => qitem.AssistType == Common.Enum.User.AssistTypeEnum.Teacher && qitem.StuId == ogModel.Student_Id);
//根据课程Id 查询 上课课程
var cList = totalChapterList?.Where(qitem => qitem.CourseId == item.CourseId)?.ToList();
cList.ForEach(x =>
{
x.SortNum = Convert.ToDouble(x.ChapterNo);
});
if (item.ClassScrollType == 2)
{
var achildList = AppointList.Where(x => x.GuestId == ogModel.GuestId).ToList();//当前课程的
//预约课
int CourseChapterNo = achildList.Any() ? achildList.Max(x => x.ChapterNo) : 0;
int CourseChapterNo2 = SkipList.Any() ? SkipList.Max(x => x.ChapterNo) : 0;
CourseChapterNo = CourseChapterNo < CourseChapterNo2 ? CourseChapterNo2 : CourseChapterNo;
foreach (var cItem in cList.OrderBy(qitem => qitem.SortNum))
{
int State = 4;//待上课
if (cItem.SortNum <= CourseChapterNo)
{
var AppointModel = achildList.Where(y => y.ChapterNo == cItem.SortNum && y.AppointType != 3 && y.LearnCourseId == item.CourseId).FirstOrDefault();
var SkipModel = SkipList.Where(y => y.ChapterNo == cItem.SortNum && y.CourseId == item.CourseId).FirstOrDefault();
if (AppointModel != null)
{
//正常约课
if (AppointModel.AppointType == 1)
{
State = 1;//正常上课
}
else if (AppointModel.AppointType == 2)
{
State = 2;//补课
}
}
if (SkipModel != null && SkipModel.State == 1)
{
State = 3;//跳课
}
}
ChapterList.Add(new
{
cItem.ChapterNo,
cItem.ChapterName,
cItem.CourseRate,
CourseRateName = cItem.CourseRate.ToName(),
cItem.ChapterGradeNo,
State,
});
}
}
else
{
//跟班
int CourseChapterNo = oguestModel?.CourseChapterNo ?? 0;
foreach (var cItem in cList.OrderBy(qitem => qitem.SortNum))
{
int State = 4;
if (cItem.SortNum <= CourseChapterNo)
{
State = 1;
}
ChapterList.Add(new
{
cItem.ChapterNo,
cItem.ChapterName,
cItem.CourseRate,
CourseRateName = cItem.CourseRate.ToName(),
cItem.ChapterGradeNo,
State,
});
}
}
Rlist.Add(new
{
item.OrderId,
item.CourseId,
item.CourseName,
item.ClassScrollType,
StuName= oguestModel?.GuestName??"",
TeacherName=teacherModel?.AssistName??"",
oguestModel.CourseChapterNo,
oguestModel.TotalChapterNo,
ChapterList
});
}
}
return Rlist;
}
#endregion #endregion
} }
} }
...@@ -22,8 +22,8 @@ namespace Edu.Repository.Customer ...@@ -22,8 +22,8 @@ namespace Edu.Repository.Customer
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.* SELECT A.*,IFNULL(B.EmName,'') AS AssistName
FROM RB_Student_Assist AS A FROM RB_Student_Assist AS A LEFT JOIN rb_employee AS B ON A.AssistId=B.EmployeeId
WHERE 1=1 WHERE 1=1
"); ");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.Status), (int)DateStateEnum.Normal); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Assist_Extend.Status), (int)DateStateEnum.Normal);
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Model.Entity.User; using Edu.Model.Entity.User;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -24,14 +25,20 @@ namespace Edu.Repository.User ...@@ -24,14 +25,20 @@ namespace Edu.Repository.User
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*,IFNULL(B.ClassName,'') AS ClassName,IFNULL(B.ClassNo,'') AS ClassNo,IFNULL(C.JoinType,0) AS StuJoinType,IFNULL(D.GuestState,0) AS StuGuestState SELECT A.*,IFNULL(B.ClassName,'') AS ClassName,IFNULL(B.ClassNo,'') AS ClassNo,IFNULL(C.JoinType,0) AS StuJoinType,IFNULL(D.GuestState,0) AS StuGuestState
,C.OrderState,IFNULL(D.TotalHours,0) AS TotalHours,IFNULL(D.CompleteHours,0) AS CompleteHours,IFNULL(B.ClassStatus,0) AS ClassStatus,IFNULL(D.RenewState,0) AS RenewState ,C.OrderState,IFNULL(D.TotalHours,0) AS TotalHours,IFNULL(D.CompleteHours,0) AS CompleteHours,IFNULL(B.ClassStatus,0) AS ClassStatus,IFNULL(D.RenewState,0) AS RenewState
,IFNULL(E.CourseName,'') AS CourseName,IFNULL(B.CouseId,0) AS CourseId
FROM RB_Student_OrderGuest AS A INNER JOIN rb_class AS B ON A.ClassId=B.ClassId FROM RB_Student_OrderGuest AS A INNER JOIN rb_class AS B ON A.ClassId=B.ClassId
INNER JOIN rb_order AS C ON A.OrderId=C.OrderId INNER JOIN rb_order AS C ON A.OrderId=C.OrderId
INNER JOIN rb_order_guest AS D ON A.GuestId=D.Id INNER JOIN rb_order_guest AS D ON A.GuestId=D.Id
LEFT JOIN rb_course AS E ON B.CouseId=E.CourseId
WHERE 1=1 AND C.OrderState IN(1) AND D.Status=0 WHERE 1=1 AND C.OrderState IN(1) AND D.Status=0
"); ");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.Status), (int)DateStateEnum.Normal); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null) if (query != null)
{ {
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND C.{0}={1} ", nameof(RB_Order_ViewModel.Group_Id), query.Group_Id);
}
if (query.ClassId > 0) if (query.ClassId > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.ClassId), query.ClassId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.ClassId), query.ClassId);
...@@ -60,6 +67,19 @@ WHERE 1=1 AND C.OrderState IN(1) AND D.Status=0 ...@@ -60,6 +67,19 @@ WHERE 1=1 AND C.OrderState IN(1) AND D.Status=0
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.Account_Id), query.Account_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_OrderGuest_ViewModel.Account_Id), query.Account_Id);
} }
if (query.AssistId > 0)
{
builder.AppendFormat(" AND EXISTS(SELECT 1 FROM rb_student_assist WHERE `Status`=0 AND AssistType=4 AND StuId=A.Student_Id AND AssistId={0} ) ", query.AssistId);
}
if (query.CourseId > 0)
{
builder.AppendFormat(" AND C.{0}={1} ", nameof(RB_Order_ViewModel.CourseId), query.CourseId);
}
//课程等级
if (query.CourseRate > 0)
{
builder.AppendFormat(" AND EXISTS(SELECT 1 FROM rb_course_chapter WHERE `Status`=0 AND CourseId=C.CourseId AND CourseRate IN({0}))",(int)query.CourseRate);
}
} }
return Get<RB_Student_OrderGuest_ViewModel>(builder.ToString()).ToList(); return Get<RB_Student_OrderGuest_ViewModel>(builder.ToString()).ToList();
} }
......
...@@ -9,6 +9,7 @@ using Edu.Common.Enum.Course; ...@@ -9,6 +9,7 @@ using Edu.Common.Enum.Course;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Grade; using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Query;
using Edu.Model.ViewModel.Scroll; using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell; using Edu.Model.ViewModel.Sell;
using Edu.Module.Course; using Edu.Module.Course;
...@@ -1067,18 +1068,41 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1067,18 +1068,41 @@ namespace Edu.WebApi.Controllers.Course
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult GetStuLearnChapterList() { public ApiResult GetStuLearnChapterList()
{
var userInfo = base.UserInfo; var userInfo = base.UserInfo;
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString()); RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
if (demodel.StuId <= 0) {
return ApiResult.ParamIsNull("请传递学生ID");
}
demodel.Group_Id = userInfo.Group_Id; demodel.Group_Id = userInfo.Group_Id;
var list = scrollClassModule.GetStuLearnChapterList(demodel); var list = scrollClassModule.GetStuLearnChapterList(demodel);
return ApiResult.Success("", list); return ApiResult.Success("", list);
} }
/// <summary>
/// 获取学员课消统计
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetStuLearnChapterStatic()
{
var userInfo = base.UserInfo;
StuCourseQuery demodel = new StuCourseQuery()
{
TeacherAccountId=base.ParmJObj.GetInt("TeacherAccountId"),
CourseId=base.ParmJObj.GetInt("CourseId"),
CourseRate=(CourseRateEnum)base.ParmJObj.GetInt("CourseRate")
};
//if (demodel.StuId <= 0)
//{
// return ApiResult.ParamIsNull("请传递学生ID");
//}
demodel.Group_Id = userInfo.Group_Id;
var list = scrollClassModule.GetStuLearnChapterStaticModule(demodel);
return ApiResult.Success("", list);
}
#endregion #endregion
} }
} }
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