|
@@ -101,80 +101,8 @@ namespace TEAMModelFunction
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- List<(string pId, List<string> gid)> ps = new List<(string pId, List<string> gid)>();
|
|
|
- if (info.groupLists.Count > 0)
|
|
|
- {
|
|
|
- var group = info.groupLists;
|
|
|
- foreach (var gp in group)
|
|
|
- {
|
|
|
- foreach (KeyValuePair<string, List<string>> pp in gp)
|
|
|
- {
|
|
|
- ps.Add((pp.Key, pp.Value));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<string> classes = ExamService.getClasses(info.classes, info.stuLists);
|
|
|
- (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetStutmdidListids(client, _dingDing, classes, info.school, ps);
|
|
|
- var addStudentsCls = tchList.FindAll(x => x.type == 2);
|
|
|
- var addTmdidsCls = tchList.FindAll(x => x.type == 1);
|
|
|
- List<StuActivity> stuActivities = new List<StuActivity>();
|
|
|
- List<StuActivity> tmdActivities = new List<StuActivity>();
|
|
|
- if (addTmdidsCls.IsNotEmpty())
|
|
|
- {
|
|
|
- addTmdidsCls.ForEach(x =>
|
|
|
- {
|
|
|
- tmdActivities.Add(new StuActivity
|
|
|
- {
|
|
|
- pk = "Activity",
|
|
|
- id = info.id,
|
|
|
- code = $"Activity-{x.id}",
|
|
|
- type = "Exam",
|
|
|
- name = info.name,
|
|
|
- source = info.source,
|
|
|
- startTime = info.startTime,
|
|
|
- endTime = info.endTime,
|
|
|
- scode = info.code,
|
|
|
- scope = info.scope,
|
|
|
- school = info.school,
|
|
|
- creatorId = info.creatorId,
|
|
|
- subjects = sub,
|
|
|
- blob = null,
|
|
|
- owner = info.owner,
|
|
|
- createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
- taskStatus = -1,
|
|
|
- classIds = classes
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- if (addStudentsCls.IsNotEmpty())
|
|
|
- {
|
|
|
- addStudentsCls.ForEach(x =>
|
|
|
- {
|
|
|
- stuActivities.Add(new StuActivity
|
|
|
- {
|
|
|
- pk = "Activity",
|
|
|
- id = info.id,
|
|
|
- code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
|
|
|
- type = "Exam",
|
|
|
- name = info.name,
|
|
|
- source = info.source,
|
|
|
- startTime = info.startTime,
|
|
|
- endTime = info.endTime,
|
|
|
- scode = info.code,
|
|
|
- scope = info.scope,
|
|
|
- school = info.school,
|
|
|
- creatorId = info.creatorId,
|
|
|
- subjects = sub,
|
|
|
- blob = null,
|
|
|
- owner = info.owner,
|
|
|
- classIds = classes,
|
|
|
- createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
- taskStatus = -1
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, null);
|
|
|
+ //处理活动中间件
|
|
|
+ List<string> classes = await Activity(info,client,_dingDing,sub);
|
|
|
//向学生或醍摩豆账号发起通知
|
|
|
#region
|
|
|
//Notice notice = new Notice()
|
|
@@ -398,6 +326,8 @@ namespace TEAMModelFunction
|
|
|
int fno = 0;
|
|
|
try
|
|
|
{
|
|
|
+ //处理活动中间件
|
|
|
+ await Activity(info, client, _dingDing, sub);
|
|
|
foreach (ExamSubject subject in info.subjects)
|
|
|
{
|
|
|
await createClassResultAsync(info, examClassResults, subject, fno, _azureCosmos, _dingDing, _azureStorage);
|
|
@@ -597,6 +527,83 @@ namespace TEAMModelFunction
|
|
|
await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-{info.id}-评测作答记录结算异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
}
|
|
|
+ public static async Task<List<string>> Activity(ExamInfo info, CosmosClient client, DingDing _dingDing, List<string> sub) {
|
|
|
+ List<(string pId, List<string> gid)> ps = new List<(string pId, List<string> gid)>();
|
|
|
+ if (info.groupLists.Count > 0)
|
|
|
+ {
|
|
|
+ var group = info.groupLists;
|
|
|
+ foreach (var gp in group)
|
|
|
+ {
|
|
|
+ foreach (KeyValuePair<string, List<string>> pp in gp)
|
|
|
+ {
|
|
|
+ ps.Add((pp.Key, pp.Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<string> classes = ExamService.getClasses(info.classes, info.stuLists);
|
|
|
+ (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetStutmdidListids(client, _dingDing, classes, info.school, ps);
|
|
|
+ var addStudentsCls = tchList.FindAll(x => x.type == 2);
|
|
|
+ var addTmdidsCls = tchList.FindAll(x => x.type == 1);
|
|
|
+ List<StuActivity> stuActivities = new List<StuActivity>();
|
|
|
+ List<StuActivity> tmdActivities = new List<StuActivity>();
|
|
|
+ if (addTmdidsCls.IsNotEmpty())
|
|
|
+ {
|
|
|
+ addTmdidsCls.ForEach(x =>
|
|
|
+ {
|
|
|
+ tmdActivities.Add(new StuActivity
|
|
|
+ {
|
|
|
+ pk = "Activity",
|
|
|
+ id = info.id,
|
|
|
+ code = $"Activity-{x.id}",
|
|
|
+ type = "Exam",
|
|
|
+ name = info.name,
|
|
|
+ source = info.source,
|
|
|
+ startTime = info.startTime,
|
|
|
+ endTime = info.endTime,
|
|
|
+ scode = info.code,
|
|
|
+ scope = info.scope,
|
|
|
+ school = info.school,
|
|
|
+ creatorId = info.creatorId,
|
|
|
+ subjects = sub,
|
|
|
+ blob = null,
|
|
|
+ owner = info.owner,
|
|
|
+ createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
+ taskStatus = -1,
|
|
|
+ classIds = classes
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (addStudentsCls.IsNotEmpty())
|
|
|
+ {
|
|
|
+ addStudentsCls.ForEach(x =>
|
|
|
+ {
|
|
|
+ stuActivities.Add(new StuActivity
|
|
|
+ {
|
|
|
+ pk = "Activity",
|
|
|
+ id = info.id,
|
|
|
+ code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
|
|
|
+ type = "Exam",
|
|
|
+ name = info.name,
|
|
|
+ source = info.source,
|
|
|
+ startTime = info.startTime,
|
|
|
+ endTime = info.endTime,
|
|
|
+ scode = info.code,
|
|
|
+ scope = info.scope,
|
|
|
+ school = info.school,
|
|
|
+ creatorId = info.creatorId,
|
|
|
+ subjects = sub,
|
|
|
+ blob = null,
|
|
|
+ owner = info.owner,
|
|
|
+ classIds = classes,
|
|
|
+ createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
+ taskStatus = -1
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, null);
|
|
|
+ return classes;
|
|
|
+ }
|
|
|
|
|
|
public static async Task knowledgeCount(ExamInfo info, ExamSubject subject, DingDing _dingDing, int no, List<ExamClassResult> classResults,
|
|
|
double rhwCount, double rhw, double rhlCount, double rhl, AzureCosmosFactory _azureCosmos)
|