|
@@ -1,5 +1,6 @@
|
|
|
using Azure.Core;
|
|
|
using Azure.Cosmos;
|
|
|
+using Azure.Storage.Blobs;
|
|
|
using DocumentFormat.OpenXml.Bibliography;
|
|
|
using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
@@ -962,6 +963,8 @@ namespace TEAMModelBI.Controllers.Census
|
|
|
|
|
|
var redisClinet = _azureRedis.GetRedisClient(8);
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+ var tableClient = _azureStorage.GetCloudTableClient();
|
|
|
+ var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
|
DateTimeOffset dateTime = DateTimeOffset.UtcNow;
|
|
|
Area area = null;
|
|
|
AreaStats areaScStats = new();
|
|
@@ -973,7 +976,21 @@ namespace TEAMModelBI.Controllers.Census
|
|
|
Dictionary<string, double?> typeStics = new(); //所有类型
|
|
|
var (weekS, weekE) = TimeHelper.GetStartOrEnd(dateTime, "week"); //计算本周开始/结束时间
|
|
|
var (mthS, mthE) = TimeHelper.GetStartOrEnd(dateTime, "month"); //本月开始/结束时间
|
|
|
-
|
|
|
+ //學區成員修正:若學校(Base)有學區ID而學校中間件無 ->補足
|
|
|
+ List<string> schInBIRel = new List<string>();
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<string>(queryText: $"SELECT VALUE c.id FROM c WHERE c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
|
|
|
+ {
|
|
|
+ schInBIRel.Add(item);
|
|
|
+ }
|
|
|
+ await foreach (School school in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: $"SELECT * FROM c WHERE c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
+ {
|
|
|
+ string schId = school.id.ToString();
|
|
|
+ if (!schInBIRel.Contains(schId))
|
|
|
+ {
|
|
|
+ await BIStats.SetSchoolBIRelation(cosmosClient, blobClient, tableClient, _dingDing, school);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //學校中間件資料取得
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<BISchoolInfo>(queryText: $"select c.id,c.name,c.picture,c.areaId,c.areaName,c.size,c.scale,c.assists,c.sales,c.createDate,c.serial,c.service,c.hard from c where c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
|
|
|
{
|
|
|
schoolInfos.Add(item);
|