Commit 8900876e authored by liudong1993's avatar liudong1993

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

parents c915b251 d6cc6d65
...@@ -8,7 +8,8 @@ using Edu.Common.Enum; ...@@ -8,7 +8,8 @@ using Edu.Common.Enum;
namespace Edu.Cache.App namespace Edu.Cache.App
{ {
public class MsgUserRedisCache public class MsgUserRedisCache
{ /// <summary> {
/// <summary>
/// 使用redis第几号库 /// 使用redis第几号库
/// </summary> /// </summary>
public static readonly int REDIS_DB3 = 3; public static readonly int REDIS_DB3 = 3;
......
...@@ -43,6 +43,7 @@ namespace Edu.Common ...@@ -43,6 +43,7 @@ namespace Edu.Common
/// <summary> /// <summary>
/// 获取时间格式 /// 获取时间格式
/// [HH:mm]
/// </summary> /// </summary>
/// <param name="time"></param> /// <param name="time"></param>
/// <returns></returns> /// <returns></returns>
...@@ -531,5 +532,72 @@ namespace Edu.Common ...@@ -531,5 +532,72 @@ namespace Edu.Common
int result = rd.Next(1, 100); int result = rd.Next(1, 100);
return result % 4; 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
...@@ -316,7 +316,6 @@ namespace Edu.Education.Helper ...@@ -316,7 +316,6 @@ namespace Edu.Education.Helper
/// <returns></returns> /// <returns></returns>
public async Task EduCreateScrollClassTimer() public async Task EduCreateScrollClassTimer()
{ {
string cronExpression = "0 10 0 1 * ?"; //每月1号凌晨10分
NameValueCollection props = new NameValueCollection NameValueCollection props = new NameValueCollection
{ {
{ "quartz.serializer.type", "binary" } { "quartz.serializer.type", "binary" }
......
...@@ -58,7 +58,7 @@ namespace Edu.Model.Entity.Customer ...@@ -58,7 +58,7 @@ namespace Edu.Model.Entity.Customer
public string Image { get; set; } public string Image { get; set; }
/// <summary> /// <summary>
/// 客户来源 /// 同行客户来源(1-企业,2-学校)
/// </summary> /// </summary>
public int CustomerSourceType { get; set; } public int CustomerSourceType { get; set; }
......
...@@ -78,7 +78,7 @@ namespace Edu.Model.Entity.Grade ...@@ -78,7 +78,7 @@ namespace Edu.Model.Entity.Grade
public int PlanType { get; set; } public int PlanType { get; set; }
/// <summary> /// <summary>
/// 课程ID /// 课程id
/// </summary> /// </summary>
public int CourseId { get; set; } public int CourseId { get; set; }
} }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.DataStatistics
{
/// <summary>
/// 市场渠道统计实体类
/// </summary>
public class MarketChannelStaticModel
{
/// <summary>
/// 渠道名称
/// </summary>
public string ChannelName { get; set; }
/// <summary>
/// 渠道编号
/// </summary>
public int ChannelId { get; set; }
/// <summary>
/// 回单(新增学员数量)
/// </summary>
public int ClueCount { get; set; }
/// <summary>
/// 到访数量
/// </summary>
public int VisitCount { get; set; }
/// <summary>
/// 订单数量
/// </summary>
public int OrderCount { get; set; }
/// <summary>
/// 订单业绩金额
/// </summary>
public decimal OrderIncome { get; set; }
}
}
...@@ -56,11 +56,6 @@ namespace Edu.Model.ViewModel.Grade ...@@ -56,11 +56,6 @@ namespace Edu.Model.ViewModel.Grade
/// </summary> /// </summary>
public string CourseName { get; set; } public string CourseName { get; set; }
/// <summary>
/// 课程id
/// </summary>
public int CourseId { get; set; }
/// <summary> /// <summary>
/// 班级类型 /// 班级类型
/// </summary> /// </summary>
......
...@@ -144,6 +144,11 @@ namespace Edu.Model.ViewModel.User ...@@ -144,6 +144,11 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public int OrderCount { get; set; } public int OrderCount { get; set; }
/// <summary>
/// 订单实收金额
/// </summary>
public decimal OrderIncome { get; set; }
/// <summary> /// <summary>
/// 续费订单数量 /// 续费订单数量
/// </summary> /// </summary>
...@@ -208,6 +213,9 @@ namespace Edu.Model.ViewModel.User ...@@ -208,6 +213,9 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public string QDate { get; set; } public string QDate { get; set; }
/// <summary>
/// 到访次数
/// </summary>
public int VisitCount { get; set; } public int VisitCount { get; set; }
/// <summary> /// <summary>
...@@ -220,6 +228,11 @@ namespace Edu.Model.ViewModel.User ...@@ -220,6 +228,11 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public string CustomerName { get; set; } public string CustomerName { get; set; }
/// <summary>
/// 同行客户来源(1-企业,2-学校)
/// </summary>
public int CustomerSourceType { get; set; }
/// <summary> /// <summary>
/// 来源人名称 /// 来源人名称
/// </summary> /// </summary>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<NoWarn>1701;1702;NETSDK1138</NoWarn> <NoWarn>1701;1702;NETSDK1138;CS8602</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
......
...@@ -13,6 +13,9 @@ using Edu.Model.ViewModel.DataStatistics; ...@@ -13,6 +13,9 @@ using Edu.Model.ViewModel.DataStatistics;
using Edu.Model.ViewModel.Reserve; using Edu.Model.ViewModel.Reserve;
using VT.FW.DB; using VT.FW.DB;
using Edu.Common.Enum; using Edu.Common.Enum;
using Edu.Repository.System;
using Edu.Model.ViewModel.System;
using Edu.Common.Enum.User;
namespace Edu.Module.Customer namespace Edu.Module.Customer
{ {
...@@ -71,6 +74,16 @@ namespace Edu.Module.Customer ...@@ -71,6 +74,16 @@ namespace Edu.Module.Customer
/// </summary> /// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository(); private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary>
/// 渠道仓储层对象
/// </summary>
private readonly RB_ChannelRepository channelRepository = new RB_ChannelRepository();
/// <summary>
/// 同行列表
/// </summary>
private readonly RB_CustomerRepository customerRepository = new RB_CustomerRepository();
/// <summary> /// <summary>
/// 清除数据 /// 清除数据
/// </summary> /// </summary>
...@@ -602,7 +615,14 @@ namespace Edu.Module.Customer ...@@ -602,7 +615,14 @@ namespace Edu.Module.Customer
} }
dayList.Add(tempObj); dayList.Add(tempObj);
} }
var yesDataList = lastList?.Where(qitem =>qitem.Date.Year== end.AddDays(-1).Year && qitem.Date.Month== end.AddDays(-1).Month)?.ToList(); 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 obj = new
{ {
dayList, dayList,
...@@ -613,38 +633,38 @@ namespace Edu.Module.Customer ...@@ -613,38 +633,38 @@ namespace Edu.Module.Customer
ClueCount = yesDataList?.Sum(qitem => qitem.ClueCount) ?? 0, ClueCount = yesDataList?.Sum(qitem => qitem.ClueCount) ?? 0,
YestodayClue = yesDataList?.Sum(qitem => qitem.YestodayClue) ?? 0, YestodayClue = yesDataList?.Sum(qitem => qitem.YestodayClue) ?? 0,
CurWeekClue = yesDataList?.Sum(qitem => qitem.CurWeekClue) ?? 0, CurWeekClue = curWeekList?.Sum(qitem => qitem.CurWeekClue) ?? 0,
LastWeekClue = yesDataList?.Sum(qitem => qitem.LastWeekClue) ?? 0, LastWeekClue = lastWeekList?.Sum(qitem => qitem.LastWeekClue) ?? 0,
CurMonthClue = yesDataList?.Sum(qitem => qitem.CurMonthClue) ?? 0, CurMonthClue = tempDataList?.Sum(qitem => qitem.CurMonthClue) ?? 0,
LastMonthClue = yesDataList?.Sum(qitem => qitem.LastMonthClue) ?? 0, LastMonthClue = tempDataList?.Sum(qitem => qitem.LastMonthClue) ?? 0,
FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0, FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0,
YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0, YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0,
CurWeekFollow = yesDataList?.Sum(qitem => qitem.CurWeekFollow) ?? 0, CurWeekFollow = curWeekList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = yesDataList?.Sum(qitem => qitem.LastWeekFollow) ?? 0, LastWeekFollow = lastWeekList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurMonthFollow = yesDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0, CurMonthFollow = tempDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0,
LastMonthFollow = yesDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0, LastMonthFollow = tempDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0,
VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0, VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0,
YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0, YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0,
CurWeekVisit = yesDataList?.Sum(qitem => qitem.CurWeekVisit) ?? 0, CurWeekVisit = curWeekList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = yesDataList?.Sum(qitem => qitem.LastWeekVisit) ?? 0, LastWeekVisit = lastWeekList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurMonthVisit = yesDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0, CurMonthVisit = tempDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0,
LastMonthVisit = yesDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0, LastMonthVisit = tempDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0,
TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0, TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0,
YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0, YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0,
CurWeekTrialLesson = yesDataList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0, CurWeekTrialLesson = curWeekList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = yesDataList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0, LastWeekTrialLesson = lastWeekList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurMonthTrialLesson = yesDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0, CurMonthTrialLesson = tempDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0,
LastMonthTrialLesson = yesDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0, LastMonthTrialLesson = tempDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0,
SaleMoney = yesDataList?.Sum(qitem => qitem.SaleMoney) ?? 0, SaleMoney = yesDataList?.Sum(qitem => qitem.SaleMoney) ?? 0,
YestodaySale = yesDataList?.Sum(qitem => qitem.YestodaySale) ?? 0, YestodaySale = yesDataList?.Sum(qitem => qitem.YestodaySale) ?? 0,
CurWeekSale = yesDataList?.Sum(qitem => qitem.CurWeekSale) ?? 0, CurWeekSale = curWeekList?.Sum(qitem => qitem.CurWeekSale) ?? 0,
LastWeekSale = yesDataList?.Sum(qitem => qitem.LastWeekSale) ?? 0, LastWeekSale = lastWeekList?.Sum(qitem => qitem.LastWeekSale) ?? 0,
CurMonrhSale = yesDataList?.Sum(qitem => qitem.CurMonrhSale) ?? 0, CurMonrhSale = tempDataList?.Sum(qitem => qitem.CurMonrhSale) ?? 0,
LastMonthSale = yesDataList?.Sum(qitem => qitem.LastMonthSale) ?? 0, LastMonthSale = tempDataList?.Sum(qitem => qitem.LastMonthSale) ?? 0,
} }
}; };
return obj; return obj;
...@@ -667,58 +687,64 @@ namespace Edu.Module.Customer ...@@ -667,58 +687,64 @@ namespace Edu.Module.Customer
QCreateByIds = EmpIds QCreateByIds = EmpIds
}); });
var consultantGoal = GetConsultantGoalListModule(new RB_Consultant_Goal_Extend() { Group_Id = 100000, Dept_Id = 13, YearStr = end.Year, MonthStr = end.Month })?.FirstOrDefault(); 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 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 obj = new
{ {
DayStr = Common.ConvertHelper.FormatMonthDay(end.AddDays(-1)), DayStr = Common.ConvertHelper.FormatMonthDay(end.AddDays(-1)),
WeekStr=Common.Plugin.StringHelper.GetWeek(end.AddDays(-1)), WeekStr = Common.Plugin.StringHelper.GetWeek(end.AddDays(-1)),
TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0, TrialLessonCount = yesDataList?.Sum(qitem => qitem.TrialLessonCount) ?? 0,
YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0, YestodayTrialLesson = yesDataList?.Sum(qitem => qitem.YestodayTrialLesson) ?? 0,
CurWeekTrialLesson = yesDataList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0, CurWeekTrialLesson = curWeekList?.Sum(qitem => qitem.CurWeekTrialLesson) ?? 0,
LastWeekTrialLesson = yesDataList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0, LastWeekTrialLesson = lastWeekList?.Sum(qitem => qitem.LastWeekTrialLesson) ?? 0,
CurMonthTrialLesson = yesDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0, CurMonthTrialLesson = tempDataList?.Sum(qitem => qitem.CurMonthTrialLesson) ?? 0,
LastMonthTrialLesson = yesDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0, LastMonthTrialLesson = tempDataList?.Sum(qitem => qitem.LastMonthTrialLesson) ?? 0,
VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0, VisitCount = yesDataList?.Sum(qitem => qitem.VisitCount) ?? 0,
YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0, YestodayVisit = yesDataList?.Sum(qitem => qitem.YestodayVisit) ?? 0,
CurWeekVisit = yesDataList?.Sum(qitem => qitem.CurWeekVisit) ?? 0, CurWeekVisit = curWeekList?.Sum(qitem => qitem.CurWeekVisit) ?? 0,
LastWeekVisit = yesDataList?.Sum(qitem => qitem.LastWeekVisit) ?? 0, LastWeekVisit = lastWeekList?.Sum(qitem => qitem.LastWeekVisit) ?? 0,
CurMonthVisit = yesDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0, CurMonthVisit = tempDataList?.Sum(qitem => qitem.CurMonthVisit) ?? 0,
LastMonthVisit = yesDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0, LastMonthVisit = tempDataList?.Sum(qitem => qitem.LastMonthVisit) ?? 0,
Rates = yesDataList?.Sum(qitem => qitem.Rates) ?? 0, Rates = yesDataList?.Sum(qitem => qitem.Rates) ?? 0,
YestodayRates = yesDataList?.Sum(qitem => qitem.YestodayRates) ?? 0, YestodayRates = yesDataList?.Sum(qitem => qitem.YestodayRates) ?? 0,
CurWeekRates = yesDataList?.Sum(qitem => qitem.CurWeekRates) ?? 0, CurWeekRates = curWeekList?.Sum(qitem => qitem.CurWeekRates) ?? 0,
LastWeekRates = yesDataList?.Sum(qitem => qitem.LastWeekRates) ?? 0, LastWeekRates = lastWeekList?.Sum(qitem => qitem.LastWeekRates) ?? 0,
CurMonthRates = yesDataList?.Sum(qitem => qitem.CurMonthRates) ?? 0, CurMonthRates = tempDataList?.Sum(qitem => qitem.CurMonthRates) ?? 0,
LastMonthRates = yesDataList?.Sum(qitem => qitem.LastMonthRates) ?? 0, LastMonthRates = tempDataList?.Sum(qitem => qitem.LastMonthRates) ?? 0,
FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0, FollowCount = yesDataList?.Sum(qitem => qitem.FollowCount) ?? 0,
YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0, YestodayFollow = yesDataList?.Sum(qitem => qitem.YestodayFollow) ?? 0,
CurWeekFollow = yesDataList?.Sum(qitem => qitem.CurWeekFollow) ?? 0, CurWeekFollow = curWeekList?.Sum(qitem => qitem.CurWeekFollow) ?? 0,
LastWeekFollow = yesDataList?.Sum(qitem => qitem.LastWeekFollow) ?? 0, LastWeekFollow = lastWeekList?.Sum(qitem => qitem.LastWeekFollow) ?? 0,
CurMonthFollow = yesDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0, CurMonthFollow = tempDataList?.Sum(qitem => qitem.CurMonthFollow) ?? 0,
LastMonthFollow = yesDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0, LastMonthFollow = tempDataList?.Sum(qitem => qitem.LastMonthFollow) ?? 0,
AgFollow = yesDataList?.Average(qitem => qitem.AgFollow) ?? 0, AgFollow = Math.Round(yesDataList?.Average(qitem => qitem.AgFollow) ?? 0, 2),
YestodayAgFollow = yesDataList?.Average(qitem => qitem.YestodayAgFollow) ?? 0, YestodayAgFollow = Math.Round(yesDataList?.Average(qitem => qitem.YestodayAgFollow) ?? 0, 2),
CurWeekAgFollow = yesDataList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, CurWeekAgFollow = Math.Round(curWeekList?.Average(qitem => qitem.CurWeekAgFollow) ?? 0, 2),
LastWeekAgFollow = yesDataList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, LastWeekAgFollow = Math.Round(lastWeekList?.Average(qitem => qitem.LastWeekAgFollow) ?? 0, 2),
CurMonthAgFollow = yesDataList?.Average(qitem => qitem.CurMonthAgFollow) ?? 0, CurMonthAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.CurMonthAgFollow) ?? 0, 2),
LastMonthAgFollow = yesDataList?.Average(qitem => qitem.LastMonthAgFollow) ?? 0, LastMonthAgFollow = Math.Round(tempDataList?.Average(qitem => qitem.LastMonthAgFollow) ?? 0, 2),
CurWeekOrderNum = yesDataList?.Sum(qitem => qitem.CurWeekOrderNum) ?? 0, CurWeekOrderNum = curWeekList?.Sum(qitem => qitem.CurWeekOrderNum) ?? 0,
LastWeekOrderNum = yesDataList?.Sum(qitem => qitem.LastWeekOrderNum) ?? 0, LastWeekOrderNum = lastWeekList?.Sum(qitem => qitem.LastWeekOrderNum) ?? 0,
CurWeekOrderSale = yesDataList?.Sum(qitem => qitem.CurWeekOrderSale) ?? 0, CurWeekOrderSale = tempDataList?.Sum(qitem => qitem.CurWeekOrderSale) ?? 0,
LastWeekOrderSale = yesDataList?.Sum(qitem => qitem.LastWeekOrderSale) ?? 0, LastWeekOrderSale = tempDataList?.Sum(qitem => qitem.LastWeekOrderSale) ?? 0,
CurMonthOrderSale = yesDataList?.Sum(qitem => qitem.CurMonthOrderSale) ?? 0, CurMonthOrderSale = tempDataList?.Sum(qitem => qitem.CurMonthOrderSale) ?? 0,
LastMonthOrderSale= yesDataList?.Sum(qitem => qitem.LastMonthOrderSale) ?? 0, LastMonthOrderSale = tempDataList?.Sum(qitem => qitem.LastMonthOrderSale) ?? 0,
CurMonthOrderGoal = consultantGoal?.GoalMoney??0, CurMonthOrderGoal = consultantGoal?.GoalMoney ?? 0,
CurMonthOrderNum = yesDataList?.Sum(qitem => qitem.CurMonthOrderNum) ?? 0, CurMonthOrderNum = tempDataList?.Sum(qitem => qitem.CurMonthOrderNum) ?? 0,
LastMonthOrderNum = yesDataList?.Sum(qitem => qitem.LastMonthOrderNum) ?? 0, LastMonthOrderNum = tempDataList?.Sum(qitem => qitem.LastMonthOrderNum) ?? 0,
}; };
return obj; return obj;
...@@ -743,7 +769,7 @@ namespace Edu.Module.Customer ...@@ -743,7 +769,7 @@ namespace Edu.Module.Customer
string deptIds = string.Join(",", list.Select(qitem => qitem.Dept_Id)); string deptIds = string.Join(",", list.Select(qitem => qitem.Dept_Id));
if (!string.IsNullOrEmpty(deptIds)) if (!string.IsNullOrEmpty(deptIds))
{ {
deptList= departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel()
{ {
QDeptIds = deptIds QDeptIds = deptIds
}); });
...@@ -827,7 +853,7 @@ namespace Edu.Module.Customer ...@@ -827,7 +853,7 @@ namespace Edu.Module.Customer
item.Id = newId; item.Id = newId;
flag = newId > 0; flag = newId > 0;
} }
} }
} }
} }
return flag; return flag;
...@@ -860,5 +886,406 @@ namespace Edu.Module.Customer ...@@ -860,5 +886,406 @@ namespace Edu.Module.Customer
return flag; return flag;
} }
#endregion #endregion
#region 市场渠道统计
/// <summary>
/// 市场部渠道数据统计
/// </summary>
/// <param name="StartTime">开始时间</param>
/// <param name="EndTime">结束时间</param>
/// <param name="qEmpIds">员工编号</param>
/// <returns></returns>
public List<object> MarketChannelStudentStaticModule(string StartTime, string EndTime, string qEmpIds,bool isHaveAuth=false)
{
List<object> list = new List<object>();
var empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
{
//市场部编号4,课程顾问部编号13
QDeptIds = "4",
Group_Id = 100000,
IsLeave = 1,
QIds= qEmpIds
});
if (empList != null && empList.Count > 0)
{
var channelList = channelRepository.GetChannelListRepository(new RB_Channel_Extend() { });
var dataList = studentRepository.GetStudentChannelStaticRepository(new RB_Student_ViewModel()
{
StartTime = StartTime,
EndTime = EndTime
});
foreach (var eItem in empList)
{
List<object> subList = new List<object>();
var tempList = dataList?.Where(qitem => qitem.CreateBy == eItem.Id)?.ToList();
//包含的数据
string singleIds = "";
string authId = "1";
if (isHaveAuth)
{
authId = "2";
}
if (channelList != null && channelList.Count > 0)
{
foreach (var item in channelList)
{
if (item.StaticTypeList != null && item.StaticTypeList.Contains(authId))
{
singleIds += "," + item.Id;
var channelTempList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.EmployeeInput && qitem.StuChannel == item.Id)?.ToList();
subList.Add(new
{
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)
});
}
}
}
var customerList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)?.ToList();
subList.Add(new
{
ChannelName = "同行介绍",
ChannelId = 10001,
ClueCount = customerList?.Count(),
VisitCount = customerList?.Sum(qitem => qitem.VisitCount),
OrderCount = customerList?.Sum(qitem => qitem.OrderCount),
OrderIncome = customerList?.Sum(qitem => qitem.OrderIncome)
});
var innerList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)?.ToList();
subList.Add(new
{
ChannelName = "内部介绍",
ChannelId = 10002,
ClueCount = innerList?.Count(),
VisitCount = innerList?.Sum(qitem => qitem.VisitCount),
OrderCount = innerList?.Sum(qitem => qitem.OrderCount),
OrderIncome = innerList?.Sum(qitem => qitem.OrderIncome)
});
var transList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction)?.ToList();
subList.Add(new
{
ChannelName = "学员转介绍",
ChannelId = 10003,
ClueCount = transList?.Count(),
VisitCount = transList?.Sum(qitem => qitem.VisitCount),
OrderCount = transList?.Sum(qitem => qitem.OrderCount),
OrderIncome = transList?.Sum(qitem => qitem.OrderIncome)
});
var otherList = tempList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.EmployeeInput && !singleIds.Contains(qitem.StuChannel.ToString()))?.ToList();
subList.Add(new
{
ChannelName = "其他",
ChannelId = 10004,
ClueCount = otherList?.Count(),
VisitCount = otherList?.Sum(qitem => qitem.VisitCount),
OrderCount = otherList?.Sum(qitem => qitem.OrderCount),
OrderIncome = otherList?.Sum(qitem => qitem.OrderIncome)
});
subList.Add(new
{
ChannelName = "合计",
ChannelId = 10005,
ClueCount = tempList?.Count(),
VisitCount = tempList?.Sum(qitem => qitem.VisitCount),
OrderCount = tempList?.Sum(qitem => qitem.OrderCount),
OrderIncome = tempList?.Sum(qitem => qitem.OrderIncome)
});
list.Add(new
{
eItem.Id,
eItem.EmployeeName,
subList
});
}
}
return list;
}
/// <summary>
/// 市场部学员创建类型统计
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <returns></returns>
public object MarketCreateTypeStaticModule(string StartTime, string EndTime)
{
var dataList = studentRepository.GetStudentChannelStaticRepository(new RB_Student_ViewModel()
{
StartTime = StartTime,
EndTime = EndTime
});
var enumList = Common.Plugin.EnumHelper.EnumToList(typeof(StuCreateTypeEnum));
//企业同行
List<MarketChannelStaticModel> customerDataList = new List<MarketChannelStaticModel>();
//校代同行
List<MarketChannelStaticModel> schoolDataList = new List<MarketChannelStaticModel>();
List<MarketChannelStaticModel> innerDataList = new List<MarketChannelStaticModel>();
List<MarketChannelStaticModel> transDataList = new List<MarketChannelStaticModel>();
foreach (var item in enumList)
{
if (item.Id == (int)StuCreateTypeEnum.EmployeeInput)
{
}
else if (item.Id == (int)StuCreateTypeEnum.CustomerInput)
{
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))
{
customerList = customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { CustomerIds = cusIds });
}
var sourceTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)
?.GroupBy(qitem => new { qitem.CustomerSourceType })
?.Select(qitem => new { qitem.Key.CustomerSourceType });
foreach (var sItem in sourceTypeList)
{
var sourceIdList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CustomerSourceType == sItem.CustomerSourceType)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var subItem in sourceIdList)
{
var tempCusList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.StuSourceId == subItem.StuSourceId)?.ToList();
//企业同行
if (sItem.CustomerSourceType == 1)
{
customerDataList.Add(new MarketChannelStaticModel()
{
ChannelName = customerList?.FirstOrDefault(qitem => qitem.CustomerId == subItem.StuSourceId)?.CustomerName ?? "",
ChannelId= subItem.StuSourceId,
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.CustomerSourceType == 2)
{
schoolDataList.Add(new MarketChannelStaticModel()
{
ChannelName = customerList?.FirstOrDefault(qitem => qitem.CustomerId == subItem.StuSourceId)?.CustomerName ?? "",
ChannelId= subItem.StuSourceId,
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 (item.Id == (int)StuCreateTypeEnum.InternalIntroduction)
{
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))
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = empIds });
}
var groupDataList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var sItem in groupDataList)
{
var tempInnerList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction && qitem.StuSourceId == sItem.StuSourceId)?.ToList();
innerDataList.Add(new MarketChannelStaticModel()
{
ChannelName = empList?.FirstOrDefault(qitem => qitem.Id == sItem.StuSourceId)?.EmployeeName ?? "",
ChannelId= sItem.StuSourceId,
ClueCount = tempInnerList?.Count()??0,
VisitCount = tempInnerList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = tempInnerList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = tempInnerList?.Sum(qitem => qitem.OrderIncome)??0
});
}
}
else
{
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 sourceTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var sItem in sourceTypeList)
{
var tempTransList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction && qitem.StuSourceId == sItem.StuSourceId)?.ToList();
transDataList.Add(new MarketChannelStaticModel()
{
ChannelName = stuList?.FirstOrDefault(qitem => qitem.StuId == sItem.StuSourceId)?.StuName ?? "",
ChannelId= sItem.StuSourceId,
ClueCount = tempTransList?.Count()??0,
VisitCount = tempTransList?.Sum(qitem => qitem.VisitCount)??0,
OrderCount = tempTransList?.Sum(qitem => qitem.OrderCount)??0,
OrderIncome = tempTransList?.Sum(qitem => qitem.OrderIncome)??0
});
}
}
}
return new
{
customerDataList,
schoolDataList,
innerDataList,
transDataList,
};
}
/// <summary>
/// 渠道统计汇总
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <returns></returns>
public object MarketChannelStaticModule(string StartTime, string EndTime)
{
List<object> list = new List<object>();
var channelList = channelRepository.GetChannelListRepository(new RB_Channel_Extend() { });
var dataList = studentRepository.GetStudentChannelStaticRepository(new RB_Student_ViewModel()
{
StartTime = StartTime,
EndTime = EndTime
});
if (channelList != null && channelList.Count > 0)
{
foreach (var item in channelList)
{
var channelTempList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.EmployeeInput && qitem.StuChannel == item.Id)?.ToList();
list.Add(new
{
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)
});
}
}
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))
{
customerList = customerRepository.GetCustomerListRepository(new RB_Customer_Extend() { CustomerIds = cusIds });
}
var sourceTypeList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput)
?.GroupBy(qitem => new { qitem.CustomerSourceType })
?.Select(qitem => new { qitem.Key.CustomerSourceType });
foreach (var sItem in sourceTypeList)
{
var sourceIdList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.CustomerInput && qitem.CustomerSourceType == sItem.CustomerSourceType)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var subItem in sourceIdList)
{
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 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))
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel() { QIds = empIds });
}
var groupDataList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var sItem in groupDataList)
{
var tempInnerList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.InternalIntroduction && 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.TransIntroduction)
?.GroupBy(qitem => new { qitem.StuSourceId })
?.Select(qitem => new { qitem.Key.StuSourceId });
foreach (var sItem in transTypeList)
{
var tempTransList = dataList?.Where(qitem => qitem.CreateType == StuCreateTypeEnum.TransIntroduction && 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
{
ChannelName = "合计",
ChannelId = 10005,
ClueCount = dataList?.Count(),
VisitCount = dataList?.Sum(qitem => qitem.VisitCount),
OrderCount = dataList?.Sum(qitem => qitem.OrderCount),
OrderIncome = dataList?.Sum(qitem => qitem.OrderIncome)
});
return list;
}
#endregion
} }
} }
\ No newline at end of file
...@@ -73,6 +73,10 @@ namespace Edu.Module.User ...@@ -73,6 +73,10 @@ namespace Edu.Module.User
/// <returns></returns> /// <returns></returns>
public RB_Group_ViewModel GetGroupEntityModule(string workDomainUrl) public RB_Group_ViewModel GetGroupEntityModule(string workDomainUrl)
{ {
if (workDomainUrl.ToLower() == "edu.oytour.com")
{
workDomainUrl = "m.kookaku.com";
}
return GetGroupListModule(new RB_Group_ViewModel() { WorkAppDomain=workDomainUrl })?.FirstOrDefault() ?? new RB_Group_ViewModel(); return GetGroupListModule(new RB_Group_ViewModel() { WorkAppDomain=workDomainUrl })?.FirstOrDefault() ?? new RB_Group_ViewModel();
} }
......
...@@ -934,5 +934,41 @@ WHERE 1=1 ...@@ -934,5 +934,41 @@ WHERE 1=1
return dicList; return dicList;
} }
/// <summary>
/// 市场部渠道数据统计
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Student_ViewModel> GetStudentChannelStaticRepository(RB_Student_ViewModel query)
{
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.CustomerSourceType,0) AS CustomerSourceType
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
WHERE A.Status=0
");
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Student_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.StartTime))
{
builder.AppendFormat(" AND A.{0}>='{1}' ", nameof(RB_Student_ViewModel.CreateTime), query.StartTime);
}
if (!string.IsNullOrEmpty(query.EndTime))
{
builder.AppendFormat(" AND A.{0}<='{1} 23:59:59' ", nameof(RB_Student_ViewModel.CreateTime), query.EndTime);
}
}
var list = Get<RB_Student_ViewModel>(builder.ToString()).ToList();
return list;
}
} }
} }
\ No newline at end of file
...@@ -369,7 +369,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -369,7 +369,7 @@ namespace Edu.WebApi.Controllers.User
{ {
var path = $"/administration/documentApproval"; var path = $"/administration/documentApproval";
path = HttpUtility.UrlEncode(path); path = HttpUtility.UrlEncode(path);
string markdownContent = $"##### 你有新的待审批公告 \n>**概要信息** \n>公告标题:{demodel.Title}</font>\n>发 布 人:{userInfo.AccountName}\n>提审时间:<font color='comment'>{DateTime.Now.ToString("MM-dd HH:mm")}</font>\n>\n>接收对象:<font color='info'>{(demodel.To == "-1" ? "全公司" : "指定部门")}</font>\n>请 点 击:[立即审批]({Config.ErpUrl}/autologin?loginId={modelShenhe.Content}&target={path}#target=out)"; string markdownContent = $"##### 你有新的待审批公告 \n>**概要信息** \n>公告标题:{demodel.Title}</font>\n>发 布 人:{userInfo.AccountName}\n>提审时间:<font color='comment'>{Common.ConvertHelper.FormatTimeStr2(DateTime.Now)}</font>\n>\n>接收对象:<font color='info'>{(demodel.To == "-1" ? "全公司" : "指定部门")}</font>\n>请 点 击:[立即审批]({Config.ErpUrl}/autologin?loginId={modelShenhe.Content}&target={path}#target=out)";
Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel() Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
{ {
CategoryId = PushMessageCategoryEnum.NoticeAuditTips, CategoryId = PushMessageCategoryEnum.NoticeAuditTips,
...@@ -503,7 +503,8 @@ namespace Edu.WebApi.Controllers.User ...@@ -503,7 +503,8 @@ namespace Edu.WebApi.Controllers.User
path = $"/administration/document"; path = $"/administration/document";
} }
path = HttpUtility.UrlEncode(path); path = HttpUtility.UrlEncode(path);
string markdownContent = $"<font color='{(ReviewStatus == 2 ? "warning" : "info")}'>`审批{(ReviewStatus == 1 ? "通过" : "驳回")}`</font> 公告审批结果\n\n>**概要信息** \n>公告标题:{noticeModel.Title}\n>审 核 人:{userInfo.AccountName}\n>审核时间:<font color='comment'>{DateTime.Now.ToString("MM-dd HH:mm")}</font>\n>\n>请 点 击:[查看详情]({Config.ErpUrl}/autologin?loginId={noticeModel.CreateBy}&target={path}#target=out)";
string markdownContent = $"<font color='{(ReviewStatus == 2 ? "warning" : "info")}'>`审批{(ReviewStatus == 1 ? "通过" : "驳回")}`</font> 公告审批结果\n\n>**概要信息** \n>公告标题:{noticeModel.Title}\n>审 核 人:{userInfo.AccountName}\n>审核时间:<font color='comment'>{Common.ConvertHelper.FormatTimeStr2(DateTime.Now)}</font>\n>\n>请 点 击:[查看详情]({Config.ErpUrl}/autologin?loginId={noticeModel.CreateBy}&target={path}#target=out)";
Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel() Common.Message.PushMessageModel modelWork = new Common.Message.PushMessageModel()
{ {
CategoryId = PushMessageCategoryEnum.NoticeAuditResult, CategoryId = PushMessageCategoryEnum.NoticeAuditResult,
...@@ -2757,5 +2758,108 @@ namespace Edu.WebApi.Controllers.User ...@@ -2757,5 +2758,108 @@ namespace Edu.WebApi.Controllers.User
} }
#endregion #endregion
#region 市场渠道统计
/// <summary>
/// 市场渠道月薪统计
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowRepeatAttribute]
public ApiResult MarketChannelStudentStatic()
{
string startTime = base.ParmJObj.GetStringValue("startTime");
if (string.IsNullOrEmpty(startTime))
{
startTime = "2022-01-01";
}
string endTime = base.ParmJObj.GetStringValue("endTime");
if (string.IsNullOrEmpty(endTime))
{
endTime = Common.ConvertHelper.FormatDate(DateTime.Now);
}
string empIds = base.ParmJObj.GetStringValue("empList");
List<int> empList = new List<int>();
if (!string.IsNullOrEmpty(empIds))
{
empList = JsonHelper.DeserializeObject<List<int>>(empIds);
}
string qEmpIds = "";
if (empList != null && empList.Count > 0)
{
qEmpIds = string.Join(",", empList);
}
var data = marketConsultantModule.MarketChannelStudentStaticModule(startTime, endTime, qEmpIds, isHaveAuth: base.CheckUserActionAuth("Query_MarketConsultant"));
return ApiResult.Success(data: data);
}
/// <summary>
/// 市场渠道统计
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowRepeatAttribute]
public ApiResult MarketCreateType()
{
string startTime = base.ParmJObj.GetStringValue("startTime");
if (string.IsNullOrEmpty(startTime))
{
startTime = "2022-01-01";
}
string endTime = base.ParmJObj.GetStringValue("endTime");
if (string.IsNullOrEmpty(endTime))
{
endTime = Common.ConvertHelper.FormatDate(DateTime.Now);
}
string empIds = base.ParmJObj.GetStringValue("empList");
List<int> empList = new List<int>();
if (!string.IsNullOrEmpty(empIds))
{
empList = JsonHelper.DeserializeObject<List<int>>(empIds);
}
string qEmpIds = "";
if (empList != null && empList.Count > 0)
{
qEmpIds = string.Join(",", empList);
}
var data = marketConsultantModule.MarketCreateTypeStaticModule(startTime, endTime);
return ApiResult.Success(data: data);
}
/// <summary>
/// 市场渠道统计汇总
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowRepeatAttribute]
public ApiResult MarketChannelStatic()
{
string startTime = base.ParmJObj.GetStringValue("startTime");
if (string.IsNullOrEmpty(startTime))
{
startTime = "2022-01-01";
}
string endTime = base.ParmJObj.GetStringValue("endTime");
if (string.IsNullOrEmpty(endTime))
{
endTime = Common.ConvertHelper.FormatDate(DateTime.Now);
}
string empIds = base.ParmJObj.GetStringValue("empList");
List<int> empList = new List<int>();
if (!string.IsNullOrEmpty(empIds))
{
empList = JsonHelper.DeserializeObject<List<int>>(empIds);
}
string qEmpIds = "";
if (empList != null && empList.Count > 0)
{
qEmpIds = string.Join(",", empList);
}
var data = marketConsultantModule.MarketChannelStaticModule(startTime, endTime);
return ApiResult.Success(data: data);
}
#endregion
} }
} }
\ No newline at end of file
using Edu.Common.Plugin; using Edu.CacheManager.Base;
using Edu.Common.Plugin;
using Edu.Module.Course; using Edu.Module.Course;
using Edu.Module.Customer; using Edu.Module.Customer;
using Edu.Module.Duty; using Edu.Module.Duty;
...@@ -40,6 +41,13 @@ namespace Edu.WebApi.Timers ...@@ -40,6 +41,13 @@ namespace Edu.WebApi.Timers
/// </summary> /// </summary>
private static readonly PaperModule paperModule = new PaperModule(); private static readonly PaperModule paperModule = new PaperModule();
/// <summary>
/// 使用redis第几号库
/// </summary>
static readonly int REDIS_DB3 = 3;
static readonly RedisHelper redis = new RedisHelper(REDIS_DB3);
/// <summary> /// <summary>
/// 课程顾问部和市场部数据统计 /// 课程顾问部和市场部数据统计
/// </summary> /// </summary>
...@@ -87,7 +95,7 @@ namespace Edu.WebApi.Timers ...@@ -87,7 +95,7 @@ namespace Edu.WebApi.Timers
timer4 = new System.Timers.Timer() timer4 = new System.Timers.Timer()
{ {
Interval = (1000 * 60) * (1 * 10 ) //10分中执行一次 Interval = (1000 * 60) * (1 * 10) //10分中执行一次
}; };
timer4.Elapsed += new System.Timers.ElapsedEventHandler(UpdateAuditThroughStudent); timer4.Elapsed += new System.Timers.ElapsedEventHandler(UpdateAuditThroughStudent);
timer4.Enabled = true; timer4.Enabled = true;
...@@ -113,9 +121,9 @@ namespace Edu.WebApi.Timers ...@@ -113,9 +121,9 @@ namespace Edu.WebApi.Timers
finishGuest.Elapsed += new System.Timers.ElapsedEventHandler(DealGuestFinish); finishGuest.Elapsed += new System.Timers.ElapsedEventHandler(DealGuestFinish);
finishGuest.Enabled = true; finishGuest.Enabled = true;
marketTimer= new System.Timers.Timer() marketTimer = new System.Timers.Timer()
{ {
Interval = (1000) * (1) //1秒检测一次 00:30:00 每天执行一次 Interval = (1000 * 60) * (1) //1小时检查一次
}; };
marketTimer.Elapsed += new System.Timers.ElapsedEventHandler(DealMarketConsultantData); marketTimer.Elapsed += new System.Timers.ElapsedEventHandler(DealMarketConsultantData);
marketTimer.Enabled = true; marketTimer.Enabled = true;
...@@ -146,6 +154,7 @@ namespace Edu.WebApi.Timers ...@@ -146,6 +154,7 @@ namespace Edu.WebApi.Timers
private static int marketconsultant_Timer = 0; private static int marketconsultant_Timer = 0;
private static string createMarkDataKey = "createMarkDataKey";
/// <summary> /// <summary>
/// 定时生成市场部和课程顾问部数据统计 /// 定时生成市场部和课程顾问部数据统计
/// </summary> /// </summary>
...@@ -153,20 +162,20 @@ namespace Edu.WebApi.Timers ...@@ -153,20 +162,20 @@ namespace Edu.WebApi.Timers
/// <param name="e"></param> /// <param name="e"></param>
public static void DealMarketConsultantData(object sender, System.Timers.ElapsedEventArgs e) public static void DealMarketConsultantData(object sender, System.Timers.ElapsedEventArgs e)
{ {
if (Interlocked.Exchange(ref marketconsultant_Timer, 1) == 0) if (Interlocked.Exchange(ref marketconsultant_Timer,1) == 0)
{ {
int intHour = e.SignalTime.Hour; var currentDate = DateTime.Now;
int intMinute = e.SignalTime.Minute; string cacheData = redis.Get(createMarkDataKey);
int intSecond = e.SignalTime.Second; if (string.IsNullOrEmpty(cacheData))
// 定制时间;比如 在00:30:00 的时候执行某个函数 {
int iHour = 00; redis.Set(createMarkDataKey, Common.ConvertHelper.FormatDate(currentDate));
int iMinute = 30; cacheData = Common.ConvertHelper.FormatDate(currentDate);
int iSecond = 00; }
// 设置每天的 if (!string.IsNullOrEmpty(cacheData) && cacheData != Common.ConvertHelper.FormatDate(currentDate))
if (intHour == iHour && intMinute == iMinute && intSecond == iSecond)
{ {
marketConsultantModule.CreateConsultantDataModule(DateTime.Now); redis.Set(createMarkDataKey, Common.ConvertHelper.FormatDate(currentDate));
marketConsultantModule.CreateMarketDataModule(DateTime.Now); marketConsultantModule.CreateConsultantDataModule(currentDate);
marketConsultantModule.CreateMarketDataModule(currentDate);
} }
Interlocked.Exchange(ref marketconsultant_Timer, 0); Interlocked.Exchange(ref marketconsultant_Timer, 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