Browse Source

update。

CrazyIter_Bin 3 years ago
parent
commit
10d73f4bfc

+ 3 - 3
TEAMModelOS.SDK/Models/Cosmos/Common/LessonStudentRecord.cs

@@ -7,12 +7,12 @@ using System.Threading.Tasks;
 namespace TEAMModelOS.SDK.Models.Cosmos.Common
 namespace TEAMModelOS.SDK.Models.Cosmos.Common
 {
 {
     /// <summary>
     /// <summary>
-    /// 课堂记录简要信息。
+    /// 学生课堂记录简要信息。
     /// </summary>
     /// </summary>
     public class LessonStudentRecord : CosmosEntity
     public class LessonStudentRecord : CosmosEntity
     {
     {
-        // id 学生id、醍摩豆id  ,
-        //code  LessonStudentRecord[-学校编码],
+        // id 学生id、                            醍摩豆id  ,
+        //code  LessonStudentRecord[-学校编码],  LessonStudentRecord
         //其他基础信息
         //其他基础信息
         public LessonStudentRecord() {
         public LessonStudentRecord() {
             pk = "LessonStudentRecord";
             pk = "LessonStudentRecord";

+ 11 - 7
TEAMModelOS.SDK/Models/Service/LessonService.cs

@@ -20,13 +20,13 @@ namespace TEAMModelOS.SDK.Models.Service
         public static async void DoLessonStudentRecord(LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
         public static async void DoLessonStudentRecord(LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
             Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase)
             Teacher teacher, NotificationService _notificationService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase)
         {
         {
-            var stuids = lessonBase.student.Where(x => x.type == 2).Select(x => new IdNameCode { id = x.id ,code=x.school});
+            var stuids = lessonBase.student.Where(x => x.type == 2);
             if (stuids.Any()) {
             if (stuids.Any()) {
                 stuids.ToList().ForEach(x => {
                 stuids.ToList().ForEach(x => {
-                    x.code = string.IsNullOrWhiteSpace(x.code) ? school : x.code;
+                    x.school = string.IsNullOrWhiteSpace(x.school) ? school : x.school;
                 });
                 });
             }
             }
-            var groups= stuids.Where(z=>!string.IsNullOrWhiteSpace(z.code)).GroupBy(x => x.code).Select(y=>new { code=y.Key,list=y.ToList()});
+            var groups= stuids.Where(z=>!string.IsNullOrWhiteSpace(z.school)).GroupBy(x => x.school).Select(y=>new { code=y.Key,list=y.ToList()});
             List<LessonStudentRecord> lessonStudentRecords = new List<LessonStudentRecord>();
             List<LessonStudentRecord> lessonStudentRecords = new List<LessonStudentRecord>();
             foreach (var group in groups) {
             foreach (var group in groups) {
                
                
@@ -36,7 +36,7 @@ namespace TEAMModelOS.SDK.Models.Service
                 }
                 }
 
 
             }
             }
-            var tmdids = lessonBase.student.Where(x => x.type == 1).Select(x => new { id = x.id });
+            var tmdids = lessonBase.student.Where(x => x.type == 1);
             if (tmdids.Any()) {
             if (tmdids.Any()) {
                 string tmdsql = $"select value(c) from c where c.id in({string.Join(",", tmdids.Select(x => $"'{x}'"))})";
                 string tmdsql = $"select value(c) from c where c.id in({string.Join(",", tmdids.Select(x => $"'{x}'"))})";
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIterator<LessonStudentRecord>(queryText: tmdsql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"LessonStudentRecord") }))
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIterator<LessonStudentRecord>(queryText: tmdsql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"LessonStudentRecord") }))
@@ -46,10 +46,12 @@ namespace TEAMModelOS.SDK.Models.Service
             }
             }
             List<Task<ItemResponse<LessonStudentRecord>>> records = new List<Task<ItemResponse<LessonStudentRecord>>>();
             List<Task<ItemResponse<LessonStudentRecord>>> records = new List<Task<ItemResponse<LessonStudentRecord>>>();
             stuids.ToList().ForEach(x => {
             stuids.ToList().ForEach(x => {
-                var record = lessonStudentRecords.Find(l => l.id.Equals(x.id) && l.code.Equals($"LessonStudentRecord-{x.code}"));
+                var record = lessonStudentRecords.Find(l => l.id.Equals(x.id) && l.code.Equals($"LessonStudentRecord-{x.school}"));
                 if (record != null)
                 if (record != null)
                 {
                 {
-                    record.records.Add(new StudentRecord {
+                    ClientSummaryList?  clientSummaryList= lessonBase.report.clientSummaryList.Find(c => c.seatID == x.seatID);
+                    record.records.Add(new StudentRecord
+                    {
                         tmdid = teacher.id,
                         tmdid = teacher.id,
                         tmdname = teacher.name,
                         tmdname = teacher.name,
                         name = lessonRecord.name,
                         name = lessonRecord.name,
@@ -59,7 +61,9 @@ namespace TEAMModelOS.SDK.Models.Service
                         courseId = lessonRecord.courseId,
                         courseId = lessonRecord.courseId,
                         periodId = lessonRecord.periodId,
                         periodId = lessonRecord.periodId,
                         subjectId = lessonRecord.subjectId,
                         subjectId = lessonRecord.subjectId,
-                    });
+                        report = clientSummaryList
+
+                    }) ;
                 }
                 }
                 else { 
                 else {