CrazyIter_Bin 1 年之前
父節點
當前提交
a85875e8d4
共有 1 個文件被更改,包括 13 次插入5 次删除
  1. 13 5
      TEAMModelOS/Controllers/School/ArtReviewController.cs

+ 13 - 5
TEAMModelOS/Controllers/School/ArtReviewController.cs

@@ -28,6 +28,7 @@ using DocumentFormat.OpenXml.Office2010.Excel;
 using static SKIT.FlurlHttpClient.Wechat.TenpayV3.Models.CreateApplyForSubjectApplymentRequest.Types;
 using TEAMModelOS.SDK.Models.Cosmos.Student;
 using TEAMModelOS.Controllers.Analysis;
+using System.Threading;
 
 namespace TEAMModelOS.Controllers
 {
@@ -183,7 +184,12 @@ namespace TEAMModelOS.Controllers
         [HttpPost("get-pdf")]
         public async Task<IActionResult> getPdf(JsonElement request)
         {
-            string head_lang = "zh-cn";         
+            string head_lang = "zh-cn";
+            List<string> schools = new List<string>();
+            if (request.TryGetProperty("schools", out JsonElement _schools) && _schools.ValueKind.Equals(JsonValueKind.Array))
+            {
+                schools = _schools.ToObject<List<string>>();
+            }
             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();
@@ -212,13 +218,15 @@ namespace TEAMModelOS.Controllers
                 {
                     continue;
                 }
-                else {
+                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);
+                    await ArtService.GenArtPDF(studentIds, item.id, item.school, head_lang, _serviceBus, _configuration);
+                    await Task.Delay(30000);
                 }
             }
-            return Ok(new { code = 0, msg = "加入PDF报告生成队列中。" });
+            return Ok(new { code = 0, msg = "加入PDF报告生成队列中。", schools= infos.Select(x=>x.school)});
         }
 
         /// <summary>