|
@@ -7,6 +7,7 @@ using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
|
|
|
using MathNet.Numerics;
|
|
|
using MathNet.Numerics.Distributions;
|
|
|
using Microsoft.Azure.Cosmos;
|
|
|
+using Microsoft.Azure.Cosmos.Linq;
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using OfficeOpenXml;
|
|
@@ -93,60 +94,70 @@ namespace HTEX.Lib.ETL.Lesson
|
|
|
{
|
|
|
string? periodId = !string.IsNullOrWhiteSpace(lessonLocal.lessonRecord.periodId) ? lessonLocal.lessonRecord.periodId : school.period.FirstOrDefault()?.id;
|
|
|
var period = school.period.Find(x => x.id.Equals(periodId));
|
|
|
- var semester = SchoolService.GetSemester(period, lessonLocal.lessonRecord.startTime);
|
|
|
- string pre_id = $"{semester.studyYear}-{semester.currSemester.id}";
|
|
|
- string code = $"StudentSemesterRecord-{school.id}";
|
|
|
- foreach (var studentLessonData in studentLessonDatas)
|
|
|
+ if (period!=null)
|
|
|
{
|
|
|
- StudentSemesterRecord studentSemester = null;// students.Find(x => x.stuid.Equals(studentLessonData.id) &&x.id.Equals($"{pre_id}-{studentLessonData.id}") && x.code.Equals(code));
|
|
|
- if (studentSemester==null)
|
|
|
+ var semester = SchoolService.GetSemester(period, lessonLocal.lessonRecord.startTime);
|
|
|
+ string pre_id = $"{semester.studyYear}-{semester.currSemester.id}";
|
|
|
+ string code = $"StudentSemesterRecord-{school.id}";
|
|
|
+ foreach (var studentLessonData in studentLessonDatas)
|
|
|
{
|
|
|
- studentSemester= new StudentSemesterRecord
|
|
|
+ StudentSemesterRecord studentSemester = null;
|
|
|
+ ResponseMessage responseMessage = await client.GetContainer(Constant.TEAMModelOS, Constant.Student).ReadItemStreamAsync($"{pre_id}-{studentLessonData.id}", new PartitionKey(code));
|
|
|
+ if (responseMessage.IsSuccessStatusCode)
|
|
|
{
|
|
|
- id= $"{pre_id}-{studentLessonData.id}",
|
|
|
- code=code,
|
|
|
- stuid= studentLessonData.id,
|
|
|
- userType=Constant.ScopeStudent,
|
|
|
- school=school.id,
|
|
|
- studyYear=semester.studyYear,
|
|
|
- semesterId=semester.currSemester.id,
|
|
|
- period= period?.id,
|
|
|
- };
|
|
|
- // students.Add(studentSemester);
|
|
|
- }
|
|
|
- StuLesson lesson = new StuLesson()
|
|
|
- {
|
|
|
- id= lessonLocal.lessonRecord.id,
|
|
|
- time= lessonLocal.lessonRecord.startTime,
|
|
|
- attend=0
|
|
|
- };
|
|
|
- if (studentLessonData.cooperation>0 || studentLessonData.achieve>0|| studentLessonData.attitude>0 || studentLessonData.cowork>0 || studentLessonData.appraise>0)
|
|
|
- {
|
|
|
- lesson.attend=1;
|
|
|
- studentSemester.lessons.Add(new StuLessonLite
|
|
|
+ studentSemester= JsonDocument.Parse(responseMessage.Content).ToObject<StudentSemesterRecord>();
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- tmdid=lessonLocal.lessonRecord.tmdid,
|
|
|
- sid= lessonLocal.lessonRecord.subjectId,
|
|
|
- cid= lessonLocal.lessonRecord.courseId,
|
|
|
- hrate=studentLessonData.cooperation,
|
|
|
- crate=studentLessonData.achieve,
|
|
|
- trate=studentLessonData.attitude,
|
|
|
- xrate=studentLessonData.cowork,
|
|
|
- prate=studentLessonData.appraise
|
|
|
- });
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (studentLessonData.attend==1)
|
|
|
+ studentSemester= new StudentSemesterRecord
|
|
|
+ {
|
|
|
+ id= $"{pre_id}-{studentLessonData.id}",
|
|
|
+ code=code,
|
|
|
+ stuid= studentLessonData.id,
|
|
|
+ userType=Constant.ScopeStudent,
|
|
|
+ school=school.id,
|
|
|
+ studyYear=semester.studyYear,
|
|
|
+ semesterId=semester.currSemester.id,
|
|
|
+ period= period?.id,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ studentSemester.les.Find(x => x.id.Equals(lessonLocal.lessonRecord.id));
|
|
|
+
|
|
|
+ StuLesson lesson = new StuLesson()
|
|
|
+ {
|
|
|
+ id= lessonLocal.lessonRecord.id,
|
|
|
+ time= lessonLocal.lessonRecord.startTime,
|
|
|
+ attend=0
|
|
|
+ };
|
|
|
+ if (studentLessonData.cooperation>0 || studentLessonData.achieve>0|| studentLessonData.attitude>0 || studentLessonData.cowork>0 || studentLessonData.appraise>0)
|
|
|
{
|
|
|
lesson.attend=1;
|
|
|
+ studentSemester.lessons.Add(new StuLessonLite
|
|
|
+ {
|
|
|
+
|
|
|
+ tmdid=lessonLocal.lessonRecord.tmdid,
|
|
|
+ sid= lessonLocal.lessonRecord.subjectId,
|
|
|
+ cid= lessonLocal.lessonRecord.courseId,
|
|
|
+ hrate=studentLessonData.cooperation,
|
|
|
+ crate=studentLessonData.achieve,
|
|
|
+ trate=studentLessonData.attitude,
|
|
|
+ xrate=studentLessonData.cowork,
|
|
|
+ prate=studentLessonData.appraise
|
|
|
+ });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- lesson.attend=0;
|
|
|
+ if (studentLessonData.attend==1)
|
|
|
+ {
|
|
|
+ lesson.attend=1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lesson.attend=0;
|
|
|
+ }
|
|
|
}
|
|
|
+ studentSemester.les.Add(lesson);
|
|
|
}
|
|
|
- studentSemester.les.Add(lesson);
|
|
|
}
|
|
|
}
|
|
|
}
|