12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337 |
- 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;
- 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()
- {
- try
- {
- var client = _azureCosmos.GetCosmosClient();;
- //查询全部教师人数
- long teacherCount = await CommonFind.FindTotals(client, "select count(c.id) as totals from c where c.code='Base'", new List<string>() { "Teacher" });
- //查询全部教师人数
- long studentCount = await CommonFind.FindTotals(client, "select count(c.id) as totals from c where c.pk='Base'", new List<string>() { "Student" });
- //查询已创建多少学校
- long schoolCount = await CommonFind.FindTotals(client, "select count(c.id) as totals from c where c.code='Base'", new List<string>() { "School" });
- //空间
- long schoolSize = await CommonFind.FindTotals(client, "select sum(c.size) as totals from c where c.code='Base'", new List<string>() { "School" });
- return Ok(new { state = 200, teacherCount, studentCount, schoolCount, schoolSize });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-numberpeople \n {ex.Message}{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();
- 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 _azureCosmos.GetCosmosClient().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 _azureCosmos.GetCosmosClient().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 _azureCosmos.GetCosmosClient().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}{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询所有区级信息统计数据
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-alldiststics")]
- public async Task<IActionResult> GetAllDistStics()
- {
- try
- {
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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 count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher","Base");
- //查询全部学生人数
- string sqlS = $"select count(c.id) as totals from c";
- teacherCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"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}{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();
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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 count(c.id) as totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'";
- teachCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
- //查询全部学生人数
- string sqlS = $"select count(c.id) as totals from c";
- stuCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"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}{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计所有省份下的数据
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-provincestics")]
- public async Task<IActionResult> GetProvinceStics()
- {
- try
- {
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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 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");
- //查询学校学生人数
- string sqlStu = $"select count(c.id) as totals from c";
- tempCode.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"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 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");
- //查询学校学生人数
- string sqlStu = "select count(c.id) as totals from c";
- tempProvinceStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlStu, "Student", $"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}{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询所有市级下的学校数量
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-cityschool")]
- public async Task<IActionResult> GetCitySchool()
- {
- try
- {
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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 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();
- 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 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);
- }
- }
- return Ok(new { state = 200, citySchools });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI, {_option.Location} /homestatis/get-cityschool \n {ex.Message}{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();
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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 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 where c.code='Teacher-{itemSchool}' and contains(c.roles,'teacher')";
- districtStics.teacherCount += await CommonFind.FindTotals(cosmosClient, sqlT, "Teacher", "Base");
- //查询学校学生人数
- string sqlS = $"select count(c.id) as totals from c ";
- districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, sqlS, "Student", $"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} {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
- {
- var cosmosClient = _azureCosmos.GetCosmosClient();
- 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.FindTotals(cosmosClient, $"select count(c.id) totals from c join a1 in c.schools where a1.schoolId='{itemSchool}'", "Teacher", "Base");
- //查询学校学生人数
- districtStics.studentCount += await CommonFind.FindTotals(cosmosClient, "select count(c.id) totals from c", "Student", $"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.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");
- }
- 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} {ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 查询BI权限开放人数
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-sticsbipower")]
- public async Task<IActionResult> GetSticsBIPower()
- {
- try
- {
- 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();
- 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}{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计学校和教师空间类型
- /// </summary>
- /// <returns></returns>
- [HttpPost("get-datatypestics")]
- public async Task<IActionResult> GetDataTypeStics()
- {
- try
- {
- 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();
- //查询学校空间和学校Id
- totalSize = await CommonFind.FindTotals(cosmosClient, "select sum(c.size) as totals from c", "School", "Base");
- schoolId = await CommonFind.FindSchoolIds(cosmosClient, "select c.id,c.size from c", "Base");
- //查询学校已使用空间大小
- foreach (var itemId in schoolId)
- {
- await foreach (var item in _azureCosmos.GetCosmosClient().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 = _azureRedis.GetRedisClient(8).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);
- var size = await client.GetBlobsCatalogSize();
- await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", itemId, size.Item1);
- foreach (var key in size.Item2.Keys)
- {
- await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{itemId}", key);
- await _azureRedis.GetRedisClient(8).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 = _azureRedis.GetRedisClient(8).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);
- var size = await client.GetBlobsCatalogSize();
- await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", itemId, size.Item1);
- foreach (var key in size.Item2.Keys)
- {
- await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{itemId}", key);
- await _azureRedis.GetRedisClient(8).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}{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 统计教师的空间类型
- /// </summary>
- /// <returns></returns>
- [HttpPost("get-teachetypestics")]
- public async Task<IActionResult> GetTeachDataTypeStics()
- {
- try
- {
- long teacheSize = 0; //教师空间
- long sizeT = 0; //教师空间
- List<string> teacherId = new(); //教师Id集合
- Dictionary<string, long> typeStics = new(); //所有类型
- var cosmosClient = _azureCosmos.GetCosmosClient();
- //查询教师的大小和教师集合信息
- 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 = _azureRedis.GetRedisClient(8).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 _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, teacheSize, sizeT, typeStics });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /homestatis/get-datatypestics \n {ex.Message}{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; }
- }
- }
- }
|