|
@@ -1,11 +1,14 @@
|
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
|
+using DocumentFormat.OpenXml.Spreadsheet;
|
|
using HTEX.Lib.ETL.Lesson;
|
|
using HTEX.Lib.ETL.Lesson;
|
|
using MathNet.Numerics.Distributions;
|
|
using MathNet.Numerics.Distributions;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Azure.Cosmos;
|
|
using Microsoft.Azure.Cosmos;
|
|
using StackExchange.Redis;
|
|
using StackExchange.Redis;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
+using System.Reflection;
|
|
using System.Text.Json;
|
|
using System.Text.Json;
|
|
|
|
+using System.Text.RegularExpressions;
|
|
using System.Xml;
|
|
using System.Xml;
|
|
using TEAMModelOS.SDK;
|
|
using TEAMModelOS.SDK;
|
|
using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.DI;
|
|
@@ -189,8 +192,6 @@ namespace HTEX.DataETL.Controllers
|
|
[HttpPost("process-history-students")]
|
|
[HttpPost("process-history-students")]
|
|
public async Task<IActionResult> ProcessHistoryStudents(JsonElement json)
|
|
public async Task<IActionResult> ProcessHistoryStudents(JsonElement json)
|
|
{
|
|
{
|
|
-
|
|
|
|
-
|
|
|
|
string? lessonBasePath = _configuration.GetValue<string>("LessonPath");
|
|
string? lessonBasePath = _configuration.GetValue<string>("LessonPath");
|
|
string? pathLessons = $"{lessonBasePath}\\lessons";
|
|
string? pathLessons = $"{lessonBasePath}\\lessons";
|
|
string? pathAnalysis = $"{lessonBasePath}\\analysis";
|
|
string? pathAnalysis = $"{lessonBasePath}\\analysis";
|
|
@@ -205,60 +206,143 @@ namespace HTEX.DataETL.Controllers
|
|
List<string> localIds = new List<string>();
|
|
List<string> localIds = new List<string>();
|
|
foreach (var file in filesLessons)
|
|
foreach (var file in filesLessons)
|
|
{
|
|
{
|
|
- if (file.EndsWith("-local.json"))
|
|
|
|
- {
|
|
|
|
- string lessonId = file.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
- localIds.Add(lessonId);
|
|
|
|
- }
|
|
|
|
|
|
+ string lessonId = file.Split("\\").Last().Replace("-local.json", "");
|
|
|
|
+ localIds.Add(lessonId);
|
|
|
|
+ }
|
|
|
|
+ List<LessonRecord> lessonRecords = new List<LessonRecord>();
|
|
|
|
+ string recordsPtah = $"{lessonBasePath}\\records\\records.json";
|
|
|
|
+ long stime = 0;//2023-09-01 00:00:00
|
|
|
|
+ long etime = 0;//2024-11-13 23:59:59
|
|
|
|
+ if (System.IO.File.Exists(recordsPtah))
|
|
|
|
+ {
|
|
|
|
+ string jsonData = await System.IO.File.ReadAllTextAsync(recordsPtah);
|
|
|
|
+ lessonRecords= jsonData.ToObject<List<LessonRecord>>();
|
|
|
|
+ stime= lessonRecords.Max(x => x.startTime);
|
|
|
|
+ etime= lessonRecords.Max(x => x.startTime);
|
|
}
|
|
}
|
|
- long stime = 1693497600000;//2023-08-01 00:00:00
|
|
|
|
- long etime = 1731513599000;//2023-08-01 00:00:00
|
|
|
|
- var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
|
|
- .GetList<LessonRecord>($"SELECT value c FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<={etime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ");
|
|
|
|
|
|
+ if (stime==0)
|
|
|
|
+ {
|
|
|
|
+ stime = 1693497600000;//2023-09-01 00:00:00
|
|
|
|
+ }
|
|
|
|
+ if (etime==0)
|
|
|
|
+ {
|
|
|
|
+ etime = 1731513599000;//2024-11-13 23:59:59
|
|
|
|
+ }
|
|
|
|
+ var resultSchools = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
|
|
|
|
+ .GetList<LessonRecord>($"SELECT value c FROM c where ( c.analysis>=0 or IS_DEFINED(c.analysis) = false ) and c.startTime>={stime} and c.startTime<={etime} and c.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ");
|
|
List<string> ignore = new List<string>() { "PgJump", "PgRcv", "PgAdd" };
|
|
List<string> ignore = new List<string>() { "PgJump", "PgRcv", "PgAdd" };
|
|
int index = 0;
|
|
int index = 0;
|
|
- if (resultSchool.list.IsNotEmpty())
|
|
|
|
|
|
+ if (resultSchools.list.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ lessonRecords.AddRange(resultSchools.list);
|
|
|
|
+ }
|
|
|
|
+ if (lessonRecords.IsNotEmpty())
|
|
{
|
|
{
|
|
|
|
+
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(recordsPtah, lessonRecords.ToJsonString());
|
|
List<StudentSemesterRecord> studentSemesterRecords= new List<StudentSemesterRecord>();
|
|
List<StudentSemesterRecord> studentSemesterRecords= new List<StudentSemesterRecord>();
|
|
List<OverallEducation> overallEducations= new List<OverallEducation>();
|
|
List<OverallEducation> overallEducations= new List<OverallEducation>();
|
|
List<Student> studentsBase = new List<Student>();
|
|
List<Student> studentsBase = new List<Student>();
|
|
List<LessonLocal>lessonLocals = new List<LessonLocal>();
|
|
List<LessonLocal>lessonLocals = new List<LessonLocal>();
|
|
- await Parallel.ForEachAsync(resultSchool.list, async (lessonRecord, cancellationToken) =>
|
|
|
|
|
|
+ foreach (var lessonRecord in lessonRecords)
|
|
{
|
|
{
|
|
- var item = await LessonETLService.GetLessonLocal(lessonRecord,localIds,_azureStorage,pathLessons);
|
|
|
|
|
|
+ var item = await LessonETLService.GetLessonLocal(lessonRecord, localIds, _azureStorage, pathLessons);
|
|
lessonLocals.Add(item);
|
|
lessonLocals.Add(item);
|
|
index++;
|
|
index++;
|
|
- });
|
|
|
|
-
|
|
|
|
- var schoolGroup = lessonLocals.Where(x=>!string.IsNullOrWhiteSpace(x.lessonRecord?.school)).GroupBy(x => x.lessonRecord?.school).Select(x => new { key=x.Key ,list=x.ToList()});
|
|
|
|
- string schoolSql = $"select value c from c where c.id in ({string.Join(",", schoolGroup.Select(x => $"'{x.key}'"))})";
|
|
|
|
- var schoolResults= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<School>(schoolSql, "Base");
|
|
|
|
- if (schoolResults.list.IsNotEmpty())
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string schoolPtah = $"{lessonBasePath}\\schools\\school.json";
|
|
|
|
+ if (System.IO.File.Exists(schoolPtah))
|
|
|
|
+ {
|
|
|
|
+ string jsonData = await System.IO.File.ReadAllTextAsync(schoolPtah);
|
|
|
|
+ schools= jsonData.ToObject<List<School>>();
|
|
|
|
+ }
|
|
|
|
+ var schoolGroup = lessonLocals.Where(x => !string.IsNullOrWhiteSpace(x.lessonRecord?.school)).GroupBy(x => x.lessonRecord?.school).Select(x => new { key = x.Key, list = x.ToList() });
|
|
|
|
+ var newschoolIds = schoolGroup.Select(x=>x.key).ExceptBy(schools.Select(x => x.id), x => x);
|
|
|
|
+ if (newschoolIds!=null && newschoolIds.Count()>0)
|
|
{
|
|
{
|
|
- schools.AddRange(schoolResults.list);
|
|
|
|
|
|
+ string schoolSql = $"select value c from c where c.id in ({string.Join(",", schoolGroup.Select(x => $"'{x.key}'"))})";
|
|
|
|
+ var schoolResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).GetList<School>(schoolSql, "Base");
|
|
|
|
+ if (schoolResults.list.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ schools.AddRange(schoolResults.list);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ await System.IO.File.WriteAllTextAsync($"{lessonBasePath}\\schools\\school.json", schools.ToJsonString());
|
|
foreach (var group in schoolGroup)
|
|
foreach (var group in schoolGroup)
|
|
{
|
|
{
|
|
|
|
+ string students_path = $"{lessonBasePath}\\students\\{group.key}\\students.json";
|
|
|
|
+ string records_path = $"{lessonBasePath}\\students\\{group.key}\\records.json";
|
|
|
|
+ string overall_path = $"{lessonBasePath}\\students\\{group.key}\\overall.json";
|
|
|
|
+ if (!Directory.Exists($"{lessonBasePath}\\students\\{group.key}"))
|
|
|
|
+ {
|
|
|
|
+ Directory.CreateDirectory($"{lessonBasePath}\\students\\{group.key}");
|
|
|
|
+ }
|
|
var studentIds = group.list.SelectMany(x => x.studentLessonDatas).Where(x=>!string.IsNullOrWhiteSpace(x.id)).Select(x => x.id).Distinct();
|
|
var studentIds = group.list.SelectMany(x => x.studentLessonDatas).Where(x=>!string.IsNullOrWhiteSpace(x.id)).Select(x => x.id).Distinct();
|
|
- string studentSql = $"select value c from c where c.id in ({string.Join(",", studentIds.Select(x => $"'{x}'"))})";
|
|
|
|
- var studentResults= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<Student>(studentSql, $"Base-{group.key}");
|
|
|
|
- if (studentResults.list.IsNotEmpty())
|
|
|
|
|
|
+ List<Student> schoolStudent = new List<Student>();
|
|
|
|
+ if (System.IO.File.Exists(students_path))
|
|
|
|
+ {
|
|
|
|
+ string jsonData = await System.IO.File.ReadAllTextAsync(students_path);
|
|
|
|
+ schoolStudent= jsonData.ToObject<List<Student>>();
|
|
|
|
+ studentsBase.AddRange(schoolStudent);
|
|
|
|
+ }
|
|
|
|
+ var newIds= studentIds.ExceptBy(schoolStudent.Where(x=>x.schoolId.Equals(group.key)).Select(x=>x.id),x=>x);
|
|
|
|
+ if (newIds!=null && newIds.Count()>0)
|
|
{
|
|
{
|
|
- studentsBase.AddRange(studentResults.list);
|
|
|
|
|
|
+ string studentSql = $"select value c from c where c.id in ({string.Join(",", newIds.Select(x => $"'{x}'"))})";
|
|
|
|
+ var studentResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<Student>(studentSql, $"Base-{group.key}");
|
|
|
|
+ if (studentResults.list.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ schoolStudent.AddRange(studentResults.list);
|
|
|
|
+ studentsBase.AddRange(studentResults.list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(students_path, schoolStudent.ToJsonString());
|
|
|
|
+
|
|
|
|
+ List<StudentSemesterRecord> schoolStudentSemesterRecords=new List<StudentSemesterRecord>();
|
|
|
|
+ if (System.IO.File.Exists(records_path))
|
|
|
|
+ {
|
|
|
|
+ string jsonData = await System.IO.File.ReadAllTextAsync(records_path);
|
|
|
|
+ schoolStudentSemesterRecords= jsonData.ToObject<List<StudentSemesterRecord>>();
|
|
|
|
+ studentSemesterRecords.AddRange(schoolStudentSemesterRecords);
|
|
|
|
+ }
|
|
|
|
+ var newstuIds = studentIds.ExceptBy(studentSemesterRecords.Where(x => x.school.Equals(group.key)).Select(x => x.stuid), x => x);
|
|
|
|
+ if (newstuIds!=null && newstuIds.Count()>0)
|
|
|
|
+ {
|
|
|
|
+ string studentSemesterRecordSql = $"select value c from c where c.stuid in ({string.Join(",", newstuIds.Distinct().Select(x => $"'{x}'"))}) and c.studyYear>=2023";
|
|
|
|
+ var studentSemesterRecordResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<StudentSemesterRecord>(studentSemesterRecordSql, $"StudentSemesterRecord-{group.key}");
|
|
|
|
+ if (studentSemesterRecordResults.list.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ schoolStudentSemesterRecords.AddRange(studentSemesterRecordResults.list);
|
|
|
|
+ studentSemesterRecords.AddRange(studentSemesterRecordResults.list);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- string studentSemesterRecordSql = $"select value c from c where c.stuid in ({string.Join(",", studentIds.Select(x => $"'{x}'"))}) and c.studyYear>=2023";
|
|
|
|
- var studentSemesterRecordResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<StudentSemesterRecord>(studentSemesterRecordSql, $"StudentSemesterRecord-{group.key}");
|
|
|
|
- if (studentSemesterRecordResults.list.IsNotEmpty())
|
|
|
|
|
|
+
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(records_path, schoolStudentSemesterRecords.ToJsonString());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<OverallEducation> schoolOverallEducations = new List<OverallEducation>();
|
|
|
|
+
|
|
|
|
+ if (System.IO.File.Exists(overall_path))
|
|
{
|
|
{
|
|
- studentSemesterRecords.AddRange(studentSemesterRecordResults.list);
|
|
|
|
|
|
+ string jsonData = await System.IO.File.ReadAllTextAsync(overall_path);
|
|
|
|
+ schoolOverallEducations= jsonData.ToObject<List<OverallEducation>>();
|
|
|
|
+ overallEducations.AddRange(schoolOverallEducations);
|
|
}
|
|
}
|
|
- string overallEducationSql = $"select value c from c where c.studentId in ({string.Join(",", studentIds.Select(x => $"'{x}'"))}) and c.year>=2023";
|
|
|
|
- var overallEducationResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<OverallEducation>(overallEducationSql, $"OverallEducation-{group.key}");
|
|
|
|
- if (overallEducationResults.list.IsNotEmpty())
|
|
|
|
|
|
+ var newstuoIds = studentIds.ExceptBy(schoolOverallEducations.Where(x => x.schoolCode.Equals(group.key)).Select(x => x.studentId), x => x);
|
|
|
|
+ if (newstuIds!=null && newstuIds.Count()>0)
|
|
{
|
|
{
|
|
- overallEducations.AddRange(overallEducationResults.list);
|
|
|
|
|
|
+ string overallEducationSql = $"select value c from c where c.studentId in ({string.Join(",", newstuoIds.Select(x => $"'{x}'"))}) and c.year>=2023";
|
|
|
|
+ var overallEducationResults = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).GetList<OverallEducation>(overallEducationSql, $"OverallEducation-{group.key}");
|
|
|
|
+ if (overallEducationResults.list.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+ schoolOverallEducations.AddRange(overallEducationResults.list);
|
|
|
|
+ overallEducations.AddRange(overallEducationResults.list);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(overall_path, schoolOverallEducations.ToJsonString());
|
|
}
|
|
}
|
|
|
|
+
|
|
List<(string id,string owner, List<StudentLessonData> studentLessonData)> studentLessonDatas= new List<(string id, string owner, List<StudentLessonData>)>();
|
|
List<(string id,string owner, List<StudentLessonData> studentLessonData)> studentLessonDatas= new List<(string id, string owner, List<StudentLessonData>)>();
|
|
List<(string id, string owner, List<StudentLessonItem> studentLessons,List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)> lessonItems = new List<(string id, string owner, List<StudentLessonItem> studentLessons, List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)>();
|
|
List<(string id, string owner, List<StudentLessonItem> studentLessons,List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)> lessonItems = new List<(string id, string owner, List<StudentLessonItem> studentLessons, List<CodeBool> codeBools, List<StudentLessonData> studentLessonData)>();
|
|
int n = 0;
|
|
int n = 0;
|
|
@@ -273,37 +357,75 @@ namespace HTEX.DataETL.Controllers
|
|
}
|
|
}
|
|
n++;
|
|
n++;
|
|
}
|
|
}
|
|
- int p = 0;
|
|
|
|
- //XmlDocument xmlDocument = new XmlDocument();
|
|
|
|
- //var runtimePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
|
|
|
- //xmlDocument.Load($"{runtimePath}\\summary.xml");
|
|
|
|
- await Parallel.ForEachAsync(lessonItems, async (lessonItem, cancellationToken) =>
|
|
|
|
- {
|
|
|
|
- lessonItem.studentLessons = LessonETLService.ProcessStudentDataV2(lessonItem.studentLessonData, lessonDataAnalysis, lessonItem.codeBools);
|
|
|
|
- await LessonETLService.ExportToExcelAzureBlob(lessonItem.studentLessons, _azureStorage, lessonItem.owner, $"{lessonItem.id}/student-analysis.xlsx", xmlDocument);
|
|
|
|
- p++;
|
|
|
|
- });
|
|
|
|
- int s = 0;
|
|
|
|
- await Parallel.ForEachAsync(studentLessonDatas, async (studentLessonData, cancellationToken) =>
|
|
|
|
- {
|
|
|
|
- await _azureStorage.GetBlobContainerClient(studentLessonData.owner).UploadFileByContainer(studentLessonData.studentLessonData.ToJsonString(), "records", $"{studentLessonData.id}/student-analysis.json");
|
|
|
|
- s++;
|
|
|
|
- });
|
|
|
|
|
|
|
|
- int m =0;
|
|
|
|
- await Parallel.ForEachAsync(studentSemesterRecords, async (studentSemester, cancellationToken) =>
|
|
|
|
|
|
+
|
|
|
|
+ foreach (var group in schoolGroup)
|
|
{
|
|
{
|
|
- await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code));
|
|
|
|
- m++;
|
|
|
|
- });
|
|
|
|
|
|
+ string students_path = $"{lessonBasePath}\\students\\{group.key}\\students.json";
|
|
|
|
+ string records_path = $"{lessonBasePath}\\students\\{group.key}\\records.json";
|
|
|
|
+ string overall_path = $"{lessonBasePath}\\students\\{group.key}\\overall.json";
|
|
|
|
+ if (!Directory.Exists($"{lessonBasePath}\\students\\{group.key}"))
|
|
|
|
+ {
|
|
|
|
+ Directory.CreateDirectory($"{lessonBasePath}\\students\\{group.key}");
|
|
|
|
+ }
|
|
|
|
+ var schoolStudent = studentsBase.FindAll(x => x.schoolId.Equals(group.key));
|
|
|
|
+ var schoolStudentSemesterRecords= studentSemesterRecords.FindAll(x => x.school.Equals(group.key));
|
|
|
|
+ var schoolOverallEducations = overallEducations.FindAll(x => x.schoolCode.Equals(group.key));
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(students_path, schoolStudent.ToJsonString());
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(records_path, schoolStudentSemesterRecords.ToJsonString());
|
|
|
|
+ await System.IO.File.WriteAllTextAsync(overall_path, schoolOverallEducations.ToJsonString());
|
|
|
|
+ }
|
|
|
|
+ int m = 0;
|
|
|
|
+ var grpdata = studentSemesterRecords.GroupBy(x => x.code).Select(x => new { key = x.Key, list = x.ToList() });
|
|
|
|
+ foreach (var group in grpdata)
|
|
|
|
+ {
|
|
|
|
+ var pages = group.list.Page(66);
|
|
|
|
+
|
|
|
|
+ foreach (var page in pages)
|
|
|
|
+ {
|
|
|
|
+ List<Task<ItemResponse<StudentSemesterRecord>>> list = new();
|
|
|
|
+ foreach (var studentSemester in page)
|
|
|
|
+ {
|
|
|
|
+ list.Add(_azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code))) ;
|
|
|
|
+ m++;
|
|
|
|
+ }
|
|
|
|
+ await Task.WhenAll(list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
int k = 0;
|
|
int k = 0;
|
|
- await Parallel.ForEachAsync(overallEducations, async (overallEducation, cancellationToken) =>
|
|
|
|
|
|
+ var gpover = overallEducations.GroupBy(x => x.code).Select(x => new { key = x.Key, list = x.ToList() });
|
|
|
|
+ foreach (var item in gpover)
|
|
{
|
|
{
|
|
- await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(overallEducation, partitionKey: new PartitionKey(overallEducation.code));
|
|
|
|
- //string key = $"OverallEducation:{overallEducation.schoolCode}:{overallEducation.periodId}:{overallEducation.year}:{overallEducation.semesterId}:{overallEducation?.classId}";
|
|
|
|
- //await _azureRedis.GetRedisClient(8).HashSetAsync(key, overallEducation.studentId, overallEducation.ToJsonString());
|
|
|
|
- //await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, new TimeSpan(180 *24, 0, 0));
|
|
|
|
- k++;
|
|
|
|
|
|
+ var pages = item.list.Page(66);
|
|
|
|
+ foreach (var page in pages)
|
|
|
|
+ {
|
|
|
|
+ List<Task<ItemResponse<OverallEducation>>> list = new();
|
|
|
|
+ foreach (var overallEducation in page)
|
|
|
|
+ {
|
|
|
|
+ list.Add(_azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(overallEducation, partitionKey: new PartitionKey(overallEducation.code)));
|
|
|
|
+
|
|
|
|
+ //string key = $"OverallEducation:{overallEducation.schoolCode}:{overallEducation.periodId}:{overallEducation.year}:{overallEducation.semesterId}:{overallEducation?.classId}";
|
|
|
|
+ //await _azureRedis.GetRedisClient(8).HashSetAsync(key, overallEducation.studentId, overallEducation.ToJsonString());
|
|
|
|
+ //await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, new TimeSpan(180 *24, 0, 0));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ await Task.WhenAll(list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ int p = 0;
|
|
|
|
+ // 获取类的属性
|
|
|
|
+ PropertyInfo[] properties = typeof(StudentLessonItem).GetProperties();
|
|
|
|
+ List<string> summaryes= new List<string>();
|
|
|
|
+ for (int i = 0; i < properties.Length; i++)
|
|
|
|
+ {
|
|
|
|
+ string summary = Regex.Replace(LessonETLService.GetPropertySummary(properties[i], xmlDocument), @"\s+", "");
|
|
|
|
+ summaryes.Add(summary);
|
|
|
|
+ }
|
|
|
|
+ await Parallel.ForEachAsync(lessonItems, async (lessonItem, _) => {
|
|
|
|
+ await _azureStorage.GetBlobContainerClient(lessonItem.owner).UploadFileByContainer(lessonItem.studentLessonData.ToJsonString(), "records", $"{lessonItem.id}/student-analysis.json");
|
|
|
|
+ await LessonETLService.ExportToExcelAzureBlob(lessonItem.studentLessons, _azureStorage, lessonItem.owner, $"{lessonItem.id}/student-analysis.xlsx", xmlDocument, summaryes, properties);
|
|
|
|
+ p++;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return Ok();
|
|
return Ok();
|