Commit 065557b4 authored by 吴春's avatar 吴春

1

parent f0e2c08a
using Edu.Common.Enum.Course;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Contract;
using System;
using System.Collections.Generic;
namespace Edu.Model.ViewModel.Sell
{
/// <summary>
/// 订单实体类
/// </summary>
[Serializable]
public class RB_Order_Course_ViewModel : RB_Order_Course
{
/// <summary>
/// 订单编号【查询使用】
/// </summary>
public string QOrderIds { get; set; }
/// <summary>
/// 班级ids
/// </summary>
public string ClassIds { get; set; }
/// <summary>
/// 学生Ids(我的客户报名)
/// </summary>
public string StuIds { get; set; }
/// <summary>
/// 项目ids
/// </summary>
public string SourceIds { get; set; }
/// <summary>
/// 讲师名称
/// </summary>
public string TeacherName { get; set; }
/// <summary>
/// 讲师头像
/// </summary>
public string TeacherHead { get; set; }
/// <summary>
/// 班级名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 班号
/// </summary>
public string ClassNo { get; set; }
/// <summary>
/// 留学就业产品名称
/// </summary>
public string StudyName { get; set; }
/// <summary>
/// 协助人员姓名
/// </summary>
public string HelpEnterName { get; set; }
/// <summary>
/// 课程名称
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 课程封面图
/// </summary>
public string CourseImg { get; set; }
/// <summary>
/// 开班时间
/// </summary>
public DateTime OpenTime { get; set; }
/// <summary>
/// 订单学员编号
/// </summary>
public int Student_Id { get; set; }
}
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ using Edu.Common.Enum.User; ...@@ -3,6 +3,7 @@ using Edu.Common.Enum.User;
using Edu.Common.Plugin; using Edu.Common.Plugin;
using Edu.Model.Entity.Sell; using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Contract; using Edu.Model.ViewModel.Contract;
using Edu.Model.ViewModel.Grade;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -124,7 +125,7 @@ namespace Edu.Model.ViewModel.Sell ...@@ -124,7 +125,7 @@ namespace Edu.Model.ViewModel.Sell
/// <summary> /// <summary>
/// 订单课程 2024-09-02 add by:W /// 订单课程 2024-09-02 add by:W
/// </summary> /// </summary>
public List<RB_Order_Course> OrderCourseList { get; set; } public List<RB_Order_Course_ViewModel> OrderCourseList { get; set; }
/// <summary> /// <summary>
/// 客人列表 /// 客人列表
/// </summary> /// </summary>
...@@ -135,6 +136,12 @@ namespace Edu.Model.ViewModel.Sell ...@@ -135,6 +136,12 @@ namespace Edu.Model.ViewModel.Sell
/// </summary> /// </summary>
public List<RB_Education_Contract_ViewModel> ContractList { get; set; } public List<RB_Education_Contract_ViewModel> ContractList { get; set; }
/// <summary>
/// 班级信息
/// </summary>
public List<RB_Class_ViewModel> ClassList { get; set; }
/// <summary> /// <summary>
/// 报名开始时间 /// 报名开始时间
/// </summary> /// </summary>
......
...@@ -2375,7 +2375,24 @@ namespace Edu.Module.Course ...@@ -2375,7 +2375,24 @@ namespace Edu.Module.Course
#region 订单课程信息 2024-09-02 add by:w #region 订单课程信息 2024-09-02 add by:w
if (demodel.OrderCourseList != null && demodel.OrderCourseList.Any()) if (demodel.OrderCourseList != null && demodel.OrderCourseList.Any())
{ {
demodel.OrderCourseList.ForEach(x => x.OrderId = demodel.OrderId); foreach (var item in demodel.OrderCourseList)
{
var courseModel = courseList?.FirstOrDefault(x => x.CourseId == item.CourseId) ?? new RB_Course_ViewModel();
item.OrderId = demodel.OrderId;
item.Class_Price = courseModel?.SellPrice ?? 0;
item.Unit_Price = courseModel?.SellPrice ?? 0;
item.PreferPrice = (courseModel?.SellPrice ?? 0) * StuList.Count();
item.SourceId = demodel.SourceId;
item.HelpEnterId = demodel.HelpEnterId;
item.TransIntroductceRatio = courseModel.TransIntroductceRatio;
item.TransIntroductceReNewRatio = courseModel.TransIntroductceReNewRatio;
item.InnerRecommendRatio = courseModel.InnerRecommendRatio;
item.InnerRecommendReNewRatio = courseModel.InnerRecommendReNewRatio;
item.CommissionReType = courseModel.CommissionReType;
item.ScrollSchoolId = demodel.ScrollSchoolId;
item.StudyBroadRebateMoney = demodel.StudyBroadRebateMoney;
item.GuestNum = demodel.GuestNum;
}
order_CourseRepository.InsertBatch(demodel.OrderCourseList); order_CourseRepository.InsertBatch(demodel.OrderCourseList);
} }
#endregion #endregion
...@@ -2836,7 +2853,7 @@ namespace Edu.Module.Course ...@@ -2836,7 +2853,7 @@ namespace Edu.Module.Course
#endregion #endregion
// 处理返佣信息 // 处理返佣信息
// System.Threading.Tasks.Task.Run(() => SetReturnOrderCommission(demodel)); // System.Threading.Tasks.Task.Run(() => SetReturnOrderCommission(demodel));
} }
#region 写日志 #region 写日志
...@@ -4608,8 +4625,27 @@ namespace Edu.Module.Course ...@@ -4608,8 +4625,27 @@ namespace Edu.Module.Course
//获取订单的返佣 //获取订单的返佣
var rclist = returnComissionRepository.GetOrderReturnComissionListRepositpry(new RB_Order_ReturnComission_ViewModel() { GroupId = demodel.Group_Id, QOrderIds = orderIds }); var rclist = returnComissionRepository.GetOrderReturnComissionListRepositpry(new RB_Order_ReturnComission_ViewModel() { GroupId = demodel.Group_Id, QOrderIds = orderIds });
//获取订单的课程信息
var orderCourseList = order_CourseRepository.GetOrderCourseListRepository(new RB_Order_Course_ViewModel { QOrderIds = orderIds });
List<RB_Class_ViewModel> classList = new List<RB_Class_ViewModel>();
if (orderCourseList != null && orderCourseList.Any())
{
classList = classRepository.GetClassListRepository(new RB_Class_ViewModel { Q_ClassIds = string.Join(",", orderCourseList.Select(x => x.ClassId)), ClassScrollType = 0 });
}
foreach (var item in orderList) foreach (var item in orderList)
{ {
item.ClassList = new List<RB_Class_ViewModel>();
item.OrderCourseList = new List<RB_Order_Course_ViewModel>();
item.OrderCourseList = orderCourseList?.Where(x => x.OrderId == item.OrderId)?.ToList() ?? new List<RB_Order_Course_ViewModel>();
if (item.OrderCourseList != null && item.OrderCourseList.Any() && classList != null && classList.Any())
{
foreach (var itemCourse in item.OrderCourseList)
{
item.ClassList.Add(classList.FirstOrDefault(x => x.ClassId == itemCourse.ClassId));
}
}
if (item.SourceOrderId > 0) if (item.SourceOrderId > 0)
{ {
item.SourceClassName = sourceTargetList?.Where(qitem => qitem.OrderId == item.SourceOrderId)?.FirstOrDefault()?.ClassName; item.SourceClassName = sourceTargetList?.Where(qitem => qitem.OrderId == item.SourceOrderId)?.FirstOrDefault()?.ClassName;
...@@ -4667,7 +4703,6 @@ namespace Edu.Module.Course ...@@ -4667,7 +4703,6 @@ namespace Edu.Module.Course
var tempStu = stuList?.FirstOrDefault(qitem => qitem.OrderId == item.OrderId); var tempStu = stuList?.FirstOrDefault(qitem => qitem.OrderId == item.OrderId);
item.CreateType = tempStu?.CreateType ?? StuCreateTypeEnum.EmployeeInput; item.CreateType = tempStu?.CreateType ?? StuCreateTypeEnum.EmployeeInput;
item.StuSourceIdName = tempStu?.StuSourceIdName ?? ""; item.StuSourceIdName = tempStu?.StuSourceIdName ?? "";
item.BrokerageMoney = rclist.Where(x => x.OrderId == item.OrderId && x.Status > 0).Sum(x => x.CommissionMoeny); item.BrokerageMoney = rclist.Where(x => x.OrderId == item.OrderId && x.Status > 0).Sum(x => x.CommissionMoeny);
} }
} }
......
...@@ -18,7 +18,7 @@ namespace Edu.Repository.Sell ...@@ -18,7 +18,7 @@ namespace Edu.Repository.Sell
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <param name="orderIds"></param> /// <param name="orderIds"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Order_Course> GetOrderCourseListRepository(RB_Order_Course demodel, string OrderIds) public List<RB_Order_Course_ViewModel> GetOrderCourseListRepository(RB_Order_Course_ViewModel demodel)
{ {
string where = $@" 1=1 "; string where = $@" 1=1 ";
if (demodel.Group_Id > 0) if (demodel.Group_Id > 0)
...@@ -33,13 +33,13 @@ namespace Edu.Repository.Sell ...@@ -33,13 +33,13 @@ namespace Edu.Repository.Sell
{ {
where += $@" AND {nameof(RB_Order_Course.ClassId)} ={demodel.ClassId}"; where += $@" AND {nameof(RB_Order_Course.ClassId)} ={demodel.ClassId}";
} }
if (!string.IsNullOrEmpty(OrderIds)) if (!string.IsNullOrEmpty(demodel.QOrderIds))
{ {
where += $@" AND {nameof(RB_Order_Course.OrderId)} in({OrderIds})"; where += $@" AND {nameof(RB_Order_Course.OrderId)} in({demodel.QOrderIds})";
} }
string sql = $@" SELECT * FROM RB_Order_Course WHERE {where}"; string sql = $@" SELECT * FROM RB_Order_Course WHERE {where}";
return Get<RB_Order_Course>(sql).ToList(); return Get<RB_Order_Course_ViewModel>(sql).ToList();
} }
} }
} }
...@@ -224,6 +224,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -224,6 +224,7 @@ namespace Edu.WebApi.Controllers.Course
{ {
NorList = orderList.Where(x => x.OrderState != Common.Enum.Course.OrderStateEnum.Cancel).Select(x => new NorList = orderList.Where(x => x.OrderState != Common.Enum.Course.OrderStateEnum.Cancel).Select(x => new
{ {
ClassList = x.ClassList?.Select(z => new { z.ClassId, z.ClassName, z.CouseId, z.CourseSubjectName, z.CourseName, z.TeacherName, z.Teacher_Id, OpenTimeStr = StringHelper.FormatDate(z.OpenTime) }),
x.OrderId, x.OrderId,
x.ClassId, x.ClassId,
x.ClassName, x.ClassName,
...@@ -360,6 +361,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -360,6 +361,7 @@ namespace Edu.WebApi.Controllers.Course
}), }),
CancelList = orderList.Where(x => x.OrderState == Common.Enum.Course.OrderStateEnum.Cancel).Select(x => new CancelList = orderList.Where(x => x.OrderState == Common.Enum.Course.OrderStateEnum.Cancel).Select(x => new
{ {
ClassList = x.ClassList?.Select(z => new { z.ClassId, z.ClassName, z.CouseId, z.CourseSubjectName, z.CourseName, z.TeacherName, z.Teacher_Id, OpenTimeStr = StringHelper.FormatDate(z.OpenTime) }),
x.OrderId, x.OrderId,
x.ClassId, x.ClassId,
x.TradeWay, x.TradeWay,
...@@ -943,7 +945,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -943,7 +945,7 @@ namespace Edu.WebApi.Controllers.Course
var flag = false; var flag = false;
string message = ""; string message = "";
//订单课程 //订单课程
demodel.OrderCourseList = new List<Model.Entity.Sell.RB_Order_Course>(); demodel.OrderCourseList = new List<RB_Order_Course_ViewModel>();
var orderCourseListStr = base.ParmJObj.GetStringValue("OrderCourseList"); var orderCourseListStr = base.ParmJObj.GetStringValue("OrderCourseList");
if (!string.IsNullOrWhiteSpace(orderCourseListStr)) if (!string.IsNullOrWhiteSpace(orderCourseListStr))
{ {
...@@ -951,7 +953,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -951,7 +953,7 @@ namespace Edu.WebApi.Controllers.Course
foreach (var itemOrderCourse in OrderCourseObjList) foreach (var itemOrderCourse in OrderCourseObjList)
{ {
JObject parmsI = JObject.Parse(itemOrderCourse.ToString()); JObject parmsI = JObject.Parse(itemOrderCourse.ToString());
Model.Entity.Sell.RB_Order_Course orderCourseModel = new Model.Entity.Sell.RB_Order_Course RB_Order_Course_ViewModel orderCourseModel = new RB_Order_Course_ViewModel
{ {
OrderCourseId = parmsI.GetInt("OrderCourseId"), OrderCourseId = parmsI.GetInt("OrderCourseId"),
OrderId = parmsI.GetInt("OrderId"), OrderId = parmsI.GetInt("OrderId"),
...@@ -1142,7 +1144,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1142,7 +1144,7 @@ namespace Edu.WebApi.Controllers.Course
} }
//订单课程 //订单课程
demodel.OrderCourseList = new List<Model.Entity.Sell.RB_Order_Course>(); demodel.OrderCourseList = new List<RB_Order_Course_ViewModel>();
var orderCourseListStr = parms.GetStringValue("OrderCourseList"); var orderCourseListStr = parms.GetStringValue("OrderCourseList");
if (!string.IsNullOrWhiteSpace(orderCourseListStr)) if (!string.IsNullOrWhiteSpace(orderCourseListStr))
{ {
...@@ -1150,7 +1152,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1150,7 +1152,7 @@ namespace Edu.WebApi.Controllers.Course
foreach (var itemOrderCourse in OrderCourseObjList) foreach (var itemOrderCourse in OrderCourseObjList)
{ {
JObject parmsI = JObject.Parse(itemOrderCourse.ToString()); JObject parmsI = JObject.Parse(itemOrderCourse.ToString());
Model.Entity.Sell.RB_Order_Course orderCourseModel = new Model.Entity.Sell.RB_Order_Course RB_Order_Course_ViewModel orderCourseModel = new RB_Order_Course_ViewModel
{ {
OrderCourseId = parmsI.GetInt("OrderCourseId"), OrderCourseId = parmsI.GetInt("OrderCourseId"),
OrderId = parmsI.GetInt("OrderId"), OrderId = parmsI.GetInt("OrderId"),
...@@ -1942,6 +1944,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1942,6 +1944,7 @@ namespace Edu.WebApi.Controllers.Course
}, },
List = orderList?.Select(x => new List = orderList?.Select(x => new
{ {
ClassList = x.ClassList?.Select(z => new { z.ClassId, z.ClassName, z.CouseId, z.CourseSubjectName, z.CourseName, z.TeacherName, z.Teacher_Id, OpenTimeStr = StringHelper.FormatDate(z.OpenTime) }),
x.OrderId, x.OrderId,
x.ClassId, x.ClassId,
x.CourseId, x.CourseId,
...@@ -2147,6 +2150,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -2147,6 +2150,7 @@ namespace Edu.WebApi.Controllers.Course
}, },
List = orderList?.Select(x => new List = orderList?.Select(x => new
{ {
ClassList = x.ClassList?.Select(z => new { z.ClassId, z.ClassName, z.CouseId, z.CourseSubjectName, z.CourseName, z.TeacherName, z.Teacher_Id, OpenTimeStr = StringHelper.FormatDate(z.OpenTime) }),
x.OrderId, x.OrderId,
x.ClassId, x.ClassId,
x.ClassNo, x.ClassNo,
...@@ -2391,7 +2395,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -2391,7 +2395,7 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: (item.HelpEnterId > 0 ? UserReidsCache.GetUserLoginInfo(item.HelpEnterId)?.AccountName ?? "" : "")){ }, new ExcelColumn(value: (item.HelpEnterId > 0 ? UserReidsCache.GetUserLoginInfo(item.HelpEnterId)?.AccountName ?? "" : "")){ },
new ExcelColumn(value: item.ClassName){ }, new ExcelColumn(value: item.ClassName){ },
new ExcelColumn(value: item.OpenTime.ToString("yyyy-MM-dd")){ }, new ExcelColumn(value: item.OpenTime.ToString("yyyy-MM-dd")){ },
new ExcelColumn(value: item.CourseName){ }, new ExcelColumn(value: (item.ClassList!=null&&item.ClassList.Any())?(string.Join(",",item.ClassList.Select(x=>x.CourseName))): item.CourseName){ },
new ExcelColumn(value: item.GuestNum.ToString()){ }, new ExcelColumn(value: item.GuestNum.ToString()){ },
new ExcelColumn(value: item.Class_Price.ToString("#0.00")+"\r\n"+(item.SellPriceType==2?"课时单价":"课时总价")){ }, new ExcelColumn(value: item.Class_Price.ToString("#0.00")+"\r\n"+(item.SellPriceType==2?"课时单价":"课时总价")){ },
new ExcelColumn(value: item.Unit_Price.ToString("#0.00")){ }, new ExcelColumn(value: item.Unit_Price.ToString("#0.00")){ },
......
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