Commit d2c0f876 authored by 黄奎's avatar 黄奎

页面修改

parent 3ff39b60
......@@ -386,6 +386,16 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public int CategoryId { get; set; }
/// <summary>
/// 同行名称
/// </summary>
public string CategoryName { get; set; }
/// <summary>
/// 同行类型
/// </summary>
public CatetoryTypeEnum CatetoryType { get; set; }
/// <summary>
/// 课程顾问跟进状态名称
/// </summary>
......
......@@ -19,6 +19,7 @@ using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Newtonsoft.Json.Linq;
using System.Dynamic;
using Edu.Common.Enum.Customer;
namespace Edu.Module.Customer
{
......@@ -1245,44 +1246,39 @@ namespace Edu.Module.Customer
{
customerList = customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { CustomerIds = cusIds });
}
var sourceTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)
?.GroupBy(qitem => new { qitem.CustomerType })
?.Select(qitem => new { qitem.Key.CustomerType });
var categoryTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)
?.GroupBy(qitem => new { qitem.CatetoryType})
?.Select(qitem => new { qitem.Key.CatetoryType });
foreach (var sItem in sourceTypeList)
foreach (var sItem in categoryTypeList)
{
var sourceIdList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CustomerType == sItem.CustomerType)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var subItem in sourceIdList)
var categoryList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CatetoryType == sItem.CatetoryType)
?.GroupBy(qitem => new { qitem.CategoryId })
?.Select(qitem => new { qitem.Key.CategoryId });
foreach (var subItem in categoryList)
{
var tempCusList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.StuSourceId == subItem.StuSourceId)?.ToList();
var tempCustomer = customerList?.FirstOrDefault(qitem => qitem.CustomerId == subItem.StuSourceId);
string channelName = tempCustomer?.CustomerName ?? "";
if (!string.IsNullOrEmpty(tempCustomer?.CategoryName))
{
channelName += string.Format("({0})", tempCustomer?.CategoryName);
}
//企业同行
if (sItem.CustomerType == Common.Enum.Customer.CatetoryTypeEnum.Company)
var tempCusList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CategoryId == subItem.CategoryId)?.ToList();
var tempCustomer = customerList?.FirstOrDefault(qitem => qitem.CategoryId == subItem.CategoryId);
string channelName = tempCustomer?.CategoryName ?? "其他";
if (sItem.CatetoryType == CatetoryTypeEnum.Company)
{
customerDataList.Add(new MarketChannelStaticModel()
{
ChannelName = channelName,
ChannelId = subItem.StuSourceId,
ChannelId = subItem.CategoryId,
ClueCount = tempCusList?.Count() ?? 0,
VisitCount = tempCusList?.Sum(qitem => qitem.VisitCount) ?? 0,
OrderCount = tempCusList?.Sum(qitem => qitem.OrderCount) ?? 0,
OrderIncome = tempCusList?.Sum(qitem => qitem.OrderIncome) ?? 0
});
}
//校代同行
else if (sItem.CustomerType == Common.Enum.Customer.CatetoryTypeEnum.School)
if (sItem.CatetoryType == CatetoryTypeEnum.School)
{
schoolDataList.Add(new MarketChannelStaticModel()
{
ChannelName = channelName,
ChannelId = subItem.StuSourceId,
ChannelId = subItem.CategoryId,
ClueCount = tempCusList?.Count() ?? 0,
VisitCount = tempCusList?.Sum(qitem => qitem.VisitCount) ?? 0,
OrderCount = tempCusList?.Sum(qitem => qitem.OrderCount) ?? 0,
......@@ -1291,7 +1287,6 @@ namespace Edu.Module.Customer
}
}
}
}
else if (item.Id == (int)StuCreateTypeEnum.InternalIntroduction)
{
......
......@@ -243,7 +243,7 @@ WHERE 1=1
SELECT t.*,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount ,c.CustomerName,IFNULL(B.Name,'') AS AdvisorStatusName
FROM rb_student AS t LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
LEFT JOIN rb_school AS s ON t.School_Id=s.SId
LEFT JOIN rb_customer c on c.CustomerId = t.CustomerId
LEFT JOIN rb_customer c on (c.CustomerId = t.StuSourceId AND t.CreateType=2)
LEFT JOIN rb_account as a ON (t.StuId=a.AccountId AND a.AccountType=4 )
LEFT JOIN rb_student_advisorconfig AS b ON t.AdvisorStatus=B.Id
WHERE 1=1
......@@ -1080,11 +1080,12 @@ WHERE 1=1
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.StuId,A.CreateBy,A.StuChannel,A.CreateType,IFNULL(B.VisitCount,0) AS VisitCount,IFNULL(C.CourseOrderCount,0) AS OrderCount,IFNULL(c.Income,0) AS OrderInCome
,A.CustomerId,A.StuSourceId,IFNULL(D.CustomerType,0) AS CustomerType,IFNULL(D.CategoryId,0) AS CategoryId
,A.CustomerId,A.StuSourceId,IFNULL(D.CustomerType,0) AS CustomerType,IFNULL(D.CategoryId,0) AS CategoryId,IFNULL(E.CategoryName,'') AS CategoryName,IFNULL(E.CatetoryType,0) AS CatetoryType
FROM RB_Student AS A
LEFT JOIN(SELECT StuId,Count(1) AS VisitCount FROM rb_student_visit WHERE Status=0 GROUP BY StuId) AS B ON A.StuId=B.StuId
LEFT JOIN(SELECT og.Student_Id,COUNT(1) AS CourseOrderCount,SUM(o.Income) AS Income FROM rb_student_orderguest AS og INNER JOIN rb_order AS o ON og.OrderId=o.OrderId WHERE O.OrderState NOT IN(3,4) GROUP BY og.Student_Id ) AS C ON A.StuId=C.Student_Id
LEFT JOIN rb_customer AS D ON A.StuSourceId=D.CustomerId AND A.CreateType=2
LEFT JOIN rb_customer_category AS E ON D.CategoryId=E.CategoryId
WHERE A.Status=0
");
if (query != null)
......
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