|
@@ -108,7 +108,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
List<NotAreaSchool> tempNotAreaSchools = new();
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorSql(queryText: sqltxt.ToString(), continuationToken: pageToken, requestOptions: new QueryRequestOptions() { MaxItemCount = pageSize, PartitionKey = new PartitionKey("Base") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
@@ -188,7 +188,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorSql(queryText: sqltxt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{pk}") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
@@ -277,7 +277,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_areaId}", new PartitionKey("AreaSetting"));
|
|
|
if (responseSet.Status == 200)
|
|
|
{
|
|
|
- using var fileJson = await JsonDocument.ParseAsync(responseSet.ContentStream);
|
|
|
+ using var fileJson = await JsonDocument.ParseAsync(responseSet.Content);
|
|
|
AreaSetting delSet = fileJson.ToObject<AreaSetting>();
|
|
|
if (!string.IsNullOrEmpty(delSet.accessConfig))
|
|
|
return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
|
|
@@ -378,7 +378,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(schoolAssists.id, new PartitionKey("ProductSum"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
if (json.RootElement.TryGetProperty("serial", out JsonElement serial) && !serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
{
|
|
|
schoolAssists.serial = serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
@@ -501,14 +501,14 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(sid, new PartitionKey("Base"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
school = json.ToObject<School>();
|
|
|
}
|
|
|
|
|
|
long teach = 0;
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorSql(queryText: $"SELECT sum(c.size) as size FROM c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{sid}") }))
|
|
|
{
|
|
|
- var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
foreach (var elmt in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
if (elmt.TryGetProperty("size", out JsonElement _size) && _size.ValueKind.Equals(JsonValueKind.Number))
|
|
@@ -769,7 +769,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
|
|
|
if (resScInfo.Status == 200)
|
|
|
{
|
|
|
- using var tchJson = await JsonDocument.ParseAsync(resScInfo.ContentStream);
|
|
|
+ using var tchJson = await JsonDocument.ParseAsync(resScInfo.Content);
|
|
|
School scInfo = tchJson.ToObject<School>();
|
|
|
areaId = scInfo.areaId;
|
|
|
}
|
|
@@ -782,7 +782,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var resTeacher = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Base"));
|
|
|
if (resTeacher.Status == 200)
|
|
|
{
|
|
|
- using var tchJson = await JsonDocument.ParseAsync(resTeacher.ContentStream);
|
|
|
+ using var tchJson = await JsonDocument.ParseAsync(resTeacher.Content);
|
|
|
teacher = tchJson.ToObject<Teacher>();
|
|
|
|
|
|
var existArea = teacher.schools.Find(f => f.schoolId.Equals($"{schoolId}"));
|
|
@@ -813,7 +813,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Teacher-{schoolId}"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
schoolTeacher = json.ToObject<SchoolTeacher>();
|
|
|
if (!schoolTeacher.roles.Contains("admin"))
|
|
|
{
|
|
@@ -895,7 +895,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync($"{tmdId}", new PartitionKey("Base"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
Teacher teacher = json.ToObject<Teacher>();
|
|
|
teacher.schools.RemoveAll(s => scIds.Contains(s.schoolId));
|
|
|
await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));
|
|
@@ -916,7 +916,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
scTeacher = json.ToObject<SchoolTeacher>();
|
|
|
if (scTeacher.roles.Contains("admin"))
|
|
|
{
|
|
@@ -970,7 +970,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var resTeacher = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Base"));
|
|
|
if (resTeacher.Status == 200)
|
|
|
{
|
|
|
- using var tchJson = await JsonDocument.ParseAsync(resTeacher.ContentStream);
|
|
|
+ using var tchJson = await JsonDocument.ParseAsync(resTeacher.Content);
|
|
|
teacher = tchJson.ToObject<Teacher>();
|
|
|
}
|
|
|
else
|
|
@@ -999,7 +999,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Teacher-{school.id}"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
schoolTeacher = json.ToObject<SchoolTeacher>();
|
|
|
if (!schoolTeacher.roles.Contains("admin"))
|
|
|
{
|
|
@@ -1134,7 +1134,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var tchBaseResponse = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync($"{item}", new PartitionKey("Base"));
|
|
|
if (tchBaseResponse.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(tchBaseResponse.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(tchBaseResponse.Content);
|
|
|
Teacher teacher = json.ToObject<Teacher>();
|
|
|
var tempSc = teacher.schools.Find(f => f.schoolId.Equals($"{tempId}"));
|
|
|
if (tempSc != null)
|
|
@@ -1269,7 +1269,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(schoolInfo.id, new PartitionKey("ProductSum"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
if (json.RootElement.TryGetProperty("serial", out JsonElement serial) && !serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
schoolInfo.serial = serial.ToObject<List<ProductSumInfos>>();
|
|
|
|
|
@@ -1346,7 +1346,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
recSchool = json.ToObject<RecSchool>();
|
|
|
}
|
|
|
else return Ok(new { state = RespondCode.NotFound, msg = "未找到该学校" });
|
|
@@ -1866,7 +1866,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
school = json.ToObject<AnSchool>();
|
|
|
}
|
|
|
else return Ok(new { state = RespondCode.NotFound, msg = "未找到该学校" });
|
|
@@ -1885,7 +1885,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var responseProduct = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(school.id, new PartitionKey("ProductSum"));
|
|
|
if (responseProduct.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(responseProduct.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(responseProduct.Content);
|
|
|
if (json.RootElement.TryGetProperty("serial", out JsonElement _serial) && !_serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
{
|
|
|
school.serial = _serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
@@ -1988,7 +1988,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(scProd.id, new PartitionKey("ProductSum"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
if (json.RootElement.TryGetProperty("serial", out JsonElement serial) && !serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
{
|
|
|
List<string> serials = serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
@@ -2015,7 +2015,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
// var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(scProd.id, new PartitionKey("ProductSum"));
|
|
|
// if (response.Status == 200)
|
|
|
// {
|
|
|
- // using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ // using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
// if (json.RootElement.TryGetProperty("serial", out JsonElement serial) && !serial.ValueKind.Equals(JsonValueKind.Null))
|
|
|
// {
|
|
|
// scProd.serial = serial.ToObject<List<SchoolProductSumData>>().Select(x => x.prodCode).ToList();
|
|
@@ -2063,7 +2063,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
|
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIteratorSql(queryText: sqlTxt.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
@@ -2109,7 +2109,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIteratorSql(queryText: $"SELECT sum(c.size) as size FROM c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school}") }))
|
|
|
{
|
|
|
- var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
foreach (var elmt in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
if (elmt.TryGetProperty("size", out JsonElement _size) && _size.ValueKind.Equals(JsonValueKind.Number))
|
|
@@ -2419,7 +2419,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var response = await db.ReadItemStreamAsync(school_code.ToString(), new PartitionKey($"ProductSum"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
productSum = json.ToObject<SchoolProductSum>();
|
|
|
prodinfo = productSum.prodinfo;
|
|
|
serviceSum = productSum.service;
|
|
@@ -2431,7 +2431,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
string serialQueryText = $"SELECT * FROM c WHERE c.dataType = 'serial' AND ARRAY_CONTAINS({serialPermitJsonStr}, c.prodCode)";
|
|
|
await foreach (var itemsr in db.GetItemQueryStreamIteratorSql(queryText: serialQueryText, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Product-{school_code}") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(itemsr.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(itemsr.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
deviceForCoreService uuidForCore;
|
|
@@ -2447,7 +2447,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
SchoolProductSum schoolProductSum;
|
|
|
await foreach (var items in db.GetItemQueryStreamIteratorSql(queryText: $"SELECT * FROM c WHERE c.id = '{school_code}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ProductSum") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(items.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(items.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
@@ -2474,7 +2474,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
//硬體
|
|
|
await foreach (var itemhd in db.GetItemQueryStreamIteratorSql(queryText: $"SELECT * FROM c WHERE c.dataType = 'hard'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Product-{school_code}") }))
|
|
|
{
|
|
|
- using var json = await JsonDocument.ParseAsync(itemhd.ContentStream);
|
|
|
+ using var json = await JsonDocument.ParseAsync(itemhd.Content);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
@@ -2490,7 +2490,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
var querysp = $"SELECT SUM(c.size) as size FROM c";
|
|
|
await foreach (var item in db.GetItemQueryStreamIteratorSql(queryText: querysp, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school_code}") }))
|
|
|
{
|
|
|
- var jsonts = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ var jsonts = await JsonDocument.ParseAsync(item.Content);
|
|
|
foreach (var obj in jsonts.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
{
|
|
|
teach = obj.GetProperty("size").GetInt64() * 1073741824; //G換算
|