|
@@ -38,7 +38,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
{
|
|
|
await table_cancel.DeleteSingle<ChangeRecord>(record.PartitionKey, record.RowKey);
|
|
|
await _serviceBus.GetServiceBusClient().CancelMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), record.sequenceNumber);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
@@ -191,7 +191,8 @@ namespace TEAMModelOS.FunctionV4
|
|
|
|
|
|
}
|
|
|
List<string> sub = new();
|
|
|
- if (work.tchLists.Count == 0) {
|
|
|
+ if (work.tchLists.Count == 0)
|
|
|
+ {
|
|
|
if (work.targets.Count > 0)
|
|
|
{
|
|
|
foreach (var course in work.targets)
|
|
@@ -204,7 +205,7 @@ namespace TEAMModelOS.FunctionV4
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (addTmdidsCls.IsNotEmpty())
|
|
|
{
|
|
|
addTmdidsCls.ForEach(x =>
|
|
@@ -277,92 +278,92 @@ namespace TEAMModelOS.FunctionV4
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- stuActivities.Add(new StuActivity
|
|
|
- {
|
|
|
- pk = "Activity",
|
|
|
- id = work.id,
|
|
|
- code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
|
|
|
- type = "Homework",
|
|
|
- name = work.name,
|
|
|
- startTime = work.startTime,
|
|
|
- endTime = work.endTime,
|
|
|
- scode = work.code,
|
|
|
- scope = work.scope,
|
|
|
- school = work.school,
|
|
|
- creatorId = work.creatorId,
|
|
|
- subjects = sub,
|
|
|
- blob = work.blob,
|
|
|
- owner = work.owner,
|
|
|
- createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
- taskStatus = sta,
|
|
|
- classIds = classIds.ToList(),
|
|
|
- mustSubmit = work.mustSubmit
|
|
|
- });
|
|
|
+ stuActivities.Add(new StuActivity
|
|
|
+ {
|
|
|
+ pk = "Activity",
|
|
|
+ id = work.id,
|
|
|
+ code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
|
|
|
+ type = "Homework",
|
|
|
+ name = work.name,
|
|
|
+ startTime = work.startTime,
|
|
|
+ endTime = work.endTime,
|
|
|
+ scode = work.code,
|
|
|
+ scope = work.scope,
|
|
|
+ school = work.school,
|
|
|
+ creatorId = work.creatorId,
|
|
|
+ subjects = sub,
|
|
|
+ blob = work.blob,
|
|
|
+ owner = work.owner,
|
|
|
+ createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
+ taskStatus = sta,
|
|
|
+ classIds = classIds.ToList(),
|
|
|
+ mustSubmit = work.mustSubmit
|
|
|
});
|
|
|
+ });
|
|
|
+ }
|
|
|
+ (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, work.tchLists, work.school, ps);
|
|
|
+ (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.OfflineRecord }, 0);
|
|
|
+ if (tchList.IsNotEmpty())
|
|
|
+ {
|
|
|
+ list.tmdids = tchList.Select(x => x.id).ToList();
|
|
|
+ School school = null;
|
|
|
+ if (!string.IsNullOrEmpty(work.school))
|
|
|
+ {
|
|
|
+ school = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(work.school, new Azure.Cosmos.PartitionKey("Base"));
|
|
|
+ list.school = school.id;
|
|
|
+ list.standard = school.standard;
|
|
|
}
|
|
|
- (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, work.tchLists, work.school, ps);
|
|
|
- (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.OfflineRecord }, 0);
|
|
|
- if (tchList.IsNotEmpty())
|
|
|
+ tchList.ForEach(x =>
|
|
|
{
|
|
|
- list.tmdids = tchList.Select(x => x.id).ToList();
|
|
|
- School school = null;
|
|
|
- if (!string.IsNullOrEmpty(work.school))
|
|
|
+ HashSet<string> classIds = new();
|
|
|
+ classInfos.ForEach(z =>
|
|
|
{
|
|
|
- school = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(work.school, new Azure.Cosmos.PartitionKey("Base"));
|
|
|
- list.school = school.id;
|
|
|
- list.standard = school.standard;
|
|
|
- }
|
|
|
- tchList.ForEach(x =>
|
|
|
- {
|
|
|
- HashSet<string> classIds = new();
|
|
|
- classInfos.ForEach(z =>
|
|
|
+ z.members.ForEach(y =>
|
|
|
{
|
|
|
- z.members.ForEach(y =>
|
|
|
+ if (y.id.Equals(x.id) && y.type == 1)
|
|
|
{
|
|
|
- if (y.id.Equals(x.id) && y.type == 1)
|
|
|
- {
|
|
|
- classIds.Add(z.id);
|
|
|
- }
|
|
|
- });
|
|
|
+ classIds.Add(z.id);
|
|
|
+ }
|
|
|
});
|
|
|
- int sta = -1;
|
|
|
- if (tac.Count > 0)
|
|
|
+ });
|
|
|
+ int sta = -1;
|
|
|
+ if (tac.Count > 0)
|
|
|
+ {
|
|
|
+ StuActivity activity = tac.Where(t => t.code.Equals($"Activity-{x.id}")).FirstOrDefault();
|
|
|
+ if (activity != null)
|
|
|
{
|
|
|
- StuActivity activity = tac.Where(t => t.code.Equals($"Activity-{x.id}")).FirstOrDefault();
|
|
|
- if (activity != null)
|
|
|
- {
|
|
|
- sta = activity.taskStatus;
|
|
|
- }
|
|
|
+ sta = activity.taskStatus;
|
|
|
}
|
|
|
- tchActivities.Add(new StuActivity
|
|
|
- {
|
|
|
- pk = "Activity",
|
|
|
- id = work.id,
|
|
|
- code = $"Activity-{x.id}",
|
|
|
- type = "Homework",
|
|
|
- name = work.name,
|
|
|
- startTime = work.startTime,
|
|
|
- endTime = work.endTime,
|
|
|
- scode = work.code,
|
|
|
- scope = work.scope,
|
|
|
- school = work.school,
|
|
|
- creatorId = work.creatorId,
|
|
|
- subjects = new List<string> { "" },
|
|
|
- blob = work.blob,
|
|
|
- owner = work.owner,
|
|
|
- createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
- taskStatus = sta,
|
|
|
- classIds = classIds.ToList()
|
|
|
- });
|
|
|
-
|
|
|
+ }
|
|
|
+ tchActivities.Add(new StuActivity
|
|
|
+ {
|
|
|
+ pk = "Activity",
|
|
|
+ id = work.id,
|
|
|
+ code = $"Activity-{x.id}",
|
|
|
+ type = "Homework",
|
|
|
+ name = work.name,
|
|
|
+ startTime = work.startTime,
|
|
|
+ endTime = work.endTime,
|
|
|
+ scode = work.code,
|
|
|
+ scope = work.scope,
|
|
|
+ school = work.school,
|
|
|
+ creatorId = work.creatorId,
|
|
|
+ subjects = new List<string> { "" },
|
|
|
+ blob = work.blob,
|
|
|
+ owner = work.owner,
|
|
|
+ createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
+ taskStatus = sta,
|
|
|
+ classIds = classIds.ToList()
|
|
|
});
|
|
|
|
|
|
- }
|
|
|
- await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
|
|
|
- await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
|
|
|
+ await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
+
|