|
@@ -1,7 +1,7 @@
|
|
|
using Microsoft.Azure.Cosmos;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
-using Microsoft.Table;
|
|
|
+
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using System;
|
|
@@ -17,6 +17,7 @@ using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Models;
|
|
|
using TEAMModelOS.SDK.Services;
|
|
|
using static TEAMModelBI.Models.Extension.GeoRegion;
|
|
|
+using Microsoft.Azure.Documents.Client;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.BITmid
|
|
|
{
|
|
@@ -132,7 +133,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", tmids);
|
|
|
await foreach (var item in cosmosClientCsv2
|
|
|
.GetContainer("Core", "ID2")
|
|
|
- .GetItemQueryStreamIteratorSql(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base") }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -169,7 +170,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", tmids);
|
|
|
await foreach (var item in cosmosClientCsv2
|
|
|
.GetContainer("Core", "ID2")
|
|
|
- .GetItemQueryStreamIteratorSql(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base-ex") }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base-ex") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -405,7 +406,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", schoolIds);
|
|
|
await foreach (var itemsc in cosmosClientIes5
|
|
|
.GetContainer(Constant.TEAMModelOS, "School")
|
|
|
- .GetItemQueryStreamIteratorSql(querysc, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(querysc, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
{
|
|
|
using var jsonsc = await JsonDocument.ParseAsync(itemsc.Content);
|
|
|
if (jsonsc.RootElement.TryGetProperty("_count", out JsonElement countsc) && countsc.GetUInt16() > 0)
|
|
@@ -501,7 +502,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", tmidDic.Keys.ToList());
|
|
|
await foreach (var item in cosmosClientCsv2
|
|
|
.GetContainer("Core", "ID2")
|
|
|
- .GetItemQueryStreamIteratorSql(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("benefits") }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("benefits") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -528,7 +529,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", tmidDic.Keys.ToList());
|
|
|
await foreach (var item in cosmosClientCsv2
|
|
|
.GetContainer("Core", "ID2")
|
|
|
- .GetItemQueryStreamIteratorSql(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("sokrates") }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("sokrates") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -808,7 +809,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- continuationToken = item.GetContinuationToken();
|
|
|
+ continuationToken = item.ContinuationToken;
|
|
|
}
|
|
|
}
|
|
|
while (!string.IsNullOrWhiteSpace(continuationToken));
|
|
@@ -821,7 +822,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
.WithParameter("@key", tmids);
|
|
|
await foreach (var item in cosmosClientCsv2
|
|
|
.GetContainer("Core", "ID2")
|
|
|
- .GetItemQueryStreamIteratorSql(querye, continuationToken: continuationToken, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base-ex"), MaxItemCount = pageSize }))
|
|
|
+ .GetItemQueryStreamIteratorQuery(querye, continuationToken: continuationToken, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base-ex"), MaxItemCount = pageSize }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -844,7 +845,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- continuationToken = item.GetContinuationToken();
|
|
|
+ continuationToken = item.ContinuationToken;
|
|
|
}
|
|
|
}
|
|
|
while (!string.IsNullOrWhiteSpace(continuationToken));
|
|
@@ -1114,7 +1115,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
{
|
|
|
strQueryV += $" AND c.prodCode = '{prodCode}'";
|
|
|
}
|
|
|
- await foreach (OrderHisService orderService in cosmosClientCsv2.GetContainer("Habb", "Auth").GetItemQueryIteratorSql<OrderHisService>(strQueryV, null, qryOption))
|
|
|
+ await foreach (OrderHisService orderService in cosmosClientCsv2.GetContainer("Habb", "Auth").GetItemQueryIteratorSql<OrderHisService>(queryText:strQueryV, continuationToken: null, requestOptions: qryOption))
|
|
|
{
|
|
|
Ies5OrderHisService ies5OrderVRow = new Ies5OrderHisService();
|
|
|
ies5OrderVRow.prodCode = orderService.prodCode;
|
|
@@ -1199,7 +1200,7 @@ namespace TEAMModelBI.Controllers.BITmid
|
|
|
if (from > 0) strQuery += $" AND c.dateTime >= {from}";
|
|
|
if (to > 0) strQuery += $" AND c.dateTime <= {to}";
|
|
|
|
|
|
- await foreach (TmidAnalysisCosmos tmidAnalysis in cosmosClientIes5.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIteratorSql<TmidAnalysisCosmos>(strQuery, null, qryOption))
|
|
|
+ await foreach (TmidAnalysisCosmos tmidAnalysis in cosmosClientIes5.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIteratorSql<TmidAnalysisCosmos>(queryText:strQuery, continuationToken:null, requestOptions:qryOption))
|
|
|
{
|
|
|
//特殊修正
|
|
|
tmidAnalysis.lTypeNone = ((tmidAnalysis.lTypeNone - tmidAnalysis.lessonLeng0) < 0) ? 0 : tmidAnalysis.lTypeNone - tmidAnalysis.lessonLeng0; //無學習型態數值須扣除未上課
|