Commit b12e41d5 authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 46141cd7 35ac9e84
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using Edu.Common.Plugin;
namespace Edu.Common.Data
{
/// <summary>
/// 约课导入帮助类
/// </summary>
public class AppointmentHelper
{
/// <summary>
/// 根据Excel文件获取列表
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static List<AppointmentModel> GetAppointmentData(string filePath)
{
List<AppointmentModel> xlsItems = new List<AppointmentModel>();
var dt = Common.Plugin.NPOIHelper.ImportExcelToDatatable(filePath, 0, 0, true);
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow item in dt.Rows)
{
xlsItems.Add(DataRowToModel(item));
}
}
return xlsItems;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
private static AppointmentModel DataRowToModel(DataRow dr)
{
AppointmentModel model = new AppointmentModel();
if (dr != null)
{
if (dr.Table.Columns.Contains("日期") && !string.IsNullOrEmpty(dr["日期"].ToString()))
{
model.Date = dr["日期"].ToString();
}
if (dr.Table.Columns.Contains("时段") && !string.IsNullOrEmpty(dr["时段"].ToString()))
{
model.Times = dr["时段"].ToString();
}
if (dr.Table.Columns.Contains("教室") && !string.IsNullOrEmpty(dr["教室"].ToString()))
{
model.RoomName = dr["教室"].ToString();
}
if (dr.Table.Columns.Contains("老师") && !string.IsNullOrEmpty(dr["老师"].ToString()))
{
model.TeacherName = dr["老师"].ToString();
}
if (dr.Table.Columns.Contains("学生") && !string.IsNullOrEmpty(dr["学生"].ToString()))
{
model.StuNames = dr["学生"].ToString();
}
}
return model;
}
}
/// <summary>
/// 导入数据列表
/// </summary>
public class AppointmentModel
{
/// <summary>
/// 上课日期
/// </summary>
public string Date { get; set; }
/// <summary>
/// 上课时段
/// </summary>
public string Times { get; set; }
/// <summary>
/// 教室名称
/// </summary>
public string RoomName { get; set; }
/// <summary>
/// 老师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 学生姓名 英文逗号分隔
/// </summary>
public string StuNames { get; set; }
}
}
......@@ -34,6 +34,7 @@ namespace Edu.Education
//new QuarzHelper().EduB2BOrderCommissionTimer().GetAwaiter().GetResult();//教育同业订单返佣 (2022-01-25 暂屏蔽)
new QuarzHelper().EduCreateScrollClassTimer().GetAwaiter().GetResult();//滚动开班
new QuarzHelper().EduCreateScrollAppointmentTimer().GetAwaiter().GetResult();//预约课程
new QuarzHelper().EduCreateScrollChapterTimer().GetAwaiter().GetResult();//预约章节自动生成 2022-02-14
new QuarzHelper().CheckPerparingTimer().GetAwaiter().GetResult();
}
......
......@@ -375,6 +375,32 @@ namespace Edu.Education.Helper
await scheduler.ScheduleJob(job, trigger);
}
/// <summary>
/// 定时执行上课章节生成
/// </summary>
/// <returns></returns>
public async Task EduCreateScrollChapterTimer()
{
string cronExpression = "0 0,5,10,15,20,25,30,35,40,45,50,55 * * * ?";//每5分钟执行的一次
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
};
StdSchedulerFactory factory = new StdSchedulerFactory(props);
IScheduler scheduler = await factory.GetScheduler();
await scheduler.Start();
IJobDetail job = JobBuilder.Create<CreateScrollChapter>()
.WithIdentity("job12", "group12")
.Build();
ICronTrigger trigger = (ICronTrigger)TriggerBuilder.Create()
.WithIdentity("trigger12", "group12")
.WithCronSchedule(cronExpression)
.Build();
await scheduler.ScheduleJob(job, trigger);
}
}
......@@ -737,6 +763,41 @@ namespace Edu.Education.Helper
{
LogHelper.Write(ex, "CreateScrollAppointment");
}
try
{
LogHelper.Write("滚动开班预约课程即将取消通知");
ScrollClassCommonModule scrollClassModule = new ScrollClassCommonModule();
scrollClassModule.RemindScrollAppointment(100000);
}
catch (Exception ex)
{
LogHelper.Write(ex, "RemindScrollAppointment");
}
return null;
}
}
/// <summary>
/// 滚动开班学生章节生成
/// </summary>
public class CreateScrollChapter : IJob
{
/// <summary>
/// 这里是作业调度每次定时执行方法
/// </summary>
/// <param name="context"></param>
public Task Execute(IJobExecutionContext context)
{
try
{
LogHelper.Write("滚动开班学生章节生成");
ScrollClassCommonModule scrollClassModule = new ScrollClassCommonModule();
scrollClassModule.CreateScrollChapter(100000);
}
catch (Exception ex)
{
LogHelper.Write(ex, "CreateScrollChapter");
}
return null;
}
}
......
......@@ -17,7 +17,7 @@ namespace Edu.EducationCore
ServiceBase.Run(ServicesToRun);
//Console.WriteLine("来了");
//new QuarzHelper().CheckPerparingTimer().GetAwaiter().GetResult();
//new QuarzHelper().EduCreateScrollAppointmentTimer().GetAwaiter().GetResult();
//Console.WriteLine("结束了");
//Console.ReadKey();
}
......
......@@ -56,6 +56,8 @@
"RedisPwd": "Viitto2018"
},
"VirtualDirectory": "WebFile",
//是否是本地服务
"IsLocal": "1",
//是否是线上环境
"IsOnline": false
}
\ No newline at end of file
......@@ -72,10 +72,12 @@ namespace Edu.Model.Entity.Grade
/// </summary>
public string RepeatPlanIds { get; set; }
private int planType = 1;//默认正常班
/// <summary>
/// 计划类型 1正常班 2滚动开班
/// </summary>
public int PlanType { get; set; }
public int PlanType { get => planType; set => this.planType = value; }
/// <summary>
/// 课程id
......
......@@ -33,7 +33,7 @@ namespace Edu.Model.Entity.Scroll
public int StuId { get; set; }
/// <summary>
/// 课程ID
/// 课程ID (第一个预约人的课程)
/// </summary>
public int CourseId { get; set; }
......@@ -87,6 +87,11 @@ namespace Edu.Model.Entity.Scroll
/// </summary>
public DateTime CourseEndTime { get; set; }
/// <summary>
/// 上课的时间段 json格式
/// </summary>
public string CourseTime { get; set; }
/// <summary>
/// 上课教室ID
/// </summary>
......@@ -96,5 +101,40 @@ namespace Edu.Model.Entity.Scroll
/// 上课计划ID
/// </summary>
public int ClassPlanId { get; set; }
/// <summary>
/// 订单OrderGuestId
/// </summary>
public int GuestId { get; set; }
/// <summary>
/// 订单ID
/// </summary>
public int OrderId { get; set; }
/// <summary>
/// 开始时间点
/// </summary>
public string CourseSTime { get; set; }
/// <summary>
/// 结束时间点
/// </summary>
public string CourseETime { get; set; }
/// <summary>
/// 课次等级ID (枚举) 与ChapterNo 组成唯一
/// </summary>
public CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 报名课程ID
/// </summary>
public int LearnCourseId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
}
}
\ No newline at end of file
......@@ -236,5 +236,10 @@ namespace Edu.Model.Entity.Sell
/// 已上课的章节
/// </summary>
public int CourseChapterNo { get; set; }
/// <summary>
/// 总计上课章节
/// </summary>
public int TotalChapterNo { get; set; }
}
}
......@@ -109,7 +109,7 @@ namespace Edu.Model.Entity.Sell
public int SureStatus { get; set; }
/// <summary>
/// 分类 1基础课 2试听
/// 分类 1跟班课 2试听课 3预约
/// </summary>
public int CouseClassify { get; set; }
}
......
......@@ -58,6 +58,11 @@ namespace Edu.Model.ViewModel.Grade
/// </summary>
public string Q_ClassIds { get; set; }
/// <summary>
/// ids
/// </summary>
public string QClassPlanIds { get; set; }
/// <summary>
/// 签到统计
/// </summary>
......
......@@ -61,6 +61,11 @@ namespace Edu.Model.ViewModel.Grade
/// </summary>
public int ClassType { get; set; }
/// <summary>
/// 约课状态 1待确认 2已确认
/// </summary>
public int AppointState { get; set; }
/// <summary>
/// 班级课时分钟数
/// </summary>
......@@ -184,5 +189,10 @@ namespace Edu.Model.ViewModel.Grade
public int AccountId { get; set; }
public string WorkUserId { get; set; }
/// <summary>
/// 约课Ids
/// </summary>
public string AppointIds { get; set; }
}
}
......@@ -20,6 +20,16 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public string EntTime { get; set; }
/// <summary>
/// 上课结束时间
/// </summary>
public string CourseEndTimeStr { get; set; }
/// <summary>
/// 学生IDs
/// </summary>
public string StuIds { get; set; }
/// <summary>
/// 老师ID
/// </summary>
......@@ -55,6 +65,11 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public string RoomName { get; set; }
/// <summary>
/// 教室所属校区
/// </summary>
public int RoomSchoolId { get; set; }
/// <summary>
/// 教室所属校区
/// </summary>
......@@ -84,5 +99,42 @@ namespace Edu.Model.ViewModel.Scroll
/// 上课时段
/// </summary>
public List<CourseTimeModel> CourseTimeList { get; set; }
/// <summary>
/// 约课状态 1待确认 2已确认
/// </summary>
public int Q_AppointState { get; set; }
/// <summary>
/// 查询正常 1
/// </summary>
public int Q_SelectNormal { get; set; }
/// <summary>
/// 约课Ids
/// </summary>
public string AppointIds { get; set; }
/// <summary>
/// 总上课章节
/// </summary>
public int TotalChapterNo { get; set; }
/// <summary>
/// 学生列表
/// </summary>
public List<ScrollGuestModel> GuestList { get; set; }
}
/// <summary>
/// 学员
/// </summary>
public class ScrollGuestModel
{
public int StuId { get; set; }
public int GuestId { get; set; }
public string StuName { get; set; }
}
}
\ No newline at end of file
......@@ -72,6 +72,11 @@ namespace Edu.Model.ViewModel.Scroll
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 课次等级
/// </summary>
public Common.Enum.Course.CourseRateEnum CourseGradeId { get; set; }
/// <summary>
/// 课程章节
/// </summary>
......
......@@ -119,5 +119,19 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public int ClassScrollType { get; set; }
/// <summary>
/// 滚动开班 学生报名校区
/// </summary>
public int ScrollSchoolId { get; set; }
/// <summary>
/// 最后预约日期
/// </summary>
public string AppointDate { get; set; }
/// <summary>
/// 预约的次数
/// </summary>
public int AppointNum { get; set; }
}
}
This diff is collapsed.
......@@ -1256,6 +1256,7 @@ namespace Edu.Module.Course
#region 插入学生名单(客户选择转订单)
if (flag && demodel.OrderIdentify == 2) {
int MaxChapterNo = courseRepository.GetMaxChapterNum(demodel.CourseId, demodel.Group_Id);
foreach (var item in StuList) {
var guestModel = new RB_Order_Guest_ViewModel()
{
......@@ -1298,6 +1299,7 @@ namespace Edu.Module.Course
RenewState = item.IsRenewGuest == 1 ? 2 : 1,
QQ=item.QQ,
WeChatNo=item.WeChatNo,
TotalChapterNo = MaxChapterNo
};
SetOrderGuestInfo(guestModel, out string Nmessage);
......
This diff is collapsed.
......@@ -555,11 +555,15 @@ namespace Edu.Module.Course
//查询所有课程的上课时间
List<RB_Class_Type_ViewModel> typeList = new List<RB_Class_Type_ViewModel>();
List<RB_Class_Check_ViewModel> checkList = new List<RB_Class_Check_ViewModel>();
List<RB_Class_Check_ViewModel> plancheckList = new List<RB_Class_Check_ViewModel>();
List<RB_Teacher_ViewModel> teacherList = new List<RB_Teacher_ViewModel>();
List<RB_Teaching_BonusDetail_ViewModel> DateList = new List<RB_Teaching_BonusDetail_ViewModel>();
List<RB_Class_Time_ViewModel> timeList = new List<RB_Class_Time_ViewModel>();
if (plist.Any())
{
string pids = string.Join(",", plist.Select(x => x.ClassPlanId));
timeList = class_TimeRepository.GetClassTimeListRepository(new RB_Class_Time_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = pids });
plancheckList = class_CheckRepository.GetClassCheckStatisticsForYK(new RB_Class_Check_ViewModel() { Group_Id = userInfo.Group_Id, QClassPlanIds = pids, StartDate = StartTime, EndDate = EndTime });
string classTypeIds = string.Join(",", plist.Select(x => x.ClassType).Distinct());
typeList = class_TypeRepository.GetClassTypeListRepository(new RB_Class_Type_ViewModel() { Group_Id = userInfo.Group_Id, Q_CTypeIds = classTypeIds });
//查询签到数据
......@@ -643,7 +647,16 @@ namespace Edu.Module.Course
//基础课
foreach (var item in plist)
{
var dateqList = DateList.Where(x => x.TeacherId == item.TeacherId && x.ClassId == item.ClassId && x.Date == item.ClassDate).ToList();
var dateqList = new List<RB_Teaching_BonusDetail_ViewModel>();
if (item.PlanType == 2)
{
var tqlist = timeList.Where(x => x.ClassPlanId == item.ClassPlanId).Select(x => (x.StartTime + "~" + x.EndTime)).ToList();
dateqList = DateList.Where(x => x.TeacherId == item.TeacherId && x.CouseId == item.CourseId && x.Date == item.ClassDate && tqlist.Contains(x.TimeBucket)).ToList();
}
else
{
dateqList = DateList.Where(x => x.TeacherId == item.TeacherId && x.ClassId == item.ClassId && x.Date == item.ClassDate).ToList();
}
//查询课时
decimal ksNum = dateqList.Sum(x => x.KSNum);
//查询课单价
......@@ -651,12 +664,21 @@ namespace Edu.Module.Course
var teacherModel = teacherList.Where(x => x.TId == item.TeacherId).FirstOrDefault();
decimal unitPrice = configModel.BasicHourFee + (typeModel?.AddHourFee ?? 0) + (teacherModel?.BaseHourFee ?? 0);
//签到人数
int CheckNum = 0;
if (item.PlanType == 2)
{
CheckNum = plancheckList.Where(x => x.ClassTimeId == item.ClassPlanId).FirstOrDefault()?.CheckNum ?? 0;
}
else
{
var checkModel = checkList.Where(x => x.ClassId == item.ClassId && x.ClassDate == item.ClassDate).FirstOrDefault();
CheckNum = checkModel?.CheckNum ?? 0;
}
teaching_BonusDetailRepository.Insert(new RB_Teaching_BonusDetail()
{
BonusId = bonusId,
CheckInNum = checkModel?.CheckNum ?? 0,
CheckInNum = CheckNum,
ClassId = item.ClassId,
CourseHour = ksNum,
CreateBy = dmodel.CreateBy,
......@@ -668,11 +690,11 @@ namespace Edu.Module.Course
School_Id = item.School_Id,
Status = 0,
TeacherId = item.TeacherId,
Type = item.TeacherId == item.Teacher_Id ? 1 : 2,
Type = item.PlanType == 2 ? 1 : item.TeacherId == item.Teacher_Id ? 1 : 2,
UnitPrice = unitPrice,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now,
CouseClassify = 1
CouseClassify = item.PlanType == 2 ? 3 : 1
}, trans);
TotalMoney += ksNum * unitPrice;
}
......
......@@ -20,6 +20,7 @@ using Edu.Model.ViewModel.User;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Customer;
using Edu.Model.Entity.Customer;
using Edu.Repository.Scroll;
namespace Edu.Module.Duty
{
......@@ -68,6 +69,12 @@ namespace Edu.Module.Duty
/// </summary>
private readonly RB_Student_OrderGuestRepository student_OrderGuestRepository = new RB_Student_OrderGuestRepository();
/// <summary>
/// 学员预约课
/// </summary>
private readonly RB_Scroll_AppointmentRepository scroll_AppointmentRepository = new RB_Scroll_AppointmentRepository();
/// <summary>
/// 获取访客约课分页列表
/// </summary>
......@@ -340,6 +347,16 @@ namespace Edu.Module.Duty
}
#endregion
#region 验证预约课
if (CheckAppointmentModule(chooseDateTime, chooseEndTime, model, out string appointMessage))
{
message = appointMessage;
return false;
}
#endregion
if (model.ReserveClassId > 0)
{
var oldModel = GetReserveClassModule(model.ReserveClassId);
......@@ -523,6 +540,40 @@ namespace Edu.Module.Duty
return false;
}
/// <summary>
/// 检查预约课是否重复
/// </summary>
/// <param name="chooseDateTime"></param>
/// <param name="chooseEndTime"></param>
/// <param name="model"></param>
/// <param name="RoomMessage"></param>
/// <returns></returns>
public bool CheckAppointmentModule(DateTime chooseDateTime, DateTime chooseEndTime, RB_Reserve_Class_Extend model, out string AppointMessage)
{
AppointMessage = "";
var planList = scroll_AppointmentRepository.GetList(new Model.ViewModel.Scroll.RB_Scroll_Appointment_ViewModel()
{
TeacherId = model.TeacherId,
StartTime = Common.ConvertHelper.FormatDate(model.ClassDate),
EntTime = Common.ConvertHelper.FormatDate(model.ClassDate),
Group_Id = model.Group_Id
});
if (planList != null && planList.Any())
{
foreach (var item in planList)
{
var startTime = Convert.ToDateTime(Common.ConvertHelper.FormatDate(item.Date) + " " + item.CourseSTime);
var endTime = Convert.ToDateTime(Common.ConvertHelper.FormatDate(item.Date) + " " + item.CourseETime);
if ((chooseDateTime > startTime && chooseDateTime < endTime) || (chooseEndTime > startTime && chooseEndTime < endTime))
{
AppointMessage = string.Format("此教师已有 {0} {1}-{2}预约课计划!请重新选择时间", Common.ConvertHelper.FormatDate(model.ClassDate), item.CourseSTime, item.CourseETime);
return true;
}
}
}
return false;
}
/// <summary>
/// 检查预约课程是否存在
/// </summary>
......
......@@ -558,8 +558,10 @@ GROUP BY Teacher_Id
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
update rb_class AS A set A.Status =1
WHERE 1=1
update rb_class AS A
left join rb_order o on A.ClassId =o.ClassId and o.OrderState <>3
set A.Status =1
WHERE 1=1 and o.OrderId IS NULL
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Status), (int)DateStateEnum.Normal);
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_ViewModel.Group_Id), groupId);
......
......@@ -113,6 +113,42 @@ WHERE 1=1 AND `Status` =0 and CheckStatus =0 ");
return Get<RB_Class_Check_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 获取签到列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Class_Check_ViewModel> GetClassCheckStatisticsForYK(RB_Class_Check_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT C.ClassPlanId as ClassTimeId,A.ClassDate,COUNT(0) AS CheckNum
FROM RB_Class_Check AS A
inner join rb_class_time C on A.ClassTimeId = C.ClassTimeId
WHERE 1=1 AND A.`Status` =0 and A.CheckStatus =0 ");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.QClassPlanIds))
{
builder.AppendFormat(" AND C.ClassPlanId in({0}) ", query.QClassPlanIds);
}
if (!string.IsNullOrWhiteSpace(query.StartDate))
{
builder.AppendFormat(" AND A.{0} >='{1}' ", nameof(RB_Class_Check_ViewModel.ClassDate), query.StartDate);
}
if (!string.IsNullOrWhiteSpace(query.EndDate))
{
builder.AppendFormat(" AND A.{0} <='{1} 23:59:59' ", nameof(RB_Class_Check_ViewModel.ClassDate), query.EndDate);
}
}
builder.AppendFormat(" GROUP BY C.ClassPlanId,A.ClassDate ");
return Get<RB_Class_Check_ViewModel>(builder.ToString()).ToList();
}
/// <summary>
/// 班级总人数
/// </summary>
......@@ -234,6 +270,10 @@ GROUP BY A.ClassId
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Check_ViewModel.OrderGuestId), query.OrderGuestId);
}
if (!string.IsNullOrEmpty(query.QOrderGuestIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.OrderGuestId), query.QOrderGuestIds);
}
if (!string.IsNullOrEmpty(query.Q_ClassIds))
{
builder.AppendFormat(" AND A.{0} in({1}) ", nameof(RB_Class_Check_ViewModel.ClassId), query.Q_ClassIds);
......@@ -518,12 +558,17 @@ GROUP BY tt.TeacherId,tt.OrderGuestId
}
string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,c.ClassType,c.ClassNo,s.SName,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,
c.ClassType,c.ClassNo,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours
FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId
left join rb_school s on s.SId = c.School_Id
left join rb_school s2 on s2.SId = cp.School_Id
WHERE p.`Status`=0 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC
......@@ -558,12 +603,16 @@ ORDER BY p.ClassDate ASC
}
string sql = $@"
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,c.ClassName,co.CourseName,p.ClassId,s.SName,c.ClassType,c.ClassNo,c.ClassHourMinute,c.CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
SELECT p.TeacherId,t2.TeacherName,t2.BaseHourFee,t2.BaseHoursEnabled,t2.EnableTime,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,
p.ClassId,if(cp.PlanType=2,s2.SName,s.SName) as SName,c.ClassType,c.ClassNo,c.ClassHourMinute,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,Max(p.CurrentDeductionHours) as CurrentDeductionHours FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_teacher t2 on p.TeacherId = t2.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId
left join rb_school s on s.SId = c.School_Id
left join rb_school s2 on s2.SId = cp.School_Id
WHERE p.`Status`=0 and p.Group_Id ={group_Id} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
GROUP BY p.TeacherId,p.ClassId,p.ClassTimeId
ORDER BY p.ClassDate ASC
......@@ -625,7 +674,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney / tt.TotalSub * tt.CourseFee) /tt.ClassHours
else 0 END AS UnitPrice
FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,c.ClassName,c.ClassNo,co.CourseName,p.ClassId,c.CouseId
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
......@@ -636,11 +685,13 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache
,o.JoinType,o.TargetJoinType,o.SourceOrderId,o.TargetOrderId
FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_order_guest t2 on p.OrderGuestId = t2.Id
LEFT JOIN rb_order o on o.OrderId = t2.OrderId
LEFT JOIN rb_teacher t3 on p.TeacherId = t3.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId
LEFT JOIN rb_education_contract ec on ec.GuestId = p.OrderGuestId
WHERE p.`Status`=0 and p.Group_Id ={groupId} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
) tt
......@@ -700,7 +751,7 @@ case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney / tt.TotalSub * tt.CourseFee) /tt.ClassHours
else 0 END AS UnitPrice
FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,c.ClassName,c.ClassNo,co.CourseName,p.ClassId,c.CouseId
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
,p.ClassDate,p.ClassTimeId,t.StartTime as StartDate,t.EndTime as EndDate,o.EnterID,o.HelpEnterId
,ec.FirstCourseFee + ec.SecondCourseFee + ec.ThirdCourseFee as CourseFee
,ec.FirstDiscountMoney + ec.SecondDiscountMoney + ec.ThirdDiscountMoney as DiscountMoney
......@@ -710,11 +761,13 @@ SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.Teache
,ec.FirstClassHours + ec.SecondClassHours + ec.ThirdClassHours as ClassHours
FROM rb_class_check p
INNER JOIN rb_class_time t on p.ClassTimeId = t.ClassTimeId
inner join rb_class_plan cp on t.ClassPlanId = cp.ClassPlanId
LEFT JOIN rb_order_guest t2 on p.OrderGuestId = t2.Id
LEFT JOIN rb_order o on o.OrderId = t2.OrderId
LEFT JOIN rb_teacher t3 on p.TeacherId = t3.TId
LEFT JOIN rb_class c on p.ClassId = c.ClassId
LEFT JOIN rb_course co on c.CouseId = co.CourseId
left join rb_course co2 on cp.CourseId = co2.CourseId
LEFT JOIN rb_education_contract ec on ec.GuestId = p.OrderGuestId
WHERE p.`Status`=0 and p.Group_Id ={groupId} {where} and p.ClassDate >= '{startMonth}' and p.ClassDate <='{endMonth} 23:59:59'
) tt
......
......@@ -263,6 +263,29 @@ where a.`Status`=0 and c.ClassStatus in(1,2) and a.TeacherId={TId} and c.`Sta
return Get<RB_Class_Time_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 获取约课下一节课时间
/// </summary>
/// <param name="StuId"></param>
/// <param name="Group_Id"></param>
/// <returns></returns>
public List<RB_Class_Time_Extend> GetClassTimeByAppointStuId(int StuId, int Group_Id)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT t.TeacherName,croom.RoomName,t.TeacherHead,cou.CourseName,A.ClassPlanId,A.ClassId,A.`Status`,
A.ClassRoomId,A.Group_Id,A.School_Id,A.TeacherId,B.ClassTimeId,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.StartTime,':00') AS NewPlanDateTime,
B.EndTime,B.StartTime,B.SuiPai,B.ClassStatus,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') AS NewEndPlanDateTime
FROM rb_class_plan AS A
INNER JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
INNER JOIN rb_scroll_appointment sa on A.ClassPlanId = sa.ClassPlanId
LEFT JOIN rb_teacher as t on A.TeacherId=t.TId
LEFT JOIN rb_course as cou on cou.CourseId=A.CourseId
LEFT JOIN rb_class_room as croom on croom.RoomId=a.ClassRoomId
where A.`Status`=0 and A.Group_Id={Group_Id} and sa.StuId ={StuId}
and DATE_FORMAT(A.ClassDate,'%Y-%m-%d')>=DATE_FORMAT(NOW(),'%Y-%m-%d') ORDER BY CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') asc LIMIT 10");
return Get<RB_Class_Time_Extend>(builder.ToString()).ToList();
}
#endregion
/// <summary>
......
......@@ -28,6 +28,10 @@ namespace Edu.Repository.Scroll
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.State > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} ={(int)demodel.State}";
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} >='{demodel.StartTime}'";
......@@ -36,6 +40,22 @@ namespace Edu.Repository.Scroll
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
}
if (!string.IsNullOrEmpty(demodel.CourseEndTimeStr))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseEndTime)} <='{demodel.CourseEndTimeStr}'";
}
if (demodel.TeacherId > 0)
{
where += $@" and c.AccountId ={demodel.TeacherId}";
}
if (demodel.StuId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
}
if (!string.IsNullOrEmpty(demodel.StuIds))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} in({demodel.StuIds})";
}
string sql = $@"
SELECT r.*,c.AccountId as TeacherId,s.StuName,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum From RB_Scroll_Appointment r
......@@ -70,7 +90,7 @@ ORDER BY r.Id asc ";
public List<RB_Scroll_Appointment_ViewModel> GetAppointPageList(int pageIndex, int pageSize, out long count, RB_Scroll_Appointment_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.{nameof(RB_Scroll_Appointment_ViewModel.Status)} =0 and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} <>5";
string where = $@" 1=1 and r.{nameof(RB_Scroll_Appointment_ViewModel.Status)} =0 ";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Group_Id)} ={demodel.Group_Id}";
......@@ -93,7 +113,7 @@ ORDER BY r.Id asc ";
}
if (demodel.CourseId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseId)} ={demodel.CourseId}";
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.LearnCourseId)} ={demodel.CourseId}";
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
......@@ -103,13 +123,17 @@ ORDER BY r.Id asc ";
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
}
if (demodel.Q_SelectNormal == 1)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} <>5";
}
string sql = $@"
SELECT r.*,c.AccountId as TeacherId,t.TeacherName,t.TeacherHead,s.StuName,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,sc.SName as RoomSchoolName From RB_Scroll_Appointment r
inner join rb_account c on r.AccountId = c.Id
inner join rb_teacher t on c.AccountId = t.TId
inner join rb_student s on r.StuId = s.StuId
inner join rb_course cou on r.CourseId = cou.CourseId
inner join rb_course cou on r.LearnCourseId = cou.CourseId
inner join rb_class_room cr on r.RoomId = cr.RoomId
left join rb_school sc on sc.SId = cr.School_Id
WHERE {where}
......@@ -146,10 +170,26 @@ ORDER BY r.Id desc ";
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} ={demodel.StuId}";
}
if (!string.IsNullOrEmpty(demodel.StuIds))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.StuId)} in({demodel.StuIds})";
}
if (demodel.CourseId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseId)} ={demodel.CourseId}";
}
if (demodel.RoomId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.RoomId)} ={demodel.RoomId}";
}
if (demodel.ChapterNo > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.ChapterNo)} ={demodel.ChapterNo}";
}
if (demodel.CourseGradeId > 0)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.CourseGradeId)} ={(int)demodel.CourseGradeId}";
}
if (!string.IsNullOrEmpty(demodel.StartTime))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} >='{demodel.StartTime}'";
......@@ -158,10 +198,29 @@ ORDER BY r.Id desc ";
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Date)} <='{demodel.EntTime} 23:59:59'";
}
if (!string.IsNullOrEmpty(demodel.AppointIds))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.Id)} in({demodel.AppointIds})";
}
if (!string.IsNullOrEmpty(demodel.ShiftSort))
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.ShiftSort)} ='{demodel.ShiftSort}'";
}
if (demodel.Q_AppointState > 0) {
if (demodel.Q_AppointState == 1)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} =1";
}
else if (demodel.Q_AppointState == 2)
{
where += $@" and r.{nameof(RB_Scroll_Appointment_ViewModel.State)} in(2,3,4)";
}
}
string sql = $@"
SELECT r.*,c.AccountId as TeacherId,c.WorkUserId,t.TeacherName,t.TeacherHead,s.StuName,sch.OpenId as StuOpenId,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,sc.SName as RoomSchoolName
SELECT r.*,c.AccountId as TeacherId,c.WorkUserId,t.TeacherName,t.TeacherHead,s.StuName,sch.OpenId as StuOpenId,cou.CourseName,cou.ScrollMinNum,cou.ScrollMaxNum,cou.CourseTimeId,cr.RoomName,cr.School_Id as RoomSchoolId,sc.SName as RoomSchoolName ,og.TotalChapterNo
From RB_Scroll_Appointment r
inner join rb_order_guest og on r.GuestId = og.Id
inner join rb_account c on r.AccountId = c.Id
inner join rb_teacher t on c.AccountId = t.TId
inner join rb_student s on r.StuId = s.StuId
......
......@@ -42,7 +42,8 @@ namespace Edu.Repository.Scroll
}
string sql = $@"
SELECT * From RB_Scroll_Plan r
SELECT r.*,a.AccountId as TeacherId From RB_Scroll_Plan r
inner join rb_account a on r.AccountId = a.Id
WHERE {where}
ORDER BY r.Id asc ";
return Get<RB_Scroll_Plan_ViewModel>(sql, parameters).ToList();
......@@ -55,7 +56,7 @@ ORDER BY r.Id asc ";
/// <param name="schoolId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Scroll_Plan_ViewModel> GetTeacherPlanForDay(string date, int schoolId, int group_Id)
public List<RB_Scroll_Plan_ViewModel> GetTeacherPlanForDay(string date, int schoolId, int group_Id, int teacherId =0)
{
string sql = $@"SELECT p.*,a.AccountId as TeacherId,t.TeacherName,t.TeacherHead,t.TeacherIntro,r.RoomName,s.SName as SchoolName FROM rb_scroll_plan p
inner join rb_account a on p.AccountId = a.Id
......@@ -66,6 +67,9 @@ WHERE p.`Status` =0 and p.Group_Id ={group_Id} and p.Date ='{date}' and p.ShiftI
if (schoolId >= 0) {
sql += $@" and r.School_Id ={schoolId}";
}
if (teacherId > 0) {
sql += $@" and t.TId ={teacherId}";
}
return Get<RB_Scroll_Plan_ViewModel>(sql).ToList();
}
}
......
......@@ -160,7 +160,7 @@ where {where} order by bd.Date asc";
where += $@" and b.{nameof(RB_Teaching_BonusDetail.Type)} ={demodel.Type}";
}
string sql = $@" select b.*,t.TeacherName,case when b.CouseClassify =1 then c.ClassName else tr.LessonName end as ClassName,
string sql = $@" select b.*,t.TeacherName,case when b.CouseClassify =3 then '预约课' else case when b.CouseClassify =1 then c.ClassName else tr.LessonName end end as ClassName,
c.ClassNo,s.SName from RB_Teaching_BonusDetail b
left join rb_teacher t on b.TeacherId = t.TId
left join rb_class c on b.ClassId = c.ClassId and b.CouseClassify =1
......
......@@ -786,22 +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 SchoolId, int group_Id)
public List<RB_Student_OrderGuest_ViewModel> GetCanAppointmentStuList(int courseId, int NextChapterNo, 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}
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 (courseId > 0) {
sql += $@" and o.CourseId ={courseId}";
}
if (NextChapterNo > 0) {
sql += $@" and (og.CourseChapterNo + 1 + IFNULL(sa.AppointNum,0)) ={NextChapterNo}";
}
......@@ -812,6 +810,26 @@ and og.TotalChapterNo > og.CourseChapterNo ";
return Get<RB_Student_OrderGuest_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取所有学习中的学生列表
/// </summary>
/// <param name="courseId"></param>
/// <param name="NextChapterNo"></param>
/// <param name="CourseGradeId"></param>
/// <param name="SchoolId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Student_OrderGuest_ViewModel> GetAppointmentStudyList(int group_Id)
{
string sql = $@"SELECT sog.Student_Id,sog.GuestId,sog.OrderId,o.CourseId,s.StuName as GuestName,og.TotalHours,og.CompleteHours 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
WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState <>2 and o.OrderState <>3
and og.TotalHours > og.CompleteHours order by sog.OrderId asc ";
return Get<RB_Student_OrderGuest_ViewModel>(sql).ToList();
}
#endregion
}
}
......@@ -254,6 +254,58 @@ namespace Edu.WebApi.Controllers.Applet
}
}
/// <summary>
/// 验证统一时段 同日是否有相同课次预约
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult ValidateToDayAppointment() {
var userInfo = base.AppletUserInfo;
RB_Scroll_Appointment_ViewModel demodel = JsonHelper.DeserializeObject<RB_Scroll_Appointment_ViewModel>(base.RequestParm.Msg.ToString());
if (demodel.AccountId <= 0)
{
return ApiResult.ParamIsNull("请传递老师账号ID");
}
if (demodel.TeacherId <= 0)
{
return ApiResult.ParamIsNull("请传递老师编号ID");
}
if (demodel.Date <= DateTime.Now)
{
return ApiResult.ParamIsNull("预约日期有误");
}
if (string.IsNullOrEmpty(demodel.ShiftSort))
{
return ApiResult.ParamIsNull("请传递上课时段");
}
#region 验证是否连续的时段
List<int> SortList = JsonHelper.DeserializeObject<List<int>>("[" + demodel.ShiftSort + "]");
int MinSort = SortList.Min(x => x);
string ShiftSort = "";
for (var i = 0; i < SortList.Count(); i++)
{
ShiftSort += (MinSort + i) + ",";
}
if (ShiftSort != demodel.ShiftSort + ",")
{
return ApiResult.ParamIsNull("需预约连续的时段");
}
#endregion
demodel.StuId = userInfo.AccountId;
demodel.Group_Id = userInfo.Group_Id;
var robj = scrollClassModule.ValidateToDayAppointment(demodel, out string rmsg);
if (rmsg == "")
{
return ApiResult.Success("", robj);
}
else
{
return ApiResult.Failed(rmsg);
}
}
/// <summary>
/// 获取枚举列表
/// </summary>
......@@ -310,9 +362,11 @@ namespace Edu.WebApi.Controllers.Applet
x.TeacherHead,
x.StuId,
x.StuName,
x.CourseId,
x.LearnCourseId,
x.CourseName,
x.ChapterNo,
x.CourseGradeId,
CourseGradeName = x.CourseGradeId.ToName(),
x.CourseTimeList,
x.RoomId,
x.RoomName,
......
......@@ -236,19 +236,27 @@ namespace Edu.WebApi.Controllers.Applet
//查询下一节课(要查询正在学习中)
var ClassNext = new object();
if (studentModel.ClassId > 0 && studentModel.ClassStatus != 3) {
var classTimeList = classModule.GetClassTimeByClassId(studentModel.ClassId, appletUserInfo.Group_Id);
if ((studentModel.ClassId > 0 && studentModel.ClassStatus != 3)|| studentModel.ClassScrollType == 2) {
List<RB_Class_Time_Extend> classTimeList = new List<RB_Class_Time_Extend>();
if (studentModel.ClassScrollType == 2)
{
classTimeList = classModule.GetClassTimeByAppointStuId(studentModel.StuId, appletUserInfo.Group_Id);
}
else
{
classTimeList = classModule.GetClassTimeByClassId(studentModel.ClassId, appletUserInfo.Group_Id);
}
int ClassPlanState = 1;//上课中
var tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.ClassId == studentModel.ClassId && x.NewPlanDateTime.HasValue && System.DateTime.Now >= x.NewPlanDateTime.Value && x.NewEndPlanDateTime.HasValue && System.DateTime.Now < x.NewEndPlanDateTime.Value);
var tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.NewPlanDateTime.HasValue && System.DateTime.Now >= x.NewPlanDateTime.Value && x.NewEndPlanDateTime.HasValue && System.DateTime.Now < x.NewEndPlanDateTime.Value);
if (tempList == null || !tempList.Any())
{
tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.ClassId == studentModel.ClassId && x.NewPlanDateTime.HasValue && System.DateTime.Now <= x.NewPlanDateTime.Value);
tempList = classTimeList.OrderBy(x => x.NewEndPlanDateTime).Where(x => x.NewPlanDateTime.HasValue && System.DateTime.Now <= x.NewPlanDateTime.Value);
ClassPlanState = 2;//待上课
}
var classModel = tempList?.OrderBy(x => x.NewPlanDateTime).FirstOrDefault();
if (classModel == null || classModel.ClassTimeId == 0)
{
classModel = new Model.ViewModel.Grade.RB_Class_Time_Extend();
classModel = new RB_Class_Time_Extend();
ClassPlanState = 3;//暂无
}
ClassNext = new //我的课表最新一个数据
......@@ -537,6 +545,9 @@ namespace Edu.WebApi.Controllers.Applet
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int ClassId = parms.GetInt("ClassId", 0);//班级ID
int CourseId = parms.GetInt("CourseId", 0);//课程ID
int GuestId = parms.GetInt("GuestId", 0);//订单GuestId
int ClassScrollType = parms.GetInt("ClassScrollType", 0);//学习类型 1跟班 2约课
int StuId = parms.GetInt("StuId", 0);//学生ID
if (ClassId <= 0)
{
return ApiResult.ParamIsNull("请传递班级ID");
......@@ -547,9 +558,9 @@ namespace Edu.WebApi.Controllers.Applet
}
//先获取计划列表
var planList = classModule.GetMyStudyCourseList(ClassId, appletUserInfo.Group_Id);
var planList = classModule.GetMyStudyCourseList(ClassId, ClassScrollType, StuId, GuestId, appletUserInfo.Group_Id);
//查询章节列表 + 完成度 + 单词测试得分
var MaxChapterNo = planList.Max(x => x.LessonPlanNum);
var MaxChapterNo = planList.Any() ? planList.Max(x => x.LessonPlanNum) : 0;
//查询所有的章节
var chapterTreeList = courseModule.GetChapterTreeListModule_V2(new Model.ViewModel.Course.RB_Course_Chapter_ViewModel() { Group_Id = appletUserInfo.Group_Id, CourseId = CourseId });
var ctList = chapterTreeList.Where(x => Convert.ToInt32(x.ChapterNo) <= MaxChapterNo).OrderByDescending(qitem=> Convert.ToInt32(qitem.ChapterNo)).ToList();
......
......@@ -89,6 +89,8 @@ namespace Edu.WebApi.Controllers.APP
JObject jobj = JObject.Parse(RequestParm.Msg.ToString());
string account = jobj.GetStringValue("Account");
string password = jobj.GetStringValue("Password");
string UnionId = jobj.GetStringValue("UnionId");
string OpenId = jobj.GetStringValue("OpenId");
var model = accountModule.GetStudentExt(new RB_Account_ViewModel()
{
......@@ -109,6 +111,12 @@ namespace Edu.WebApi.Controllers.APP
return ApiResult.Failed("密码错误", new { Error = 0 });
}
}
if (!string.IsNullOrEmpty(model.OpenId))//UnionId是否为空,为空则绑定手机号与UnionId
{
model.UnionId = UnionId;
model.OpenId = OpenId;
var flag = accountModule.UpdateAccountUnionId(model);
}
if (model.Status == Common.Enum.DateStateEnum.Delete)
{
return ApiResult.Failed(message: $"此账号【{ account }】已禁用", new { Error = 2 });
......
......@@ -2585,9 +2585,10 @@ namespace Edu.WebApi.Controllers.Course
School_Id = -1,
ClassId = base.ParmJObj.GetInt("ClassId"),
};
//课程类型(0-全部,1-正常,2-试听课)
//课程类型(0-全部,1-正常,2-试听课,3-约课)
int ClassType = base.ParmJObj.GetInt("ClassType");
var obj = classModule.GetClassPlanStatisticalModule(query,out _,ClassType: ClassType);
int AppointState = base.ParmJObj.GetInt("AppointState", 0);//约课状态 1待确认 2已确认
var obj = classModule.GetClassPlanStatisticalModule(query,out _,ClassType: ClassType, AppointState);
return ApiResult.Success(data: obj);
}
......@@ -2629,7 +2630,8 @@ namespace Edu.WebApi.Controllers.Course
};
//课程类型(0-全部,1-正常,2-试听课)
int ClassType = base.ParmJObj.GetInt("ClassType");
var obj = classModule.GetClassPlanStatisticalModule(query, out List<object> resultList, ClassType: ClassType);
int AppointState = base.ParmJObj.GetInt("AppointState", 0);//约课状态 1待确认 2已确认
var obj = classModule.GetClassPlanStatisticalModule(query, out List<object> resultList, ClassType: ClassType, AppointState);
List<ExcelDataSource> slist = new List<ExcelDataSource>();
ExcelDataSource header = new ExcelDataSource()
......
......@@ -144,7 +144,8 @@ namespace Edu.WebApi.Controllers.Course
};
//课程类型(0-全部,1-正常,2-试听课)
int ClassType = base.ParmJObj.GetInt("ClassType");
var obj = classModule.GetTeacherPlanStatisticalModule(query, ClassType: ClassType);
int AppointState = base.ParmJObj.GetInt("AppointState", 0);//约课状态 1待确认 2已确认
var obj = classModule.GetTeacherPlanStatisticalModule(query, ClassType: ClassType, AppointState);
return ApiResult.Success(data: obj);
}
......@@ -184,7 +185,8 @@ namespace Edu.WebApi.Controllers.Course
School_Id = -1,
ClassId = base.ParmJObj.GetInt("ClassId"),
OrderBy = base.ParmJObj.GetInt("OrderBy", 0),
ClassType = base.ParmJObj.GetInt("ClassType")// //课程类型(0-全部,1-正常,2-试听课)
ClassType = base.ParmJObj.GetInt("ClassType"),// //课程类型(0-全部,1-正常,2-试听课)
AppointState = base.ParmJObj.GetInt("AppointState", 0)//约课状态 1待确认 2已确认
};
var result = classModule.GetTeacherPlan(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
......@@ -465,5 +467,31 @@ namespace Edu.WebApi.Controllers.Course
return result ? ApiResult.Success() : ApiResult.Failed("上课反馈失败");
}
#endregion
#region 预约课管理
/// <summary>
/// 获取预约课计划
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppointmentPlanStat()
{
var StartDate = base.ParmJObj.GetStringValue("StartDate");
var EndDate = base.ParmJObj.GetStringValue("EndDate");
int TeacherId = base.ParmJObj.GetInt("TeacherId");
int ClassRoomId = base.ParmJObj.GetInt("ClassRoomId");
int ClassType = base.ParmJObj.GetInt("ClassType");//课程类型(0-全部,1-正常,2-试听课)
int AppointState = base.ParmJObj.GetInt("AppointState", 0);//约课状态 1待确认 2已确认
if (string.IsNullOrEmpty(StartDate) || string.IsNullOrEmpty(EndDate)) {
return ApiResult.ParamIsNull();
}
var obj = classModule.GetAppointmentPlanStat(StartDate, EndDate, TeacherId, ClassRoomId, ClassType, AppointState, base.UserInfo.Group_Id);
return ApiResult.Success(data: obj);
}
#endregion
}
}
......@@ -39,7 +39,7 @@
"sTenpayNotifyUrl": "http://eduapi.oytour.com/api/WeChatPay/WxPayCallback", //下单回调地址
"sTenpayNotifyRefundUrl": "http://eduapi.oytour.com/api/WeChatPay/Refunds", //退款回调地址
"FinanceDateBase": "reborn_finance",
"EduDateBase": "uat_reborn_edu",
"EduDateBase": "reborn_edu",
"JHTenantId": "15",
"JHMallBaseId": "5",
"JHMallUserOpenId": "oshxs5I-6uR1J91Rs3QVyi2rJIm4",
......@@ -115,5 +115,5 @@
//投稿审批流程编号
"ContributeFlowId": 10,
//新业绩提成启用时间
"NewAchievementsEnable": "2021-12-01"
"NewAchievementsEnable": "2022-01-01"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment