Commit 94ee406d authored by 黄奎's avatar 黄奎

页面修改

parent fa19bc31
......@@ -404,160 +404,160 @@ namespace Edu.Module.User
if (index > 0)
{
decimal PushCount = 0;
if (item.PushCount > 0)
if (firstModel.PushCount > 0)
{
PushCount = (item.PushCount - firstModel.PushCount) / item.PushCount * 100;
PushCount = (item.PushCount - firstModel.PushCount) / firstModel.PushCount * 100;
}
decimal NewCount = 0;
if (item.NewCount > 0)
if (firstModel.NewCount > 0)
{
NewCount = (item.NewCount - firstModel.NewCount) / item.NewCount * 100;
NewCount = (item.NewCount - firstModel.NewCount) / firstModel.NewCount * 100;
}
decimal CommunicationCount = 0;
if (item.CommunicationCount > 0)
if (firstModel.CommunicationCount > 0)
{
CommunicationCount = (item.CommunicationCount - firstModel.CommunicationCount) / item.CommunicationCount * 100;
CommunicationCount = (item.CommunicationCount - firstModel.CommunicationCount) / firstModel.CommunicationCount * 100;
}
decimal TrialLessonCount = 0;
if (item.TrialLessonCount > 0)
if (firstModel.TrialLessonCount > 0)
{
TrialLessonCount = (item.TrialLessonCount - firstModel.TrialLessonCount) / item.TrialLessonCount * 100;
TrialLessonCount = (item.TrialLessonCount - firstModel.TrialLessonCount) / firstModel.TrialLessonCount * 100;
}
decimal NotContacted = 0;
if (item.NotContacted > 0)
if (firstModel.NotContacted > 0)
{
NotContacted = (item.NotContacted - firstModel.NotContacted) / item.NotContacted * 100;
NotContacted = (item.NotContacted - firstModel.NotContacted) / firstModel.NotContacted * 100;
}
decimal JPCount = 0;
if (item.JPCount > 0)
if (firstModel.JPCount > 0)
{
JPCount = (item.JPCount - firstModel.JPCount) / item.JPCount * 100;
JPCount = (item.JPCount - firstModel.JPCount) / firstModel.JPCount * 100;
}
decimal KRCount = 0;
if (item.KRCount > 0)
if (firstModel.KRCount > 0)
{
KRCount = (item.KRCount - firstModel.KRCount) / item.KRCount * 100;
KRCount = (item.KRCount - firstModel.KRCount) / firstModel.KRCount * 100;
}
decimal FRCount = 0;
if (item.FRCount > 0)
if (firstModel.FRCount > 0)
{
FRCount = (item.FRCount - firstModel.FRCount) / item.FRCount * 100;
FRCount = (item.FRCount - firstModel.FRCount) / firstModel.FRCount * 100;
}
decimal JPStudyCount = 0;
if (item.JPStudyCount > 0)
if (firstModel.JPStudyCount > 0)
{
JPStudyCount = (item.JPStudyCount - firstModel.JPStudyCount) / item.JPStudyCount * 100;
JPStudyCount = (item.JPStudyCount - firstModel.JPStudyCount) / firstModel.JPStudyCount * 100;
}
decimal KRStudyCount = 0;
if (item.KRStudyCount > 0)
if (firstModel.KRStudyCount > 0)
{
KRStudyCount = (item.KRStudyCount - firstModel.KRStudyCount) / item.KRStudyCount * 100;
KRStudyCount = (item.KRStudyCount - firstModel.KRStudyCount) / firstModel.KRStudyCount * 100;
}
decimal YGAStudyCount = 0;
if (item.YGAStudyCount > 0)
if (firstModel.YGAStudyCount > 0)
{
YGAStudyCount = (item.YGAStudyCount - firstModel.YGAStudyCount) / item.YGAStudyCount * 100;
YGAStudyCount = (item.YGAStudyCount - firstModel.YGAStudyCount) / firstModel.YGAStudyCount * 100;
}
decimal USStudyCount = 0;
if (item.USStudyCount > 0)
if (firstModel.USStudyCount > 0)
{
USStudyCount = (item.USStudyCount - firstModel.USStudyCount) / item.USStudyCount * 100;
USStudyCount = (item.USStudyCount - firstModel.USStudyCount) / firstModel.USStudyCount * 100;
}
decimal SGStudyCount = 0;
if (item.SGStudyCount > 0)
if (firstModel.SGStudyCount > 0)
{
SGStudyCount = (item.SGStudyCount - firstModel.SGStudyCount) / item.SGStudyCount * 100;
SGStudyCount = (item.SGStudyCount - firstModel.SGStudyCount) / firstModel.SGStudyCount * 100;
}
decimal AXStudyCount = 0;
if (item.AXStudyCount > 0)
if (firstModel.AXStudyCount > 0)
{
AXStudyCount = (item.AXStudyCount - firstModel.AXStudyCount) / item.AXStudyCount * 100;
AXStudyCount = (item.AXStudyCount - firstModel.AXStudyCount) / firstModel.AXStudyCount * 100;
}
decimal OtherCount = 0;
if (item.OtherCount > 0)
if (firstModel.OtherCount > 0)
{
OtherCount = (item.OtherCount - firstModel.OtherCount) / item.OtherCount * 100;
OtherCount = (item.OtherCount - firstModel.OtherCount) / firstModel.OtherCount * 100;
}
decimal ClassACount = 0;
if (item.ClassACount > 0)
if (firstModel.ClassACount > 0)
{
ClassACount = (item.ClassACount - firstModel.ClassACount) / item.ClassACount * 100;
ClassACount = (item.ClassACount - firstModel.ClassACount) / firstModel.ClassACount * 100;
}
decimal ClassBCount = 0;
if (item.ClassBCount > 0)
if (firstModel.ClassBCount > 0)
{
ClassBCount = (item.ClassBCount - firstModel.ClassBCount) / item.ClassBCount * 100;
ClassBCount = (item.ClassBCount - firstModel.ClassBCount) / firstModel.ClassBCount * 100;
}
decimal ClassCCount = 0;
if (item.ClassCCount > 0)
if (firstModel.ClassCCount > 0)
{
ClassCCount = (item.ClassCCount - firstModel.ClassCCount) / item.ClassCCount * 100;
ClassCCount = (item.ClassCCount - firstModel.ClassCCount) / firstModel.ClassCCount * 100;
}
decimal ClassDCount = 0;
if (item.ClassDCount > 0)
if (firstModel.ClassDCount > 0)
{
ClassDCount = (item.ClassDCount - firstModel.ClassDCount) / item.ClassDCount * 100;
ClassDCount = (item.ClassDCount - firstModel.ClassDCount) / firstModel.ClassDCount * 100;
}
decimal CustomerCount = 0;
if (item.CustomerCount > 0)
if (firstModel.CustomerCount > 0)
{
CustomerCount = (item.CustomerCount - firstModel.CustomerCount) / item.CustomerCount * 100;
CustomerCount = (item.CustomerCount - firstModel.CustomerCount) / firstModel.CustomerCount * 100;
}
decimal B2CCount = 0;
if (item.B2CCount > 0)
if (firstModel.B2CCount > 0)
{
B2CCount = (item.B2CCount - firstModel.B2CCount) / item.B2CCount * 100;
B2CCount = (item.B2CCount - firstModel.B2CCount) / firstModel.B2CCount * 100;
}
decimal TransCount = 0;
if (item.TransCount > 0)
if (firstModel.TransCount > 0)
{
TransCount = (item.TransCount - firstModel.TransCount) / item.TransCount * 100;
TransCount = (item.TransCount - firstModel.TransCount) / firstModel.TransCount * 100;
}
decimal InnerCount = 0;
if (item.InnerCount > 0)
if (firstModel.InnerCount > 0)
{
InnerCount = (item.InnerCount - firstModel.InnerCount) / item.InnerCount * 100;
InnerCount = (item.InnerCount - firstModel.InnerCount) / firstModel.InnerCount * 100;
}
decimal InvalidCount = 0;
if (item.InvalidCount > 0)
if (firstModel.InvalidCount > 0)
{
InvalidCount = (item.InvalidCount - firstModel.InvalidCount) / item.InvalidCount * 100;
InvalidCount = (item.InvalidCount - firstModel.InvalidCount) / firstModel.InvalidCount * 100;
}
decimal SuspectedCount = 0;
if (item.SuspectedCount > 0)
if (firstModel.SuspectedCount > 0)
{
SuspectedCount = (item.SuspectedCount - firstModel.SuspectedCount) / item.SuspectedCount * 100;
SuspectedCount = (item.SuspectedCount - firstModel.SuspectedCount) / firstModel.SuspectedCount * 100;
}
decimal IntentionCount = 0;
if (item.IntentionCount > 0)
if (firstModel.IntentionCount > 0)
{
IntentionCount = (item.IntentionCount - firstModel.IntentionCount) / item.IntentionCount * 100;
IntentionCount = (item.IntentionCount - firstModel.IntentionCount) / firstModel.IntentionCount * 100;
}
decimal InvitationCount = 0;
if (item.InvitationCount > 0)
if (firstModel.InvitationCount > 0)
{
InvitationCount = (item.InvitationCount - firstModel.InvitationCount) / item.InvitationCount * 100;
InvitationCount = (item.InvitationCount - firstModel.InvitationCount) / firstModel.InvitationCount * 100;
}
decimal NegotiationCount = 0;
if (item.NegotiationCount > 0)
if (firstModel.NegotiationCount > 0)
{
NegotiationCount = (item.NegotiationCount - firstModel.NegotiationCount) / item.NegotiationCount * 100;
NegotiationCount = (item.NegotiationCount - firstModel.NegotiationCount) / firstModel.NegotiationCount * 100;
}
decimal ContractCount = 0;
if (item.ContractCount > 0)
if (firstModel.ContractCount > 0)
{
ContractCount = (item.ContractCount - firstModel.ContractCount) / item.ContractCount * 100;
ContractCount = (item.ContractCount - firstModel.ContractCount) / firstModel.ContractCount * 100;
}
decimal OrderMoney = 0;
if (item.OrderMoney > 0)
if (firstModel.OrderMoney > 0)
{
OrderMoney = (item.OrderMoney - firstModel.OrderMoney) / item.OrderMoney * 100;
OrderMoney = (item.OrderMoney - firstModel.OrderMoney) / firstModel.OrderMoney * 100;
}
decimal StudyOrderMoney = 0;
if (item.StudyOrderMoney > 0)
if (firstModel.StudyOrderMoney > 0)
{
StudyOrderMoney = (item.StudyOrderMoney - firstModel.StudyOrderMoney) / item.StudyOrderMoney * 100;
StudyOrderMoney = (item.StudyOrderMoney - firstModel.StudyOrderMoney) / firstModel.StudyOrderMoney * 100;
}
subObj = new
{
......@@ -2152,14 +2152,16 @@ namespace Edu.Module.User
public List<RateYearItem> GetStudentStaticListYearRateModule(RB_Student_Static_Extend query)
{
List<RateYearItem> yearList = new List<RateYearItem>();
List<RB_Student_Static_Extend> rateList = new List<RB_Student_Static_Extend>();
var list = student_StaticRepository.GetStudentStaticYearListRepository(query);
if (list != null)
{
int minYear = list.Min(qitem => qitem.YearStr);
int maxYear = list.Max(qitem => qitem.YearStr);
var dataList = student_StaticRepository.GetStudentStaticMonthListRepository(query, isYear:true);
List<RB_Student_Static_Extend> result = new List<RB_Student_Static_Extend>();
int minYear = dataList.Min(qitem => qitem.YearStr);
int maxYear = dataList.Max(qitem => qitem.YearStr);
var totalYear = maxYear - minYear;
for (var i = 0; i <= totalYear; i++)
for (var y = 0; y <= totalYear; y++)
{
var list = dataList.Where(qitem => qitem.YearStr == minYear + y).ToList();
for (var i = 0; i < 12; i++)
{
decimal PushCount = 0;
var firstModel = new RB_Student_Static_Extend();
......@@ -2168,120 +2170,120 @@ namespace Edu.Module.User
firstModel = i < list.Count ? list[i - 1] : new RB_Student_Static_Extend();
}
var item = i < list.Count ? list[i] : new RB_Student_Static_Extend();
if (item.PushCount > 0 && i > 0)
if (firstModel.PushCount > 0 && i > 0)
{
PushCount = (item.PushCount - firstModel.PushCount) / item.PushCount * 100;
PushCount = (item.PushCount - firstModel.PushCount) / firstModel.PushCount * 100;
}
decimal NewCount = 0;
if (item.NewCount > 0 && i > 0)
if (firstModel.NewCount > 0 && i > 0)
{
NewCount = (item.NewCount - firstModel.NewCount) / item.NewCount * 100;
NewCount = (item.NewCount - firstModel.NewCount) / firstModel.NewCount * 100;
}
decimal CommunicationCount = 0;
if (item.CommunicationCount > 0 && i > 0)
if (firstModel.CommunicationCount > 0 && i > 0)
{
CommunicationCount = (item.CommunicationCount - firstModel.CommunicationCount) / item.CommunicationCount * 100;
CommunicationCount = (item.CommunicationCount - firstModel.CommunicationCount) / firstModel.CommunicationCount * 100;
}
decimal TrialLessonCount = 0;
if (item.TrialLessonCount > 0 && i > 0)
if (firstModel.TrialLessonCount > 0 && i > 0)
{
TrialLessonCount = (item.TrialLessonCount - firstModel.TrialLessonCount) / item.TrialLessonCount * 100;
TrialLessonCount = (item.TrialLessonCount - firstModel.TrialLessonCount) / firstModel.TrialLessonCount * 100;
}
decimal NotContacted = 0;
if (item.NotContacted > 0 && i > 0)
if (firstModel.NotContacted > 0 && i > 0)
{
NotContacted = (item.NotContacted - firstModel.NotContacted) / item.NotContacted * 100;
NotContacted = (item.NotContacted - firstModel.NotContacted) / firstModel.NotContacted * 100;
}
decimal JPCount = 0;
if (item.JPCount > 0 && i > 0)
if (firstModel.JPCount > 0 && i > 0)
{
JPCount = (item.JPCount - firstModel.JPCount) / item.JPCount * 100;
JPCount = (item.JPCount - firstModel.JPCount) / firstModel.JPCount * 100;
}
decimal KRCount = 0;
if (item.KRCount > 0 && i > 0)
if (firstModel.KRCount > 0 && i > 0)
{
KRCount = (item.KRCount - firstModel.KRCount) / item.KRCount * 100;
KRCount = (item.KRCount - firstModel.KRCount) / firstModel.KRCount * 100;
}
decimal FRCount = 0;
if (item.FRCount > 0 && i > 0)
if (firstModel.FRCount > 0 && i > 0)
{
FRCount = (item.FRCount - firstModel.FRCount) / item.FRCount * 100;
FRCount = (item.FRCount - firstModel.FRCount) / firstModel.FRCount * 100;
}
decimal JPStudyCount = 0;
if (item.JPStudyCount > 0 && i > 0)
if (firstModel.JPStudyCount > 0 && i > 0)
{
JPStudyCount = (item.JPStudyCount - firstModel.JPStudyCount) / item.JPStudyCount * 100;
JPStudyCount = (item.JPStudyCount - firstModel.JPStudyCount) / firstModel.JPStudyCount * 100;
}
decimal KRStudyCount = 0;
if (item.KRStudyCount > 0 && i > 0)
if (firstModel.KRStudyCount > 0 && i > 0)
{
KRStudyCount = (item.KRStudyCount - firstModel.KRStudyCount) / item.KRStudyCount * 100;
KRStudyCount = (item.KRStudyCount - firstModel.KRStudyCount) / firstModel.KRStudyCount * 100;
}
decimal YGAStudyCount = 0;
if (item.YGAStudyCount > 0 && i > 0)
if (firstModel.YGAStudyCount > 0 && i > 0)
{
YGAStudyCount = (item.YGAStudyCount - firstModel.YGAStudyCount) / item.YGAStudyCount * 100;
YGAStudyCount = (item.YGAStudyCount - firstModel.YGAStudyCount) / firstModel.YGAStudyCount * 100;
}
decimal USStudyCount = 0;
if (item.USStudyCount > 0 && i > 0)
if (firstModel.USStudyCount > 0 && i > 0)
{
USStudyCount = (item.USStudyCount - firstModel.USStudyCount) / item.USStudyCount * 100;
USStudyCount = (item.USStudyCount - firstModel.USStudyCount) / firstModel.USStudyCount * 100;
}
decimal SGStudyCount = 0;
if (item.SGStudyCount > 0 && i > 0)
if (firstModel.SGStudyCount > 0 && i > 0)
{
SGStudyCount = (item.SGStudyCount - firstModel.SGStudyCount) / item.SGStudyCount * 100;
SGStudyCount = (item.SGStudyCount - firstModel.SGStudyCount) / firstModel.SGStudyCount * 100;
}
decimal AXStudyCount = 0;
if (item.AXStudyCount > 0 && i > 0)
if (firstModel.AXStudyCount > 0 && i > 0)
{
AXStudyCount = (item.AXStudyCount - firstModel.AXStudyCount) / item.AXStudyCount * 100;
AXStudyCount = (item.AXStudyCount - firstModel.AXStudyCount) / firstModel.AXStudyCount * 100;
}
decimal OtherCount = 0;
if (item.OtherCount > 0 && i > 0)
if (firstModel.OtherCount > 0 && i > 0)
{
OtherCount = (item.OtherCount - firstModel.OtherCount) / item.OtherCount * 100;
OtherCount = (item.OtherCount - firstModel.OtherCount) / firstModel.OtherCount * 100;
}
decimal ClassACount = 0;
if (item.ClassACount > 0 && i > 0)
if (firstModel.ClassACount > 0 && i > 0)
{
ClassACount = (item.ClassACount - firstModel.ClassACount) / item.ClassACount * 100;
ClassACount = (item.ClassACount - firstModel.ClassACount) / firstModel.ClassACount * 100;
}
decimal ClassBCount = 0;
if (item.ClassBCount > 0 && i > 0)
if (firstModel.ClassBCount > 0 && i > 0)
{
ClassBCount = (item.ClassBCount - firstModel.ClassBCount) / item.ClassBCount * 100;
ClassBCount = (item.ClassBCount - firstModel.ClassBCount) / firstModel.ClassBCount * 100;
}
decimal ClassCCount = 0;
if (item.ClassCCount > 0)
if (firstModel.ClassCCount > 0)
{
ClassCCount = (item.ClassCCount - firstModel.ClassCCount) / item.ClassCCount * 100;
ClassCCount = (item.ClassCCount - firstModel.ClassCCount) / firstModel.ClassCCount * 100;
}
decimal ClassDCount = 0;
if (item.ClassDCount > 0 && i > 0)
if (firstModel.ClassDCount > 0 && i > 0)
{
ClassDCount = (item.ClassDCount - firstModel.ClassDCount) / item.ClassDCount * 100;
ClassDCount = (item.ClassDCount - firstModel.ClassDCount) / firstModel.ClassDCount * 100;
}
decimal CustomerCount = 0;
if (item.CustomerCount > 0 && i > 0)
if (firstModel.CustomerCount > 0 && i > 0)
{
CustomerCount = (item.CustomerCount - firstModel.CustomerCount) / item.CustomerCount * 100;
CustomerCount = (item.CustomerCount - firstModel.CustomerCount) / firstModel.CustomerCount * 100;
}
decimal B2CCount = 0;
if (item.B2CCount > 0 && i > 0)
if (firstModel.B2CCount > 0 && i > 0)
{
B2CCount = (item.B2CCount - firstModel.B2CCount) / item.B2CCount * 100;
B2CCount = (item.B2CCount - firstModel.B2CCount) / firstModel.B2CCount * 100;
}
decimal TransCount = 0;
if (item.TransCount > 0 && i > 0)
if (firstModel.TransCount > 0 && i > 0)
{
TransCount = (item.TransCount - firstModel.TransCount) / item.TransCount * 100;
TransCount = (item.TransCount - firstModel.TransCount) / firstModel.TransCount * 100;
}
decimal InnerCount = 0;
if (item.InnerCount > 0 && i > 0)
if (firstModel.InnerCount > 0 && i > 0)
{
InnerCount = (item.InnerCount - firstModel.InnerCount) / item.InnerCount * 100;
InnerCount = (item.InnerCount - firstModel.InnerCount) / firstModel.InnerCount * 100;
}
decimal InvalidCount = 0;
if (item.InvalidCount > 0 && i > 0)
......@@ -2289,43 +2291,44 @@ namespace Edu.Module.User
InvalidCount = (item.InvalidCount - firstModel.InvalidCount) / item.InvalidCount * 100;
}
decimal SuspectedCount = 0;
if (item.SuspectedCount > 0 && i > 0)
if (firstModel.SuspectedCount > 0 && i > 0)
{
SuspectedCount = (item.SuspectedCount - firstModel.SuspectedCount) / item.SuspectedCount * 100;
SuspectedCount = (item.SuspectedCount - firstModel.SuspectedCount) / firstModel.SuspectedCount * 100;
}
decimal IntentionCount = 0;
if (item.IntentionCount > 0 && i > 0)
if (firstModel.IntentionCount > 0 && i > 0)
{
IntentionCount = (item.IntentionCount - firstModel.IntentionCount) / item.IntentionCount * 100;
IntentionCount = (item.IntentionCount - firstModel.IntentionCount) / firstModel.IntentionCount * 100;
}
decimal InvitationCount = 0;
if (item.InvitationCount > 0 && i > 0)
if (firstModel.InvitationCount > 0 && i > 0)
{
InvitationCount = (item.InvitationCount - firstModel.InvitationCount) / item.InvitationCount * 100;
InvitationCount = (item.InvitationCount - firstModel.InvitationCount) / firstModel.InvitationCount * 100;
}
decimal NegotiationCount = 0;
if (item.NegotiationCount > 0 && i > 0)
if (firstModel.NegotiationCount > 0 && i > 0)
{
NegotiationCount = (item.NegotiationCount - firstModel.NegotiationCount) / item.NegotiationCount * 100;
NegotiationCount = (item.NegotiationCount - firstModel.NegotiationCount) / firstModel.NegotiationCount * 100;
}
decimal ContractCount = 0;
if (item.ContractCount > 0 && i > 0)
if (firstModel.ContractCount > 0 && i > 0)
{
ContractCount = (item.ContractCount - firstModel.ContractCount) / item.ContractCount * 100;
ContractCount = (item.ContractCount - firstModel.ContractCount) / firstModel.ContractCount * 100;
}
decimal OrderMoney = 0;
if (item.OrderMoney > 0 && i > 0)
if (firstModel.OrderMoney > 0 && i > 0)
{
OrderMoney = (item.OrderMoney - firstModel.OrderMoney) / item.OrderMoney * 100;
OrderMoney = (item.OrderMoney - firstModel.OrderMoney) / firstModel.OrderMoney * 100;
}
decimal StudyOrderMoney = 0;
if (item.StudyOrderMoney > 0 && i > 0)
if (firstModel.StudyOrderMoney > 0 && i > 0)
{
StudyOrderMoney = (item.StudyOrderMoney - firstModel.StudyOrderMoney) / item.StudyOrderMoney * 100;
StudyOrderMoney = (item.StudyOrderMoney - firstModel.StudyOrderMoney) / firstModel.StudyOrderMoney * 100;
}
rateList.Add(new RB_Student_Static_Extend()
var newModel = new RB_Student_Static_Extend()
{
YearStr = minYear + i,
YearStr =minYear+y,
MonthStr = i + 1,
PushCount = PushCount,
NewCount = NewCount,
CommunicationCount = CommunicationCount,
......@@ -2357,478 +2360,538 @@ namespace Edu.Module.User
ContractCount = ContractCount,
OrderMoney = OrderMoney,
StudyOrderMoney = StudyOrderMoney,
});
};
result.Add(newModel);
}
}
var lastModel = rateList.FirstOrDefault(qitem => qitem.YearStr == minYear);
var curModel = rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear);
var lastPushCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem=>qitem.PushCount);
var curPushCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.PushCount);
decimal CPushCount = 0;
if (lastModel.PushCount > 0)
if (lastPushCount > 0)
{
CPushCount = (curModel.PushCount - lastModel.PushCount) / lastModel.PushCount * 100;
CPushCount = (curPushCount - lastPushCount) / lastPushCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "推送人数成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).PushCount, 2),
FirstYear = Math.Round(lastPushCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).PushCount, 2),
SecondYear = Math.Round(curPushCount, 2),
YearRate = Math.Round(CPushCount, 2),
});
var lastNewCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.NewCount);
var curNewCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.NewCount);
decimal CNewCount = 0;
if (lastModel.NewCount > 0)
if (lastNewCount > 0)
{
CNewCount = (curModel.NewCount - lastModel.NewCount) / lastModel.NewCount * 100;
CNewCount = (curNewCount - lastNewCount) / lastNewCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "新客户成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).NewCount, 2),
FirstYear = Math.Round(lastNewCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).NewCount, 2),
SecondYear = Math.Round(curNewCount, 2),
YearRate = Math.Round(CNewCount, 2),
});
var lastCommunicationCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.CommunicationCount);
var curCommunicationCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.CommunicationCount);
decimal CCommunicationCount = 0;
if (lastModel.CommunicationCount > 0)
if (lastCommunicationCount > 0)
{
CCommunicationCount = (curModel.CommunicationCount - lastModel.CommunicationCount) / lastModel.CommunicationCount * 100;
CCommunicationCount = (curCommunicationCount - lastCommunicationCount) / lastCommunicationCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "初步(二次)沟通成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).CommunicationCount, 2),
FirstYear = Math.Round(lastCommunicationCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).CommunicationCount, 2),
SecondYear = Math.Round(curCommunicationCount, 2),
YearRate = Math.Round(CCommunicationCount, 2),
});
var lastTrialLessonCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TrialLessonCount);
var curTrialLessonCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TrialLessonCount);
decimal CTrialLessonCount = 0;
if (lastModel.TrialLessonCount > 0)
if (lastTrialLessonCount > 0)
{
CTrialLessonCount = (curModel.TrialLessonCount - lastModel.TrialLessonCount) / lastModel.TrialLessonCount * 100;
CTrialLessonCount = (curTrialLessonCount - lastTrialLessonCount) / lastTrialLessonCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "预约试听(已到店.已试听)成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).TrialLessonCount, 2),
FirstYear = Math.Round(lastTrialLessonCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TrialLessonCount, 2),
SecondYear = Math.Round(curTrialLessonCount, 2),
YearRate = Math.Round(CTrialLessonCount, 2),
});
var lastNotContacted = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.NotContacted);
var curNotContacted = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.NotContacted);
decimal CNotContacted = 0;
if (lastModel.NotContacted > 0)
if (lastNotContacted > 0)
{
CNotContacted = (curModel.NotContacted - lastModel.NotContacted) / lastModel.NotContacted * 100;
CNotContacted = (curNotContacted - lastNotContacted) / lastNotContacted * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "待联系成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).NotContacted, 2),
FirstYear = Math.Round(lastNotContacted, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).NotContacted, 2),
SecondYear = Math.Round(curNotContacted, 2),
YearRate = Math.Round(CNotContacted, 2),
});
var lastJPCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.JPCount);
var curJPCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.JPCount);
decimal CJPCount = 0;
if (lastModel.JPCount > 0)
if (lastJPCount > 0)
{
CJPCount = (curModel.JPCount - lastModel.JPCount) / lastModel.JPCount * 100;
CJPCount = (curJPCount - lastJPCount) / lastJPCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "日本语培成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).JPCount, 2),
FirstYear = Math.Round(lastJPCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).JPCount, 2),
SecondYear = Math.Round(curJPCount, 2),
YearRate = Math.Round(CJPCount, 2),
});
var lastKRCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.KRCount);
var curKRCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.KRCount);
decimal CKRCount = 0;
if (lastModel.KRCount > 0)
if (lastKRCount > 0)
{
CKRCount = (curModel.KRCount - lastModel.KRCount) / lastModel.KRCount * 100;
CKRCount = (curKRCount - lastKRCount) / lastKRCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "韩国语培成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).KRCount, 2),
FirstYear = Math.Round(lastKRCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).KRCount, 2),
SecondYear = Math.Round(curKRCount, 2),
YearRate = Math.Round(CKRCount, 2),
});
var lastFRCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.FRCount);
var curFRCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.FRCount);
decimal CFRCount = 0;
if (lastModel.FRCount > 0)
if (lastFRCount > 0)
{
CFRCount = (curModel.FRCount - lastModel.FRCount) / lastModel.FRCount * 100;
CFRCount = (curFRCount - lastFRCount) / lastFRCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "法国语培成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).FRCount, 2),
FirstYear = Math.Round(lastFRCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).FRCount, 2),
SecondYear = Math.Round(curFRCount, 2),
YearRate = Math.Round(CFRCount, 2),
});
var lastJPStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.JPStudyCount);
var curJPStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.JPStudyCount);
decimal CJPStudyCount = 0;
if (lastModel.JPStudyCount > 0)
if (lastJPStudyCount > 0)
{
CJPStudyCount = (curModel.JPStudyCount - lastModel.JPStudyCount) / lastModel.JPStudyCount * 100;
CJPStudyCount = (curJPStudyCount - lastJPStudyCount) / lastJPStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "日本留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).JPStudyCount, 2),
FirstYear = Math.Round(lastJPStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).JPStudyCount, 2),
SecondYear = Math.Round(curJPStudyCount, 2),
YearRate = Math.Round(CJPStudyCount, 2),
});
var lastKRStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.KRStudyCount);
var curKRStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.KRStudyCount);
decimal CKRStudyCount = 0;
if (lastModel.KRStudyCount > 0)
if (lastKRStudyCount > 0)
{
CKRStudyCount = (curModel.KRStudyCount - lastModel.KRStudyCount) / lastModel.KRStudyCount * 100;
CKRStudyCount = (curKRStudyCount - lastKRStudyCount) / lastKRStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "韩国留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).KRStudyCount, 2),
FirstYear = Math.Round(lastKRStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).KRStudyCount, 2),
SecondYear = Math.Round(curKRStudyCount, 2),
YearRate = Math.Round(CKRStudyCount, 2),
});
var lastYGAStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.YGAStudyCount);
var curYGAStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.YGAStudyCount);
decimal CYGAStudyCount = 0;
if (lastModel.YGAStudyCount > 0)
if (lastYGAStudyCount > 0)
{
CYGAStudyCount = (curModel.YGAStudyCount - lastModel.YGAStudyCount) / lastModel.YGAStudyCount * 100;
CYGAStudyCount = (curYGAStudyCount - lastYGAStudyCount) / lastYGAStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "英港澳留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).YGAStudyCount, 2),
FirstYear = Math.Round(lastYGAStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).YGAStudyCount, 2),
SecondYear = Math.Round(curYGAStudyCount, 2),
YearRate = Math.Round(CYGAStudyCount, 2),
});
var lastUSStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.USStudyCount);
var curUSStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.USStudyCount);
decimal CUSStudyCount = 0;
if (lastModel.USStudyCount > 0)
if (lastUSStudyCount > 0)
{
CUSStudyCount = (curModel.USStudyCount - lastModel.USStudyCount) / lastModel.USStudyCount * 100;
CUSStudyCount = (curUSStudyCount - lastUSStudyCount) / lastUSStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "美国留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).USStudyCount, 2),
FirstYear = Math.Round(lastUSStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).USStudyCount, 2),
SecondYear = Math.Round(curUSStudyCount, 2),
YearRate = Math.Round(CUSStudyCount, 2),
});
var lastSGStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.SGStudyCount);
var curSGStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.SGStudyCount);
decimal CSGStudyCount = 0;
if (lastModel.SGStudyCount > 0)
if (lastSGStudyCount > 0)
{
CSGStudyCount = (curModel.SGStudyCount - lastModel.SGStudyCount) / lastModel.SGStudyCount * 100;
CSGStudyCount = (curSGStudyCount - lastSGStudyCount) / lastSGStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "新加坡留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).SGStudyCount, 2),
FirstYear = Math.Round(lastSGStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).SGStudyCount, 2),
SecondYear = Math.Round(curSGStudyCount, 2),
YearRate = Math.Round(CSGStudyCount, 2),
});
var lastAXStudyCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.AXStudyCount);
var curAXStudyCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.AXStudyCount);
decimal CAXStudyCount = 0;
if (lastModel.AXStudyCount > 0)
if (lastAXStudyCount > 0)
{
CAXStudyCount = (curModel.AXStudyCount - lastModel.AXStudyCount) / lastModel.AXStudyCount * 100;
CAXStudyCount = (curAXStudyCount - lastAXStudyCount) / lastAXStudyCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "澳新留学成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == minYear).AXStudyCount, 2),
FirstYear = Math.Round(lastAXStudyCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(list.FirstOrDefault(qitem => qitem.YearStr == maxYear).AXStudyCount, 2),
SecondYear = Math.Round(curAXStudyCount, 2),
YearRate = Math.Round(CAXStudyCount, 2),
});
var lastOtherCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.OtherCount);
var curOtherCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.OtherCount);
decimal COtherCount = 0;
if (lastModel.OtherCount > 0)
if (lastOtherCount > 0)
{
COtherCount = (curModel.OtherCount - lastModel.OtherCount) / lastModel.OtherCount * 100;
COtherCount = (curOtherCount - lastOtherCount) / lastOtherCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "其他成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).OtherCount, 2),
FirstYear = Math.Round(lastOtherCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).OtherCount, 2),
SecondYear = Math.Round(curOtherCount, 2),
YearRate = Math.Round(COtherCount, 2),
});
var lastClassACount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ClassACount);
var curClassACount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ClassACount);
decimal CClassACount = 0;
if (lastModel.ClassACount > 0)
if (lastClassACount > 0)
{
CClassACount = (curModel.ClassACount - lastModel.ClassACount) / lastModel.ClassACount * 100;
CClassACount = (curClassACount - lastClassACount) / lastClassACount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "A类客户成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).ClassACount, 2),
FirstYear = Math.Round(lastClassACount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ClassACount, 2),
SecondYear = Math.Round(curClassACount, 2),
YearRate = Math.Round(CClassACount, 2),
});
var lastClassBCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ClassBCount);
var curClassBCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ClassBCount);
decimal CClassBCount = 0;
if (lastModel.ClassBCount > 0)
if (lastClassBCount > 0)
{
CClassBCount = (curModel.ClassBCount - lastModel.ClassBCount) / lastModel.ClassBCount * 100;
CClassBCount = (curClassBCount - lastClassBCount) / lastClassBCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "B类客户成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).ClassBCount, 2),
FirstYear = Math.Round(lastClassBCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ClassBCount, 2),
SecondYear = Math.Round(curClassBCount, 2),
YearRate = Math.Round(CClassBCount, 2),
});
var lastClassCCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ClassCCount);
var curClassCCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ClassCCount);
decimal CClassCCount = 0;
if (lastModel.ClassCCount > 0)
if (lastClassCCount > 0)
{
CClassCCount = (curModel.ClassCCount - lastModel.ClassCCount) / lastModel.ClassCCount * 100;
CClassCCount = (curClassCCount - lastClassCCount) / lastClassCCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "C类客户成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).ClassCCount, 2),
FirstYear = Math.Round(lastClassCCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ClassCCount, 2),
SecondYear = Math.Round(curClassCCount, 2),
YearRate = Math.Round(CClassCCount, 2),
});
var lastClassDCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ClassDCount);
var curClassDCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ClassDCount);
decimal CClassDCount = 0;
if (lastModel.ClassDCount > 0)
if (lastClassDCount > 0)
{
CClassDCount = (curModel.ClassDCount - lastModel.ClassDCount) / lastModel.ClassDCount * 100;
CClassDCount = (curClassDCount - lastClassDCount) / lastClassDCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "D类客户成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).ClassDCount, 2),
FirstYear = Math.Round(lastClassDCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ClassDCount, 2),
SecondYear = Math.Round(curClassDCount, 2),
YearRate = Math.Round(CClassDCount, 2),
});
var lastCustomerCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.CustomerCount);
var curCustomerCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.CustomerCount);
decimal CCustomerCount = 0;
if (lastModel.CustomerCount > 0)
if (lastCustomerCount > 0)
{
CCustomerCount = (curModel.CustomerCount - lastModel.CustomerCount) / lastModel.CustomerCount * 100;
CCustomerCount = (curCustomerCount - lastCustomerCount) / lastCustomerCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "同行介绍成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).CustomerCount, 2),
FirstYear = Math.Round(lastCustomerCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).CustomerCount, 2),
SecondYear = Math.Round(curCustomerCount, 2),
YearRate = Math.Round(CCustomerCount, 2),
});
var lastB2CCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.B2CCount);
var curB2CCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.B2CCount);
decimal CB2CCount = 0;
if (lastModel.B2CCount > 0)
if (lastB2CCount > 0)
{
CB2CCount = (curModel.B2CCount - lastModel.B2CCount) / lastModel.B2CCount * 100;
CB2CCount = (curB2CCount - lastB2CCount) / lastB2CCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "直客成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).B2CCount, 2),
FirstYear = Math.Round(lastB2CCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).B2CCount, 2),
SecondYear = Math.Round(curB2CCount, 2),
YearRate = Math.Round(CB2CCount, 2),
});
var lastTransCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.TransCount);
var curTransCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.TransCount);
decimal CTransCount = 0;
if (lastModel.TransCount > 0)
if (lastTransCount > 0)
{
CTransCount = (curModel.TransCount - lastModel.TransCount) / lastModel.TransCount * 100;
CTransCount = (curTransCount - lastTransCount) / lastTransCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "学员转介绍成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).TransCount, 2),
FirstYear = Math.Round(lastTransCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).TransCount, 2),
SecondYear = Math.Round(curTransCount, 2),
YearRate = Math.Round(CTransCount, 2),
});
var lastInnerCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.InnerCount);
var curInnerCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.InnerCount);
decimal CInnerCount = 0;
if (lastModel.InnerCount > 0)
if (lastInnerCount > 0)
{
CInnerCount = (curModel.InnerCount - lastModel.InnerCount) / lastModel.InnerCount * 100;
CInnerCount = (curInnerCount - lastInnerCount) / lastInnerCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "内部介绍成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).InnerCount, 2),
FirstYear = Math.Round(lastInnerCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).InnerCount, 2),
SecondYear = Math.Round(curInnerCount, 2),
YearRate = Math.Round(CInnerCount, 2),
});
var lastInvalidCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.InvalidCount);
var curInvalidCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.InvalidCount);
decimal CInvalidCount = 0;
if (lastModel.InvalidCount > 0)
if (lastInvalidCount > 0)
{
CInvalidCount = (curModel.InvalidCount - lastModel.InvalidCount) / lastModel.InvalidCount * 100;
CInvalidCount = (curInvalidCount - lastInvalidCount) / lastInvalidCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "无效成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).InvalidCount, 2),
FirstYear = Math.Round(lastInvalidCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).InvalidCount, 2),
SecondYear = Math.Round(curInvalidCount, 2),
YearRate = Math.Round(CInvalidCount, 2),
});
var lastSuspectedCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.SuspectedCount);
var curSuspectedCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.SuspectedCount);
decimal CSuspectedCount = 0;
if (lastModel.SuspectedCount > 0)
if (lastSuspectedCount > 0)
{
CSuspectedCount = (curModel.SuspectedCount - lastModel.SuspectedCount) / lastModel.SuspectedCount * 100;
CSuspectedCount = (curSuspectedCount - lastSuspectedCount) / lastSuspectedCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "疑似成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).SuspectedCount, 2),
FirstYear = Math.Round(lastSuspectedCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).SuspectedCount, 2),
SecondYear = Math.Round(curSuspectedCount, 2),
YearRate = Math.Round(CSuspectedCount, 2),
});
var lastIntentionCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.IntentionCount);
var curIntentionCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.IntentionCount);
decimal CIntentionCount = 0;
if (lastModel.IntentionCount > 0)
if (lastIntentionCount > 0)
{
CIntentionCount = (curModel.IntentionCount - lastModel.IntentionCount) / lastModel.IntentionCount * 100;
CIntentionCount = (curIntentionCount - lastIntentionCount) / lastIntentionCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "意向成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).IntentionCount, 2),
FirstYear = Math.Round(lastIntentionCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).IntentionCount, 2),
SecondYear = Math.Round(curIntentionCount, 2),
YearRate = Math.Round(CIntentionCount, 2),
});
var lastInvitationCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.InvitationCount);
var curInvitationCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.InvitationCount);
decimal CInvitationCount = 0;
if (lastModel.InvitationCount > 0)
if (lastInvitationCount > 0)
{
CInvitationCount = (curModel.InvitationCount - lastModel.InvitationCount) / lastModel.InvitationCount * 100;
CInvitationCount = (curInvitationCount - lastInvitationCount) / lastInvitationCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "近期课邀约成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).InvitationCount, 2),
FirstYear = Math.Round(lastInvitationCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).InvitationCount, 2),
SecondYear = Math.Round(curInvitationCount, 2),
YearRate = Math.Round(CInvitationCount, 2),
});
var lastNegotiationCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.NegotiationCount);
var curNegotiationCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.NegotiationCount);
decimal CNegotiationCount = 0;
if (lastModel.NegotiationCount > 0)
if (lastNegotiationCount > 0)
{
CNegotiationCount = (curModel.NegotiationCount - lastModel.NegotiationCount) / lastModel.NegotiationCount * 100;
CNegotiationCount = (curNegotiationCount - lastNegotiationCount) / lastNegotiationCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "谈判成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).NegotiationCount, 2),
FirstYear = Math.Round(lastNegotiationCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).NegotiationCount, 2),
SecondYear = Math.Round(curNegotiationCount, 2),
YearRate = Math.Round(CNegotiationCount, 2),
});
var lastContractCount = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.ContractCount);
var curContractCount = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.ContractCount);
decimal CContractCount = 0;
if (lastModel.ContractCount > 0)
if (lastContractCount > 0)
{
CContractCount = (curModel.ContractCount - lastModel.ContractCount) / lastModel.ContractCount * 100;
CContractCount = (curContractCount - lastContractCount) / lastContractCount * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "签约.成交.续费成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).ContractCount, 2),
FirstYear = Math.Round(lastContractCount, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).ContractCount, 2),
SecondYear = Math.Round(curContractCount, 2),
YearRate = Math.Round(CContractCount, 2),
});
var lastOrderMoney = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.OrderMoney);
var curOrderMoney = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.OrderMoney);
decimal COrderMoney = 0;
if (lastModel.OrderMoney > 0)
if (lastOrderMoney > 0)
{
COrderMoney = (curModel.OrderMoney - lastModel.OrderMoney) / lastModel.OrderMoney * 100;
COrderMoney = (curOrderMoney - lastOrderMoney) / lastOrderMoney * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "语培签约金额成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).OrderMoney, 2),
FirstYear = Math.Round(lastOrderMoney, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).OrderMoney, 2),
SecondYear = Math.Round(curOrderMoney, 2),
YearRate = Math.Round(COrderMoney, 2),
});
var lastStudyOrderMoney = result.Where(qitem => qitem.YearStr == minYear).Average(qitem => qitem.StudyOrderMoney);
var curStudyOrderMoney = result.Where(qitem => qitem.YearStr == maxYear).Average(qitem => qitem.StudyOrderMoney);
decimal CStudyOrderMoney = 0;
if (lastModel.StudyOrderMoney > 0)
if (lastStudyOrderMoney > 0)
{
CStudyOrderMoney = (curModel.StudyOrderMoney - lastModel.StudyOrderMoney) / lastModel.StudyOrderMoney * 100;
CStudyOrderMoney = (curStudyOrderMoney - lastStudyOrderMoney) / lastStudyOrderMoney * 100;
}
yearList.Add(new RateYearItem()
{
ItemName = "留学签约金额成长率",
FirstYearStr = minYear,
FirstYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == minYear).StudyOrderMoney, 2),
FirstYear = Math.Round(lastStudyOrderMoney, 2),
SecondYearStr = maxYear,
SecondYear = Math.Round(rateList.FirstOrDefault(qitem => qitem.YearStr == maxYear).StudyOrderMoney, 2),
SecondYear = Math.Round(curStudyOrderMoney, 2),
YearRate = Math.Round(CStudyOrderMoney, 2),
});
}
return yearList;
}
......
......@@ -56,11 +56,11 @@ WHERE 1=1
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_Static_Extend> GetStudentStaticMonthListRepository(RB_Student_Static_Extend query)
public List<RB_Student_Static_Extend> GetStudentStaticMonthListRepository(RB_Student_Static_Extend query,bool isYear=false)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT CONCAT(DATE_FORMAT(A.Date, '%Y-%m'),'-01') AS Date,SUM(A.PushCount) AS PushCount,SUM(A.NewCount) AS NewCount,SUM(A.CommunicationCount) AS CommunicationCount
SELECT CONCAT(DATE_FORMAT(A.Date, '%Y-%m'),'-01') AS Date,A.YearStr,A.MonthStr,SUM(A.PushCount) AS PushCount,SUM(A.NewCount) AS NewCount,SUM(A.CommunicationCount) AS CommunicationCount
,SUM(A.TrialLessonCount) AS TrialLessonCount,SUM(A.NotContacted) AS NotContacted,SUM(A.JPCount) AS JPCount,SUM(A.KRCount) AS KRCount,SUM(A.FRCount) AS FRCount
,SUM(A.JPStudyCount) AS JPStudyCount,SUM(A.KRStudyCount) AS KRStudyCount,SUM(A.YGAStudyCount) AS YGAStudyCount,SUM(A.USStudyCount) AS USStudyCount
,SUM(A.SGStudyCount) AS SGStudyCount,SUM(A.AXStudyCount) AS AXStudyCount,SUM(A.OtherCount) AS OtherCount,SUM(A.ClassACount) AS ClassACount,SUM(A.ClassBCount) AS ClassBCount
......@@ -78,12 +78,19 @@ WHERE 1=1 AND A.Date<>'0001-01-01 00:00:00'
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Static_Extend.Group_Id), query.Group_Id);
}
if (query.YearStr > 0)
{
if (isYear)
{
builder.AppendFormat(" AND A.{0}<={1} ", nameof(RB_Student_Static_Extend.YearStr), query.YearStr);
}
else
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_Static_Extend.YearStr), query.YearStr);
}
}
}
builder.AppendFormat(" GROUP BY DATE_FORMAT(A.Date, '%Y-%m') ");
builder.AppendFormat(" ORDER BY DATE_FORMAT(A.Date, '%Y-%m') ASC ", nameof(RB_Student_Static_Extend.Id));
builder.AppendFormat(" ORDER BY DATE_FORMAT(A.Date, '%Y-%m') ASC ");
return Get<RB_Student_Static_Extend>(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