Commit 42d492be authored by liudong1993's avatar liudong1993

1

parent 8a08a2af
......@@ -158,5 +158,48 @@ namespace Edu.Module.Course
return false;
}
}
/// <summary>
/// 发放教育同业每月佣金/幸福存折
/// </summary>
/// <returns></returns>
public bool SetEduB2BCustomerCommission() {
if (DateTime.Now.Day != 25) { return false; }
var glist = groupRepository.GetGroupListRepository(new Model.ViewModel.User.RB_Group_ViewModel() { });
var trans = customerRepository.DbTransaction;
try
{
foreach (var group in glist)
{
int GroupId = group.GId;
string dateStr = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM") + "-01").AddDays(-1).ToString("yyyy-MM-dd");
//获取可发放返佣列表
var blist = customer_BalanceDetailRepository.SetEduB2BCustomerCommissionCanSendList(GroupId, dateStr);
if (blist.Any())
{
//获取所有的同业
customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { });
//获取所有的订单列表
//获取所有的学生列表
//获取所有学生已上课课时
//获取已发放记录
//根据当月已上课时 计算当月应返佣金额
}
}
customerRepository.DBSession.Commit();
return true;
}
catch (Exception ex)
{
customerRepository.DBSession.Rollback();
LogHelper.Write(ex, "SetEduB2BOrderCommission 定时更新 更新教育同业订单返佣");
return false;
}
}
}
}
......@@ -64,6 +64,7 @@ namespace Edu.Module.Customer
bool flag;
if (model.CustomerId > 0)
{
var oldModel = customerRepository.GetEntity(model.CustomerId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Customer_Extend.CustomerName),model.CustomerName },
......@@ -89,8 +90,7 @@ namespace Edu.Module.Customer
flag = customerRepository.Update(fileds, new WhereHelper(nameof(RB_Customer_Extend.CustomerId), model.CustomerId));
if (flag) {
#region 操作记录
string LogContent = "后台修改同业信息:";
var oldModel = customerRepository.GetEntity(model.CustomerId);
string LogContent = "后台修改同业信息:";
if (oldModel.CustomerName != model.CustomerName)
{
LogContent += "名称由'" + oldModel.CustomerName + "'修改为'" + model.CustomerName + "';";
......
......@@ -142,5 +142,19 @@ WHERE o.Group_Id ={groupId} and o.OrderState =1 and o.OrderSource =9 and o.PaySt
var Robj = ExecuteScalar(sql);
return Robj == null ? 0 : Convert.ToDecimal(Robj);
}
/// <summary>
/// 获取未发放完的返佣列表
/// </summary>
/// <param name="groupId"></param>
/// <param name="dateStr"></param>
/// <returns></returns>
public List<RB_Customer_BalanceDetail_ViewModel> SetEduB2BCustomerCommissionCanSendList(int groupId, string dateStr)
{
string sql = $@"SELECT b.* FROM rb_customer_balancedetail b
INNER JOIN rb_order o on b.OrderId = o.OrderId
WHERE b.Group_Id ={groupId} and o.OrderState in(1,2) and b.UpdateTime <='{dateStr} 23:59:59' and b.BalanceState =1 and b.GiveOutOK <>1 ";
return Get<RB_Customer_BalanceDetail_ViewModel>(sql).ToList();
}
}
}
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