Commit bc2ba96c authored by 黄奎's avatar 黄奎

查询调整

parent c6384eab
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.User
{
/// <summary>
/// 学员上课考勤方式
/// </summary>
public enum AttendanceMethodEnum
{
/// <summary>
/// 线下
/// </summary>
[EnumField("线下")]
Offline = 1,
/// <summary>
/// 线上
/// </summary>
[EnumField("线上")]
Online = 2,
/// <summary>
/// 录播
/// </summary>
[EnumField("录播")]
Video = 3,
}
}
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
<NoWarn>$(NoWarn);NETSDK1138</NoWarn> <NoWarn>$(NoWarn);NETSDK1138</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="ViewModel\Scroll\ScheduleResult.cs~RF5a2d34.TMP" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="VT.FW" Version="1.0.1" /> <PackageReference Include="VT.FW" Version="1.0.1" />
</ItemGroup> </ItemGroup>
......
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Common.Enum.User;
using System; using System;
using VT.FW.DB; using VT.FW.DB;
...@@ -98,5 +99,11 @@ namespace Edu.Model.Entity.Grade ...@@ -98,5 +99,11 @@ namespace Edu.Model.Entity.Grade
/// 补课状态(1-正常,2-可补课,3-不可补课, 4-未处理) /// 补课状态(1-正常,2-可补课,3-不可补课, 4-未处理)
/// </summary> /// </summary>
public int MakeUpStatus { get; set; } public int MakeUpStatus { get; set; }
}
/// <summary>
/// 上课方式(1-线下;2-线上;3-录播)
/// </summary>
public AttendanceMethodEnum AttendanceMethod { get; set; }
}
} }
using Edu.Common.Enum; using Edu.Common.Enum.Course;
using Edu.Common.Enum.Course;
using System; using System;
using VT.FW.DB; using VT.FW.DB;
......
...@@ -246,5 +246,30 @@ namespace Edu.Model.Entity.Sell ...@@ -246,5 +246,30 @@ namespace Edu.Model.Entity.Sell
/// 课时单价 (应收总金额-教材费-课件费)/总课时 2024-08-26 add by:W /// 课时单价 (应收总金额-教材费-课件费)/总课时 2024-08-26 add by:W
/// </summary> /// </summary>
public decimal ClassUnitPrice { get; set; } public decimal ClassUnitPrice { get; set; }
/// <summary>
/// 排课状态(0-正常排课,1-暂停排课)
/// </summary>
public int ScheduleStatus { get; set; }
/// <summary>
/// 暂停排课截止日期
/// </summary>
public DateTime StopDeadline { get; set; }
/// <summary>
/// 排课备注
/// </summary>
public string ScheduleRemark { get; set; }
/// <summary>
/// 授课方式(1-线上;2-线下;3-录播)
/// </summary>
public int TeachingMethod { get; set; }
/// <summary>
/// 学管备注
/// </summary>
public string XGRemark { get; set; }
} }
} }
...@@ -277,5 +277,10 @@ namespace Edu.Model.ViewModel.Grade ...@@ -277,5 +277,10 @@ namespace Edu.Model.ViewModel.Grade
/// 学生ID /// 学生ID
/// </summary> /// </summary>
public int StuId { get; set; } public int StuId { get; set; }
/// <summary>
/// 上课计划ID
/// </summary>
public int ClassPlanId { get; set; }
} }
} }
...@@ -16,9 +16,57 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -16,9 +16,57 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary> /// </summary>
public CourseRateEnum QCourseRate { get; set; } public CourseRateEnum QCourseRate { get; set; }
/// <summary>
/// 班主任
/// </summary>
public int QHeadMasterId { get; set; }
/// <summary>
/// 结课状态(1-正常,7-毕业)
/// </summary>
public int QGuestState { get; set; }
/// <summary>
/// 排课状态 0-正常, 1-暂停排课
/// </summary>
public int QScheduleStatus { get; set; } = -1;
/// <summary>
/// 上课方式 (1-线下,2-线上,3-录播)
/// </summary>
public int QTeachingMethod { get; set; }
/// <summary>
/// 学员姓名
/// </summary>
public string QGuestName { get; set; }
/// <summary> /// <summary>
/// 集团编号 /// 集团编号
/// </summary> /// </summary>
public int Group_Id { get; set; } public int Group_Id { get; set; }
} }
/// <summary>
/// 约课签到查询条件
/// </summary>
[Serializable]
public class ScrollAppointmentQuery
{
/// <summary>
/// 开始日期
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public string EndDate { get; set; }
/// <summary>
/// 学员名称
/// </summary>
public string GuestName { get; set; }
}
} }
using Edu.Common.Enum.Course; using Edu.Common.Enum.Course;
using Edu.Common.Enum.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using VT.FW.DB;
namespace Edu.Model.ViewModel.Scroll namespace Edu.Model.ViewModel.Scroll
{ {
...@@ -8,6 +10,7 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -8,6 +10,7 @@ namespace Edu.Model.ViewModel.Scroll
/// 排课返回实体类 /// 排课返回实体类
/// </summary> /// </summary>
[Serializable] [Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class SchedulePlanResult public class SchedulePlanResult
{ {
/// <summary> /// <summary>
...@@ -15,6 +18,11 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -15,6 +18,11 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary> /// </summary>
public int GuestId { get; set; } public int GuestId { get; set; }
/// <summary>
/// 学员表ID
/// </summary>
public int StuId { get; set; }
/// <summary> /// <summary>
/// 订单编号 /// 订单编号
/// </summary> /// </summary>
...@@ -94,6 +102,16 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -94,6 +102,16 @@ namespace Edu.Model.ViewModel.Scroll
/// VIP总课次 /// VIP总课次
/// </summary> /// </summary>
public int TotalTimes { get; set; } public int TotalTimes { get; set; }
/// <summary>
/// 停止排课截止时间
/// </summary>
public DateTime StopDeadline { get; set; }
/// <summary>
/// 排课备注
/// </summary>
public string ScheduleRemark { get; set; }
} }
...@@ -101,6 +119,7 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -101,6 +119,7 @@ namespace Edu.Model.ViewModel.Scroll
/// 课程项目 /// 课程项目
/// </summary> /// </summary>
[Serializable] [Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class PCourseItem public class PCourseItem
{ {
/// <summary> /// <summary>
...@@ -143,5 +162,82 @@ namespace Edu.Model.ViewModel.Scroll ...@@ -143,5 +162,82 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary> /// </summary>
public decimal CurrentDeductionHours { get; set; } public decimal CurrentDeductionHours { get; set; }
} }
/// <summary>
/// 约课签到查询结果
/// </summary>
[Serializable]
public class ScrollAppointmentResult
{
/// <summary>
/// 约课日期
/// </summary>
public DateTime Date { get; set; }
/// <summary>
/// 上课老师ID
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// 老师
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 学员ID
/// </summary>
public int GuestId { get; set; }
/// <summary>
/// 学员姓名
/// </summary>
public string GuestName { get; set; }
/// <summary>
/// 消课课程ID
/// </summary>
public int LearnCourseId { get; set; }
/// <summary>
/// 消课章节
/// </summary>
public int CourseGradeNo { get; set; }
/// <summary>
/// 生成上课计划Id
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 上课开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 上课结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 签到ID
/// </summary>
public int ClassCheckId { get; set; }
/// <summary>
/// 考勤方式
/// </summary>
public AttendanceMethodEnum AttendanceMethod { get; set; }
}
} }
...@@ -2093,12 +2093,7 @@ namespace Edu.Module.Course ...@@ -2093,12 +2093,7 @@ namespace Edu.Module.Course
/// <returns></returns> /// <returns></returns>
public virtual async Task<bool> AddClassCheckModule(List<RB_Class_Check_ViewModel> list) public virtual async Task<bool> AddClassCheckModule(List<RB_Class_Check_ViewModel> list)
{ {
bool flag = classCheckRepository.StudentCheckRepository(list,1); bool flag = classCheckRepository.StudentCheckRepository(list);
//if (MessageCenterHub.GlobalContext != null)
//{
// //通知教室端签到更新
// await MessageCenterHub.GlobalContext.Clients.All.SendAsync("UpdateCheckin", "666");
//}
return flag; return flag;
} }
......
using Edu.Model.ViewModel.Scroll; using Edu.Model.Entity.Grade;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Question;
using Edu.Model.ViewModel.Scroll;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.Course;
using Edu.Repository.Grade;
using Edu.Repository.Scroll; using Edu.Repository.Scroll;
using Edu.Repository.Sell;
using Edu.Repository.User; using Edu.Repository.User;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB;
namespace Edu.Module.Course namespace Edu.Module.Course
{ {
...@@ -19,6 +29,9 @@ namespace Edu.Module.Course ...@@ -19,6 +29,9 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
private ScheduleCourseRepository scheduleCourseRepository = new ScheduleCourseRepository(); private ScheduleCourseRepository scheduleCourseRepository = new ScheduleCourseRepository();
private RB_AccountRepository accountRepository = new RB_AccountRepository(); private RB_AccountRepository accountRepository = new RB_AccountRepository();
private RB_Order_GuestRepository guestRepository = new RB_Order_GuestRepository();
private RB_Class_CheckRepository checkRepository = new RB_Class_CheckRepository();
private RB_CourseRepository courseRepository = new RB_CourseRepository();
/// <summary> /// <summary>
/// 排课计划表 /// 排课计划表
...@@ -62,5 +75,138 @@ namespace Edu.Module.Course ...@@ -62,5 +75,138 @@ namespace Edu.Module.Course
} }
return list; return list;
} }
/// <summary>
/// 修改学员,排课状态
/// </summary>
/// <param name="GuestId"></param>
/// <param name="ScheduleStatus"></param>
/// <returns></returns>
public bool SetGuestScheduleStatusModule(int GuestId, int ScheduleStatus,string ScheduleRemark,DateTime StopDeadline)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>
{
{nameof(RB_Order_Guest_Extend.ScheduleStatus),ScheduleStatus },
{nameof(RB_Order_Guest_Extend.ScheduleRemark),ScheduleRemark },
};
if (ScheduleStatus == 0)
{
fileds.Add(nameof(RB_Order_Guest_Extend.StopDeadline),null);
}
else if (ScheduleStatus == 1)
{
fileds.Add(nameof(RB_Order_Guest_Extend.StopDeadline), StopDeadline);
}
flag = guestRepository.Update(fileds, new WhereHelper(nameof(RB_Order_Guest_Extend.Id), GuestId));
return flag;
}
/// <summary>
/// 修改学员,学管备注
/// </summary>
/// <param name="GuestId"></param>
/// <param name="ScheduleStatus"></param>
/// <param name="XGRemark"></param>
/// <returns></returns>
public bool SetGuestRemarkModule(int GuestId, string XGRemark)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>
{
{nameof(RB_Order_Guest_Extend.XGRemark),XGRemark },
};
flag = guestRepository.Update(fileds, new WhereHelper(nameof(RB_Order_Guest_Extend.Id), GuestId));
return flag;
}
/// <summary>
/// 修改学员授课方式
/// </summary>
/// <param name="GuestId"></param>
/// <param name="TeachingMethod"></param>
/// <returns></returns>
public bool SetGuestTeachingMethodModule(int GuestId, int TeachingMethod)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Order_Guest_Extend.TeachingMethod),TeachingMethod }
};
flag = guestRepository.Update(fileds, new WhereHelper(nameof(RB_Order_Guest_Extend.Id), GuestId));
return flag;
}
/// <summary>
/// 取消学员签到
/// </summary>
/// <param name="GuestId">学员ID</param>
/// <returns></returns>
public bool CancelGuestCheckModule(int GuestId)
{
bool flag = false;
var list= checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { OrderGuestId = GuestId });
return flag;
}
/// <summary>
/// 修改学员上课方式
/// </summary>
/// <param name="ClassCheckId">学员ID</param>
/// <param name="AttendanceMethod">上课方式(1-线上;2-线下;3-录播)</param>
/// <returns></returns>
public bool SetGuestCheckStyleModule(int ClassCheckId, int AttendanceMethod)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Class_Check.AttendanceMethod), AttendanceMethod}
};
flag = checkRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Check.ClassCheckId), ClassCheckId));
return flag;
}
/// <summary>
/// 获取约课学员签到列表
/// </summary>
/// <returns></returns>
public List<ScrollAppointmentResult> GetAppointStuListModule(int pageIndex, int pageSize, out long rowsCount, ScrollAppointmentQuery query)
{
var list = scheduleCourseRepository.ScrollAppointmentCheckPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>();
string accountIds = string.Join(",", list.Select(qitem => qitem.AccountId).Distinct());
string courseIds = string.Join(",", list.Select(qitem => qitem.LearnCourseId).Distinct());
string minDate = Common.ConvertHelper.FormatDate(list.Min(qitem => qitem.Date));
string maxDate = Common.ConvertHelper.FormatDate(list.Max(qitem => qitem.Date));
string guestIds = string.Join(",", list.Select(qitem => qitem.GuestId).Distinct());
if (!string.IsNullOrEmpty(accountIds))
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = accountIds });
}
if (!string.IsNullOrEmpty(courseIds))
{
courseList = courseRepository.GetCourseListRepository(new Model.ViewModel.Course.RB_Course_ViewModel() { QCourseIds = courseIds });
}
var checkList= checkRepository.GetClassCheckList(new Model.ViewModel.Grade.RB_Class_Check_ViewModel() { QOrderGuestIds = guestIds, StartDate = minDate, EndDate = maxDate });
foreach (var item in list)
{
item.TeacherName = empList?.FirstOrDefault(qitem => qitem.Id == item.AccountId)?.EmployeeName ?? "";
item.CourseName = courseList?.FirstOrDefault(qitem => qitem.CourseId == item.LearnCourseId)?.CourseName ?? "";
var tempCheck = checkList?.FirstOrDefault(qitem => qitem.ClassPlanId == item.ClassPlanId);
item.ClassCheckId = tempCheck?.ClassCheckId ?? 0;
if (tempCheck != null)
{
item.AttendanceMethod = tempCheck.AttendanceMethod;
}
}
}
return list;
}
} }
} }
using System; using Edu.Common.Enum.System;
using System.Collections.Generic; using Edu.Common.Plugin;
using System.Linq;
using System.Text;
using Edu.Common.Enum.Course;
using Edu.Common.Enum.System;
using System.Web;
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.Scroll;
using Edu.Model.ViewModel.Sell; using Edu.Model.ViewModel.Sell;
using Spire.Pdf.Exporting.XPS.Schema; using Edu.Model.ViewModel.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using VT.FW.DB; using VT.FW.DB;
using VT.FW.DB.Dapper; using VT.FW.DB.Dapper;
using Edu.Model.Entity.Sell;
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using Org.BouncyCastle.Bcpg.OpenPgp;
using Castle.Core.Internal;
using Edu.Model.ViewModel.Scroll;
using Edu.Common.Plugin;
using System.Text.RegularExpressions;
namespace Edu.Repository.Grade namespace Edu.Repository.Grade
{ {
...@@ -52,10 +45,7 @@ WHERE 1=1 AND A.Status=0 "); ...@@ -52,10 +45,7 @@ WHERE 1=1 AND A.Status=0 ");
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.Group_Id), query.Group_Id); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.Group_Id), query.Group_Id);
} }
if (query.School_Id > 0)
{
//builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.School_Id), query.School_Id);
}
if (query.ClassId > 0) if (query.ClassId > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.ClassId), query.ClassId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.ClassId), query.ClassId);
...@@ -267,7 +257,10 @@ GROUP BY A.ClassId ...@@ -267,7 +257,10 @@ GROUP BY A.ClassId
public List<RB_Class_Check_ViewModel> GetClassCheckList(RB_Class_Check_ViewModel query) public List<RB_Class_Check_ViewModel> GetClassCheckList(RB_Class_Check_ViewModel query)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT A.* FROM RB_Class_Check AS A WHERE 1=1 "); builder.AppendFormat(@"
SELECT A.*,IFNULL(B.ClassPlanId,0) AS ClassPlanId
FROM RB_Class_Check AS A LEFT JOIN rb_class_time AS B ON A.ClassTimeId = B.ClassTimeId
WHERE 1=1 ");
if (query != null) if (query != null)
{ {
if (query.Group_Id > 0) if (query.Group_Id > 0)
...@@ -950,9 +943,8 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString ...@@ -950,9 +943,8 @@ WHERE 1=1 AND A.Status=0 {1} ", builderMakeUp.ToString(), builderWhere.ToString
/// 班课学员签到 /// 班课学员签到
/// </summary> /// </summary>
/// <param name="list">学员信息</param> /// <param name="list">学员信息</param>
/// <param name="CheckType">1-班课,2-约课</param>
/// <returns></returns> /// <returns></returns>
public bool StudentCheckRepository(List<RB_Class_Check_ViewModel> list,int CheckType) public bool StudentCheckRepository(List<RB_Class_Check_ViewModel> list)
{ {
bool flag = false; bool flag = false;
List<RB_Order_Guest_Extend> guestList = new List<RB_Order_Guest_Extend>(); List<RB_Order_Guest_Extend> guestList = new List<RB_Order_Guest_Extend>();
......
...@@ -5,6 +5,7 @@ using System; ...@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Scroll namespace Edu.Repository.Scroll
{ {
...@@ -20,16 +21,18 @@ namespace Edu.Repository.Scroll ...@@ -20,16 +21,18 @@ namespace Edu.Repository.Scroll
/// <returns></returns> /// <returns></returns>
public List<SchedulePlanResult> GetScheduleCourseStuListRepository(ScheduleQuery query) public List<SchedulePlanResult> GetScheduleCourseStuListRepository(ScheduleQuery query)
{ {
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.Id AS GuestId,A.OrderId,A.GuestName,A.GuestState,IFNULL(B.EnterID,0) AS EnterID,IFNULL(D.AssistId,0) AS HeadMasterId,B.CourseId,A.TotalHours AS TotalTimes SELECT A.Id AS GuestId,A.OrderId,A.GuestName,A.GuestState,IFNULL(B.EnterID,0) AS EnterID,IFNULL(D.AssistId,0) AS HeadMasterId,B.CourseId,A.TotalHours AS TotalTimes
,IFNULL(cs.CourseName,'') AS CourseName,IFNULL(cs.CourseRate,0) AS CourseRate ,IFNULL(cs.CourseName,'') AS CourseName,IFNULL(cs.CourseRate,0) AS CourseRate,IFNULL(A.ScheduleStatus,0) AS ScheduleStatus,IFNULL(A.TeachingMethod,0) AS TeachingMethod
,IFNULL(A.XGRemark,'') AS XGRemark,A.StopDeadline,IFNULL(A.ScheduleRemark,'') AS ScheduleRemark,C.Student_Id AS StuId
FROM rb_order_guest AS A INNER JOIN RB_Order AS B ON A.OrderId=B.OrderId FROM rb_order_guest AS A INNER JOIN RB_Order AS B ON A.OrderId=B.OrderId
INNER JOIN rb_class AS E ON B.ClassId=E.ClassId INNER JOIN rb_class AS E ON B.ClassId=E.ClassId
INNER JOIN rb_student_orderguest AS C ON A.Id=C.GuestId INNER JOIN rb_student_orderguest AS C ON A.Id=C.GuestId
INNER JOIN RB_Course AS cs ON B.CourseId=cs.CourseId INNER JOIN RB_Course AS cs ON B.CourseId=cs.CourseId
LEFT JOIN rb_student_assist AS D ON (C.Student_Id=D.StuId AND D.AssistType=4) LEFT JOIN rb_student_assist AS D ON (C.Student_Id=D.StuId AND D.AssistType=4)
WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.ClassScrollType=2 WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
"); ");
if (query.QCourseRate == Common.Enum.Course.CourseRateEnum.N5 if (query.QCourseRate == Common.Enum.Course.CourseRateEnum.N5
|| query.QCourseRate == Common.Enum.Course.CourseRateEnum.N4 || query.QCourseRate == Common.Enum.Course.CourseRateEnum.N4
...@@ -43,14 +46,40 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl ...@@ -43,14 +46,40 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl
{ {
builder.AppendFormat(" AND cs.CourseRate IN({0}) ", (int)query.QCourseRate); builder.AppendFormat(" AND cs.CourseRate IN({0}) ", (int)query.QCourseRate);
} }
if (query.QHeadMasterId > 0)
{
builder.AppendFormat(@" AND D.AssistId={0} ",query.QHeadMasterId);
}
if (query.QGuestState > 0)
{
builder.AppendFormat(@" AND A.GuestState={0} ", query.QGuestState);
}
else
{
builder.AppendFormat(@" AND A.GuestState in(1,5,7) ");
}
if (query.QScheduleStatus > -1)
{
builder.AppendFormat(@" AND A.ScheduleStatus={0} ", query.QScheduleStatus);
}
if (query.QTeachingMethod > 0)
{
builder.AppendFormat(@" AND A.TeachingMethod={0} ", query.QTeachingMethod);
}
if (!string.IsNullOrEmpty(query.QGuestName))
{
builder.AppendFormat(" AND A.GuestName LIKE @GuestName ");
parameters.Add("GuestName", "%" + query.QGuestName + "%");
}
builder.AppendFormat(" ORDER BY A.OrderId DESC "); builder.AppendFormat(" ORDER BY A.OrderId DESC ");
var list = Get<SchedulePlanResult>(builder.ToString()).ToList(); var list = Get<SchedulePlanResult>(builder.ToString(), parameters).ToList();
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
string guestIds = string.Join(",", list.Select(qitem => qitem.GuestId)); string guestIds = string.Join(",", list.Select(qitem => qitem.GuestId).Distinct());
string courseIds = string.Join(",", list.Select(qitem => qitem.CourseId)); string courseIds = string.Join(",", list.Select(qitem => qitem.CourseId).Distinct());
// string courseChapterSql = string.Format(@" // string courseChapterSql = string.Format(@"
//SELECT CourseId,ChapterGradeNo //SELECT CourseId,ChapterGradeNo
...@@ -64,11 +93,11 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl ...@@ -64,11 +93,11 @@ WHERE 1=1 AND B.OrderState=1 AND A.GuestState in(1,5) AND B.OrderType=1 AND E.Cl
SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours SELECT A.Date,A.AccountId,A.State,A.GuestId,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,IFNULL(C.ClassCheckId,0) AS ClassCheckId,IFNULL(C.CurrentDeductionHours,0) AS CurrentDeductionHours
FROM rb_scroll_appointment AS A LEFT JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId FROM rb_scroll_appointment AS A LEFT JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
LEFT JOIN rb_class_check AS C ON B.ClassTimeId=C.ClassTimeId AND A.GuestId=C.OrderGuestId LEFT JOIN rb_class_check AS C ON B.ClassTimeId=C.ClassTimeId AND A.GuestId=C.OrderGuestId
WHERE 1=1 AND A.State NOT IN(5) WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
"); ");
appointBuilder.AppendFormat(@" AND A.GuestId IN({0}) ", guestIds);
appointBuilder.AppendFormat(@" AND A.LearnCourseId IN ({0}) ", courseIds); appointBuilder.AppendFormat(@" AND A.LearnCourseId IN ({0}) ", courseIds);
appointBuilder.AppendFormat(@" AND A.CourseGradeId IN ({0}) ", (int)query.QCourseRate); appointBuilder.AppendFormat(@" AND A.CourseGradeId IN ({0}) ", (int)query.QCourseRate);
appointBuilder.AppendFormat(@" AND A.GuestId IN({0}) ", guestIds);
var courseList = Get<PCourseItem>(appointBuilder.ToString()).ToList(); var courseList = Get<PCourseItem>(appointBuilder.ToString()).ToList();
foreach (var item in list) foreach (var item in list)
...@@ -82,5 +111,46 @@ WHERE 1=1 AND A.State NOT IN(5) ...@@ -82,5 +111,46 @@ WHERE 1=1 AND A.State NOT IN(5)
} }
return list; return list;
} }
/// <summary>
/// 约课签到管理
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<ScrollAppointmentResult> ScrollAppointmentCheckPageRepository(int pageIndex,int pageSize,out long rowsCount, ScrollAppointmentQuery query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.Date,A.AccountId,A.State,A.GuestId,g.GuestName,A.LearnCourseId,A.CourseGradeId,A.CourseGradeNo,A.ClassPlanId,A.CourseETime AS EndTime,A.CourseSTime AS StartTime
FROM rb_scroll_appointment AS A LEFT JOIN rb_order_guest AS g ON A.GuestId=g.Id
WHERE 1=1 AND A.State IN(3) AND A.AppointType IN(1,2)
");
if (query != null)
{
if (!string.IsNullOrEmpty(query.StartDate))
{
builder.AppendFormat(@" AND A.Date>='{0}' ",query.StartDate);
}
if (!string.IsNullOrEmpty(query.EndDate))
{
builder.AppendFormat(@" AND A.Date<='{0} 23:59:59 ' ", query.StartDate);
}
if (!string.IsNullOrEmpty(query.GuestName))
{
builder.AppendFormat(@" AND g.GuestName LIKE @GuestName ");
parameters.Add("GuestName", "%" + query.GuestName + "%");
}
}
var list = base.GetPage<ScrollAppointmentResult>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
return list;
}
} }
} }
...@@ -4,11 +4,14 @@ using Edu.Common.Enum.Course; ...@@ -4,11 +4,14 @@ using Edu.Common.Enum.Course;
using Edu.Common.Plugin; using Edu.Common.Plugin;
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.Module.Course; using Edu.Module.Course;
using Edu.Module.User;
using Edu.WebApi.Filter; using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -36,6 +39,11 @@ namespace Edu.WebApi.Controllers.Course ...@@ -36,6 +39,11 @@ namespace Edu.WebApi.Controllers.Course
var query = new ScheduleQuery() var query = new ScheduleQuery()
{ {
QCourseRate = (CourseRateEnum)base.ParmJObj.GetInt("CourseRate"), QCourseRate = (CourseRateEnum)base.ParmJObj.GetInt("CourseRate"),
QHeadMasterId = base.ParmJObj.GetInt("HeadMasterId"),
QGuestState = base.ParmJObj.GetInt("GuestState"),
QScheduleStatus = base.ParmJObj.GetInt("ScheduleStatus"),
QTeachingMethod = base.ParmJObj.GetInt("TeachingMethod"),
QGuestName = base.ParmJObj.GetStringValue("GuestName"),
}; };
if (query.QCourseRate <= 0) if (query.QCourseRate <= 0)
{ {
...@@ -48,6 +56,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -48,6 +56,7 @@ namespace Edu.WebApi.Controllers.Course
{ {
Dictionary<string,object> jobj =new Dictionary<string, object> (); Dictionary<string,object> jobj =new Dictionary<string, object> ();
jobj.Add("OrderId", item.OrderId); jobj.Add("OrderId", item.OrderId);
jobj.Add("StuId", item.StuId);
jobj.Add("GuestId", item.GuestId); jobj.Add("GuestId", item.GuestId);
jobj.Add("GuestName", item.GuestName); jobj.Add("GuestName", item.GuestName);
jobj.Add("GuestState", (int)item.GuestState); jobj.Add("GuestState", (int)item.GuestState);
...@@ -62,6 +71,8 @@ namespace Edu.WebApi.Controllers.Course ...@@ -62,6 +71,8 @@ namespace Edu.WebApi.Controllers.Course
jobj.Add("ClassProgress", (item.ClassProgress > 0 ? item.ClassProgress : 0)); jobj.Add("ClassProgress", (item.ClassProgress > 0 ? item.ClassProgress : 0));
jobj.Add("ScheduleStatus", (item.ScheduleStatus > 0 ? item.ScheduleStatus : -1)); jobj.Add("ScheduleStatus", (item.ScheduleStatus > 0 ? item.ScheduleStatus : -1));
jobj.Add("XGRemark", (!string.IsNullOrEmpty(item.XGRemark) ? item.XGRemark : "")); jobj.Add("XGRemark", (!string.IsNullOrEmpty(item.XGRemark) ? item.XGRemark : ""));
jobj.Add("StopDeadline", Common.ConvertHelper.FormatDate(item.StopDeadline));
jobj.Add("ScheduleRemark", item.ScheduleRemark);
jobj.Add("CourseItems", item?.CourseItems?.OrderBy(qitem => qitem.CourseGradeNo)?.Select(qitem => new jobj.Add("CourseItems", item?.CourseItems?.OrderBy(qitem => qitem.CourseGradeNo)?.Select(qitem => new
{ {
Date = Common.ConvertHelper.FormatDate(qitem.Date), Date = Common.ConvertHelper.FormatDate(qitem.Date),
...@@ -86,5 +97,114 @@ namespace Edu.WebApi.Controllers.Course ...@@ -86,5 +97,114 @@ namespace Edu.WebApi.Controllers.Course
} }
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
/// <summary>
/// 修改学员,排课状态
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuestScheduleStatus()
{
int GuestId = base.ParmJObj.GetInt("GuestId");
int ScheduleStatus = base.ParmJObj.GetInt("ScheduleStatus");
string ScheduleRemark = base.ParmJObj.GetStringValue("ScheduleRemark");
DateTime StopDeadline = base.ParmJObj.GetDateTime("StopDeadline");
bool flag = scheduleCourse.SetGuestScheduleStatusModule(GuestId, ScheduleStatus, ScheduleRemark, StopDeadline);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改学员备注
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuestRemark()
{
int GuestId = base.ParmJObj.GetInt("GuestId");
string XGRemark = base.ParmJObj.GetStringValue("XGRemark");
bool flag = scheduleCourse.SetGuestRemarkModule(GuestId, XGRemark);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改学员授课方式
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuestTeachingMethod()
{
int GuestId = base.ParmJObj.GetInt("GuestId");
int TeachingMethod = base.ParmJObj.GetInt("TeachingMethod");
bool flag = scheduleCourse.SetGuestTeachingMethodModule(GuestId, TeachingMethod);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 取消学员签到
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CancalGuestCheck()
{
return ApiResult.Failed();
}
/// <summary>
/// 修改学员上课方式
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGuestCheckStyle()
{
var ClassCheckId = base.ParmJObj.GetInt("ClassCheckId");
int AttendanceMethod = base.ParmJObj.GetInt("AttendanceMethod");
bool flag = scheduleCourse.SetGuestCheckStyleModule(ClassCheckId, AttendanceMethod);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取约课学员签到分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppointCheckPage()
{
var pageModel = new ResultPageModel()
{
PageIndex=base.ParmJObj.GetInt("PageIndex"),
PageSize=base.ParmJObj.GetInt("PageSize"),
};
var query = new ScrollAppointmentQuery()
{
StartDate = base.ParmJObj.GetStringValue("StartDate"),
EndDate = base.ParmJObj.GetStringValue("EndDate"),
GuestName = base.ParmJObj.GetStringValue("GuestName"),
};
List<object> list = new List<object>();
var dataList = scheduleCourse.GetAppointStuListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in dataList)
{
list.Add(new
{
Date = Common.ConvertHelper.FormatDate(item.Date),
item.TeacherName,
item.GuestId,
item.GuestName,
item.StartTime,
item.EndTime,
item.CourseName,
item.ClassCheckId,
item.AttendanceMethod,
AttendanceMethodName = item.AttendanceMethod.ToName(),
});
}
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
} }
} }
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