Commit 4cee7ff1 authored by liudong1993's avatar liudong1993

试听课 课时费

parent 67fbe49b
......@@ -107,5 +107,10 @@ namespace Edu.Model.Entity.Sell
/// 提成确认状态0-未确认,1-已确认
/// </summary>
public int SureStatus { get; set; }
/// <summary>
/// 分类 1基础课 2试听课
/// </summary>
public int CouseClassify { get; set; }
}
}
......@@ -74,5 +74,35 @@ namespace Edu.Model.ViewModel.Reserve
/// 转化率
/// </summary>
public decimal ConversionRates { get; set; }
/// <summary>
/// 老师Ids
/// </summary>
public string TeacherIds { get; set; }
/// <summary>
/// 签到人数
/// </summary>
public int CheckNum { get; set; }
/// <summary>
/// 试听课时费
/// </summary>
public decimal ClassHourFee { get; set; }
/// <summary>
/// 是否启用基础课时 1是
/// </summary>
public int BaseHoursEnabled { get; set; }
/// <summary>
/// 启用时间 (存到月)
/// </summary>
public string EnableTime { get; set; }
/// <summary>
/// 校区
/// </summary>
public string SName { get; set; }
}
}
......@@ -11,6 +11,7 @@ using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Finance;
using Edu.Model.ViewModel.Grade;
using Edu.Model.ViewModel.Log;
using Edu.Model.ViewModel.Reserve;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User;
using Edu.Repository.Course;
......@@ -136,6 +137,14 @@ namespace Edu.Module.Course
/// 投稿信息
/// </summary>
private readonly Repository.WeChat.RB_Contribute_InfoRepository contribute_InfoRepository = new Repository.WeChat.RB_Contribute_InfoRepository();
/// <summary>
/// 试听课程
/// </summary>
private readonly RB_TrialLessonRepository trialLessonRepository = new RB_TrialLessonRepository();
/// <summary>
/// 试听班级
/// </summary>
private readonly Repository.Reserve.RB_Reserve_ClassRepository reserve_ClassRepository = new Repository.Reserve.RB_Reserve_ClassRepository();
......@@ -593,10 +602,45 @@ namespace Edu.Module.Course
}
}
}
#region 试听课
List<RB_Teaching_BonusDetail_ViewModel> stDateList = new List<RB_Teaching_BonusDetail_ViewModel>();
var stlist = reserve_ClassRepository.GetClassReserveList(new RB_Reserve_Class_Extend() { Group_Id = userInfo.Group_Id, TeacherIds = dmodel.TeacherIds, ClassTime = StartTime, EndTime = EndTime });
if (stlist.Any()) {
//每次试听课 算一个课时
foreach (var item in stlist) {
stDateList.Add(new RB_Teaching_BonusDetail_ViewModel()
{
BonusId = bonusId,
CheckInNum = item.CheckNum,
ClassId = item.ReserveClassId,
CourseHour = 1,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
Date = item.ClassDate,
Group_Id = dmodel.Group_Id,
Id = 0,
Money = item.ClassHourFee,
School_Id = item.School_Id,
Status = 0,
TeacherId = item.TeacherId,
Type = 1,
UnitPrice = item.ClassHourFee,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now,
CouseClassify = 2
});
}
}
#endregion
var trans = teaching_BonusDetailRepository.DbTransaction;
try
{
decimal TotalMoney = 0;
//基础课
foreach (var item in plist)
{
var dateqList = DateList.Where(x => x.TeacherId == item.TeacherId && x.ClassId == item.ClassId && x.Date == item.ClassDate).ToList();
......@@ -627,10 +671,17 @@ namespace Edu.Module.Course
Type = item.TeacherId == item.Teacher_Id ? 1 : 2,
UnitPrice = unitPrice,
UpdateBy = dmodel.UpdateBy,
UpdateTime = DateTime.Now
UpdateTime = DateTime.Now,
CouseClassify = 1
}, trans);
TotalMoney += ksNum * unitPrice;
}
//试听课
foreach (var item in stDateList) {
teaching_BonusDetailRepository.Insert(item, trans);
TotalMoney += item.Money;
}
#region 更新状态为待确认
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Teaching_Bonus_ViewModel.State), BonusStateEnum.Wait},
......
This diff is collapsed.
......@@ -155,5 +155,80 @@ WHERE 1=1 AND c.Status=0 AND NOT(CONCAT(substring(C.ClassDate,1,10),' ',C.ClassT
}
return result>0;
}
/// <summary>
/// 获取试听班级列表
/// </summary>
/// <param name="rB_Reserve_Class_Extend"></param>
/// <returns></returns>
public List<RB_Reserve_Class_Extend> GetClassReserveList(RB_Reserve_Class_Extend dmodel)
{
string where = " 1=1 and c.Status =0 and c.TrialLessonId >0 and t.CalculateType =2";
if (dmodel.Group_Id > 0)
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.Group_Id)} ={dmodel.Group_Id}";
}
if (!string.IsNullOrEmpty(dmodel.TeacherIds))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.TeacherId)} in({dmodel.TeacherIds})";
}
if (!string.IsNullOrEmpty(dmodel.ClassTime))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.ClassDate)} >='{dmodel.ClassTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.ClassDate)} <='{dmodel.EndTime} 23:59:59'";
}
string sql = $@"select c.*,t.ClassHourFee,t.LessonName as ClassName,(select count(0) from rb_visitor_reserve v where v.ReserveClassId = c.ReserveClassId and v.Status =0 ) as CheckNum
from RB_Reserve_Class c
left join rb_triallesson t on c.TrialLessonId = t.Id
where {where}";
return Get<RB_Reserve_Class_Extend>(sql).ToList();
}
/// <summary>
/// 获取试听班级列表
/// </summary>
/// <param name="userIds"></param>
/// <param name="schoolId"></param>
/// <param name="classId"></param>
/// <param name="startMonth"></param>
/// <param name="endMonth"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public List<RB_Reserve_Class_Extend> GetTeacherHoursDetialList(string userIds, int schoolId, int classId, string startMonth, string endMonth, int groupId)
{
string where = " 1=1 and c.Status =0 and c.TrialLessonId >0 and t.CalculateType =2";
if (groupId > 0)
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.Group_Id)} ={groupId}";
}
if (schoolId > 0)
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.School_Id)} ={schoolId}";
}
if (!string.IsNullOrEmpty(userIds))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.TeacherId)} in({userIds})";
}
if (!string.IsNullOrEmpty(startMonth))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.ClassDate)} >='{startMonth}'";
}
if (!string.IsNullOrEmpty(endMonth))
{
where += $@" and c.{nameof(RB_Reserve_Class_Extend.ClassDate)} <='{endMonth} 23:59:59'";
}
string sql = $@"select c.*,t.ClassHourFee,t.LessonName,t2.TeacherName,t2.BaseHoursEnabled,t2.EnableTime,s.SName
from RB_Reserve_Class c
left join rb_triallesson t on c.TrialLessonId = t.Id
LEFT JOIN rb_teacher t2 on c.TeacherId = t2.TId
left join rb_school s on s.SId = c.School_Id
where {where}";
return Get<RB_Reserve_Class_Extend>(sql).ToList();
}
}
}
......@@ -155,10 +155,13 @@ where {where} order by bd.Date asc";
where += $@" and b.{nameof(RB_Teaching_BonusDetail.Type)} ={demodel.Type}";
}
string sql = $@" select b.*,t.TeacherName,c.ClassName,c.ClassNo,s.SName from RB_Teaching_BonusDetail b
string sql = $@" select b.*,t.TeacherName,case when b.CouseClassify =1 then c.ClassName else tr.LessonName 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
left join rb_class c on b.ClassId = c.ClassId and b.CouseClassify =1
left join rb_school s on b.School_Id = s.SId
left join rb_reserve_class rc on b.ClassId = rc.ReserveClassId and b.CouseClassify =2
left join rb_triallesson tr on rc.TrialLessonId = tr.Id
where {where} order by b.TeacherId asc,b.Date asc";
return Get<RB_Teaching_BonusDetail_ViewModel>(sql).ToList();
}
......
......@@ -268,14 +268,15 @@ namespace Edu.WebApi.Controllers.Course
x.TeacherName,
x.SName,
x.ClassId,
x.ClassName,
x.ClassNo,
ClassName = x.ClassName + (x.CouseClassify == 2 ? "(试听)" : ""),
ClassNo = string.IsNullOrEmpty(x.ClassNo) ? "-" : x.ClassNo,
x.Type,
x.CourseHour,
x.DeductionHour,
x.UnitPrice,
x.CheckInNum,
x.Money
x.Money,
x.CouseClassify
}),
Statistics = slit.GroupBy(x => x.SName).Select(x => new
{
......@@ -342,8 +343,8 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: item.Date.ToString("yyyyMMdd")){ },
new ExcelColumn(value: item.TeacherName){ },
new ExcelColumn(value: item.SName){ },
new ExcelColumn(value: item.ClassNo){ },
new ExcelColumn(value: item.ClassName){ },
new ExcelColumn(value: string.IsNullOrEmpty(item.ClassNo) ? "-" : item.ClassNo){ },
new ExcelColumn(value: item.ClassName + (item.CouseClassify == 2 ? "(试听)" :"")){ },
new ExcelColumn(value: item.Type==1?"带班":"代课"){ },
new ExcelColumn(value: item.DeductionHour.ToString()){ },
new ExcelColumn(value: item.CourseHour.ToString()){ },
......
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