|
@@ -73,81 +73,87 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
break;
|
|
|
case "going":
|
|
|
- List<(string pId, List<string> gid)> ps = new List<(string pId, List<string> gid)>();
|
|
|
- if (study.groupLists.Count > 0)
|
|
|
- {
|
|
|
- var group = study.groupLists;
|
|
|
- foreach (var gp in group) {
|
|
|
- foreach (KeyValuePair<string, List<string>> pp in gp) {
|
|
|
- ps.Add((pp.Key, pp.Value));
|
|
|
+ try {
|
|
|
+ List<(string pId, List<string> gid)> ps = new List<(string pId, List<string> gid)>();
|
|
|
+ if (study.groupLists.Count > 0)
|
|
|
+ {
|
|
|
+ var group = study.groupLists;
|
|
|
+ foreach (var gp in group)
|
|
|
+ {
|
|
|
+ foreach (KeyValuePair<string, List<string>> pp in gp)
|
|
|
+ {
|
|
|
+ ps.Add((pp.Key, pp.Value));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, study.tchLists, study.school,ps);
|
|
|
- await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}研修活动【{tdata.name}-{tdata.id}-ttl={tdata.ttl}】正在操作、list??{tchList.ToJsonString()}=={ps[0].gid.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
- List<StuActivity> tchActivities = new List<StuActivity>();
|
|
|
- (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(study.school))
|
|
|
+ (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, study.tchLists, study.school, ps);
|
|
|
+ List<StuActivity> tchActivities = new List<StuActivity>();
|
|
|
+ (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())
|
|
|
{
|
|
|
- school = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(study.school, new Azure.Cosmos.PartitionKey("Base"));
|
|
|
- list.school = school.id;
|
|
|
- list.standard = school.standard;
|
|
|
+ list.tmdids = tchList.Select(x => x.id).ToList();
|
|
|
+ School school = null;
|
|
|
+ if (!string.IsNullOrEmpty(study.school))
|
|
|
+ {
|
|
|
+ school = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(study.school, new Azure.Cosmos.PartitionKey("Base"));
|
|
|
+ list.school = school.id;
|
|
|
+ list.standard = school.standard;
|
|
|
+ }
|
|
|
+ tchList.ForEach(x =>
|
|
|
+ {
|
|
|
+ tchActivities.Add(new StuActivity
|
|
|
+ {
|
|
|
+ pk = "Activity",
|
|
|
+ id = study.id,
|
|
|
+ code = $"Activity-{x.id}",
|
|
|
+ type = "Study",
|
|
|
+ name = study.name,
|
|
|
+ startTime = study.startTime,
|
|
|
+ endTime = study.endTime,
|
|
|
+ scode = study.code,
|
|
|
+ scope = study.scope,
|
|
|
+ school = study.school,
|
|
|
+ creatorId = study.creatorId,
|
|
|
+ subjects = new List<string> { "" },
|
|
|
+ blob = null,
|
|
|
+ owner = study.owner,
|
|
|
+ createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
+ taskStatus = -1,
|
|
|
+ classIds = study.tchLists
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
- tchList.ForEach(x =>
|
|
|
+
|
|
|
+ await ActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}研修活动【{tdata.name}-{tdata.id}-ttl={tdata.ttl}】正在操作\n{tchList.ToJsonString()}\n{ps[0].gid.ToJsonString()}\n{list.tmdids.ToJsonString()}\n{list.update.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
+ await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
|
|
|
+ var messageWorkEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
|
|
|
+ messageWorkEnd.ApplicationProperties.Add("name", "Study");
|
|
|
+ if (changeRecords.Count > 0)
|
|
|
{
|
|
|
- tchActivities.Add(new StuActivity
|
|
|
+ long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageWorkEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
|
|
|
+ await _serviceBus.GetServiceBusClient().cancelMessage(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), changeRecords[0].sequenceNumber);
|
|
|
+ changeRecords[0].sequenceNumber = end;
|
|
|
+ await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageWorkEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
|
|
|
+ ChangeRecord changeRecord = new ChangeRecord
|
|
|
{
|
|
|
- pk = "Activity",
|
|
|
- id = study.id,
|
|
|
- code = $"Activity-{x.id}",
|
|
|
- type = "Study",
|
|
|
- name = study.name,
|
|
|
- startTime = study.startTime,
|
|
|
- endTime = study.endTime,
|
|
|
- scode = study.code,
|
|
|
- scope = study.scope,
|
|
|
- school = study.school,
|
|
|
- creatorId = study.creatorId,
|
|
|
- subjects = new List<string> { "" },
|
|
|
- blob = null,
|
|
|
- owner = study.owner,
|
|
|
- createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
|
|
- taskStatus = -1,
|
|
|
- classIds = study.tchLists
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
+ RowKey = input.Id,
|
|
|
+ PartitionKey = PartitionKey,
|
|
|
+ sequenceNumber = end,
|
|
|
+ msgId = messageWorkEnd.MessageId
|
|
|
+ };
|
|
|
+ await _azureStorage.Save<ChangeRecord>(changeRecord);
|
|
|
+ }
|
|
|
|
|
|
- await ActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
|
|
|
-
|
|
|
- await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
|
|
|
- var messageWorkEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
|
|
|
- messageWorkEnd.ApplicationProperties.Add("name", "Study");
|
|
|
- if (changeRecords.Count > 0)
|
|
|
- {
|
|
|
- long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageWorkEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
|
|
|
- await _serviceBus.GetServiceBusClient().cancelMessage(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), changeRecords[0].sequenceNumber);
|
|
|
- changeRecords[0].sequenceNumber = end;
|
|
|
- await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageWorkEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
|
|
|
- ChangeRecord changeRecord = new ChangeRecord
|
|
|
- {
|
|
|
- RowKey = input.Id,
|
|
|
- PartitionKey = PartitionKey,
|
|
|
- sequenceNumber = end,
|
|
|
- msgId = messageWorkEnd.MessageId
|
|
|
- };
|
|
|
- await _azureStorage.Save<ChangeRecord>(changeRecord);
|
|
|
+ catch (Exception ex) {
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}研修活动异常-going {ex.Message}{ex.StackTrace}{tdata.ToJsonString()}{input}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
-
|
|
|
|
|
|
break;
|
|
|
case "finish":
|