Commit 8e776e5b authored by 罗超's avatar 罗超

新增定时任务

parent d40dd5a5
......@@ -28,6 +28,7 @@ namespace Edu.Education
new QuarzHelper().OKRPeriodTimer().GetAwaiter().GetResult();
new QuarzHelper().OKRPeriodRuleTimer().GetAwaiter().GetResult();
new QuarzHelper().RevenueReportTimer().GetAwaiter().GetResult();
new QuarzHelper().CheckPerparingTimer().GetAwaiter().GetResult();
}
/// <summary>
......
......@@ -11,6 +11,9 @@ using Edu.Module.OKR;
using System.Linq;
using System.Collections.Generic;
using Edu.Module.Finance;
using System.Web;
using Edu.Common.Plugin;
using Edu.Common;
namespace Edu.Education.Helper
{
......@@ -59,7 +62,7 @@ namespace Edu.Education.Helper
/// <returns></returns>
public async Task OKRPeriodTimer()
{
string cronExpression = "0 0 1 * * ?"; //每天凌晨1点
string cronExpression = "0 0 1 * * ?"; //每天凌晨1点
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
......@@ -146,8 +149,36 @@ namespace Edu.Education.Helper
await scheduler.ScheduleJob(job, trigger);
}
/// <summary>
/// 定时执行备课检查
/// </summary>
/// <returns></returns>
public async Task CheckPerparingTimer()
{
string CronExpression = "0 08 13,18 * * ?";
NameValueCollection props = new NameValueCollection
{
{ "quartz.serializer.type", "binary" }
};
StdSchedulerFactory factory = new StdSchedulerFactory(props);
IScheduler scheduler = await factory.GetScheduler();
await scheduler.Start();
IJobDetail job = JobBuilder.Create<NotifyTeachPerparing>()
.WithIdentity("job4", "group4")
.Build();
ICronTrigger trigger = (ICronTrigger)TriggerBuilder.Create()
.WithIdentity("trigger5", "group5")
.WithCronSchedule(CronExpression)
.Build();
await scheduler.ScheduleJob(job, trigger);
}
}
/// <summary>
/// 教师绩效生成
/// </summary>
......@@ -319,6 +350,42 @@ namespace Edu.Education.Helper
}
}
/// <summary>
/// 备课检查通知
/// </summary>
public class NotifyTeachPerparing : IJob
{
public Task Execute(IJobExecutionContext context)
{
try
{
Console.WriteLine("开始执行未备课查询....");
ClassModule classModule = new ClassModule();
var query = classModule.GetNotPerparingTeachModule();
if (query != null && query.Count > 0)
{
Console.WriteLine($"未备课查询结果为:{query.Count}....");
query.ForEach(x =>
{
var recipientPath = HttpUtility.UrlEncode($"/teacher/myPrepareLessons?d={HttpUtility.UrlEncode(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"))}");
var content = $"<font color='info'>备课通知</font> 明日还有班级没有完成备课\n>**概要信息** \n>上课日期:<font color='warning'>{DateTime.Now.AddDays(1).ToString("yyyy年MM月dd日")}</font>\n>未备课班级:<font color='comment'>{x.ClassCount}个</font>\n>请点击:[立即备课]({Config.ErpUrl}/autologin?loginId={x.AccountId}&target={recipientPath})";
Console.WriteLine($"开始推送内容为:{content}....");
PushWorkChatHelper.PushToWorkChat(content, x.WorkUserId, "业务单据驳回通知");
});
}
else
{
Console.WriteLine("所有老师完成明日备课....");
}
}
catch (Exception ex)
{
LogHelper.Write(ex, "CreateRevenueReport");
}
return null;
}
}
public class UpdageHistoryOrderCommissionHelper
......
......@@ -9,17 +9,17 @@ namespace Edu.EducationCore
{
static void Main(string[] args)
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new EducationTimerServer(),
};
ServiceBase.Run(ServicesToRun);
//ServiceBase[] ServicesToRun;
//ServicesToRun = new ServiceBase[]
//{
// new EducationTimerServer(),
//};
//ServiceBase.Run(ServicesToRun);
//Console.WriteLine("来了");
//new QuarzHelper().RevenueReportTimer().GetAwaiter().GetResult();
//Console.WriteLine("结束了");
//Console.ReadKey();
Console.WriteLine("来了");
new QuarzHelper().CheckPerparingTimer().GetAwaiter().GetResult();
Console.WriteLine("结束了");
Console.ReadKey();
}
}
}
{
"ConnectionStrings": {
//"DefaultConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=uat_reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
"DataStatisticsConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_datastatistics;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DataStatisticsConnectionPName": "MySql.Data.MySqlClient",
"LogConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_sys;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"LogConnectionPName": "MySql.Data.MySqlClient",
"MallConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=test_reborn_mall;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"MallConnectionPName": "MySql.Data.MySqlClient"
//"DefaultConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
//"DefaultConnectionPName": "MySql.Data.MySqlClient",
//"FinanceConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
//"FinanceConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
//"FinanceConnectionPName": "MySql.Data.MySqlClient",
//"DataStatisticsConnection": "server=192.168.20.214;user id=reborn;password=Reborn@2018;database=reborn_datastatistics;CharSet=utf8mb4; Convert Zero Datetime=true; ",
//"DataStatisticsConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_datastatistics;CharSet=utf8mb4; Convert Zero Datetime=true; ",
//"DataStatisticsConnectionPName": "MySql.Data.MySqlClient"
"DefaultConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_edu;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DefaultConnectionPName": "MySql.Data.MySqlClient",
"FinanceConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_finance;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"FinanceConnectionPName": "MySql.Data.MySqlClient",
"DataStatisticsConnection": "server=rm-bp1tj77h6kp0d02fb.mysql.rds.aliyuncs.com;user id=reborn;password=Reborn@2018;database=uat_reborn_datastatistics;CharSet=utf8mb4; Convert Zero Datetime=true; ",
"DataStatisticsConnectionPName": "MySql.Data.MySqlClient"
},
"Logging": {
"LogLevel": {
......@@ -25,6 +29,7 @@
"IsSendMsg": 2,
"AllowedHosts": "*",
"OpenValidation": "False",
"ErpUrl": "http://localhost:8181/#",
"UploadSiteUrl": "http://192.168.20.214:8120",
"ViewFileSiteUrl": "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com",
"ErpViewFileSiteUrl": "http://imgfile.oytour.com",
......@@ -40,7 +45,8 @@
"VirtualHost": "/",
"Port": 5672,
"UserName": "guest",
"Password": "viitto2019"
"Password": "viitto2019",
"QueenName": "vt_sys_message_test"
},
"RedisSetting": {
"RedisServer": "47.96.23.199",
......
......@@ -164,6 +164,16 @@ namespace Edu.Model.ViewModel.Grade
/// </summary>
public int OrderBy { get; set; }
/// <summary>
/// 班级数量
/// </summary>
public int ClassCount { get; set; }
/// <summary>
/// 账号编号
/// </summary>
public int AccountId { get; set; }
public string WorkUserId { get; set; }
}
}
......@@ -4167,7 +4167,14 @@ namespace Edu.Module.Course
return true;
}
/// <summary>
/// 返回明日未备课的老师列表
/// </summary>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetNotPerparingTeachModule()
{
return class_PlanRepository.GetNotPerparingTeachRepository();
}
#region 教师-我的班级
......
......@@ -1143,5 +1143,21 @@ WHERE 1=1
return dayClassHours;
}
/// <summary>
/// 查询明日还有未备课的老师信息
/// </summary>
/// <returns></returns>
public List<RB_Class_Plan_ViewModel> GetNotPerparingTeachRepository()
{
var sql = @"select b.Id as AccountId,b.WorkUserId,c.TeacherName,Count(0) as ClassCount from rb_class_plan a
left join rb_account b on a.TeacherId=b.AccountId and b.AccountType=2
left join rb_teacher c on a.TeacherId=c.Tid
left join rb_class d on a.ClassId=d.ClassId
where ClassDate=DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') and a.BeiKeStatus=0 and a.TeacherId>0 and d.ClassStatus=2 and d.`Status`=0 and a.`Status`=0 and b.WorkUserId is not null
group by TeacherId";
return Get<RB_Class_Plan_ViewModel>(sql,null).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