فهرست منبع

update 名称。

CrazyIter_Bin 3 سال پیش
والد
کامیت
a311993729

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

@@ -337,7 +337,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
             await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", new RedisValue(name), new RedisValue($"{blobsize}"));
             long end = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             long dis = (end - statr) / 1000;
-            long timeout = 10;
+            long timeout = 60*5;
             if (dis > timeout)
             {
                 await _dingDing.SendBotMsg($"ServiceBus,RefreshBlob:空间计算已经超过{timeout}秒\n容器名:{name}\n文件夹:{u}\n计算时长:{dis}", GroupNames.醍摩豆服務運維群組);
@@ -524,7 +524,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                     //课程名单变动修改学生课程关联信息
                     await ActivityService.FixStuCourse(client, _dingDing, groupChange);
                     //名单变动修改课例关联信息
-                    await ActivityService.FixLessonRecord(client, _dingDing, groupChange);
+                    //await ActivityService.FixLessonRecord(client, _dingDing, groupChange);
 
                 }
             }
@@ -971,6 +971,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     LessonBase lessonBase = baseblobDownload.Content.ToObjectFromJson<LessonBase>();
                                     if (lessonBase != null  && lessonBase.summary!=null)
                                     {
+                                        lessonRecord.name = lessonBase.summary.activityName;
                                         lessonRecord.attendCount = lessonBase.summary.attendCount;
                                         lessonRecord.clientCount = lessonBase.summary.clientCount;
                                         lessonRecord.attendRate = lessonBase.summary.attendRate;
@@ -1010,7 +1011,6 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                     //await _dingDing.SendBotMsg($"{_option.Location},课堂id:{_lessonId} blob刷新完成!", GroupNames.醍摩豆服務運維群組);
                                     msgs.Add(update);
                                 }
-                                 
                                 catch (Exception ex)
                                 {
                                    // await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}课程读取base.json,{_lessonId}\n{ex.Message}\n{ex.StackTrace}\n{lessonRecord.ToJsonString()}", GroupNames.醍摩豆服務運維群組);

+ 11 - 2
TEAMModelOS/Controllers/Both/CourseController.cs

@@ -313,7 +313,7 @@ namespace TEAMModelOS.Controllers
         {
             if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
             if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
-
+            requert.TryGetProperty("period", out JsonElement _period) ;
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
@@ -340,8 +340,12 @@ namespace TEAMModelOS.Controllers
                 var query = $"select c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c";
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 {
+                    string sql = query;
+                    if (!string.IsNullOrWhiteSpace($"{_period}")) {
+                        sql = $"{sql} where c.period.id ='{_period}'";
+                    }
 
-                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
                     {
                         //continuationToken = item.GetContinuationToken();
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
@@ -374,6 +378,11 @@ namespace TEAMModelOS.Controllers
                     if (requert.TryGetProperty("schoolId", out JsonElement schoolId))
                     {
                         var querySchool = $"select distinct c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c join A0 in c.schedule where A0.teacherId = '{code}'";
+                         
+                        if (!string.IsNullOrWhiteSpace($"{_period}"))
+                        {
+                            querySchool = $"{querySchool}  and  c.period.id ='{_period}'";
+                        }
                         await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: querySchool, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{schoolId.GetString()}") }))
                         {
                             //continuationToken = item.GetContinuationToken();

+ 24 - 25
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -340,32 +340,31 @@ namespace TEAMModelOS.Controllers
             {
                 records.Add(item);
             }
-            if (records.Any()) {
-                var groupIds= records.SelectMany(x => x.groupIds).ToHashSet();
-                if (groupIds.Any()) {
-                    var groups = await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school," c.id ");
-                    //获取已经被删除的名单。
-                    var idsExp =  groupIds.Except(groups.Select(x => x.id));
-                    if (idsExp.Any()) {
-
+            //if (records.Any()) {
+            //    var groupIds= records.SelectMany(x => x.groupIds).ToHashSet();
+            //    if (groupIds.Any()) {
+            //        var groups = await GroupListService.GetGroupListListids(_azureCosmos.GetCosmosClient(), _dingDing, groupIds.ToList(), school," c.id ");
+            //        //获取已经被删除的名单。
+            //        var idsExp =  groupIds.Except(groups.Select(x => x.id));
+            //        if (idsExp.Any()) {
                    
-                        foreach(var item in records)
-                        {
-                            int countRmv = item.groupIds.RemoveAll(x => idsExp.Contains(x));
-                            if (countRmv > 0)
-                            {
-                                try {
-                                    LessonRecord record = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>(item.id, new PartitionKey(code));
-                                    record.groupIds = item.groupIds;
-                                    await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(record, item.id, new PartitionKey(code));
-                                } catch (CosmosException ex) when (ex.Status == 404) {
-                                    continue;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
+            //            foreach(var item in records)
+            //            {
+            //                int countRmv = item.groupIds.RemoveAll(x => idsExp.Contains(x));
+            //                if (countRmv > 0)
+            //                {
+            //                    try {
+            //                        LessonRecord record = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>(item.id, new PartitionKey(code));
+            //                        record.groupIds = item.groupIds;
+            //                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(record, item.id, new PartitionKey(code));
+            //                    } catch (CosmosException ex) when (ex.Status == 404) {
+            //                        continue;
+            //                    }
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
             count = records.Count;
             return Ok(new { count=count, records });
         }

+ 5 - 0
TEAMModelOS/Controllers/Client/HiTeachController.cs

@@ -81,6 +81,7 @@ namespace TEAMModelOS.Controllers.Client
             var client = _azureCosmos.GetCosmosClient();
             if (!request.TryGetProperty("lesson_id", out JsonElement _lessonId)) return BadRequest();
             if (!request.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
+            request.TryGetProperty("name", out JsonElement name);
             request.TryGetProperty("school", out JsonElement _school);
             if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
             request.TryGetProperty("grant_types", out JsonElement _grant_types);
@@ -111,6 +112,10 @@ namespace TEAMModelOS.Controllers.Client
                         updates.Add(new LessonUpdate { grant_type = "up-base" });
                     }
                 }
+                if (!string.IsNullOrWhiteSpace($"{name}")) {
+                    lessonRecord.name = $"{name}";
+                    await client.GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(lessonRecord, $"{_lessonId}", new PartitionKey(code));
+                }
                 var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
                 string msg = null;
                 msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();