1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414 |
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Configuration;
- using Microsoft.Extensions.Options;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using TEAMModelOS.Models;
- using TEAMModelOS.SDK.DI;
- using TEAMModelOS.SDK.Models;
- using Microsoft.Azure.Cosmos;
- using System.Text.Json;
- using TEAMModelOS.SDK.Models.Cosmos.Common;
- using TEAMModelOS.SDK.Models.Cosmos.BI;
- using Azure.Messaging.ServiceBus;
- using TEAMModelOS.SDK.Extension;
- using TEAMModelBI.Filter;
- using TEAMModelBI.Tool.Extension;
- using TEAMModelBI.Tool;
- using Azure.Storage.Blobs.Models;
- using Azure;
- using Azure.Storage.Blobs.Specialized;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Net;
- using TEAMModelOS.SDK;
- using TEAMModelOS.SDK.Context.BI;
- using System.Text;
- using Microsoft.Extensions.Hosting;
- using Microsoft.AspNetCore.Hosting;
- using TEAMModelOS.SDK.Context.Constant;
- using TEAMModelOS.SDK.Models.Service.BI;
- using TEAMModelBI.Models;
- using System.Text.RegularExpressions;
- namespace TEAMModelBI.Controllers.BINormal
- {
- [Route("batcharea")]
- [ApiController]
- public class BatchAreaController : ControllerBase
- {
- private readonly AzureCosmosFactory _azureCosmos;
- private readonly DingDing _dingDing;
- private readonly Option _option;
- private readonly AzureStorageFactory _azureStorage;
- private readonly IConfiguration _configuration;
- private readonly AzureServiceBusFactory _serviceBus;
- private readonly IHttpClientFactory _http;
- private readonly CoreAPIHttpService _coreAPIHttpService;
- private readonly IWebHostEnvironment _environment; //读取文件
- public BatchAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment)
- {
- _azureCosmos = azureCosmos;
- _dingDing = dingDing;
- _azureStorage = azureStorage;
- _option = option?.Value;
- _configuration = configuration;
- _serviceBus = serviceBus;
- _http = http;
- _coreAPIHttpService = coreAPIHttpService;
- _environment = hostingEnvironment;
- }
- /// <summary>
- /// 查询所有的区域标准 //已对接
- /// </summary>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("get-areas")]
- public async Task<IActionResult> GetArea(JsonElement jsonElement)
- {
- try
- {
- jsonElement.TryGetProperty("id", out JsonElement id);
- jsonElement.TryGetProperty("name", out JsonElement name);
- jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
- //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
- int? pageSize = 100; //默认不指定返回大小
- string continuationToken = string.Empty; //返给前端分页token
- string pageToken = default;//接受前端的分页Tolen
- bool iscontinuation = false;//是否需要进行分页查询,默认不分页
- if (jsonElement.TryGetProperty("pageSize", out JsonElement jsonPageSize))
- {
- if (!jsonPageSize.ValueKind.Equals(JsonValueKind.Undefined) && !jsonPageSize.ValueKind.Equals(JsonValueKind.Null) && jsonPageSize.TryGetInt32(out int tempPageSize))
- {
- pageSize = tempPageSize;
- }
- }
- if (pageSize != null && pageSize.Value > 0)
- {
- iscontinuation = true;
- }
- if (jsonElement.TryGetProperty("contToken", out JsonElement ContToken))
- {
- pageToken = ContToken.GetString();
- }
- List<RecArea> areas = new();
- var table = _azureStorage.GetCloudTableClient().GetTableReference("IESLogin");
- var cosmosClient = _azureCosmos.GetCosmosClient();
- ////分开部署,就不需要,一站多用时,取消注释
- //if ($"{site}".Equals(BIConst.Global))
- //{
- // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- // table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("IESLogin");
- //}
- StringBuilder areaSql = new($"select c.id,c.code,c.pk,c.shortCode,c.name,c.provCode,c.provName,c.cityCode,c.cityName,c.standard,c.standardName,c.institution,c.updateTime,c.quoteId,c.sokShortCode from c");
- if (!string.IsNullOrEmpty($"{id}") && string.IsNullOrEmpty($"{name}"))
- areaSql.Append($" where c.id='{id}'");
- if (string.IsNullOrEmpty($"{id}") && !string.IsNullOrEmpty($"{name}"))
- areaSql.Append($" where Contains(c.name,'{name}')");
-
- if (!string.IsNullOrEmpty($"{tmdId}"))
- {
- List<string> schoolIds = new();
- schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}", roles: "assist", isMany: true);
- if (schoolIds.Count > 0)
- {
- string scsSql = BICommonWay.ManyScSql("c.id", schoolIds);
- StringBuilder scAreaIdSql = new($"select distinct value(c.areaId) from c where c.pk='School'");
- scAreaIdSql.Append($" and {scsSql} and (c.areaId!='' or c.areaId!='' or IS_DEFINED(c.areaId) = false)");
- List<string> areaIds = await CommonFind.GetValueSingle(cosmosClient, "School", scAreaIdSql.ToString(), "Base");
- if (areaIds.Count > 0)
- areaSql.Append(BICommonWay.ManyScSql(" where c.id", areaIds));
- }
- }
- await foreach (var itemArea in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryStreamIteratorSql(queryText: areaSql.ToString(), continuationToken: pageToken, requestOptions: new QueryRequestOptions() { MaxItemCount = pageSize, PartitionKey = new PartitionKey("Base-Area") }))
- {
- using var json = await JsonDocument.ParseAsync(itemArea.Content);
- if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetInt16() > 0)
- {
- foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
- {
- areas.Add(obj.ToObject<RecArea>());
- }
- if (iscontinuation)
- {
- continuationToken = itemArea.ContinuationToken;
- break;
- }
- }
- }
- //areas.ForEach(async area =>
- //{
- // area.schoolCount = await CommonFind.GetSqlValueCount(cosmosClient, "School", $"select value(count(c.id)) from c where c.areaId='{area.id}' and c.standard='{area.standard}'", "Base");
- // area.aquoteRec = await table.QueryWhereString<AreaQuoteRecord>($"PartitionKey eq 'QuoteRecord' and areaId eq '{area.id}'");
- // //List<AreaQuoteRecord> aqr = await table.QueryWhereString<AreaQuoteRecord>($"PartitionKey eq 'QuoteRecord' and areaId eq '{area.id}'");
- // //aqr.Sort((x, y) => y.RowKey.CompareTo(x.RowKey));
- // await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<string>(queryText: $"select value(c.accessConfig) from c where c.id='{area.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- // {
- // if (string.IsNullOrEmpty(item))
- // area.cutArea = false;
- // else
- // area.cutArea = true;
- // };
- //});
- foreach (var area in areas)
- {
- //select value(count(c.id)) from c where c.areaId='{area.id}' and c.standard='{area.standard}'
- int baseCount = await CommonFind.GetSqlValueCount(cosmosClient, "School", $"select value(count(c.id)) from c where c.areaId='{area.id}'", "Base");
- int virtualCount = await CommonFind.GetSqlValueCount(cosmosClient, "School", $"select value(count(c.id)) from c where c.areaId='{area.id}'", "VirtualBase");
- area.schoolCount = baseCount + virtualCount;
- area.aquoteRec = await table.QueryWhereString<AreaQuoteRecord>($"PartitionKey eq 'QuoteRecord' and areaId eq '{area.id}'");
- //List<AreaQuoteRecord> aqr = await table.QueryWhereString<AreaQuoteRecord>($"PartitionKey eq 'QuoteRecord' and areaId eq '{area.id}'");
- //aqr.Sort((x, y) => y.RowKey.CompareTo(x.RowKey));
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<string>(queryText: $"select value(c.accessConfig) from c where c.id='{area.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- {
- if (string.IsNullOrEmpty(item))
- area.cutArea = false;
- else
- area.cutArea = true;
- };
- }
- return Ok(new { state = 200, areas, continuationToken });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} batcharea/get-areas \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 批量创区 新接口 //已对接
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [AuthToken(Roles = "admin,rdc")]
- [HttpPost("batch-area")]
- public async Task<IActionResult> batchArea(JsonElement jsonElement)
- {
- try
- {
- if (!jsonElement.TryGetProperty("name", out JsonElement name)) return BadRequest();
- string shortCode = (jsonElement.TryGetProperty("shortCode", out JsonElement _shortCode)) ? _shortCode.GetString() : string.Empty;
- jsonElement.TryGetProperty("provCode", out JsonElement provCode);
- jsonElement.TryGetProperty("provName", out JsonElement provName);
- jsonElement.TryGetProperty("cityCode", out JsonElement cityCode);
- jsonElement.TryGetProperty("cityName", out JsonElement cityName);
- jsonElement.TryGetProperty("areaAdmin", out JsonElement areadAdmin);
- if (!jsonElement.TryGetProperty("standard", out JsonElement standard)) return BadRequest();
- if (!jsonElement.TryGetProperty("standardName", out JsonElement standardName)) return BadRequest();
- jsonElement.TryGetProperty("institution", out JsonElement institution);
- jsonElement.TryGetProperty("oldId", out JsonElement _oldId);
- jsonElement.TryGetProperty("oldStandard", out JsonElement oldStandard);
- jsonElement.TryGetProperty("oldName", out JsonElement oldName);
- //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
- var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
- //操作记录实体
- var tempStandard = !string.IsNullOrEmpty($"{oldStandard}") && !string.IsNullOrEmpty($"{_oldId}") ? $"{oldStandard}" : "standard2";
- var cosmosClient = _azureCosmos.GetCosmosClient();//数据库连接
- var tableClient = _azureStorage.GetCloudTableClient();
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
- ServiceBusClient serBusClient;
- try
- {
- serBusClient = _serviceBus.GetServiceBusClient();
- }
- catch
- {
- return Ok(new { state = 403, msg = "Functionn未启动,请联系管理员" });
- }
- var activeTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");//秘钥地址
- var table = tableClient.GetTableReference("IESLogin");
- string queryText = $"SELECT value(c) from c ";
- queryText += $"WHERE c.standard='{standard}'";
- queryText += $" OR c.name='{name}'";
- if(!string.IsNullOrWhiteSpace(shortCode)) queryText += $" OR c.shortCode='{shortCode}'";
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Area>(queryText: $"{queryText}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
- {
- //查询新的是否存在
- if (item.standard.Equals($"{standard}"))
- return Ok(new { state = 1, message = "新创区的standard已存在请检查" });
- //查询新的区级名称是否存在
- if (item.name.Equals($"{name}"))
- return Ok(new { state = 1, message = "区级名称相同,请检测区级名称!" });
- //查询學區簡碼是否存在
- if (item.shortCode.Equals($"{shortCode}"))
- return Ok(new { state = 1, message = "此学区简码已存在请检查" });
- }
- //查询新的是否存在
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Area>(queryText: $"select value(c) from c where c.standard='{standard}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
- //{
- // if (item.standard.Equals($"{standard}"))
- // return Ok(new { state = 1, message = "新创区的standard已存在请检查" });
- //}
- //查询新的区级名称是否存在
- //await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Area>(queryText: $"select value(c) from c where c.name='{name}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
- //{
- // if (item.name.Equals($"{name}"))
- // return Ok(new { state = 1, message = "区级名称相同,请检测区级名称!" });
- //}
- //区级的ID
- string areaId = Guid.NewGuid().ToString();
- Area addArea = new()
- {
- id = areaId,
- code = $"Base-Area",
- shortCode = shortCode,
- name = $"{name}",
- provCode = $"{provCode}",
- provName = $"{provName}",
- cityCode = $"{cityCode}",
- cityName = $"{cityName}",
- standard = $"{standard}",
- standardName = $"{standardName}",
- institution = $"{institution}",
- quoteId = $"{_oldId}"
- };
- #region 区级管理员
- var coreUser = await _coreAPIHttpService.GetUserInfo(new Dictionary<string, string> { { "key", $"{areadAdmin}" } }, _option.Location, _configuration);
- if (coreUser == null || coreUser.id == null)
- return Ok(new { state = 404, msg = "未找到改账户的管理员" });
- //string tmdId = !string.IsNullOrEmpty(tempTmdId) ? tempTmdId : $"{areadAdmin}";
- Teacher teacher = null;
- try
- {
- //查询该教师是否存在
- teacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<Teacher>($"{coreUser.id}", new PartitionKey("Base"));
- }
- catch
- {
- }
- if (teacher != null)
- {
- //教师存在,在该教师信息中添加要管理的学校信息
- teacher.areas.Add(new Teacher.TeacherArea { areaId = addArea.id, status = "join", name = addArea.name });
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));
- }
- else
- {
- teacher.id = coreUser.id;
- teacher.name = coreUser.name;
- teacher.picture = coreUser.picture;
- teacher.pk = "Base";
- teacher.code = "Base";
- teacher.size = 1;
- teacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
- //教师存在,在该教师信息中添加要管理的学校信息
- teacher.areas.Add(new Teacher.TeacherArea { areaId = addArea.id, status = "join", name = addArea.name });
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<Teacher>(teacher, new PartitionKey("Base"));
- }
- #endregion
- //创建区域
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync<Area>(addArea, new PartitionKey("Base-Area"));
- //保存引用记录
- await table.SaveOrUpdate<AreaQuoteRecord>(new AreaQuoteRecord() { PartitionKey = "QuoteRecord", RowKey = $"{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}", areaId = $"{areaId}", quoteId = $"{_oldId}", quoteName = $"{oldName}", standard = tempStandard });
- //消息分区键
- string partitionCode = "copyAbility-mark";
- #region 使用Function创区
- //string areaCode = "copyArea-mark";
- //BatchCopyAreaRelevant bCopyArea = new BatchCopyAreaRelevant()
- //{
- // tmdid = $"{_tmdId}",
- // tmdName = $"{_tmdName}",
- // codeKey = areaCode,
- // tmdIds = new List<string> { $"{_tmdId}"},
- // oldStandard = $"{oldStandard}",
- // oldId = $"{_oldId}",
- // standard = $"{standard}",
- // areaId = areaId,
- // cut="",
- //};
- //var messageBatchCopyArea = new ServiceBusMessage(bCopyArea.ToJsonString());
- //messageBatchCopyArea.ApplicationProperties.Add("name", "CopyAreaRelevant");
- //var activeTaskArea = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
- //await _serviceBus.GetServiceBusClient().SendMessageAsync(activeTaskArea, messageBatchCopyArea);
- #endregion
- #region 旧的批量创区
- List<Task<ItemResponse<Ability>>> abilities = new List<Task<ItemResponse<Ability>>>(); //存储区域数据
- List<Task<ItemResponse<AbilityTask>>> abilityTasks = new List<Task<ItemResponse<AbilityTask>>>(); //存储章节
- if (!string.IsNullOrEmpty($"{oldStandard}") && !string.IsNullOrEmpty($"{_oldId}"))
- {
- //查询要复制区域的能力标准点
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{oldStandard}") }))
- {
- if (!string.IsNullOrEmpty(item.blob))
- {
- item.blob = item.blob.Replace($"/{oldStandard}/", $"/{standard}/");
- };
- item.standard = $"{standard}";
- item.code = $"Ability-{standard}";
- item.school = $"{standard}";
- //添加区能力标准点
- abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{standard}")));
- }
- try
- {
- if (abilities.Count < 256)
- {
- await Task.WhenAll(abilities);
- }
- else
- {
- int pages = (abilities.Count + 255) / 256;
- for (int i = 0; i < pages; i++)
- {
- List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
- await Task.WhenAll(tempAbility);
- }
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
- }
- try
- {
- //微能力点
- await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{oldStandard}") }))
- {
- List<Tnode> tnodes = new List<Tnode>();
- foreach (Tnode tnode in atask.children)
- {
- if (tnode.rnodes != null)
- {
- List<Rnode> rnodes = new List<Rnode>();
- foreach (Rnode rnode in tnode.rnodes)
- {
- if (!string.IsNullOrEmpty($"{rnode.link}"))
- {
- rnode.link = rnode.link.Replace($"/{oldStandard}/", $"/{standard}/");
- }
- rnodes.Add(rnode);
- }
- tnode.rnodes = rnodes;
- }
- tnodes.Add(tnode);
- }
- atask.children = tnodes;
- atask.code = $"AbilityTask-{standard}";
- atask.standard = $"{standard}";
- atask.codeval = $"{standard}";
- //添加区能力标准点中的节点
- //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{standard}")));
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{standard}"));
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准创建成功,微能力点复制失败,遗留数据影响!" });
- }
- //if (abilityTasks.Count > 0)
- //{
- // for (int i = 0; i < abilityTasks.Count; i++)
- // {
- // List<Task<ItemResponse<AbilityTask>>> tempAbilityTasks = abilityTasks.Skip((i)).Take(1).ToList();
- // await Task.WhenAll(tempAbilityTasks);
- // }
- //}
- //新政策文件
- await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<StandardFile>(queryText: $"select value(c) from c where c.id='{_oldId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
- {
- if (standardFile != null)
- {
- standardFile.standard = $"{standard}";
- standardFile.id = areaId;
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(standardFile, new PartitionKey($"StandardFile"));
- }
- }
- //新的区域设置
- await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AreaSetting>(queryText: $"select value(c) from c where c.id='{_oldId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- {
- if (areaSetting != null)
- {
- areaSetting.accessConfig = null;
- areaSetting.id = areaId;
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(areaSetting, new PartitionKey($"AreaSetting"));
- }
- }
- }
- else
- {
- Area area = null;
- await foreach (var tempArea in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Area>(queryText: $"select value(c) from c where c.standard='standard2'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
- {
- area = tempArea;
- }
- if (area != null)
- {
- //查询要复制区域的能力标准点
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{area.standard}") }))
- {
- if (!string.IsNullOrEmpty(item.blob))
- {
- item.blob = item.blob.Replace($"/{area.standard}/", $"/{standard}/");
- };
- item.standard = $"{standard}";
- item.code = $"Ability-{standard}";
- item.school = $"{standard}";
- //添加区能力标准点
- abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{standard}")));
- }
- try
- {
- if (abilities.Count < 256)
- {
- await Task.WhenAll(abilities);
- }
- else
- {
- int pages = (abilities.Count + 255) / 256;
- for (int i = 0; i < pages; i++)
- {
- List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
- await Task.WhenAll(tempAbility);
- }
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
- }
- try
- {
- //微能力点
- await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{area.standard}") }))
- {
- List<Tnode> tnodes = new List<Tnode>();
- foreach (Tnode tnode in atask.children)
- {
- if (tnode.rnodes != null)
- {
- List<Rnode> rnodes = new List<Rnode>();
- foreach (Rnode rnode in tnode.rnodes)
- {
- if (!string.IsNullOrEmpty($"{rnode.link}"))
- {
- rnode.link = rnode.link.Replace($"/{area.standard}/", $"/{standard}/");
- }
- rnodes.Add(rnode);
- }
- tnode.rnodes = rnodes;
- }
- tnodes.Add(tnode);
- }
- atask.children = tnodes;
- atask.code = $"AbilityTask-{standard}";
- atask.standard = $"{standard}";
- atask.codeval = $"{standard}";
- //添加区能力标准点中的节点
- //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{standard}")));
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{standard}"));
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准创建成功,微能力点复制失败,遗留数据影响!" });
- }
- //if (abilityTasks.Count > 0)
- //{
- // for (int i = 0; i < abilityTasks.Count; i++)
- // {
- // List<Task<ItemResponse<AbilityTask>>> tempAbilityTasks = abilityTasks.Skip(i).Take(1).ToList();
- // await Task.WhenAll(tempAbilityTasks);
- // }
- //}
- //新政策文件
- await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<StandardFile>(queryText: $"select value(c) from c where c.id='{area.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
- {
- if (standardFile != null)
- {
- standardFile.standard = $"{standard}";
- standardFile.id = areaId;
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(standardFile, new PartitionKey($"StandardFile"));
- }
- }
- //新的区域设置
- await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AreaSetting>(queryText: $"select value(c) from c where c.id='{area.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- {
- if (areaSetting != null)
- {
- areaSetting.accessConfig = null;
- areaSetting.id = areaId;
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(areaSetting, new PartitionKey($"AreaSetting"));
- }
- }
- }
- else return Ok(new { state = 201, message = "未找到默认能力点!" });
- }
- #endregion
- //执行复制操作
- //去除新建区,复制能力点文件
- //BatchCopyFile batchCopyFile = new BatchCopyFile();
- //batchCopyFile.blobCntr = "teammodelos";
- //batchCopyFile.oldFileName = $"{oldStandard}";
- //batchCopyFile.newFileName = $"{standard}";
- //batchCopyFile.tmdid = $"{_tmdId}";
- //batchCopyFile.tmdIds = new List<string> { $"{ _tmdId}" };
- //batchCopyFile.codeKey = partitionCode;
- //batchCopyFile.tmdName = $"{_tmdName}";
- //var messageBatchCopyFile = new ServiceBusMessage(batchCopyFile.ToJsonString());
- //messageBatchCopyFile.ApplicationProperties.Add("name", "CopyStandardFile");
- //try
- //{
- // await serBusClient.SendMessageAsync(activeTask, messageBatchCopyFile);
- //}
- //catch (Exception)
- //{
- // return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
- //}
- //保存操作记录
- //await _azureStorage.SaveBILog("area-add", $"{_tmdName}【{_tmdId}】已操作创区功能模块:{name},当前标准【{standard}】,复制的微能力点:{tempStandard}", _dingDing, httpContext: HttpContext);
- await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "area-add", $"{_tmdName}【{_tmdId}】已操作创区功能模块:{name},当前标准【{standard}】,复制的微能力点:{tempStandard}", _dingDing, httpContext: HttpContext);
- return Ok(new { state = 200, area = addArea });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /batcharea/batch-area \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 修改學區
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [AuthToken(Roles = "admin,rdc")]
- [HttpPost("upd-area")]
- public async Task<IActionResult> updArea(JsonElement jsonElement)
- {
- try
- {
- if (!jsonElement.TryGetProperty("id", out JsonElement _id)) return BadRequest();
- string id = _id.GetString();
- string shortCode = (jsonElement.TryGetProperty("shortCode", out JsonElement _shortCode)) ? _shortCode.GetString() : string.Empty;
- string name = (jsonElement.TryGetProperty("name", out JsonElement _name)) ? _name.GetString() : string.Empty;
- if(string.IsNullOrWhiteSpace(shortCode) && string.IsNullOrWhiteSpace(name))
- {
- return Ok(new { state = 1, message = "输入值有误,请检查输入值" });
- }
- var cosmosClient = _azureCosmos.GetCosmosClient();//数据库连接
- //學區取得
- Area area = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<Area>(id, new PartitionKey($"Base-Area"));
- //輸入值重複檢驗
- string queryText = $"SELECT value(c) from c ";
- string queryWhere = string.Empty;
- if (!string.IsNullOrWhiteSpace(name))
- {
- if (!string.IsNullOrWhiteSpace(queryWhere)) queryWhere += " OR ";
- queryWhere += $"c.name='{name}'";
- }
- if (!string.IsNullOrWhiteSpace(shortCode))
- {
- if (!string.IsNullOrWhiteSpace(queryWhere)) queryWhere += " OR ";
- queryWhere += $"c.shortCode='{shortCode}'";
- }
- queryWhere = $"WHERE ({queryWhere}) AND c.id != '{id}'";
- queryText = $"{queryText}{queryWhere}";
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Area>(queryText: $"{queryText}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
- {
- //查询区级名称是否存在
- if (item.name.Equals($"{name}"))
- return Ok(new { state = 1, message = "区级名称相同,请检测区级名称!" });
- //查询學區簡碼是否存在
- if (item.shortCode.Equals($"{shortCode}"))
- return Ok(new { state = 1, message = "此学区简码已存在请检查" });
- }
- // 檢查是否有大寫或是中文字
- if ( Regex.IsMatch(shortCode, @"[^a-z0-9]") )
- {
- return Ok(new { state = 1, message = "此区级简码必须为小写字母!" });
- }
- string sqlCheckRep = $"SELECT c.id FROM c WHERE c.shortCode = '{shortCode}'";
- var _azureCosmosClientCsv2Read = _azureCosmos.GetCosmosClient(name: "CoreServiceV2CnRead");
- //學校資料庫驗證 [式樣待確認,先封印]
- ///學區簡碼重複驗證
- //await foreach (var item in _azureCosmosClientCsv2Read.GetContainer("Core", "School").GetItemQueryStreamIteratorSql(queryText: sqlCheckRep, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("district") }))
- //{
- // using var json = await JsonDocument.ParseAsync(item.Content);
- // if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetInt16() > 0)
- // {
- // return Ok(new { state = 1, message = "此学区简码与其他 [学区] 简码相同请检查!" });
- // }
- //}
- ///學校簡碼重複驗證
- //await foreach (var item in _azureCosmosClientCsv2Read.GetContainer("Core", "School").GetItemQueryStreamIteratorSql(queryText: sqlCheckRep, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("base") }))
- //{
- // using var json = await JsonDocument.ParseAsync(item.Content);
- // if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetInt16() > 0)
- // {
- // return Ok(new { state = 1, message = "此学区简码与其他 [学校] 简码相同请检查!" });
- // }
- //}
- //DB值更新
- if (!string.IsNullOrWhiteSpace(name)) area.name = name;
- if (!string.IsNullOrWhiteSpace(shortCode)) area.shortCode = shortCode;
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<Area>(area, id);
- //保存操作记录
- var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
- var tableClient = _azureStorage.GetCloudTableClient();
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
- string BILogContent = string.Empty;
- BILogContent += $"学区ID:{id}, 更新资料: ";
- if (!string.IsNullOrWhiteSpace(name)) BILogContent += $"name:{name}, ";
- if (!string.IsNullOrWhiteSpace(shortCode)) BILogContent += $"shortCode:{shortCode}, ";
- await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "upd-area", $"{_tmdName}【{_tmdId}】已更新學區資料 {BILogContent}", _dingDing, httpContext: HttpContext);
- return Ok(new { state = 200, area = area });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} /batcharea/upd-area \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 创区后切换能力点, 先删除原来的能力点,后复制新的能力点 //已对接
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [AuthToken(Roles = "admin,rdc")]
- [HttpPost("cut-standard")]
- public async Task<IActionResult> CutStandard(JsonElement jsonElement)
- {
- try
- {
- if (!jsonElement.TryGetProperty("oldId", out JsonElement _oldId)) return BadRequest();
- if (!jsonElement.TryGetProperty("oldStandard", out JsonElement _oldStandard)) return BadRequest();
- if (!jsonElement.TryGetProperty("newId", out JsonElement _newId)) return BadRequest();
- if (!jsonElement.TryGetProperty("newStandard", out JsonElement _newStandard)) return BadRequest();
- jsonElement.TryGetProperty("newName", out JsonElement newName);
- //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
- var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
- //操作记录实体
- string blobOrTable = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
- var tableClient = _azureStorage.GetCloudTableClient();
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
- var cosmosClient = _azureCosmos.GetCosmosClient();
- var serBusClient = _serviceBus.GetServiceBusClient();
- var activeTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");//秘钥地址
- ////分开部署,就不需要,一站多用时,取消注释
- //if ($"{site}".Equals(BIConst.Global))
- //{
- // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- // tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
- // blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
- // serBusClient = _serviceBus.GetServiceBusClient(BIConst.Global); //暂未确定使用默认
- // //activeTask = _configuration.GetValue<string>("GlobalAzure:ServiceBus:ActiveTask"); //暂未确定使用默认
- //}
- var table = tableClient.GetTableReference("IESLogin");
- var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_oldId}", new PartitionKey("AreaSetting"));
- if (responseSet.StatusCode == HttpStatusCode.OK)
- {
- using var fileJson = await JsonDocument.ParseAsync(responseSet.Content);
- AreaSetting delSet = fileJson.ToObject<AreaSetting>();
- if (!string.IsNullOrEmpty(delSet.accessConfig))
- return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
- }
- //保存引用记录
- await table.SaveOrUpdate<AreaQuoteRecord>(new AreaQuoteRecord() { PartitionKey = "QuoteRecord", RowKey = $"{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}", areaId = $"{_oldId}", quoteId = $"{_newId}", quoteName = $"{newName}", standard = $"{_newStandard}" });
- List<string> abilityIds = new(); //册别的ID集合
- //查询册别信息
- await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{_oldStandard}") }))
- {
- abilityIds.Add(tempAbility.id); //查询出来册别ID添加册别ID集合
- }
- //删除册别
- if (abilityIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{_oldStandard}");
- }
- List<string> abilityTaskIds = new(); //章节ID集合
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{_oldStandard}") }))
- {
- abilityTaskIds.Add(item.id); //查询出来的章节信息ID添加到战绩集合
- }
- //删除章节
- if (abilityTaskIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityTaskIds, $"AbilityTask-{_oldStandard}");
- }
- List<Task<ItemResponse<Ability>>> abilities = new(); //存储册别数据
- List<Task<ItemResponse<AbilityTask>>> abilityTasks = new(); //存储章节
- //查询要复制区域的能力标准点
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{_newStandard}") }))
- {
- if (!string.IsNullOrEmpty(item.blob))
- {
- item.blob = item.blob.Replace($"/{_newStandard}/", $"/{_oldStandard}/");
- };
- item.standard = $"{_oldStandard}";
- item.code = $"Ability-{_oldStandard}";
- item.school = $"{_oldStandard}";
- //添加区能力标准点
- abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
- }
- try
- {
- if (abilities.Count < 256)
- {
- await Task.WhenAll(abilities);
- }
- else
- {
- int pages = (abilities.Count + 255) / 256;
- for (int i = 0; i < pages; i++)
- {
- List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
- await Task.WhenAll(tempAbility);
- }
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "能力标准点复制失败,遗留数据影响!" });
- }
- try
- {
- //微能力点
- await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{_newStandard}") }))
- {
- List<Tnode> tnodes = new();
- foreach (Tnode tnode in atask.children)
- {
- if (tnode.rnodes != null)
- {
- List<Rnode> rnodes = new();
- foreach (Rnode rnode in tnode.rnodes)
- {
- if (!string.IsNullOrEmpty($"{rnode.link}"))
- {
- rnode.link = rnode.link.Replace($"/{_newStandard}/", $"/{_oldStandard}/");
- }
- rnodes.Add(rnode);
- }
- tnode.rnodes = rnodes;
- }
- tnodes.Add(tnode);
- }
- atask.children = tnodes;
- atask.code = $"AbilityTask-{_oldStandard}";
- atask.standard = $"{_oldStandard}";
- atask.codeval = $"{_oldStandard}";
- ////添加区能力标准点中的节点
- //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}")));
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}"));
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "能力标准创建成功,微能力点复制失败,遗留数据影响!" });
- }
- StandardFile saveFile = new();
- //新政策文件
- await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<StandardFile>(queryText: $"select value(c) from c where c.id='{_newId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
- {
- if (standardFile != null)
- {
- standardFile.standard = $"{_oldStandard}";
- standardFile.id = $"{_oldId}";
- saveFile = standardFile;
- }
- }
- StandardFile tempFile = new();
- if (saveFile.id != null)
- {
- var respFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveFile.id, new PartitionKey("StandardFile"));
- if (respFile.StatusCode == HttpStatusCode.OK)
- {
- using var json = await JsonDocument.ParseAsync(respFile.Content);
- tempFile = json.ToObject<StandardFile>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<StandardFile>(tempFile.id, new PartitionKey("StandardFile"));
- }
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
- }
- //新的区域设置
- AreaSetting saveSetting = new AreaSetting();
- await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AreaSetting>(queryText: $"select value(c) from c where c.id='{_newId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- {
- if (areaSetting != null)
- {
- areaSetting.accessConfig = null;
- areaSetting.id = $"{_oldId}";
- saveSetting = areaSetting;
- }
- }
- AreaSetting tempSetting = new();
- if (saveSetting.id != null)
- {
- var respSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveSetting.id, new PartitionKey("AreaSetting"));
- if (respSetting.StatusCode == HttpStatusCode.OK)
- {
- using var json = await JsonDocument.ParseAsync(respSetting.Content);
- tempSetting = json.ToObject<AreaSetting>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<AreaSetting>(tempFile.id, new PartitionKey("AreaSetting"));
- }
- tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
- }
- //修改切换区级能力引用id
- Area area = new();
- area = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<Area>($"{_oldId}", new PartitionKey("Base-Area"));
- area.quoteId = $"{_newId}";
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<Area>(area, area.id, new PartitionKey(area.code));
- //发送消息分区键
- string partitionCode = "DelBeforeCopyAbility-mark";
- //v2通知
- Teacher targetTeacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"{_tmdId}", new PartitionKey($"Base"));
- _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "copy-file_area", Constant.NotifyType_IES5_Management, new Dictionary<string, object> { { "tmdname", $"{_tmdName}" } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
- //执行复制操作
- //去除新建区,复制能力点文件
- //BatchCopyFile batchCopyFile = new();
- //batchCopyFile.blobCntr = "teammodelos";
- //batchCopyFile.oldFileName = $"{_newStandard}";
- //batchCopyFile.newFileName = $"{_oldStandard}";
- //batchCopyFile.tmdid = $"{_tmdId}";
- //batchCopyFile.tmdIds = new List<string> { $"{ _tmdId}" };
- //batchCopyFile.codeKey = partitionCode;
- //batchCopyFile.tmdName = $"{_tmdName}";
- //var messageBatchCopyFile = new ServiceBusMessage(batchCopyFile.ToJsonString());
- //messageBatchCopyFile.ApplicationProperties.Add("name", "CopyStandardFile");
- //try
- //{
-
- // await serBusClient.SendMessageAsync(activeTask, messageBatchCopyFile); //先执行删除操作,在执行复制
- //}
- //catch (Exception)
- //{
- // return Ok(new { state = 201 ,msg = "能力点复制成功,复制能力点的文件失败," });
- //}
-
- //保存操作记录
- await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "area-cut", $"{_tmdName}【{_tmdId}】已操作【{_oldStandard}】切换至{_newStandard}微能力点,复制标准:{_newStandard}", _dingDing, httpContext: HttpContext);
- return Ok(new { state = 200 });
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} batcharea/cut-standard \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 删除区域和区域的册别、能力点、区域文件、区域设置
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [HttpPost("del-area")]
- public async Task<IActionResult> DelArea(JsonElement jsonElement)
- {
- if (!jsonElement.TryGetProperty("areaId", out JsonElement areaId)) return BadRequest();
- if (!jsonElement.TryGetProperty("standard", out JsonElement standard)) return BadRequest();
- //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "teammodelos");
- var cosmosClient = _azureCosmos.GetCosmosClient();
- ////分开部署,就不需要,一站多用时,取消注释
- //if ($"{site}".Equals(BIConst.Global))
- //{
- // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
- // blobClient = _azureStorage.GetBlobContainerClient(containerName: "teammodelos", BIConst.Global);
- //}
- var response = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{areaId}", new PartitionKey("Base-Area"));
- if (response.StatusCode == HttpStatusCode.OK)
- {
- using var json = await JsonDocument.ParseAsync(response.Content);
- Area area = json.ToObject<Area>();
- if (area.standard == $"{standard}")
- {
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<Area>(area.id, new PartitionKey("Base-Area")); //删除区
- List<Teacher> teachers = new();
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIteratorSql<Teacher>(queryText: $"SELECT distinct value(c) FROM c join a in c.areas join s in c.schools where a.areaId='{area.id}' or s.areaId='{area.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
- {
- teachers.Add(item);
- }
- foreach (var item in teachers)
- {
- var tempArea = item.areas.Find(f => f.areaId.Equals(area.id));
- if (tempArea != null)
- {
- item.areas.Remove(tempArea);
- }
- item.schools.ForEach(fe => { if (fe.areaId.Equals(area.id)) fe.areaId = ""; });
- await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(item, item.id, new PartitionKey("Base"));
- }
- List<string> scIds = await CommonFind.FindScIds(cosmosClient, $"select value(c.id) from c where c.areaId='{area.id}' and c.standard ='{area.standard}'", "Base");
- foreach (var item in scIds)
- {
- School school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>(item, new PartitionKey("Base"));
- school.areaId = "";
- school.standard = "";
- school = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<School>(school, school.id, new PartitionKey("Base"));
- }
- List<string> abilityIds = new(); //册别的ID集合
- List<string> abilityTaskIds = new(); //章节ID集合
- //查询册别信息
- await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{area.standard}") }))
- {
- abilityIds.Add(tempAbility.id); //查询出来册别ID添加册别ID集合
- }
- //删除册别
- if (abilityIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{area.standard}");
- }
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{area.standard}") }))
- {
- abilityTaskIds.Add(item.id); //查询出来的章节信息ID添加到战绩集合
- }
- //删除章节
- if (abilityTaskIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityTaskIds, $"AbilityTask-{standard}");
- }
- //区域政策文件
- StandardFile delFile = new();
- var responseFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(area.id, new PartitionKey("StandardFile"));
- if(responseFile.StatusCode == HttpStatusCode.OK)
- {
- using var fileJson = await JsonDocument.ParseAsync(responseFile.Content);
- delFile = fileJson.ToObject<StandardFile>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<StandardFile>(delFile.id, new PartitionKey("StandardFile"));
- }
- //区域设置
- AreaSetting delSet = new();
- var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(area.id, new PartitionKey("AreaSetting"));
- if (responseSet.StatusCode == HttpStatusCode.OK)
- {
- using var fileJson = await JsonDocument.ParseAsync(responseSet.Content);
- delSet = fileJson.ToObject<AreaSetting>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<AreaSetting>(delSet.id, new PartitionKey("AreaSetting"));
- }
- List<object> fileobj = new();
- //先删除原有的文件
- List<Task<Response<bool>>> DelList = new();
- await foreach (BlobItem blobItem in blobClient.GetBlobsAsync(BlobTraits.None, BlobStates.None, $"yxpt/{area.standard}/"))
- {
- fileobj.Add(blobItem.Name);
- DelList.Add(blobClient.GetBlobBaseClient(blobItem.Name).DeleteIfExistsAsync());
- }
- if (DelList.Count <= 256)
- {
- await Task.WhenAll(DelList);
- }
- else
- {
- int pages = (DelList.Count + 255) / 256;
- for (int i = 0; i < pages; i++)
- {
- List<Task<Response<bool>>> delList = DelList.Skip((i) * 256).Take(256).ToList();
- await Task.WhenAll(delList);
- }
- }
- return Ok(new { state = 200,area, scIds, abilityIds, abilityTaskIds, delFile, delSet, fileobj });
- }
- else return Ok(new { state = 400, msg = "id和standard不匹配!" });
- }
- else return Ok(new { state = 404,msg="依据Id未找到该区!" });
- }
- /// <summary>
- /// 同步两个区到新的区中
- /// </summary>
- /// <param name="jsonElement"></param>
- /// <returns></returns>
- [ProducesDefaultResponseType]
- [AuthToken(Roles = "admin")]
- [HttpPost("cut-full-statndard")]
- public async Task<IActionResult> CutFullStandard(JsonElement jsonElement)
- {
- try
- {
- string _oldId = "bde5c011-2ae4-461a-b46c-5483ba72ae45";
- //string _oldStandard = "standard27";
- string standardFileId = "02944f32-f534-3397-ea56-e6f1fc6c3714";
- string standard = "standard2";
- List<CopyStandard> copyStand = new()
- {
- new CopyStandard() { id = standardFileId, standard = standard },
- new CopyStandard() { id = "99a4a33b-e21b-44ac-80a1-b31dc40496e0", standard = "standard3" }
- };
- var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
- var tableClient = _azureStorage.GetCloudTableClient();
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
- var cosmosClient = _azureCosmos.GetCosmosClient();
- var serBusClient = _serviceBus.GetServiceBusClient();
- var activeTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");//秘钥地址
- var table = tableClient.GetTableReference("IESLogin");
- Area area = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<Area>($"{_oldId}", new PartitionKey("Base-Area"));
- if (area != null)
- {
- var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_oldId}", new PartitionKey("AreaSetting"));
- if (responseSet.StatusCode == HttpStatusCode.OK)
- {
- using var fileJson = await JsonDocument.ParseAsync(responseSet.Content);
- AreaSetting delSet = fileJson.ToObject<AreaSetting>();
- if (!string.IsNullOrEmpty(delSet.accessConfig))
- return Ok(new { state = 401, msg = "区域已经规定了,不能切换能能力" });
- }
- List<string> abilityIds = new(); //册别的ID集合
- //查询册别信息
- await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{area.standard}") }))
- {
- abilityIds.Add(tempAbility.id); //查询出来册别ID添加册别ID集合
- }
- //删除册别
- if (abilityIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityIds, $"Ability-{area.standard}");
- }
- List<string> abilityTaskIds = new List<string>(); //章节ID集合
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{area.standard}") }))
- {
- abilityTaskIds.Add(item.id); //查询出来的章节信息ID添加到战绩集合
- }
- //删除章节
- if (abilityTaskIds.IsNotEmpty())
- {
- var sresponse = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemsStreamAsync(abilityTaskIds, $"AbilityTask-{area.standard}");
- }
- List<Task<ItemResponse<Ability>>> abilities = new(); //存储册别数据
- List<Task<ItemResponse<AbilityTask>>> abilityTasks = new(); //存储章节
- List<string> repeatAbilityId = new();
- List<string> repeatAbilityTaskId = new();
- foreach (var newstand in copyStand)
- {
- try
- {
- //查询要复制区域的能力标准点
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<Ability>(queryText: $"select value(c) from c", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Ability-{newstand.standard}") }))
- {
- if (!string.IsNullOrEmpty(item.blob))
- item.blob = item.blob.Replace($"/{newstand.standard}/", $"/{area.standard}/");
- item.standard = $"{area.standard}";
- item.code = $"Ability-{area.standard}";
- item.school = $"{area.standard}";
- //添加区能力标准点
- //abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}")));
- //await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{_oldStandard}"));
- var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(item.id, new PartitionKey(item.code));
- if (respond.StatusCode != HttpStatusCode.OK)
- abilities.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(item, new PartitionKey($"Ability-{area.standard}")));
- else
- repeatAbilityId.Add(item.id);
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
- }
- try
- {
- if (abilities.Count < 256)
- {
- await Task.WhenAll(abilities);
- }
- else
- {
- int pages = (abilities.Count + 255) / 256;
- for (int i = 0; i < pages; i++)
- {
- List<Task<ItemResponse<Ability>>> tempAbility = abilities.Skip((i) * 256).Take(256).ToList();
- await Task.WhenAll(tempAbility);
- }
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准点复制失败,遗留数据影响!" });
- }
- try
- {
- //微能力点
- await foreach (var atask in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AbilityTask>(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilityTask-{newstand.standard}") }))
- {
- List<Tnode> tnodes = new();
- foreach (Tnode tnode in atask.children)
- {
- if (tnode.rnodes != null)
- {
- List<Rnode> rnodes = new();
- foreach (Rnode rnode in tnode.rnodes)
- {
- if (!string.IsNullOrEmpty($"{rnode.link}"))
- {
- rnode.link = rnode.link.Replace($"/{newstand.standard}/", $"/{area.standard}/");
- }
- rnodes.Add(rnode);
- }
- tnode.rnodes = rnodes;
- }
- tnodes.Add(tnode);
- }
- atask.children = tnodes;
- atask.code = $"AbilityTask-{area.standard}";
- atask.standard = $"{area.standard}";
- atask.codeval = $"{area.standard}";
- var respond = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(atask.id, new PartitionKey(atask.code));
- if (respond.StatusCode != HttpStatusCode.OK)
- ////添加区能力标准点中的节点
- //abilityTasks.Add(cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{_oldStandard}")));
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(atask, new PartitionKey($"AbilityTask-{area.standard}"));
- else
- repeatAbilityTaskId.Add(atask.id);
- }
- }
- catch
- {
- return Ok(new { state = 200, msg = "创区成功,能力标准创建成功,微能力点复制失败,遗留数据影响!" });
- }
- //发送消息分区键
- string partitionCode = "DelBeforeCopyAbility-mark";
- //执行复制操作
- //去除新建区,复制能力点文件
- //BatchCopyFile batchCopyFile = new();
- //batchCopyFile.blobCntr = "teammodelos";
- //batchCopyFile.oldFileName = $"{newstand.standard}";
- //batchCopyFile.newFileName = $"{area.standard}";
- //batchCopyFile.tmdid = $"{_tmdId}";
- //batchCopyFile.tmdIds = new List<string> { $"{_tmdId}" };
- //batchCopyFile.codeKey = partitionCode;
- //batchCopyFile.tmdName = $"{_tmdName}";
- //var messageBatchCopyFile = new ServiceBusMessage(batchCopyFile.ToJsonString());
- //messageBatchCopyFile.ApplicationProperties.Add("name", "CopyStandardFile");
- //try
- //{
- // //await _serviceBus.GetServiceBusClient().SendMessageAsync(activeTask, messageBatchCopyFile); //先执行删除操作,在执行复制 单一
- // await serBusClient.SendMessageAsync(activeTask, messageBatchCopyFile); //先执行删除操作,在执行复制
- //}
- //catch (Exception)
- //{
- // return Ok(new { state = 201, msg = "能力点复制成功,复制能力点的文件失败," });
- //}
- }
- StandardFile saveFile = new();
- //新政策文件
- await foreach (StandardFile standardFile in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<StandardFile>(queryText: $"select value(c) from c where c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StandardFile") }))
- {
- if (standardFile != null)
- {
- standardFile.standard = $"{area.standard}";
- standardFile.id = $"{_oldId}";
- saveFile = standardFile;
- }
- }
- StandardFile tempFile = new();
- if (saveFile.id != null)
- {
- var respFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveFile.id, new PartitionKey("StandardFile"));
- if (respFile.StatusCode == HttpStatusCode.OK)
- {
- using var json = await JsonDocument.ParseAsync(respFile.Content);
- tempFile = json.ToObject<StandardFile>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<StandardFile>(tempFile.id, new PartitionKey("StandardFile"));
- }
- tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
- }
- //if (tempFile.id != null)
- //{
- // if (tempFile.id.Equals(saveFile.id))
- // await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<StandardFile>(saveFile, saveFile.id, new PartitionKey("StandardFile")); //直接替换以前的数据
- // else
- // await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveFile, new PartitionKey($"StandardFile")); // 需要删除原来的政策文件数据在进行添加
- //}
- //新的区域设置
- AreaSetting saveSetting = new();
- await foreach (AreaSetting areaSetting in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIteratorSql<AreaSetting>(queryText: $"select value(c) from c where c.id='{standardFileId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("AreaSetting") }))
- {
- if (areaSetting != null)
- {
- areaSetting.accessConfig = null;
- areaSetting.id = $"{_oldId}";
- saveSetting = areaSetting;
- }
- }
- AreaSetting tempSetting = new();
- if (saveSetting.id != null)
- {
- var respSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync(saveSetting.id, new PartitionKey("AreaSetting"));
- if (respSetting.StatusCode == HttpStatusCode.OK)
- {
- using var json = await JsonDocument.ParseAsync(respSetting.Content);
- tempSetting = json.ToObject<AreaSetting>();
- await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").DeleteItemAsync<AreaSetting>(saveSetting.id, new PartitionKey("AreaSetting"));
- }
- tempSetting = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
- }
- //if (tempSetting.id != null)
- //{
- // if (tempSetting.id.Equals(saveSetting.id))
- // await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReplaceItemAsync<AreaSetting>(saveSetting, saveSetting.id, new PartitionKey($"AreaSetting")); //直接替换以前的数据
- // else
- // await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").CreateItemAsync(saveSetting, new PartitionKey($"AreaSetting")); //需要删除原来的区域设置数据在进行添加
- //}
- return Ok(new { state = RespondCode.Ok, repeatAbilityId, repeatAbilityTaskId });
- }
- else
- return Ok(new { state = RespondCode.NotFound, msg = "标准为空"}) ;
- }
- catch (Exception ex)
- {
- await _dingDing.SendBotMsg($"BI,{_option.Location} batcharea/cut-full-statndard \n {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
- return BadRequest();
- }
- }
- /// <summary>
- /// 区域列表
- /// </summary>
- public record RecArea
- {
- public string id { get; set; }
- public string code { get; set; }
- public string pk { get; set; }
- public string shortCode { get; set; }
- public string name { get; set; }
- public string provCode { get; set; }
- public string provName { get; set; }
- public string cityCode { get; set; }
- public string cityName { get; set; }
- public string standard { get; set; }
- public string standardName { get; set; }
- public string institution { get; set; }
- public int schoolCount { get; set; }
- public long updateTime { get; set; }
- public string quoteId { get; set; } = null;
- public bool cutArea { get; set; } = false;
- public List<AreaQuoteRecord> aquoteRec { get; set; } = new List<AreaQuoteRecord>();
- }
- }
- }
|