Browse Source

处理名单查询。

CrazyIter_Bin 3 years ago
parent
commit
75781331c9

+ 95 - 88
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -356,7 +356,7 @@ namespace TEAMModelOS.SDK.Models.Service
                     var list = item.Value.GroupBy(x => x.type).Select(y => new { key = y.Key, list = y.ToList() });
                     var list = item.Value.GroupBy(x => x.type).Select(y => new { key = y.Key, list = y.ToList() });
                     foreach (var group in list)
                     foreach (var group in list)
                     {
                     {
-                        await GetGroupListMemberInfo(client, group.key, group.list, item.Key);
+                        await GetGroupListMemberInfo(client, group.key, group.list, item.Key,_dingDing);
                     }
                     }
                 }
                 }
                 groupLists = groups.SelectMany(x => x.Value).ToList();
                 groupLists = groups.SelectMany(x => x.Value).ToList();
@@ -389,116 +389,123 @@ namespace TEAMModelOS.SDK.Models.Service
             return groupLists;
             return groupLists;
         }
         }
 
 
-        public static async Task<(List<GroupList> groups, List<Member> members)> GetGroupListMemberInfo(CosmosClient client, string type, List<GroupList> groups, string groupTbname)
+        public static async Task<(List<GroupList> groups, List<Member> members)> GetGroupListMemberInfo(CosmosClient client, string type, List<GroupList> groups, string groupTbname, DingDing _dingDing)
         {
         {
 
 
-            var members = groups.SelectMany(y => y.members).ToList();
-            //去重
-            List<Member> tmids = members.FindAll(x => x.type == 1).Where((x, i) => members.FindAll(x => x.type == 1).FindIndex(n => n.id.Equals(x.id)) == i).ToList();
-            List<Member> students = members.FindAll(x => x.type == 2).Where((x, i) => members.FindAll(x => x.type == 2).FindIndex(n => n.id.Equals(x.id) && n.code.Equals(x.code)) == i).ToList();
-            var stu = students.GroupBy(x => x.code).Select(y => new { key = y.Key, list = y.ToList() });
-            List<Student> studentsData = new List<Student>();
-            if (stu != null)
-            {
-                foreach (var item in stu)
+            try {
+                var members = groups.SelectMany(y => y.members).ToList();
+                //去重
+                List<Member> tmids = members.FindAll(x => x.type == 1).Where((x, i) => members.FindAll(x => x.type == 1).FindIndex(n => n.id.Equals(x.id)) == i).ToList();
+                List<Member> students = members.FindAll(x => x.type == 2).Where((x, i) => members.FindAll(x => x.type == 2).FindIndex(n => n.id.Equals(x.id) && n.code.Equals(x.code)) == i).ToList();
+                var stu = students.GroupBy(x => x.code).Select(y => new { key = y.Key, list = y.ToList() });
+                List<Student> studentsData = new List<Student>();
+                if (stu != null)
                 {
                 {
-                    var ids = item.list.Select(x => x.id).ToList();
-                    if (ids.IsNotEmpty())
-                    {
-                        StringBuilder stuSql = new StringBuilder($"SELECT distinct c.name,c.id,c.code,c.picture,c.no FROM c ");
-                        string insql = string.Join(",", ids.Select(x => $"'{x}'"));
-                        stuSql.Append($"c.id in ({insql})");
-                        await foreach (var student in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: stuSql.ToString(),
-                            requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{item.key}") }))
+                    foreach (var item in stu)
+                    {
+                        var ids = item.list.Select(x => x.id).ToList();
+                        if (ids.IsNotEmpty())
                         {
                         {
-                            studentsData.Add(student);
+                            StringBuilder stuSql = new StringBuilder($"SELECT distinct c.name,c.id,c.code,c.picture,c.no FROM c ");
+                            string insql = string.Join(",", ids.Select(x => $"'{x}'"));
+                            stuSql.Append($"where  c.id in ({insql})");
+                            await foreach (var student in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: stuSql.ToString(),
+                                requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{item.key}") }))
+                            {
+                                student.schoolId = item.key;
+                                studentsData.Add(student);
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
-            }
-            List<TmdUser> tmdsData = new List<TmdUser>();
-            if (tmids.IsNotEmpty())
-            {
-                string memberTbname = "";
-                //可能会出现在两种表中
-                if ($"{type}".Equals("teach") || $"{type}".Equals("research") || $"{type}".Equals("group")
-                    || $"{type}".Equals("friend") || $"{type}".Equals("manage") || $"{type}".Equals("subject"))
+                List<TmdUser> tmdsData = new List<TmdUser>();
+                if (tmids.IsNotEmpty())
                 {
                 {
-                    StringBuilder tmdidSql = new StringBuilder($"SELECT distinct c.name,c.id,c.picture FROM c ");
-                    string insql = string.Join(",", tmids.Select(x => $"'{x.id}'"));
-                    tmdidSql.Append($" where  c.id in ({insql})");
-                    memberTbname = "Teacher";
-                    await foreach (var tmd in client.GetContainer(Constant.TEAMModelOS, memberTbname).GetItemQueryIterator<TmdUser>(queryText: tmdidSql.ToString(),
-                            requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
-                    {
-                        tmdsData.Add(tmd);
-                    }
-                }
-                if ($"{type}".Equals("teach") || $"{type}".Equals("friend") || $"{type}".Equals("group"))
-                {
-                    //取差集,减少二次搜寻
-                    var tmdidexp = tmids.Select(x => x.id).Except(tmdsData.Select(y => y.id)).ToList();
-                    if (tmdidexp.IsNotEmpty())
+                    string memberTbname = "";
+                    //可能会出现在两种表中
+                    if ($"{type}".Equals("teach") || $"{type}".Equals("research") || $"{type}".Equals("group")
+                        || $"{type}".Equals("friend") || $"{type}".Equals("manage") || $"{type}".Equals("subject"))
                     {
                     {
                         StringBuilder tmdidSql = new StringBuilder($"SELECT distinct c.name,c.id,c.picture FROM c ");
                         StringBuilder tmdidSql = new StringBuilder($"SELECT distinct c.name,c.id,c.picture FROM c ");
-                        string insql = string.Join(",", tmdidexp.Select(x => $"'{x}'"));
+                        string insql = string.Join(",", tmids.Select(x => $"'{x.id}'"));
                         tmdidSql.Append($" where  c.id in ({insql})");
                         tmdidSql.Append($" where  c.id in ({insql})");
-
-                        memberTbname = "Student";
+                        memberTbname = "Teacher";
                         await foreach (var tmd in client.GetContainer(Constant.TEAMModelOS, memberTbname).GetItemQueryIterator<TmdUser>(queryText: tmdidSql.ToString(),
                         await foreach (var tmd in client.GetContainer(Constant.TEAMModelOS, memberTbname).GetItemQueryIterator<TmdUser>(queryText: tmdidSql.ToString(),
                                 requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
                                 requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
                         {
                         {
                             tmdsData.Add(tmd);
                             tmdsData.Add(tmd);
                         }
                         }
                     }
                     }
+                    if ($"{type}".Equals("teach") || $"{type}".Equals("friend") || $"{type}".Equals("group"))
+                    {
+                        //取差集,减少二次搜寻
+                        var tmdidexp = tmids.Select(x => x.id).Except(tmdsData.Select(y => y.id)).ToList();
+                        if (tmdidexp.IsNotEmpty())
+                        {
+                            StringBuilder tmdidSql = new StringBuilder($"SELECT distinct c.name,c.id,c.picture FROM c ");
+                            string insql = string.Join(",", tmdidexp.Select(x => $"'{x}'"));
+                            tmdidSql.Append($" where  c.id in ({insql})");
+
+                            memberTbname = "Student";
+                            await foreach (var tmd in client.GetContainer(Constant.TEAMModelOS, memberTbname).GetItemQueryIterator<TmdUser>(queryText: tmdidSql.ToString(),
+                                    requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
+                            {
+                                tmdsData.Add(tmd);
+                            }
+                        }
+                    }
+                    //去重
+                    tmdsData = tmdsData.Where((x, i) => tmdsData.FindIndex(n => n.id.Equals(x.id)) == i).ToList();
                 }
                 }
-                //去重
-                tmdsData = tmdsData.Where((x, i) => tmdsData.FindIndex(n => n.id.Equals(x.id)) == i).ToList();
-            }
-            HashSet<GroupList> changes = new HashSet<GroupList>();
-            var unexist_tmdid = tmids.Select(x => x.id).Except(tmdsData.Select(y => y.id)).ToList();
-            groups.ForEach(x =>
-            {
-                int item = x.members.RemoveAll(y => unexist_tmdid.Contains(y.id) && y.type == 1);
-                if (item > 0)
+                HashSet<GroupList> changes = new HashSet<GroupList>();
+                var unexist_tmdid = tmids.Select(x => x.id).Except(tmdsData.Select(y => y.id)).ToList();
+                groups.ForEach(x =>
                 {
                 {
-                    changes.Add(x);
-                }
-            });
-            var unexist_student = students.Select(x => (x.id, x.code)).Except(studentsData.Select(y => (y.id, y.code)), new CompareIdCode()).ToList();
-            groups.ForEach(x =>
-            {
-                int item = x.members.RemoveAll(y => y.type == 2 && unexist_student.Exists(x => x.id.Equals(y.id) && x.code.Equals(y.code)));
-                if (item > 0)
+                    int item = x.members.RemoveAll(y => unexist_tmdid.Contains(y.id) && y.type == 1);
+                    if (item > 0)
+                    {
+                        changes.Add(x);
+                    }
+                });
+                var unexist_student = students.Select(x => (x.id, x.code)).Except(studentsData.Select(y => (y.id, y.schoolId)), new CompareIdCode()).ToList();
+                groups.ForEach(x =>
                 {
                 {
-                    changes.Add(x);
-                }
-            });
-            if (changes.Count > 0 && !string.IsNullOrEmpty(groupTbname))
-            {
-                foreach (var change in changes)
+                    int item = x.members.RemoveAll(y => y.type == 2 && !unexist_student.Exists(x => x.id.Equals(y.id) && x.Item2.Equals(y.code)));
+                    if (item > 0)
+                    {
+                        changes.Add(x);
+                    }
+                });
+                tmids.ForEach(x =>
+                {
+                    var user = tmdsData.Find(y => y.id.Equals(x.id));
+                    x.name = user?.name;
+                    x.picture = user?.picture;
+                });
+                students.ForEach(x =>
+                {
+                    var student = studentsData.Find(y => y.id.Equals(x.id) && y.schoolId.Equals(x.code));
+                    x.name = student?.name;
+                    x.picture = student?.picture;
+                    x.no = student?.no;
+                });
+                var mbs = tmids;
+                mbs.AddRange(students);
+                if (changes.Count > 0 && !string.IsNullOrEmpty(groupTbname))
                 {
                 {
-                    change.tcount = change.members.Where(x => x.type == 1).Count();
-                    change.scount = change.members.Where(x => x.type == 2).Count();
-                    await client.GetContainer(Constant.TEAMModelOS, groupTbname).ReplaceItemAsync(change, change.id, new PartitionKey(change.code));
+                    foreach (var change in changes)
+                    {
+                        change.tcount = change.members.Where(x => x.type == 1).Count();
+                        change.scount = change.members.Where(x => x.type == 2).Count();
+                        await client.GetContainer(Constant.TEAMModelOS, groupTbname).ReplaceItemAsync(change, change.id, new PartitionKey(change.code));
+                    }
                 }
                 }
+               
+                return (groups, mbs);
+            } catch (Exception ex) {
+                await _dingDing.SendBotMsg($"OS,GetGroupListMemberInfo()\n{ex.Message}{ex.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
             }
             }
-            tmids.ForEach(x =>
-            {
-                var user = tmdsData.Find(y => y.id.Equals(x.id));
-                x.name = user?.name;
-                x.picture = user?.picture;
-            });
-            students.ForEach(x =>
-            {
-                var student = studentsData.Find(y => y.id.Equals(x.id) && y.code.Equals(x.code));
-                x.name = student?.name;
-                x.picture = student?.picture;
-                x.no = student?.no;
-            });
-            var mbs = tmids;
-            mbs.AddRange(students);
-            return (groups, mbs);
+            return (null, null);
         }
         }
 
 
         public static async Task FixActivity(CosmosClient client, DingDing _dingDing, GroupChange groupChange, string type)
         public static async Task FixActivity(CosmosClient client, DingDing _dingDing, GroupChange groupChange, string type)

+ 3 - 3
TEAMModelOS/Controllers/School/GroupListController.cs

@@ -452,7 +452,7 @@ namespace TEAMModelOS.Controllers
                 {
                 {
                     groups.Add(item);
                     groups.Add(item);
                 }
                 }
-                (List<GroupList> groupsData, List<Member> members) = await GroupListService.GetGroupListMemberInfo(client, $"{type}", groups, tbname);
+                (List<GroupList> groupsData, List<Member> members) = await GroupListService.GetGroupListMemberInfo(client, $"{type}", groups, tbname,_dingDing);
                 return Ok(new { groups = groupsData, members });
                 return Ok(new { groups = groupsData, members });
             }
             }
             catch (CosmosException ex)
             catch (CosmosException ex)
@@ -546,10 +546,10 @@ namespace TEAMModelOS.Controllers
                 else
                 else
                 {
                 {
                     //学校自定义名单
                     //学校自定义名单
-                    code = !code.StartsWith("GroupList-") ? $"GroupList-{code}" : code;
+                    code = !code.StartsWith("GroupList-") ? $"GroupList-{_code}" : code;
                 }
                 }
                 groupList = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<GroupList>($"{id}", new PartitionKey($"{code}"));
                 groupList = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<GroupList>($"{id}", new PartitionKey($"{code}"));
-                (List<GroupList> groupsData, List<Member> members) = await GroupListService.GetGroupListMemberInfo(client, $"{groupList.type}", new List<GroupList> { groupList }, tbname);
+                (List<GroupList> groupsData, List<Member> members) = await GroupListService.GetGroupListMemberInfo(client, $"{groupList.type}", new List<GroupList> { groupList }, tbname,_dingDing);
                 groupList = groupsData.FirstOrDefault();
                 groupList = groupsData.FirstOrDefault();
             }
             }
             catch (CosmosException ex)
             catch (CosmosException ex)

+ 96 - 81
TEAMModelOS/Controllers/XTest/DataMigrationController.cs

@@ -57,55 +57,102 @@ namespace TEAMModelOS.Controllers
         //[AuthToken(Roles = "teacher")]
         //[AuthToken(Roles = "teacher")]
         [HttpGet("restore-stulist")]
         [HttpGet("restore-stulist")]
         public async Task<IActionResult> RestoreStulist() {
         public async Task<IActionResult> RestoreStulist() {
-            var client = _azureCosmos.GetCosmosClient();
-            List<School> schools = new List<School>(0);
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
-            {
-                schools.Add(item);
-            }
-            foreach (var school in schools) {
-                List<GroupList> teachlists = new List<GroupList>();
-                List<GroupList> reschlists = new List<GroupList>();
-                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"StuList-{school.id}") }))
+            try {
+                var client = _azureCosmos.GetCosmosClient();
+                List<School> schools = new List<School>(0);
+                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                 {
                 {
-                    List<Member> members = new List<Member>();
-                    if (item.students.IsNotEmpty()) {
-                        item.students.ForEach(x => {
-                            members.Add(new Member { id = x.id, code = school.id, type = 2});
-                        });
+                    schools.Add(item);
+                }
+                foreach (var school in schools)
+                {
+                    List<GroupList> teachlists = new List<GroupList>();
+                    List<GroupList> reschlists = new List<GroupList>();
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"StuList-{school.id}") }))
+                    {
+                        List<Member> members = new List<Member>();
+                        if (item.students.IsNotEmpty())
+                        {
+                            item.students.ForEach(x => {
+                                members.Add(new Member { id = x.id, code = x.code.Replace("Base-", ""), type = 2 });
+                            });
+                        }
+                        if (item.tmids.IsNotEmpty())
+                        {
+                            item.tmids.ForEach(x => {
+                                members.Add(new Member { id = x, type = 1 });
+                            });
+                        }
+                        GroupList group = new GroupList
+                        {
+                            pk = "GroupList",
+                            id = item.id,
+                            code = $"GroupList-{school.id}",
+                            name = item.id,
+                            ttl = -1,
+                            no = item.no,
+                            periodId = string.IsNullOrEmpty(item.periodId) ? school.period[0]?.id : item.periodId,
+                            scope = "school",
+                            creatorId = item.creatorId,
+                            type = "teach",
+                            members = members,
+                            school = school.id
+                        };
+                        await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
+                        teachlists.Add(group);
                     }
                     }
-                    if (item.tmids.IsNotEmpty()) {
-                        item.tmids.ForEach(x => {
-                            members.Add(new Member { id = x, type =1 });
-                        });
+                    if (teachlists.IsNotEmpty())
+                    {
+                        await GroupListService.GetGroupListMemberInfo(client, "teach", teachlists, "School", _dingDing);
                     }
                     }
-                    GroupList group = new GroupList
+                  
+
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TchList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"TchList-{school.id}") }))
                     {
                     {
-                        pk = "GroupList",
-                        id = item.id,
-                        code = $"GroupList-{school.id}",
-                        name = item.id,
-                        ttl = -1,
-                        no = item.no,
-                        periodId = string.IsNullOrEmpty(item.periodId) ? school.period[0]?.id : item.periodId,
-                        scope = "school",
-                        creatorId = item.creatorId,
-                        type = "teach",
-                        members = members,
-                        school = school.id
-                    };
-                   await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
-                    teachlists.Add(group);
-                }
-                await GroupListService.GetGroupListMemberInfo(client, "teach", teachlists, "School");
+                        List<Member> members = new List<Member>();
 
 
-                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TchList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"TchList-{school.id}") }))
+                        if (item.teachers.IsNotEmpty())
+                        {
+                            item.teachers.ForEach(x => {
+                                members.Add(new Member { id = x, type = 1 });
+                            });
+                        }
+                        GroupList group = new GroupList
+                        {
+                            pk = "GroupList",
+                            id = item.id,
+                            code = $"GroupList-{school.id}",
+                            name = item.id,
+                            ttl = -1,
+                            no = item.no,
+                            scope = "school",
+                            creatorId = item.creatorId,
+                            type = "research",
+                            members = members,
+                            school = school.id
+                        };
+                        await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
+                        reschlists.Add(group);
+                    }
+                    if (reschlists.IsNotEmpty())
+                    {
+                        await GroupListService.GetGroupListMemberInfo(client, "research", reschlists, "School", _dingDing);
+                    }
+                       
+                }
+                List<GroupList> groupLists = new List<GroupList>();
+                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"StuList") }))
                 {
                 {
                     List<Member> members = new List<Member>();
                     List<Member> members = new List<Member>();
-                    
-                    if (item.teachers.IsNotEmpty())
+                    if (item.students.IsNotEmpty())
                     {
                     {
-                        item.teachers.ForEach(x => {
+                        item.students.ForEach(x => {
+                            members.Add(new Member { id = x.id, code = x.code.Replace("Base-", ""), type = 2 });
+                        });
+                    }
+                    if (item.tmids.IsNotEmpty())
+                    {
+                        item.tmids.ForEach(x => {
                             members.Add(new Member { id = x, type = 1 });
                             members.Add(new Member { id = x, type = 1 });
                         });
                         });
                     }
                     }
@@ -113,56 +160,24 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         pk = "GroupList",
                         pk = "GroupList",
                         id = item.id,
                         id = item.id,
-                        code = $"GroupList-{school.id}",
+                        code = $"GroupList",
                         name = item.id,
                         name = item.id,
                         ttl = -1,
                         ttl = -1,
                         no = item.no,
                         no = item.no,
                         scope = "school",
                         scope = "school",
                         creatorId = item.creatorId,
                         creatorId = item.creatorId,
-                        type = "research",
+                        type = "teach",
                         members = members,
                         members = members,
-                        school=school.id
+
                     };
                     };
-                    await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
-                    reschlists.Add(group);
+                    await client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync(group, new PartitionKey(group.code));
+                    groupLists.Add(group);
                 }
                 }
-                await GroupListService.GetGroupListMemberInfo(client, "research", teachlists, "School");
+                await GroupListService.GetGroupListMemberInfo(client, "teach", groupLists, "Teacher",_dingDing);
             }
             }
-            List<GroupList> groupLists = new List<GroupList>();
-            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: "SELECT  value(c) FROM c", requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"StuList") }))
-            {
-                List<Member> members = new List<Member>();
-                if (item.students.IsNotEmpty())
-                {
-                    item.students.ForEach(x => {
-                        members.Add(new Member { id = x.id, code =x.id.Replace("Base-",""), type = 2 });
-                    });
-                }
-                if (item.tmids.IsNotEmpty())
-                {
-                    item.tmids.ForEach(x => {
-                        members.Add(new Member { id = x, type = 1 });
-                    });
-                }
-                GroupList group = new GroupList
-                {
-                    pk = "GroupList",
-                    id = item.id,
-                    code = $"GroupList",
-                    name = item.id,
-                    ttl = -1,
-                    no = item.no,
-                    scope = "school",
-                    creatorId = item.creatorId,
-                    type = "teach",
-                    members = members,
-                 
-                };
-                await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
-                groupLists.Add(group);
+            catch (Exception ex) {
+                await _dingDing.SendBotMsg($"OS,restore-stulist()\n{ex.Message}{ex.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
             }
             }
-            await GroupListService.GetGroupListMemberInfo(client, "teach", groupLists, "Teacher");
-
             return Ok();
             return Ok();
         }
         }