|
@@ -641,22 +641,28 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
element.TryGetProperty("school", out JsonElement code);
|
|
|
string sname = string.Empty;
|
|
|
string areaId = string.Empty;
|
|
|
-
|
|
|
- var scquery = $"SELECT c.name,c.areaId from c where c.id = '{code}'";
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: scquery, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
- {
|
|
|
-
|
|
|
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
- if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
- {
|
|
|
- var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
- while (accounts.MoveNext())
|
|
|
- {
|
|
|
- JsonElement account = accounts.Current;
|
|
|
- sname = account.GetProperty("name").ToString();
|
|
|
- areaId = account.GetProperty("areaId").ToString();
|
|
|
- }
|
|
|
- }
|
|
|
+ School school= await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{code}", new PartitionKey("Base"));
|
|
|
+ sname = school.name;
|
|
|
+ areaId = school.areaId;
|
|
|
+ //var scquery = $"SELECT c.name,c.areaId from c where c.id = '{code}'";
|
|
|
+ //await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: scquery, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
+ //{
|
|
|
+
|
|
|
+ // using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ // if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ // {
|
|
|
+ // var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
+ // while (accounts.MoveNext())
|
|
|
+ // {
|
|
|
+ // JsonElement account = accounts.Current;
|
|
|
+ // sname = account.GetProperty("name").ToString();
|
|
|
+ // areaId = account.GetProperty("areaId").ToString();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ if (string.IsNullOrWhiteSpace(areaId)) {
|
|
|
+ await _dingDing.SendBotMsg($"校本研修生成PDF时,区级id为空\n{msg}",GroupNames.成都开发測試群組);
|
|
|
+ return;
|
|
|
}
|
|
|
foreach (string id in tIds)
|
|
|
{
|