|
@@ -280,35 +280,14 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
sticsDist.distName = itemStandrds.distName;
|
|
sticsDist.distName = itemStandrds.distName;
|
|
sticsDist.standard = itemStandrds.standard;
|
|
sticsDist.standard = itemStandrds.standard;
|
|
|
|
|
|
- //
|
|
|
|
|
|
+ //查询区级下的学校ID
|
|
string sqlTxt = $"select c.id from c where c.standard='{itemStandrds.standard}'";
|
|
string sqlTxt = $"select c.id from c where c.standard='{itemStandrds.standard}'";
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlTxt, "Base");
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlTxt, "Base");
|
|
|
|
|
|
- //List<string> schoolIds = new List<string>();
|
|
|
|
- //int schoolCount = 0;
|
|
|
|
-
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrds.standard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
sticsDist.schoolCount = schoolIds.Count;
|
|
sticsDist.schoolCount = schoolIds.Count;
|
|
|
|
|
|
int teacherCount = 0; //教师数量
|
|
int teacherCount = 0; //教师数量
|
|
int studentCount = 0; //学生数量
|
|
int studentCount = 0; //学生数量
|
|
- List<string> teacherIds = new List<string>();
|
|
|
|
-
|
|
|
|
- List<string> studentIds = new List<string>();
|
|
|
|
|
|
|
|
//查询学校下面的教师人数
|
|
//查询学校下面的教师人数
|
|
foreach (var itemSchool in schoolIds)
|
|
foreach (var itemSchool in schoolIds)
|
|
@@ -317,40 +296,9 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher","Base");
|
|
teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher","Base");
|
|
|
|
|
|
- //string sqlTeacherTxt = $"select distinct value(c) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: sqlTeacherTxt, 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;
|
|
|
|
- // //teacherIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // teacherCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
//查询全部学生人数
|
|
//查询全部学生人数
|
|
string sqlS = $"select count(c.id) as totals from c";
|
|
string sqlS = $"select count(c.id) as totals from c";
|
|
teacherCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
teacherCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
-
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- //{
|
|
|
|
- // 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;
|
|
|
|
- // //studentIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // studentCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
sticsDist.teacherCount = teacherCount;
|
|
sticsDist.teacherCount = teacherCount;
|
|
@@ -410,66 +358,8 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
stuCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
stuCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return Ok(new { state = 200, schoolCount = citySchoolCount, teacherCount = teachCount, tudentCount = stuCount });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //List<string> teacherIds = new List<string>();
|
|
|
|
- //List<string> studentIds = new List<string>();
|
|
|
|
|
|
|
|
- //foreach (var tempSatndard in areaStandard)
|
|
|
|
- //{
|
|
|
|
- // List<string> schoolIds = new List<string>();
|
|
|
|
- // await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{tempSatndard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // citySchoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // //查询学校下面的教师人数
|
|
|
|
- // foreach (var itemSchool in schoolIds)
|
|
|
|
- // {
|
|
|
|
- // //查询全部教师人数
|
|
|
|
- // await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- // teacherIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // //查询全部学生人数
|
|
|
|
- // await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- // {
|
|
|
|
- // 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;
|
|
|
|
- // studentIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- //return Ok(new { state = 200, schoolCount = citySchoolCount, teacherCount = teacherIds.Count, tudentCount = studentIds.Count });
|
|
|
|
|
|
+ return Ok(new { state = 200, schoolCount = citySchoolCount, teacherCount = teachCount, tudentCount = stuCount });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -521,21 +411,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
|
|
string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
|
|
tempCode.schoolCount += schoolIds.Count;
|
|
tempCode.schoolCount += schoolIds.Count;
|
|
- //List<string> schoolIds = new List<string>();
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandard.standard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // tempCode.schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
foreach (var itemSchool in schoolIds)
|
|
foreach (var itemSchool in schoolIds)
|
|
@@ -544,37 +420,9 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
tempCode.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
tempCode.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- // tempCode.teacherCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
//查询学校学生人数
|
|
//查询学校学生人数
|
|
string sqlStu = $"select count(c.id) as totals from c";
|
|
string sqlStu = $"select count(c.id) as totals from c";
|
|
tempCode.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"Base-{itemSchool}");
|
|
tempCode.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"Base-{itemSchool}");
|
|
-
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- //{
|
|
|
|
- // 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;
|
|
|
|
- // tempCode.studentCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -596,21 +444,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
|
|
string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
|
|
tempProvinceStics.schoolCount += schoolIds.Count;
|
|
tempProvinceStics.schoolCount += schoolIds.Count;
|
|
- //List<string> schoolIds = new List<string>();
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandard.standard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // tempProvinceStics.schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
+
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
foreach (var itemSchool in schoolIds)
|
|
foreach (var itemSchool in schoolIds)
|
|
@@ -619,37 +453,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
tempProvinceStics.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
tempProvinceStics.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- // tempProvinceStics.teacherCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
//查询学校学生人数
|
|
//查询学校学生人数
|
|
string sqlStu = "select count(c.id) as totals from c";
|
|
string sqlStu = "select count(c.id) as totals from c";
|
|
tempProvinceStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"Base-{itemSchool}");
|
|
tempProvinceStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"Base-{itemSchool}");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- //{
|
|
|
|
- // 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;
|
|
|
|
- // tempProvinceStics.studentCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -701,19 +508,6 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlTxt = $"select count(c.id) totals from c where c.standard='{itemStandrd.standard}'";
|
|
string sqlTxt = $"select count(c.id) totals from c where c.standard='{itemStandrd.standard}'";
|
|
tempCode.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
tempCode.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
- // tempCode.schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
var tempModel = citySchools.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
var tempModel = citySchools.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
if (tempModel != null)
|
|
if (tempModel != null)
|
|
{
|
|
{
|
|
@@ -728,22 +522,6 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlTxt = $"select count(c.id) totals from c where c.standard='{itemStandrd.standard}'";
|
|
string sqlTxt = $"select count(c.id) totals from c where c.standard='{itemStandrd.standard}'";
|
|
citySchool.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
citySchool.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
|
|
|
|
- //List<string> schoolIds = new List<string>();
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // citySchool.schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
citySchools.Add(citySchool);
|
|
citySchools.Add(citySchool);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -796,22 +574,6 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient,sqlTxt, "Base");
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient,sqlTxt, "Base");
|
|
districtStics.schoolCount += schoolIds.Count;
|
|
districtStics.schoolCount += schoolIds.Count;
|
|
|
|
|
|
- //List<string> schoolIds = new List<string>();
|
|
|
|
- ////查询区域学校数量
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
- // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- // districtStics.schoolCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
@@ -821,38 +583,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
string sqlT = $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
|
|
districtStics.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
districtStics.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- // districtStics.teacherCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
//查询学校学生人数
|
|
//查询学校学生人数
|
|
-
|
|
|
|
string sqlS = $"select count(c.id) as totals from c ";
|
|
string sqlS = $"select count(c.id) as totals from c ";
|
|
districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"Base-{itemSchool}");
|
|
|
|
|
|
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- //{
|
|
|
|
- // 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;
|
|
|
|
- // districtStics.studentCount += 1;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
districtSticss.Add(districtStics);
|
|
districtSticss.Add(districtStics);
|
|
@@ -880,7 +614,6 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
try
|
|
try
|
|
{
|
|
{
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
-
|
|
|
|
List<AllCityStics> tempAllCityStics = new List<AllCityStics>();
|
|
List<AllCityStics> tempAllCityStics = new List<AllCityStics>();
|
|
//查询省份区域
|
|
//查询省份区域
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select c.name,c.cityCode,c.cityName,c.standard from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select c.name,c.cityCode,c.cityName,c.standard from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
@@ -902,22 +635,24 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
var tempCode = sticsCitys.Find(x => (x.cityCode) == (itemStandrd.cityCode));
|
|
var tempCode = sticsCitys.Find(x => (x.cityCode) == (itemStandrd.cityCode));
|
|
if (tempCode != null)
|
|
if (tempCode != null)
|
|
{
|
|
{
|
|
- List<string> schoolIds = new List<string>();
|
|
|
|
|
|
+ List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.standard='{itemStandrd.standard}'", "Base");
|
|
|
|
+ tempCode.schoolCount += schoolIds.Count;
|
|
|
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
- schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- tempCode.schoolCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //List<string> schoolIds = new List<string>();
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
+ // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
+ // tempCode.schoolCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
|
|
var tempModel = sticsCitys.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
var tempModel = sticsCitys.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
if (tempModel != null)
|
|
if (tempModel != null)
|
|
@@ -935,34 +670,38 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
foreach (var itemSchool in schoolIds)
|
|
foreach (var itemSchool in schoolIds)
|
|
{
|
|
{
|
|
//查询学校教师人数
|
|
//查询学校教师人数
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- districtStics.teacherCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ districtStics.teacherCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'", "Teacher", "Base");
|
|
|
|
+
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
+ // districtStics.teacherCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
|
|
//查询学校学生人数
|
|
//查询学校学生人数
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- {
|
|
|
|
- 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;
|
|
|
|
- districtStics.studentCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Student", $"Base-{itemSchool}");
|
|
|
|
+
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
+ //{
|
|
|
|
+ // 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;
|
|
|
|
+ // districtStics.studentCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -977,21 +716,24 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
citySchool.cityCode = itemStandrd.cityCode;
|
|
citySchool.cityCode = itemStandrd.cityCode;
|
|
citySchool.cityName = itemStandrd.cityName;
|
|
citySchool.cityName = itemStandrd.cityName;
|
|
|
|
|
|
- List<string> schoolIds = new List<string>();
|
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
- schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
- citySchool.schoolCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.standard='{itemStandrd.standard}'","Base");
|
|
|
|
+ citySchool.schoolCount += schoolIds.Count;
|
|
|
|
+
|
|
|
|
+ //List<string> schoolIds = new List<string>();
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.standard='{itemStandrd.standard}'", 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;
|
|
|
|
+ // schoolIds.Add(account.GetProperty("id").GetString());
|
|
|
|
+ // citySchool.schoolCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
|
|
List<DistrictStics> tempDistrictStics = new List<DistrictStics>();
|
|
List<DistrictStics> tempDistrictStics = new List<DistrictStics>();
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
@@ -1003,34 +745,38 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
foreach (var itemSchool in schoolIds)
|
|
foreach (var itemSchool in schoolIds)
|
|
{
|
|
{
|
|
//查询学校教师人数
|
|
//查询学校教师人数
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
- districtStics.teacherCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ districtStics.teacherCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'", "Teacher", "Base");
|
|
|
|
+
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id from c join a1 in c.schools where a1.schoolId='{itemSchool}'", 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;
|
|
|
|
+ // districtStics.teacherCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
|
|
//查询学校学生人数
|
|
//查询学校学生人数
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
- {
|
|
|
|
- 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;
|
|
|
|
- districtStics.studentCount += 1;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c", "Student","Base");
|
|
|
|
+
|
|
|
|
+ //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{itemSchool}") }))
|
|
|
|
+ //{
|
|
|
|
+ // 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;
|
|
|
|
+ // districtStics.studentCount += 1;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
tempDistrictStics.Add(districtStics);
|
|
tempDistrictStics.Add(districtStics);
|
|
}
|
|
}
|
|
@@ -1038,7 +784,6 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
citySchool.districtSticss = tempDistrictStics;
|
|
citySchool.districtSticss = tempDistrictStics;
|
|
sticsCitys.Add(citySchool);
|
|
sticsCitys.Add(citySchool);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
return Ok(new { state = 200, sticsCitys });
|
|
return Ok(new { state = 200, sticsCitys });
|