|
@@ -27,6 +27,7 @@ using Microsoft.AspNetCore.Authorization;
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.CreateApplyForSubjectApplymentRequest.Types;
|
|
|
using TEAMModelOS.SDK.Models.Cosmos.Student;
|
|
|
+using TEAMModelOS.Controllers.Analysis;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -168,6 +169,50 @@ namespace TEAMModelOS.Controllers
|
|
|
await ArtService.GenArtPDF(studentIds, $"{_artId}", $"{_schoolId}", head_lang, _serviceBus, _configuration);
|
|
|
return Ok(new {code=0,msg="加入PDF报告生成队列中。" });
|
|
|
}
|
|
|
+
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
+ //[AuthToken(Roles = "teacher,admin")]
|
|
|
+ [HttpPost("get-pdf")]
|
|
|
+ public async Task<IActionResult> getPdf(JsonElement request)
|
|
|
+ {
|
|
|
+ string head_lang = "zh-cn";
|
|
|
+ var client = _azureCosmos.GetCosmosClient();
|
|
|
+ string sql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
|
|
|
+ List<ArtEvaluation> infos = new();
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryIterator<ArtEvaluation>(queryText: sql))
|
|
|
+ {
|
|
|
+ infos.Add(item);
|
|
|
+ }
|
|
|
+ //List<Task<ItemResponse<ExamInfo>>> tasks = new List<Task<ItemResponse<ExamInfo>>>();
|
|
|
+ List<string> ids = infos.Select(x => x.id).ToList();
|
|
|
+ List<StudentArtResult> artResults = new List<StudentArtResult>();
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(
|
|
|
+ queryText: $"select value(c) from c where c.pk = 'ArtResult' and c.artId in ({string.Join(",", ids.Select(o => $"'{o}'"))})"))
|
|
|
+ {
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ {
|
|
|
+ foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ {
|
|
|
+ artResults.Add(obj.ToObject<StudentArtResult>());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ foreach (var item in infos)
|
|
|
+ {
|
|
|
+ if (item.classes.Count == 0)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var studentIds = artResults.Where(c => c.artId.Equals(item.id)).Select(z => z.studentId).ToList();
|
|
|
+
|
|
|
+ await ArtService.GenArtPDF(studentIds, item.id,item.school, head_lang, _serviceBus, _configuration);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Ok(new { code = 0, msg = "加入PDF报告生成队列中。" });
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|