Commit cfec307d authored by 黄奎's avatar 黄奎

页面修改

parent e5d85c86
......@@ -57,6 +57,11 @@ namespace Edu.Module.Customer
/// </summary>
private readonly RB_Customer_CategoryRepository customer_CategoryRepository = new RB_Customer_CategoryRepository();
/// <summary>
/// 员工账号仓储层
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 获取客户分页列表..
......@@ -269,6 +274,13 @@ namespace Edu.Module.Customer
if (list.Any())
{
string customerIds = string.Join(",", list.Select(x => x.CustomerId));
string createByIds = string.Join(",", list.Where(qitem => qitem.CreateBy > 0).Select(qitem => qitem.CreateBy));
var empList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(createByIds))
{
empList= accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = createByIds });
}
//查询客户数量
var StuNumList = customerRepository.GetCustomerStuNum(customerIds, query.Group_Id);
//查询订单数量 及 交易额
......@@ -281,6 +293,10 @@ namespace Edu.Module.Customer
item.StuNum = stuList?.Sum(qitem=>qitem.StuNum)??0;
item.OrderNum = orderList?.Sum(qitem => qitem.OrderNum) ?? 0;
item.OrderSales = orderList?.Sum(qitem => qitem.OrderSales) ?? 0;
if (item.CreateBy > 0)
{
item.CreateByName = empList?.FirstOrDefault(qitem => qitem.Id == item.CreateBy)?.EmployeeName ?? "";
}
}
}
return list;
......
......@@ -183,11 +183,11 @@ WHERE 1=1
public List<RB_Customer_Extend> GetCustomerStuNum(string customerIds, int group_Id)
{
string sql = $@"
SELECT s.CustomerId,C.CategoryId,COUNT(0) as StuNum
SELECT c.CustomerId,C.CategoryId,COUNT(0) as StuNum
FROM rb_student s INNER JOIN rb_customer AS c ON (s.StuSourceId=C.CustomerId AND s.CreateType=2)
WHERE s.`Status`=0 and s.Group_Id ={group_Id}
and s.CustomerId in({customerIds})
GROUP BY s.CustomerId,C.CategoryId
and c.CustomerId in({customerIds})
GROUP BY c.CustomerId,C.CategoryId
";
return Get<RB_Customer_Extend>(sql).ToList();
}
......
......@@ -512,13 +512,7 @@ namespace Edu.WebApi.Controllers.Customer
};
query.CreateBy = userInfo.Id;
var list = customerModule.GetCustomerPageModule_V2(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
}
pageModel.PageData = list.Select(x => new
{
x.CustomerId,
......@@ -564,13 +558,7 @@ namespace Edu.WebApi.Controllers.Customer
CategoryId=base.ParmJObj.GetInt("CategoryId"),
};
var list = customerModule.GetCustomerPageModule_V2(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
}
pageModel.PageData = list.Select(x => new
{
x.CustomerId,
......@@ -617,7 +605,10 @@ namespace Edu.WebApi.Controllers.Customer
CategoryId = base.ParmJObj.GetInt("CategoryId"),
};
string excelName = "同行联系人.xls";
Common.Plugin.StopwatchHelper stopwatch = new StopwatchHelper();
stopwatch.Start();
var list = customerModule.GetCustomerPageModule_V2(1, 100000, out long rowsCount, query);
var xx = stopwatch.Stop();
List<ExcelDataSource> slist = new List<ExcelDataSource>();
try
{
......@@ -655,13 +646,14 @@ namespace Edu.WebApi.Controllers.Customer
new ExcelColumn(item.OrderSales.ToString()),
new ExcelColumn(item.ApproveStateStr),
new ExcelColumn(item.CreateTimeStr),
new ExcelColumn(UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? ""),
new ExcelColumn(item.CreateByName),
}
};
slist.Add(dataRow);
}
stopwatch.Start();
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
var yy = stopwatch.Stop();
return File(byteData, "application/octet-stream", excelName);
}
catch (Exception ex)
......
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