Commit ddd6e110 authored by 黄奎's avatar 黄奎

页面修改

parent 61f5984f
...@@ -1173,38 +1173,102 @@ namespace Edu.Module.Customer ...@@ -1173,38 +1173,102 @@ namespace Edu.Module.Customer
}); });
} }
} }
var customerList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)?.ToList();
list.Add(new
var cusIds = string.Join(",", dataList.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput).Select(qitem => qitem.StuSourceId));
List<RB_Customer_Extend> customerList = new List<RB_Customer_Extend>();
if (!string.IsNullOrEmpty(cusIds))
{ {
ChannelName = "同行介绍", customerList = customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { CustomerIds = cusIds });
ChannelId = 10001, }
ClueCount = customerList?.Count(), var sourceTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)
VisitCount = customerList?.Sum(qitem => qitem.VisitCount), ?.GroupBy(qitem => new { qitem.CustomerSourceType })
OrderCount = customerList?.Sum(qitem => qitem.OrderCount), ?.Select(qitem => new { qitem.Key.CustomerSourceType });
OrderIncome = customerList?.Sum(qitem => qitem.OrderIncome)
});
var innerList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)?.ToList(); foreach (var sItem in sourceTypeList)
list.Add(new
{ {
ChannelName = "内部介绍", var sourceIdList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CustomerSourceType == sItem.CustomerSourceType)
ChannelId = 10002, ?.GroupBy(qitem => new { qitem.StuSourceId })
ClueCount = innerList?.Count(), ?.Select(qitem => new { qitem.Key.StuSourceId });
VisitCount = innerList?.Sum(qitem => qitem.VisitCount), foreach (var subItem in sourceIdList)
OrderCount = innerList?.Sum(qitem => qitem.OrderCount), {
OrderIncome = innerList?.Sum(qitem => qitem.OrderIncome) var tempCusList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.StuSourceId == subItem.StuSourceId)?.ToList();
}); //企业同行
if (sItem.CustomerSourceType == 1)
{
list.Add(new
{
ChannelName ="(企业)"+( customerList?.FirstOrDefault(qitem => qitem.CustomerId == subItem.StuSourceId)?.CustomerName ?? ""),
subItem.StuSourceId,
ClueCount = tempCusList?.Count(),
VisitCount = tempCusList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempCusList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempCusList?.Sum(qitem => qitem.OrderIncome)
});
}
//校代同行
else if (sItem.CustomerSourceType == 2)
{
list.Add(new
{
ChannelName = "(校代)" + (customerList?.FirstOrDefault(qitem => qitem.CustomerId == subItem.StuSourceId)?.CustomerName ?? ""),
subItem.StuSourceId,
ClueCount = tempCusList?.Count(),
VisitCount = tempCusList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempCusList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempCusList?.Sum(qitem => qitem.OrderIncome)
});
}
}
}
var transList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction)?.ToList();
list.Add(new var empIds = string.Join(",", dataList.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction).Select(qitem => qitem.StuSourceId));
List<Employee_ViewModel> empList = new List<Employee_ViewModel>();
if (!string.IsNullOrEmpty(empIds))
{ {
ChannelName = "学员转介绍", empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = empIds });
ChannelId = 10003, }
ClueCount = transList?.Count(), var groupDataList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)
VisitCount = transList?.Sum(qitem => qitem.VisitCount), ?.GroupBy(qitem => new { qitem.StuSourceId })
OrderCount = transList?.Sum(qitem => qitem.OrderCount), ?.Select(qitem => new { qitem.Key.StuSourceId });
OrderIncome = transList?.Sum(qitem => qitem.OrderIncome) foreach (var sItem in groupDataList)
}); {
var tempInnerList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.StuSourceId == sItem.StuSourceId)?.ToList();
list.Add(new
{
ChannelName = "(内部介绍)" + (empList?.FirstOrDefault(qitem => qitem.Id == sItem.StuSourceId)?.EmployeeName ?? ""),
sItem.StuSourceId,
ClueCount = tempInnerList?.Count(),
VisitCount = tempInnerList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempInnerList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempInnerList?.Sum(qitem => qitem.OrderIncome)
});
}
var stuIds = string.Join(",", dataList.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction).Select(qitem => qitem.StuSourceId));
List<RB_Student_ViewModel> stuList = new List<RB_Student_ViewModel>();
if (!string.IsNullOrEmpty(stuIds))
{
stuList = studentRepository.GetStudentListRepository(new RB_Student_ViewModel() { StuIds = stuIds });
}
var transTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var sItem in transTypeList)
{
var tempTransList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction && qitem.StuSourceId == sItem.StuSourceId)?.ToList();
list.Add(new
{
ChannelName = "(学员转介绍)" + stuList?.FirstOrDefault(qitem => qitem.StuId == sItem.StuSourceId)?.StuName ?? "",
sItem.StuSourceId,
ClueCount = tempTransList?.Count(),
VisitCount = tempTransList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempTransList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempTransList?.Sum(qitem => qitem.OrderIncome)
});
}
list.Add(new list.Add(new
{ {
ChannelName = "合计", ChannelName = "合计",
......
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