Browse Source

Merge branch 'develop-StudentActivity' into develop

CrazyIter_Bin 1 year ago
parent
commit
b194aaf355
28 changed files with 775 additions and 755 deletions
  1. 2 2
      TEAMModelBI/Controllers/BIStudent/StudentController.cs
  2. 103 101
      TEAMModelOS.FunctionV4/CosmosDB/TriggerArt.cs
  3. 1 1
      TEAMModelOS.FunctionV4/CosmosDB/TriggerCorrect.cs
  4. 3 1
      TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs
  5. 26 27
      TEAMModelOS.FunctionV4/CosmosDB/TriggerExamLite.cs
  6. 12 11
      TEAMModelOS.FunctionV4/CosmosDB/TriggerHomework.cs
  7. 8 7
      TEAMModelOS.FunctionV4/CosmosDB/TriggerStudy.cs
  8. 96 93
      TEAMModelOS.FunctionV4/CosmosDB/TriggerSurvey.cs
  9. 16 11
      TEAMModelOS.FunctionV4/CosmosDB/TriggerVote.cs
  10. 7 7
      TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs
  11. 37 37
      TEAMModelOS.SDK/Models/Service/Common/ActivityStudentService.cs
  12. 25 20
      TEAMModelOS.SDK/Models/Service/IESActivityService.cs
  13. 225 75
      TEAMModelOS.SDK/Models/Service/StudentService.cs
  14. 4 0
      TEAMModelOS/ClientApp/src/api/studentWeb.js
  15. 4 7
      TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/ArtTestReport.vue
  16. 4 4
      TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/PaperView.vue
  17. 46 14
      TEAMModelOS/ClientApp/src/components/student-web/EventView/EventList.vue
  18. 30 17
      TEAMModelOS/ClientApp/src/components/student-web/HomeView/HomeView.vue
  19. 1 0
      TEAMModelOS/ClientApp/src/router/routes.js
  20. 11 0
      TEAMModelOS/ClientApp/src/view/student-web/AppNew.vue
  21. 21 6
      TEAMModelOS/Controllers/Common/ArtController.cs
  22. 1 1
      TEAMModelOS/Controllers/Common/CommonController.cs
  23. 58 65
      TEAMModelOS/Controllers/Common/ExamController.cs
  24. 25 25
      TEAMModelOS/Controllers/Common/HomeworkController.cs
  25. 2 2
      TEAMModelOS/Controllers/Student/StudentCommonController.cs
  26. 3 27
      TEAMModelOS/Controllers/Teacher/TeacherCommonController.cs
  27. 1 25
      TEAMModelOS/Controllers/XTest/DataMigrationController.cs
  28. 3 169
      TEAMModelOS/Controllers/XTest/FixDataController.cs

+ 2 - 2
TEAMModelBI/Controllers/BIStudent/StudentController.cs

@@ -106,7 +106,7 @@ namespace TEAMModelBI.Controllers.BIStudent
 
                 if (correctStus.Count > 0)
                 {
-                    foreach (var correct in correctStus)
+                    /*foreach (var correct in correctStus)
                     {
                         StuActivity stuActivity = await cosmosClient.GetContainer("TEAMModelOS", "Student").ReadItemAsync<StuActivity>(correct.id, new PartitionKey(correct.code));
                         if (stuActivity != null)
@@ -115,7 +115,7 @@ namespace TEAMModelBI.Controllers.BIStudent
 
                             await cosmosClient.GetContainer("TEAMModelOS", "Student").ReplaceItemAsync<StuActivity>(stuActivity, stuActivity.id, new PartitionKey(stuActivity.code));
                         }
-                    }
+                    }*/
 
                     return Ok(new { state = 200, msg = "去重成功" });
                 }

+ 103 - 101
TEAMModelOS.FunctionV4/CosmosDB/TriggerArt.cs

@@ -42,7 +42,7 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
                     ActivityList data = input.ToObject<ActivityList>();
                     //删除blob 相关资料
                     await _azureStorage.GetBlobServiceClient().DeleteBlobs(_dingDing, tdata.school, new List<string> { $"art/{tdata.id}" });
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                   // await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                     List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tdata.id } });
                     foreach (var record in records)
@@ -113,108 +113,110 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
                             break;
                         case "going":
 
-                            if (art.classes.Count > 0)
+                            /*
+                             if (art.classes.Count > 0)
                             {
-                                List<string> classes = ExamService.getClasses(art.classes, art.stuLists);
-                                (List<RMember> tmdIds, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classes, art.school, null);
-                                var addStudentsCls = tmdIds.FindAll(x => x.type == 2);
-                                var addTmdidsCls = tmdIds.FindAll(x => x.type == 1);
-                                List<string> tmds = new List<string>();
-                                if (addTmdidsCls.IsNotEmpty())
-                                {
-                                    tmds.AddRange(addTmdidsCls.Select(x => x.id).ToList());
-                                }
-                                List<StuActivity> stuActivities = new List<StuActivity>();
-                                List<StuActivity> tmdActivities = new List<StuActivity>();
-                                List<StuActivity> tchActivities = new List<StuActivity>();
-                                List<string> sub = new();
-                                if (art.subjects.Count > 0)
-                                {
-                                    foreach (var course in art.subjects)
-                                    {
-                                        sub.Add(course.id);
-                                    }
-                                }
-                                if (tmds.IsNotEmpty())
-                                {
-                                    tmds.ForEach(x =>
-                                    {
-                                        HashSet<string> classIds = new HashSet<string>();
-                                        classLists.ForEach(z =>
-                                        {
-                                            z.members.ForEach(y =>
-                                            {
-                                                if (y.id.Equals(x) && y.type == 1)
-                                                {
-                                                    classIds.Add(z.id);
-                                                }
-                                            });
-                                        });
-                                        tmdActivities.Add(new StuActivity
-                                        {
-                                            pk = "Activity",
-                                            id = art.id,
-                                            code = $"Activity-{x}",
-                                            type = "Art",
-                                            name = art.name,
-                                            startTime = art.startTime,
-                                            endTime = art.endTime,
-                                            scode = art.code,
-                                            scope = art.scope,
-                                            school = art.school,
-                                            creatorId = art.creatorId,
-                                            subjects = sub,
-                                            blob = null,
-                                            owner = art.owner,
-                                            createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
-                                            ext = new Dictionary<string, JsonElement>() { { "subjects", art.subjects.ToJsonString().ToObject<JsonElement>() } },
-                                            taskStatus = -1,
-                                            classIds = classIds.ToList()
-                                        });
-                                    });
-                                }
-                                if (addStudentsCls.IsNotEmpty())
-                                {
-                                    addStudentsCls.ForEach(x =>
-                                    {
-                                        HashSet<string> classIds = new HashSet<string>();
-                                        classLists.ForEach(z =>
-                                        {
-                                            z.members.ForEach(y =>
-                                            {
-                                                if (y.id.Equals(x.id) && y.code.Equals(art.school) && y.type == 2)
-                                                {
-                                                    classIds.Add(z.id);
-                                                }
-                                            });
-                                        });
-                                        stuActivities.Add(new StuActivity
-                                        {
-                                            pk = "Activity",
-                                            id = art.id,
-                                            code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
-                                            type = "Art",
-                                            name = art.name,
-                                            startTime = art.startTime,
-                                            endTime = art.endTime,
-                                            scode = art.code,
-                                            scope = art.scope,
-                                            school = art.school,
-                                            creatorId = art.creatorId,
-                                            subjects = sub,
-                                            blob = null,
-                                            owner = art.owner,
-                                            createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
-                                            ext = new Dictionary<string, JsonElement>() { { "subjects", art.subjects.ToJsonString().ToObject<JsonElement>() } },
-                                            taskStatus = -1,
-                                            classIds = classIds.ToList()
-                                        });
-                                    });
-                                }
-                                await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
-                                //await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client)
 
-                            }
+                               List<string> classes = ExamService.getClasses(art.classes, art.stuLists);
+                               (List<RMember> tmdIds, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classes, art.school, null);
+                               var addStudentsCls = tmdIds.FindAll(x => x.type == 2);
+                               var addTmdidsCls = tmdIds.FindAll(x => x.type == 1);
+                               List<string> tmds = new List<string>();
+                               if (addTmdidsCls.IsNotEmpty())
+                               {
+                                   tmds.AddRange(addTmdidsCls.Select(x => x.id).ToList());
+                               }
+                               List<StuActivity> stuActivities = new List<StuActivity>();
+                               List<StuActivity> tmdActivities = new List<StuActivity>();
+                               List<StuActivity> tchActivities = new List<StuActivity>();
+                               List<string> sub = new();
+                               if (art.subjects.Count > 0)
+                               {
+                                   foreach (var course in art.subjects)
+                                   {
+                                       sub.Add(course.id);
+                                   }
+                               }
+                               if (tmds.IsNotEmpty())
+                               {
+                                   tmds.ForEach(x =>
+                                   {
+                                       HashSet<string> classIds = new HashSet<string>();
+                                       classLists.ForEach(z =>
+                                       {
+                                           z.members.ForEach(y =>
+                                           {
+                                               if (y.id.Equals(x) && y.type == 1)
+                                               {
+                                                   classIds.Add(z.id);
+                                               }
+                                           });
+                                       });
+                                       tmdActivities.Add(new StuActivity
+                                       {
+                                           pk = "Activity",
+                                           id = art.id,
+                                           code = $"Activity-{x}",
+                                           type = "Art",
+                                           name = art.name,
+                                           startTime = art.startTime,
+                                           endTime = art.endTime,
+                                           scode = art.code,
+                                           scope = art.scope,
+                                           school = art.school,
+                                           creatorId = art.creatorId,
+                                           subjects = sub,
+                                           blob = null,
+                                           owner = art.owner,
+                                           createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                           ext = new Dictionary<string, JsonElement>() { { "subjects", art.subjects.ToJsonString().ToObject<JsonElement>() } },
+                                           taskStatus = -1,
+                                           classIds = classIds.ToList()
+                                       });
+                                   });
+                               }
+                               if (addStudentsCls.IsNotEmpty())
+                               {
+                                   addStudentsCls.ForEach(x =>
+                                   {
+                                       HashSet<string> classIds = new HashSet<string>();
+                                       classLists.ForEach(z =>
+                                       {
+                                           z.members.ForEach(y =>
+                                           {
+                                               if (y.id.Equals(x.id) && y.code.Equals(art.school) && y.type == 2)
+                                               {
+                                                   classIds.Add(z.id);
+                                               }
+                                           });
+                                       });
+                                       stuActivities.Add(new StuActivity
+                                       {
+                                           pk = "Activity",
+                                           id = art.id,
+                                           code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
+                                           type = "Art",
+                                           name = art.name,
+                                           startTime = art.startTime,
+                                           endTime = art.endTime,
+                                           scode = art.code,
+                                           scope = art.scope,
+                                           school = art.school,
+                                           creatorId = art.creatorId,
+                                           subjects = sub,
+                                           blob = null,
+                                           owner = art.owner,
+                                           createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                           ext = new Dictionary<string, JsonElement>() { { "subjects", art.subjects.ToJsonString().ToObject<JsonElement>() } },
+                                           taskStatus = -1,
+                                           classIds = classIds.ToList()
+                                       });
+                                   });
+                               }
+                               await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
+
+
+                           }*/
                             var messageVoteEnd = new ServiceBusMessage(new { tdata.id, progress = "finish", tdata.code }.ToJsonString());
                             messageVoteEnd.ApplicationProperties.Add("name", "Art");
                             if (voteRecords.Count > 0)

+ 1 - 1
TEAMModelOS.FunctionV4/CosmosDB/TriggerCorrect.cs

@@ -27,7 +27,7 @@ namespace TEAMModelOS.FunctionV4
             {
                 await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                 ActivityList data = input.ToObject<ActivityList>();
-                await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                //await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                 var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                 List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tdata.id } });
                 foreach (var record in records)

+ 3 - 1
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -54,7 +54,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(data.id, new PartitionKey(data.code));
                     ActivityList activity = input.ToObject<ActivityList>();
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, activity);
+                    //await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, activity);
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                     List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", data.id } });
                     foreach (var record in records)
@@ -1185,6 +1185,7 @@ namespace TEAMModelOS.FunctionV4
                 }
             }
             (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classes, info.school, ps);
+            /*
             var addStudentsCls = tchList.FindAll(x => x.type == 2);
             var addTmdidsCls = tchList.FindAll(x => x.type == 1);
             List<StuActivity> stuActivities = new List<StuActivity>();
@@ -1362,6 +1363,7 @@ namespace TEAMModelOS.FunctionV4
                 });
             }
             await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, null);
+             */
             return classLists;
         }
 

+ 26 - 27
TEAMModelOS.FunctionV4/CosmosDB/TriggerExamLite.cs

@@ -29,7 +29,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                     ActivityList data = input.ToObject<ActivityList>();
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                   // await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                     List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tdata.id } });
                     foreach (var record in records)
@@ -112,7 +112,7 @@ namespace TEAMModelOS.FunctionV4
                                 }
                             }
                             (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, lite.tchLists, lite.school, ps);
-                            List<StuActivity> tchActivities = new();
+                            //List<StuActivity> tchActivities = new();
                             (string standard, List<string> tmdids, string school, List<string> update, int statistics)  list =    (null,null, null, new List<string> { StatisticsService.TeacherExamLite }, 0)  ;
                             if (tchList.IsNotEmpty())
                             {
@@ -124,33 +124,32 @@ namespace TEAMModelOS.FunctionV4
                                     list.school = school.id;
                                     list.standard = school.standard;
                                 }
-                                tchList.ForEach(x =>
-                                {
-                                    tchActivities.Add(new StuActivity
-                                    {
-                                        pk = "Activity",
-                                        id = lite.id,
-                                        code = $"Activity-{x.id}",
-                                        type = "ExamLite",
-                                        name = lite.name,
-                                        startTime = lite.startTime,
-                                        endTime = lite.endTime,
-                                        scode = lite.code,
-                                        scope = lite.scope,
-                                        school = lite.school,
-                                        creatorId = lite.creatorId,
-                                        subjects = new List<string> { "" },
-                                        blob = null,
-                                        owner = lite.owner,
-                                        createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
-                                        taskStatus = -1,
-                                        classIds = lite.tchLists
-                                    });
-                                   
-                                });
+                                //tchList.ForEach(x =>
+                                //{
+                                //    tchActivities.Add(new StuActivity
+                                //    {
+                                //        pk = "Activity",
+                                //        id = lite.id,
+                                //        code = $"Activity-{x.id}",
+                                //        type = "ExamLite",
+                                //        name = lite.name,
+                                //        startTime = lite.startTime,
+                                //        endTime = lite.endTime,
+                                //        scode = lite.code,
+                                //        scope = lite.scope,
+                                //        school = lite.school,
+                                //        creatorId = lite.creatorId,
+                                //        subjects = new List<string> { "" },
+                                //        blob = null,
+                                //        owner = lite.owner,
+                                //        createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                //        taskStatus = -1,
+                                //        classIds = lite.tchLists
+                                //    });
+                                //});
                               
                             }
-                            await IESActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
+                            //await IESActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
                             await StatisticsService.SendServiceBus(list, _configuration, _serviceBus,   client);
                             var messageWorkEnd = new ServiceBusMessage(new { id = tdata.id, progress = "finish", code = tdata.code }.ToJsonString());
                             messageWorkEnd.ApplicationProperties.Add("name", "ExamLite");

+ 12 - 11
TEAMModelOS.FunctionV4/CosmosDB/TriggerHomework.cs

@@ -30,7 +30,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                     ActivityList data = input.ToObject<ActivityList>();
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                    //await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                     List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tdata.id } });
                     foreach (var record in records)
@@ -191,14 +191,13 @@ namespace TEAMModelOS.FunctionV4
             (List<RMember> tmdids, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classes, work.school, ps);
             var addStudentsCls = tmdids.FindAll(x => x.type == 2);
             var addTmdidsCls = tmdids.FindAll(x => x.type == 1);
-            List<StuActivity> stuActivities = new();
-            List<StuActivity> tmdActivities = new();
-            List<StuActivity> tchActivities = new();
-
+            //List<StuActivity> stuActivities = new();
+            //List<StuActivity> tmdActivities = new();
+            //List<StuActivity> tchActivities = new();
+            //List<StuActivity> tac = new();
             List<string> tIds = addStudentsCls.Select(x => x.id).ToList();
-            List<StuActivity> tac = new();
-
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuActivity>(queryText: $"select value(c) from c where c.id ='{work.id}' and c.type = 'Homework'"))
+            /*
+                         await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuActivity>(queryText: $"select value(c) from c where c.id ='{work.id}' and c.type = 'Homework'"))
             {
                 tac.Add(item);
 
@@ -319,6 +318,7 @@ namespace TEAMModelOS.FunctionV4
                     });
                 });
             }
+             */
             (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, work.tchLists, work.school, ps);
             (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.OfflineRecord }, 0);
             if (tchList.IsNotEmpty())
@@ -331,7 +331,8 @@ namespace TEAMModelOS.FunctionV4
                     list.school = school.id;
                     list.standard = school.standard;
                 }
-                tchList.ForEach(x =>
+                /*
+                 tchList.ForEach(x =>
                 {
                     HashSet<string> classIds = new();
                     classInfos.ForEach(z =>
@@ -375,9 +376,9 @@ namespace TEAMModelOS.FunctionV4
                     });
 
                 });
-
+                 */
             }
-            await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
+            //await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
             await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
 
         }

+ 8 - 7
TEAMModelOS.FunctionV4/CosmosDB/TriggerStudy.cs

@@ -35,7 +35,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                     ActivityList data = input.ToObject<ActivityList>();
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                    //await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
                     List<ChangeRecord> records = await table_cancel.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", tdata.id } });
                     foreach (var record in records)
@@ -121,7 +121,7 @@ namespace TEAMModelOS.FunctionV4
                                     }
                                 }
                                 (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, study.tchLists, study.school, ps);
-                                List<StuActivity> tchActivities = new List<StuActivity>();
+                                //List<StuActivity> tchActivities = new List<StuActivity>();
                                 (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.OfflineRecord }, 0);
                                 if (tchList.IsNotEmpty())
                                 {                                  
@@ -150,9 +150,9 @@ namespace TEAMModelOS.FunctionV4
                                             }
                                         }
                                     }
-                                   /* var groupNames =  study.groupLists.FirstOrDefault().Select(x => x.Value).FirstOrDefault();
-                                    var gname = tchList.FirstOrDefault().groupName;*/
-                                    if (ids.Count == 0) {
+
+                                    /*
+                                     if (ids.Count == 0) {
                                         tchList.ForEach(x =>
                                         {
                                             tchActivities.Add(new StuActivity
@@ -176,9 +176,10 @@ namespace TEAMModelOS.FunctionV4
                                                 classIds = study.tchLists
                                             });
                                         });
-                                    }                         
+                                    }  
+                                     */
                                 }
-                                await IESActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
+                                //await IESActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
                                 await StatisticsService.SendServiceBus(list, _configuration, _serviceBus,client);
                                 var messageWorkEnd = new ServiceBusMessage(new { id = tdata.id, progress = "finish", code = tdata.code }.ToJsonString());
                                 messageWorkEnd.ApplicationProperties.Add("name", "Study");

+ 96 - 93
TEAMModelOS.FunctionV4/CosmosDB/TriggerSurvey.cs

@@ -36,7 +36,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                     ActivityList data = input.ToObject<ActivityList>();
-                    await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                    //await IESActivityService.DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Record:{tdata.id}");
                     _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Submit:{tdata.id}");
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
@@ -129,97 +129,98 @@ namespace TEAMModelOS.FunctionV4
 #if DEBUG
                             await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}问卷调查{tdata.id}写入学生表作为活动列表!", GroupNames.醍摩豆服務運維群組);
 #endif
-                            List<StuActivity> stuActivities = new List<StuActivity>();
-                            List<StuActivity> tmdActivities = new List<StuActivity>();
-                            List<StuActivity> tchActivities = new List<StuActivity>();
+                            /*
+                               List<StuActivity> stuActivities = new List<StuActivity>();
+                              List<StuActivity> tmdActivities = new List<StuActivity>();
+                              List<StuActivity> tchActivities = new List<StuActivity>();
+                              List<string> sub = new();
+                              if (survey.tchLists.Count == 0) {
+                                  if (survey.targets.Count > 0)
+                                  {
+                                      foreach (var course in survey.targets)
+                                      {
+                                          var info = course.ToObject<List<string>>();
+                                          if (info.Count > 1)
+                                          {
+                                              sub.Add(info[0]);
+                                          }
+                                      }
+                                  }
+                              }
 
-                            List<string> sub = new();
-                            if (survey.tchLists.Count == 0) {
-                                if (survey.targets.Count > 0)
-                                {
-                                    foreach (var course in survey.targets)
-                                    {
-                                        var info = course.ToObject<List<string>>();
-                                        if (info.Count > 1)
-                                        {
-                                            sub.Add(info[0]);
-                                        }
-                                    }
-                                }
-                            }
-                                
-                            if (addTmdidsCls.IsNotEmpty())
-                            {
-                                addTmdidsCls.ForEach(x =>
-                                {
-                                    HashSet<string> classIds = new HashSet<string>();
-                                    classLists.ForEach(z => {
-                                        z.members.ForEach(y => {
-                                            if (y.id.Equals(x.id)&& y.type==1) 
-                                            {
-                                                classIds.Add(z.id);
-                                            }
-                                        });
-                                    });
-                                    tmdActivities.Add(new StuActivity
-                                    {
-                                        pk = "Activity",
-                                        id = survey.id,
-                                        code = $"Activity-{x.id}",
-                                        type = "Survey",
-                                        name = survey.name,
-                                        startTime = survey.startTime,
-                                        endTime = survey.endTime,
-                                        scode = survey.code,
-                                        scope = survey.scope,
-                                        school = survey.school,
-                                        creatorId = survey.creatorId,
-                                        subjects = sub,
-                                        blob = survey.blob,
-                                        owner = survey.owner,
-                                        isSub = survey.isSub,
-                                        createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
-                                        taskStatus = -1,
-                                        classIds = classIds.ToList()
-                                    });
-                                });
-                            }
-                            if (addStudentsCls.IsNotEmpty())
-                            {
-                                addStudentsCls.ForEach(x =>
-                                {
-                                    HashSet<string> classIds = new HashSet<string>();
-                                    classLists.ForEach(z => {
-                                        z.members.ForEach(y => {
-                                            if (y.id.Equals(x.id)&& y.code.Equals(survey.school) && y.type == 2)
-                                            {
-                                                classIds.Add(z.id);
-                                            }
-                                        });
-                                    });
-                                    stuActivities.Add(new StuActivity
-                                    {
-                                        pk = "Activity",
-                                        id = survey.id,
-                                        code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
-                                        type = "Survey",
-                                        name = survey.name,
-                                        startTime = survey.startTime,
-                                        endTime = survey.endTime,
-                                        scode = survey.code,
-                                        scope = survey.scope,
-                                        school = survey.school,
-                                        creatorId = survey.creatorId,
-                                        subjects = sub,
-                                        blob = survey.blob,
-                                        owner = survey.owner,
-                                        isSub = survey.isSub,
-                                        createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
-                                        taskStatus = -1,
-                                        classIds = classIds.ToList()
-                                    }); 
-                                });
-                            }
+                              if (addTmdidsCls.IsNotEmpty())
+                              {
+                                  addTmdidsCls.ForEach(x =>
+                                  {
+                                      HashSet<string> classIds = new HashSet<string>();
+                                      classLists.ForEach(z => {
+                                          z.members.ForEach(y => {
+                                              if (y.id.Equals(x.id)&& y.type==1) 
+                                              {
+                                                  classIds.Add(z.id);
+                                              }
+                                          });
+                                      });
+                                      tmdActivities.Add(new StuActivity
+                                      {
+                                          pk = "Activity",
+                                          id = survey.id,
+                                          code = $"Activity-{x.id}",
+                                          type = "Survey",
+                                          name = survey.name,
+                                          startTime = survey.startTime,
+                                          endTime = survey.endTime,
+                                          scode = survey.code,
+                                          scope = survey.scope,
+                                          school = survey.school,
+                                          creatorId = survey.creatorId,
+                                          subjects = sub,
+                                          blob = survey.blob,
+                                          owner = survey.owner,
+                                          isSub = survey.isSub,
+                                          createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                          taskStatus = -1,
+                                          classIds = classIds.ToList()
+                                      });
+                                  });
+                              }
+                              if (addStudentsCls.IsNotEmpty())
+                              {
+                                  addStudentsCls.ForEach(x =>
+                                  {
+                                      HashSet<string> classIds = new HashSet<string>();
+                                      classLists.ForEach(z => {
+                                          z.members.ForEach(y => {
+                                              if (y.id.Equals(x.id)&& y.code.Equals(survey.school) && y.type == 2)
+                                              {
+                                                  classIds.Add(z.id);
+                                              }
+                                          });
+                                      });
+                                      stuActivities.Add(new StuActivity
+                                      {
+                                          pk = "Activity",
+                                          id = survey.id,
+                                          code = $"Activity-{x.code.Replace("Base-", "")}-{x.id}",
+                                          type = "Survey",
+                                          name = survey.name,
+                                          startTime = survey.startTime,
+                                          endTime = survey.endTime,
+                                          scode = survey.code,
+                                          scope = survey.scope,
+                                          school = survey.school,
+                                          creatorId = survey.creatorId,
+                                          subjects = sub,
+                                          blob = survey.blob,
+                                          owner = survey.owner,
+                                          isSub = survey.isSub,
+                                          createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                                          taskStatus = -1,
+                                          classIds = classIds.ToList()
+                                      }); 
+                                  });
+                              }
+                             */
                             (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, survey.tchLists, survey.school, ps);
                             (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.TeacherSurvey }, 0);
                             if (tchList.IsNotEmpty())
@@ -232,7 +233,8 @@ namespace TEAMModelOS.FunctionV4
                                     list.school = school.id;
                                     list.standard = school.standard;
                                 }
-                                tchList.ForEach(x =>
+                                /*
+                                 tchList.ForEach(x =>
                                 {
                                     HashSet<string> classIds = new HashSet<string>();
                                     classInfos.ForEach(z => {
@@ -265,9 +267,10 @@ namespace TEAMModelOS.FunctionV4
                                         classIds = classIds.ToList()
                                     });
                                 });
+                                 */
 
                             }
-                            await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
+                           // await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
                             await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                             //向学生或醍摩豆账号发起通知
                             #region

+ 16 - 11
TEAMModelOS.FunctionV4/CosmosDB/TriggerVote.cs

@@ -35,7 +35,7 @@ namespace TEAMModelOS.FunctionV4
                 {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").DeleteItemStreamAsync(tdata.id, new PartitionKey(tdata.code));
                     ActivityList data = input.ToObject<ActivityList>();
-                    await IESActivityService. DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
+                   // await IESActivityService. DeleteActivity(_coreAPIHttpService, client, _dingDing, data);
                     _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Record:{tdata.id}");
                     _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Count:{tdata.id}");
                     var table_cancel = _azureStorage.GetCloudTableClient().GetTableReference("ChangeRecord");
@@ -132,6 +132,7 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 tmds.AddRange(addTmdidsCls.Select(x => x.id).ToList());
                             }
+                            /*
                             List<StuActivity> stuActivities = new List<StuActivity>();
                             List<StuActivity> tmdActivities = new List<StuActivity>();
                             List<StuActivity> tchActivities = new List<StuActivity>();
@@ -150,14 +151,16 @@ namespace TEAMModelOS.FunctionV4
                                     }
                                 }
                             }
-                                
+
                             if (tmds.IsNotEmpty())
                             {
                                 tmds.ForEach(x =>
                                 {
                                     HashSet<string> classIds = new HashSet<string>();
-                                    classLists.ForEach(z => {
-                                        z.members.ForEach(y => {
+                                    classLists.ForEach(z =>
+                                    {
+                                        z.members.ForEach(y =>
+                                        {
                                             if (y.id.Equals(x) && y.type == 1)
                                             {
                                                 classIds.Add(z.id);
@@ -191,8 +194,10 @@ namespace TEAMModelOS.FunctionV4
                                 addStudentsCls.ForEach(x =>
                                 {
                                     HashSet<string> classIds = new HashSet<string>();
-                                    classLists.ForEach(z => {
-                                        z.members.ForEach(y => {
+                                    classLists.ForEach(z =>
+                                    {
+                                        z.members.ForEach(y =>
+                                        {
                                             if (y.id.Equals(x.id) && y.code.Equals(vote.school) && y.type == 2)
                                             {
                                                 classIds.Add(z.id);
@@ -221,6 +226,7 @@ namespace TEAMModelOS.FunctionV4
                                     });
                                 });
                             }
+                             */
                             (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, vote.tchLists, vote.school, ps);
                             (string standard, List<string> tmdids, string school, List<string> update, int statistics) list = (null, null, null, new List<string> { StatisticsService.TeacherVote }, 0);
                             if (tchList.IsNotEmpty())
@@ -233,7 +239,8 @@ namespace TEAMModelOS.FunctionV4
                                     list.school = school.id;
                                     list.standard = school.standard;
                                 }
-                                tchList.ForEach(x =>
+                                /*
+                                 tchList.ForEach(x =>
                                 {
                                     HashSet<string> classIds = new HashSet<string>();
                                     classInfos.ForEach(z => {
@@ -265,12 +272,10 @@ namespace TEAMModelOS.FunctionV4
                                         classIds = classIds.ToList()
                                     });
                                 });
+                                 */
 
                             }
-                            //await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}投票活动,:教研组活动:" +
-
-                            //   $"{tchActivities.ToJsonString()}\n", GroupNames.醍摩豆服務運維群組);
-                            await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
+                            // await IESActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
                             await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                             //向学生或醍摩豆账号发起通知
                             #region

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

@@ -509,19 +509,19 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                 //await StuListService.FixStuCourse(client, stuListChange);
                 //Vote投票 Survey问卷 Exam评测 Learn学习活动 Homework作业活动
                 //名单变动修改学生问卷关联信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Survey");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Survey");
                 //名单变动修改学生投票关联信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Vote");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Vote");
                 //名单变动修改学生评测关联信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Exam");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Exam");
                 //名单变动修改学生研修关联信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Study");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Study");
                 //名单变动修改学生简易评测关联信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "ExamLite");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "ExamLite");
                 //名单变动修改学生作业活动信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Homework");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Homework");
                 //名单变动修改学生艺术评价活动信息
-                await IESActivityService.FixActivity(client, _dingDing, groupChange, "Art");
+                //await IESActivityService.FixActivity(client, _dingDing, groupChange, "Art");
                 //TODO学习活动
                 //await FixActivity(client, stuListChange, "Learn");
                 if (groupChange.type == null || !groupChange.type.Equals("research") || !groupChange.type.Equals("yxtrain") || !groupChange.type.Equals("activity"))

+ 37 - 37
TEAMModelOS.SDK/Models/Service/Common/ActivityStudentService.cs

@@ -178,18 +178,18 @@ namespace TEAMModelOS.SDK.Services
                     }
                     try
                     {
-                        if (!string.IsNullOrEmpty(school))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{school}-{userid}"));
-                            activity.taskStatus = taskStatus;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{school}-{userid}"));
-                        }
-                        else
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
-                            activity.taskStatus = taskStatus;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
-                        }
+                        //if (!string.IsNullOrEmpty(school))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{school}-{userid}"));
+                        //    activity.taskStatus = taskStatus;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{school}-{userid}"));
+                        //}
+                        //else
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
+                        //    activity.taskStatus = taskStatus;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
+                        //}
 
                     }
                     catch (CosmosException ex)
@@ -198,17 +198,17 @@ namespace TEAMModelOS.SDK.Services
                         {
                             try
                             {
-                                StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
-                                activity.taskStatus = taskStatus;
-                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
+                                //StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
+                                //activity.taskStatus = taskStatus;
+                                //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
                             }
                             catch (CosmosException cex)
                             {
                                 try
                                 {
-                                    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
-                                    activity.taskStatus = taskStatus;
-                                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
+                                    //StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(vote.id, new PartitionKey($"Activity-{userid}"));
+                                    //activity.taskStatus = taskStatus;
+                                    //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
                                     if (!string.IsNullOrEmpty(standard) && !string.IsNullOrEmpty(school))
                                     {
                                         await StatisticsService.SendServiceBus(($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherVote }, 0), _configuration, _serviceBus, client);
@@ -815,19 +815,19 @@ namespace TEAMModelOS.SDK.Services
                     }
                     try
                     {
-                        if (!string.IsNullOrEmpty(school))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{school}-{userid}"));
-                            activity.taskStatus = taskStatus;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{school}-{userid}"));
-
-                        }
-                        else
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
-                            activity.taskStatus = taskStatus;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
-                        }
+                        //if (!string.IsNullOrEmpty(school))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{school}-{userid}"));
+                        //    activity.taskStatus = taskStatus;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{school}-{userid}"));
+
+                        //}
+                        //else
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
+                        //    activity.taskStatus = taskStatus;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
+                        //}
 
                     }
                     catch (CosmosException ex)
@@ -836,9 +836,9 @@ namespace TEAMModelOS.SDK.Services
                         {
                             try
                             {
-                                StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
-                                activity.taskStatus = taskStatus;
-                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
+                            //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
+                            //    activity.taskStatus = taskStatus;
+                            //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
                             }
                             catch (CosmosException cex)
                             {
@@ -846,9 +846,9 @@ namespace TEAMModelOS.SDK.Services
                                 {
                                     try
                                     {
-                                        StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
-                                        activity.taskStatus = taskStatus;
-                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
+                                        //StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(survey.id, new PartitionKey($"Activity-{userid}"));
+                                        //activity.taskStatus = taskStatus;
+                                        //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
                                         if (!string.IsNullOrEmpty(standard) && !string.IsNullOrEmpty(school))
                                         {
                                             await StatisticsService.SendServiceBus(($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherSurvey }, 0), _configuration, _serviceBus, client);

+ 25 - 20
TEAMModelOS.SDK/Models/Service/IESActivityService.cs

@@ -125,7 +125,8 @@ namespace TEAMModelOS.SDK
                         }
                     }
                     //stujoin新加入名单的
-                    foreach (Member member in groupChange.stujoin)
+                    /*
+                     foreach (Member member in groupChange.stujoin)
                     {
                         ExamInfo info =  await updateClassResulte(client, classResults, standerAnswers, member, groupChange,activity);
                         var stucourse = new StuActivity
@@ -152,9 +153,11 @@ namespace TEAMModelOS.SDK
                         };
                         await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
                     }
+                     */
 
                     //tmdjoin新加入的
-                    foreach (Member member in groupChange.tmdjoin)
+                    /*
+                      foreach (Member member in groupChange.tmdjoin)
                     {
                         ExamInfo info =  await updateClassResulte(client, classResults, standerAnswers, member, groupChange,activity);
                         var stucourse = new StuActivity
@@ -181,11 +184,11 @@ namespace TEAMModelOS.SDK
                         };
                         await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
                     }
+                     */
                     //tchjoin新加入的
-                    foreach (Member member in groupChange.tchjoin)
+                    /*
+                     foreach (Member member in groupChange.tchjoin)
                     {
-                        //await updateClassResulte(client, classResults, standerAnswers, member.id);
-
                         var groupNames =  activity.groupLists.FirstOrDefault().Select(x => x.Value).FirstOrDefault();
                         if (groupNames.Count > 0)
                         {
@@ -239,7 +242,11 @@ namespace TEAMModelOS.SDK
                         }
                                         
                     }
-                    foreach (Member member in groupChange.stuleave)
+                     */
+
+
+                    /*
+                     foreach (Member member in groupChange.stuleave)
                     {
                         try
                         {
@@ -259,7 +266,6 @@ namespace TEAMModelOS.SDK
                         catch (CosmosException)
                         {
                             continue;
-                            // 继续执行 删除失败
                         }
                     }
                     foreach (Member member in groupChange.tmdleave)
@@ -281,7 +287,6 @@ namespace TEAMModelOS.SDK
                         catch (CosmosException)
                         {
                             continue;
-                            // 继续执行 删除失败
                         }
                     }
                     foreach (Member member in groupChange.tchleave)
@@ -302,9 +307,9 @@ namespace TEAMModelOS.SDK
                         catch (CosmosException)
                         {
                             continue;
-                            // 继续执行 删除失败
                         }
                     }
+                     */
                 }
             }
             catch (CosmosException e)
@@ -596,16 +601,11 @@ namespace TEAMModelOS.SDK
             }
         }
         */
-        public  static async  Task FixLessonRecord(CosmosClient client, DingDing dingDing, GroupChange groupChange)
-        {
-            if (groupChange.status.Equals("delete")) {
-                string sql = "select value(c) from c where (c.status<>404 or IS_DEFINED(c.status) = false ) and  array_length(c.groupIds)>0  ";
-               
-            }
-          
-        }
 
-        public static async Task<string> SaveStuActivity(CosmosClient client, DingDing _dingDing, List<StuActivity> stuActivities, List<StuActivity> tmdActivities, List<StuActivity> tchActivities)
+
+        /*
+         
+          public static async Task<string> SaveStuActivity(CosmosClient client, DingDing _dingDing, List<StuActivity> stuActivities, List<StuActivity> tmdActivities, List<StuActivity> tchActivities)
         {
             try
             {
@@ -643,6 +643,8 @@ namespace TEAMModelOS.SDK
             }
             return "";
         }
+       
+         
         public static async Task RefreshStuActivity(CoreAPIHttpService _coreAPIHttpService, CosmosClient client, DingDing _dingDing, string id, string code)
         {
             MQActivity activity = null;
@@ -721,6 +723,7 @@ namespace TEAMModelOS.SDK
                 await Task.WhenAll(tasks);
             }
         }
+         */
         public static async Task<ExamInfo> updateClassResulte(CosmosClient client, List<ExamClassResult> classResults, List<PaperSimple> standerAnswers, Member member ,GroupChange change,MQActivity activity)
         {
             ExamInfo info = new();
@@ -818,7 +821,8 @@ namespace TEAMModelOS.SDK
             return info;
 
         }
-        public static async Task DeleteActivity(CoreAPIHttpService _coreAPIHttpService, CosmosClient client, DingDing _dingDing, ActivityList activityList)
+        /*
+           public static async Task DeleteActivity(CoreAPIHttpService _coreAPIHttpService, CosmosClient client, DingDing _dingDing, ActivityList activityList)
         {
             List<(string pId, List<string> gid)> ps = new List<(string pId, List<string> gid)>();
             if (activityList.groupLists.Count > 0)
@@ -924,7 +928,8 @@ namespace TEAMModelOS.SDK
             return "";
         }
 
-      
+         */
+
     }
 
     public class ActivityList

+ 225 - 75
TEAMModelOS.SDK/Models/Service/StudentService.cs

@@ -7,9 +7,11 @@ using DocumentFormat.OpenXml.Office2010.Excel;
 using DocumentFormat.OpenXml.Spreadsheet;
 using DocumentFormat.OpenXml.VariantTypes;
 using HTEXLib.COMM.Helpers;
+using HTEXLib.Helpers.ShapeHelpers;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Configuration;
 using NUnit.Framework;
+using NUnit.Framework.Interfaces;
 using OpenXmlPowerTools;
 using System;
 using System.Collections.Generic;
@@ -53,13 +55,17 @@ namespace TEAMModelOS.SDK
             public string creatorId { get; set; }
             public string scode { get; set; }
             public string type { get; set; }
-            public string examType { get; set; }
+            public Custom examType { get; set; } = new Custom();
 
             public List<ExamSubject> subjects { get; set; } = new List<ExamSubject>();
-
+            //返回科目内容
+            public List<string> subs { get; set; } = new List<string>();
+            //返回字段
+            public List<string> classIds { get; set; } = new List<string>();
             public List<string> classes { get; set; } = new List<string>();
             public List<string> stuLists { get; set; } = new List<string>();
             public List<string> tchLists { get; set; } = new List<string>();
+            public List<JsonElement> targets { get; set; } = new List<JsonElement>();
             public long createTime { get; set; } = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             public Dictionary<string, JsonElement> ext { get; set; } = new Dictionary<string, JsonElement>();
             /// 评分状态,0,未评分, 1已评分
@@ -90,7 +96,7 @@ namespace TEAMModelOS.SDK
         /// <param name="azureRedis"></param>
         public static async Task<List<StudentActivity>> FindActivity(JsonElement request, string userId, string userScope, List<string> groupListIds, List<string> subjects, string school, List<string> types, AzureCosmosFactory _azureCosmos)
         {
-            string filed = "c.id ,c.code,c.owner,c.pk,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
+            string filed = "c.id ,c.code,c.owner,c.pk as type,c.examType,c.targets,c.qamode,c.name,c.school,c.startTime,c.endTime,c.classes,c.stuLists,c.tchLists,c.createTime,c.creatorId,c.isSub,c.mustSubmit,c.sStatus,c.scope,c.source,c.subjects";
             if (string.IsNullOrWhiteSpace(school))
             {
                 if (request.TryGetProperty("school", out JsonElement schooljson))
@@ -136,7 +142,7 @@ namespace TEAMModelOS.SDK
                 throw new Exception("名单为空");
             }
 
-            List<StudentActivity> activities = new List<StudentActivity>();
+            List<StudentActivity> datas = new List<StudentActivity>();
             if (types.IsEmpty() || types.Contains("Exam"))
             {
                 string subjectSQL = "";
@@ -144,22 +150,27 @@ namespace TEAMModelOS.SDK
                 if (subjects.IsNotEmpty())
                 {
                     subjectJoin = "join s in c.subjects";
-                    subjectSQL = $" and  c.id in ({string.Join(",", subjects.Select(z => $"'{z}'"))}) ";
+                    subjectSQL = $" and  s.id in ({string.Join(",", subjects.Select(z => $"'{z}'"))}) ";
                 }
-                StringBuilder SQL = new StringBuilder($"select {filed} from c {subjectJoin} where c.pk='Exam' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} ");
+                StringBuilder SQL = new StringBuilder($"select distinct {filed} from c {subjectJoin} where c.pk='Exam' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} and c.qamode != 2 ");
                 //获取学校发布的活动
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
                     var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.owner='school' ", $"Exam-{school}");
-                    List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultSchool.list, school, userId, userScope);
-                    activities.AddRange(activity);
+                    if (resultSchool.list.Count > 0) {
+                        List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultSchool.list, school, userId, userScope);
+                        datas.AddRange(activity);
+                    }                  
                 }
                 //获取教师发布的活动(个人名单,学校名单)
                 {
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.owner='teacher' ");
-                    List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultTeacher.list, school, userId, userScope);
-                    activities.AddRange(resultTeacher.list);
+                    if(resultTeacher.list.Count > 0) {
+                        List<StudentActivity> activity = await getStuActivity(_azureCosmos, resultTeacher.list, school, userId, userScope);
+                        datas.AddRange(activity);
+                    }
                 }
+                   
             }
 
             if (types.IsEmpty() || types.Contains("Vote"))
@@ -170,12 +181,61 @@ namespace TEAMModelOS.SDK
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
                     var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='school' ", $"Vote-{school}");
-                    activities.AddRange(resultSchool.list);
+                    if (resultSchool.list.Count > 0)
+                    {
+                        foreach (var vote in resultSchool.list)
+                        {
+                            vote.scode = vote.code;
+                            List<string> sub = new();
+                            if (vote.tchLists.Count == 0)
+                            {
+                                if (vote.targets.Count > 0)
+                                {
+                                    foreach (var course in vote.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            vote.subs = sub;
+
+                        }
+                    }
+                    datas.AddRange(resultSchool.list);
                 }
                 //获取教师发布的活动(个人名单,学校名单)
                 {
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='teacher' ");
-                    activities.AddRange(resultTeacher.list);
+                    if (resultTeacher.list.Count > 0)
+                    {
+                        foreach (var vote in resultTeacher.list)
+                        {
+                            vote.scode = vote.code;
+
+                                List<string> sub = new();
+                                if (vote.tchLists.Count == 0)
+                                {
+                                    if (vote.targets.Count > 0)
+                                    {
+                                        foreach (var course in vote.targets)
+                                        {
+                                            var info = course.ToObject<List<string>>();
+                                            if (info.Count > 1)
+                                            {
+                                                sub.Add(info[0]);
+                                            }
+                                        }
+                                    }
+                                }
+                                vote.subs = sub;
+                            
+                        }
+                    }
+                    datas.AddRange(resultTeacher.list);
                 }
             }
             if (types.IsEmpty() || types.Contains("Survey"))
@@ -186,12 +246,59 @@ namespace TEAMModelOS.SDK
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
                     var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='school' ", $"Survey-{school}");
-                    activities.AddRange(resultSchool.list);
+                    if (resultSchool.list.Count > 0)
+                    {
+                        foreach (var survey in resultSchool.list)
+                        {
+                            survey.scode = survey.code;
+                            List<string> sub = new();
+                            if (survey.tchLists.Count == 0)
+                            {
+                                if (survey.targets.Count > 0)
+                                {
+                                    foreach (var course in survey.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            survey.subs = sub;
+
+                        }
+                    }
+                    datas.AddRange(resultSchool.list);
                 }
                 //获取教师发布的活动(个人名单,学校名单)
                 {
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='teacher' ");
-                    activities.AddRange(resultTeacher.list);
+                    if (resultTeacher.list.Count > 0) {
+                        foreach (var survey in resultTeacher.list) {
+                            survey.scode = survey.code;
+
+                                List<string> sub = new();
+                                if (survey.tchLists.Count == 0)
+                                {
+                                    if (survey.targets.Count > 0)
+                                    {
+                                        foreach (var course in survey.targets)
+                                        {
+                                            var info = course.ToObject<List<string>>();
+                                            if (info.Count > 1)
+                                            {
+                                                sub.Add(info[0]);
+                                            }
+                                        }
+                                    }
+                                }
+                                survey.subs = sub;
+                            
+                        }
+                    }
+                    datas.AddRange(resultTeacher.list);
                 }
             }
             if (types.IsEmpty() || types.Contains("Homework"))
@@ -202,12 +309,62 @@ namespace TEAMModelOS.SDK
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
                     var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='school' ", $"Homework-{school}");
-                    activities.AddRange(resultSchool.list);
+                    if (resultSchool.list.Count > 0)
+                    {
+                        foreach (var work in resultSchool.list)
+                        {
+                            work.classIds = work.classes;
+                            work.scode = work.code;
+                            List<string> sub = new();
+                            if (work.tchLists.Count == 0)
+                            {
+                                if (work.targets.Count > 0)
+                                {
+                                    foreach (var course in work.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            work.subs = sub;
+
+                        }
+                    }
+                    datas.AddRange(resultSchool.list);
                 }
                 //获取教师发布的活动(个人名单,学校名单)
                 {
                     var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='teacher' ");
-                    activities.AddRange(resultTeacher.list);
+                    if (resultTeacher.list.Count > 0)
+                    {
+                        foreach (var work in resultTeacher.list)
+                        {
+                            work.scode = work.code;
+                            work.classIds = work.stuLists;
+                            List<string> sub = new();
+                            if (work.tchLists.Count == 0)
+                            {
+                                if (work.targets.Count > 0)
+                                {
+                                    foreach (var course in work.targets)
+                                    {
+                                        var info = course.ToObject<List<string>>();
+                                        if (info.Count > 1)
+                                        {
+                                            sub.Add(info[0]);
+                                        }
+                                    }
+                                }
+                            }
+                            work.subs = sub;
+
+                        }
+                    }
+                    datas.AddRange(resultTeacher.list);
                 }
             }
             if (types.IsEmpty() || types.Contains("Art"))
@@ -217,19 +374,42 @@ namespace TEAMModelOS.SDK
                 if (subjects.IsNotEmpty())
                 {
                     subjectJoin = "join s in c.subjects";
-                    subjectSQL = $" and  c.id in ({string.Join(",", subjects.Select(z => $"'{z}'"))}) ";
+                    subjectSQL = $" and  s.id in ({string.Join(",", subjects.Select(z => $"'{z}'"))}) ";
                 }
 
-                StringBuilder SQL = new($"select {filed} from c  {subjectJoin} where c.pk='Art' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} ");
+                StringBuilder SQL = new($"select distinct  {filed} from c  {subjectJoin} where c.pk='Art' {subjectSQL} {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} ");
                 //获取学校发布的活动
                 if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
                 {
-                    var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.school='school' ", $"Art-{school}");
-                    activities.AddRange(resultSchool.list);
+                    var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.school='{school}' ", $"Art-{school}");
+                    if (resultSchool.list.Count > 0)
+                    {
+                        foreach (var stu in resultSchool.list)
+                        {
+                            stu.classIds = stu.classes;
+                        }
+                    }
+                    datas.AddRange(resultSchool.list);
                 }
             }
+            if (types.IsEmpty() || types.Contains("Study"))
+            {
+
+                StringBuilder SQL = new StringBuilder($"select {filed} from c  where c.pk='Study' {groupListSQL} and c.startTime>={stime} and c.startTime <= {etime} ");
+                //获取学校发布的研修活动
+                if (userScope.Equals(Constant.ScopeStudent) && !string.IsNullOrWhiteSpace(school))
+                {
+                    var resultSchool = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL}  and c.owner='school' ", $"Study-{school}");                              
+                    datas.AddRange(resultSchool.list);
+                }
+               /* //获取教师发布的活动(个人名单,学校名单)
+                {
+                    var resultTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<StudentActivity>($"{SQL.ToString()}  and c.owner='teacher' ");
+                    datas.AddRange(resultTeacher.list);
+                }*/
+            }
             //作答 记录recordUrl  taskStatus
-            return activities;
+            return datas;
         }
 
 
@@ -264,21 +444,21 @@ namespace TEAMModelOS.SDK
             List<ExamClassResult> examClassResults = new();
 
             await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(
-            queryText: $"select value(c) from c where c.examId = in ({string.Join(",", examIds.Select(z => $"'{z}'"))})' and c.pk = 'ExamClassResult'" ))
+            queryText: $"select value(c) from c where c.examId in ({string.Join(",", examIds.Select(z => $"'{z}'"))}) and c.pk = 'ExamClassResult'" ))
             {
                 examClassResults.Add(item);
             }
             bool iss = false;
             //标记学生作答状态
             int ts = 0;
-            List<Dictionary<string, int>> et = new();
-            List<Dictionary<string, bool>> es = new();
+            List<(string eId, int status)> et = new();
+            List<(string eId, bool flag)> es = new();
             if (examClassResults.Count > 0)
             {
                 foreach (ExamClassResult exam in examClassResults)
                 {
-                    Dictionary<string, int> examTasks = new Dictionary<string, int>();
-                    Dictionary<string, bool> examStatus = new Dictionary<string, bool>();
+                    //List<(string eId, int status)> examTasks = new();
+                    //List<(string eId, bool flag)> examStatus = new();
                     int index = exam.studentIds.IndexOf(userId);
                     if (index != -1)
                     {
@@ -289,84 +469,54 @@ namespace TEAMModelOS.SDK
                             {
                                 ts = 1;
                                 iss = true;
-                                break;
+                                //break;
                             }
                             else
                             {
+                                iss = false;
                                 ts = 0;
                             }
+                            et.Add((exam.examId, ts));
+                            es.Add((exam.examId,iss));
                         }
                         else
                         {
                             ts = -1;
-                        }
-                        if (examTasks.ContainsKey(exam.examId))
-                        {
-                            if (ts == -1)
-                            {
-                                examTasks[exam.examId] = -1;
-                            }
-                            else if (examTasks[exam.examId] == -1)
-                            {
-                                examTasks[exam.examId] = -1;
-                            }
-                            else
-                            {
-                                examTasks[exam.examId] = ts;
-                            }
-                        }
-                        else
-                        {
-                            examTasks[exam.examId] = ts;
-                        }
-                        if (examStatus.ContainsKey(exam.examId))
-                        {
-                            if (!iss)
-                            {
-                                examStatus[exam.examId] = false;
-                            }
-                            else if (examStatus[exam.examId] == false)
-                            {
-                                examStatus[exam.examId] = false;
-                            }
-                        }
-                        else
-                        {
-                            examStatus[exam.examId] = iss;
-                        }
-                        et.Add(examTasks);
-                        es.Add(examStatus);
+                            iss = false;
+                            et.Add((exam.examId, ts));
+                            es.Add((exam.examId, iss));
+                        }                      
                     }
                 }
             }
-            else
-            {
-                ts = -1;
-            }
+            
             var stuActivity = activities.Select(x => new StudentActivity
             {
                 id = x.id,
                 stuId = userId,
                 userType = userScope,
-                type = "Exam",
+                type = "Exam",               
                 name = x.name,
                 source = x.source,
                 startTime = x.startTime,
                 endTime = x.endTime,
                 scope = x.scope,
                 school = x.school,
-                scode = x.scode,
+                scode = x.code,
                 creatorId = x.creatorId,
                 subjects = x.subjects,
                 owner = x.owner,
-                classes = x.classes,
+                classIds = x.classes.Count > 0 ? x.classes : x.stuLists,
                 code = x.code,
                 createTime = x.createTime,
                 qamode = x.qamode,
-                ext = new Dictionary<string, JsonElement>() { { "type", x.examType.ToJsonString().ToObject<JsonElement>() },
-                            { "subjects", x.subjects.ToJsonString().ToObject<JsonElement>() } },
-                taskStatus = (int)(et.Where(c => c.Keys.Equals(x.id))?.FirstOrDefault()[x.id]),
-                sStatus = (bool)es.Where(c => c.Keys.Equals(x.id))?.FirstOrDefault()[x.id] ? 1 : 0
+                examType = x.examType,
+                //taskStatus = et.Select(c => c[x.id]).FirstOrDefault(),
+                //ext = new Dictionary<string, JsonElement>() { { "type", !string.IsNullOrEmpty(x.examType) ? x.examType.ToJsonString().ToObject<JsonElement>():new JsonElement() },
+                            //{ "subjects", x.subjects.ToJsonString().ToObject<JsonElement>() } },
+                taskStatus = et.Where(c => c.eId.Equals(x.id)).FirstOrDefault().status,
+                sStatus = es.Where(z => z.eId.Equals(x.id)).FirstOrDefault().flag ? 1 : 0
+                //sStatus  = es.Select(c => c[x.id]).FirstOrDefault() ? 1 : 0
             }).ToList();
             return stuActivity;
         }

+ 4 - 0
TEAMModelOS/ClientApp/src/api/studentWeb.js

@@ -83,6 +83,10 @@ export default {
     getActivityInfo: function (data) {
         return post('/student/stu-activity', data)
     },
+    //新版 查詢學生端活動信息
+    getActivityInfoNew: function (data) {
+        return post('/student/student-activity', data)
+    },
     //查詢學生端投票活动
     getVoteInfo: function (data) {
         return post('/common/vote/find-id', data)

+ 4 - 7
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/ArtTestReport.vue

@@ -151,7 +151,6 @@ export default {
                                     })
                                     if(examInfo) {
                                         examInfo.isOrder = task.isOrder //0:默认,1:乱序
-                                        examInfo.quotaId = item.id
                                         examInfo.quotaName = item.quotaname
                                         examInfo.quotaId = item.id
                                     }
@@ -170,7 +169,6 @@ export default {
                                 let subIndex = subList.findIndex(sub => {
                                     return task.subject === sub.subject.id
                                 })
-                                console.log(examInfo);
                                 // 没有该科目,就保存一次,再增加对应的试卷id:acId
                                 if(subIndex === -1) {
                                     let examList = {
@@ -184,8 +182,8 @@ export default {
                                         paperInfo: [],
                                         testState: 0,
                                     }
-                                    if(this.getItemTitle.ext) {
-                                        examList.subject.name = this.getItemTitle.ext.subjects.find(sub => {
+                                    if(this.getItemTitle.subjects) {
+                                        examList.subject.name = this.getItemTitle.subjects.find(sub => {
                                             return sub.id === task.subject
                                         }).name
                                     }
@@ -262,11 +260,11 @@ export default {
                                 if(res.status === 200) {
                                     if(res.papers.length) {
                                         let blob = this.stusInfo.find(stu => {
-                                            return stu.paper[0].subject === res.subjects[0].id
+                                            return stu.subject === res.subjects[0].id
                                         })
                                         if(blob) {
                                             let paperArt = res.papers.find(papers => {
-                                                return papers.blob === blob.paper[0].blob
+                                                return papers.blob === blob.paper
                                             })
                                             paperArt.source = this.getItemTitle.source || null
                                             paperArt.qamode = this.getItemTitle.qamode
@@ -314,7 +312,6 @@ export default {
                 Promise.allSettled(promiseArr).then(result => {
                     resolve(result)
                 }).catch(e => {
-                    console.log(e);
                     reject(e)
                 })
             })

+ 4 - 4
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/PaperView.vue

@@ -275,8 +275,8 @@
                                             exam: [],
                                             homework: []
                                         }
-                                        if(this.getItemTitle.ext) {
-                                            examList.subject.name = this.getItemTitle.ext.subjects.find(sub => {
+                                        if(this.getItemTitle.subjects) {
+                                            examList.subject.name = this.getItemTitle.subjects.find(sub => {
                                                 return sub.id === task.subject
                                             }).name
                                         }
@@ -400,11 +400,11 @@
                                 // 艺术评测试卷需先从stus -> paper 中获取blob, 再从res.papers中找出那一个试卷
                                 if(isArt) {
                                     let blob = this.stusInfo.find(item => {
-                                        return item.paper[0].subject === res.subjects[0].id
+                                        return item.subject === res.subjects[0].id
                                     })
                                     if(blob) {
                                         let paperArt = res.papers.find(papers => {
-                                            return papers.blob === blob.paper[0].blob
+                                            return papers.blob === blob.paper
                                         })
                                         paperArt.source = this.getItemTitle.source || null
                                         paperArt.qamode = this.getItemTitle.qamode

+ 46 - 14
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventList.vue

@@ -592,22 +592,52 @@ import ArtTestReport from "./EventContentTypeTemplate/PaperViewBox/ArtTestReport
                     }
                 })
             },
+            getGroupList() {
+                return new Promise((resolve, reject) => {
+                    this.$api.studentWeb.getAllGrouplist({}).then(res => {
+                        if(res.groups.length) {
+                            let lists = res.groups.map(item => item.id)
+                            resolve(lists)
+                        }
+                    }).catch(err => {
+                        reject([])
+                    })
+                })
+            },
             //获取活动信息数据
-            getActivityInfo(time) {
+            async getActivityInfo(time) {
                 this.isLoad = true
                 this.eventList.length = 0
                 this.isListNoItem = true;
 
                 let params = {
-                    userid: this.userInfo.sub,
-                    userType: "",
-                    school: this.userInfo.azp
+                    groupListIds: [],
+                    subjects: [],
+                    types: this.showType,
+                }
+                if(this.showType.length === 2 && this.showType.includes('Vote')) {
+                    params.groupListIds = await this.getGroupList()
+                } else {
+                    if(!this.getNowCourse) {
+                        this.$Message.warning('请先选择课程')
+                        return
+                    }
+                    params.groupListIds = [this.getNowCourse?.groupId]
+                    if(this.getNowCourse?.scope === 'private') {
+                        params.subjects.push(this.getNowCourse.id)
+                    } else {
+                        // 学校课程-课程id, 科目id, 科目bindId
+                        if(this.getNowCourse.id) params.subjects.push(this.getNowCourse.id)
+                        let subj = this.getNowCourse.subjectList ? this.getNowCourse.subjectList[this.nowSub] : this.getNowCourse.subject
+                        params.subjects.push(subj.id)
+                        if(subj.bindId) params.subjects.push(subj.bindId)
+                    }
                 }
-                params.userType = this.userInfo.scope === "tmduser" ? "tmdid" : "schoolid"
                 if(time) {
                     params.stime = time
+                    params.etime = new Date().getTime()
                 }
-                this.$api.studentWeb.getActivityInfo(params).then(async res => {
+                this.$api.studentWeb.getActivityInfoNew(params).then(async res => {
                     if (res) {
                         /* source: 0(线上评量) / 1(课中评量) / 2(阅卷评量) */
                         let data = []
@@ -645,22 +675,22 @@ import ArtTestReport from "./EventContentTypeTemplate/PaperViewBox/ArtTestReport
                                 data.push(item)
                             }
                         }
-                        // this.eventList = [...data]
-                        this.eventList = data.filter(item => {
+                        this.eventList = [...data]
+                        // this.eventList = data.filter(item => {
                             /**
                              * 1. 筛选类型(评测、作业)
                              * 2. 匹配名单
                              * 3. 科目、课程有一个匹配即可
                              */
                             // 目前评测、作业都只传了一个值
-                            if(!this.showType.includes("Vote")) {
+                            /* if(!this.showType.includes("Vote")) {
                                 // 只匹配班级id
                                 return this.showType.includes(item.type) && item.classIds.includes(this.courseNow.groupId)
                                 // return this.showType.includes(item.type) && (item.classIds.includes(this.courseNow.list) || item.subjects.includes(this.courseNow.subject.id) || item.creatorId === this.courseNow.roster.teacherId)
                             } else {
                                 return this.showType.includes(item.type)
-                            }
-                        })
+                            } */
+                        // })
                         this.eventList = this.eventList.sort(function (a, b) {
                             return b.startTime - a.startTime //时间正序
                         });
@@ -695,7 +725,7 @@ import ArtTestReport from "./EventContentTypeTemplate/PaperViewBox/ArtTestReport
                                 }
                             }
                             // 2023.11.09 评测列表展示: 科目($sotre.state.user.curPeriod.subjects) + 班级
-                            this.eventShow = this.eventList.filter(eveList => {
+                            /* this.eventShow = this.eventList.filter(eveList => {
                                 if(this.courseNow.subjectList) {
                                     // 基本课程: 匹配科目
                                     return eveList.subjects.includes(this.courseNow.subjectList[this.nowSub].id) || eveList.subjects.includes(this.courseNow.subjectList[this.nowSub].bindId)
@@ -707,7 +737,8 @@ import ArtTestReport from "./EventContentTypeTemplate/PaperViewBox/ArtTestReport
                                         return eveList.scope === 'school' ? (eveList.subjects.includes(this.courseNow.subject.id) || eveList.subjects.includes(this.courseNow.subject.bindId)) : eveList.subjects.includes(this.courseNow.id)
                                     }
                                 }
-                            })
+                            }) */
+                            this.eventShow = [...this.eventList]
                         }
                         
                         if(this.eventShow.length) {
@@ -1164,10 +1195,11 @@ import ArtTestReport from "./EventContentTypeTemplate/PaperViewBox/ArtTestReport
                 console.log(type, index, teacher);
                 if(type === 'subject') {
                     this.nowSub = index
+                    this.getActivityInfo()
                 } else {
                     this.nowTea = index
+                    this.predealMockdatafirstItem()
                 }
-                this.predealMockdatafirstItem()
                 /* if(teacher) {
                     let list = this.eventShow.filter(item => item.creatorId === teacher.id)
                     if (!list.length) {

+ 30 - 17
TEAMModelOS/ClientApp/src/components/student-web/HomeView/HomeView.vue

@@ -283,7 +283,7 @@ import { mapGetters, mapState } from 'vuex';
 import BlobTool from "@/utils/blobTool.js"
 
 export default {
-    name: "HomeViewnnnnew",
+    name: "HomeView",
     components: {
         ExamPerform,
         HomeworkPoint,
@@ -352,7 +352,7 @@ export default {
         this.$emit("onNavNo", this.MyNo)
         this.$emit("onNavName", this.MyName)
         this.getGroupList()
-        this.getActivity()
+        // this.getActivity()
         if(this.getAllCourse.length) {
             this.getSubErr()
         }
@@ -416,6 +416,7 @@ export default {
                             }
                             groupIds.push(item.id)
                         })
+                        this.getActivity()
                         this.getSchool("school", this.groups.school)
                         this.getNotice(groupIds)
                     }
@@ -561,22 +562,29 @@ export default {
                 r(sasInfo)
             })
         },
-        getActivity(time) {
+        getActivity() {
             this.isLoading = true
             // this.testData = []
             // this.voteandSur = []
             // this.examandHw = []
             let params = {
-                userid: this.userInfo.sub,
-                userType: "",
-                school: this.userInfo.azp
+                groupListIds: [],
+                subjects: [],
+                types: ['Exam', 'Art', 'Vote', 'Survey', 'Homework'],
             }
-            // 醍摩豆登陆——> roles有teacher
-            params.userType = this.userInfo.scope === "tmduser" ? "tmdid" : "schoolid"
-            if(time) {
-                params.stime = time
-            }
-            this.$api.studentWeb.getActivityInfo(params).then(async res => {
+            this.getAllCourse.forEach(item => {
+                if(item.subjectList) {
+                    item.subjectList.forEach(subj => {
+                        if(!params.subjects.includes(subj.id)) params.subjects.push(subj.id)
+                        if(subj.bindId && !params.subjects.includes(subj.bindId)) params.subjects.push(subj.bindId)
+                    })
+                } else {
+                    if(!params.subjects.includes(item.id)) params.subjects.push(item.id)
+                    if(item.scope === 'school' && !params.subjects.includes(item.subject.id)) params.subjects.push(item.subject.id)
+                }
+            })
+            params.groupListIds = this.classIds.map(item => item.id)
+            this.$api.studentWeb.getActivityInfoNew(params).then(async res => {
                 if (res.datas.length) {
                     let data = []
                     let ids = []
@@ -635,6 +643,9 @@ export default {
                             item.tempsub = (item.taskStatus === -1 && timeSub > 0 && timeSub < twoDay) ? this.getTimeSub(timeSub) : ""
                         }
                     }, 1000)
+                    this.activityList = this.activityList.sort(function (a, b) {
+                        return b.startTime - a.startTime //时间正序
+                    });
                     this.$forceUpdate()
                 }
             }).finally(()=>{
@@ -741,7 +752,8 @@ export default {
         },
         sentSelectedEventTitle(item) {
             if(item.type === "Exam" || item.type === "Homework" || item.type === "Art") {
-                let index =  this.getCourseIndex(item.subjects, item.classIds, item.scope === 'school', item.type === "Homework")
+                let subjectIds = (['Exam', 'Art'].includes(item.type)) ? item.subjects.map(sub => sub.id) : item.subs
+                let index =  this.getCourseIndex(subjectIds, item.classIds, item.scope === 'school', item.type === "Homework")
                 if(index === -1) {
                     this.$Message.error(this.$t('studentWeb.homework.tips3'))
                 } else {
@@ -824,18 +836,18 @@ export default {
                 })
             }
         },
-        getCourseIndex(ids, classIds, isSchool, isHw) {
+        getCourseIndex(subjectIds, classIds, isSchool, isHw) {
             // 同时匹配科目 && 班级id
             return this.getAllCourse.findIndex(course => {
                 if(isSchool && course.subjectList) {
                     return classIds.includes(course.groupId) && course.subjectList.find(subList => {
-                        return ids.includes(subList.id) || ids.includes(subList.bindId)
+                        return subjectIds.includes(subList.id) || subjectIds.includes(subList.bindId)
                     })
                 } else {
                     if(isHw) {
-                        return classIds.includes(course.groupId) && ids.includes(course.id)
+                        return classIds.includes(course.groupId) && subjectIds.includes(course.id)
                     } else {
-                        return classIds.includes(course.groupId) && (isSchool ? (ids.includes(course.subject.id) || ids.includes(course.subject.bindId)) : ids.includes(course.id))
+                        return classIds.includes(course.groupId) && (isSchool ? (subjectIds.includes(course.subject.id) || subjectIds.includes(course.subject.bindId)) : subjectIds.includes(course.id))
                     }
                 }
             })
@@ -920,6 +932,7 @@ export default {
         getAllCourse: {
             handler(n, o) {
                 this.isLoading = true
+                this.getActivity()
                 this.searchCourse()
                 // this.allCourseShow = [...n]
                 if(this.classRecord) {

+ 1 - 0
TEAMModelOS/ClientApp/src/router/routes.js

@@ -1533,6 +1533,7 @@ export const routes = [{
             path: "homeViewMobile",
             component: () => import('@/components/student-web/HomeView/HomeViewMobile'),
         },
+        // 已废弃
         {
             name: "courseList",
             path: "courseList",

+ 11 - 0
TEAMModelOS/ClientApp/src/view/student-web/AppNew.vue

@@ -414,6 +414,17 @@ export default {
         },
     },
     watch: {
+        getNowCourse: {
+            handler(n, o) {
+                if(!n) {
+                    this.$router.push({
+                        path: 'homeView'
+                    })
+                }
+            },
+            deep: true,
+            immediate: true
+        },
     },
     created() {
         this.getUsers();

+ 21 - 6
TEAMModelOS/Controllers/Common/ArtController.cs

@@ -884,8 +884,8 @@ namespace TEAMModelOS.Controllers.Common
                 ArtMusic music = new();
                 if (art != null)
                 {
-                    List<StuActivity> stus = new();
-                    //List<studentInfos> stus = new();
+                    //List<StuActivity> stus = new();
+                    List<studentInfos> stus = new();
                     List<string> wIds = new();
                     List<StudentArtResult> works = new();
 
@@ -911,11 +911,26 @@ namespace TEAMModelOS.Controllers.Common
                     //wIds = art.settings.SelectMany(z => z.task).Where(t => t.type == 2).Select(a => a.acId).ToList();
                     if (taskType1 != null && taskType1.Any())
                     {
-                        string sql = $"select value c from  c where c.id in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))})";
-                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student)
-                            .GetItemQueryIterator<StuActivity>(sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Activity-{school}-{userid}") }))
+                        List<ExamClassResult> examClassResults = new();
+                        //string sql = $"select value(c) from c where c.examId in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))})' and c.pk = 'ExamClassResult' and array_contains(c.studentIds,'{userid}')";
+                        await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(
+                        queryText: $"select value(c) from c where c.examId in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))}) and c.pk = 'ExamClassResult' and array_contains(c.studentIds,'{userid}')"))
                         {
-                            stus.Add(item);
+                            examClassResults.Add(item);
+                        }
+                        foreach (ExamClassResult classResult in examClassResults)
+                        {
+                            int index = classResult.studentIds.IndexOf(userid);
+                            if (index != -1)
+                            {
+                                studentInfos infos = new()
+                                {
+                                    id = classResult.examId,
+                                    paper = classResult.paper[index],
+                                    subject = classResult.subjectId
+                                };
+                                stus.Add(infos);
+                            }
                         }
                     }
                     await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StudentArtResult>(

+ 1 - 1
TEAMModelOS/Controllers/Common/CommonController.cs

@@ -173,7 +173,7 @@ namespace TEAMModelOS.Controllers.Common
                 }
                 await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<Dictionary<string, object>>(dy, dy["id"].ToString(), new Azure.Cosmos.PartitionKey(dy["code"].ToString()));
                 var content = new { id = $"{id}", code = $"{code}" };
-                await IESActivityService.RefreshStuActivity(_coreAPIHttpService, client, _dingDing, $"{id}", $"{code}");
+               // await IESActivityService.RefreshStuActivity(_coreAPIHttpService, client, _dingDing, $"{id}", $"{code}");
                 return Ok(new { code=200, isScore });
             }
             catch (Exception ex)

+ 58 - 65
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1224,24 +1224,24 @@ namespace TEAMModelOS.Controllers
                     await SystemService.RecordAccumulateData(_azureRedis, _dingDing, new SDK.Models.Dtos.Accumulate { client =_client, count = 1, id = info.id, key = "exam-submit", name = info.name, scope = info.scope, target = target });
                     if (isAns)
                     {
-                        if ($"{scope}".Equals(Constant.ScopeStudent))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
-                            activity.taskStatus = 0;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
-                        }
-                        if ($"{scope}".Equals(Constant.ScopeTmdUser))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
-                            activity.taskStatus = 0;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
-                        }
-                        if ($"{scope}".Equals(Constant.ScopeTeacher))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
-                            activity.taskStatus = 0;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
-                        }
+                        //if ($"{scope}".Equals(Constant.ScopeStudent))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
+                        //    activity.taskStatus = 0;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
+                        //}
+                        //if ($"{scope}".Equals(Constant.ScopeTmdUser))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //    activity.taskStatus = 0;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //}
+                        //if ($"{scope}".Equals(Constant.ScopeTeacher))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //    activity.taskStatus = 0;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //}
                     }
                     else
                     {
@@ -1250,31 +1250,32 @@ namespace TEAMModelOS.Controllers
                             await getArtInfoAsync(client, artId.GetString(), school, result.sum[newIndex], id.GetString(), subjectId.GetString(), quotaId.GetString(), userId, picture, name, userType, ids);
                         };
 
-                        if ($"{scope}".Equals(Constant.ScopeStudent))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
-                            activity.taskStatus = 1;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
-                        }
-                        if ($"{scope}".Equals(Constant.ScopeTmdUser))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
-                            activity.taskStatus = 1;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
-                        }
-                        if ($"{scope}".Equals(Constant.ScopeTeacher))
-                        {
-                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
-                            activity.taskStatus = 1;
-                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
-                        }
+                        //if ($"{scope}".Equals(Constant.ScopeStudent))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
+                        //    activity.taskStatus = 1;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{school}-{userId}"));
+                        //}
+                        //if ($"{scope}".Equals(Constant.ScopeTmdUser))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //    activity.taskStatus = 1;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //}
+                        //if ($"{scope}".Equals(Constant.ScopeTeacher))
+                        //{
+                        //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //    activity.taskStatus = 1;
+                        //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, id.ToString(), new PartitionKey($"Activity-{userId}"));
+                        //}
                     }
                 }
                 //当作答班级数量与实际班级数量一致时才触发结算
                 var ansCount = info.subjects.Where(c => c.id.Equals(subjectId)).FirstOrDefault()?.classCount;
-                if (ansCount == info.classes.Count) {
+                if (ansCount == info.classes.Count)
+                {
                     await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(info, id.ToString(), new PartitionKey($"{scode}"));
-                }               
+                }
                 await Task.WhenAll(tasks);
 
 
@@ -1419,12 +1420,7 @@ namespace TEAMModelOS.Controllers
                 }
 
                 ExamClassResult classResult = new ExamClassResult();
-                List<Task<ItemResponse<StuActivity>>> tasks = new List<Task<ItemResponse<StuActivity>>>();
-                //ExamInfo classResult = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
-                //ExamClassResult classResult = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamClassResult>(id.ToString(), new PartitionKey($"{code}"));
-                /*foreach (double index in ans) {
-                    classResult.studentScores.in
-                }*/
+                //List<Task<ItemResponse<StuActivity>>> tasks = new List<Task<ItemResponse<StuActivity>>>();
                 foreach (ExamClassResult result in examClassResults)
                 {
                     int index_sc = 0;
@@ -1443,9 +1439,9 @@ namespace TEAMModelOS.Controllers
                             {
                                 try
                                 {
-                                    StuActivity activity = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{s.id}"));
-                                    activity.sStatus = 1;
-                                    tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
+                                    //StuActivity activity = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{s.id}"));
+                                    //activity.sStatus = 1;
+                                    //tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
                                 }
                                 catch (Exception ex)
                                 {
@@ -1460,9 +1456,9 @@ namespace TEAMModelOS.Controllers
                                     if (response.Status == 200)
                                     {
                                         using var json = await JsonDocument.ParseAsync(response.ContentStream);
-                                        StuActivity activity = json.ToObject<StuActivity>();
-                                        activity.sStatus = 1;
-                                        tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
+                                        //StuActivity activity = json.ToObject<StuActivity>();
+                                        //activity.sStatus = 1;
+                                        //tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
 
                                     }
                                     else
@@ -1483,14 +1479,11 @@ namespace TEAMModelOS.Controllers
                                         }
                                         foreach (var sid in scode)
                                         {
-                                            StuActivity activity = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{sid}-{s.id}"));
-                                            activity.sStatus = 1;
-                                            tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
+                                            //StuActivity activity = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{sid}-{s.id}"));
+                                            //activity.sStatus = 1;
+                                            //tasks.Add(client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync(activity, activity.id, new PartitionKey($"{activity.code}")));
                                         }
                                     }
-                                    /*StuActivity activity = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{result.scIds[index]}-{s.id}"));
-                                    activity.sStatus = 1;
-                                    await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(id.ToString(), new PartitionKey($"Activity-{result.scIds[index]}-{s.id}"));*/
 
                                 }
                                 catch (Exception ex)
@@ -1537,7 +1530,7 @@ namespace TEAMModelOS.Controllers
                         await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"Exam-{code}"));
                     }
                     classResult = await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync(result, result.id, new PartitionKey($"{result.code}"));
-                    await Task.WhenAll(tasks);
+                    // await Task.WhenAll(tasks);
                 }
                 //检查所有成员是否完成打分
                 List<List<double>> ers = new List<List<double>>();
@@ -1584,14 +1577,14 @@ namespace TEAMModelOS.Controllers
             {
                 return builder.Error(ResponseCode.DATA_EXIST, "考试不存在!").build();
             }*/
-        }
+                    }
 
-        /// <summary>
-        /// 查询评测详细信息(教师或者学生通用)
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
+                    /// <summary>
+                    /// 查询评测详细信息(教师或者学生通用)
+                    /// </summary>
+                    /// <param name="request"></param>
+                    /// <returns></returns>
+                    [ProducesDefaultResponseType]
         [Authorize(Roles = "IES")]
         [AuthToken(Roles = "teacher,admin")]
         [HttpPost("find-summary-record")]
@@ -1771,7 +1764,7 @@ namespace TEAMModelOS.Controllers
                         return Ok(new { props });
                     }                   
                 }*/
-                return Ok(new { examClassResults, ufos, delIds });
+            return Ok(new { examClassResults, ufos, delIds });
             }
             catch (Exception ex)
             {

+ 25 - 25
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -708,16 +708,16 @@ namespace TEAMModelOS.Controllers.Learn
                                             }
                                         }
                                         //TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO 写入方便教师查看的作答记录
-                                        try
+                                        /*try
                                         {
-                                            StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{one.id}"));
-                                            activity.taskStatus = taskStatus;
-                                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{one.id}"));
+                                            //StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{one.id}"));
+                                            //activity.taskStatus = taskStatus;
+                                            //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{one.id}"));
                                         }
                                         catch (CosmosException ex)
                                         {
                                            
-                                        }
+                                        }*/
                                         
                                         await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{one.id}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord },0)  , _configuration, _serviceBus, client);
                                         //string sql = $"select value(c) from c where c.workId='{_id}'";
@@ -803,31 +803,31 @@ namespace TEAMModelOS.Controllers.Learn
                                    
                                 }
                                 //TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO 写入方便教师查看的作答记录
-                                try
+                                /*try
                                 {
-                                    if ($"{_scope}".Equals(Constant.ScopeStudent))
-                                    {
-                                        StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{school}-{userid}"));
-                                        activity.taskStatus = taskStatus;
-                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{school}-{userid}"));
-                                    }
-                                    if ($"{_scope}".Equals(Constant.ScopeTmdUser))
-                                    {
-                                        StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{userid}"));
-                                        activity.taskStatus = taskStatus;
-                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{userid}"));
-                                    }
-                                    if ($"{_scope}".Equals(Constant.ScopeTeacher))
-                                    {
-                                        StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{userid}"));
-                                        activity.taskStatus = taskStatus;
-                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{userid}"));
-                                    }
+                                    //if ($"{_scope}".Equals(Constant.ScopeStudent))
+                                    //{
+                                    //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{school}-{userid}"));
+                                    //    activity.taskStatus = taskStatus;
+                                    //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{school}-{userid}"));
+                                    //}
+                                    //if ($"{_scope}".Equals(Constant.ScopeTmdUser))
+                                    //{
+                                    //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{userid}"));
+                                    //    activity.taskStatus = taskStatus;
+                                    //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{userid}"));
+                                    //}
+                                    //if ($"{_scope}".Equals(Constant.ScopeTeacher))
+                                    //{
+                                    //    StuActivity activity = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>($"{_id}", new PartitionKey($"Activity-{userid}"));
+                                    //    activity.taskStatus = taskStatus;
+                                    //    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, $"{_id}", new PartitionKey($"Activity-{userid}"));
+                                    //}
                                 }
                                 catch (CosmosException ex)
                                 {
                                     taskStatus = -1;
-                                }
+                                }*/
                                 if (content.Exists(x => x.prime == true))
                                 {
                                     await StatisticsService.SendServiceBus(   ($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord }, 0 ), _configuration, _serviceBus, client);

+ 2 - 2
TEAMModelOS/Controllers/Student/StudentCommonController.cs

@@ -85,8 +85,8 @@ namespace TEAMModelOS.Controllers
                 types= _types.ToObject<List<string>>();
             }
             HttpContext?.Items.TryGetValue("Scope", out  _scope);
-            List<StudentActivity> activities =  await  StudentService.FindActivity(request, id, $"{_scope}", groupListIds, subjects, school, types, _azureCosmos);
-            return Ok(new { code =200, activities ,serverTime=DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()});
+            List<StudentActivity> datas =  await  StudentService.FindActivity(request, id, $"{_scope}", groupListIds, subjects, school, types, _azureCosmos);
+            return Ok(new { code =200, datas, serverTime=DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()});
         }
 
         /// <summary>

+ 3 - 27
TEAMModelOS/Controllers/Teacher/TeacherCommonController.cs

@@ -388,31 +388,7 @@ namespace TEAMModelOS.Controllers
 
 
 
-        [ProducesDefaultResponseType]
-        [HttpPost("tec-activity")]
-        [Authorize(Roles = "IES")]
-        [AuthToken(Roles = "student,admin,teacher")]
-        public async Task<IActionResult> TecActivity(JsonElement request)
-        {
-            if (!request.TryGetProperty("type", out JsonElement _type)) return BadRequest();
-            var (id, name, pic, school) = HttpContext.GetAuthTokenInfo();
-            List<StuActivity> datas = new List<StuActivity>();
-            var queryc = $"SELECT value(c) from c where c.school = '{school}' and c.type='{_type}' ";
-            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuActivity>(queryText: queryc, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Activity-{id}") }))
-            {
-                datas.Add(item);
-                /*using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                {
-                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    {
-                        courses.Add(obj.ToObject<object>());
-                    }
-                }*/
-            }
-            //(List<StuActivity> datas, string continuationToken) = await ActivityStudentService.FindActivity(request, id, school, _azureCosmos, _azureRedis);
-            return Ok(new { datas });
-        }
+         
 
         /// <summary>
         /// 
@@ -435,11 +411,11 @@ namespace TEAMModelOS.Controllers
                 {
                     if (role.GetString().Equals("teacher") || role.GetString().Equals("admin"))
                     {
-                        await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity>($"{id}", new PartitionKey($"{code}"));
+                       // await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity>($"{id}", new PartitionKey($"{code}"));
                     }
                     else if (role.GetString().Equals("student"))
                     {
-                        await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity>($"{id}", new PartitionKey($"{code}"));
+                        //await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity>($"{id}", new PartitionKey($"{code}"));
                     }
                     else
                     {

+ 1 - 25
TEAMModelOS/Controllers/XTest/DataMigrationController.cs

@@ -1177,31 +1177,7 @@ namespace TEAMModelOS.Controllers
             return Ok();
         }
 
-        /// <summary>
-        /// 迁移教师基础信息,并处理历史数据。
-        /// </summary>
-        /// <param name="data"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        //[AuthToken(Roles = "teacher")]
-        [HttpGet("restore-tmd-course&activity")]
-        public async Task<IActionResult> RestoreTmdCourseAndActivity()
-        {
-            var client = _azureCosmos.GetCosmosClient();
-            List<StuActivity> activities = new List<StuActivity>();
-            List<StuCourse> stuCourses = new List<StuCourse>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuActivity>(queryText: "select value(c) from c where c.pk='Activity'"))
-            {
-                await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync<StuActivity>(item, partitionKey: new PartitionKey(item.code));
-                activities.Add(item);
-            }
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuCourse>(queryText: "select value(c) from c where c.pk='StuCourse'"))
-            {
-                await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync<StuCourse>(item, partitionKey: new PartitionKey(item.code));
-                stuCourses.Add(item);
-            }
-            return Ok(new { activities, stuCourses });
-        }
+      
 
         /// <summary>
         /// 迁移教师基础信息,并处理历史数据。

+ 3 - 169
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -417,46 +417,6 @@ namespace TEAMModelOS.Controllers
             //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).UpsertItemAsync(examImport, new Azure.Cosmos.PartitionKey(examImport.code));
             return Ok(new { code = 200, students });
         }
-
-        [HttpPost("fix-exam-paper")]
-        //[Authorize(Roles = "IES")]
-        //[AuthToken(Roles = "teacher,admin,business")]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<IActionResult> fixExamPaper(JsonElement json)
-        {
-            var client = _azureCosmos.GetCosmosClient();
-            string stusql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
-            //string stusql = "select * from c where c.pk = 'Art' and c.pId  = '306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2'";
-            List<ArtEvaluation> art = new List<ArtEvaluation>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryIterator<ArtEvaluation>(queryText: stusql))
-            {
-                art.Add(item);
-            }
-            var examId = art.SelectMany(c => c.settings).Where(z => z.id.Equals("quota_21")).SelectMany(a => a.task).Where(p => p.type == 1 && !string.IsNullOrEmpty(p.acId)).Select(o => o.acId).ToList();
-            string examSQL = $"select * from c where c.pk = 'ExamClassResult' and c.examId in ({string.Join(",", examId.Select(o => $"'{o}'"))})";
-            List<ExamClassResult> classResults = new();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryIterator<ExamClassResult>(queryText: examSQL))
-            {
-                classResults.Add(item);
-            }
-            string stuSql = $"select * from c where c.pk = 'Activity' and c.id in ({string.Join(",", examId.Select(o => $"'{o}'"))})";
-            List<StuActivity> stus = new();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student).GetItemQueryIterator<StuActivity>(queryText: stuSql))
-            {
-                stus.Add(item);
-            }
-            List<(string code, string sId)> students = new();
-            
-
-            await foreach (var (school, id) in stuTask(client, stus, classResults))
-            {
-                students.Add((school, id));
-            }
-
-            //await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).UpsertItemAsync(examImport, new Azure.Cosmos.PartitionKey(examImport.code));
-            return Ok(new { code = 200, students });
-        }
-
         private async IAsyncEnumerable<(string school,string id)> stuTask(CosmosClient client,List<StudentArtResult> artResults, List<(string code, string stuId, double score)> stus) {
             
             foreach (StudentArtResult result in artResults)
@@ -490,39 +450,7 @@ namespace TEAMModelOS.Controllers
             }
         }
 
-        private async IAsyncEnumerable<(string school, string id)> stuTask(CosmosClient client, List<StuActivity> stus, List<ExamClassResult> classResults)
-        {
-
-            foreach (ExamClassResult classResult in classResults)
-            {
-                string value = "";
-                string code = "";
-                try {
-                    //int n = 0;
-                    var activity = stus.Where(c => c.id.Equals(classResult.examId)).ToList();
-                    //List<(string studentId, string blob)> stuBlob = new();
-                    foreach (StuActivity stu in activity) { 
-                        List<string> tas = stu.code.Split('-').ToList();
-                        JsonElement dict = stu.paper;
-                        dict[0].TryGetProperty("blob", out JsonElement element);
-                        string blob = element.ToString();
-                        int index =  classResult.studentIds.IndexOf(tas[2]);
-                        if (index != -1)
-                        {
-                            classResult.paper[index] = blob;
-                        }
-                    }
-                    await client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(classResult, classResult.id, new PartitionKey(classResult.code));
-                } catch (Exception e) {
-                    value = classResult.examId;
-                    code = classResult.school;
-                }
-
-                yield return (code, value);
-
-            }
-        }
-
+       
         [ProducesDefaultResponseType]
         [HttpPost("find-xg-activity")]
         public async Task<IActionResult> findXgActivity(JsonElement element)
@@ -1772,25 +1700,7 @@ namespace TEAMModelOS.Controllers
             return Ok(new { });
         }
 
-        [ProducesDefaultResponseType]
-        //[AuthToken(Roles = "teacher")]
-        [HttpPost("fix-activity-art")]
-        public async Task<IActionResult> FixActivityArt(JsonElement data)
-        {
-
-            var client = _azureCosmos.GetCosmosClient();
-            List<StuActivity> activities = new List<StuActivity>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuActivity>(queryText: "SELECT  value(c) FROM c where c.pk = 'Activity' and c.type = 'Atr'"))
-            {
-                activities.Add(item);
-            }
-            foreach (var activity in activities)
-            {
-                    activity.type = "Art";
-                    await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(activity, activity.id,new PartitionKey(activity.code));
-            }
-            return Ok(new { });
-        }
+         
 
         /// <summary>
         /// 修复名单的scope,school,creatorid
@@ -2551,83 +2461,7 @@ namespace TEAMModelOS.Controllers
             return Ok(new { countMore1, countEqual1 , nokey,noreg});
 
         }
-        /// <summary>
-        /// 学生活动中间表ClassIds去重
-        /// </summary>
-        /// <param name="jsonElement"></param>
-        /// <returns></returns>
-        [HttpPost("fix-classIds")]
-        public async Task<IActionResult> CorrectActivityClassIds()
-        {
-            try
-            {
-                var cosmosClient = _azureCosmos.GetCosmosClient();
-                //string sqlTxt = "SELECT select c.id,c.code,c.classIds FROM c  where c.pk='Activity' and c.classIds <> []";
-                string sqlTxt = "select c.id,c.code,c.classIds from c where c.classIds <> []";
-                List<CorrectStu> correctStus = new List<CorrectStu>();
-                await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: sqlTxt, requestOptions: new QueryRequestOptions() { }))
-                {
-                    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    {
-                        obj.TryGetProperty("id", out JsonElement tempTd);
-                        obj.TryGetProperty("code", out JsonElement code);
-                        obj.TryGetProperty("classIds", out JsonElement _classIds);
-                        List<string> templist = _classIds.ToObject<List<string>>();
-
-                        //List<string> newList = templist.Distinct().ToList(); //Equals实现去重  
-                        //List<string> newLis1 = templist.Where((x, i) => templist.FindIndex(z => z == x) == i).ToList(); //Lambda表达式去重 
-                        HashSet<string> hashSet = new HashSet<string>(templist);//哈希自动去重
-                        if (hashSet.Count != templist.Count)
-                        {
-                            CorrectStu correctList = new CorrectStu() { id = $"{tempTd}", code = $"{code}", classIds = hashSet.ToList() };
-                            correctStus.Add(correctList);
-                        }
-                    }
-                }
-                List<Task<ItemResponse<StuActivity>>> tasks = new List<Task<ItemResponse<StuActivity>>>();
-                if (correctStus.Count > 0)
-                {
-                    foreach (var correct in correctStus)
-                    {
-                        StuActivity stuActivity = await cosmosClient.GetContainer("TEAMModelOS", "Student").ReadItemAsync<StuActivity>(correct.id, new PartitionKey(correct.code));
-                        if (stuActivity != null)
-                        {
-                            stuActivity.classIds = correct.classIds;
-
-                            tasks.Add(cosmosClient.GetContainer("TEAMModelOS", "Student").ReplaceItemAsync<StuActivity>(stuActivity, stuActivity.id, new PartitionKey(stuActivity.code)));
-                        }
-                    }
-                    int pagesize = 1000;
-                    if (tasks.Count <= pagesize)
-                    {
-                        await Task.WhenAll(tasks);
-                    }
-                    else
-                    {
-                        int pages = (tasks.Count + pagesize) / pagesize; //256是批量操作最大值,pages = (total + max -1) / max;
-                        for (int i = 0; i < pages; i++)
-                        {
-                            var listssb = tasks.Skip((i) * pagesize).Take(pagesize).ToList();
-                            await Task.WhenAll(listssb);
-                        }
-                    }
-                    return Ok(new { state = 200, msg = "去重成功" });
-                }
-                else
-                {
-                    return Ok(new { state = 201, msg = "学生活动中间表无重复班级ID" });
-                }
-
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"OS,{_option.Location} /fix-data/fix-classIds \n {ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
-                return Ok(new { state = 401 });
-            }
-        }
-
-
+         
 
         /// <summary>
         /// 所有学校添加国家智慧教育公共服务平台  https://www.smartedu.cn/