Commit 21689ea2 authored by 吴春's avatar 吴春

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

parents edc03069 81d80619
...@@ -303,5 +303,10 @@ namespace Edu.Model.Entity.Course ...@@ -303,5 +303,10 @@ namespace Edu.Model.Entity.Course
/// 最开始拆分订单的订单编号【最原始的订单编号】 /// 最开始拆分订单的订单编号【最原始的订单编号】
/// </summary> /// </summary>
public int FirstOrderId { get; set; } public int FirstOrderId { get; set; }
/// <summary>
/// 是否已回归原班(1-是)
/// </summary>
public int IsBackClass { get; set; }
} }
} }
...@@ -32,7 +32,7 @@ namespace Edu.Model.Entity.Course ...@@ -32,7 +32,7 @@ namespace Edu.Model.Entity.Course
public string GuestName { get; set; } public string GuestName { get; set; }
/// <summary> /// <summary>
/// 状态 1正常 2退学 3-申请中,4-驳回申请,5-停课,6-停课申请中,7-完结的订单,8-转班申请中 /// 状态 1正常 2退学 3-申请中,4-驳回申请,5-停课,6-停课申请中,7-完结的订单,8-转班申请中,9-分拆申请
/// </summary> /// </summary>
public int GuestState { get; set; } public int GuestState { get; set; }
......
...@@ -86,6 +86,7 @@ namespace Edu.Model.ViewModel.Course ...@@ -86,6 +86,7 @@ namespace Edu.Model.ViewModel.Course
case 6: str = "停课申请中"; break; case 6: str = "停课申请中"; break;
case 7: str = "完结"; break; case 7: str = "完结"; break;
case 8: str = "转班申请中"; break; case 8: str = "转班申请中"; break;
case 9: str = "分拆申请中"; break;
} }
return str; return str;
} }
......
...@@ -225,5 +225,10 @@ namespace Edu.Model.ViewModel.Course ...@@ -225,5 +225,10 @@ namespace Edu.Model.ViewModel.Course
/// 目标班级名称 /// 目标班级名称
/// </summary> /// </summary>
public string TargetClassName { get; set; } public string TargetClassName { get; set; }
/// <summary>
/// 订单拆分列表
/// </summary>
public List<RB_Order_SplitDetails_ViewModel> SplitDetailsList { get; set; }
} }
} }
\ No newline at end of file
...@@ -2151,15 +2151,27 @@ namespace Edu.Module.Course ...@@ -2151,15 +2151,27 @@ namespace Edu.Module.Course
{ {
idList.AddRange(targetOrderIdList); idList.AddRange(targetOrderIdList);
} }
List<RB_Order_SplitDetails_ViewModel> splitList = new List<RB_Order_SplitDetails_ViewModel>();
var firstOrderList = Common.ConvertHelper.StringToList(string.Join(",", orderList.Where(qitem=>qitem.FirstOrderId>0).Select(x => x.FirstOrderId)));
if (firstOrderList != null && firstOrderList.Count > 0)
{
splitList = splitDetailsRepository.GetOrderSplitDetailsListRepository(new RB_Order_SplitDetails_ViewModel()
{
Q_OldOrderIds = string.Join(",", firstOrderList)
});
}
if (idList != null && idList.Count > 0) if (idList != null && idList.Count > 0)
{ {
string ids = string.Join(",", idList); string ids = string.Join(",", idList);
sourceTargetList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel { QOrderIds = ids }); sourceTargetList = orderRepository.GetOrderListRepository(new RB_Order_ViewModel { QOrderIds = ids });
} }
//获取备注列表 //获取备注列表
var remarkList = order_RemarkRepository.GetOrderRemarkListRepository(new RB_Order_Remark_ViewModel() { QOrderIds = orderIds }); var remarkList = order_RemarkRepository.GetOrderRemarkListRepository(new RB_Order_Remark_ViewModel() { QOrderIds = orderIds });
//获取名单列表 //获取名单列表
var guestList = order_GuestRepository.GetOrderGuestListRepository(new RB_Order_Guest_ViewModel() { OrderIds = orderIds }); var guestList = order_GuestRepository.GetOrderGuestListRepository(new RB_Order_Guest_ViewModel() { OrderIds = orderIds });
//获取合同列表 //获取合同列表
var clist = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds, Status = -1 }).Where(x => x.Status != 4).ToList(); var clist = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds, Status = -1 }).Where(x => x.Status != 4).ToList();
foreach (var item in orderList) foreach (var item in orderList)
...@@ -2172,6 +2184,7 @@ namespace Edu.Module.Course ...@@ -2172,6 +2184,7 @@ namespace Edu.Module.Course
{ {
item.TargetClassName = sourceTargetList?.Where(qitem => qitem.OrderId == item.TargetOrderId)?.FirstOrDefault()?.ClassName; item.TargetClassName = sourceTargetList?.Where(qitem => qitem.OrderId == item.TargetOrderId)?.FirstOrDefault()?.ClassName;
} }
item.SplitDetailsList = splitList.Where(qitem => qitem.OldOrderId == item.OrderId || qitem.OldOrderId == item.FirstOrderId)?.ToList() ?? new List<RB_Order_SplitDetails_ViewModel>();
item.SaleRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 1).ToList(); item.SaleRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 1).ToList();
item.TeacherRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 2).ToList(); item.TeacherRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 2).ToList();
item.RectorRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 3).ToList(); item.RectorRemarkList = remarkList.Where(x => x.OrderId == item.OrderId && x.Type == 3).ToList();
......
...@@ -270,25 +270,42 @@ namespace Edu.Module.EduTask ...@@ -270,25 +270,42 @@ namespace Edu.Module.EduTask
orderModel.UpdateBy = userInfo.Id; orderModel.UpdateBy = userInfo.Id;
orderModel.UpdateTime = DateTime.Now; orderModel.UpdateTime = DateTime.Now;
orderModel.OldGuestId = orderChangeModel.OrderGuestId; orderModel.OldGuestId = orderChangeModel.OrderGuestId;
if (oldOrderModel.SourceOrderId > 0) if (oldOrderModel.FirstOrderId ==0)
{ {
orderModel.FirstOrderId = oldOrderModel.SourceOrderId; orderModel.FirstOrderId = oldOrderModel.OrderId;
} }
else else
{ {
orderModel.FirstOrderId = oldOrderModel.OrderId; orderModel.FirstOrderId = oldOrderModel.FirstOrderId;
} }
flag = orderModule.SetClassOrderCommonModule(orderModel, userInfo, false, out string message); flag = orderModule.SetClassOrderCommonModule(orderModel, userInfo, false, out string message);
#endregion #endregion
if (flag) if (flag)
{ {
if (oldOrderModel.FirstOrderId > 0)
{
//添加关联记录
splitDetailsRepository.Insert(new RB_Order_SplitDetails()
{
OldOrderId = orderModel.FirstOrderId,
S_OrderId = oldOrderModel.OrderId,
S_JoinType = oldOrderModel.JoinType,
S_ClassId = oldOrderModel.ClassId,
T_OrderId = orderModel.OrderId,
T_JoinType = orderModel.JoinType,
T_ClassId = orderModel.ClassId,
CreateBy = orderModel.CreateBy,
CreateTime = DateTime.Now
});
}
#region 修改老订单 【目标订单和应收】 #region 修改老订单 【目标订单和应收】
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Order_ViewModel.TargetOrderId),orderModel.OrderId }, {nameof(RB_Order_ViewModel.TargetOrderId),orderModel.OrderId },
{nameof(RB_Order_ViewModel.PreferPrice),oldPreferPrice }, {nameof(RB_Order_ViewModel.PreferPrice),oldPreferPrice },
{nameof(RB_Order_ViewModel.TargetJoinType),(int) Common.Enum.Sale.OrderJoinTypeEnum.TransOrder }, {nameof(RB_Order_ViewModel.TargetJoinType),(int) Common.Enum.Sale.OrderJoinTypeEnum.TransOrder },
{nameof(RB_Order_ViewModel.FirstOrderId),orderModel.FirstOrderId },
}; };
flag = orderRepository.Update(fileds, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), orderChangeModel.SourceOrderId)); flag = orderRepository.Update(fileds, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), orderChangeModel.SourceOrderId));
#endregion #endregion
...@@ -311,6 +328,7 @@ namespace Edu.Module.EduTask ...@@ -311,6 +328,7 @@ namespace Edu.Module.EduTask
{ {
OrderId = orderChangeModel.SourceOrderId, OrderId = orderChangeModel.SourceOrderId,
GuestId = orderChangeModel.OrderGuestId, GuestId = orderChangeModel.OrderGuestId,
Status=-1,
}).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault(); }).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault();
//创建老订单合同 //创建老订单合同
CreateContract(oldOrderModel, newCourseModel, oldContract, orderChangeModel.OrderGuestId); CreateContract(oldOrderModel, newCourseModel, oldContract, orderChangeModel.OrderGuestId);
...@@ -702,13 +720,13 @@ namespace Edu.Module.EduTask ...@@ -702,13 +720,13 @@ namespace Edu.Module.EduTask
orderModel.OldGuestId = orderChangeModel.OrderGuestId; orderModel.OldGuestId = orderChangeModel.OrderGuestId;
orderModel.NewGuestTotalClassHours = Convert.ToInt32(courseValidHourse); orderModel.NewGuestTotalClassHours = Convert.ToInt32(courseValidHourse);
orderModel.SourceOrderId = orderChangeModel.SourceOrderId; orderModel.SourceOrderId = orderChangeModel.SourceOrderId;
if (oldOrderModel.TargetOrderId==0) if (oldOrderModel.FirstOrderId == 0)
{ {
orderModel.FirstOrderId = oldOrderModel.OrderId; orderModel.FirstOrderId = oldOrderModel.OrderId;
} }
else else
{ {
orderModel.FirstOrderId = oldOrderModel.SourceOrderId; orderModel.FirstOrderId = oldOrderModel.FirstOrderId;
} }
flag = orderModule.SetClassOrderCommonModule(orderModel, userInfo, false, out string message); flag = orderModule.SetClassOrderCommonModule(orderModel, userInfo, false, out string message);
#endregion #endregion
...@@ -735,6 +753,7 @@ namespace Edu.Module.EduTask ...@@ -735,6 +753,7 @@ namespace Edu.Module.EduTask
{nameof(RB_Order_ViewModel.TargetOrderId),orderModel.OrderId }, {nameof(RB_Order_ViewModel.TargetOrderId),orderModel.OrderId },
{nameof(RB_Order_ViewModel.PreferPrice),oldPreferPrice }, {nameof(RB_Order_ViewModel.PreferPrice),oldPreferPrice },
{nameof(RB_Order_ViewModel.TargetJoinType),(int) Common.Enum.Sale.OrderJoinTypeEnum.SplitOrder }, {nameof(RB_Order_ViewModel.TargetJoinType),(int) Common.Enum.Sale.OrderJoinTypeEnum.SplitOrder },
{nameof(RB_Order_ViewModel.FirstOrderId),orderModel.FirstOrderId},
}; };
flag = orderRepository.Update(fileds, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), orderChangeModel.SourceOrderId)); flag = orderRepository.Update(fileds, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), orderChangeModel.SourceOrderId));
#endregion #endregion
...@@ -755,6 +774,7 @@ namespace Edu.Module.EduTask ...@@ -755,6 +774,7 @@ namespace Edu.Module.EduTask
{ {
OrderId = orderChangeModel.SourceOrderId, OrderId = orderChangeModel.SourceOrderId,
GuestId = orderChangeModel.OrderGuestId, GuestId = orderChangeModel.OrderGuestId,
Status=-1,
}).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault(); }).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault();
//生成老订单合同 //生成老订单合同
CreateContract(oldOrderModel, oldCourseModel, oldContract, orderChangeModel.OrderGuestId); CreateContract(oldOrderModel, oldCourseModel, oldContract, orderChangeModel.OrderGuestId);
...@@ -905,13 +925,32 @@ namespace Edu.Module.EduTask ...@@ -905,13 +925,32 @@ namespace Edu.Module.EduTask
/// 回归原班上课 /// 回归原班上课
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool RegressSourceClassModule(int OrderId, int GuestId,int oldOrderId,int oldGuestId) public bool RegressSourceClassModule(int OrderId,out string message)
{ {
bool flag = false; bool flag = false;
var oldOrder = orderRepository.GetEntity(oldOrderId); message = "";
var order = orderRepository.GetEntity(OrderId); var order = orderRepository.GetEntity(OrderId);
var oldGuest = guestRepository.GetEntity(oldGuestId); if (order == null)
var guest = guestRepository.GetEntity(GuestId); {
message = "未找到此订单";
return false;
}
if (order.FirstOrderId <= 0)
{
message = "当前订单不是转班/分拆订单不能回归原班!";
return false;
}
var oldOrder = orderRepository.GetEntity(order.FirstOrderId);
if (oldOrder == null)
{
message = "原订单不是转班/分拆订单不能回归原班!";
return false;
}
var orderguestList = guestRepository.GetOrderGuestListRepository(new RB_Order_Guest_ViewModel() {
OrderIds = OrderId + "," + order.FirstOrderId
});
var oldGuest = orderguestList.Where(qitem=>qitem.OrderId==oldOrder.OrderId)?.FirstOrDefault()??new RB_Order_Guest_ViewModel ();
var guest = orderguestList.Where(qitem => qitem.OrderId == order.OrderId)?.FirstOrDefault() ?? new RB_Order_Guest_ViewModel();
var classList = classRepository.GetClassListRepository(new RB_Class_ViewModel() var classList = classRepository.GetClassListRepository(new RB_Class_ViewModel()
{ {
Q_ClassIds = oldOrder.ClassId + "," + order.ClassId Q_ClassIds = oldOrder.ClassId + "," + order.ClassId
...@@ -921,12 +960,14 @@ namespace Edu.Module.EduTask ...@@ -921,12 +960,14 @@ namespace Edu.Module.EduTask
{ {
OrderId = oldOrder.OrderId, OrderId = oldOrder.OrderId,
GuestId = oldGuest.Id, GuestId = oldGuest.Id,
Status=-1,
}).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault(); }).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault();
var newContract = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel() var newContract = education_ContractRepository.GetList(new RB_Education_Contract_ViewModel()
{ {
OrderId = order.OrderId, OrderId = order.OrderId,
GuestId = guest.Id, GuestId = guest.Id,
Status=-1,
}).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault(); }).Where(qitem => qitem.Status == 0 || qitem.Status == 1 || qitem.Status == 2)?.FirstOrDefault();
var oldClassModel = classList?.Where(qitem => qitem.ClassId == oldOrder.ClassId)?.FirstOrDefault() ?? new RB_Class_ViewModel(); var oldClassModel = classList?.Where(qitem => qitem.ClassId == oldOrder.ClassId)?.FirstOrDefault() ?? new RB_Class_ViewModel();
...@@ -967,7 +1008,8 @@ namespace Edu.Module.EduTask ...@@ -967,7 +1008,8 @@ namespace Edu.Module.EduTask
Dictionary<string, object> newOrderFileds = new Dictionary<string, object>() Dictionary<string, object> newOrderFileds = new Dictionary<string, object>()
{ {
{nameof(RB_Order.PreferPrice),order.PreferPrice-refundMoney} {nameof(RB_Order.PreferPrice),order.PreferPrice-refundMoney},
{nameof(RB_Order.IsBackClass),1}
}; };
//更新新订单应收 //更新新订单应收
flag = orderRepository.Update(newOrderFileds, new WhereHelper(nameof(RB_Order.OrderId), order.OrderId)); flag = orderRepository.Update(newOrderFileds, new WhereHelper(nameof(RB_Order.OrderId), order.OrderId));
...@@ -998,7 +1040,7 @@ namespace Edu.Module.EduTask ...@@ -998,7 +1040,7 @@ namespace Edu.Module.EduTask
{ {
ChangeType = 2, ChangeType = 2,
ClassId = order.ClassId, ClassId = order.ClassId,
GuestId = GuestId, GuestId = guest.Id,
OrderId = order.OrderId, OrderId = order.OrderId,
GuestName = guest.GuestName, GuestName = guest.GuestName,
InCome = refundMoney, InCome = refundMoney,
...@@ -1015,7 +1057,7 @@ namespace Edu.Module.EduTask ...@@ -1015,7 +1057,7 @@ namespace Edu.Module.EduTask
{ {
ChangeType = 2, ChangeType = 2,
ClassId = oldOrder.ClassId, ClassId = oldOrder.ClassId,
GuestId = GuestId, GuestId = guest.Id,
OrderId = oldOrder.OrderId, OrderId = oldOrder.OrderId,
GuestName = guest.GuestName, GuestName = guest.GuestName,
InCome = refundMoney, InCome = refundMoney,
......
...@@ -239,7 +239,21 @@ namespace Edu.WebApi.Controllers.Course ...@@ -239,7 +239,21 @@ namespace Edu.WebApi.Controllers.Course
x.UpOrderId, x.UpOrderId,
x.VisitorReserveId, x.VisitorReserveId,
x.RenewOrderId, x.RenewOrderId,
x.FirstOrderId,
x.IsBackClass,
SplitDetailsList = x?.SplitDetailsList?.Select(qitem => new
{
qitem.S_ClassId,
qitem.S_ClassName,
qitem.S_JoinType,
S_JoinTypeName = qitem.S_JoinType.ToName(),
qitem.S_OrderId,
qitem.T_ClassId,
qitem.T_ClassName,
qitem.T_JoinType,
T_JoinTypeName = qitem.T_JoinType.ToName(),
qitem.T_OrderId
}),
SaleRemarkList = x.SaleRemarkList.Select(z => new SaleRemarkList = x.SaleRemarkList.Select(z => new
{ {
z.Id, z.Id,
...@@ -1263,6 +1277,21 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1263,6 +1277,21 @@ namespace Edu.WebApi.Controllers.Course
OpenTime = Common.ConvertHelper.FormatDate(x.OpenTime), OpenTime = Common.ConvertHelper.FormatDate(x.OpenTime),
x.VisitorReserveId, x.VisitorReserveId,
x.RenewOrderId, x.RenewOrderId,
x.FirstOrderId,
x.IsBackClass,
SplitDetailsList = x?.SplitDetailsList?.Select(qitem => new
{
qitem.S_ClassId,
qitem.S_ClassName,
qitem.S_JoinType,
S_JoinTypeName = qitem.S_JoinType.ToName(),
qitem.S_OrderId,
qitem.T_ClassId,
qitem.T_ClassName,
qitem.T_JoinType,
T_JoinTypeName = qitem.T_JoinType.ToName(),
qitem.T_OrderId
}),
SaleRemarkList = x?.SaleRemarkList.Select(z => new SaleRemarkList = x?.SaleRemarkList.Select(z => new
{ {
z.Id, z.Id,
...@@ -1425,6 +1454,21 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1425,6 +1454,21 @@ namespace Edu.WebApi.Controllers.Course
x.UpOrderId, x.UpOrderId,
x.VisitorReserveId, x.VisitorReserveId,
x.RenewOrderId, x.RenewOrderId,
x.FirstOrderId,
x.IsBackClass,
SplitDetailsList = x?.SplitDetailsList?.Select(qitem => new
{
qitem.S_ClassId,
qitem.S_ClassName,
qitem.S_JoinType,
S_JoinTypeName= qitem.S_JoinType.ToName(),
qitem.S_OrderId,
qitem.T_ClassId,
qitem.T_ClassName,
qitem.T_JoinType,
T_JoinTypeName = qitem.T_JoinType.ToName(),
qitem.T_OrderId
}),
SaleRemarkList = x?.SaleRemarkList.Select(z => new SaleRemarkList = x?.SaleRemarkList.Select(z => new
{ {
z.Id, z.Id,
......
...@@ -85,7 +85,7 @@ namespace Edu.WebApi.Controllers.EduTask ...@@ -85,7 +85,7 @@ namespace Edu.WebApi.Controllers.EduTask
{ {
return ApiResult.ParamIsNull(message: "原订单号不存在!"); return ApiResult.ParamIsNull(message: "原订单号不存在!");
} }
if (oldOrderModel.PreferPrice != (oldOrderModel.Income + oldOrderModel.PlatformTax - oldOrderModel.Refund)) if (oldOrderModel.PreferPrice != (oldOrderModel.Income +oldOrderModel.DiscountMoney+ oldOrderModel.PlatformTax - oldOrderModel.Refund))
{ {
return ApiResult.ParamIsNull(message: "原订单款未收齐,不能转班!"); return ApiResult.ParamIsNull(message: "原订单款未收齐,不能转班!");
} }
...@@ -166,7 +166,7 @@ namespace Edu.WebApi.Controllers.EduTask ...@@ -166,7 +166,7 @@ namespace Edu.WebApi.Controllers.EduTask
{ {
return ApiResult.ParamIsNull(message: "原订单号不存在!"); return ApiResult.ParamIsNull(message: "原订单号不存在!");
} }
if (oldOrderModel.PreferPrice != (oldOrderModel.Income + oldOrderModel.PlatformTax - oldOrderModel.Refund)) if (oldOrderModel.PreferPrice != (oldOrderModel.Income +oldOrderModel.DiscountMoney+ oldOrderModel.PlatformTax - oldOrderModel.Refund))
{ {
return ApiResult.ParamIsNull(message: "原订单款未收齐,不能转班!"); return ApiResult.ParamIsNull(message: "原订单款未收齐,不能转班!");
} }
...@@ -203,11 +203,8 @@ namespace Edu.WebApi.Controllers.EduTask ...@@ -203,11 +203,8 @@ namespace Edu.WebApi.Controllers.EduTask
public ApiResult RegressSourceClass() public ApiResult RegressSourceClass()
{ {
var OrderId = base.ParmJObj.GetInt("OrderId"); var OrderId = base.ParmJObj.GetInt("OrderId");
var GuestId = base.ParmJObj.GetInt("GuestId"); bool flag = orderChangeModule.RegressSourceClassModule(OrderId,out string message);
var oldOrderId = base.ParmJObj.GetInt("oldOrderId"); return flag ? ApiResult.Success() : ApiResult.Failed(message: message);
var oldGuestId = base.ParmJObj.GetInt("oldGuestId");
bool flag = orderChangeModule.RegressSourceClassModule(OrderId, GuestId, oldOrderId, oldGuestId);
return flag ? ApiResult.Success() : ApiResult.Failed();
} }
} }
} }
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