Commit dc4ef83f authored by liudong1993's avatar liudong1993

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

parents c319529e 9c6f6bc2
......@@ -143,5 +143,10 @@ namespace Edu.Model.Entity.Course
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 续费订单号
/// </summary>
public int RenewOrderId { get; set; }
}
}
......@@ -57,10 +57,12 @@ namespace Edu.Model.ViewModel.Course
/// 班级对应的老师id
/// </summary>
public int Teacher_Id { get; set; }
/// <summary>
/// 教师ids
/// </summary>
public string Q_TeacherIds { get; set; }
/// <summary>
/// 上课开始时间
/// </summary>
......@@ -69,5 +71,10 @@ namespace Edu.Model.ViewModel.Course
/// 上课结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 上课日期【查询使用】
/// </summary>
public string QClassDateStr { get; set; }
}
}
......@@ -126,5 +126,10 @@ namespace Edu.Model.ViewModel.Course
/// 具体开课时间
/// </summary>
public string NewPlanDateTime { get; set; }
/// <summary>
/// 原班级id
/// </summary>
public int OldClassId { get; set; }
}
}
\ No newline at end of file
......@@ -133,24 +133,36 @@ namespace Edu.Module.Course
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <param name="isGetStepPrice">是否查询阶梯价格</param>
/// <returns></returns>
public List<RB_Class_ViewModel> GetClassPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Class_ViewModel query)
public List<RB_Class_ViewModel> GetClassPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Class_ViewModel query,bool isGetStepPrice=false)
{
var list = classRepository.GetClassPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
var classTimeList = new List<RB_Class_Time_ViewModel>();
var classOrderList = new List<RB_Order_ViewModel>();
var stepPriceList = new List<RB_Class_StepPrice_ViewModel>();
string ids = string.Join(",", list.Select(qitem => qitem.ClassId));
if (!string.IsNullOrEmpty(ids))
{
classTimeList = class_TimeRepository.GetClassTimeListRepository(ids);
classOrderList = orderRepository.GetClassOrderPeopleNum(ids);
}
if (isGetStepPrice)
{
stepPriceList=class_StepPriceRepository.GetClassStepPriceListRepository(new RB_Class_StepPrice_ViewModel() { QClassIds = ids })?.ToList() ?? new List<RB_Class_StepPrice_ViewModel>();
}
//课程计划上课日期
foreach (var item in list)
{
item.NewPlanDateTime = classTimeList?.Where(qitem => qitem.ClassId == item.ClassId)?.FirstOrDefault()?.NewPlanDateTime;
item.OrderStudentCount = classOrderList?.Where(qitem => qitem.ClassId == item.ClassId)?.FirstOrDefault()?.GuestNum ?? 0;
if (isGetStepPrice)
{
item.ClassStepPriceList = stepPriceList?.Where(qitem => qitem.ClassId == item.ClassId)?.ToList() ?? new List<RB_Class_StepPrice_ViewModel>();
}
}
}
return list;
......@@ -1059,6 +1071,7 @@ namespace Edu.Module.Course
{
return class_PlanRepository.GetClassPlanModelRepository(query);
}
/// <summary>
/// 获取每天签到记录
/// </summary>
......
......@@ -85,7 +85,10 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_Finance_ConfigRepository finance_ConfigRepository = new RB_Finance_ConfigRepository();
/// <summary>
/// 班级处理类
/// </summary>
private readonly ClassModule classModule = new ClassModule();
/// <summary>
/// 获取学员退课单据分页列表
......@@ -953,7 +956,7 @@ namespace Edu.Module.Course
/// <param name="orderModel">订单实体类</param>
/// <param name="message">提示信息</param>
/// <returns></returns>
public bool RenewOrderModule(int orderId, int guestId, RB_Order_ViewModel orderModel, out string message)
public virtual bool RenewOrderModule(int orderId, int guestId, RB_Order_ViewModel orderModel, out string message)
{
bool flag = false;
message = "";
......@@ -983,7 +986,12 @@ namespace Edu.Module.Course
flag = false;
return flag;
}
var classModel = classRepository.GetEntity(orderModel.ClassId);
orderModel.School_Id = classModel?.School_Id ?? 0;
orderModel.EnterID = oldOrderModel.EnterID;
orderModel.OrderState = OrderStateEnum.Normal;
orderModel.OrderSource = oldOrderModel.OrderSource;
orderModel.OrderForm = oldOrderModel.OrderForm;
//新增订单
var newOrderId = orderRepository.Insert(orderModel);
......@@ -1021,7 +1029,50 @@ namespace Edu.Module.Course
guestModel.Id = newGuestId;
flag = newGuestId > 0;
}
if (flag)
{
Dictionary<string, object> orderFileds = new Dictionary<string, object>()
{
{nameof(RB_Order.RenewOrderId), newOrderId}
};
flag = orderRepository.Update(orderFileds, new WhereHelper(nameof(RB_Order.OrderId), orderId));
}
return flag;
}
/// <summary>
/// 获取续费课程列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetRenewClassModule(int pageIndex, int pageSize, out long rowsCount, RB_Class_ViewModel query)
{
List<object> list = new List<object>();
var classList = classModule.GetClassPageListModule(pageIndex, pageSize, out rowsCount, query, isGetStepPrice: true);
foreach (var item in classList)
{
var obj = new
{
item.ClassId,
item.ClassName,
item.CourseName,
item.ClassHours,
item.TeacherName,
item.RoomName,
OpenTime = Common.ConvertHelper.FormatDate(item.OpenTime),
item.OriginalPrice,
item.SellPrice,
item.ClassPersion,
item.OrderStudentCount,
item.ClassStepPriceList,
item.InnerRemark
};
list.Add(obj);
}
return list;
}
}
}
......@@ -129,11 +129,12 @@ SELECT A.*,B.CourseName,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.CourseName,C.AssistName,IFNULL(C.AssistIcon,'') AS AssistIcon,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead
,E.SName AS SchoolName
,E.SName AS SchoolName,IFNULL(F.RoomName,'') AS RoomName
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_assist AS C ON A.Assist_Id=C.AId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
LEFT JOIN rb_school AS E ON A.School_Id=E.SId
LEFT JOIN rb_class_room AS F ON A.ClassRoomId=F.RoomId
WHERE 1=1
");
if (query != null)
......@@ -174,6 +175,18 @@ WHERE 1=1
builder.AppendFormat(" AND D.{0} LIKE @TeacherName ", nameof(RB_Teacher_ViewModel.TeacherName));
parameters.Add("TeacherName", "%" + query.TeacherName.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.AppendFormat(" AND A.{0}>='{1}' ", nameof(RB_Class_ViewModel.OpenTime), query.StartTime);
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Class_ViewModel.OpenTime), query.EndTime);
}
if (query.OldClassId > 0)
{
builder.AppendFormat(" AND A.{0}<>{1} ", nameof(RB_Class_ViewModel.ClassId), query.OldClassId);
}
}
return GetPage<RB_Class_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
......
......@@ -233,8 +233,10 @@ LEFT JOIN rb_teacher as c on c.TId=a.TeacherId
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT a.* from rb_class_plan as a
where a.`Status`=0 and DATE_FORMAT(a.ClassDate,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d') ");
builder.AppendFormat(@"
SELECT a.*
FROM rb_class_plan as a
WHERE a.`Status`=0 ");
if (query != null)
{
if (query.Group_Id > 0)
......@@ -253,8 +255,16 @@ LEFT JOIN rb_teacher as c on c.TId=a.TeacherId
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Class_Plan_ViewModel.Status), (int)query.Status);
}
if (!string.IsNullOrEmpty(query.QClassDateStr))
{
builder.AppendFormat(@" AND DATE_FORMAT(a.ClassDate,'%Y-%m-%d')=DATE_FORMAT('{0}','%Y-%m-%d') ", query.QClassDateStr);
}
else
{
builder.AppendFormat(@" AND DATE_FORMAT(a.ClassDate,'%Y-%m-%d')=DATE_FORMAT(NOW(),'%Y-%m-%d') ");
}
}
builder.AppendFormat(@" order by ClassDate desc ");
builder.AppendFormat(@" ORDER BY ClassDate DESC ");
return Get<RB_Class_Plan_ViewModel>(builder.ToString()).ToList();
}
......
......@@ -601,7 +601,12 @@ namespace Edu.WebApi.Controllers.Course
}
//判断今天有课没有
var planList = classModule.GetClassPlanModelRepository(new RB_Class_Plan_ViewModel { Group_Id = base.UserInfo.Group_Id, ClassId = list.FirstOrDefault().ClassId });
var planList = classModule.GetClassPlanModelRepository(new RB_Class_Plan_ViewModel
{
Group_Id = base.UserInfo.Group_Id,
ClassId = list.FirstOrDefault().ClassId,
QClassDateStr = Common.ConvertHelper.FormatDate(list.FirstOrDefault().ClassDate),
});
if (planList == null || !planList.Any())
{
return ApiResult.Failed("今日无课程,无须签到");
......
......@@ -710,7 +710,7 @@ namespace Edu.WebApi.Controllers.Course
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var dmodel = JsonHelper.DeserializeObject<RB_Order_Guest_ViewModel>(RequestParm.Msg.ToString());
dmodel.Group_Id = userInfo.Group_Id;
var list = orderModule.GetOrderGuestPageList(pageModel.PageIndex, pageModel.PageSize, out long count, dmodel);
pageModel.Count = Convert.ToInt32(count);
pageModel.PageData = list.Select(x => new
......@@ -735,6 +735,7 @@ namespace Edu.WebApi.Controllers.Course
x.Contact,
x.ContactMobile,
UpdateTime = x.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss"),
IsShow=true,
});
return ApiResult.Success("", pageModel);
}
......
......@@ -121,7 +121,6 @@ namespace Edu.WebApi.Controllers.Course
/// 获取学员预计退课金额
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetBackBillMoney()
{
......@@ -182,8 +181,13 @@ namespace Edu.WebApi.Controllers.Course
int guestId = base.ParmJObj.GetInt("GuestId");
var orderModel = new RB_Order_ViewModel()
{
SaleRemark="学员续费",
Class_Price = base.ParmJObj.GetDecimal("Class_Price"),//单价
Unit_Price = base.ParmJObj.GetDecimal("Class_Price"),//成交单价
GuestNum = 1,
PreferPrice = base.ParmJObj.GetDecimal("PreferPrice"),//应收,
Income = 0,
ClassId = base.ParmJObj.GetInt("ClassId"),//班级编号
SaleRemark =base.ParmJObj.GetStringValue("SaleRemark"),//销售备注
CreateBy=base.UserInfo.Id,
CreateTime=DateTime.Now,
UpdateBy=base.UserInfo.Id,
......@@ -194,5 +198,29 @@ namespace Edu.WebApi.Controllers.Course
bool flag = studentBillModule.RenewOrderModule(OrderId, guestId, orderModel,out string message);
return flag ? ApiResult.Success() : ApiResult.Failed(message: message);
}
/// <summary>
/// 获取续费班级列表
/// </summary>
/// <returns></returns>
public ApiResult GetRenewClass()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Class_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id"),
ClassType = base.ParmJObj.GetInt("ClassType"),
StartTime = base.ParmJObj.GetStringValue("StartTime"),
EndTime = base.ParmJObj.GetStringValue("EndTime"),
TeacherName = base.ParmJObj.GetStringValue("TeacherName"),
CouseId = base.ParmJObj.GetInt("CouseId"),
OldClassId = base.ParmJObj.GetInt("ClassId")
};
var obj = studentBillModule.GetRenewClassModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = Convert.ToInt32(rowsCount);
pageModel.PageData = obj;
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