Commit dd4a1809 authored by 黄奎's avatar 黄奎

页面修改

parent 65f39861
......@@ -53,5 +53,15 @@ namespace Edu.Model.ViewModel.Sell
/// 学生
/// </summary>
public string StuName { get; set; }
/// <summary>
/// 订单编号【查询使用】
/// </summary>
public string QOrderIds { get; set; }
/// <summary>
/// 关联人员名称
/// </summary>
public string OrderSourceIdName { get; set; }
}
}
using Edu.Model.Entity.Sell;
using Edu.Common.Enum.User;
using Edu.Model.Entity.Sell;
using Edu.Model.ViewModel.Customer;
using Edu.Model.ViewModel.Sell;
using Edu.Model.ViewModel.User;
using Edu.Repository.Customer;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -10,6 +15,20 @@ namespace Edu.Repository.Sell
{
public class RB_Order_ReturnComissionRepository:BaseRepository<RB_Order_ReturnComission>
{
/// <summary>
/// 员工处理类对象
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 同业联系人仓储层对象
/// </summary>
private readonly RB_CustomerRepository customerRepository = new RB_CustomerRepository();
/// <summary>
/// 学员仓储层对象
/// </summary>
private readonly RB_StudentRepository studentRepository = new RB_StudentRepository();
/// <summary>
/// 根据OrderId和StuId查询实体
......@@ -260,5 +279,92 @@ where {where}";
where r.GroupId ={group_Id} and r.UnionCashOutId ={remitId}";
Execute(sql);
}
/// <summary>
/// 获取订单返佣列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Order_ReturnComission_ViewModel> GetOrderReturnComissionListRepositpry(RB_Order_ReturnComission_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_order_returncomission AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}>=0 ", nameof(RB_Order_ReturnComission_ViewModel.Status));
if (query != null)
{
if (query.OrderId > 0)
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Order_ReturnComission_ViewModel.OrderId),query.OrderId);
}
if (!string.IsNullOrEmpty(query.QOrderIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Order_ReturnComission_ViewModel.OrderId), query.QOrderIds);
}
}
var list= Get<RB_Order_ReturnComission_ViewModel>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
var employeeIds = string.Join(",", list.Where(qitem => qitem.OrderSourceType == StuCreateTypeEnum.EmployeeInput || qitem.OrderSourceType == StuCreateTypeEnum.InternalIntroduction).Select(qitem => qitem.OrderSourceId));
var customerIds = string.Join(",", list.Where(qitem => qitem.OrderSourceType == StuCreateTypeEnum.CustomerInput).Select(qitem => qitem.OrderSourceId));
var stuIds = string.Join(",", list.Where(qitem => qitem.OrderSourceType == StuCreateTypeEnum.TransIntroduction).Select(qitem => qitem.OrderSourceId));
List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
List<RB_Customer_Extend> customerList = new List<RB_Customer_Extend>();
List<RB_Student_ViewModel> stuList = new List<RB_Student_ViewModel>();
if (!string.IsNullOrEmpty(employeeIds))
{
empList= accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = employeeIds });
}
if (!string.IsNullOrEmpty(customerIds))
{
customerList= customerRepository.GetCustomerListRepository(new RB_Customer_Extend()
{
CustomerIds = customerIds
});
}
if (!string.IsNullOrEmpty(stuIds))
{
stuList= studentRepository.GetStudentListRepository(new RB_Student_ViewModel()
{
StuIds = stuIds
});
}
foreach (var item in list)
{
switch (item.OrderSourceType)
{
case StuCreateTypeEnum.EmployeeInput:
item.OrderSourceIdName = empList?.FirstOrDefault(qitem => qitem.Id == item.OrderSourceId)?.EmployeeName ?? "";
break;
case StuCreateTypeEnum.CustomerInput:
var tempCustomer = customerList?.FirstOrDefault(qitem => qitem.CustomerId == item.OrderSourceId);
string tempStr = tempCustomer?.CustomerName ?? "";
if (tempCustomer != null)
{
if (tempCustomer.CustomerType == Common.Enum.Customer.CatetoryTypeEnum.Other)
{
tempStr += string.Format("({0})", tempCustomer?.EnterpriseName ?? "");
}
else
{
tempStr += string.Format("({0})", tempCustomer?.CategoryName ?? "");
}
}
item.OrderSourceIdName = tempStr;
break;
case StuCreateTypeEnum.InternalIntroduction:
item.OrderSourceIdName = empList?.FirstOrDefault(qitem => qitem.Id == item.OrderSourceId)?.EmployeeName ?? "";
break;
case StuCreateTypeEnum.TransIntroduction:
item.OrderSourceIdName = stuList?.FirstOrDefault(qitem => qitem.StuId == item.OrderSourceId)?.StuName ?? "";
break;
}
}
}
return list;
}
}
}
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