Commit d01e0533 authored by liudong1993's avatar liudong1993

1

parent 8cf5020d
......@@ -73,5 +73,16 @@ namespace Edu.Model.Entity.Customer
/// 合同附件
/// </summary>
public string ContractUrl { get; set; }
}
/// <summary>
/// 返佣比例
/// </summary>
public decimal RebateRate { get; set; }
/// <summary>
/// 固定返佣金额
/// </summary>
public decimal RebateMoney { get; set; }
}
}
......@@ -129,6 +129,11 @@ namespace Edu.Module.Course
/// </summary>
private readonly RB_CustomerRepository customerRepository = new RB_CustomerRepository();
/// <summary>
/// 同行资料
/// </summary>
private readonly RB_Customer_CategoryRepository customer_CategoryRepository = new RB_Customer_CategoryRepository();
/// <summary>
/// 学生关联
/// </summary>
......@@ -450,7 +455,8 @@ namespace Edu.Module.Course
CommissionType = orderCount == 0 ? 1 : 2,
SchoolId = model.School_Id,
GroupId = model.Group_Id,
Remark = ""
Remark = "",
};
if (model.OrderType == OrderTypeEnum.CourseOrder)
{
......@@ -634,33 +640,55 @@ namespace Edu.Module.Course
else if ((int)m.OrderSourceType == 2)
{
var customerModel = customerRepository.GetEntity(m.OrderSourceId);
if (customerModel.CustomerType == Common.Enum.Customer.CatetoryTypeEnum.Company)
var customerCompany = customer_CategoryRepository.GetEntity(customerModel.CategoryId);
//验证订单是否 续费订单
var orderModel = orderRepository.GetEntity(m.OrderId);
if (orderModel.JoinType == OrderJoinTypeEnum.Normal && (customerCompany.RebateRate > 0 || customerCompany.RebateMoney > 0))
{
if (courseModel.CommissionReType == 1)
//同业返佣 只有首单反, 直接默认 次月全提
if (customerCompany.RebateRate > 0)
{
m.CommissionMoeny = Math.Round(sellPrice * ((m.CommissionType == 1 ? courseModel.B2BRebateRatio : courseModel.B2BReNewRatio) / 100), 2, MidpointRounding.AwayFromZero);
m.CommissionMoeny = Math.Round(sellPrice * (customerCompany.RebateRate / 100), 2, MidpointRounding.AwayFromZero);
}
else
{
m.CommissionMoeny = m.CommissionType == 1 ? courseModel.B2BRebateRatio : courseModel.B2BReNewRatio;
m.CommissionMoeny = customerCompany.RebateMoney;
}
m.CommissionReType = m.CommissionType == 1 ? courseModel.B2BRebateRatioType.ToInt() : courseModel.B2BReNewRatioType.ToInt();
m.CommissionReValue = m.CommissionType == 1 ? courseModel.B2BRebateRatioValue : courseModel.B2BReNewRatioValue;
m.Remark = $"学员来源为:同业,学员为{(m.CommissionType == 1 ? "首次报名" : "续费报名")},本次报名金额为:{sellPrice},本次返佣金额为:{m.CommissionMoeny:0.00}";
m.CommissionReType = (int)CourseRebateSetEnum.NextMonth;
m.CommissionReValue = 0;
m.Remark = $"学员来源为:同业,学员为首次报名,本次报名金额为:{sellPrice},本次返佣金额为:{m.CommissionMoeny:0.00}";
}
else
{
if (courseModel.CommissionReType == 1)
//走课程配置
if (customerModel.CustomerType == Common.Enum.Customer.CatetoryTypeEnum.Company)
{
m.CommissionMoeny = Math.Round(sellPrice * ((m.CommissionType == 1 ? courseModel.SchoolRebateRatio : courseModel.SchoolReNewRatio) / 100), 2, MidpointRounding.AwayFromZero);
if (courseModel.CommissionReType == 1)
{
m.CommissionMoeny = Math.Round(sellPrice * ((m.CommissionType == 1 ? courseModel.B2BRebateRatio : courseModel.B2BReNewRatio) / 100), 2, MidpointRounding.AwayFromZero);
}
else
{
m.CommissionMoeny = m.CommissionType == 1 ? courseModel.B2BRebateRatio : courseModel.B2BReNewRatio;
}
m.CommissionReType = m.CommissionType == 1 ? courseModel.B2BRebateRatioType.ToInt() : courseModel.B2BReNewRatioType.ToInt();
m.CommissionReValue = m.CommissionType == 1 ? courseModel.B2BRebateRatioValue : courseModel.B2BReNewRatioValue;
m.Remark = $"学员来源为:同业,学员为{(m.CommissionType == 1 ? "首次报名" : "续费报名")},本次报名金额为:{sellPrice},本次返佣金额为:{m.CommissionMoeny:0.00}";
}
else
{
m.CommissionMoeny = m.CommissionType == 1 ? courseModel.SchoolRebateRatio : courseModel.SchoolReNewRatio;
if (courseModel.CommissionReType == 1)
{
m.CommissionMoeny = Math.Round(sellPrice * ((m.CommissionType == 1 ? courseModel.SchoolRebateRatio : courseModel.SchoolReNewRatio) / 100), 2, MidpointRounding.AwayFromZero);
}
else
{
m.CommissionMoeny = m.CommissionType == 1 ? courseModel.SchoolRebateRatio : courseModel.SchoolReNewRatio;
}
m.CommissionReType = m.CommissionType == 1 ? courseModel.SchoolRebateRatioType.ToInt() : courseModel.SchoolReNewRatioType.ToInt();
m.CommissionReValue = m.CommissionType == 1 ? courseModel.SchoolRebateRatioValue : courseModel.SchoolReNewRatioValue;
m.Remark = $"学员来源为:校代,学员为{(m.CommissionType == 1 ? "首次报名" : "续费报名")},本次报名金额为:{sellPrice},本次返佣金额为:{m.CommissionMoeny:0.00}";
}
m.CommissionReType = m.CommissionType == 1 ? courseModel.SchoolRebateRatioType.ToInt() : courseModel.SchoolReNewRatioType.ToInt();
m.CommissionReValue = m.CommissionType == 1 ? courseModel.SchoolRebateRatioValue : courseModel.SchoolReNewRatioValue;
m.Remark = $"学员来源为:校代,学员为{(m.CommissionType == 1 ? "首次报名" : "续费报名")},本次报名金额为:{sellPrice},本次返佣金额为:{m.CommissionMoeny:0.00}";
}
}
else if ((int)m.OrderSourceType == 3)
......
......@@ -660,6 +660,8 @@ namespace Edu.Module.Customer
{ nameof(RB_Customer_Category_Extend.UpdateTime),model.UpdateTime},
{ nameof(RB_Customer_Category_Extend.IsContract),model.IsContract},
{ nameof(RB_Customer_Category_Extend.ContractUrl),model.ContractUrl},
{ nameof(RB_Customer_Category_Extend.RebateRate),model.RebateRate},
{ nameof(RB_Customer_Category_Extend.RebateMoney),model.RebateMoney},
};
flag = customer_CategoryRepository.Update(fileds, new WhereHelper(nameof(RB_Customer_Category_Extend.CategoryId), model.CategoryId));
}
......
......@@ -973,6 +973,8 @@ namespace Edu.WebApi.Controllers.Customer
item.OrderCount,
item.IsContract,
item.ContractUrl,
item.RebateRate,
item.RebateMoney,
CatetoryTypeName = item.CatetoryType.ToName(),
CreateTime = Common.ConvertHelper.FormatTime(item.CreateTime),
});
......@@ -1097,6 +1099,8 @@ namespace Edu.WebApi.Controllers.Customer
CatetoryType = (CatetoryTypeEnum)base.ParmJObj.GetInt("CatetoryType"),
IsContract=base.ParmJObj.GetInt("IsContract"),
ContractUrl=base.ParmJObj.GetStringValue("ContractUrl"),
RebateRate = base.ParmJObj.GetDecimal("RebateRate"),
RebateMoney = base.ParmJObj.GetDecimal("RebateMoney"),
};
var linkMan = base.ParmJObj.GetStringValue("linkMan");
var linkTel = base.ParmJObj.GetStringValue("linkTel");
......@@ -1179,6 +1183,8 @@ namespace Edu.WebApi.Controllers.Customer
CatetoryTypeName=extModel?.CatetoryType.ToName()??"",
extModel?.ContractUrl,
extModel?.IsContract,
extModel?.RebateRate,
extModel?.RebateMoney
};
return ApiResult.Success(data: obj);
}
......
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