CrazyIter_Bin 1 年之前
父節點
當前提交
f92a9dccfe

+ 12 - 7
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -1338,15 +1338,19 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                             case "up-base":
 
                                 //读取TimeLine.json
+                                List<string> PickupMemberIds = new List<string>();
                                 try
                                 {
                                     BlobDownloadResult timeLineBlobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/records/{_lessonId}/IES/TimeLine.json").DownloadContentAsync();
                                     TimeLineData timeLineData = timeLineBlobDownload.Content.ToObjectFromJson<TimeLineData>();
                                     lessonRecord.hitaClientCmpCount = timeLineData.events.Where(z => !string.IsNullOrWhiteSpace(z.WrkCmpSrcType) && z.WrkCmpSrcType.Equals("HitaClientCmp")).Count();
                                     //lessonRecord.collateTaskCount = lessonRecord.hitaClientCmpCount;
-                                    List<TimeLineEvent> timeLineEvents=  timeLineData.events.FindAll(z => !string.IsNullOrWhiteSpace(z.Event) && z.Event.Equals("PickupResult"));
-                                    if (timeLineEvents.IsNotEmpty()) { 
-                                        
+                                    List<TimeLineEvent> timeLineEvents =  timeLineData.events.FindAll(z => !string.IsNullOrWhiteSpace(z.Event) && z.Event.Equals("PickupResult"));
+                                    if (timeLineEvents.IsNotEmpty()) {
+                                        foreach (var timeLineEvent in timeLineEvents) {
+                                           var memberIds= timeLineEvent.PickupMemberId.ToObject<List<string>>();
+                                            PickupMemberIds.AddRange(memberIds);
+                                        }
                                     }
                                 }
                                 catch (Exception ex)
@@ -1357,11 +1361,11 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     }
                                 }
                                 //读取Task.json
+                                List<TaskData> taskDatas = new List<TaskData>();
                                 try
                                 {
                                     BlobDownloadResult taskBlobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/records/{_lessonId}/IES/Task.json").DownloadContentAsync();
-                                    List<TaskData> timeLineData = taskBlobDownload.Content.ToObjectFromJson<List<TaskData>>();
-                                   
+                                    taskDatas = taskBlobDownload.Content.ToObjectFromJson<List<TaskData>>();
                                 }
                                 catch (Exception ex)
                                 {
@@ -1371,10 +1375,11 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     }
                                 }
                                 //读取IRS.json
+                                List<IRSData> iRSDatas = new List<IRSData>();
                                 try
                                 {
                                     BlobDownloadResult irsBlobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/records/{_lessonId}/IES/IRS.json").DownloadContentAsync();
-                                    List<IRSData> iRSDatas = irsBlobDownload.Content.ToObjectFromJson<List<IRSData>>();
+                                    iRSDatas = irsBlobDownload.Content.ToObjectFromJson<List<IRSData>>();
 
                                 }
                                 catch (Exception ex)
@@ -1536,7 +1541,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     //await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} blob刷新完成!", GroupNames.醍摩豆服務運維群組);
                                     await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "update", root = "records", name = $"{blobname}" }, _serviceBus, _configuration, _azureRedis);
                                     msgs.Add(update);
-                                    DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher, _serviceBus, _azureStorage, _configuration, lessonBase,_azureRedis);
+                                    DoLessonStudentRecord(_dingDing, _snowflakeId, lessonRecord, scope, client, school, tmdid, teacher, _serviceBus, _azureStorage, _configuration, lessonBase,_azureRedis ,PickupMemberIds ,taskDatas,iRSDatas );
 
                                 }
                                 catch (Exception ex)

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/LessonRecord.cs

@@ -251,6 +251,7 @@ namespace TEAMModelOS.SDK.Models
         public string pageID { get; set; }
         public bool isBuzz { get; set; }
         public List<string> buzzClients { get; set; } = new List<string>();
+        public List<IRSClientAnswer> clientAnswers { get; set; }= new List<IRSClientAnswer>();
 
     }
     public class IRSClientAnswer {

+ 29 - 2
TEAMModelOS.SDK/Models/Service/LessonService.cs

@@ -169,7 +169,7 @@ namespace TEAMModelOS.SDK.Models.Service
             return dict;
         }
         public static async void DoLessonStudentRecord(DingDing _dingding, SnowflakeId snowflakeId, LessonRecord lessonRecord, string scope, CosmosClient client, string school, string tmdid,
-            Teacher teacher,   AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase,AzureRedisFactory _azureRedis)
+            Teacher teacher,   AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, IConfiguration _configuration, LessonBase lessonBase,AzureRedisFactory _azureRedis, List<string> pickupMemberIds, List<TaskData> taskDatas, List<IRSData> iRSDatas)
         {
             School schoolBase = null;
             Period period = null;
@@ -229,9 +229,36 @@ namespace TEAMModelOS.SDK.Models.Service
                      
                 }
                 List <Task<ItemResponse<StudentScoreRecord>>> records = new List<Task<ItemResponse<StudentScoreRecord>>>();
-                 HashSet <OverallEducation> overallEducations   = new HashSet<OverallEducation>();
+                HashSet <OverallEducation> overallEducations   = new HashSet<OverallEducation>();
+
+                // 互动次数,-1 表示没有进行互动。 与 0 不同
+                int interactCount = -1;
+                if (iRSDatas.IsNotEmpty()) {
+                    interactCount= iRSDatas.Where(z => z.isBuzz==false).SelectMany(v => v.clientAnswers).Count();
+                }
+                //任务发布次数 ,-1 表示没有进行互动。 与 0 不同
+                int taskCount = -1;
+                if (taskDatas.IsNotEmpty())
+                {
+                    taskCount=0;
+                   foreach (var taskData in taskDatas)
+                    {
+                        var isGroupItem=  taskData.clientWorks.FindAll(z => z.isGroupItem);
+                        if (isGroupItem.IsNotEmpty())
+                        {
+                            //有组任务
+                        }
+                        else {
+                            //没有组任务
+
+                            taskCount+=1;
+                        }
+                    }
+                }
                 foreach (var x in stuids) {
                     var record = lessonStudentRecords.Find(l => l.stuid.Equals(x.id) && l.code.Equals($"StudentScoreRecord") && l.school.Equals(x.school));
+
+
                     ClientSummaryList clientSummaryList = lessonBase.report.clientSummaryList.Find(c => c.seatID == x.seatID);
                     if (record != null)
                     {