|
@@ -212,8 +212,9 @@ namespace HTEX.DataETL.Controllers
|
|
|
}
|
|
|
}
|
|
|
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.expire<=0 and c.status<>404 and c.duration>300 and c.pk='LessonRecord' ");
|
|
|
+ .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" };
|
|
|
int index = 0;
|
|
|
if (resultSchool.list.IsNotEmpty())
|
|
@@ -221,24 +222,41 @@ namespace HTEX.DataETL.Controllers
|
|
|
List<StudentSemesterRecord> studentSemesterRecords= new List<StudentSemesterRecord>();
|
|
|
List<OverallEducation> overallEducations= new List<OverallEducation>();
|
|
|
List<Student> studentsBase = new List<Student>();
|
|
|
+ List<LessonLocal>lessonLocals = new List<LessonLocal>();
|
|
|
await Parallel.ForEachAsync(resultSchool.list, async (lessonRecord, cancellationToken) =>
|
|
|
{
|
|
|
var item = await LessonETLService.GetLessonLocal(lessonRecord,localIds,_azureStorage,pathLessons);
|
|
|
- var studata = await LessonETLService.DoStudentLessonData(Constant.objectiveTypes, _azureStorage, item, _dingDing, _azureCosmos.GetCosmosClient(), "China", _azureRedis, studentSemesterRecords, overallEducations, lessonDataAnalysis, studentsBase, schools);
|
|
|
+ lessonLocals.Add(item);
|
|
|
index++;
|
|
|
});
|
|
|
-
|
|
|
+ int n = 0;
|
|
|
+ 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())
|
|
|
+ {
|
|
|
+ schools.AddRange(schoolResults.list);
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var item in lessonLocals)
|
|
|
+ {
|
|
|
+ var studata = await LessonETLService.DoStudentLessonData(Constant.objectiveTypes, _azureStorage, item, _dingDing, _azureCosmos.GetCosmosClient(), "China", _azureRedis, studentSemesterRecords, overallEducations, lessonDataAnalysis, studentsBase, schools);
|
|
|
+ n++;
|
|
|
+ }
|
|
|
+ int m =0;
|
|
|
await Parallel.ForEachAsync(studentSemesterRecords, async (studentSemester, cancellationToken) =>
|
|
|
{
|
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).UpsertItemAsync(studentSemester, new PartitionKey(studentSemester.code));
|
|
|
-
|
|
|
+ m++;
|
|
|
});
|
|
|
+ int k = 0;
|
|
|
await Parallel.ForEachAsync(overallEducations, async (overallEducation, cancellationToken) =>
|
|
|
{
|
|
|
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));
|
|
|
+ //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++;
|
|
|
});
|
|
|
}
|
|
|
return Ok();
|