Commit c7aaf2a0 authored by 黄奎's avatar 黄奎

新增控制器

parent b88f8427
...@@ -32,9 +32,9 @@ namespace Edu.Module.Course ...@@ -32,9 +32,9 @@ namespace Edu.Module.Course
/// <param name="rowsCount"></param> /// <param name="rowsCount"></param>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Bonus_PlanExtend> GetBounsPlanListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Bonus_PlanExtend query) public List<RB_Bonus_PlanExtend> GetBounsPlanPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Bonus_PlanExtend query)
{ {
var list = bonus_PlanRepository.GetBounsPlanListRepository(pageIndex, pageSize, out rowsCount, query); var list = bonus_PlanRepository.GetBounsPlanPageRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count>0) if (list != null && list.Count>0)
{ {
string Ids = string.Join(",", list.Select(qitem => qitem.Id)); string Ids = string.Join(",", list.Select(qitem => qitem.Id));
......
...@@ -21,7 +21,7 @@ namespace Edu.Repository.Sell ...@@ -21,7 +21,7 @@ namespace Edu.Repository.Sell
/// <param name="rowsCount"></param> /// <param name="rowsCount"></param>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Bonus_PlanExtend> GetBounsPlanListRepository(int pageIndex,int pageSize,out long rowsCount,RB_Bonus_PlanExtend query) public List<RB_Bonus_PlanExtend> GetBounsPlanPageRepository(int pageIndex,int pageSize,out long rowsCount,RB_Bonus_PlanExtend query)
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
......
using Edu.Cache.User;
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Sell;
using Edu.Module.Course;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Bonus
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class BonusController : BaseController
{
/// <summary>
/// 获取课程顾问、市场达标奖金配置处理类对象
/// </summary>
private readonly BonusConfigModule bonusConfigModule = new BonusConfigModule();
/// <summary>
/// 获取课程顾问、市场达标奖金配置分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetBounsPlanPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Bonus_PlanExtend()
{
PlanName=base.ParmJObj.GetStringValue("PlanName"),
};
query.Group_Id = base.UserInfo.Group_Id;
List<object> result = new List<object>();
var list = bonusConfigModule.GetBounsPlanPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
string CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
result.Add(new
{
item.Id,
item.PlanName,
item.BasicSalary,
item.OpenBonus,
item.WorkAgeSalary,
item.ClueNumSalary,
item.SaleIds,
item.UseCourseIds,
item.NotUseCourseIds,
CreateByName,
CreateTime = Common.ConvertHelper.FormatTime(item.CreateTime),
});
}
pageModel.Count = rowsCount;
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 新增修改课程顾问、市场达标奖金配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetBounsPlan()
{
var query = new RB_Bonus_PlanExtend()
{
Id=base.ParmJObj.GetInt("Id"),
PlanName = base.ParmJObj.GetStringValue("PlanName"),
BasicSalary=base.ParmJObj.GetDecimal("BasicSalary"),
OpenBonus=base.ParmJObj.GetDecimal("OpenBonus"),
WorkAgeSalary=base.ParmJObj.GetDecimal("WorkAgeSalary"),
ClueNumSalary=base.ParmJObj.GetDecimal("ClueNumSalary"),
SaleIds=base.ParmJObj.GetStringValue("SaleIds"),
UseCourseIds=base.ParmJObj.GetStringValue("UseCourseIds"),
NotUseCourseIds=base.ParmJObj.GetStringValue("NotUseCourseIds"),
};
query.CreateBy = base.UserInfo.Id;
query.UpdateBy = base.UserInfo.Id;
query.CreateTime = DateTime.Now;
query.UpdateTime = DateTime.Now;
query.Group_Id = base.UserInfo.Group_Id;
query.Status = Common.Enum.DateStateEnum.Normal;
bool flag = bonusConfigModule.SetBonusPlanModule(query);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取课程顾问、市场达标奖金配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetBonusPlan()
{
var Id = base.ParmJObj.GetInt("Id");
var model = bonusConfigModule.GetBonusPlanModule(Id);
return ApiResult.Success(data: model);
}
/// <summary>
/// 根据编号删除课程顾问、市场达标奖金配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult RemoveBonusPlan()
{
var Id = base.ParmJObj.GetInt("Id");
var flag = bonusConfigModule.RemoveBonusPlanModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
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