1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387 |
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using System.Text.Json;
- using TEAMModelOS.SDK.DI;
- using Azure.Cosmos;
- using Microsoft.Extensions.Options;
- using TEAMModelOS.SDK.Models;
- using TEAMModelOS.Models;
- using System.Text;
- using StackExchange.Redis;
- using TEAMModelOS.SDK.Extension;
- using TEAMModelBI.Tool;
- using TEAMModelOS.SDK.Context.BI;
- namespace TEAMModelBI.Controllers.BIHome
- {
- [Route("homestatis")]
- [ApiController]
- public class HomeStatisController : ControllerBase
- {
- private readonly AzureCosmosFactory _azureCosmos;
- private readonly AzureStorageFactory _azureStorage;
- private readonly DingDing _dingDing;
- private readonly Option _option;
- private readonly AzureRedisFactory _azureRedis;
- public HomeStatisController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option)
- {
- _azureCosmos = azureCosmos;
- _dingDing = dingDing;
- _option = option?.Value;
- _azureStorage = azureStorage;
- _azureRedis = azureRedis;
- }
- /// <summary>
- /// 获取全部教师数量、学生数量、已创校数量、全部学校总空间大小 //已对接
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-allnumber")]
- public async Task<IActionResult> GetAllNumber(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- var client = _azureCosmos.GetCosmosClient();;
- if ($"{site}".Equals(BIConst.Global))
- client = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- //查询全部教师人数
- long teacherCount = await CommonFind.GetSqlValueCount(client, "Teacher", "select value(count(c.id)) from c ", "Base");
- //查询全部学生人数
- long studentCount = await CommonFind.GetSqlValueCount(client, "Student", "select value(count(c.id)) from c", "Base");
- //查询已创建多少学校
- long schoolCount = await CommonFind.GetSqlValueCount(client, "School", "select value(count(c.id)) from c ", "Base");
- //空间
- long schoolSize = await CommonFind.GetSqlValueCount(client, "School", "select value(sum(c.size)) from c ", "Base");
- return Ok(new { state = 200, teacherCount, studentCount, schoolCount, schoolSize });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-numberpeople \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 获取其它类型的统计:问卷调查、评量检测、投票活动
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-othertypes")]
- public async Task<IActionResult> GetOtherTypes(JsonElement jsonElement)
- {
- try
- {
- if (!jsonElement.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- int surveyJoinCount = 0; //调查参加数量
- int surveyDoneCount = 0; //调查完成数量
- int surveyAreaJoinCount = 0; //调查区域参加数量
- int surveyAreaDoneCount = 0; //调查区域完成数量
- int examJoinCount = 0; //评量检测参加数量
- int examDoneCount = 0; //评量检测完成数量
- int examAreaJoinCount = 0; //评量检测区域参加数量
- int examAreaDoneCount = 0; //评量检测区域完成数量
- int voteJoinCount = 0; //投票参加数量
- int voteDoneCount = 0; //投票完成数量
- int voteAreaJoinCount = 0; //投票区域参加数量
- int voteAreaDoneCount = 0; //投票区域完成数量
- //问卷调查
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher")
- .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Survey' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
- {
- if (!string.IsNullOrEmpty(item.owner))
- {
- if (item.owner.Equals("school"))
- {
- surveyJoinCount += 1;
- if (item.taskStatus > 0)
- {
- surveyDoneCount += 1;
- }
- }
- else if (item.owner.Equals("area"))
- {
- surveyAreaJoinCount += 1;
- if (item.taskStatus > 0)
- {
- surveyAreaDoneCount += 1;
- }
- }
- }
- }
- //评量检测
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher")
- .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'ExamLite' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
- {
- if (!string.IsNullOrEmpty(item.owner))
- {
- if (item.owner.Equals("school"))
- {
- examJoinCount += 1;
- if (item.taskStatus > 0)
- {
- examDoneCount += 1;
- }
- }
- else if (item.owner.Equals("area"))
- {
- examAreaJoinCount += 1;
- if (item.taskStatus > 0)
- {
- examAreaDoneCount += 1;
- }
- }
- }
- }
- //投票活动
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher")
- .GetItemQueryIterator<StuActivity>(queryText: $"select c.owner, c.taskStatus from c where c.type = 'Vote' ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{_tmdid}") }))
- {
- if (!string.IsNullOrEmpty(item.owner))
- {
- if (item.owner.Equals("school"))
- {
- voteJoinCount += 1;
- if (item.taskStatus > 0)
- {
- voteDoneCount += 1;
- }
- }
- else if (item.owner.Equals("area"))
- {
- voteAreaJoinCount += 1;
- if (item.taskStatus > 0)
- {
- voteAreaDoneCount += 1;
- }
- }
- }
- }
- return Ok(new { state = 200, surveyJoinCount, surveyDoneCount, surveyAreaJoinCount, surveyAreaDoneCount, examJoinCount, examDoneCount, examAreaJoinCount, examAreaDoneCount, voteJoinCount, voteDoneCount, voteAreaJoinCount, voteAreaDoneCount });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-othertypes \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询所有区级信息统计数据
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-alldiststics")]
- public async Task<IActionResult> GetAllDistStics(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- 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()
- {
- areaId = item.id,
- provName = item.provName,
- cityName = item.cityName,
- distName = item.name,
- standard = item.standard
- };
- standards.Add(sticsCity);
- }
- List<SticsDist> sticsDists = new();
- //查询所有下面的学校数量
- foreach (var itemStandrds in standards)
- {
- 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.areaId='{itemStandrds.areaId}' and c.standard='{itemStandrds.standard}'";
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlTxt, "Base");
- sticsDist.schoolCount = schoolIds.Count;
- int teacherCount = 0; //教师数量
- int studentCount = 0; //学生数量
- //查询学校下面的教师人数
- foreach (var itemSchool in schoolIds)
- {
- //查询全部教师人数
- string sqlT = $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", sqlT, "Base");
- //查询全部学生人数
- string sqlS = $"select value(count(c.id)) from c";
- teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", sqlS, $"Base-{itemSchool}");
- }
- sticsDist.teacherCount = teacherCount;
- sticsDist.studentCount = studentCount;
- sticsDists.Add(sticsDist);
- }
- return Ok(new { state = 200, sticsDists });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-alldiststics \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 依据城市Code查询学校,教师数量,学生数量
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-citystics")]
- public async Task<IActionResult> GetCityStics(JsonElement jsonElement)
- {
- try
- {
- if(!jsonElement.TryGetProperty("cityCode", out JsonElement _cityCode)) return BadRequest();
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- 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") }))
- {
- areaStandard.Add(item.standard);
- }
- int citySchoolCount = 0;
- int teachCount = 0;
- int stuCount = 0;
- foreach (var tempSatndard in areaStandard)
- {
- string sqlSchool = $"select c.id from c where c.standard='{tempSatndard}'";
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSchool, "Base");
- citySchoolCount += schoolIds.Count;
- //查询学校下面的教师人数
- foreach (var itemSchool in schoolIds)
- {
- //查询全部教师人数
- string sqlT = $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- teachCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", sqlT, "Base");
- //查询全部学生人数
- string sqlS = $"select value(count(c.id)) from c";
- stuCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", sqlS, $"Base-{itemSchool}");
- }
- }
- return Ok(new { state = 200, schoolCount = citySchoolCount, teacherCount = teachCount, tudentCount = stuCount });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-citystics \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计所有省份下的数据 //已对接
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-provincestics")]
- public async Task<IActionResult> GetProvinceStics(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- 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);
- 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;
- ProvinceStandard provinceStandard = new()
- {
- provCode = account.GetProperty("provCode").GetString(),
- provName = account.GetProperty("provName").GetString(),
- standard = account.GetProperty("standard").GetString()
- };
- standards.Add(provinceStandard);
- }
- }
- }
- List<ProvinceStics> provinceStics = new();
- foreach (var itemStandard in standards)
- {
- ProvinceStics tempProvinceStics = new();
- //ProvinceStics tempCode = new ProvinceStics();
- var tempCode = provinceStics.Find(x => x.provCode == itemStandard.provCode);
- if (tempCode != null)
- {
- string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
- tempCode.schoolCount += schoolIds.Count;
- if (schoolIds.Count > 0)
- {
- foreach (var itemSchool in schoolIds)
- {
- //查询学校教师人数
- string sqlT = $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- tempCode.teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", sqlT, "Base");
- //查询学校学生人数
- string sqlStu = $"select value(count(c.id)) from c";
- tempCode.studentCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", sqlStu, $"Base-{itemSchool}");
- }
- }
- var tempModel = provinceStics.Where(x => x.provCode == tempCode.provCode).FirstOrDefault();
- if (tempModel != null)
- {
- tempModel.schoolCount = tempCode.schoolCount;
- tempModel.teacherCount = tempCode.teacherCount;
- tempModel.studentCount = tempCode.studentCount;
- tempModel.standardCount +=1;
- }
- }
- else
- {
- tempProvinceStics.provCode = itemStandard.provCode;
- tempProvinceStics.provName = itemStandard.provName;
- tempProvinceStics.standardCount += 1;
- string sqlSc = $"select c.id from c where c.standard='{itemStandard.standard}'";
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, sqlSc, "Base");
- tempProvinceStics.schoolCount += schoolIds.Count;
-
- if (schoolIds.Count > 0)
- {
- foreach (var itemSchool in schoolIds)
- {
- //查询学校教师人数
- string sqlT = $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- tempProvinceStics.teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", sqlT, "Base");
- //查询学校学生人数
- string sqlStu = "select value(count(c.id)) from c";
- tempProvinceStics.studentCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", sqlStu, $"Base-{itemSchool}");
- }
- }
- provinceStics.Add(tempProvinceStics);
- }
- }
- return Ok(new { state = 200, provinceStics });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-provincestics \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询所有市级下的学校数量 //已对接
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-cityschool")]
- public async Task<IActionResult> GetCitySchool(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- List<CityStandard> standards = new();
- //查询省份区域
- 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
- };
- standards.Add(Citystics);
- }
- List<CitySchool> citySchools = new(); //返回数量
- foreach (var itemStandrd in standards)
- {
- 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 value(count(c.id)) from c where c.areaId='{itemStandrd.areaId}' and c.standard='{itemStandrd.standard}'";
- tempCode.schoolCount += await CommonFind.GetSqlValueCount(cosmosClient, "School", sqlTxt, "Base");
- var tempModel = citySchools.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
- if (tempModel != null)
- {
- tempModel.schoolCount = tempCode.schoolCount;
- }
- }
- else
- {
- 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 value(count(c.id)) from c where c.areaId='{itemStandrd.areaId}' and c.standard='{itemStandrd.standard}'";
- citySchool.schoolCount += await CommonFind.GetSqlValueCount(cosmosClient, "School", sqlTxt, "Base");
- citySchools.Add(citySchool);
- }
- }
- return Ok(new { state = 200, citySchools });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-cityschool \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
-
- /// <summary>
- /// 依据市级ID查询区域(区、县、郡)的学校、教师、学生数量 //已对接
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-districtstics")]
- public async Task<IActionResult> GetDistrictStics(JsonElement jsonElement)
- {
- try
- {
- if (!jsonElement.TryGetProperty("cityCode", out JsonElement _cityCode)) return BadRequest();
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- List<DistrictStandard> districtStandards = new();
- //查询省份区域
- 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()
- {
- id = item.id,
- cityName = item.cityName,
- distName = item.name,
- standard = item.standard
- };
- districtStandards.Add(districtStandard);
- }
- List<DistrictStics> districtSticss = new(); //返回数据
- foreach (var itemStandrd in districtStandards)
- {
- 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.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)
- {
- //查询学校教师人数
- string sqlT = $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- districtStics.teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", sqlT, "Base");
- //查询学校学生人数
- string sqlS = $"select value(count(c.id)) from c ";
- districtStics.studentCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", sqlS, $"Base-{itemSchool}");
- }
- }
- districtSticss.Add(districtStics);
- }
- return Ok(new { state = 200, districtSticss });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-districtstics \n {ex.Message}\n{ex.StackTrace} ", GroupNames.成都开发測試群組);
- return BadRequest();
- }
-
- }
- /// <summary>
- /// 查询市的学校数据,以及市级下的区中的学校,教师、学生数量
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-cityallstics")]
- public async Task<IActionResult> GetCityAllStics(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- var cosmosClient = _azureCosmos.GetCosmosClient();
- if ($"{site}".Equals(BIConst.Global))
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- List<AllCityStics> tempAllCityStics = new();
- //查询省份区域
- 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()
- {
- id = item.id,
- cityCode = item.cityCode,
- cityName = item.cityName,
- distName = item.name,
- standard = item.standard
- };
- tempAllCityStics.Add(Citystics);
- }
- List<SticsCitys> sticsCitys = new();
- foreach(var itemStandrd in tempAllCityStics)
- {
- 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.areaId='{itemStandrd.id}' and c.standard='{itemStandrd.standard}'", "Base");
- tempCode.schoolCount += schoolIds.Count;
- var tempModel = sticsCitys.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
- if (tempModel != null)
- {
- tempModel.schoolCount = tempCode.schoolCount;
- }
- DistrictStics districtStics = new()
- {
- cityName = itemStandrd.cityName,
- distName = itemStandrd.distName,
- schoolCount = schoolIds.Count
- };
- if (schoolIds.Count > 0)
- {
- foreach (var itemSchool in schoolIds)
- {
- //查询学校教师人数
- districtStics.teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'", "Base");
- //查询学校学生人数
- districtStics.studentCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", "select value( count(c.id)) from c", $"Base-{itemSchool}");
- }
- }
- var tempDistrict = sticsCitys.Where(x => x.cityCode == tempCode.cityCode).FirstOrDefault();
- if (tempDistrict != null)
- {
- tempDistrict.districtSticss.Add(districtStics);
- }
- }
- else
- {
- citySchool.cityCode = itemStandrd.cityCode;
- citySchool.cityName = itemStandrd.cityName;
- 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();
- if (schoolIds.Count > 0)
- {
- DistrictStics districtStics = new()
- {
- cityName = itemStandrd.cityName,
- distName = itemStandrd.distName,
- schoolCount = schoolIds.Count
- };
- foreach (var itemSchool in schoolIds)
- {
- //查询学校教师人数
- districtStics.teacherCount += await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", $"select value(count(c.id)) from c join a1 in c.schools where a1.schoolId='{itemSchool}'", "Base");
- //查询学校学生人数
- districtStics.studentCount += await CommonFind.GetSqlValueCount(cosmosClient, "Student", $"select value(count(c.id)) from c", "Base");
- }
- tempDistrictStics.Add(districtStics);
- }
- citySchool.districtSticss = tempDistrictStics;
- sticsCitys.Add(citySchool);
- }
- }
- return Ok(new { state = 200, sticsCitys });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-cityallstics \n {ex.Message}\n{ex.StackTrace} ", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询BI权限开放人数
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-sticsbipower")]
- public async Task<IActionResult> GetSticsBIPower(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- Dictionary<string, object> dic = new() { { "PartitionKey", "authority-bi" } };
- var cosmosClient = _azureCosmos.GetCosmosClient();
- var table = _azureStorage.GetCloudTableClient().GetTableReference("SchoolSetting");
- if ($"{site}".Equals(BIConst.Global))
- {
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("SchoolSetting");
- }
- List<Authority> authorityBIList = await table.FindListByDict<Authority>(dic);
- List<PowerStics> powerStics = new();
- foreach (var temp in authorityBIList)
- {
- PowerStics tempPowerStics = new();
- tempPowerStics.powerName = temp.Discription;
- //查询学校权限
- string sqlTxt = $"SELECT DISTINCT REPLACE(c.code, 'Teacher-', '') AS schoolId, c.id, c.name FROM c WHERE ARRAY_CONTAINS(c.permissions, '{temp.RowKey}', true) AND c.pk = 'Teacher' AND c.status = 'join'";
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { }))
- {
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
- foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
- {
- tempPowerStics.powerCount += 1;
- }
- }
- powerStics.Add(tempPowerStics);
- }
- return Ok(new { state = 200, powerStics });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-sticsbipower \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计学校和教师空间类型 //已对接
- /// </summary>
- /// <returns></returns>
- [HttpPost("get-datatypestics")]
- public async Task<IActionResult> GetDataTypeStics(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- long totalSize = 0; //总空间
- long useSize = 0; //已使用空间
- long teach = 0; //学校已经分配给所有教师的空间大小GB。
- Dictionary<string, long> typeStics = new(); //所有类型
- Dictionary<string, double?> typeStics1 = new(); //所有类型
- List<string> schoolId = new();
- var cosmosClient = _azureCosmos.GetCosmosClient();
- var redisClinet = _azureRedis.GetRedisClient(8);
- if ($"{site}".Equals(BIConst.Global))
- {
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- redisClinet = _azureRedis.GetRedisClient(dbnum: 8, name: BIConst.Global);
- }
- //查询学校空间和学校Id
- totalSize = await CommonFind.GetSqlValueCount(cosmosClient, "School", "select value(sum(c.size)) from c", "Base");
- schoolId = await CommonFind.FindSchoolIds(cosmosClient, "select c.id,c.size from c", "Base");
- //查询学校已使用空间大小
- foreach (var itemId in schoolId)
- {
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: $"SELECT sum(c.size) as size FROM c ",
- requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{itemId}") }))
- {
- var json = await JsonDocument.ParseAsync(item.ContentStream);
- foreach (var elmt in json.RootElement.GetProperty("Documents").EnumerateArray())
- {
- if (elmt.TryGetProperty("size", out JsonElement _size) && _size.ValueKind.Equals(JsonValueKind.Number))
- {
- teach += _size.GetInt32();
- break;
- }
- }
- }
- long blobsize = 0;
- RedisValue value = default;
- value = redisClinet.HashGet($"Blob:Record", itemId);
- if (value != default && !value.IsNullOrEmpty)
- {
- JsonElement record = value.ToString().ToObject<JsonElement>();
- if (record.TryGetInt64(out blobsize)){}
- }
- else
- {
- var client = _azureStorage.GetBlobContainerClient(itemId);
- if ($"{site}".Equals(BIConst.Global))
- {
- client = _azureStorage.GetBlobContainerClient(containerName: itemId, name: BIConst.Global);
- }
- var size = await client.GetBlobsCatalogSize();
- await redisClinet.HashSetAsync($"Blob:Record", itemId, size.Item1);
- foreach (var key in size.Item2.Keys)
- {
- await redisClinet.SortedSetRemoveAsync($"Blob:Catalog:{itemId}", key);
- await redisClinet.SortedSetIncrementAsync($"Blob:Catalog:{itemId}", key, size.Item2[key].HasValue ? size.Item2[key].Value : 0);
- }
- useSize += size.Item1.Value;
- typeStics1 = typeStics1.Concat(size.Item2).GroupBy(g => g.Key).ToDictionary(k => k.Key, k => k.Sum(kvp => kvp.Value)); //lamebda表达式
- //typeStics1 = (from e in typeStics1.Concat(schoolStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- continue;
- }
- SortedSetEntry[] Scores = redisClinet.SortedSetRangeByScoreWithScores($"Blob:Catalog:{itemId}");
- if (Scores != null)
- {
- Dictionary<string, double?> schoolStics = new(); //学校空间
- foreach (var score in Scores)
- {
- double val = score.Score;
- string key = score.Element.ToString();
- schoolStics.Add(key, val);
- }
- useSize += blobsize;
- typeStics1 = typeStics1.Concat(schoolStics).GroupBy(g => g.Key).ToDictionary(k => k.Key, k => k.Sum(kvp => kvp.Value)); //lamebda表达式
- //typeStics1 = (from e in typeStics1.Concat(schoolStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- continue;
- }
- else
- {
- var client = _azureStorage.GetBlobContainerClient(itemId);
- if ($"{site}".Equals(BIConst.Global))
- {
- client = _azureStorage.GetBlobContainerClient(containerName: itemId, name: BIConst.Global);
- }
- var size = await client.GetBlobsCatalogSize();
- await redisClinet.HashSetAsync($"Blob:Record", itemId, size.Item1);
- foreach (var key in size.Item2.Keys)
- {
- await redisClinet.SortedSetRemoveAsync($"Blob:Catalog:{itemId}", key);
- await redisClinet.SortedSetIncrementAsync($"Blob:Catalog:{itemId}", key, size.Item2[key].HasValue ? size.Item2[key].Value : 0);
- }
- useSize += size.Item1.Value;
- typeStics1 = typeStics1.Concat(size.Item2).GroupBy(g => g.Key).ToDictionary(k => k.Key, k => k.Sum(kvp => kvp.Value)); //lamebda表达式
- //typeStics1 = (from e in typeStics1.Concat(schoolStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- continue;
- }
- ////RedisValue value = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", itemId);
- //if (!value.IsNullOrEmpty)
- //{
- // useSize += Convert.ToInt64(value);
- // //JsonElement record = value.ToString().ToObject<JsonElement>();
- // //long tempSize = 0;
- // //if (record.TryGetInt64(out tempSize))
- // //{
- // // sizeS += tempSize;
- // //}
- //}
- //else
- //{
- // var client = _azureStorage.GetBlobContainerClient(itemId);
- // var size = await client.GetBlobsCatalogSize();
- // var temp = await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", itemId, size.Item1);
- // foreach (var itemKey in size.Item2.Keys)
- // {
- // var temp1 = await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{itemId}", itemKey);
- // var temp2 = await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Blob:Catalog:{itemId}", itemKey, size.Item2[itemKey].HasValue ? size.Item2[itemKey].Value : 0);
- // useSize += Convert.ToInt64(temp2);
- // }
- //}
- //SortedSetEntry[] sortedSetEntries = await _azureRedis.GetRedisClient(8).SortedSetRangeByRankWithScoresAsync($"Blob:Catalog:{itemId}");
- //if (sortedSetEntries != null)
- //{
- // foreach (var tempSorted in sortedSetEntries)
- // {
- // if (typeStics.TryGetValue($"{tempSorted.Element}", out long val))
- // typeStics[$"{tempSorted.Element}"] = Convert.ToInt64(tempSorted.Score) != 0 ? val + Convert.ToInt64(tempSorted.Score) : 0;
- // else
- // typeStics.Add($"{tempSorted.Element}", Convert.ToInt64(tempSorted.Score));
- // }
- //}
- }
-
- ////教师数据
- //List<string> teacherId = new List<string>(); //教师Id集合
- ////查询教师的大小和教师集合信息
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id,c.size from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
- //{
- // using var json = await JsonDocument.ParseAsync(item.ContentStream);
- // foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
- // {
- // totalSize += obj.GetProperty("size").GetInt64();
- // teacherId.Add(obj.GetProperty("id").GetString());
- // }
- //}
- ////查询教师已使用空间大小
- //foreach (var itemTeach in teacherId)
- //{
- // Dictionary<string, double?> teachStics = new Dictionary<string, double?>(); //学校空间
- // long blobsize = 0;
- // RedisValue value = default;
- // value = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", itemTeach);
- // if (value != default && !value.IsNullOrEmpty)
- // {
- // JsonElement record = value.ToString().ToObject<JsonElement>();
- // if (record.TryGetInt64(out blobsize))
- // {
- // }
- // }
- // else
- // {
- // var client = _azureStorage.GetBlobContainerClient(itemTeach);
- // var size = await client.GetBlobsCatalogSize();
- // await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", itemTeach, size.Item1);
- // foreach (var key in size.Item2.Keys)
- // {
- // await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{itemTeach}", key);
- // await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Blob:Catalog:{itemTeach}", key, size.Item2[key].HasValue ? size.Item2[key].Value : 0);
- // }
- // useSize += (long)size.Item1;
- // teachStics = size.Item2;
- // typeStics1 = (from e in typeStics1.Concat(teachStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- // continue;
- // }
- // SortedSetEntry[] Scores = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Blob:Catalog:{itemTeach}");
- // if (Scores != null)
- // {
- // foreach (var score in Scores)
- // {
- // double val = score.Score;
- // string key = score.Element.ToString();
- // teachStics.Add(key, val);
- // }
- // useSize += blobsize;
- // typeStics1 = (from e in typeStics1.Concat(teachStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- // continue;
- // }
- // else
- // {
- // var client = _azureStorage.GetBlobContainerClient(itemTeach);
- // var size = await client.GetBlobsCatalogSize();
- // await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", itemTeach, size.Item1);
- // foreach (var key in size.Item2.Keys)
- // {
- // await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{itemTeach}", key);
- // await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Blob:Catalog:{itemTeach}", key, size.Item2[key].HasValue ? size.Item2[key].Value : 0);
- // }
- // useSize += (long)size.Item1;
- // teachStics = size.Item2;
- // typeStics1 = (from e in typeStics1.Concat(teachStics) group e by e.Key into g select new { Name = g.Key, Count = g.Sum(kvp => kvp.Value) }).ToDictionary(item => item.Name, item => item.Count);
- // continue;
- // }
- // //RedisValue tempValue = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", itemTeach);
- // //if (!tempValue.IsNullOrEmpty)
- // //{
- // // useSize += Convert.ToInt64(tempValue);
- // // //JsonElement record = tempValue.ToString().ToObject<JsonElement>();
- // // //long tempSize = 0;
- // // //if (record.TryGetInt64(out tempSize))
- // // //{
- // // // sizeT += tempSize;
- // // //}
- // //}
- // //SortedSetEntry[] tempSorted = await _azureRedis.GetRedisClient(8).SortedSetRangeByRankWithScoresAsync($"Blob:Catalog:{itemTeach}");
- // //if (tempSorted != null)
- // //{
- // // foreach (var itemSorted in tempSorted)
- // // {
- // // if (typeStics.TryGetValue($"{itemSorted.Element}", out long val))
- // // typeStics[$"{itemSorted.Element}"] = Convert.ToInt64(itemSorted.Score) != 0 ? val + Convert.ToInt64(itemSorted.Score) : 0;
- // // else
- // // typeStics.Add($"{itemSorted.Element}", Convert.ToInt64(itemSorted.Score));
- // // }
- // //}
- //}
- return Ok(new { state = 200, totalSize, teach, useSize, stics = typeStics1.ToList() });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-datatypestics \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计教师的空间类型
- /// </summary>
- /// <returns></returns>
- [HttpPost("get-teachetypestics")]
- public async Task<IActionResult> GetTeachDataTypeStics(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("site", out JsonElement site);
- long teacheSize = 0; //教师空间
- long sizeT = 0; //教师空间
- List<string> teacherId = new(); //教师Id集合
- Dictionary<string, long> typeStics = new(); //所有类型
- var cosmosClient = _azureCosmos.GetCosmosClient();
- var redisClinet = _azureRedis.GetRedisClient(8);
- if ($"{site}".Equals(BIConst.Global))
- {
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- redisClinet = _azureRedis.GetRedisClient(dbnum: 8, name: BIConst.Global);
- }
- //查询教师的大小和教师集合信息
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryStreamIterator(queryText: $"select c.id,c.size from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
- {
- using var json = await JsonDocument.ParseAsync(item.ContentStream);
- foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
- {
- teacheSize += obj.GetProperty("size").GetInt64();
- teacherId.Add(obj.GetProperty("id").GetString());
- }
- }
- //查询教师已使用空间大小
- foreach (var itemTeach in teacherId)
- {
- RedisValue tempValue = redisClinet.HashGet($"Blob:Record", itemTeach);
- if (!tempValue.IsNullOrEmpty)
- {
- sizeT += Convert.ToInt64(tempValue);
- //JsonElement record = tempValue.ToString().ToObject<JsonElement>();
- //long tempSize = 0;
- //if (record.TryGetInt64(out tempSize))
- //{
- // sizeT += tempSize;
- //}
- }
- SortedSetEntry[] tempSorted = await redisClinet.SortedSetRangeByRankWithScoresAsync($"Blob:Catalog:{itemTeach}");
- if (tempSorted != null)
- {
- foreach (var itemSorted in tempSorted)
- {
- if (typeStics.TryGetValue($"{itemSorted.Element}", out long val))
- typeStics[$"{itemSorted.Element}"] = Convert.ToInt64(itemSorted.Score) != 0 ? val + Convert.ToInt64(itemSorted.Score) : 0;
- else
- typeStics.Add($"{itemSorted.Element}", Convert.ToInt64(itemSorted.Score));
- }
- }
- }
- return Ok(new { state = 200, teacheSize, sizeT, typeStics });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-datatypestics \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 存放的类型
- /// </summary>
- public record AllDataType
- {
- public long vote { get; set; }/// 投票josn
- public long thum { get; set; }//视频和封面缩略图
- public long avatar { get; set; }//学生头像
- public long test { get; set; }//
- public long survey { get; set; }//问卷调查 josn
- public long image { get; set; }// PNG
- public long other { get; set; }//其他
- public long doc { get; set; }//文档
- public long homework { get; set; }//作业 json
- public long item { get; set; }// 题库 json
- public long paper { get; set; }//试卷 json
- public long train { get; set; }// 研修
- public long res { get; set; }// 教程 htx
- public long exam { get; set; }//评测 json
- public long syllabus { get; set; }// 课纲 json
- public long video { get; set; }// 视频
- public long yxpt { get; set; }//研修平台
- public long jyzx { get; set; }// 教研中心
- public long records { get; set; } //HiTeach上传的数据
- }
- /// <summary>
- /// 省的数据标准
- /// </summary>
- public record ProvinceStics
- {
- /// <summary>
- /// 省份ID
- /// </summary>
- public string provCode { get; set; }
- /// <summary>
- /// 省份名称
- /// </summary>
- public string provName { get; set; }
- /// <summary>
- /// 省份下的方案数量
- /// </summary>
- public int standardCount { get; set; }
- /// <summary>
- /// 省份下的学校
- /// </summary>
- public int schoolCount { get; set; }
- /// <summary>
- /// 省份下的教师数量
- /// </summary>
- public int teacherCount { get; set; }
- /// <summary>
- /// 省份下的学生数量
- /// </summary>
- public int studentCount { get; set; }
- }
- /// <summary>
- /// 省以下的区域标准
- /// </summary>
- public record ProvinceStandard
- {
- /// <summary>
- /// 城市Code
- /// </summary>
- public string provCode { get; set; }
- /// <summary>
- /// 城市名称
- /// </summary>
- public string provName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- }
- public record PowerStics
- {
- public string powerName { get; set; }
- public int powerCount { get; set; }
- }
- /// <summary>
- /// 市的学校数据,及以下数据
- /// </summary>
- public record SticsCitys
- {
- /// <summary>
- /// 市级Code
- /// </summary>
- public string cityCode { get; set; }
- /// <summary>
- /// 市级名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 学校数量
- /// </summary>
- public int schoolCount { get; set; }
- /// <summary>
- /// 市级下的区域,学校、
- /// </summary>
- public List<DistrictStics> districtSticss { get; set; }
- }
- /// <summary>
- /// 所有区域标准
- /// </summary>
- public record AllCityStics
- {
- /// <summary>
- /// 区域ID
- /// </summary>
- public string id { get; set; }
- /// <summary>
- /// 城市Code
- /// </summary>
- public string cityCode { get; set; }
- /// <summary>
- /// 城市名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 区名称
- /// </summary>
- public string distName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- }
- /// <summary>
- /// 统计区域数量
- /// </summary>
- public record DistrictStics
- {
- /// <summary>
- /// 市级名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 地区名称
- /// </summary>
- public string distName { get; set; }
- /// <summary>
- /// 学校数量
- /// </summary>
- public int schoolCount { get; set; }
- /// <summary>
- /// 教师数量
- /// </summary>
- public int teacherCount { get; set; }
- /// <summary>
- /// 学生数量
- /// </summary>
- public int studentCount { get; set; }
- }
- /// <summary>
- /// 区域标准
- /// </summary>
- public record DistrictStandard()
- {
- /// <summary>
- /// 区域标准
- /// </summary>
- public string id { get; set; }
- /// <summary>
- /// 市名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 区域名称
- /// </summary>
- public string distName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- }
- /// <summary>
- /// 市级学校数量
- /// </summary>
- public record CitySchool
- {
- /// <summary>
- /// 市级ID
- /// </summary>
- public string cityCode { get; set; }
- /// <summary>
- /// 市级名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 市级学校数量
- /// </summary>
- public int schoolCount { get; set;}
- }
- /// <summary>
- /// 市级信息标准
- /// </summary>
- public record CityStandard
- {
- public string areaId { get; set; }
- /// <summary>
- /// 城市Code
- /// </summary>
- public string cityCode { get; set; }
- /// <summary>
- /// 城市名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- }
- /// <summary>
- /// 区域
- /// </summary>
- public record SticsCity
- {
- /// <summary>
- /// 区域Id
- /// </summary>
- public string areaId { get; set; }
- /// <summary>
- /// 省份
- /// </summary>
- public string provName { get; set; }
- /// <summary>
- /// 市名称
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 区域名称
- /// </summary>
- public string distName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- }
- /// <summary>
- /// 返回统计数据
- /// </summary>
- public record SticsDist
- {
- /// <summary>
- /// 省份
- /// </summary>
- public string provName { get; set; }
- /// <summary>
- /// 市名
- /// </summary>
- public string cityName { get; set; }
- /// <summary>
- /// 区域标准名称
- /// </summary>
- public string distName { get; set; }
- /// <summary>
- /// 区域标准
- /// </summary>
- public string standard { get; set; }
- /// <summary>
- /// 学校数量
- /// </summary>
- public int schoolCount { get; set; }
- /// <summary>
- /// 教师人数
- /// </summary>
- public int teacherCount { get; set; }
- /// <summary>
- /// 学生人数
- /// </summary>
- public int studentCount { get; set; }
- }
- }
- }
|