|
@@ -21,6 +21,7 @@ using TEAMModelOS.Models;
|
|
|
using TEAMModelOS.SDK;//引用创建学校Code
|
|
|
using TEAMModelOS.SDK.Context.Attributes.Azure;
|
|
|
using TEAMModelOS.SDK.DI;
|
|
|
+using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
|
|
|
using TEAMModelOS.SDK.Models;
|
|
|
using TEAMModelOS.SDK.Models.Cosmos.BI;
|
|
@@ -53,6 +54,90 @@ namespace TEAMModeBI.Controllers.BITest
|
|
|
_configuration = configuration;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 删除册别,删除章节 创区
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="jsonElement"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("del-standard")]
|
|
|
+ public async Task<IActionResult> DelStandard(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (!jsonElement.TryGetProperty("oldStandard", out JsonElement _oldStandard)) return BadRequest();
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+
|
|
|
+ List<string> abilityIds = new List<string>(); //册别的ID集合
|
|
|
+
|
|
|
+ //查询册别信息
|
|
|
+ await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<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 List<string>(); //章节ID集合
|
|
|
+
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<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}");
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(new { state = 200 });
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpPost("get-query")]
|
|
|
+ public async Task<IActionResult> QueryTest(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (!jsonElement.TryGetProperty("oldId", out JsonElement oldId)) return BadRequest();
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+
|
|
|
+ StandardFile tempFile = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //tempFile = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>($"{oldId}", new PartitionKey("StandardFile"));
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<StandardFile>(queryText: $"select value(c) from c where c.id='{oldId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("StandardFile") }))
|
|
|
+ {
|
|
|
+ tempFile = item;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception ex)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(new { state = 200, tempFile });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public async Task<IActionResult> DelSchool(JsonElement jsonElement)
|
|
|
+ {
|
|
|
+ if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
|
+
|
|
|
+ List<string> ids = schoolId.ToObject<List<string>>();
|
|
|
+
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+
|
|
|
+ string sql = $"select value(v) from c";
|
|
|
+
|
|
|
+ return Ok(new { state = 200 });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询学校
|
|
|
/// </summary>
|
|
@@ -195,7 +280,6 @@ namespace TEAMModeBI.Controllers.BITest
|
|
|
//string Str_char1 = GenerateRandom.Str_char(1, true);
|
|
|
|
|
|
CreateSchoolInfo data = await SchoolCode.GenerateSchoolCode(createSchoolInfo, _dingDing, _environment);
|
|
|
- string temp = null;
|
|
|
return Ok(new { state = 200, data, data.id });
|
|
|
}
|
|
|
|
|
@@ -598,46 +682,7 @@ namespace TEAMModeBI.Controllers.BITest
|
|
|
return Ok(new { pageTests1 });
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 删除册别,删除章节
|
|
|
- /// </summary>
|
|
|
- /// <param name="jsonElement"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost("del-standard")]
|
|
|
- public async Task<IActionResult> DelStandard(JsonElement jsonElement)
|
|
|
- {
|
|
|
- if (!jsonElement.TryGetProperty("oldStandard", out JsonElement _oldStandard)) return BadRequest();
|
|
|
- var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
-
|
|
|
- List<string> abilityIds = new List<string>(); //册别的ID集合
|
|
|
-
|
|
|
- //查询册别信息
|
|
|
- await foreach (var tempAbility in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<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 List<string>(); //章节ID集合
|
|
|
- foreach (var abilityId in abilityIds)
|
|
|
- {
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AbilityTask>(queryText: $"select value(c) from c where c.abilityId='{abilityId}'", 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}");
|
|
|
- }
|
|
|
-
|
|
|
- return Ok(new { state = 200 });
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存日志文件
|