CrazyIter_Bin 1 년 전
부모
커밋
9a395823d9
2개의 변경된 파일219개의 추가작업 그리고 45개의 파일을 삭제
  1. 63 3
      TEAMModelOS.SDK/Models/Service/GroupListService.cs
  2. 156 42
      TEAMModelOS/Controllers/Both/GroupListController.cs

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

@@ -17,6 +17,7 @@ using System.Text.RegularExpressions;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models;
 using System.Net.Http;
 using System.Net.Http;
 using DocumentFormat.OpenXml.Wordprocessing;
 using DocumentFormat.OpenXml.Wordprocessing;
+using static TEAMModelOS.SDK.GroupListService;
 
 
 namespace TEAMModelOS.SDK
 namespace TEAMModelOS.SDK
 {
 {
@@ -225,10 +226,43 @@ namespace TEAMModelOS.SDK
                     }
                     }
                     else
                     else
                     {
                     {
-                        string key = $"GroupList:Waitinglist:{item.scope}:{item.id}";
-                        string filed = !string.IsNullOrWhiteSpace(school) ? $"{school}:{userid}" : userid;
-                        await _azureRedis.GetRedisClient(8).HashSetAsync(key, filed, new { _stuListNo, userid, type, school, year, id = item.id, name, picture, lang }.ToJsonString());
+                        string key = $"GroupList:GroupWaitingList:{item.scope}:{item.id}";
+                        string filed = !string.IsNullOrWhiteSpace(school) ? $"{school}_{userid}" : userid;
+                        await _azureRedis.GetRedisClient(8).HashSetAsync(key, filed, new GroupWaitingList
+                        {
+                            stuListNo=_stuListNo,
+                            userid=userid,
+                            type=type,
+                            school= school,
+                            year = year,
+                            groupId = item.id,
+                            name = name,
+                            picture = picture,
+                            lang = lang,
+                            qrcodeExpire=item.qrcodeExpire,
+                            groupName= item.name,
+                            applyTime=now
+                        }.ToJsonString());
                         await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(item.qrcodeExpire).UtcDateTime);
                         await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(item.qrcodeExpire).UtcDateTime);
+                        string  stuKey = !string.IsNullOrWhiteSpace(school) ? $"GroupList:StudentWaitinglist:{school}_{userid}" :$"GroupList:StudentWaitinglist:{userid}" ;
+                        string sutFiled = $"{item.scope}:{item.id}";
+                        await _azureRedis.GetRedisClient(8).HashSetAsync(stuKey, sutFiled, new GroupWaitingList
+                        {
+                            stuListNo=_stuListNo,
+                            userid=userid,
+                            type=type,
+                            school= school,
+                            year = year,
+                            groupId = item.id,
+                            name = name,
+                            picture = picture,
+                            lang = lang,
+                            qrcodeExpire=item.qrcodeExpire,
+                            groupName= item.name,
+                            applyTime=now
+                        }.ToJsonString());
+                        //三十天都不登录,则不需要查看申请清单,30*24=720
+                        await _azureRedis.GetRedisClient(8).KeyExpireAsync(stuKey, new TimeSpan(720 , 0, 0));
                         return (6, item, null);
                         return (6, item, null);
                     }
                     }
                 }
                 }
@@ -242,6 +276,32 @@ namespace TEAMModelOS.SDK
             }
             }
             return data;
             return data;
         }
         }
+
+        /// <summary>
+        /// 加入名单等候列表
+        /// </summary>
+        public class GroupWaitingList
+        { 
+            /// <summary>
+            /// 
+            /// </summary>
+            public string stuListNo { get; set; }
+            public string userid { get; set; }
+            public int type { get; set; }
+            public string school { get; set; }
+            public int  year { get; set; }
+            public string groupId { get; set; }
+            public string name { get; set; }
+            public string picture { get; set; }
+            public string lang { get; set; }
+            public long  qrcodeExpire { get; set; }
+            public string groupName { get; set; }
+            public long applyTime{ get; set; }
+            /// <summary>
+            /// 申请状态,-1 申请中,0 通过,1 拒绝。 
+            /// </summary>
+            public int status { get; set; } = -1;
+        }
         public static (int status, GroupList stuList, Member member) JoinList(GroupList stuList, string userid, int type, string school,int year)
         public static (int status, GroupList stuList, Member member) JoinList(GroupList stuList, string userid, int type, string school,int year)
         {
         {
             int status = -1;
             int status = -1;

+ 156 - 42
TEAMModelOS/Controllers/Both/GroupListController.cs

@@ -25,6 +25,10 @@ using Microsoft.Extensions.Hosting;
 using OpenXmlPowerTools;
 using OpenXmlPowerTools;
 using TEAMModelOS.SDK.Models.Dtos;
 using TEAMModelOS.SDK.Models.Dtos;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
+using Azure.Core;
+using static TEAMModelOS.SDK.Services.ActivityStudentService;
+using static TEAMModelOS.SDK.GroupListService;
+using DocumentFormat.OpenXml.Bibliography;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers
 {
 {
@@ -45,7 +49,7 @@ namespace TEAMModelOS.Controllers
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
         private const string SummarySql = " c.id,c.code,c.name,c.no,c.periodId,c.scope,c.school,c.creatorId,c.type,c.year,c.tcount,c.scount,c.leader ,c.froms ,c.joinLock ,c.review,c.limitCount ,c.expire,c.qrcodeExpire,c.qrcodeDays ,c.grades  ";
         private const string SummarySql = " c.id,c.code,c.name,c.no,c.periodId,c.scope,c.school,c.creatorId,c.type,c.year,c.tcount,c.scount,c.leader ,c.froms ,c.joinLock ,c.review,c.limitCount ,c.expire,c.qrcodeExpire,c.qrcodeDays ,c.grades  ";
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
-        public GroupListController(IWebHostEnvironment environment,CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option, 
+        public GroupListController(IWebHostEnvironment environment, CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, DingDing dingDing, IOptionsSnapshot<Option> option,
             AzureServiceBusFactory serviceBus, AzureStorageFactory azureStorage, IConfiguration configuration, AzureRedisFactory azureRedis)
             AzureServiceBusFactory serviceBus, AzureStorageFactory azureStorage, IConfiguration configuration, AzureRedisFactory azureRedis)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
@@ -65,15 +69,15 @@ namespace TEAMModelOS.Controllers
         [AuthToken(Roles = "admin,teacher,student")]
         [AuthToken(Roles = "admin,teacher,student")]
         public async Task<IActionResult> GetMyCourseAndGroupList(JsonElement json)
         public async Task<IActionResult> GetMyCourseAndGroupList(JsonElement json)
         {
         {
-            var (userid, _name, _picture,school) = HttpContext.GetAuthTokenInfo();
+            var (userid, _name, _picture, school) = HttpContext.GetAuthTokenInfo();
             var client = _azureCosmos.GetCosmosClient();
             var client = _azureCosmos.GetCosmosClient();
-            object scope = null;  
+            object scope = null;
             HttpContext?.Items.TryGetValue("Scope", out scope);
             HttpContext?.Items.TryGetValue("Scope", out scope);
-            int memberType =2;
+            int memberType = 2;
             if ($"{scope}".Equals(Constant.ScopeStudent))
             if ($"{scope}".Equals(Constant.ScopeStudent))
             {
             {
                 memberType = 2;
                 memberType = 2;
-               // Student student = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<Student>(userid, new PartitionKey($"Base-{school}"));
+                // Student student = await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<Student>(userid, new PartitionKey($"Base-{school}"));
             }
             }
             if ($"{scope}".Equals(Constant.ScopeTmdUser))
             if ($"{scope}".Equals(Constant.ScopeTmdUser))
             {
             {
@@ -83,7 +87,7 @@ namespace TEAMModelOS.Controllers
             {
             {
                 memberType = 1;
                 memberType = 1;
             }
             }
-            List<GroupListGrp> groups=  await  GroupListService.GetMemberInGroupList(_coreAPIHttpService, client, _dingDing, userid, memberType, school, new List<string> { "class", "teach" });
+            List<GroupListGrp> groups = await GroupListService.GetMemberInGroupList(_coreAPIHttpService, client, _dingDing, userid, memberType, school, new List<string> { "class", "teach" });
             return Ok(new { groups = groups });
             return Ok(new { groups = groups });
         }
         }
 
 
@@ -133,7 +137,7 @@ namespace TEAMModelOS.Controllers
                 }
                 }
             }
             }
             int year = DateTimeOffset.UtcNow.Year;
             int year = DateTimeOffset.UtcNow.Year;
-            (int status, GroupList stuList,Member member) data = await GroupListService.CodeJoinList(client,_azureRedis, $"{_stuListNo}", id, type: 1, $"{school}",year, $"{name}", $"{picture}",$"{lang}");
+            (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", id, type: 1, $"{school}", year, $"{name}", $"{picture}", $"{lang}");
             //没有TmdUser时
             //没有TmdUser时
             if (data.status == 0)
             if (data.status == 0)
             {
             {
@@ -157,14 +161,14 @@ namespace TEAMModelOS.Controllers
                 if (ids.IsNotEmpty())
                 if (ids.IsNotEmpty())
                 {
                 {
                     string bizcode = "scan-join";
                     string bizcode = "scan-join";
-                    string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids .Select(x => $"'{x}'"))})";
+                    string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher)
                         .GetItemQueryIterator<IdNameCode>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                         .GetItemQueryIterator<IdNameCode>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                     {
                     {
                         idNameCodes.Add(item);
                         idNameCodes.Add(item);
                     }
                     }
-                  //  _coreAPIHttpService.PushNotify(idNameCodes, $"scan-join_groupList", Constant.NotifyType_IES5_Course,   new Dictionary<string, object> { { "tmdid", id }, { "tmdname", name }, { "groupListName", data.stuList.name }, { "groupListId", data.stuList.id } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
+                    //  _coreAPIHttpService.PushNotify(idNameCodes, $"scan-join_groupList", Constant.NotifyType_IES5_Course,   new Dictionary<string, object> { { "tmdid", id }, { "tmdname", name }, { "groupListName", data.stuList.name }, { "groupListId", data.stuList.id } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                 }
                 }
                 return Ok(new { data.stuList, data.status });
                 return Ok(new { data.stuList, data.status });
             }
             }
@@ -186,7 +190,7 @@ namespace TEAMModelOS.Controllers
         [Authorize(Roles = "IES")]
         [Authorize(Roles = "IES")]
         public async Task<IActionResult> InputCodeJoinList(JsonElement json)
         public async Task<IActionResult> InputCodeJoinList(JsonElement json)
         {
         {
-            string head_lang = _option.Location.Contains("China")? "zh-cn": "zh-tw";
+            string head_lang = _option.Location.Contains("China") ? "zh-cn" : "zh-tw";
             if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
             if (HttpContext.Request.Headers.TryGetValue("lang", out var _lang))
             {
             {
                 head_lang = $"{_lang}";
                 head_lang = $"{_lang}";
@@ -215,7 +219,7 @@ namespace TEAMModelOS.Controllers
             {
             {
                 type = 1;
                 type = 1;
             }
             }
-            (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", userid, type, school,year,_name,_picture,head_lang);
+            (int status, GroupList stuList, Member member) data = await GroupListService.CodeJoinList(client, _azureRedis, $"{_stuListNo}", userid, type, school, year, _name, _picture, head_lang);
             if (data.status == 0)
             if (data.status == 0)
             {
             {
 
 
@@ -239,7 +243,7 @@ namespace TEAMModelOS.Controllers
                 if (ids.IsNotEmpty())
                 if (ids.IsNotEmpty())
                 {
                 {
                     string bizcode = "scan-join";
                     string bizcode = "scan-join";
-                 
+
 
 
                     string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                     string sql = $"select c.id, c.name ,c.lang as code from c where c.id in ({string.Join(",", ids.Select(x => $"'{x}'"))})";
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
                     List<IdNameCode> idNameCodes = new List<IdNameCode>();
@@ -249,7 +253,7 @@ namespace TEAMModelOS.Controllers
                         idNameCodes.Add(item);
                         idNameCodes.Add(item);
                     }
                     }
                     _coreAPIHttpService.PushNotify(idNameCodes, $"{bizcode}_school", Constant.NotifyType_IES5_Course,
                     _coreAPIHttpService.PushNotify(idNameCodes, $"{bizcode}_school", Constant.NotifyType_IES5_Course,
-                              new Dictionary<string, object> { { "tmdid",userid },{ "tmdname", _name }, { "groupListName", data.stuList.name } , { "groupListId", data.stuList.id } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
+                              new Dictionary<string, object> { { "tmdid", userid }, { "tmdname", _name }, { "groupListName", data.stuList.name }, { "groupListId", data.stuList.id } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                 }
                 }
                 return Ok(new { data.stuList, data.status });
                 return Ok(new { data.stuList, data.status });
             }
             }
@@ -311,7 +315,7 @@ namespace TEAMModelOS.Controllers
             json.TryGetProperty("schoolId", out JsonElement schoolId);
             json.TryGetProperty("schoolId", out JsonElement schoolId);
             if (!json.TryGetProperty("opt", out JsonElement opt)) { return BadRequest(); }
             if (!json.TryGetProperty("opt", out JsonElement opt)) { return BadRequest(); }
             json.TryGetProperty("periodId", out JsonElement periodId);
             json.TryGetProperty("periodId", out JsonElement periodId);
-            long nowtime =DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+            long nowtime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             List<GroupListGrp> groupLists = new List<GroupListGrp>();
             List<GroupListGrp> groupLists = new List<GroupListGrp>();
             switch (true)
             switch (true)
             {
             {
@@ -338,13 +342,14 @@ namespace TEAMModelOS.Controllers
                         await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: classsql.ToString(),
                         await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: classsql.ToString(),
                             requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{schoolId}") }))
                             requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{schoolId}") }))
                         {
                         {
-                            int scount=0;
+                            int scount = 0;
                             HashSet<string> groupNames = new HashSet<string>();
                             HashSet<string> groupNames = new HashSet<string>();
                             string gpsql = $"SELECT distinct c.id,  c.groupId,c.groupName FROM c where  c.classId='{item.id}' ";
                             string gpsql = $"SELECT distinct c.id,  c.groupId,c.groupName FROM c where  c.classId='{item.id}' ";
                             await foreach (var gp in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: gpsql,
                             await foreach (var gp in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: gpsql,
                                 requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{schoolId}") }))
                                 requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{schoolId}") }))
                             {
                             {
-                                if (!string.IsNullOrWhiteSpace(gp.groupName)) {
+                                if (!string.IsNullOrWhiteSpace(gp.groupName))
+                                {
                                     groupNames.Add(gp.groupName);
                                     groupNames.Add(gp.groupName);
                                 }
                                 }
                                 scount += 1;
                                 scount += 1;
@@ -439,7 +444,7 @@ namespace TEAMModelOS.Controllers
                         string insql = string.Join(",", classIds.Select(x => $"'{x}'"));
                         string insql = string.Join(",", classIds.Select(x => $"'{x}'"));
                         query = new StringBuilder($"SELECT c.id,c.name,c.periodId ,c.year  FROM c where c.id in ({insql}) and ( c.graduate = 0 or  IS_DEFINED(c.graduate) = false) ");
                         query = new StringBuilder($"SELECT c.id,c.name,c.periodId ,c.year  FROM c where c.id in ({insql}) and ( c.graduate = 0 or  IS_DEFINED(c.graduate) = false) ");
                         ///行政班(学生搜寻classId动态返回)class
                         ///行政班(学生搜寻classId动态返回)class
-                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText:  query.ToString(),
+                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: query.ToString(),
                         requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{schoolId}") }))
                         requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{schoolId}") }))
                         {
                         {
                             HashSet<string> groupNames = new HashSet<string>();
                             HashSet<string> groupNames = new HashSet<string>();
@@ -494,7 +499,8 @@ namespace TEAMModelOS.Controllers
                         }
                         }
                     }
                     }
                     List<CourseGroupList> courseGroups = new List<CourseGroupList>();
                     List<CourseGroupList> courseGroups = new List<CourseGroupList>();
-                    teachCourses.GroupBy(y => (y.id, y.name, y.scope, y.period.name, y.period.id, y.subject.name, y.subject.id)).ToList().ForEach(x => {
+                    teachCourses.GroupBy(y => (y.id, y.name, y.scope, y.period.name, y.period.id, y.subject.name, y.subject.id)).ToList().ForEach(x =>
+                    {
                         List<GroupListGrp> classIds = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.classId)).Select(b => b.schedule.classId).Contains(n.id)).ToList();
                         List<GroupListGrp> classIds = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.classId)).Select(b => b.schedule.classId).Contains(n.id)).ToList();
                         List<GroupListGrp> stulists = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.stulist)).Select(b => b.schedule.stulist).Contains(n.id)).ToList();
                         List<GroupListGrp> stulists = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.stulist)).Select(b => b.schedule.stulist).Contains(n.id)).ToList();
                         if (classIds == null)
                         if (classIds == null)
@@ -534,7 +540,7 @@ namespace TEAMModelOS.Controllers
         /// <param name="json"></param>
         /// <param name="json"></param>
         /// <returns></returns>
         /// <returns></returns>
         [ProducesDefaultResponseType]
         [ProducesDefaultResponseType]
-       
+
         [HttpPost("get-members-listids")]
         [HttpPost("get-members-listids")]
 #if !DEBUG
 #if !DEBUG
         [AuthToken(Roles = "teacher,admin,student")]
         [AuthToken(Roles = "teacher,admin,student")]
@@ -835,7 +841,7 @@ namespace TEAMModelOS.Controllers
 #if !DEBUG
 #if !DEBUG
  [Authorize(Roles = "IES")]
  [Authorize(Roles = "IES")]
 #endif
 #endif
-        public async Task<IActionResult> UpsertGroupList(JsonElement  json)
+        public async Task<IActionResult> UpsertGroupList(JsonElement json)
         {
         {
 
 
             GroupList list = json.ToObject<GroupList>();
             GroupList list = json.ToObject<GroupList>();
@@ -848,7 +854,7 @@ namespace TEAMModelOS.Controllers
                 }
                 }
                 list.year = list.year > 0 ? list.year : DateTimeOffset.UtcNow.Year;
                 list.year = list.year > 0 ? list.year : DateTimeOffset.UtcNow.Year;
                 list.ttl = -1;
                 list.ttl = -1;
-                
+
                 list.creatorId = userid;
                 list.creatorId = userid;
                 list.school = string.IsNullOrEmpty(list.school) ? school : list.school;
                 list.school = string.IsNullOrEmpty(list.school) ? school : list.school;
                 list.pk = "GroupList";
                 list.pk = "GroupList";
@@ -856,44 +862,49 @@ namespace TEAMModelOS.Controllers
                 {
                 {
                     //私人名单
                     //私人名单
                     list.code = "GroupList";
                     list.code = "GroupList";
+                    list.school = null;
                     //只有开启审核,且设置天数大于零,且之前没有设置过期时间的时候才会重新设置过期时间。
                     //只有开启审核,且设置天数大于零,且之前没有设置过期时间的时候才会重新设置过期时间。
+                    GroupList dblist = null;
+                    if (!string.IsNullOrWhiteSpace(list.id))
+                    {
+                        var response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemStreamAsync(list.id, new PartitionKey(list.code));
+                        if (response.Status==200)
+                        {
+                            dblist = JsonDocument.Parse(response.Content).RootElement.ToObject<GroupList>();
+
+                        }
+                    }
                     if (list.review==1)
                     if (list.review==1)
                     {
                     {
                         if (list.qrcodeDays>0)
                         if (list.qrcodeDays>0)
                         {
                         {
-                            GroupList dblist = null;
-                            if (!string.IsNullOrWhiteSpace(list.id))
-                            {
-                                var response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemStreamAsync(list.id, new PartitionKey(list.code));
-                                if (response.Status==200)
-                                {
-                                    dblist = JsonDocument.Parse(response.Content).RootElement.ToObject<GroupList>();
-                                  
-                                }
-                            }
+                            
                             if (dblist!=null)
                             if (dblist!=null)
                             {
                             {
                                 //更新过期时间
                                 //更新过期时间
                                 if (dblist.qrcodeDays!=list.qrcodeDays)
                                 if (dblist.qrcodeDays!=list.qrcodeDays)
                                 {
                                 {
                                     list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
                                     list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
-                                    string key = $"GroupList:Waitinglist:{list.scope}:{list.id}";
+                                    string key = $"GroupList:GroupWaitingList:{list.scope}:{list.id}";
                                     await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(list.qrcodeExpire).UtcDateTime);
                                     await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(list.qrcodeExpire).UtcDateTime);
                                 }
                                 }
-                                else {
+                                else
+                                {
                                     //相同
                                     //相同
                                     if (dblist.review==0  && list.review==1)
                                     if (dblist.review==0  && list.review==1)
                                     {
                                     {
                                         list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
                                         list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
-                                        string key = $"GroupList:Waitinglist:{list.scope}:{list.id}";
+                                        string key = $"GroupList:GroupWaitingList:{list.scope}:{list.id}";
                                         await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(list.qrcodeExpire).UtcDateTime);
                                         await _azureRedis.GetRedisClient(8).KeyExpireAsync(key, expiry: DateTimeOffset.FromUnixTimeMilliseconds(list.qrcodeExpire).UtcDateTime);
                                     }
                                     }
-                                    else {
+                                    else
+                                    {
                                         list.qrcodeExpire=dblist.qrcodeExpire;
                                         list.qrcodeExpire=dblist.qrcodeExpire;
                                     }
                                     }
                                 }
                                 }
                             }
                             }
-                            else {
+                            else
+                            {
                                 if (list.qrcodeExpire<=0)
                                 if (list.qrcodeExpire<=0)
                                 {
                                 {
                                     list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
                                     list.qrcodeExpire= DateTimeOffset.UtcNow.AddDays(list.qrcodeDays).ToUnixTimeMilliseconds();
@@ -907,10 +918,76 @@ namespace TEAMModelOS.Controllers
                     }
                     }
                     else
                     else
                     {
                     {
-                        list.qrcodeDays = 1;
-                        list.qrcodeExpire = 0;
+                        if (dblist!=null  && dblist.review==1) {
+                            list.qrcodeDays = 1;
+                            list.qrcodeExpire = 0;
+                            string key = $"GroupList:GroupWaitingList:{list.scope}:{list.id}";
+                            var datas = await _azureRedis.GetRedisClient(8).HashGetAllAsync(key);
+                            List<GroupWaitingList> groupWaitingLists = new List<GroupWaitingList>();
+                            foreach (var rcd in datas)
+                            {
+                                var value = rcd.Value.ToString().ToObject<GroupWaitingList>();
+                                if (value!=null) { groupWaitingLists.Add(value); }
+                            }
+                            if (groupWaitingLists.IsNotEmpty()) {
+                                var takeCount = list.limitCount-dblist.members.Count;
+                                if (takeCount>0)
+                                {
+                                    var takes = groupWaitingLists.OrderBy(x => x.applyTime).Take(takeCount);
+                                    if (takes!=null  && takes.Count()>0)
+                                    {
+                                        foreach (var t in takes)
+                                        {
+                                            GroupListService.JoinList(list, t.userid, t.type, t.school, t.year);
+                                            string stuKey = !string.IsNullOrWhiteSpace(school) ? $"GroupList:StudentWaitinglist:{school}_{t.userid}" : $"GroupList:StudentWaitinglist:{t.userid}";
+                                            string sutFiled = $"{list.scope}:{list.id}";
+                                            var data = await _azureRedis.GetRedisClient(8).HashGetAsync(stuKey, sutFiled);
+                                            if (data != default && !data.IsNullOrEmpty)
+                                            {
+                                                var value = data.ToString().ToObject<GroupWaitingList>();
+                                                value.status=0;
+                                                await _azureRedis.GetRedisClient(8).HashSetAsync(stuKey, sutFiled, value.ToJsonString());
+                                            }
+                                        }
+                                        //未自动加入的,直接拒绝
+                                        var untakes = groupWaitingLists.Except(takes);
+                                        if (untakes!=null  && untakes.Count()>0)
+                                        {
+                                            foreach (var t in takes)
+                                            {
+                                                string stuKey = !string.IsNullOrWhiteSpace(school) ? $"GroupList:StudentWaitinglist:{school}_{t.userid}" : $"GroupList:StudentWaitinglist:{t.userid}";
+                                                string sutFiled = $"{list.scope}:{list.id}";
+                                                var data = await _azureRedis.GetRedisClient(8).HashGetAsync(stuKey, sutFiled);
+                                                if (data != default && !data.IsNullOrEmpty)
+                                                {
+                                                    var value = data.ToString().ToObject<GroupWaitingList>();
+                                                    value.status=1;
+                                                    await _azureRedis.GetRedisClient(8).HashSetAsync(stuKey, sutFiled, value.ToJsonString());
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    //已经加满,删除候选
+                                    foreach (var t in groupWaitingLists)
+                                    {
+                                        string stuKey = !string.IsNullOrWhiteSpace(school) ? $"GroupList:StudentWaitinglist:{school}_{t.userid}" : $"GroupList:StudentWaitinglist:{t.userid}";
+                                        string sutFiled = $"{list.scope}:{list.id}";
+                                        var data = await _azureRedis.GetRedisClient(8).HashGetAsync(stuKey, sutFiled);
+                                        if (data != default && !data.IsNullOrEmpty)
+                                        {
+                                            var value = data.ToString().ToObject<GroupWaitingList>();
+                                            value.status=1;
+                                            await _azureRedis.GetRedisClient(8).HashSetAsync(stuKey, sutFiled, value.ToJsonString());
+                                        }
+                                    }
+                                }
+                            }
+                            await _azureRedis.GetRedisClient(8).KeyDeleteAsync(key);
+                        }
                     }
                     }
-                    list.school = null;
                 }
                 }
                 else
                 else
                 {
                 {
@@ -974,7 +1051,7 @@ namespace TEAMModelOS.Controllers
                 if (!json.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
                 if (!json.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
                 if (!json.TryGetProperty("id", out JsonElement id)) return BadRequest();
                 if (!json.TryGetProperty("id", out JsonElement id)) return BadRequest();
                 var client = _azureCosmos.GetCosmosClient();
                 var client = _azureCosmos.GetCosmosClient();
-              
+
                 string tbname = "";
                 string tbname = "";
                 string datacode = "";
                 string datacode = "";
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
@@ -991,7 +1068,7 @@ namespace TEAMModelOS.Controllers
                 {
                 {
                     await GroupListService.DeleteGrouplistEvent($"{id}", datacode, tbname, client, _configuration, _serviceBus);
                     await GroupListService.DeleteGrouplistEvent($"{id}", datacode, tbname, client, _configuration, _serviceBus);
                 }
                 }
-                catch (Exception ex) {  }
+                catch (Exception ex) { }
                 return Ok(new { id });
                 return Ok(new { id });
             }
             }
             catch (Exception ex)
             catch (Exception ex)
@@ -1042,7 +1119,8 @@ namespace TEAMModelOS.Controllers
                         var members = _members.ToObject<List<Member>>();
                         var members = _members.ToObject<List<Member>>();
                         List<Member> updateSuccess = new List<Member>();
                         List<Member> updateSuccess = new List<Member>();
                         List<Member> updateFailed = new List<Member>();
                         List<Member> updateFailed = new List<Member>();
-                        members.ForEach(x => {
+                        members.ForEach(x =>
+                        {
                             var member = groupList.members.Find(z => z.type == x.type && z.id.Equals(x.id));
                             var member = groupList.members.Find(z => z.type == x.type && z.id.Equals(x.id));
                             if (member != null)
                             if (member != null)
                             {
                             {
@@ -1066,5 +1144,41 @@ namespace TEAMModelOS.Controllers
 
 
             return Ok();
             return Ok();
         }
         }
+
+        /// <
+        /// summary>
+        /// 处理名单审核
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "teacher,admin")]
+        [HttpPost("review")]
+#if DEBUG
+        [Authorize(Roles = "IES")]
+#endif
+        public async Task<IActionResult> review(JsonElement request)
+        {
+            (string tmdid, _, _, string school) = HttpContext.GetAuthTokenInfo();
+            if (!request.TryGetProperty("grant_type", out JsonElement grant_type)) return BadRequest();
+          
+            var client = _azureCosmos.GetCosmosClient();
+            switch (true)
+            {
+                //待加入列表
+                case bool when $"{grant_type}".Equals("waitlist", StringComparison.OrdinalIgnoreCase):
+
+                    break;
+                //处理审核
+                case bool when $"{grant_type}".Equals("process", StringComparison.OrdinalIgnoreCase):
+                    await _azureRedis.GetRedisClient(8).KeyExpireTimeAsync("");
+                    break;
+                    //审核结果,学生端获取到被拒绝的,或者过期的自动删除,未被审核的保存
+                case bool when $"{grant_type}".Equals("result", StringComparison.OrdinalIgnoreCase):
+                    break;
+
+            }
+            return Ok();
+        }
     }
     }
 }
 }