|
@@ -30,15 +30,15 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
{
|
|
|
public static class SystemService
|
|
|
{
|
|
|
-
|
|
|
+ #region
|
|
|
static string cn_wb = @"
|
|
|
IES晚报:
|
|
|
- 尊敬的{tmdname}您好,以下是您的今日个人IES教学汇总报告,截至{sendTime},您已发布{examCount}次评测任务,{homeworkCount}次作业任务,并使用HiTeach教师端开设了{lessonCount}节课堂教学活动。
|
|
|
+ {tmdname}您好,以下是您的今日个人IES教学汇总报告,截至{sendTime},您已发布{examCount}次评测任务,{homeworkCount}次作业任务,并使用HiTeach教师端开设了{lessonCount}节课堂教学活动。
|
|
|
以下是报告的具体详细信息。
|
|
|
评测任务提交详情:
|
|
|
- {examList}
|
|
|
+ {cn_examList}
|
|
|
课堂教学出席详情:
|
|
|
- {lessonList}
|
|
|
+ {cn_lessonList}
|
|
|
个人课程名单变化详情:
|
|
|
{cn_grouplistJoin}
|
|
|
{cn_grouplistLeave}
|
|
@@ -51,12 +51,71 @@ IES晚报:
|
|
|
|
|
|
static string cn_zb = @"
|
|
|
IES早报:
|
|
|
- 尊敬的{tmdname}您好,以下是您发布过的作业任务汇总报告。
|
|
|
+ {tmdname}您好,以下是您发布过的作业任务汇总报告。
|
|
|
以下是报告的具体详细信息。
|
|
|
作业任务提交详情:
|
|
|
{cn_homeworkList}
|
|
|
";
|
|
|
static string cn_homeworkList = "{homeworkName}已经有{submitCount}位学生提交,仍有{unsubmitCount}位学生未提交。";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region
|
|
|
+ static string tw_wb = @"
|
|
|
+IES晚間報告:
|
|
|
+ {tmdname}您好,以下是您的今日個人IES教學總結報告,截至{sendTime},您已發布{examCount}次測驗任務,{homeworkCount}次作業任務,並使用HiTeach上傳了{lessonCount}節課堂教學活動。
|
|
|
+ 以下是詳細資訊。
|
|
|
+ 測驗任務完成詳情:
|
|
|
+ {tw_examList}
|
|
|
+ 課堂教學出席詳情:
|
|
|
+ {tw_lessonList}
|
|
|
+ 個人課程名單變動詳情:
|
|
|
+ {tw_grouplistJoin}
|
|
|
+ {tw_grouplistLeave}
|
|
|
+ 如有佈署作業任務,將於隔天早上8點透過晨間報告方式發送。
|
|
|
+";
|
|
|
+ static string tw_examList = "{examName}已經有{submitCount}位學生繳交,仍有{unsubmitCount}位學生未繳交。";
|
|
|
+ static string tw_lessonList = "{lessonName}課堂應出席人數{memberCount},實際出席人數{attendCount},出席率{attendRate}。";
|
|
|
+ static string tw_grouplistJoin = "{grouplistName}已有總人數{memberCount},有{joinCount}加入。";
|
|
|
+ static string tw_grouplistLeave = "{grouplistName}已有總人數{memberCount},有{joinCount}離開。";
|
|
|
+
|
|
|
+ static string tw_zb = @"
|
|
|
+IES晨間報告:
|
|
|
+ {tmdname}您好,以下是您曾經發佈過的作業任務總結報告。
|
|
|
+ 以下是具體詳細資訊。
|
|
|
+ 作業任務繳交詳情:
|
|
|
+ {tw_homeworkList}
|
|
|
+";
|
|
|
+ static string tw_homeworkList = "{homeworkName}已經有{submitCount}位學生繳交,仍有{unsubmitCount}位學生未繳交。";
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region
|
|
|
+ static string en_wb = @"
|
|
|
+IES Evening Report:
|
|
|
+ Hello {tmdname}, here is your personal IES teaching summary report for today. As of {sendTime}, you have published {examCount} test tasks, {homeworkCount} homework tasks, and uploaded {lessonCount} HiTeach lesson activity records.
|
|
|
+ The following are the specific details.
|
|
|
+ Test task submission details:
|
|
|
+ {en_examList}
|
|
|
+ Lesson attendance details:
|
|
|
+ {en_lessonList}
|
|
|
+ Personal course list change details:
|
|
|
+ {en_grouplistJoin}
|
|
|
+ {en_grouplistLeave}
|
|
|
+ If there are homework tasks assigned, they will be sent through the morning report at 8 am the next day.
|
|
|
+";
|
|
|
+ static string en_examList = "{examName} has {submitCount} students submitted, and there are still {unsubmitCount} students who have not submitted.";
|
|
|
+ static string en_lessonList = "{lessonName} lesson should have {memberCount} attendees, actual attendees {attendCount}, attendance rate {attendRate}.";
|
|
|
+ static string en_grouplistJoin = "{grouplistName} has a total of {memberCount}, {joinCount} joined.";
|
|
|
+ static string en_grouplistLeave = "{grouplistName} has a total of {memberCount}, {joinCount} left.";
|
|
|
+ static string en_zb = @"
|
|
|
+IES Morning Report:
|
|
|
+ Hello {tmdname}, here is the summary report of the homework tasks you have posted.
|
|
|
+ Homework Submission Details:
|
|
|
+ {en_homeworkList}
|
|
|
+";
|
|
|
+ static string en_homeworkList = "{homeworkName} has {submitCount} students submitted, and there are still {unsubmitCount} students who have not submitted.";
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
public static async Task AccumulateDaily(AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos,CoreAPIHttpService coreAPIHttpService, DingDing dingDing)
|
|
|
{
|
|
@@ -169,6 +228,18 @@ IES早报:
|
|
|
|
|
|
foreach (var teacher in teachers)
|
|
|
{
|
|
|
+ string lang = teacher.lang;
|
|
|
+ if (string.IsNullOrWhiteSpace(teacher.lang))
|
|
|
+ {
|
|
|
+ if (coreAPIHttpService.options.location.Contains("China", StringComparison.OrdinalIgnoreCase))
|
|
|
+ {
|
|
|
+ lang= "zh-cn";
|
|
|
+ }
|
|
|
+ if (coreAPIHttpService.options.location.Contains("Global",StringComparison.OrdinalIgnoreCase))
|
|
|
+ {
|
|
|
+ lang= "en-us";
|
|
|
+ }
|
|
|
+ }
|
|
|
int examCount = 0,homeworkCount=0,lessonCount=0;
|
|
|
StringBuilder examSB= new StringBuilder();
|
|
|
foreach (var exam in exam_submit)
|
|
@@ -188,12 +259,25 @@ IES早报:
|
|
|
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}"));
|
|
|
+ switch (lang)
|
|
|
+ {
|
|
|
+ case "zh-cn":
|
|
|
+ examSB.Append(cn_examList.Replace("{examName}", examName).Replace("{submitCount}", $"{submit}").Replace("{unsubmitCount}", $"{unsubmit}"));
|
|
|
+ break;
|
|
|
+ case "zh-tw":
|
|
|
+ examSB.Append(tw_examList.Replace("{examName}", examName).Replace("{submitCount}", $"{submit}").Replace("{unsubmitCount}", $"{unsubmit}"));
|
|
|
+ break;
|
|
|
+ case "en-us":
|
|
|
+ examSB.Append(en_examList.Replace("{examName}", examName).Replace("{submitCount}", $"{submit}").Replace("{unsubmitCount}", $"{unsubmit}"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ StringBuilder homeworkSB = new StringBuilder();
|
|
|
foreach (var homeworksm in homework_submit)
|
|
|
{
|
|
|
int sendTime = 8;
|
|
@@ -209,11 +293,123 @@ IES早报:
|
|
|
Azure .Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).ReadItemStreamAsync(homeworkId, new Azure.Cosmos.PartitionKey($"Homework-{tid}"));
|
|
|
if (response.Status==200) {
|
|
|
Homework homework= JsonDocument.Parse(response.Content).RootElement.ToObject<Homework>();
|
|
|
- await HomeworkService.AnswerRecordAll(_azureCosmos.GetCosmosClient(), coreAPIHttpService, dingDing, homework, tid, "Student", homework.stuLists, "student");
|
|
|
+ List<HomeworkUser> homeworkUsers= await HomeworkService.AnswerRecordAll(_azureCosmos.GetCosmosClient(), coreAPIHttpService, dingDing, homework, tid, "Student", homework.stuLists, "student");
|
|
|
+ homeworkCount++;
|
|
|
+ switch (lang)
|
|
|
+ {
|
|
|
+ case "zh-cn":
|
|
|
+ homeworkSB.Append(cn_homeworkList.Replace("{homeworkName}", homework.name).Replace("{submitCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{unsubmitCount}", $"{homeworkUsers.Where(x => !x.submit).Count()}"));
|
|
|
+ break;
|
|
|
+ case "zh-tw":
|
|
|
+ homeworkSB.Append(tw_homeworkList.Replace("{homeworkName}", homework.name).Replace("{submitCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{unsubmitCount}", $"{homeworkUsers.Where(x => !x.submit).Count()}"));
|
|
|
+ break;
|
|
|
+ case "en-us":
|
|
|
+ homeworkSB.Append(en_homeworkList.Replace("{homeworkName}", homework.name).Replace("{submitCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{unsubmitCount}", $"{homeworkUsers.Where(x => !x.submit).Count()}"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuilder lessonSB = new StringBuilder();
|
|
|
+ foreach (var lesson in lessoncreate)
|
|
|
+ {
|
|
|
+
|
|
|
+ int sendTime = 20;
|
|
|
+
|
|
|
+ string[] ks = lesson.Key.Split("::");
|
|
|
+ string tid = ks[0];
|
|
|
+ if (tid.Equals(teacher.id))
|
|
|
+ {
|
|
|
+ var tzt = now.GetGMTTime((int)teacher.timezone);
|
|
|
+ if (tzt.Hour==sendTime)
|
|
|
+ {
|
|
|
+ long stime = now.AddHours(-20).ToUnixTimeMilliseconds();
|
|
|
+ string sql = $"select value c from c where c.tmdid='{teacher.id}' and c.pk='LessonRecord' and c.startTime> {stime} ";
|
|
|
+ List<LessonRecord>lessons = new List<LessonRecord>();
|
|
|
+ var schoolResult= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<LessonRecord>(sql);
|
|
|
+ var teahcerResult = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetList<LessonRecord>(sql, "LessonRecord");
|
|
|
+ lessons.AddRange(schoolResult.list);
|
|
|
+ lessons.AddRange(teahcerResult.list);
|
|
|
+ foreach(var lessonRecord in lessons)
|
|
|
+ {
|
|
|
+ lessonCount++;
|
|
|
+ switch (lang)
|
|
|
+ {
|
|
|
+ case "zh-cn":
|
|
|
+ lessonSB.Append(cn_lessonList.Replace("{lessonName}", lessonRecord.name).Replace("{memberCount}", $"{lessonRecord.clientCount}").Replace("{attendCount}", $"{lessonRecord.attendCount}")).Replace("{attendRate}", $"{lessonRecord.attendRate}");
|
|
|
+ break;
|
|
|
+ case "zh-tw":
|
|
|
+ lessonSB.Append(tw_lessonList.Replace("{lessonName}", lessonRecord.name).Replace("{memberCount}", $"{lessonRecord.clientCount}").Replace("{attendCount}", $"{lessonRecord.attendCount}")).Replace("{attendRate}", $"{lessonRecord.attendRate}");
|
|
|
+ break;
|
|
|
+ case "en-us":
|
|
|
+ lessonSB.Append(en_lessonList.Replace("{lessonName}", lessonRecord.name).Replace("{memberCount}", $"{lessonRecord.clientCount}").Replace("{attendCount}", $"{lessonRecord.attendCount}")).Replace("{attendRate}", $"{lessonRecord.attendRate}");
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ StringBuilder grouplistSB = new StringBuilder();
|
|
|
+ foreach (var group in grouplist)
|
|
|
+ {
|
|
|
+ int sendTime = 20;
|
|
|
+
|
|
|
+ string[] ks = group.Key.Split("::");
|
|
|
+ string tid = ks[0];
|
|
|
+ string grouplistId = ks[1];
|
|
|
+ string grouplistName = ks[3];
|
|
|
+
|
|
|
+ if (tid.Equals(teacher.id))
|
|
|
+ {
|
|
|
+ var tzt = now.GetGMTTime((int)teacher.timezone);
|
|
|
+ if (tzt.Hour==sendTime)
|
|
|
+ {
|
|
|
+ switch (lang)
|
|
|
+ {
|
|
|
+ //case "zh-cn":
|
|
|
+
|
|
|
+ // if (group.Value>=0)
|
|
|
+ // {
|
|
|
+ // grouplistSB.Append(cn_grouplistJoin.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // grouplistSB.Append(cn_grouplistLeave.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ //case "zh-tw":
|
|
|
+ // if (group.Value>=0)
|
|
|
+ // {
|
|
|
+ // grouplistSB.Append(tw_grouplistJoin.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // grouplistSB.Append(tw_grouplistLeave.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ //case "en-us":
|
|
|
+ // if (group.Value>=0)
|
|
|
+ // {
|
|
|
+ // grouplistSB.Append(en_grouplistJoin.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // grouplistSB.Append(en_grouplistLeave.Replace("{grouplistName}", grouplistName).Replace("{memberCount}", $"{homeworkUsers.Where(x => x.submit).Count()}").Replace("{joinCount}", $"{group.Value}"));
|
|
|
+
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
public static async Task RecordAccumulateData(AzureRedisFactory azureRedis, DingDing dingDing, Accumulate accumulate)
|