|
@@ -1,6 +1,7 @@
|
|
|
using Azure;
|
|
|
using Azure.Cosmos;
|
|
|
using DinkToPdf.Contracts;
|
|
|
+using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
@@ -47,7 +48,8 @@ namespace TEAMModelOS.Controllers
|
|
|
private readonly IConverter _converter;
|
|
|
public IConfiguration _configuration { get; set; }
|
|
|
private readonly CoreAPIHttpService _coreAPIHttpService;
|
|
|
- public ArtReviewController(IConverter converter, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing,
|
|
|
+ private readonly HttpTrigger _httpTrigger;
|
|
|
+ public ArtReviewController(HttpTrigger httpTrigger,IConverter converter, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing,
|
|
|
IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, IConfiguration configuration, IWebHostEnvironment env)
|
|
|
{
|
|
|
_environment = env;
|
|
@@ -61,6 +63,7 @@ namespace TEAMModelOS.Controllers
|
|
|
_azureRedis = azureRedis;
|
|
|
_configuration = configuration;
|
|
|
_converter = converter;
|
|
|
+ _httpTrigger= httpTrigger;
|
|
|
}
|
|
|
[HttpPost("get-parents")]
|
|
|
public async Task<IActionResult> GetParents(JsonElement request) {
|
|
@@ -114,7 +117,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
return BadRequest();
|
|
|
}
|
|
|
-
|
|
|
+ School school =await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS,Constant.School).ReadItemAsync<School>($"{_schoolId}", new PartitionKey("Base"));
|
|
|
string path = Path.Combine(_environment.ContentRootPath, $"Lang/{head_lang}.json");
|
|
|
string comment1 = "";
|
|
|
string comment2 = "";
|
|
@@ -261,12 +264,17 @@ namespace TEAMModelOS.Controllers
|
|
|
x.studentName = rmbs[0].name;
|
|
|
}
|
|
|
List<string> classNames = new List<string>();
|
|
|
+ HashSet<string> periodIds = new HashSet<string>();
|
|
|
x.classIds.ForEach(c =>
|
|
|
{
|
|
|
var gps = groups.FindAll(g => g.id.Equals(c));
|
|
|
if (gps.IsNotEmpty())
|
|
|
{
|
|
|
classNames.Add(gps[0].name);
|
|
|
+ if (!string.IsNullOrWhiteSpace(gps[0].periodId))
|
|
|
+ {
|
|
|
+ periodIds.Add(gps[0].periodId);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
allSubjectArtQuotaPdfs.ForEach(x => x.level = level);
|
|
@@ -326,8 +334,23 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
comment.Append(comment3.Replace("{quotasLow}", string.Join("、", quota)));
|
|
|
}
|
|
|
+ string periodId = "";
|
|
|
+ string periodName = "";
|
|
|
+ string schoolName = "";
|
|
|
+ if (periodIds.Any()) {
|
|
|
+ var ps= school.period.FindAll(x => periodIds.Contains(x.id));
|
|
|
+ if (ps.Any()) {
|
|
|
+ periodName=String.Join(",", ps.Select(x=>x.name));
|
|
|
+ periodId= String.Join(",", ps.Select(x => x.id));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ArtStudentPdf studentPdf = new ArtStudentPdf
|
|
|
{
|
|
|
+ schoolCode=school.id,
|
|
|
+ schoolName=school.name,
|
|
|
+ periodId = periodId,
|
|
|
+ periodName = periodName,
|
|
|
studentId = x.studentId,
|
|
|
studentName = x.studentName,
|
|
|
picture = x.picture,
|
|
@@ -340,6 +363,7 @@ namespace TEAMModelOS.Controllers
|
|
|
};
|
|
|
studentPdfs.Add(studentPdf);
|
|
|
});
|
|
|
+ _= _httpTrigger.RequestHttpTrigger(new { studentPdfs = studentPdfs , schoolCode =$"{_schoolId}"}, _option.Location, "gen-art-pdf");
|
|
|
return Ok(new { studentPdfs = studentPdfs });
|
|
|
}
|
|
|
|