Commit cc39a28f authored by liudong1993's avatar liudong1993

1预约课再次调整

parent 233adf96
......@@ -131,5 +131,10 @@ namespace Edu.Model.Entity.Course
/// 当前课时(累加计算)
/// </summary>
public double CurrentHours { get; set; }
/// <summary>
/// 课程等级节点
/// </summary>
public int ChapterGradeNo { get; set; }
}
}
......@@ -122,11 +122,6 @@ namespace Edu.Model.Entity.Scroll
/// </summary>
public string CourseETime { get; set; }
/// <summary>
/// 课次等级ID (枚举) 与ChapterNo 组成唯一
/// </summary>
public CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 报名课程ID
/// </summary>
......@@ -141,5 +136,15 @@ namespace Edu.Model.Entity.Scroll
/// 类型 1 正常 2补课 3重上课
/// </summary>
public int AppointType { get; set; }
/// <summary>
/// 课次等级ID (枚举) CourseGradeNo 组成唯一
/// </summary>
public CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 课程等级 对应的章节 与CourseGradeId 组成唯一
/// </summary>
public int CourseGradeNo { get; set; }
}
}
\ No newline at end of file
......@@ -72,5 +72,15 @@ namespace Edu.Model.Entity.Scroll
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 课次等级ID (枚举) CourseGradeNo 组成唯一
/// </summary>
public CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 课程等级 对应的章节 与CourseGradeId 组成唯一
/// </summary>
public int CourseGradeNo { get; set; }
}
}
\ No newline at end of file
......@@ -77,6 +77,11 @@ namespace Edu.Model.ViewModel.Course
/// </summary>
public CourseRateEnum CourseRate { get; set; }
/// <summary>
/// 等级对应节点
/// </summary>
public int ChapterGradeNo { get; set; }
/// <summary>
/// 课程等级名称
/// </summary>
......
......@@ -78,9 +78,9 @@ namespace Edu.Model.ViewModel.Scroll
public Common.Enum.Course.CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 课程章节
/// 课程等级对应章节
/// </summary>
public int CourseChapterNo { get; set; }
public int CourseGradeNo { get; set; }
/// <summary>
/// 预约人数
......
......@@ -3875,7 +3875,7 @@ namespace Edu.Module.Course
});
}
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.ChapterNo, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.CourseGradeId, x.CourseGradeNo, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
......@@ -3889,7 +3889,8 @@ namespace Edu.Module.Course
item.Key.CourseName,
item.Key.RoomName,
item.Key.TeacherName,
Ranks = item.Key.ChapterNo,
Ranks = item.Key.CourseGradeNo,
CourseGradeIdName = item.Key.CourseGradeId.ToName(),
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
TimeStr = Common.ConvertHelper.GetTimeStr(currentDate),
StartTime = STime,
......@@ -4210,7 +4211,7 @@ namespace Edu.Module.Course
}
// 约课
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.ChapterNo, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.CourseGradeNo, x.CourseGradeId, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
......@@ -4225,7 +4226,8 @@ namespace Edu.Module.Course
item.Key.CourseName,
item.Key.RoomName,
item.Key.TeacherName,
Ranks = item.Key.ChapterNo,
Ranks = item.Key.CourseGradeNo,
CourseGradeIdName = item.Key.CourseGradeId.ToName(),
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
TimeStr = Common.ConvertHelper.GetTimeStr(currentDate),
StartTime = STime,
......@@ -4455,7 +4457,7 @@ namespace Edu.Module.Course
}
//约课
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.ChapterNo, x.CourseSTime }).OrderBy(x=> x.Key.CourseSTime).ToList().ForEach(item =>
appointList.Where(x => x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseName, x.CourseGradeNo, x.CourseGradeId, x.CourseSTime }).OrderBy(x=> x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
......@@ -4470,7 +4472,8 @@ namespace Edu.Module.Course
item.Key.CourseName,
item.Key.RoomName,
item.Key.TeacherName,
Ranks = item.Key.ChapterNo,
Ranks = item.Key.CourseGradeNo,
CourseGradeIdName = item.Key.CourseGradeId.ToName(),
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
TimeStr = Common.ConvertHelper.GetTimeStr(currentDate),
StartTime = STime,
......@@ -4678,7 +4681,7 @@ namespace Edu.Module.Course
});
}
appointList.Where(x => x.TeacherId == titem.TId && x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseId, x.CourseName, x.CourseGradeId, x.ChapterNo, x.ShiftSort, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
appointList.Where(x => x.TeacherId == titem.TId && x.Date == ClassDate).GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseId, x.CourseName, x.CourseGradeId, x.CourseGradeNo, x.ShiftSort, x.CourseSTime }).OrderBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
......@@ -4693,7 +4696,7 @@ namespace Edu.Module.Course
item.Key.TeacherName,
item.Key.CourseGradeId,
CourseGradeName = item.Key.CourseGradeId.ToName(),
Ranks = item.Key.ChapterNo,
Ranks = item.Key.CourseGradeNo,
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
StartTime = STime,
EndTime = ETime,
......@@ -4816,7 +4819,7 @@ namespace Edu.Module.Course
});
}
appointList.GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseId, x.CourseName, x.CourseGradeId, x.ChapterNo, x.ShiftSort, x.CourseSTime }).OrderBy(x => x.Key.Date).ThenBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
appointList.GroupBy(x => new { x.Date, x.TeacherId, x.TeacherName, x.RoomId, x.RoomName, x.CourseId, x.CourseName, x.CourseGradeId, x.CourseGradeNo, x.ShiftSort, x.CourseSTime }).OrderBy(x => x.Key.Date).ThenBy(x => x.Key.CourseSTime).ToList().ForEach(item =>
{
//上课时段
string STime = item.FirstOrDefault().CourseSTime ?? "", ETime = item.FirstOrDefault().CourseETime ?? "";
......@@ -4832,12 +4835,13 @@ namespace Edu.Module.Course
ClassRoomId = item.Key.RoomId,
item.Key.RoomName,
item.Key.TeacherName,
Ranks = item.Key.ChapterNo,
Ranks = item.Key.CourseGradeNo,
CourseGradeIdName = item.Key.CourseGradeId.ToName(),
TotalPlanNum = item.FirstOrDefault().TotalChapterNo,
StartTime = STime,
EndTime = ETime,
CompleteProgress = -1,
GuestList = item.Select(qitem => new { GuestName = qitem.StuName, qitem.StuId, AppointmentId = qitem.Id, qitem.AppointType })
GuestList = item.Select(qitem => new { GuestName = qitem.StuName, qitem.StuId, AppointmentId = qitem.Id, qitem.AppointType }),
});
});
}
......
......@@ -593,6 +593,7 @@ namespace Edu.Module.Course
Requirement = subItem.Requirement,
CourseRate = subItem.CourseRate,
CurrentHours = subItem.CurrentHours,
ChapterGradeNo = subItem.ChapterGradeNo
};
//父节点
list.Add(parentModel);
......@@ -791,7 +792,8 @@ namespace Edu.Module.Course
CourseRate = childItem.CourseRate,
StudyMinutes = childItem.StudyMinutes,
CurrentHours = childItem.CurrentHours,
CourseRateName = EnumHelper.ToName(childItem.CourseRate)
CourseRateName = EnumHelper.ToName(childItem.CourseRate),
ChapterGradeNo = childItem.ChapterGradeNo
};
childModel.ChildList.AddRange(GetChapterChild(sourceList, childItem.ChapterId));
resultList.Add(childModel);
......@@ -931,10 +933,30 @@ namespace Edu.Module.Course
{nameof(RB_Course_Chapter_ViewModel.Requirement) ,model.Requirement},
{nameof(RB_Course_Chapter_ViewModel.CourseRate) ,model.CourseRate},
};
Common.Enum.Course.CourseRateEnum oldCourseRate = 0;
if (model.ParentId == 0)
{
fileds.Add(nameof(RB_Course_Chapter_ViewModel.SortNum), Convert.ToDouble(model.ChapterNo));
oldCourseRate = chapterRepository.GetEntity(model.ChapterId)?.CourseRate ?? Common.Enum.Course.CourseRateEnum.OTHER;
}
flag = chapterRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Chapter_ViewModel.ChapterId), model.ChapterId));
if (flag && model.ParentId == 0) {
if (oldCourseRate != model.CourseRate) {
//修改了等级了 重新初始化
System.Threading.Tasks.Task.Run(() =>
{
chapterRepository.SetInitChapterGradeNo(model.CourseId, model.ChapterNo, model.Group_Id);
});
}
}
}
else
{
if (model.ParentId == 0) {
//查询当前等级对应的NO
int CourseGradeId = chapterRepository.GetMaxChapterGradeNo(model.CourseId, model.ChapterNo, model.CourseRate, model.Group_Id);
model.ChapterGradeNo = CourseGradeId + 1;
}
var newId = chapterRepository.Insert(model);
model.ChapterId = newId;
flag = newId > 0;
......
......@@ -226,7 +226,7 @@ namespace Edu.Module.Course
List<int> CancelStuId = new List<int>();
//以老师为单位 遍历
AppointList.GroupBy(x => new { x.Date, x.AccountId, x.WorkUserId,x.TeacherId, x.TeacherName, x.CourseId, x.CourseName, x.ChapterNo, x.ShiftSort, x.CourseTimeId, x.RoomId, x.RoomName, x.RoomSchoolId, x.RoomSchoolName, x.ScrollMinNum }).OrderBy(x=>x.Key.Date).ThenBy(x=>x.Key.ShiftSort).ToList().ForEach(item =>
AppointList.GroupBy(x => new { x.Date, x.AccountId, x.WorkUserId,x.TeacherId, x.TeacherName, x.CourseId, x.CourseName, x.CourseGradeId,x.CourseGradeNo, x.ShiftSort, x.CourseTimeId, x.RoomId, x.RoomName, x.RoomSchoolId, x.RoomSchoolName, x.ScrollMinNum }).OrderBy(x=>x.Key.Date).ThenBy(x=>x.Key.ShiftSort).ToList().ForEach(item =>
{
var CourseTimeList = JsonHelper.DeserializeObject<List<CourseTimeModel>>(item.FirstOrDefault().CourseTime);
string CourseTime = CourseTimeList.Min(x => x.StartTime) + "~" + CourseTimeList.Max(x => x.EndTime);
......@@ -445,7 +445,7 @@ namespace Edu.Module.Course
if (!string.IsNullOrEmpty(item.Key.WorkUserId))
{
var recipientPath = HttpUtility.UrlEncode($"/stu/subscribe");//地址需要后台功能做了之后吧
var content = $"<font color='info'>课程预约成功通知</font>\n>**概要信息** \n>上课日期:<font color='warning'>{item.Key.Date.ToString("yyyy-MM-dd")}</font>\n>上课时段:<font color='warning'>{CourseTime}</font>\n>上课课程:<font color='warning'>{item.Key.CourseName}(第{item.Key.ChapterNo}次课)</font>\n>上课教室:<font color='warning'>{item.Key.RoomName}({item.Key.RoomSchoolName})</font>\n>上课人数:<font color='comment'>{item.Count()}人</font>\n>请 点 击:[查看详情]({Config.ErpUrl}/autologin?loginId={item.Key.AccountId}&target={recipientPath})";
var content = $"<font color='info'>课程预约成功通知</font>\n>**概要信息** \n>上课日期:<font color='warning'>{item.Key.Date.ToString("yyyy-MM-dd")}</font>\n>上课时段:<font color='warning'>{CourseTime}</font>\n>上课课程:<font color='warning'>{item.Key.CourseName}(第{item.FirstOrDefault().ChapterNo}次课)</font>\n>上课教室:<font color='warning'>{item.Key.RoomName}({item.Key.RoomSchoolName})</font>\n>上课人数:<font color='comment'>{item.Count()}人</font>\n>请 点 击:[查看详情]({Config.ErpUrl}/autologin?loginId={item.Key.AccountId}&target={recipientPath})";
PushWorkChatHelper.PushToWorkChat(content, item.Key.WorkUserId, "课程预约成功通知");
}
}
......
This diff is collapsed.
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -42,6 +44,18 @@ namespace Edu.Repository.Course
{
builder.AppendFormat(" AND {0}>='{1}' ", nameof(RB_Course_Chapter_ViewModel.CreateTime), query.QCreateTime);
}
if (query.CourseRate > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Chapter_ViewModel.CourseRate), (int)query.CourseRate);
}
if (query.ChapterGradeNo > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Course_Chapter_ViewModel.ChapterGradeNo), query.ChapterGradeNo);
}
if (!string.IsNullOrEmpty(query.ChapterNo))
{
builder.AppendFormat(" AND {0}='{1}' ", nameof(RB_Course_Chapter_ViewModel.ChapterNo), query.ChapterNo);
}
}
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
......@@ -64,12 +78,12 @@ namespace Edu.Repository.Course
public bool SetBatchInsertCourseChapterRepository(List<RB_Course_Chapter_ViewModel> param)
{
StringBuilder builder = new StringBuilder();
builder.Append("INSERT INTO rb_course_chapter (CourseId, ChapterNo, ChapterName,ChapterContent,ParentId,OpenStatus,Progress,CreateBy,CreateTime,UpdateBy,UpdateTime,Status,School_Id,Group_Id,SortNum,StudyHours,Objectives,Requirement,CourseRate,StudyMinutes,CurrentHours) VALUES");
builder.Append("INSERT INTO rb_course_chapter (CourseId, ChapterNo, ChapterName,ChapterContent,ParentId,OpenStatus,Progress,CreateBy,CreateTime,UpdateBy,UpdateTime,Status,School_Id,Group_Id,SortNum,StudyHours,Objectives,Requirement,CourseRate,StudyMinutes,CurrentHours,ChapterGradeNo) VALUES");
param.ForEach(x =>
{
var newChapterNo = x.ChapterNo.Replace(".", "");
double.TryParse(newChapterNo, out double SortNum);
builder.Append($"({x.CourseId},'{x.ChapterNo}','{x.ChapterName}','{x.ChapterContent}',{x.ParentId},{x.OpenStatus},{x.Progress},{x.CreateBy},'{x.CreateTime}',{x.UpdateBy},'{x.UpdateTime}',{(int)x.Status},{x.School_Id},{x.Group_Id},{x.SortNum},{x.StudyHours},'{x.Objectives}','{x.Requirement}',{(int)x.CourseRate},{x.StudyMinutes},{x.CurrentHours}),");
builder.Append($"({x.CourseId},'{x.ChapterNo}','{x.ChapterName}','{x.ChapterContent}',{x.ParentId},{x.OpenStatus},{x.Progress},{x.CreateBy},'{x.CreateTime}',{x.UpdateBy},'{x.UpdateTime}',{(int)x.Status},{x.School_Id},{x.Group_Id},{x.SortNum},{x.StudyHours},'{x.Objectives}','{x.Requirement}',{(int)x.CourseRate},{x.StudyMinutes},{x.CurrentHours},{x.ChapterGradeNo}),");
});
builder = builder.Remove(builder.Length - 1, 1);
return base.Execute(builder.ToString()) > 0;
......@@ -204,5 +218,38 @@ namespace Edu.Repository.Course
}
return Get<RB_Course_Chapter_ViewModel>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取当前章节对应的最大的等级节点
/// </summary>
/// <param name="courseId"></param>
/// <param name="chapterNo"></param>
/// <param name="courseRate"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public int GetMaxChapterGradeNo(int courseId, string chapterNo, CourseRateEnum courseRate, int group_Id)
{
string sql = $@"SELECT MAX(ChapterGradeNo) ChapterGradeNo FROM rb_course_chapter where Group_Id ={group_Id} and CourseId ={courseId} and ChapterNo <={chapterNo} and CourseRate ={(int)courseRate}";
var robj = ExecuteScalar(sql);
return robj == null ? 0 : Convert.ToInt32(robj);
}
/// <summary>
/// 更新课程等级对应节点
/// </summary>
/// <param name="courseId"></param>
/// <param name="chapterNo"></param>
/// <param name="group_Id"></param>
public void SetInitChapterGradeNo(int courseId, string chapterNo, int group_Id)
{
string sql = $@"UPDATE rb_course_chapter cc
LEFT JOIN (
SELECT c.ChapterId,c.CourseId,c.ChapterNo,c.SortNum,c.CourseRate
,(SELECT COUNT(0) as Num FROM rb_course_chapter c2 WHERE c2.`Status` =0 and c2.CourseId = c.CourseId and c2.CourseRate = c.CourseRate and c2.SortNum <= c.SortNum) AS GrageNum
FROM rb_course_chapter c WHERE c.`Status` =0 and c.CourseId ={courseId}) cc2 on cc.ChapterId =cc2.ChapterId
SET cc.ChapterGradeNo = cc2.GrageNum
WHERE cc.Group_Id ={group_Id} and cc.CourseId ={courseId} and cc.ChapterNo >={chapterNo}";
Execute(sql);
}
}
}
\ No newline at end of file
......@@ -52,6 +52,10 @@ namespace Edu.Repository.Scroll
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
}
if (demodel.GuestId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.GuestId)} ={demodel.GuestId}";
}
if (!string.IsNullOrEmpty(demodel.StuIds))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} in({demodel.StuIds})";
......@@ -77,9 +81,9 @@ ORDER BY r.Id asc ";
/// <param name="stuId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Scroll_Appointment_ViewModel GetMyAppointmentNum(int stuId, int group_Id)
public RB_Scroll_Appointment_ViewModel GetMyAppointmentNum(int stuId, int guestId, int group_Id)
{
string sql = $@"SELECT MAX(Date) AS Date, COUNT(0) as ScrollMinNum FROM rb_scroll_appointment WHERE `Status` =0 and State <>5 and CourseEndTime >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' and Group_Id ={group_Id} and StuId ={stuId} HAVING COUNT(0) >0";
string sql = $@"SELECT MAX(Date) AS Date, COUNT(0) as ScrollMinNum FROM rb_scroll_appointment WHERE `Status` =0 and State <>5 and CourseEndTime >='{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' and Group_Id ={group_Id} and StuId ={stuId} and GuestId ={guestId} HAVING COUNT(0) >0";
return Get<RB_Scroll_Appointment_ViewModel>(sql).FirstOrDefault();
}
......@@ -174,6 +178,10 @@ ORDER BY r.Id desc ";
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
}
if (demodel.GuestId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.GuestId)} ={demodel.GuestId}";
}
if (!string.IsNullOrEmpty(demodel.StuIds))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} in({demodel.StuIds})";
......@@ -198,6 +206,10 @@ ORDER BY r.Id desc ";
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseGradeId)} ={(int)demodel.CourseGradeId}";
}
if (demodel.CourseGradeNo > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseGradeNo)} ={demodel.CourseGradeNo}";
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} >='{demodel.StartTime}'";
......@@ -254,9 +266,13 @@ ORDER BY r.Id desc ";
/// <param name="groupId"></param>
public void UpdateAppointSkipCourse(int stuId, int guestId, int ChapterNum,int SChapterNo, int groupId)
{
string sql = $@"UPDATE rb_scroll_appointment SET ChapterNo = ChapterNo +{ChapterNum} WHERE Group_Id ={groupId} and StuId ={stuId} and GuestId ={guestId} ";
//string sql = $@"UPDATE rb_scroll_appointment SET ChapterNo = ChapterNo +{ChapterNum} WHERE Group_Id ={groupId} and StuId ={stuId} and GuestId ={guestId} ";
string sql = $@"UPDATE rb_scroll_appointment a
SET a.ChapterNo = a.ChapterNo +{ChapterNum},a.CourseGradeId = (SELECT CourseRate FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
,a.CourseGradeNo = (SELECT ChapterGradeNo FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
WHERE a.Group_Id ={groupId} and a.StuId ={stuId} and a.GuestId ={guestId}";
if (SChapterNo > 0) {
sql += $@" and ChapterNo >={SChapterNo}";
sql += $@" and a.ChapterNo >={SChapterNo}";
}
Execute(sql);
}
......@@ -269,11 +285,11 @@ ORDER BY r.Id desc ";
/// <param name="courseGradeId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Scroll_Appointment_ViewModel> GetCanAppointmentAgainList(string stuName, int chapterNo, int courseGradeId, int group_Id)
public List<RB_Scroll_Appointment_ViewModel> GetCanAppointmentAgainList(string stuName, int courseGradeNo, int courseGradeId, int group_Id)
{
string sql = $@"SELECT a.Id,a.StuId,a.GuestId,a.OrderId,a.CourseId,s.StuName FROM rb_scroll_appointment a
LEFT JOIN rb_student s on a.StuId = s.StuId
WHERE a.Group_Id ={group_Id} and a.State =3 and a.AppointType =1 and a.ChapterNo ={chapterNo} and a.courseGradeId ={courseGradeId} and s.StuName LIKE '%{stuName}%'
WHERE a.Group_Id ={group_Id} and a.State =3 and a.AppointType =1 and a.CourseGradeNo ={courseGradeNo} and a.CourseGradeId ={courseGradeId} and s.StuName LIKE '%{stuName}%'
ORDER BY a.OrderId DESC";
return Get<RB_Scroll_Appointment_ViewModel>(sql).ToList();
}
......
......@@ -48,6 +48,14 @@ namespace Edu.Repository.Scroll
{
where += $@" and r.{nameof(RB_Scroll_SkipCourse_ViewModel.State)} ={demodel.State}";
}
if (demodel.CourseGradeNo > 0)
{
where += $@" and r.{nameof(RB_Scroll_SkipCourse_ViewModel.CourseGradeNo)} ={demodel.CourseGradeNo}";
}
if (demodel.CourseGradeId > 0)
{
where += $@" and r.{nameof(RB_Scroll_SkipCourse_ViewModel.CourseGradeId)} ={(int)demodel.CourseGradeId}";
}
string sql = $@"
......
......@@ -472,7 +472,7 @@ FROM
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT ar.AccountRemark,A.Id,A.Account,A.Password,A.AccountId,A.WorkUserId,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.IDCard,A.Sex,A.Education,A.EntryTime,A.Address,A.BirthDate
SELECT ar.AccountRemark,A.Id,A.Account,A.Password,A.AccountId,A.WorkUserId,A.IsWorkTransfer,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.IDCard,A.Sex,A.Education,A.EntryTime,A.Address,A.BirthDate
,A.LeaveStatus,A.LeaveTime,A.EmployeeTel,A.AccountType,A.Email,A.BaseHourFee,A.BaseHoursEnabled,A.EnableTime,IFNULL(A.DirectSupervisor,0) AS DirectSupervisor
,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptId,0) AS Dept_Id,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostId,0) AS Post_Id, IFNULL(p.PostName,'') AS PostName
......@@ -482,7 +482,7 @@ SELECT ar.AccountRemark,A.Id,A.Account,A.Password,A.AccountId,A.WorkUserId,A.Gro
ELSE 0 END) IsBirth,A.UserRole,A.IsTenCccUser
FROM
(
SELECT A.Id,A.Account,A.`Password`, 1 as AccountType,B.MId as AccountId,A.WorkUserId
SELECT A.Id,A.Account,A.`Password`, 1 as AccountType,B.MId as AccountId,A.WorkUserId,A.IsWorkTransfer
,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,A.`Status`,A.AnnualLeaveDay,A.DirectSupervisor
,b.School_Id,IFNULL(B.MName,'') AS EmployeeName,B.MHead AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
......@@ -491,7 +491,7 @@ FROM
FROM rb_manager AS B LEFT JOIN rb_account AS A ON A.AccountId=B.MId AND A.AccountType=1
WHERE 1=1 {0} {1}
UNION ALL
SELECT A.Id,A.Account,A.`Password`, 2 as AccountType,B.TId as AccountId,A.WorkUserId
SELECT A.Id,A.Account,A.`Password`, 2 as AccountType,B.TId as AccountId,A.WorkUserId,A.IsWorkTransfer
,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,A.`Status`,A.AnnualLeaveDay,A.DirectSupervisor
,b.School_Id,IFNULL(B.TeacherName,'') AS EmployeeName,B.TeacherIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
......@@ -500,7 +500,7 @@ FROM
FROM rb_teacher AS B LEFT JOIN rb_account AS A ON A.AccountId=B.TId AND A.AccountType=2
WHERE 1=1 {0} {2}
UNION ALL
SELECT A.Id,A.Account,A.`Password`, 3 as AccountType,B.AId as AccountId,A.WorkUserId
SELECT A.Id,A.Account,A.`Password`, 3 as AccountType,B.AId as AccountId,A.WorkUserId,A.IsWorkTransfer
,A.CreateBy,A.CreateTime,A.UpdateBy,A.UpdateTime,A.Group_Id,A.`Status`,A.AnnualLeaveDay,A.DirectSupervisor
,b.School_Id,IFNULL(B.AssistName,'') AS EmployeeName,B.AssistIcon AS UserIcon,B.Dept_Id,B.Post_Id,B.IDCard
,B.Sex,B.Education,B.EntryTime,B.Address,B.BirthDate
......
......@@ -786,23 +786,20 @@ GROUP BY s.StuId order by s.StuId desc";
/// <param name="courseId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuList(int courseId, int NextChapterNo, int CourseGradeId, int SchoolId, int group_Id)
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuList(int courseId, int NextChapterGradeNo, int CourseGradeId, int SchoolId, int group_Id)
{
string sql = $@"SELECT sog.Student_Id,sog.GuestId,s.StuName as GuestName,og.CourseChapterNo,DATE_FORMAT(sa.Date,'%Y-%m-%d') as AppointDate,sa.AppointNum FROM rb_student_orderguest sog
INNER JOIN rb_order_guest og on sog.GuestId = og.Id
INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_student s on sog.Student_Id = s.StuId
INNER JOIN rb_class c on o.ClassId = c.ClassId
inner join rb_course_chapter cc on o.CourseId = cc.CourseId and cc.ParentId =0 and cc.ChapterNo ='{NextChapterNo}' and cc.CourseRate ={CourseGradeId}
inner join rb_course_chapter cc on o.CourseId = cc.CourseId and cc.ParentId =0 and cc.ChapterGradeNo ='{NextChapterGradeNo}' and cc.CourseRate ={CourseGradeId}
LEFT JOIN (
SELECT StuId,MAX(Date) AS Date, COUNT(0) as AppointNum FROM rb_scroll_appointment
WHERE `Status` =0 and State <>5 and CourseEndTime >=NOW() and Group_Id ={group_Id} GROUP BY StuId
) sa on sog.Student_Id = sa.StuId
WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState <>2 and o.OrderState <>3 and c.ClassScrollType =2
and og.TotalChapterNo > og.CourseChapterNo ";
if (NextChapterNo > 0) {
sql += $@" and (og.CourseChapterNo + 1 + IFNULL(sa.AppointNum,0)) ={NextChapterNo}";
}
and og.TotalChapterNo > og.CourseChapterNo and (og.CourseChapterNo + 1 + IFNULL(sa.AppointNum,0)) =cc.ChapterNo";
if (SchoolId >= 0) {
sql += $@" and o.ScrollSchoolId ={SchoolId}";
}
......
......@@ -293,10 +293,15 @@ namespace Edu.WebApi.Controllers.Course
{
var userInfo = base.UserInfo;
int CourseId = base.ParmJObj.GetInt("CourseId", 0);//课程ID
int NextChapterNo = base.ParmJObj.GetInt("NextChapterNo", 1);//下一次课
int CourseGradeId = base.ParmJObj.GetInt("CourseGradeId", 0);//上课等级ID
int NextCourseGradeNo = base.ParmJObj.GetInt("NextCourseGradeNo", 0);//上课等级ID对应的课次
int SchoolId = base.ParmJObj.GetInt("SchoolId", -1);//约课校区
var list = scrollClassModule.GetCanAppointmentStuList(CourseId, NextChapterNo, CourseGradeId, SchoolId, userInfo.Group_Id);
if (CourseGradeId <= 0 || NextCourseGradeNo <= 0)
{
return ApiResult.ParamIsNull();
}
var list = scrollClassModule.GetCanAppointmentStuList(CourseId, NextCourseGradeNo, CourseGradeId, SchoolId, userInfo.Group_Id);
return ApiResult.Success("", list.Select(x => new
{
StuId = x.Student_Id,
......@@ -342,10 +347,6 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递老师编号ID");
}
if (demodel.Date <= DateTime.Now)
{
return ApiResult.ParamIsNull("预约日期有误");
}
if (string.IsNullOrEmpty(demodel.ShiftSort))
{
return ApiResult.ParamIsNull("请传递上课时段");
......@@ -553,12 +554,14 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost]
public ApiResult GetCanMakeupStuList() {
var userInfo = base.UserInfo;
int ChapterNo = base.ParmJObj.GetInt("ChapterNo", 0);
if (ChapterNo <= 0) {
int CourseGradeNo = base.ParmJObj.GetInt("CourseGradeNo", 0);
int CourseGradeId = base.ParmJObj.GetInt("CourseGradeId", 0);
if (CourseGradeNo <= 0 || CourseGradeId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = scrollClassModule.GetCanMakeupStuList(ChapterNo, userInfo);
var list = scrollClassModule.GetCanMakeupStuList(CourseGradeNo, CourseGradeId, userInfo);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
......@@ -582,10 +585,6 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递老师编号ID");
}
if (demodel.Date <= DateTime.Now)
{
return ApiResult.ParamIsNull("预约日期有误");
}
if (string.IsNullOrEmpty(demodel.ShiftSort))
{
return ApiResult.ParamIsNull("请传递上课时段");
......@@ -598,7 +597,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递学生ID");
}
if (demodel.ChapterNo <= 0)
if (demodel.CourseGradeId <= 0 || demodel.CourseGradeNo <=0)
{
return ApiResult.ParamIsNull("请传递上课章节");
}
......@@ -644,13 +643,13 @@ namespace Edu.WebApi.Controllers.Course
public ApiResult GetCanAppointmentAgainList() {
var userInfo = base.UserInfo;
string StuName = base.ParmJObj.GetStringValue("StuName");//学生名称 模糊查询
int ChapterNo = base.ParmJObj.GetInt("ChapterNo", 0);
int CourseGradeId = base.ParmJObj.GetInt("CourseGradeId", 0);
if (string.IsNullOrEmpty(StuName) || ChapterNo <= 0 || CourseGradeId <= 0) {
int CourseGradeNo = base.ParmJObj.GetInt("CourseGradeNo", 0);//课程等级对应的章节
int CourseGradeId = base.ParmJObj.GetInt("CourseGradeId", 0);//课程等级
if (string.IsNullOrEmpty(StuName) || CourseGradeNo <= 0 || CourseGradeId <= 0) {
return ApiResult.ParamIsNull();
}
var list = scrollClassModule.GetCanAppointmentAgainList(StuName, ChapterNo, CourseGradeId, userInfo);
var list = scrollClassModule.GetCanAppointmentAgainList(StuName, CourseGradeNo, CourseGradeId, userInfo);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
......@@ -675,10 +674,6 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递老师编号ID");
}
if (demodel.Date <= DateTime.Now)
{
return ApiResult.ParamIsNull("预约日期有误");
}
if (string.IsNullOrEmpty(demodel.ShiftSort))
{
return ApiResult.ParamIsNull("请传递上课时段");
......@@ -691,7 +686,7 @@ namespace Edu.WebApi.Controllers.Course
{
return ApiResult.ParamIsNull("请传递学生ID");
}
if (demodel.ChapterNo <= 0)
if (demodel.CourseGradeNo <= 0 || demodel.CourseGradeId <=0)
{
return ApiResult.ParamIsNull("请传递上课章节");
}
......
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