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;
namespace Edu.Cache.App
{
public class MsgUserRedisCache
{ /// <summary>
{
/// <summary>
/// 使用redis第几号库
/// </summary>
public static readonly int REDIS_DB3 = 3;
......
......@@ -43,6 +43,7 @@ namespace Edu.Common
/// <summary>
/// 获取时间格式
/// [HH:mm]
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
......@@ -531,5 +532,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
......@@ -316,7 +316,6 @@ namespace Edu.Education.Helper
/// <returns></returns>
public async Task EduCreateScrollClassTimer()
{
string cronExpression = "0 10 0 1 * ?"; //每月1号凌晨10分
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
......
......@@ -58,7 +58,7 @@ namespace Edu.Model.Entity.Customer
public string Image { get; set; }
/// <summary>
/// 客户来源
/// 同行客户来源(1-企业,2-学校)
/// </summary>
public int CustomerSourceType { get; set; }
......
......@@ -78,7 +78,7 @@ namespace Edu.Model.Entity.Grade
public int PlanType { get; set; }
/// <summary>
/// 课程ID
/// 课程id
/// </summary>
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
/// </summary>
public string CourseName { get; set; }
/// <summary>
/// 课程id
/// </summary>
public int CourseId { get; set; }
/// <summary>
/// 班级类型
/// </summary>
......
......@@ -144,6 +144,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public int OrderCount { get; set; }
/// <summary>
/// 订单实收金额
/// </summary>
public decimal OrderIncome { get; set; }
/// <summary>
/// 续费订单数量
/// </summary>
......@@ -208,6 +213,9 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public string QDate { get; set; }
/// <summary>
/// 到访次数
/// </summary>
public int VisitCount { get; set; }
/// <summary>
......@@ -220,6 +228,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 同行客户来源(1-企业,2-学校)
/// </summary>
public int CustomerSourceType { get; set; }
/// <summary>
/// 来源人名称
/// </summary>
......
......@@ -7,7 +7,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<NoWarn>1701;1702;NETSDK1138</NoWarn>
<NoWarn>1701;1702;NETSDK1138;CS8602</NoWarn>
</PropertyGroup>
<ItemGroup>
......
......@@ -73,6 +73,10 @@ namespace Edu.Module.User
/// <returns></returns>
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();
}
......
......@@ -934,5 +934,41 @@ WHERE 1=1
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
{
var path = $"/administration/documentApproval";
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()
{
CategoryId = PushMessageCategoryEnum.NoticeAuditTips,
......@@ -503,7 +503,8 @@ namespace Edu.WebApi.Controllers.User
path = $"/administration/document";
}
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()
{
CategoryId = PushMessageCategoryEnum.NoticeAuditResult,
......@@ -2757,5 +2758,108 @@ namespace Edu.WebApi.Controllers.User
}
#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.Customer;
using Edu.Module.Duty;
......@@ -40,6 +41,13 @@ namespace Edu.WebApi.Timers
/// </summary>
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>
......@@ -87,7 +95,7 @@ namespace Edu.WebApi.Timers
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.Enabled = true;
......@@ -113,9 +121,9 @@ namespace Edu.WebApi.Timers
finishGuest.Elapsed += new System.Timers.ElapsedEventHandler(DealGuestFinish);
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.Enabled = true;
......@@ -146,6 +154,7 @@ namespace Edu.WebApi.Timers
private static int marketconsultant_Timer = 0;
private static string createMarkDataKey = "createMarkDataKey";
/// <summary>
/// 定时生成市场部和课程顾问部数据统计
/// </summary>
......@@ -153,20 +162,20 @@ namespace Edu.WebApi.Timers
/// <param name="e"></param>
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;
int intMinute = e.SignalTime.Minute;
int intSecond = e.SignalTime.Second;
// 定制时间;比如 在00:30:00 的时候执行某个函数
int iHour = 00;
int iMinute = 30;
int iSecond = 00;
// 设置每天的
if (intHour == iHour && intMinute == iMinute && intSecond == iSecond)
var currentDate = DateTime.Now;
string cacheData = redis.Get(createMarkDataKey);
if (string.IsNullOrEmpty(cacheData))
{
redis.Set(createMarkDataKey, Common.ConvertHelper.FormatDate(currentDate));
cacheData = Common.ConvertHelper.FormatDate(currentDate);
}
if (!string.IsNullOrEmpty(cacheData) && cacheData != Common.ConvertHelper.FormatDate(currentDate))
{
marketConsultantModule.CreateConsultantDataModule(DateTime.Now);
marketConsultantModule.CreateMarketDataModule(DateTime.Now);
redis.Set(createMarkDataKey, Common.ConvertHelper.FormatDate(currentDate));
marketConsultantModule.CreateConsultantDataModule(currentDate);
marketConsultantModule.CreateMarketDataModule(currentDate);
}
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