|
@@ -113,9 +113,17 @@ namespace TEAMModelBI.Controllers.Census
|
|
|
[HttpPost("copy-infos")]
|
|
|
public async Task<IActionResult> CopyInfos(JsonElement jsonElement)
|
|
|
{
|
|
|
+ if (!jsonElement.TryGetProperty("papers", out JsonElement jsPapers)) return BadRequest();
|
|
|
|
|
|
+ List<CopyPaper> papers = jsPapers.ToObject<List<CopyPaper>>();
|
|
|
|
|
|
+ var cosmosClinet = _azureCosmos.GetCosmosClient();
|
|
|
+ foreach (var cItem in papers)
|
|
|
+ {
|
|
|
+ Paper paper = await cosmosClinet.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<Paper>(cItem.oldId, new PartitionKey($"Paper-{cItem.oldSc}"));
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
|
|
|
return Ok(new { state = RespondCode.Ok});
|
|
|
}
|
|
@@ -455,5 +463,20 @@ namespace TEAMModelBI.Controllers.Census
|
|
|
public Dictionary<string, long> yearPaper { get; set; }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public record CopyPaper
|
|
|
+ {
|
|
|
+ public string oldId { get; set; }
|
|
|
+ public string oldSc { get; set; }
|
|
|
+ public string newId { get; set; }
|
|
|
+ public string newSc { get; set; }
|
|
|
+ public string newPrdId { get; set; }
|
|
|
+ public string newSubId { get; set; }
|
|
|
+ public string newGrId { get; set; }
|
|
|
+ public string isKlogger { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|