Commit acacf5c4 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 1bf38c90 21b9b640
......@@ -17,6 +17,8 @@ using Edu.Repository.System;
using Edu.Model.ViewModel.System;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Newtonsoft.Json.Linq;
using System.Dynamic;
namespace Edu.Module.Customer
{
......@@ -1020,7 +1022,7 @@ namespace Edu.Module.Customer
});
foreach (var eItem in empList)
{
List<object> subList = new List<object>();
List<MarketChannelStaticModel> subList = new List<MarketChannelStaticModel>();
var tempList = dataList?.Where(qitem => qitem.CreateBy == eItem.Id)?.ToList();
//包含的数据
string singleIds = "";
......@@ -1037,77 +1039,97 @@ namespace Edu.Module.Customer
{
singleIds += "," + item.Id;
var channelTempList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.EmployeeInput && qitem.StuChannel == item.Id)?.ToList();
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = item.Name,
ChannelId = item.Id,
ClueCount = channelTempList?.Count(),
VisitCount = channelTempList?.Sum(qitem => qitem.VisitCount),
OrderCount = channelTempList?.Sum(qitem => qitem.OrderCount),
OrderIncome = channelTempList?.Sum(qitem => qitem.OrderIncome)
ClueCount = channelTempList?.Count()??0,
VisitCount = channelTempList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = channelTempList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = channelTempList?.Sum(qitem => qitem.OrderIncome)??0
});
}
}
}
var customerList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)?.ToList();
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = "同行介绍",
ChannelId = 10001,
ClueCount = customerList?.Count(),
VisitCount = customerList?.Sum(qitem => qitem.VisitCount),
OrderCount = customerList?.Sum(qitem => qitem.OrderCount),
OrderIncome = customerList?.Sum(qitem => qitem.OrderIncome)
ClueCount = customerList?.Count()??0,
VisitCount = customerList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = customerList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = customerList?.Sum(qitem => qitem.OrderIncome)??0
});
var innerList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)?.ToList();
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = "内部介绍",
ChannelId = 10002,
ClueCount = innerList?.Count(),
VisitCount = innerList?.Sum(qitem => qitem.VisitCount),
OrderCount = innerList?.Sum(qitem => qitem.OrderCount),
OrderIncome = innerList?.Sum(qitem => qitem.OrderIncome)
ClueCount = innerList?.Count()??0,
VisitCount = innerList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = innerList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = innerList?.Sum(qitem => qitem.OrderIncome)??0
});
var transList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction)?.ToList();
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = "学员转介绍",
ChannelId = 10003,
ClueCount = transList?.Count(),
VisitCount = transList?.Sum(qitem => qitem.VisitCount),
OrderCount = transList?.Sum(qitem => qitem.OrderCount),
OrderIncome = transList?.Sum(qitem => qitem.OrderIncome)
ClueCount = transList?.Count()??0,
VisitCount = transList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = transList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = transList?.Sum(qitem => qitem.OrderIncome)??0
});
var otherList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.EmployeeInput && !singleIds.Contains(qitem.StuChannel.ToString()))?.ToList();
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = "其他",
ChannelId = 10004,
ClueCount = otherList?.Count(),
VisitCount = otherList?.Sum(qitem => qitem.VisitCount),
OrderCount = otherList?.Sum(qitem => qitem.OrderCount),
OrderIncome = otherList?.Sum(qitem => qitem.OrderIncome)
ClueCount = otherList?.Count()??0,
VisitCount = otherList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = otherList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = otherList?.Sum(qitem => qitem.OrderIncome)??0
});
subList.Add(new
subList.Add(new MarketChannelStaticModel()
{
ChannelName = "合计",
ChannelId = 10005,
ClueCount = tempList?.Count(),
VisitCount = tempList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempList?.Sum(qitem => qitem.OrderIncome)
ClueCount = tempList?.Count()??0,
VisitCount = tempList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = tempList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = tempList?.Sum(qitem => qitem.OrderIncome)??0
});
list.Add(new
Dictionary<string, object> dicList = new Dictionary<string, object>();
for (var i = 0; i < subList.Count; i++)
{
if (i == 0)
{
dicList.Add(string.Format("Id"), eItem.Id);
dicList.Add(string.Format("EmployeeName"), eItem.EmployeeName);
}
decimal rate = 0;
if (subList[i].ClueCount > 0)
{
rate = Math.Round(Convert.ToDecimal(subList[i].VisitCount) / Convert.ToDecimal(subList[i].ClueCount) * Convert.ToDecimal(100), 2);
}
dicList.Add(string.Format("ChannelName{0}", i), subList[i].ChannelName);
dicList.Add(string.Format("ClueCount{0}", i), subList[i].ClueCount);
dicList.Add(string.Format("VisitCount{0}", i), subList[i].VisitCount);
dicList.Add(string.Format("Rates{0}", i), rate+"%");
}
list.Add(new {
eItem.Id,
eItem.EmployeeName,
subList
dicList,
subList,
});
}
}
......
......@@ -968,7 +968,11 @@ WHERE A.Status=0
}
if (query.CreateIds != null && query.CreateIds.Count > 0)
{
builder.AppendFormat(" AND A.{0} IN({0}) ", nameof(RB_Student_ViewModel.CreateBy), string.Join(",", query.CreateIds));
string str = string.Join(",", query.CreateIds);
if (!string.IsNullOrEmpty(str))
{
builder.AppendFormat(" AND A.{0} IN({0}) ", nameof(RB_Student_ViewModel.CreateBy), str);
}
}
}
var list = Get<RB_Student_ViewModel>(builder.ToString()).ToList();
......
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