CrazyIter_Bin 1 year ago
parent
commit
b1119b23a1

+ 3 - 1
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -1422,7 +1422,9 @@ namespace TEAMModelOS.SDK
                             }
                         }
                     }
-                    x.periodId=periodId;
+                    if (!x.scope.Equals("private")) {
+                        x.periodId=periodId;
+                    }
                 });
                 HashSet<string> schoolCodes = groups.SelectMany(x => x.members).Where(y => !string.IsNullOrEmpty(y.code)).Select(z => z.code).ToHashSet();
                 if (schoolCodes != null && schoolCodes.Count > 0)

+ 23 - 4
TEAMModelOS/Controllers/Client/AClassONEController.cs

@@ -609,7 +609,7 @@ namespace TEAMModelOS.Controllers
             }
             var groupInfo = await  GroupListService.GetMemberByListids(_coreAPIHttpService, _azureCosmos.GetCosmosClient(), _dingDing, hashGroupIds.ToList(), school);
             var groupIdsRel = groupIds.GroupBy(z => z).Select(z => new { groupId = z.Key, count = z.ToList().Count() });
-            List<dynamic> groupLists= new List<dynamic>();
+            List<TeacherRoleGrouplist> groupLists= new List<TeacherRoleGrouplist>();
             foreach (var item in teahcerCourses)
             {
                 
@@ -623,7 +623,11 @@ namespace TEAMModelOS.Controllers
                                 string subjectId = null;
                                 string subjectName = null;
                                 string subjectBindId = null;
-                                groupLists.Add(new { role = z.type,scope= "private", groupList= gp, subjectId, subjectName , subjectBindId });
+                                bool exists = groupLists.Exists(f => f.role.Equals(z.type)  &&  f.scope.Equals("private") && f.groupList.id.Equals(gp.id));
+                                if (!exists) {
+                                    groupLists.Add(new TeacherRoleGrouplist { role = z.type, scope= "private", groupList= gp, subjectId= subjectId, subjectName=subjectName, subjectBindId= subjectBindId });
+
+                                }
                             }
                         }
                     }
@@ -646,8 +650,11 @@ namespace TEAMModelOS.Controllers
                         {
                             foreach (var gp in groupList)
                             {
+                                bool exists = groupLists.Exists(f => f.role.Equals(z.type)  &&  f.scope.Equals("school") && f.groupList.id.Equals(gp.id));
+                                if (!exists) {
+                                    groupLists.Add(new TeacherRoleGrouplist { role = z.type, scope = "school", groupList = gp, subjectId = item.courseBase?.subject?.id, subjectName = item.courseBase?.subject?.name, subjectBindId= subjectBindId });
 
-                                groupLists.Add(new { role = z.type, scope = "school", groupList = gp, subjectId = item.courseBase?.subject?.id, subjectName = item.courseBase?.subject?.name, subjectBindId });
+                                }
                             }
                         }
                     }
@@ -660,13 +667,15 @@ namespace TEAMModelOS.Controllers
                     foreach (var gp in groupList)
                     {
 
-                        groupLists.Add(new { role = "charge", scope = "school", groupList = gp });
+                        groupLists.Add(new TeacherRoleGrouplist { role = "charge", scope = "school", groupList = gp });
                     }
                 }
             }
             //暂时先注释不需要的
             return Ok(new {/* teahcerCourses, schoolCourses, groupIdsRel, */groupLists });
         }
+
+   
         /// <summary>
         /// 根据家长手机号获取监护学生的信息
         /// </summary>
@@ -1323,6 +1332,16 @@ namespace TEAMModelOS.Controllers
                 return BadRequest("500错误");
             }
 
+        }
+        public class TeacherRoleGrouplist
+        {
+            public string role { get; set; }
+            public string scope { get; set; }
+            public RGroupList groupList { get; set; }
+            public string subjectId { get; set; }
+            public string subjectName { get; set; }
+            public string subjectBindId { get; set; }
+
         }
 
         public class WeChatPhone