Commit f0e2c08a authored by 吴春's avatar 吴春

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

parents 30626681 0dc3135a
......@@ -147,5 +147,15 @@ namespace Edu.Model.Entity.Sell
/// </summary>
public decimal PeopleNumMoney { get; set; }
/// <summary>
/// 是否 部门共同奖金 1是
/// </summary>
public int IsCommonDept { get; set; }
/// <summary>
/// 订单业绩
/// </summary>
public decimal OrderSaleMoney { get; set; }
}
}
......@@ -92,5 +92,10 @@ namespace Edu.Model.Entity.Sell
/// </summary>
public decimal PeopleNumMoney { get; set; }
/// <summary>
/// 是否 部门共同奖金 1是
/// </summary>
public int IsCommonDept { get; set; }
}
}
......@@ -122,5 +122,15 @@ namespace Edu.Model.Entity.Sell
/// </summary>
public string ZGAwardRule { get; set; }
}
/// <summary>
/// 是否部门共同奖金
/// </summary>
public int IsDeptAward { get; set; }
/// <summary>
/// 部门分配规则
/// </summary>
public string DeptAwardAllotRule { get; set; }
}
}
......@@ -73,5 +73,10 @@ namespace Edu.Model.ViewModel.Sell
/// 总提成数
/// </summary>
public decimal TotalMoney { get; set; }
/// <summary>
/// 使用规则ID
/// </summary>
public int RuleId { get; set; }
}
}
\ No newline at end of file
......@@ -41,6 +41,11 @@ namespace Edu.Model.ViewModel.Sell
/// 业绩比例
/// </summary>
public List<AchievementsRateModel> ZGAwardList { get; set; }
/// <summary>
/// 部门分配规则
/// </summary>
public List<DeptAllotModel> DeptAwardList { get; set; }
}
/// <summary>
......@@ -60,4 +65,22 @@ namespace Edu.Model.ViewModel.Sell
/// </summary>
public decimal Rate { get; set; }
}
/// <summary>
/// 共同奖金包分配
/// </summary>
public class DeptAllotModel {
/// <summary>
/// 人员ID
/// </summary>
public int EmpId { get; set; }
/// <summary>
/// 人员姓名
/// </summary>
public string EmName { get; set; }
/// <summary>
/// 分配比例
/// </summary>
public decimal Rate { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -1312,6 +1312,21 @@ group by o.OrderId
;";
return Get<RB_Order_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取续费订单的 首单市场人员
/// </summary>
/// <param name="groupId"></param>
/// <param name="orderIds"></param>
/// <returns></returns>
public List<RB_Order_ViewModel> GetXFOrderFirstEnterList(int groupId, string orderIds) {
string sql = $@"SELECT o.OrderId,o.EnterID,t.Student_Id as Q_StudentId FROM rb_student_orderguest t
left join rb_student_orderguest t2 on t.Student_Id = t2.Student_Id
left join rb_order o on t2.OrderId =o.OrderId
WHERE o.Group_Id={groupId} and t.OrderId in({orderIds}) and o.OrderState =1 and o.PreferPrice>0
";
return Get<RB_Order_ViewModel>(sql).ToList();
}
#endregion
/// <summary>
......
......@@ -65,6 +65,10 @@ namespace Edu.Repository.Sell
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsDept)} ={demodel.IsDept}";
}
if (demodel.IsCommonDept > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsCommonDept)} ={demodel.IsCommonDept}";
}
if (demodel.RelatedId > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.RelatedId)} ={demodel.RelatedId}";
......@@ -119,6 +123,10 @@ namespace Edu.Repository.Sell
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsDept)} ={demodel.IsDept}";
}
if (demodel.IsCommonDept > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsCommonDept)} ={demodel.IsCommonDept}";
}
string sql = $@" select r.*,
......@@ -175,6 +183,10 @@ from RB_Sell_Achievements_Details r where {where} order by r.Id asc";
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsDept)} ={demodel.IsDept}";
}
if (demodel.IsCommonDept > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsCommonDept)} ={demodel.IsCommonDept}";
}
string sql = $@" select r.* from RB_Sell_Achievements_Details r where {where} order by r.Id desc";
return GetPage<RB_Sell_Achievements_Details_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
......@@ -223,8 +235,13 @@ from RB_Sell_Achievements_Details r where {where} order by r.Id asc";
}
string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,sum(r.StudentCount) as StudentCount,sum(r.CurrentPeriodMoney + r.DeductionMoney) as CurrentPeriodMoney,sum(r.PeopleNumMoney) as PeopleNumMoney
from RB_Sell_Achievements_Details r where {where} group by r.UserId,r.Depart_Id,r.School_Id";
string sql = $@" select r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept,p.RuleId,sum(r.StudentCount) as StudentCount,sum(r.CurrentPeriodMoney + r.DeductionMoney) as CurrentPeriodMoney,sum(r.PeopleNumMoney) as PeopleNumMoney
from RB_Sell_Achievements_Details r
left join(
select e.OrderId,e.EmpId,max(e.RuleId) as RuleId from rb_sell_achievements_emp e group by e.OrderId,e.EmpId
) p on r.OrderId = p.OrderId and r.UserId = p.EmpId
where {where} group by r.UserId,r.Depart_Id,r.School_Id,r.IsCommonDept";
return Get<RB_Sell_Achievements_Details_ViewModel>(sql).ToList();
}
......@@ -288,6 +305,10 @@ GROUP BY PeriodId ";
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsDept)} ={demodel.IsDept}";
}
if (demodel.IsCommonDept > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Details_ViewModel.IsCommonDept)} ={demodel.IsCommonDept}";
}
string sql = $@" select sum(r.CurrentPeriodMoney + r.DeductionMoney + r.PeopleNumMoney) from RB_Sell_Achievements_Details r where {where}";
......
......@@ -188,9 +188,10 @@ GROUP BY e.Type,e.EmpId,e.Rate,e.IsDept,p.Periods";
/// <returns></returns>
public List<RB_Sell_Achievements_Emp_ViewModel> GetAllRefundWaitPendingList(int group_Id)
{
string sql = $@"SELECT e.*,(o.Income - o.Refund - o.TextbookFee) as OrderMoney,o.Refund FROM rb_sell_achievements_emp e
string sql = $@"SELECT e.*,(o.Income - o.Refund - o.TextbookFee - IFNULL(r.CommissionMoeny,0)) as OrderMoney,o.Refund FROM rb_sell_achievements_emp e
LEFT JOIN rb_order o on e.OrderId =o.OrderId
WHERE e.Group_Id={group_Id} and o.CreateTime >='2024-08-01' and e.GiveOutState =1 and (e.Type=2 or (e.Type=1 and e.IsDept=1)) and o.PreferPrice >0 and e.OrderSaleMoney <> (o.Income - o.Refund - o.TextbookFee) and e.OrderId>0 and e.Remark not like '%退款回扣%'
left join rb_order_returncomission r on o.OrderId =r.OrderId and r.CommissionType =1
WHERE e.Group_Id={group_Id} and o.CreateTime >='2024-09-01' and e.GiveOutState =1 and (e.Type=2 or (e.Type=1 and e.IsDept=1)) and o.PreferPrice >0 and e.OrderSaleMoney <> (o.Income - o.Refund - o.TextbookFee - IFNULL(r.CommissionMoeny,0)) and e.OrderId>0 and e.Remark not like '%退款回扣%'
ORDER BY e.OrderId ASC ";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList();
}
......
......@@ -72,6 +72,8 @@ namespace Edu.WebApi.Controllers.Course
x.ExtraMoney,
x.EnableZGAward,
x.ZGAwardList,
x.DeptAwardList,
x.IsDeptAward,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
}));
}
......@@ -150,6 +152,17 @@ namespace Edu.WebApi.Controllers.Course
else {
demodel.ZGAwardRule = "";
}
if (demodel.IsDeptAward == 1)
{
if (demodel.DeptAwardList == null || !demodel.DeptAwardList.Any())
{
return ApiResult.ParamIsNull("请传递部门共同奖金分配规则");
}
demodel.DeptAwardAllotRule = JsonHelper.Serialize(demodel.DeptAwardList);
}
else {
demodel.DeptAwardAllotRule = "";
}
demodel.Status = 0;
demodel.Group_Id = userInfo.Group_Id;
demodel.CreateBy = userInfo.Id;
......@@ -266,7 +279,8 @@ namespace Edu.WebApi.Controllers.Course
x.UserName,
x.StudentCount,
x.CurrentPeriodMoney,
x.PeopleNumMoney
x.PeopleNumMoney,
x.IsCommonDept
}));
}
......@@ -293,7 +307,7 @@ namespace Edu.WebApi.Controllers.Course
x.Depart_Id,
x.DeptName,
x.UserId,
x.UserName,
UserName = x.IsCommonDept == 1 ? "-" : x.UserName,
x.ClassId,
x.ClassName,
x.ClassNo,
......@@ -315,7 +329,9 @@ namespace Edu.WebApi.Controllers.Course
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept,
x.PeopleNumMoney
x.PeopleNumMoney,
x.IsCommonDept,
x.OrderSaleMoney
}));
}
......@@ -363,7 +379,9 @@ namespace Edu.WebApi.Controllers.Course
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept,
x.PeopleNumMoney
x.PeopleNumMoney,
x.IsCommonDept,
x.OrderSaleMoney
}));
}
......@@ -412,7 +430,9 @@ namespace Edu.WebApi.Controllers.Course
YFMoney = x.CurrentPeriodMoney + x.DeductionMoney,
x.UserType,
x.IsDept,
x.PeopleNumMoney
x.PeopleNumMoney,
x.IsCommonDept,
x.OrderSaleMoney
})
};
return ApiResult.Success("", pageModel);
......@@ -443,6 +463,7 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: "班级类型") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "学生数量") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "订单号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "订单业绩") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "订单应发") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "累计已发") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "首次发放") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
......@@ -473,8 +494,9 @@ namespace Edu.WebApi.Controllers.Course
new ExcelColumn(value: item.DeptName){ },
new ExcelColumn(value: item.UserType == 1?"市场":item.UserType ==2?"顾问":"教师"){ },
new ExcelColumn(value: item.UserName){ },
new ExcelColumn(value: item.IsDept==1?"部门":"个人"){ },
new ExcelColumn(value: item.IsCommonDept==1?"部门":"个人"){ },
new ExcelColumn(value: item.ClassNo){ },
new ExcelColumn(value: item.OrderSaleMoney.ToString("#0.00")){ },
new ExcelColumn(value: item.ClassName){ },
new ExcelColumn(value: item.ClassTypeName){ },
new ExcelColumn(value: item.StudentCount.ToString()){ },
......
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