Commit 71cd7556 authored by liudong1993's avatar liudong1993

1

parent 6cf43737
...@@ -81,5 +81,10 @@ namespace Edu.Model.Entity.Sell ...@@ -81,5 +81,10 @@ namespace Edu.Model.Entity.Sell
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 订单业绩
/// </summary>
public decimal OrderSaleMoney { get; set; }
} }
} }
...@@ -132,6 +132,10 @@ namespace Edu.Module.Course ...@@ -132,6 +132,10 @@ namespace Edu.Module.Course
/// 同业返佣 /// 同业返佣
/// </summary> /// </summary>
private readonly RB_Customer_BalanceDetailRepository customer_BalanceDetailRepository = new RB_Customer_BalanceDetailRepository(); private readonly RB_Customer_BalanceDetailRepository customer_BalanceDetailRepository = new RB_Customer_BalanceDetailRepository();
/// <summary>
/// 业绩提成
/// </summary>
private readonly RB_Sell_Achievements_EmpRepository sell_Achievements_EmpRepository = new RB_Sell_Achievements_EmpRepository();
/// <summary> /// <summary>
/// 学生关联 /// 学生关联
...@@ -2686,6 +2690,9 @@ namespace Edu.Module.Course ...@@ -2686,6 +2690,9 @@ namespace Edu.Module.Course
//获取合同列表 //获取合同列表
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();
//获取新的业绩提成
//var achList = sell_Achievements_EmpRepository.GetList(new RB_Sell_Achievements_Emp_ViewModel() { Group_Id = demodel.Group_Id, OrderIds = orderIds });
foreach (var item in orderList) foreach (var item in orderList)
{ {
if (item.SourceOrderId > 0) if (item.SourceOrderId > 0)
......
This diff is collapsed.
...@@ -65,5 +65,101 @@ namespace Edu.Repository.Sell ...@@ -65,5 +65,101 @@ namespace Edu.Repository.Sell
string sql = $@" select r.* from RB_Sell_Achievements_Emp r where {where} order by r.Id desc"; string sql = $@" select r.* from RB_Sell_Achievements_Emp r where {where} order by r.Id desc";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList(); return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList();
} }
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Sell_Achievements_Emp_ViewModel> GetPageList(int pageIndex,int pageSize,out long count,RB_Sell_Achievements_Emp_ViewModel demodel)
{
string where = $@" 1=1";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.OrderId > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.OrderId)} ={demodel.OrderId}";
}
if (demodel.Type > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.Type)} ={demodel.Type}";
}
if (demodel.EmpId > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.EmpId)} ={demodel.EmpId}";
}
if (demodel.IsDept > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.IsDept)} ={demodel.IsDept}";
}
if (demodel.PeriodsId > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.PeriodsId)} ={demodel.PeriodsId}";
}
if (demodel.GiveOutState > 0)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.GiveOutState)} ={demodel.GiveOutState}";
}
if (demodel.IsSelectNor == 1)
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.PeriodsId)} >0";
}
if (!string.IsNullOrEmpty(demodel.OrderIds))
{
where += $@" and r.{nameof(RB_Sell_Achievements_Emp_ViewModel.OrderId)} in({demodel.OrderIds})";
}
string sql = $@" select r.* from RB_Sell_Achievements_Emp r where {where} order by r.OrderId desc";
return GetPage<RB_Sell_Achievements_Emp_ViewModel>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取当月业绩(个人)
/// </summary>
/// <param name="empId"></param>
/// <param name="periodsId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Sell_Achievements_Emp_ViewModel GetMonthSaleMoney(int empId, int periodsId, int group_Id)
{
string sql = $@"SELECT MAX(SaleMoney) as SaleMoney,SUM(PushMoney) as PushMoney FROM rb_sell_achievements_emp WHERE Group_Id ={group_Id} and EmpId ={empId} and IsDept =2 and PeriodsId ={periodsId}";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).FirstOrDefault();
}
/// <summary>
/// 获取当月新收/续费业绩金额(个人)
/// </summary>
/// <param name="empId"></param>
/// <param name="periodsId"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public List<RB_Sell_Achievements_Emp_ViewModel> GetMonthNorOrderMoney(int empId, int periodsId, int group_Id)
{
string sql = $@"
SELECT g.RenewState as Type,SUM(e.OrderSaleMoney) as OrderSaleMoney FROM rb_sell_achievements_emp e
INNER JOIN rb_order_guest g on e.OrderId = g.OrderId
WHERE e.Group_Id ={group_Id} and e.EmpId ={empId} and e.IsDept =2 and e.PeriodsId ={periodsId}
GROUP BY g.RenewState";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).ToList();
}
/// <summary>
/// 获取用户累计已发提成(个人)
/// </summary>
/// <param name="id"></param>
/// <param name="group_Id"></param>
/// <returns></returns>
public RB_Sell_Achievements_Emp_ViewModel GetEmpTotalCommission(int empId, int group_Id)
{
string sql = $@"SELECT SUM(PushMoney) as PushMoney,SUM(GiveOutMoney) as GiveOutMoney FROM rb_sell_achievements_emp WHERE Group_Id ={group_Id} and EmpId ={empId} and IsDept =2";
return Get<RB_Sell_Achievements_Emp_ViewModel>(sql).FirstOrDefault();
}
} }
} }
...@@ -613,5 +613,53 @@ namespace Edu.WebApi.Controllers.Course ...@@ -613,5 +613,53 @@ namespace Edu.WebApi.Controllers.Course
} }
#endregion #endregion
#region 销售中心
/// <summary>
/// 获取市场中心业绩提成
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSellCenterAchievementsStatistics() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
string Month = parms.GetStringValue("Month");
if (string.IsNullOrEmpty(Month)) {
return ApiResult.ParamIsNull();
}
Month = Convert.ToDateTime(Month).ToString("yyyy-MM");
var Robj = sellAchievementsModule.GetSellCenterAchievementsStatistics(Month, userInfo);
return ApiResult.Success("", Robj);
}
/// <summary>
/// 获取业绩发放明细分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAchievementsEmpPageList() {
var userInfo = base.UserInfo;
ResultPageModel pmodel = JsonHelper.DeserializeObject<ResultPageModel>(base.RequestParm.Msg.ToString());
RB_Sell_Achievements_Emp_ViewModel demodel = JsonHelper.DeserializeObject<RB_Sell_Achievements_Emp_ViewModel>(base.RequestParm.Msg.ToString());
demodel.Group_Id = userInfo.Group_Id;
demodel.EmpId = userInfo.Id;
demodel.IsDept = 2;//非部门的
var list = sellAchievementsModule.GetAchievementsEmpPageList(pmodel.PageIndex, pmodel.PageSize, out long count, demodel);
pmodel.Count = Convert.ToInt32(count);
pmodel.PageData = list.Select(x => new
{
x.Id,
x.OrderId,
x.Rate,
x.PushMoney,
x.GiveOutMoney,
x.SaleMoney,
x.Remark
});
return ApiResult.Success("", pmodel);
}
#endregion
} }
} }
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