Commit 68314148 authored by 黄奎's avatar 黄奎

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

parents 6e3d7884 6f42368a
......@@ -148,5 +148,10 @@ namespace Edu.Model.Entity.Course
/// 续费订单号
/// </summary>
public int RenewOrderId { get; set; }
/// <summary>
/// 报价单id
/// </summary>
public int OfferId { get; set; }
}
}
......@@ -26,6 +26,10 @@ namespace Edu.Model.ViewModel.Course
public string QOfferIds { get; set; }
/// <summary>
/// 班级id
/// </summary>
public int ClassId { get; set; }
/// 课程源数据
/// </summary>
public object SourceData { get; set; }
......
using Edu.AOP.CustomerAttribute;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Repository.Course;
using Edu.Repository.Log;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
using VT.FW.DB;
......@@ -23,6 +27,22 @@ namespace Edu.Module.Course
private readonly RB_Course_OfferDetailsRepository course_OfferDetailsRepository = new RB_Course_OfferDetailsRepository();
/// <summary>
/// 订单
/// </summary>
private readonly RB_OrderRepository orderRepository = new RB_OrderRepository();
/// <summary>
/// 订单备注
/// </summary>
private readonly RB_Order_RemarkRepository order_RemarkRepository = new RB_Order_RemarkRepository();
/// <summary>
/// 用户日志
/// </summary>
private readonly RB_User_ChangeLogRepository changeLogRepository = new RB_User_ChangeLogRepository();
/// <summary>
/// 账号
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// 课程处理类对象
/// </summary>
private readonly CourseModule courseModule = new CourseModule();
......@@ -225,5 +245,89 @@ namespace Edu.Module.Course
var flag = course_OfferRepository.Update(fileds, new WhereHelper(nameof(RB_Course_Offer_ViewModel.Id), Id));
return flag;
}
#region 报价单创建订单
/// <summary>
/// 创建订单
/// </summary>
/// <param name="offerId"></param>
/// <param name="detailList"></param>
/// <param name="createBy"></param>
/// <returns></returns>
public bool SetOfferCreateOrder(int offerId, List<RB_Course_OfferDetails_ViewModel> detailList, int createBy) {
var emModel = accountRepository.GetEmployeeInfo(createBy);
foreach (var item in detailList) {
try
{
decimal uPrice = item.OriginalPrice / item.JoinNum;
int OrderId = orderRepository.Insert(new Model.Entity.Course.RB_Order()
{
ClassId = item.ClassId,
Class_Price = uPrice,
CommissionMoney = -1,
CreateBy = createBy,
CreateTime = DateTime.Now,
Dept_Id = emModel?.Dept_Id ?? 0,
School_Id = emModel?.School_Id ?? 0,
Group_Id = emModel?.Group_Id ?? 0,
DirectorRemark = "",
DiscountMoney = item.DiscountPrice,
EnterID = createBy,
ExtraDeductMoney = 0,
ExtraRewardMoney = 0,
GuestNum = item.JoinNum,
Income = 0,
IsCommissionGive = 0,
OrderForm = Common.Enum.Course.OrderFormEnum.Computer,
OrderId = 0,
OrderSource = Common.Enum.Course.OrderSourceEnum.Employee,
OrderState = Common.Enum.Course.OrderStateEnum.Normal,
PlatformTax = 0,
PreferPrice = item.OriginalPrice,
RectorRemark = "",
Refund = 0,
RenewOrderId = 0,
SaleRemark = item.Remark,
TeacherRemark = "",
TradeWay = Common.Enum.Course.TradeWayEnum.OnLine,
Unit_Price = uPrice,
UpdateBy = createBy,
UpdateTime = DateTime.Now,
OfferId = offerId
});
if (OrderId > 0) {
order_RemarkRepository.Insert(new Model.Entity.Course.RB_Order_Remark()
{
Id = 0,
OrderId = OrderId,
Type = 1,
Content = item.Remark,
CreateBy = createBy,
CreateTime = DateTime.Now
});
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
AccountType = emModel?.AccountType ?? 0,
Type = 2,
SourceId = OrderId,
LogContent = "由报价单自动创建订单",
School_Id = emModel?.School_Id ?? 0,
Group_Id = emModel?.Group_Id ?? 0,
CreateBy = createBy,
CreateTime = DateTime.Now
});
}
}
catch (Exception ex)
{
LogHelper.Write(ex, "报价单创建订单失败,offerId:" + offerId + ",DetailsId:" + item.DetailsId + ",ClassId:" + item.ClassId);
}
}
return true;
}
#endregion
}
}
......@@ -488,7 +488,7 @@ WHERE 1=1 {4}
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.Id,A.Account,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon
SELECT A.Id,A.Account,A.Group_Id,A.School_Id,A.EmployeeName,A.UserIcon,A.AccountType
,IFNULL(G.GroupName,'') AS GroupName,IFNULL(s.SName,'') AS SchoolName
,IFNULL(d.DeptId,0) AS Dept_Id,IFNULL(d.DeptName,'') AS DeptName,IFNULL(p.PostId,0) AS Post_Id, IFNULL(p.PostName,'') AS PostName
FROM
......
......@@ -158,6 +158,7 @@ namespace Edu.WebApi.Controllers.Course
x.TeacherRemark,
x.RectorRemark,
x.DirectorRemark,
x.OfferId,
SaleRemarkList = x.SaleRemarkList.Select(z => new
{
z.Id,
......@@ -219,6 +220,7 @@ namespace Edu.WebApi.Controllers.Course
x.TeacherRemark,
x.RectorRemark,
x.DirectorRemark,
x.OfferId,
SaleRemarkList = x.SaleRemarkList.Select(z => new
{
z.Id,
......@@ -900,6 +902,7 @@ namespace Edu.WebApi.Controllers.Course
x.TeacherRemark,
x.RectorRemark,
x.DirectorRemark,
x.OfferId,
SaleRemarkList = x.SaleRemarkList.Select(z => new
{
z.Id,
......
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