|
@@ -31,14 +31,59 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
public static class SystemService
|
|
|
{
|
|
|
|
|
|
-
|
|
|
- public static async Task AccumulateDaily(AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos)
|
|
|
+ static string cn_wb = @"
|
|
|
+IES晚报:
|
|
|
+ 尊敬的{tmdname}您好,以下是您的今日个人IES教学汇总报告,截至{sendTime},您已发布{examCount}次评测任务,{homeworkCount}次作业任务,并使用HiTeach教师端开设了{lessonCount}节课堂教学活动。
|
|
|
+ 以下是报告的具体详细信息。
|
|
|
+ 评测任务提交详情:
|
|
|
+ {examList}
|
|
|
+ 课堂教学出席详情:
|
|
|
+ {lessonList}
|
|
|
+ 个人课程名单变化详情:
|
|
|
+ {cn_grouplistJoin}
|
|
|
+ {cn_grouplistLeave}
|
|
|
+ 如有布置作业任务,将于次日8点通过早报方式发送。
|
|
|
+";
|
|
|
+ static string cn_examList = "{examName}已经有{submitCount}位学生提交,仍有{unsubmitCount}位学生未提交。";
|
|
|
+ static string cn_lessonList = "{lessonName}课例应出席人数{memberCount},实际出席人数{attendCount},出席率{attendRate}。";
|
|
|
+ static string cn_grouplistJoin = "{grouplistName}已有总人数{memberCount},有{joinCount}加入。";
|
|
|
+ static string cn_grouplistLeave = "{grouplistName}已有总人数{memberCount},有{joinCount}离开。";
|
|
|
+
|
|
|
+ static string cn_zb = @"
|
|
|
+IES早报:
|
|
|
+ 尊敬的{tmdname}您好,以下是您发布过的作业任务汇总报告。
|
|
|
+ 以下是报告的具体详细信息。
|
|
|
+ 作业任务提交详情:
|
|
|
+ {cn_homeworkList}
|
|
|
+";
|
|
|
+ static string cn_homeworkList = "{homeworkName}已经有{submitCount}位学生提交,仍有{unsubmitCount}位学生未提交。";
|
|
|
+
|
|
|
+ public static async Task AccumulateDaily(AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos,CoreAPIHttpService coreAPIHttpService, DingDing dingDing)
|
|
|
{
|
|
|
DateTimeOffset now = DateTimeOffset.UtcNow;
|
|
|
string day = now.ToString("yyyyMMdd");
|
|
|
+ string homeworkYesterday = now.AddDays(-1).ToString("yyyyMMdd");
|
|
|
+ List<string> keys = new List<string>();
|
|
|
+ //当天评测发布的。
|
|
|
//当天的个人评测提交数
|
|
|
Dictionary<string, double?> exam_submit = new();
|
|
|
- List<string> keys = new List<string>();
|
|
|
+ SortedSetEntry[] exam_goingScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:private:exam-going:{day}");
|
|
|
+ // Dictionary<string, double?> exam_going = new();
|
|
|
+ if (exam_goingScores != null)
|
|
|
+ {
|
|
|
+ foreach (var score in exam_goingScores)
|
|
|
+ {
|
|
|
+ double val = score.Score;
|
|
|
+ string key = score.Element.ToString();
|
|
|
+ // exam_going.Add(key, val);
|
|
|
+ exam_submit.Add(key, val);
|
|
|
+ keys.Add(key);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ///需要再次获取 没有任何人提交的作业和评测任务。
|
|
|
SortedSetEntry[] exam_submitScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:private:exam-submit:{day}");
|
|
|
if (exam_submitScores != null)
|
|
|
{
|
|
@@ -50,10 +95,27 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
keys.Add(key);
|
|
|
}
|
|
|
}
|
|
|
- List<string> homeworkIds = new List<string>();
|
|
|
- //当天的个人作业提交数
|
|
|
- SortedSetEntry[] homework_submitScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:teacher:homework-submit:{day}");
|
|
|
+
|
|
|
+ //昨天发布的作业
|
|
|
+ SortedSetEntry[] homework_goingScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:teacher:homework-going:{homeworkYesterday}");
|
|
|
Dictionary<string, double?> homework_submit = new();
|
|
|
+ //Dictionary<string, double?> homework_going = new();
|
|
|
+ if (homework_goingScores != null)
|
|
|
+ {
|
|
|
+ foreach (var score in homework_goingScores)
|
|
|
+ {
|
|
|
+ double val = score.Score;
|
|
|
+ string key = score.Element.ToString();
|
|
|
+ //homework_going.Add(key, val);
|
|
|
+ homework_submit.Add(key, val);
|
|
|
+ keys.Add(key);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //昨天的个人作业提交数
|
|
|
+ SortedSetEntry[] homework_submitScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:teacher:homework-submit:{homeworkYesterday}");
|
|
|
+
|
|
|
if (homework_submitScores != null)
|
|
|
{
|
|
|
foreach (var score in homework_submitScores)
|
|
@@ -62,7 +124,6 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
string key = score.Element.ToString();
|
|
|
homework_submit.Add(key, val);
|
|
|
keys.Add(key);
|
|
|
- homeworkIds.Add(key.Split("::")[1]);
|
|
|
}
|
|
|
}
|
|
|
//当天的个人名单加入人数
|
|
@@ -78,6 +139,19 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
keys.Add(key);
|
|
|
}
|
|
|
}
|
|
|
+ //当天教师的开课数量Accumulate:Daily:teacher:lesson-create:20240527
|
|
|
+ Dictionary<string, double?> lessoncreate = new();
|
|
|
+ SortedSetEntry[] llessoncreateScores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Accumulate:Daily:teacher:lesson-create:{day}");
|
|
|
+ if (llessoncreateScores != null)
|
|
|
+ {
|
|
|
+ foreach (var score in llessoncreateScores)
|
|
|
+ {
|
|
|
+ double val = score.Score;
|
|
|
+ string key = score.Element.ToString();
|
|
|
+ lessoncreate.Add(key, val);
|
|
|
+ keys.Add(key);
|
|
|
+ }
|
|
|
+ }
|
|
|
List<string> ids = new List<string>();
|
|
|
keys.ForEach(x => {
|
|
|
ids.Add(x.Split("::")[0]);
|
|
@@ -92,6 +166,51 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
teachers.AddRange(result.list);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ foreach (var teacher in teachers)
|
|
|
+ {
|
|
|
+ int examCount = 0,homeworkCount=0,lessonCount=0;
|
|
|
+ StringBuilder examSB= new StringBuilder();
|
|
|
+ foreach (var exam in exam_submit)
|
|
|
+ {
|
|
|
+ int sendTime = 20;
|
|
|
+ string[] ks = exam.Key.Split("::");
|
|
|
+ string tid = ks[0];
|
|
|
+ string examId = ks[1];
|
|
|
+ string examName = ks[3];
|
|
|
+ if (tid.Equals(teacher.id)) {
|
|
|
+ var tzt = now.GetGMTTime((int)teacher.timezone);
|
|
|
+ if (tzt.Hour==sendTime)
|
|
|
+ {
|
|
|
+ string sql = $"select c.status from c where c.examId='{examId}' and c.pk='ExamClassResult'";
|
|
|
+ var result = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamClassResult>("", $"ExamClassResult-{tid}");
|
|
|
+ if (result.list.IsNotEmpty()) {
|
|
|
+ var unsubmit = result.list.SelectMany(x => x.status).Where(x => x==1);
|
|
|
+ var submit = result.list.SelectMany(x => x.status).Where(x => x==0);
|
|
|
+ examCount++;
|
|
|
+ examSB.Append(cn_examList.Replace("{examName}",examName).Replace("{submitCount}",$"{submit}").Replace("{unsubmitCount}",$"{unsubmit}"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (var homework in homework_submit)
|
|
|
+ {
|
|
|
+ int sendTime = 8;
|
|
|
+ string[] ks = homework.Key.Split("::");
|
|
|
+ string tid = ks[0];
|
|
|
+ string examId = ks[1];
|
|
|
+ string examName = ks[3];
|
|
|
+ if (tid.Equals(teacher.id))
|
|
|
+ {
|
|
|
+ var tzt = now.GetGMTTime((int)teacher.timezone);
|
|
|
+ if (tzt.Hour==sendTime)
|
|
|
+ {
|
|
|
+ string sql = $"select c.status from c where c.examId='{examId}' and c.pk='ExamClassResult'";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
public static async Task RecordAccumulateData(AzureRedisFactory azureRedis, DingDing dingDing, Accumulate accumulate)
|
|
|
{
|