Commit 23a09c18 authored by liudong1993's avatar liudong1993

提成修改+ 班级月度课耗

parent b9d89f22
......@@ -52,5 +52,10 @@ namespace Edu.Model.Entity.Course
/// </summary>
public string Financials { get; set; }
/// <summary>
/// 已发放人员列表
/// </summary>
public string EmpIds { get; set; }
}
}
......@@ -1612,6 +1612,69 @@ namespace Edu.Module.Course
}
}
/// <summary>
/// 获取未发放提成用户列表 + 提成金额
/// </summary>
/// <param name="periodId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public object GetSellCommissionSendEmployeeList(int periodId, UserInfo userInfo)
{
var model = sell_Commission_PeriodsRepository.GetEntity(periodId);
if (model == null) { return "周期不存在"; }
List<int> EmpIdList = new List<int>();
if (!string.IsNullOrEmpty(model.EmpIds)) {
EmpIdList = JsonHelper.DeserializeObject<List<int>>("[" + model.EmpIds + "]");
}
var list = GetSellCommissionUserList(new RB_Sell_Commission_Details_ViewModel() { Group_Id = userInfo.Group_Id, PeriodId = periodId });
return ApiResult.Success("", list.Select(x => new
{
x.UserId,
x.UserName,
x.StudentCount,
CurrentPeriodMoney = x.CurrentPeriodMoney + x.CurrentExtraMoney,
IsGiveOut = EmpIdList.Contains(x.UserId) ? 1 : 2
}));
}
/// <summary>
/// 设置发放提成
/// </summary>
/// <param name="periodId"></param>
/// <param name="empIds"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetSellCommissionSendEmployee(int periodId, string empIds, UserInfo userInfo)
{
var model = sell_Commission_PeriodsRepository.GetEntity(periodId);
if (model == null) { return "周期不存在"; }
List<int> EmpIdList = new List<int>();
if (!string.IsNullOrEmpty(model.EmpIds))
{
EmpIdList = JsonHelper.DeserializeObject<List<int>>("[" + model.EmpIds + "]");
}
List<int> NewIdList = JsonHelper.DeserializeObject<List<int>>("[" + empIds + "]");
foreach (var item in NewIdList) {
if (EmpIdList.Contains(item)) {
return "用户ID" + item + "已发放了提成,无法重复发放";
}
}
EmpIdList.AddRange(NewIdList);
string empids2 = string.Join(",", EmpIdList);
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Sell_Commission_Periods_ViewModel.EmpIds),empids2}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName= nameof(RB_Sell_Commission_Periods_ViewModel.Id),
FiledValue=periodId,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = sell_Commission_PeriodsRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员";
}
#endregion
......
This diff is collapsed.
......@@ -565,7 +565,7 @@ GROUP BY ClassId;";
}
string sql = $@"SELECT o.* FROM rb_order o
inner join rb_class c on o.ClassId = c.ClassId
WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.EffectStatus in(1,2) and o.CommissionRate >0 and c.OpenTime <= '{eDate} 23:59:59' {where} and o.PreferPrice <= (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) and (o.IsCommissionGiveOK =0 or (o.ExtraRewardMoney -o.ExtraDeductMoney)<> o.ExtraCommissionMoney);";
WHERE o.Group_Id ={group_Id} and o.OrderState =1 and o.EffectStatus in(1,2) and o.CommissionRate >0 and c.OpenTime <= '{eDate} 23:59:59' {where} and o.PreferPrice = (o.Income - o.Refund + o.DiscountMoney + o.PlatformTax) and (o.IsCommissionGiveOK =0 or (o.ExtraRewardMoney -o.ExtraDeductMoney)<> o.ExtraCommissionMoney);";
return Get<RB_Order_ViewModel>(sql).ToList();
}
......
......@@ -514,6 +514,53 @@ namespace Edu.WebApi.Controllers.Course
}
}
/// <summary>
/// 获取提成可发放人员列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetSellCommissionSendEmployeeList() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//期数id
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = sellCommissionModule.GetSellCommissionSendEmployeeList(PeriodId, userInfo);
return ApiResult.Success("", list);
}
/// <summary>
/// 设置提成发放人员
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetSellCommissionSendEmployee() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(RequestParm.Msg.ToString());
int PeriodId = parms.GetInt("PeriodId", 0);//期数id
string EmpIds = parms.GetStringValue("EmpIds");//人员列表
if (PeriodId <= 0)
{
return ApiResult.ParamIsNull();
}
if (string.IsNullOrEmpty(EmpIds))
{
return ApiResult.ParamIsNull("请传递用户id");
}
string msg = sellCommissionModule.SetSellCommissionSendEmployee(PeriodId, EmpIds, userInfo);
if (msg == "")
{
return ApiResult.Success("");
}
else {
return ApiResult.Failed(msg);
}
}
#endregion
......
......@@ -752,7 +752,7 @@ namespace Edu.WebApi.Controllers.Finance
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 },
new ExcelColumn(value: "手续费") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
......@@ -1959,5 +1959,22 @@ namespace Edu.WebApi.Controllers.Finance
}
#endregion
#region 班级相关统计
/// <summary>
/// 班级月度课耗统计
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetClassMonthStatistics() {
var userInfo = base.UserInfo;
int classId = base.ParmJObj.GetInt("ClassId", 0);
var list = financeModule.GetClassMonthStatistics(classId, userInfo);
return ApiResult.Success("", list);
}
#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