|
@@ -4,6 +4,7 @@ using Azure.Storage.Blobs.Models;
|
|
|
using Microsoft.Azure.Documents;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Net.Http;
|
|
|
using System.Text;
|
|
|
using System.Text.Json;
|
|
|
using System.Threading.Tasks;
|
|
@@ -12,13 +13,15 @@ using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
|
|
|
using TEAMModelOS.SDK.Models;
|
|
|
using TEAMModelOS.SDK.Models.Cosmos;
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.Common.Inner;
|
|
|
+using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
|
|
|
|
|
|
namespace TEAMModelFunction
|
|
|
{
|
|
|
public class TriggerSurvey
|
|
|
{
|
|
|
public static async void Trigger(AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
|
|
|
- CosmosClient client, Document input, string code, long stime, long etime, string school,AzureRedisFactory _azureRedis)
|
|
|
+ CosmosClient client, Document input, string code, long stime, long etime, string school,AzureRedisFactory _azureRedis, System.Net.Http.IHttpClientFactory _clientFactory)
|
|
|
{
|
|
|
Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(input.Id, new Azure.Cosmos.PartitionKey($"{code}"));
|
|
|
List<ChangeRecord> changeRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input.Id }, { "PartitionKey", survey.progress } });
|
|
@@ -131,9 +134,16 @@ namespace TEAMModelFunction
|
|
|
var ContainerClient = _azureStorage.GetBlobContainerClient(survey.owner);
|
|
|
var route = ContainerClient.Uri.ToString();
|
|
|
List<BlobItem> items = await ContainerClient.List($"survey/{survey.id}/urecord");
|
|
|
- items.ForEach(x => {
|
|
|
- var url = $"{route}/{x.Name}";
|
|
|
- });
|
|
|
+ List<SurveyRecord> surveyRecords = new List<SurveyRecord>();
|
|
|
+ //获取
|
|
|
+ BlobAuth blobAuth = _azureStorage.GetBlobSasUriRead(survey.owner, $"survey/{survey.id}/record.json");
|
|
|
+ foreach (BlobItem item in items) {
|
|
|
+ var url = $"{route}/{item.Name}";
|
|
|
+ var response = await _clientFactory.CreateClient().GetAsync(new Uri(url + blobAuth.sas));
|
|
|
+ var json = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
|
|
|
+ var Record = json.RootElement.ToObject<SurveyRecord>();
|
|
|
+ surveyRecords.Add(Record);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|