|
@@ -470,17 +470,12 @@ namespace TEAMModelOS.SDK
|
|
|
|
|
|
return ( countProcess , genRedis.Count() );
|
|
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
|
|
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}";
|
|
string _schoolCode = $"{_schoolId}";
|
|
ArtEvaluation art = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ArtEvaluation>($"{_artId}", new PartitionKey($"Art-{_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);
|
|
(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个小时。
|
|
//2个小时。
|
|
await _azureRedis.GetRedisClient(8).KeyExpireAsync($"ArtPDF:{_artId}:{_schoolCode}", new TimeSpan(2, 0, 0));
|
|
await _azureRedis.GetRedisClient(8).KeyExpireAsync($"ArtPDF:{_artId}:{_schoolCode}", new TimeSpan(2, 0, 0));
|
|
List<Task<string>> uploads = new List<Task<string>>();
|
|
List<Task<string>> uploads = new List<Task<string>>();
|
|
- studentPdfs.ForEach(x => {
|
|
|
|
|
|
+ studentPdfs.ForEach(x =>
|
|
|
|
+ {
|
|
x.blob = $"art/{x.artId}/report/{x.studentId}.json";
|
|
x.blob = $"art/{x.artId}/report/{x.studentId}.json";
|
|
var urlSas = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Write|BlobSasPermissions.Read, hour: 24);
|
|
var urlSas = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Write|BlobSasPermissions.Read, hour: 24);
|
|
x.blobFullUrl=urlSas.fullUri;
|
|
x.blobFullUrl=urlSas.fullUri;
|
|
uploads.Add(_azureStorage.GetBlobContainerClient($"{_schoolCode}").UploadFileByContainer(x.ToJsonString(), "art", $"{x.artId}/report/{x.studentId}.json", true));
|
|
uploads.Add(_azureStorage.GetBlobContainerClient($"{_schoolCode}").UploadFileByContainer(x.ToJsonString(), "art", $"{x.artId}/report/{x.studentId}.json", true));
|
|
});
|
|
});
|
|
var uploadJsonUrls = await Task.WhenAll(uploads);
|
|
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)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
await _dingDing.SendBotMsg($"{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
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
|
|
public class GenPDFData
|