Commit 26422b2a authored by 黄奎's avatar 黄奎

页面修改

parent c9327275
......@@ -531,5 +531,72 @@ namespace Edu.Common
int result = rd.Next(1, 100);
return result % 4;
}
/// <summary>
/// 一年中的第几周
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public static int WeekOfYear(DateTime dt)
{
int days = DaysInFirstweekInYear(dt);
int dayofyear = dt.DayOfYear;
if (dayofyear < days) return 1;
else
{
int week2 = (int)Math.Ceiling((double)(dayofyear - days) / (double)7);
return week2 + 1;
}
}
/// <summary>
/// 计算某年第一周的天数
/// </summary>
/// <param name="dt">某年中的一个时间</param>
/// <returns></returns>
public static int DaysInFirstweekInYear(DateTime dt)
{
DateTime FirstDate = Convert.ToDateTime(string.Format("{0}-1-1", dt.Year));
int DayOfWeekInYear = DayOfWeek(FirstDate);
int DaysInFirstWeek = 8 - DayOfWeekInYear;
return DaysInFirstWeek;
}
/// <summary>
/// 计算星期几,转换为数字
/// </summary>
/// <param name="dt">某天的日期</param>
/// <returns></returns>
public static int DayOfWeek(DateTime dt)
{
string strDayOfWeek = dt.DayOfWeek.ToString().ToLower();
int intDayOfWeek = 0;
switch (strDayOfWeek)
{
case "monday":
intDayOfWeek = 1;
break;
case "tuesday":
intDayOfWeek = 2;
break;
case "wednesday":
intDayOfWeek = 3;
break;
case "thursday":
intDayOfWeek = 4;
break;
case "friday":
intDayOfWeek = 5;
break;
case "saturday":
intDayOfWeek = 6;
break;
case "sunday":
intDayOfWeek = 7;
break;
}
return intDayOfWeek;
}
}
}
\ No newline at end of file
......@@ -616,6 +616,12 @@ namespace Edu.Module.Customer
dayList.Add(tempObj);
}
var yesDataList = lastList?.Where(qitem => qitem.Date.Year == end.AddDays(-1).Year && qitem.Date.Month == end.AddDays(-1).Month)?.ToList();
//当前周
var curWeekList = lastList?.Where(qitem => Common.ConvertHelper.WeekOfYear(qitem.Date) == Common.ConvertHelper.WeekOfYear(end.AddDays(-1)))?.ToList();
//上一周
var lastWeekList = lastList?.Where(qitem => Common.ConvertHelper.WeekOfYear(qitem.Date) == Common.ConvertHelper.WeekOfYear(end.AddDays(-1))-1)?.ToList();
var tempDataList = lastList?.Where(qitem => Common.ConvertHelper.FormatDate(qitem.Date) == Common.ConvertHelper.FormatDate(end.AddDays(-1)))?.ToList();
obj = new
{
......@@ -627,36 +633,36 @@ namespace Edu.Module.Customer
ClueCount = yesDataList?.Sum(qitem => qitem.ClueCount) ?? 0,
YestodayClue = yesDataList?.Sum(qitem => qitem.YestodayClue) ?? 0,
CurWeekClue = tempDataList?.Sum(qitem => qitem.CurWeekClue) ?? 0,
LastWeekClue = tempDataList?.Sum(qitem => qitem.LastWeekClue) ?? 0,
CurWeekClue = curWeekList?.Sum(qitem => qitem.CurWeekClue) ?? 0,
LastWeekClue = lastWeekList?.Sum(qitem => qitem.LastWeekClue) ?? 0,
CurMonthClue = tempDataList?.Sum(qitem => qitem.CurMonthClue) ?? 0,
LastMonthClue = tempDataList?.Sum(qitem => qitem.LastMonthClue) ?? 0,
FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0,
YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0,
CurWeekFollow = tempDataList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = tempDataList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurWeekFollow = curWeekList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = lastWeekList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurMonthFollow = tempDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0,
LastMonthFollow = tempDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0,
VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0,
YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0,
CurWeekVisit = tempDataList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = tempDataList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurWeekVisit = curWeekList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = lastWeekList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurMonthVisit = tempDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0,
LastMonthVisit = tempDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0,
TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0,
YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0,
CurWeekTrialLesson = tempDataList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = tempDataList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurWeekTrialLesson = curWeekList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = lastWeekList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurMonthTrialLesson = tempDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0,
LastMonthTrialLesson = tempDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0,
SaleMoney = yesDataList?.Sum(qitem => qitem.SaleMoney) ?? 0,
YestodaySale = yesDataList?.Sum(qitem => qitem.YestodaySale) ?? 0,
CurWeekSale = tempDataList?.Sum(qitem => qitem.CurWeekSale) ?? 0,
LastWeekSale = tempDataList?.Sum(qitem => qitem.LastWeekSale) ?? 0,
CurWeekSale = curWeekList?.Sum(qitem => qitem.CurWeekSale) ?? 0,
LastWeekSale = lastWeekList?.Sum(qitem => qitem.LastWeekSale) ?? 0,
CurMonrhSale = tempDataList?.Sum(qitem => qitem.CurMonrhSale) ?? 0,
LastMonthSale = tempDataList?.Sum(qitem => qitem.LastMonthSale) ?? 0,
}
......@@ -682,6 +688,11 @@ namespace Edu.Module.Customer
});
var consultantGoal = GetConsultantGoalListModule(new RB_Consultant_Goal_Extend() { Group_Id = 100000, Dept_Id = 13, YearStr = end.Year, MonthStr = end.Month })?.FirstOrDefault();
var yesDataList = lastList?.Where(qitem => qitem.Date.Year == end.AddDays(-1).Year && qitem.Date.Month == end.AddDays(-1).Month)?.ToList();
//当前周
var curWeekList = lastList?.Where(qitem => Common.ConvertHelper.WeekOfYear(qitem.Date) == Common.ConvertHelper.WeekOfYear(end.AddDays(-1)))?.ToList();
//上一周
var lastWeekList = lastList?.Where(qitem => Common.ConvertHelper.WeekOfYear(qitem.Date) == Common.ConvertHelper.WeekOfYear(end.AddDays(-1)) - 1)?.ToList();
var tempDataList = lastList?.Where(qitem => Common.ConvertHelper.FormatDate(qitem.Date) == Common.ConvertHelper.FormatDate(end.AddDays(-1)))?.ToList();
obj = new
{
......@@ -689,41 +700,41 @@ namespace Edu.Module.Customer
WeekStr = Common.Plugin.StringHelper.GetWeek(end.AddDays(-1)),
TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0,
YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0,
CurWeekTrialLesson = tempDataList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = tempDataList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurWeekTrialLesson = curWeekList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = lastWeekList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurMonthTrialLesson = tempDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0,
LastMonthTrialLesson = tempDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0,
VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0,
YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0,
CurWeekVisit = tempDataList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = tempDataList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurWeekVisit = curWeekList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = lastWeekList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurMonthVisit = tempDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0,
LastMonthVisit = tempDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0,
Rates = yesDataList?.Sum(qitem => qitem.Rates) ?? 0,
YestodayRates = yesDataList?.Sum(qitem => qitem.YestodayRates) ?? 0,
CurWeekRates = tempDataList?.Sum(qitem => qitem.CurWeekRates) ?? 0,
LastWeekRates = tempDataList?.Sum(qitem => qitem.LastWeekRates) ?? 0,
CurWeekRates = curWeekList?.Sum(qitem => qitem.CurWeekRates) ?? 0,
LastWeekRates = lastWeekList?.Sum(qitem => qitem.LastWeekRates) ?? 0,
CurMonthRates = tempDataList?.Sum(qitem => qitem.CurMonthRates) ?? 0,
LastMonthRates = tempDataList?.Sum(qitem => qitem.LastMonthRates) ?? 0,
FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0,
YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0,
CurWeekFollow = tempDataList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = tempDataList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurWeekFollow = curWeekList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = lastWeekList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurMonthFollow = tempDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0,
LastMonthFollow = tempDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0,
AgFollow = Math.Round(yesDataList?.Average(qitem => qitem.AgFollow) ?? 0, 2),
YestodayAgFollow = Math.Round(yesDataList?.Average(qitem => qitem.YestodayAgFollow) ?? 0, 2),
CurWeekAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, 2),
LastWeekAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, 2),
CurWeekAgFollow = Math.Round(curWeekList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, 2),
LastWeekAgFollow = Math.Round(lastWeekList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, 2),
CurMonthAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.CurMonthAgFollow) ?? 0, 2),
LastMonthAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.LastMonthAgFollow) ?? 0, 2),
CurWeekOrderNum = tempDataList?.Sum(qitem => qitem.CurWeekOrderNum) ?? 0,
LastWeekOrderNum = tempDataList?.Sum(qitem => qitem.LastWeekOrderNum) ?? 0,
CurWeekOrderNum = curWeekList?.Sum(qitem => qitem.CurWeekOrderNum) ?? 0,
LastWeekOrderNum = lastWeekList?.Sum(qitem => qitem.LastWeekOrderNum) ?? 0,
CurWeekOrderSale = tempDataList?.Sum(qitem => qitem.CurWeekOrderSale) ?? 0,
LastWeekOrderSale = tempDataList?.Sum(qitem => qitem.LastWeekOrderSale) ?? 0,
......
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