|
@@ -189,13 +189,14 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
try
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- List<SticsCity> standards = new List<SticsCity>();
|
|
|
- StringBuilder stringBuder = new StringBuilder("select c.name,c.provName,c.cityName,c.standard from c");
|
|
|
+ List<SticsCity> standards = new();
|
|
|
+ StringBuilder stringBuder = new("select c.id,c.name,c.provName,c.cityName,c.standard from c");
|
|
|
//查询省份区域
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: stringBuder.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
{
|
|
|
- SticsCity sticsCity = new SticsCity
|
|
|
+ SticsCity sticsCity = new()
|
|
|
{
|
|
|
+ areaId = item.id,
|
|
|
provName = item.provName,
|
|
|
cityName = item.cityName,
|
|
|
distName = item.name,
|
|
@@ -203,20 +204,21 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
};
|
|
|
standards.Add(sticsCity);
|
|
|
}
|
|
|
- List<SticsDist> sticsDists = new List<SticsDist>();
|
|
|
+ List<SticsDist> sticsDists = new();
|
|
|
|
|
|
//查询所有下面的学校数量
|
|
|
- foreach (var itemStandrds in standards)
|
|
|
+ foreach (var itemStandrds in standards)
|
|
|
{
|
|
|
- SticsDist sticsDist = new SticsDist();
|
|
|
-
|
|
|
- sticsDist.provName = itemStandrds.provName;
|
|
|
- sticsDist.cityName = itemStandrds.cityName;
|
|
|
- sticsDist.distName = itemStandrds.distName;
|
|
|
- sticsDist.standard = itemStandrds.standard;
|
|
|
+ SticsDist sticsDist = new()
|
|
|
+ {
|
|
|
+ provName = itemStandrds.provName,
|
|
|
+ cityName = itemStandrds.cityName,
|
|
|
+ distName = itemStandrds.distName,
|
|
|
+ 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.areaId='{itemStandrds.areaId}' and c.standard='{itemStandrds.standard}'";
|
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlTxt, "Base");
|
|
|
|
|
|
sticsDist.schoolCount = schoolIds.Count;
|
|
@@ -266,7 +268,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
if(!jsonElement.TryGetProperty("cityCode", out JsonElement _cityCode)) return BadRequest();
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- List<string> areaStandard = new List<string>();
|
|
|
+ List<string> areaStandard = new();
|
|
|
//查询省份区域
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select c.name,c.cityName,c.standard from c where c.cityCode='{_cityCode}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
{
|
|
@@ -314,7 +316,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
try
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- List<ProvinceStandard> standards = new List<ProvinceStandard>();
|
|
|
+ List<ProvinceStandard> standards = new();
|
|
|
await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryStreamIterator(queryText: $"select c.provCode,c.provName,c.standard from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base-Area") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
@@ -324,7 +326,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
while (accounts.MoveNext())
|
|
|
{
|
|
|
JsonElement account = accounts.Current;
|
|
|
- ProvinceStandard provinceStandard = new ProvinceStandard
|
|
|
+ ProvinceStandard provinceStandard = new()
|
|
|
{
|
|
|
provCode = account.GetProperty("provCode").GetString(),
|
|
|
provName = account.GetProperty("provName").GetString(),
|
|
@@ -335,10 +337,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<ProvinceStics> provinceStics = new List<ProvinceStics>();
|
|
|
+ List<ProvinceStics> provinceStics = new();
|
|
|
foreach (var itemStandard in standards)
|
|
|
{
|
|
|
- ProvinceStics tempProvinceStics = new ProvinceStics();
|
|
|
+ ProvinceStics tempProvinceStics = new();
|
|
|
//ProvinceStics tempCode = new ProvinceStics();
|
|
|
var tempCode = provinceStics.Find(x => x.provCode == itemStandard.provCode);
|
|
|
if (tempCode != null)
|
|
@@ -420,12 +422,13 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
|
|
- List<CityStandard> standards = new List<CityStandard>();
|
|
|
+ List<CityStandard> standards = new();
|
|
|
//查询省份区域
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select 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.id,c.cityCode,c.cityName,c.standard from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
{
|
|
|
CityStandard Citystics = new CityStandard
|
|
|
{
|
|
|
+ areaId = item.id,
|
|
|
cityCode = item.cityCode,
|
|
|
cityName = item.cityName,
|
|
|
standard = item.standard
|
|
@@ -433,14 +436,15 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
standards.Add(Citystics);
|
|
|
}
|
|
|
|
|
|
- List<CitySchool> citySchools = new List<CitySchool>(); //返回数量
|
|
|
+ List<CitySchool> citySchools = new(); //返回数量
|
|
|
foreach (var itemStandrd in standards)
|
|
|
{
|
|
|
- CitySchool citySchool = new CitySchool();
|
|
|
+ CitySchool citySchool = new();
|
|
|
var tempCode = citySchools.Find(x => x.cityCode == itemStandrd.cityCode);
|
|
|
if (tempCode != null)
|
|
|
{
|
|
|
- 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}'";
|
|
|
+ string sqlTxt = $"select count(c.id) totals from c where c.areaId='{itemStandrd.areaId}' and c.standard='{itemStandrd.standard}'";
|
|
|
tempCode.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
|
|
|
|
var tempModel = citySchools.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
@@ -454,7 +458,8 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
citySchool.cityCode = itemStandrd.cityCode;
|
|
|
citySchool.cityName = itemStandrd.cityName;
|
|
|
|
|
|
- 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}'";
|
|
|
+ string sqlTxt = $"select count(c.id) totals from c where c.areaId='{itemStandrd.areaId}' and c.standard='{itemStandrd.standard}'";
|
|
|
citySchool.schoolCount += await CommonFind.FindTotals(cosmosClient, sqlTxt, "School", "Base");
|
|
|
|
|
|
citySchools.Add(citySchool);
|
|
@@ -483,12 +488,13 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
if (!jsonElement.TryGetProperty("cityCode", out JsonElement _cityCode)) return BadRequest();
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
|
|
- List<DistrictStandard> districtStandards = new List<DistrictStandard>();
|
|
|
+ List<DistrictStandard> districtStandards = new();
|
|
|
//查询省份区域
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select c.name,c.cityName,c.standard from c where c.cityCode='{_cityCode}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: $"select c.id,c.name,c.cityName,c.standard from c where c.cityCode='{_cityCode}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
{
|
|
|
- DistrictStandard districtStandard = new DistrictStandard
|
|
|
+ DistrictStandard districtStandard = new()
|
|
|
{
|
|
|
+ id = item.id,
|
|
|
cityName = item.cityName,
|
|
|
distName = item.name,
|
|
|
standard = item.standard
|
|
@@ -497,19 +503,21 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
districtStandards.Add(districtStandard);
|
|
|
}
|
|
|
|
|
|
- List<DistrictStics> districtSticss = new List<DistrictStics>(); //返回数据
|
|
|
+ List<DistrictStics> districtSticss = new(); //返回数据
|
|
|
|
|
|
foreach (var itemStandrd in districtStandards)
|
|
|
{
|
|
|
- DistrictStics districtStics = new DistrictStics();
|
|
|
- districtStics.cityName = itemStandrd.cityName;
|
|
|
- districtStics.distName = itemStandrd.distName;
|
|
|
+ DistrictStics districtStics = new()
|
|
|
+ {
|
|
|
+ cityName = itemStandrd.cityName,
|
|
|
+ distName = itemStandrd.distName
|
|
|
+ };
|
|
|
|
|
|
- string sqlTxt = $"select c.id from c where c.standard='{itemStandrd.standard}'";
|
|
|
+ //string sqlTxt = $"select c.id from c where c.standard='{itemStandrd.standard}'";
|
|
|
+ string sqlTxt = $"select c.id from c where c.areaId='{itemStandrd.id}' and c.standard='{itemStandrd.standard}'";
|
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient,sqlTxt, "Base");
|
|
|
districtStics.schoolCount += schoolIds.Count;
|
|
|
|
|
|
-
|
|
|
if (schoolIds.Count > 0)
|
|
|
{
|
|
|
foreach (var itemSchool in schoolIds)
|
|
@@ -551,12 +559,13 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
try
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- List<AllCityStics> tempAllCityStics = new List<AllCityStics>();
|
|
|
+ List<AllCityStics> tempAllCityStics = new();
|
|
|
//查询省份区域
|
|
|
- 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.id,c.name,c.cityCode,c.cityName,c.standard from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
|
|
|
{
|
|
|
- AllCityStics Citystics = new AllCityStics
|
|
|
+ AllCityStics Citystics = new()
|
|
|
{
|
|
|
+ id = item.id,
|
|
|
cityCode = item.cityCode,
|
|
|
cityName = item.cityName,
|
|
|
distName = item.name,
|
|
@@ -565,14 +574,15 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
tempAllCityStics.Add(Citystics);
|
|
|
}
|
|
|
|
|
|
- List<SticsCitys> sticsCitys = new List<SticsCitys>();
|
|
|
+ List<SticsCitys> sticsCitys = new();
|
|
|
foreach(var itemStandrd in tempAllCityStics)
|
|
|
{
|
|
|
- SticsCitys citySchool = new SticsCitys();
|
|
|
+ SticsCitys citySchool = new();
|
|
|
var tempCode = sticsCitys.Find(x => (x.cityCode) == (itemStandrd.cityCode));
|
|
|
if (tempCode != null)
|
|
|
{
|
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.standard='{itemStandrd.standard}'", "Base");
|
|
|
+ //List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.standard='{itemStandrd.standard}'", "Base");
|
|
|
+ List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.areaId='{itemStandrd.id}'", "Base");
|
|
|
tempCode.schoolCount += schoolIds.Count;
|
|
|
|
|
|
var tempModel = sticsCitys.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
|
|
@@ -581,10 +591,12 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
tempModel.schoolCount = tempCode.schoolCount;
|
|
|
}
|
|
|
|
|
|
- DistrictStics districtStics = new DistrictStics();
|
|
|
- districtStics.cityName = itemStandrd.cityName;
|
|
|
- districtStics.distName = itemStandrd.distName;
|
|
|
- districtStics.schoolCount = schoolIds.Count;
|
|
|
+ DistrictStics districtStics = new()
|
|
|
+ {
|
|
|
+ cityName = itemStandrd.cityName,
|
|
|
+ distName = itemStandrd.distName,
|
|
|
+ schoolCount = schoolIds.Count
|
|
|
+ };
|
|
|
|
|
|
if (schoolIds.Count > 0)
|
|
|
{
|
|
@@ -613,19 +625,21 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"select c.id from c where c.standard='{itemStandrd.standard}'","Base");
|
|
|
citySchool.schoolCount += schoolIds.Count;
|
|
|
|
|
|
- List<DistrictStics> tempDistrictStics = new List<DistrictStics>();
|
|
|
+ List<DistrictStics> tempDistrictStics = new();
|
|
|
if (schoolIds.Count > 0)
|
|
|
{
|
|
|
- DistrictStics districtStics = new DistrictStics();
|
|
|
- districtStics.cityName = itemStandrd.cityName;
|
|
|
- districtStics.distName= itemStandrd.distName;
|
|
|
- districtStics.schoolCount = schoolIds.Count;
|
|
|
+ DistrictStics districtStics = new()
|
|
|
+ {
|
|
|
+ cityName = itemStandrd.cityName,
|
|
|
+ distName = itemStandrd.distName,
|
|
|
+ schoolCount = schoolIds.Count
|
|
|
+ };
|
|
|
+
|
|
|
foreach (var itemSchool in schoolIds)
|
|
|
{
|
|
|
//查询学校教师人数
|
|
|
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");
|
|
|
|
|
|
-
|
|
|
//查询学校学生人数
|
|
|
districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, $"select count(c.id) as totals from c", "Student","Base");
|
|
|
|
|
@@ -657,15 +671,15 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- Dictionary<string, object> dic = new Dictionary<string, object> { { "PartitionKey", "authority-bi" } };
|
|
|
+ Dictionary<string, object> dic = new() { { "PartitionKey", "authority-bi" } };
|
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("SchoolSetting");
|
|
|
List<Authority> authorityBIList = await table.FindListByDict<Authority>(dic);
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- List<PowerStics> powerStics = new List<PowerStics>();
|
|
|
+ List<PowerStics> powerStics = new();
|
|
|
foreach (var temp in authorityBIList)
|
|
|
{
|
|
|
- PowerStics tempPowerStics = new PowerStics();
|
|
|
+ PowerStics tempPowerStics = new();
|
|
|
tempPowerStics.powerName = temp.Discription;
|
|
|
|
|
|
//查询学校权限
|
|
@@ -702,8 +716,8 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
long totalSize = 0; //总空间
|
|
|
long useSize = 0; //已使用空间
|
|
|
long teach = 0; //学校已经分配给所有教师的空间大小GB。
|
|
|
- Dictionary<string, long> typeStics = new Dictionary<string, long>(); //所有类型
|
|
|
- Dictionary<string, double?> typeStics1 = new Dictionary<string, double?>(); //所有类型
|
|
|
+ Dictionary<string, long> typeStics = new(); //所有类型
|
|
|
+ Dictionary<string, double?> typeStics1 = new(); //所有类型
|
|
|
|
|
|
List<string> schoolId = new List<string>();
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
@@ -735,7 +749,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Dictionary<string, double?> schoolStics = new Dictionary<string, double?>(); //学校空间
|
|
|
+ Dictionary<string, double?> schoolStics = new(); //学校空间
|
|
|
long blobsize = 0;
|
|
|
RedisValue value = default;
|
|
|
value = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", itemId);
|
|
@@ -956,8 +970,8 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
{
|
|
|
long teacheSize = 0; //教师空间
|
|
|
long sizeT = 0; //教师空间
|
|
|
- List<string> teacherId = new List<string>(); //教师Id集合
|
|
|
- Dictionary<string, long> typeStics = new Dictionary<string, long>(); //所有类型
|
|
|
+ List<string> teacherId = new(); //教师Id集合
|
|
|
+ Dictionary<string, long> typeStics = new(); //所有类型
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
|
|
//查询教师的大小和教师集合信息
|
|
@@ -1134,6 +1148,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
/// </summary>
|
|
|
public record AllCityStics
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 区域ID
|
|
|
+ /// </summary>
|
|
|
+ public string id { get; set; }
|
|
|
/// <summary>
|
|
|
/// 城市Code
|
|
|
/// </summary>
|
|
@@ -1190,6 +1208,11 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
/// </summary>
|
|
|
public record DistrictStandard()
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 区域标准
|
|
|
+ /// </summary>
|
|
|
+ public string id { get; set; }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 市名称
|
|
|
/// </summary>
|
|
@@ -1232,6 +1255,7 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
/// </summary>
|
|
|
public record CityStandard
|
|
|
{
|
|
|
+ public string areaId { get; set; }
|
|
|
/// <summary>
|
|
|
/// 城市Code
|
|
|
/// </summary>
|
|
@@ -1253,6 +1277,10 @@ namespace TEAMModelBI.Controllers.BIHome
|
|
|
/// </summary>
|
|
|
public record SticsCity
|
|
|
{
|
|
|
+ /// <summary>
|
|
|
+ /// 区域Id
|
|
|
+ /// </summary>
|
|
|
+ public string areaId { get; set; }
|
|
|
/// <summary>
|
|
|
/// 省份
|
|
|
/// </summary>
|