CrazyIter_Bin 9 ماه پیش
والد
کامیت
9ada6c440f

+ 3 - 2
TEAMModelOS.Extension/HTEX.Complex/Controllers/ScreenController.cs

@@ -39,7 +39,7 @@ namespace HTEX.Complex.Controllers
         public async Task<IActionResult> SendTask(JsonElement json)
         {
             var values =  await _azureRedis.GetRedisClient(8).HashGetAllAsync("ScreenApi:clients");
-            if (values!=null) 
+            if (values!=null)
             {
                 foreach (var value in values)
                 {
@@ -58,7 +58,7 @@ namespace HTEX.Complex.Controllers
                         {
                             screenClient.status =  ScreenConstant.busy;
                             screenClient.last_time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                            await _screenServerHub.Clients.Client(screenClient.connid!).SendAsync ("ReceiveMessage", new ScreenProcessMessage
+                            await _screenServerHub.Clients.Client(screenClient.connid!).SendAsync("ReceiveMessage", new ScreenProcessMessage
                             {
                                 connid = screenClient.connid,
                                 clientid =screenClient.clientid,
@@ -95,6 +95,7 @@ namespace HTEX.Complex.Controllers
                     await _azureRedis.GetRedisClient(8).HashSetAsync($"ScreenApi:clients", screenClient.clientid, screenClient.ToJsonString());
                 }
             }
+            else { }
             return Ok();
         }
     }

+ 1 - 1
TEAMModelOS.Extension/HTEX.Complex/Program.cs

@@ -89,7 +89,7 @@ namespace HTEX.Complex
             builder.Services.AddAzureRedis(RedisConnectionString, "Default");
             string? StorageConnectionStringTest = builder.Configuration.GetValue<string>("Azure:Storage:ConnectionString-Test");
             //Storage
-            builder.Services.AddAzureStorage(StorageConnectionString, "Test");
+            builder.Services.AddAzureStorage(StorageConnectionStringTest, "Test");
 
             builder.Services.AddSignalR();
             builder.Services.AddHttpContextAccessor();

+ 2 - 2
TEAMModelOS.Extension/HTEX.Complex/Services/TaskService.cs

@@ -39,7 +39,7 @@ namespace HTEX.Complex.Services
                             uri = new Uri(url);
                             string host = uri.Host;
                             string azure_region = genQueue.env.Equals(ScreenConstant.env_develop) ? "Test" : "Default";
-                            var blobServiceClient = _azureStorage.GetBlobServiceClient("Test");
+                            var blobServiceClient = _azureStorage.GetBlobServiceClient(azure_region);
                             if (host.Equals(blobServiceClient.Uri.Host))
                             {
                                 // 获取容器名,它是路径的第一个部分
@@ -57,7 +57,7 @@ namespace HTEX.Complex.Services
                             }
                             else
                             {
-                                msg="数据地址与服务提供的站点不一致!";
+                                msg=$"数据地址与服务提供的站点不一致!{host},{blobServiceClient.Uri.Host}";
                                 genRedis.status=3;
                                 genRedis.msg = msg;
 

+ 1 - 1
TEAMModelOS.Extension/HTEX.Complex/appsettings.Development.json

@@ -18,7 +18,7 @@
   },
   "Azure": {
     "Storage": {
-      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn",
+      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn",
       "ConnectionString-Test": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
     },
     "Redis": {

+ 2 - 1
TEAMModelOS.Extension/HTEX.Complex/appsettings.json

@@ -22,7 +22,8 @@
       "ConnectionString-Test": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
     },
     "Redis": {
-      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
+      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
+      //"ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
     }
   }
 }

+ 0 - 35
TEAMModelOS.Extension/HTEX.ScreenClient/Controllers/WeatherForecastController.cs

@@ -1,35 +0,0 @@
-using Microsoft.AspNetCore.Hosting.Server.Features;
-using Microsoft.AspNetCore.Mvc;
-
-namespace HTEX.ScreenClient.Controllers
-{
-    [ApiController]
-    [Route("[controller]")]
-    public class WeatherForecastController : ControllerBase
-    {
-        private static readonly string[] Summaries = new[]
-        {
-            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
-        };
-
-        private readonly ILogger<WeatherForecastController> _logger;
-
-        public WeatherForecastController(ILogger<WeatherForecastController> logger)
-        {
-            _logger = logger;
-        }
-
-        [HttpGet]
-        public IEnumerable<WeatherForecast> Get()
-        {
-            
-            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
-            {
-                Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
-                TemperatureC = Random.Shared.Next(-20, 55),
-                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
-            })
-            .ToArray();
-        }
-    }
-}

+ 2 - 1
TEAMModelOS.Extension/HTEX.ScreenClient/HTEX.ScreenClient.csproj

@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk.Web">
+<Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
     <TargetFramework>net8.0</TargetFramework>
@@ -16,4 +16,5 @@
     <ProjectReference Include="..\..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
   </ItemGroup>
 
+
 </Project>

+ 0 - 6
TEAMModelOS.Extension/HTEX.ScreenClient/Program.cs

@@ -18,19 +18,13 @@ namespace HTEX.ScreenClient
             builder.Services.AddControllers();
             builder.Services.AddHttpClient();
             builder.Services.AddHttpContextAccessor();
-            //CheckOrNewPort(1883)
             //CheckOrNewPort(5000)
             builder.WebHost.UseKestrel(options => {
-                //options.ListenAnyIP(4001, options => {
-                //   // options.UseHttps("Crt/iteden.pfx", "iteden"); 
-                //});
-                options.ListenAnyIP(CheckOrNewPort(1883), options => {/*options.UseHttps("Crt/iteden.pfx", "iteden");*/ });
                 options.ListenAnyIP(CheckOrNewPort(5000), options => {/* options.UseHttps("Configs/Crt/iteden.pfx", "iteden"); */}); // Default HTTP pipeline
             });
 
             builder.Services.AddHostedService<SignalRScreenClientHub>();
             var app = builder.Build();
-            // Configure the HTTP request pipeline.
 
             app.UseHttpsRedirection();
 

+ 0 - 13
TEAMModelOS.Extension/HTEX.ScreenClient/WeatherForecast.cs

@@ -1,13 +0,0 @@
-namespace HTEX.ScreenClient
-{
-    public class WeatherForecast
-    {
-        public DateOnly Date { get; set; }
-
-        public int TemperatureC { get; set; }
-
-        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
-        public string? Summary { get; set; }
-    }
-}

+ 11 - 6
TEAMModelOS.Function/IESServiceBusTrigger.cs

@@ -100,25 +100,30 @@ namespace TEAMModelOS.Function
             _logger.LogInformation("Message ID: {id}", message.MessageId);
             _logger.LogInformation("Message Body: {body}", message.Body);
             _logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);
-            var json = JsonDocument.Parse(message.Body);
+            var json = JsonDocument.Parse(message.Body).RootElement;
 
             try
             {
                 switch (true)
                 {
-                    case bool when json.RootElement.TryGetProperty("bizType", out JsonElement _bizType) && $"{_bizType}".Equals("OfflineRecord"):
+                    case bool when json.TryGetProperty("bizType", out JsonElement _bizType) && $"{_bizType}".Equals("OfflineRecord"):
                         //处理教师线下研修报告的生成。
                         //await GenOfflineRecordPdf(element, msg);
                         break;
-                    case bool when json.RootElement.TryGetProperty("bizType", out JsonElement _bizType) && $"{_bizType}".Equals("ArtStudentPdf"):
-                        await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,
-                  _coreAPIHttpService, _dingDing, _azureStorage,_configuration, json.RootElement);
+                    case bool when json.TryGetProperty("bizType", out JsonElement _bizType) && $"{_bizType}".Equals("ArtStudentPdf"):
+                        json.TryGetProperty("studentIds", out JsonElement _studentIds);
+                        json.TryGetProperty("artId", out JsonElement _artId);
+                        json.TryGetProperty("schoolCode", out JsonElement _schoolId);
+                        json.TryGetProperty("headLang", out JsonElement headLang);
+                        List<string> studentIds = _studentIds.ToObject<List<string>>();
+                        var data =  await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,  _coreAPIHttpService, _dingDing, _azureStorage,_configuration, studentIds,$"{_artId}",$"{_schoolId}",$"{headLang}");
+                        await GenPDFService. PushScreenTask(_azureRedis, _configuration, $"{_artId}",data. art,data. studentPdfs);
                         break;
                 }
             }
             catch (Exception ex)
             {
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-ServiceBus,GenPDF()\n{ex.Message}\n{ex.StackTrace}\n\n{json.RootElement.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-ServiceBus,GenPDF()\n{ex.Message}\n{ex.StackTrace}\n\n{json.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
             }
             finally
             {  // Complete the message

+ 2 - 1
TEAMModelOS.SDK/Models/Cosmos/Student/StudentArtResult.cs

@@ -24,7 +24,7 @@ namespace TEAMModelOS.SDK.Models
         public List<ArtSubjectScore> subjectScores { get; set; } = new List<ArtSubjectScore>();
         public List<ArtQuotaResult> results { get; set; } = new List<ArtQuotaResult>();
         public string blob { get; set; }
-
+        public string comment { get; set; }
         public Attachment pdf { get; set; }= new Attachment();
 
         /// <summary>
@@ -38,6 +38,7 @@ namespace TEAMModelOS.SDK.Models
     public class ArtSubjectScore {
         public string subjectId { get; set; }
         public double score { get; set; } = 0;
+        public string comment { get; set; }
     }
     public class ArtQuotaResult
     {

+ 7 - 2
TEAMModelOS.SDK/Models/Service/ArtService.cs

@@ -421,15 +421,20 @@ namespace TEAMModelOS.SDK.Models.Service
                             {
                                 comment.Append(comment5.Replace("{pointLow}", string.Join("、", pointLow)));
                             }
+                            string custom_comment = string.Empty;
                             if (artSubjectPdf.subjectId.Equals("subject_music"))
                             {
                                 comment.Append(comment_subject_music);
+                                var dbcomment= x.subjectScores.Find(d => d.subjectId.Equals("subject_music"));
+                                custom_comment=dbcomment?.comment;
                             }
                             if (artSubjectPdf.subjectId.Equals("subject_painting"))
                             {
                                 comment.Append(comment_subject_painting);
+                                var dbcomment = x.subjectScores.Find(d => d.subjectId.Equals("subject_painting"));
+                                custom_comment=dbcomment?.comment;
                             }
-                            artSubjectPdf.comment = comment.ToString();
+                            artSubjectPdf.comment = string.IsNullOrWhiteSpace(custom_comment)? comment.ToString():custom_comment;
                             subjectPdfs.Add(artSubjectPdf);
                         }
                     }
@@ -449,7 +454,7 @@ namespace TEAMModelOS.SDK.Models.Service
                     level = level,
                     score = allScore,
                     allSubjectQuotas = allSubjectQuotas.ToList(),
-                    comment = comment.ToString(),
+                    comment =string.IsNullOrWhiteSpace(x.comment)? comment.ToString():x.comment,
                     subjectPdfs = subjectPdfs,
                 };
                 studentPdfs.Add(studentPdf);

+ 33 - 41
TEAMModelOS.SDK/Models/Service/GenPDFService.cs

@@ -470,17 +470,12 @@ namespace TEAMModelOS.SDK
           
             return ( countProcess , genRedis.Count() ); 
         }
-
-        public static async Task GenArtStudentPdf( AzureRedisFactory _azureRedis, AzureCosmosFactory _azureCosmos, 
-            CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, AzureStorageFactory _azureStorage, IConfiguration _configuration, JsonElement json)
+       
+        public static async Task<(List<ArtStudentPdf> studentPdfs, List<StudentArtResult> artResults, ArtEvaluation art)> GenArtStudentPdf( AzureRedisFactory _azureRedis, AzureCosmosFactory _azureCosmos, 
+            CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, AzureStorageFactory _azureStorage, IConfiguration _configuration, List<string> studentIds,string _artId,string _schoolId,string headLang)
         {
             try
             {
-                json.TryGetProperty("studentIds", out JsonElement _studentIds);
-                json.TryGetProperty("artId", out JsonElement _artId);
-                json.TryGetProperty("schoolCode", out JsonElement _schoolId);
-                json.TryGetProperty("headLang", out JsonElement headLang);
-                List<string> studentIds = _studentIds.ToObject<List<string>>();
                 string _schoolCode = $"{_schoolId}";
                 ArtEvaluation art = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ArtEvaluation>($"{_artId}", new PartitionKey($"Art-{_schoolId}"));
                 (List<ArtStudentPdf> studentPdfs, List<StudentArtResult> artResults) = await ArtService.GenStuArtPDF(studentIds, $"{_artId}", art, $"{_schoolId}", $"{headLang}", _azureCosmos, _coreAPIHttpService, _dingDing);
@@ -506,52 +501,49 @@ namespace TEAMModelOS.SDK
                 //2个小时。
                 await _azureRedis.GetRedisClient(8).KeyExpireAsync($"ArtPDF:{_artId}:{_schoolCode}", new TimeSpan(2, 0, 0));
                 List<Task<string>> uploads = new List<Task<string>>();
-                studentPdfs.ForEach(x => {
+                studentPdfs.ForEach(x =>
+                {
                     x.blob = $"art/{x.artId}/report/{x.studentId}.json";
                     var urlSas = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Write|BlobSasPermissions.Read, hour: 24);
                     x.blobFullUrl=urlSas.fullUri;
                     uploads.Add(_azureStorage.GetBlobContainerClient($"{_schoolCode}").UploadFileByContainer(x.ToJsonString(), "art", $"{x.artId}/report/{x.studentId}.json", true));
                 });
                 var uploadJsonUrls = await Task.WhenAll(uploads);
-                var list = uploadJsonUrls.ToList();
-                //List<string> urls = new List<string>();
-                //(string uri, string sas) = _azureStorage.GetBlobContainerSAS($"{_schoolCode}", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
-                //studentPdfs.ForEach(x => {
-                //    string atrUrl = "https://teammodeltest.blob.core.chinacloudapi.cn/0-public/bookjs/art/index.html";
-                //    var s = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Read);
-                //    s.fullUri = $"{HttpUtility.UrlEncode($"{s}", Encoding.UTF8)}";
-                //    string url = $"{atrUrl}?url={s.fullUri}";
-                //    urls.Add(url);
-                //});
-                string env = ScreenConstant.env_release;
-                if (_configuration.GetValue<string>("Option:Location").Contains("Test", StringComparison.OrdinalIgnoreCase) ||
-                    _configuration.GetValue<string>("Option:Location").Contains("Dep", StringComparison.OrdinalIgnoreCase))
-                {
-                    env = ScreenConstant.env_develop;
-                }
-               var addData = await GenPDFService.AddGenPdfQueue(_azureRedis,
-                    new GenPDFData
-                    {
-                        env =env,
-                        timeout=30000,
-                        delay=1000,
-                        checkPageCompleteJs=true,
-                        sessionId=$"{_artId}",
-                        taskName = art.name,
-                        taskType="Art",
-                        owner=art.owner,
-                        scope=art.scope,
-                        pageUrl="https://teammodeltest.blob.core.chinacloudapi.cn/0-public/bookjs/art/index.html",
-                        datas= studentPdfs.Select(x => new PDFData{ id= x.studentId, name=x.studentName, url =x.blobFullUrl }).ToList()
-                    });
-                Console.WriteLine($"{addData.total},{addData.add}");
+                return (studentPdfs, artResults,art);
+
             }
             catch (Exception ex)
             {
                 await _dingDing.SendBotMsg($"{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
             }
+            return (null, null, null);
         }
 
+        public static async Task PushScreenTask(AzureRedisFactory _azureRedis, IConfiguration _configuration, string _artId, ArtEvaluation art, List<ArtStudentPdf> studentPdfs)
+        {
+            string env = ScreenConstant.env_release;
+            if (_configuration.GetValue<string>("Option:Location").Contains("Test", StringComparison.OrdinalIgnoreCase) ||
+                _configuration.GetValue<string>("Option:Location").Contains("Dep", StringComparison.OrdinalIgnoreCase))
+            {
+                env = ScreenConstant.env_develop;
+            }
+            var addData = await GenPDFService.AddGenPdfQueue(_azureRedis,
+                 new GenPDFData
+                 {
+                     env =env,
+                     timeout=30000,
+                     delay=1000,
+                     checkPageCompleteJs=true,
+                     sessionId=$"{_artId}",
+                     taskName = art.name,
+                     taskType="Art",
+                     owner=art.owner,
+                     scope=art.scope,
+                     pageUrl="https://teammodeltest.blob.core.chinacloudapi.cn/0-public/bookjs/art/index.html",
+                     datas= studentPdfs.Select(x => new PDFData { id= x.studentId, name=x.studentName, url =x.blobFullUrl }).ToList()
+                 });
+            //Console.WriteLine($"{addData.total},{addData.add}");
+        }
     }
 
     public class GenPDFData

+ 87 - 34
TEAMModelOS/Controllers/School/ArtReviewController.cs

@@ -187,54 +187,107 @@ namespace TEAMModelOS.Controllers
             return Ok(new {code=0,msg="加入PDF报告生成队列中。" });
         }
 
+
+        /**
+        {
+           "artId": "99a946a7-f475-463f-846f-834a276e1b34",
+           "schoolId": "hbcn",
+           "schoolCode":"hbcn",
+           "opt": "gen-pdf",
+           "headLang":"zh-cn",
+           "studentIds": [
+               "202206001", "202206002"
+           ]
+}
+        
+        */
+
         [ProducesDefaultResponseType]
         //[AuthToken(Roles = "teacher,admin")]
-        [HttpPost("get-pdf")]
-        public async Task<IActionResult> getPdf(JsonElement request)
+        [HttpPost("update-custom-comment")]
+        public async Task<IActionResult> UpdateCustomComment(JsonElement json) 
         {
-            string head_lang = "zh-cn";
-            List<string> schools = new List<string>();
-            if (request.TryGetProperty("schools", out JsonElement _schools) && _schools.ValueKind.Equals(JsonValueKind.Array))
+            string head_lang = "";
+            if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
             {
-                schools = _schools.ToObject<List<string>>();
+                head_lang = $"{_lang}";
             }
-            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).GetItemQueryIteratorSql<ArtEvaluation>(queryText: sql))
+            if (string.IsNullOrWhiteSpace(head_lang))
+            {
+                head_lang = _option.Location.Contains("China") ? "zh-cn" : "en-us";
+            }
+            if (!json.TryGetProperty("artId", out JsonElement _artId))
+            {
+                return BadRequest();
+            }
+            if (!json.TryGetProperty("schoolId", out JsonElement _schoolId))
             {
-                infos.Add(item);
+                return BadRequest();
             }
-            //List<Task<ItemResponse<ExamInfo>>> tasks = new List<Task<ItemResponse<ExamInfo>>>();
-            List<string> ids = infos.Select(x => x.id).ToList();
+            if (!json.TryGetProperty("studentId", out JsonElement _studentId))
+            {
+                return BadRequest();
+            }
+            json.TryGetProperty("comment", out JsonElement _comment);
+            json.TryGetProperty("comment_music", out JsonElement _comment_music);
+            json.TryGetProperty("comment_painting", out JsonElement _comment_painting);
+
+            string query = $" select value c from c where c.school  = '{_schoolId}' and c.studentId ='{_studentId}'";
             List<StudentArtResult> artResults = new List<StudentArtResult>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIteratorSql(
-                queryText: $"select value(c) from c where c.pk = 'ArtResult' and c.artId in ({string.Join(",", ids.Select(o => $"'{o}'"))})"))
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIteratorSql<StudentArtResult>
+              (queryText: query, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"ArtResult-{_artId}") }))
             {
-                using var json = await JsonDocument.ParseAsync(item.Content);
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                {
-                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                item.comment=$"{_comment}";
+                item.subjectScores.ForEach(x => {
+                    if(x.subjectId.Equals("subject_music"))
                     {
-                        artResults.Add(obj.ToObject<StudentArtResult>());
+                        x.comment=$"{_comment_music}";
                     }
-                }
+                    if (x.subjectId.Equals("subject_painting"))
+                    {
+                        x.comment = $"{_comment_painting}";
+                    }
+                });
+                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(item, new PartitionKey($"ArtResult-{_artId}"));
+                artResults.Add(item);
             }
-            foreach (var item in infos)
+            if (artResults.IsNotEmpty()) 
             {
-                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);
-                    await Task.Delay(30000);
-                }
+                var data = await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos, _coreAPIHttpService, _dingDing, _azureStorage, _configuration, artResults.Select(x=>x.studentId).ToList(), $"{_artId}", $"{_schoolId}", $"{head_lang}");
+                return Ok(new { code = 0, dataFile = data.studentPdfs.Select(x => new { x.blob, x.blobFullUrl }) });
+            }
+            return Ok(new { code = 1, msg = "没有找到学生数据" });
+        }
+
+        [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "teacher,admin")]
+        [HttpPost("get-pdf-data")]
+        public async Task<IActionResult> GetPdfData(JsonElement json)
+        {
+            if (!json.TryGetProperty("artId", out JsonElement _artId))
+            {
+                return BadRequest();
+            }
+            if (!json.TryGetProperty("schoolId", out JsonElement _schoolId))
+            {
+                return BadRequest();
+            }
+            List<string> studentIds = new List<string>();
+            if (json.TryGetProperty("studentIds", out JsonElement _studentIds) && _studentIds.ValueKind.Equals(JsonValueKind.Array))
+            {
+                studentIds = _studentIds.ToObject<List<string>>();
+            }
+            string head_lang = string.Empty;
+            if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
+            {
+                head_lang = $"{_lang}";
+            }
+            if (string.IsNullOrWhiteSpace(head_lang))
+            {
+                head_lang = _option.Location.Contains("China") ? "zh-cn" : "en-us";
             }
-            return Ok(new { code = 0, msg = "加入PDF报告生成队列中。", schools= infos.Select(x=>x.school)});
+            var data = await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos, _coreAPIHttpService, _dingDing, _azureStorage, _configuration, studentIds,$"{_artId}",$"{_schoolId}",$"{head_lang}");
+            return Ok(new {code=0, dataFiles= data.studentPdfs.Select(x=>new { x.blob,x.blobFullUrl}) });
         }
 
         /// <summary>

+ 28 - 4
TEAMModelOS/Controllers/System/GenPDFController.cs

@@ -13,7 +13,9 @@ using TEAMModelOS.SDK.Models.Service;
 using DocumentFormat.OpenXml.Vml;
 using TEAMModelOS.Filter;
 using Microsoft.AspNetCore.Authorization;
-
+using FastJSON;
+using Microsoft.Azure.Cosmos.Linq;
+using TEAMModelOS.SDK.Extension;
 namespace TEAMModelOS.Controllers
 {
     [ProducesResponseType(StatusCodes.Status200OK)]
@@ -79,10 +81,32 @@ namespace TEAMModelOS.Controllers
         //        [AuthToken(Roles = "teacher,admin")]
         //        [Authorize(Roles = "IES")]
         //#endif
-        public async Task<IActionResult> GenArtStudentPdf(JsonElement request)
+        public async Task<IActionResult> GenArtStudentPdf(JsonElement json)
         {
-
-            await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos,_coreAPIHttpService, _dingDing, _azureStorage, _configuration, request);
+            if (!json.TryGetProperty("artId", out JsonElement _artId))
+            {
+                return BadRequest();
+            }
+            if (!json.TryGetProperty("schoolId", out JsonElement _schoolId))
+            {
+                return BadRequest();
+            }
+            List<string> studentIds = new List<string>();
+            if (json.TryGetProperty("studentIds", out JsonElement _studentIds) && _studentIds.ValueKind.Equals(JsonValueKind.Array))
+            {
+                studentIds = _studentIds.ToObject<List<string>>();
+            }
+            string head_lang = string.Empty;
+            if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
+            {
+                head_lang = $"{_lang}";
+            }
+            if (string.IsNullOrWhiteSpace(head_lang))
+            {
+                head_lang = _option.Location.Contains("China") ? "zh-cn" : "en-us";
+            }
+            var data =   await GenPDFService.GenArtStudentPdf(_azureRedis, _azureCosmos, _coreAPIHttpService, _dingDing, _azureStorage, _configuration, studentIds, $"{_artId}", $"{_schoolId}", $"{head_lang}");
+            await GenPDFService.PushScreenTask(_azureRedis, _configuration, $"{_artId}", data.art, data.studentPdfs);
             return Ok();
         }
         

+ 4 - 4
TEAMModelOS/TEAMModelOS.csproj

@@ -80,11 +80,11 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2408.14</Version>
-		<AssemblyVersion>5.2408.14.1</AssemblyVersion>
-		<FileVersion>5.2408.14.1</FileVersion>
+		<Version>5.2408.21</Version>
+		<AssemblyVersion>5.2408.21.1</AssemblyVersion>
+		<FileVersion>5.2408.21.1</FileVersion>
 		<Description>TEAMModelOS(IES5)</Description>
-		<PackageReleaseNotes>IES版本说明版本切换标记5.2408.14.1</PackageReleaseNotes>
+		<PackageReleaseNotes>IES版本说明版本切换标记5.2408.21.1</PackageReleaseNotes>
 		<PackageId>TEAMModelOS</PackageId>
 		<Authors>teammodel</Authors>
 		<Company>醍摩豆(成都)信息技术有限公司</Company>

+ 1 - 1
TEAMModelOS/appsettings.Development.json

@@ -18,7 +18,7 @@
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction-test.chinacloudsites.cn/api/",
     //"HttpTrigger": "http://localhost:7071/api/"
-    "Version": "5.2408.14.1"
+    "Version": "5.2408.21.1"
   },
   "Azure": {
     // 测试站数据库

+ 1 - 1
TEAMModelOS/appsettings.json

@@ -18,7 +18,7 @@
     "Exp": 86400,
     "IdTokenSalt": "8263692E2213497BB55E74792B7900B4",
     "HttpTrigger": "https://teammodelosfunction.chinacloudsites.cn/api/",
-    "Version": "5.2408.14.1"
+    "Version": "5.2408.21.1"
   },
   "Azure": {
     "Storage": {