CrazyIter_Bin 3 éve
szülő
commit
4d904b19a4

+ 7 - 7
TEAMModelOS.SDK/Models/Service/StuListService.cs

@@ -21,7 +21,7 @@ namespace TEAMModelFunction
             try
             {
                 var query = $"SELECT distinct c.owner, c.id,c.code, c.classes,c.subjects,c.progress,c.scope,c.startTime,c.school,c.creatorId,c.name,c.pk ,c.endTime   FROM c  where  c.pk='{type}' " +
-                    $" and ( array_contains(c.classes,'{stuListChange.listid}') or ( array_contains(c.teachclasses,'{stuListChange.listid}') )";
+                    $" and (( array_contains(c.classes,'{stuListChange.listid}')) or ( array_contains(c.teachclasses,'{stuListChange.listid}')))";
                     //$"and A1 in('{stuListChange.listid}') ";
                 List<MQActivity> datas = new List<MQActivity>();
                 if (stuListChange.scope.Equals("school", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(stuListChange.school)) {
@@ -40,7 +40,7 @@ namespace TEAMModelFunction
                     foreach (var techer in teachers) {
                         var queryTech = $"SELECT distinct c.owner, c.id,c.code, c.classes,c.subjects,c.progress,c.scope,c.startTime,c.school,c.creatorId,c.name,c.pk ,c.endTime   FROM c " +
                             $" where c.school='{stuListChange.school}'   and   c.pk='{type}'" +
-                            $" and ( array_contains(c.classes,'{stuListChange.listid}') or ( array_contains(c.teachclasses,'{stuListChange.listid}') )";
+                            $" and (( array_contains(c.classes,'{stuListChange.listid}')) or ( array_contains(c.teachclasses,'{stuListChange.listid}')))";
                       //  $" and A1 in('{stuListChange.listid}') ";
                         await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<MQActivity>(queryText: queryTech,
                             requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"{type}-{techer.id}") }))
@@ -57,7 +57,7 @@ namespace TEAMModelFunction
                         datas.Add(item);
                     }
                 }
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-StuListService-FixActivity\n名单发生变更 需要处理的活动\n{datas.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-StuListService-FixActivity\n名单发生变更:涉及活动类型变更的 \n{datas.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
                 foreach (MQActivity activity in datas)
                 {
                     //已经完结的不再允许加入
@@ -73,7 +73,7 @@ namespace TEAMModelFunction
                             id = activity.id,
                             scode = activity.code,
                             name = activity.name,
-                            code = $"Activity-{activity.school}-{students.id}",
+                            code = $"Activity-{students.code.Replace("Base-","")}-{students.id}",
                             scope = activity.scope,
                             school = activity.school,
                             creatorId = activity.creatorId,
@@ -115,7 +115,7 @@ namespace TEAMModelFunction
                         try
                         {
 
-                            await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{activity.school}-{students.id}"));
+                            await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{students.code.Replace("Base-", "")}-{students.id}"));
                         }
                         catch (CosmosException ex)
                         {
@@ -174,7 +174,7 @@ namespace TEAMModelFunction
                         id = course.id,
                         scode = course.code,
                         name = course.name,
-                        code = $"StuCourse-{course.school}-{students.id}",
+                        code = $"StuCourse-{students.code.Replace("Base-", "")}-{students.id}",
                         scope = course.scope,
                         school = course.school,
                         creatorId = course.creatorId,
@@ -203,7 +203,7 @@ namespace TEAMModelFunction
                 //移除名单的。 在点击相关的课程,再去二次校验是否存在,不存在则再去删除。
                 foreach (var delStu in stuListChange.stuleave)
                 {
-                    await client.GetContainer("TEAMModelOS", "Student").DeleteItemStreamAsync(course.id, new PartitionKey($"Course-{course.school}-{delStu.id}"));
+                    await client.GetContainer("TEAMModelOS", "Student").DeleteItemStreamAsync(course.id, new PartitionKey($"Course-{delStu.code.Replace("Base-", "")}-{delStu.id}"));
                 }
                 foreach (var delTmd in stuListChange.tmdhleave)
                 {

+ 14 - 14
TEAMModelOS.SDK/Models/Service/TriggerStuActivity.cs

@@ -128,21 +128,21 @@ namespace TEAMModelFunction
 
                             classInfos.Add(item);
                         }
-                        //await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
-                        //  requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
-                        //{
-                        //    item.from = "SchStuList";
-                        //    classInfos.Add(item);
-                        //}
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                          requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
+                        {
+                            //item.from = "SchStuList";
+                            classInfos.Add(item);
+                        }
                     }
-                    //List<StuList> tchLists = new List<StuList>();
-                    //await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassListInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
-                    //    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
-                    //{
-                    //    item.from = "TchStuList";
-                    //    classInfos.Add(item);
-                    //}
-                   
+                    List<StuList> tchLists = new List<StuList>();
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                        requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
+                    {
+                       // item.from = "TchStuList";
+                        classInfos.Add(item);
+                    }
+
                 }
                 return classInfos;
             } catch (Exception ex) {

+ 1 - 1
TEAMModelOS/Controllers/School/CourseController.cs

@@ -55,7 +55,7 @@ namespace TEAMModelOS.Controllers
         /// <param name="request"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "Teacher")]
+        [AuthToken(Roles = "teacher")]
         [HttpPost("upsert")]
         public async Task<IActionResult> upsert(JsonElement requert)
         {

+ 2 - 2
TEAMModelOS/Controllers/Syllabus/FavoriteController.cs

@@ -43,7 +43,7 @@ namespace TEAMModelOS.Controllers
         /// <returns></returns>
         [ProducesDefaultResponseType]
         [HttpPost("upsert")]
-        [AuthToken(Roles = "Teacher")]
+        [AuthToken(Roles = "teacher")]
         public async Task<IActionResult> Upsert(Favorite request)
         {
             try
@@ -88,7 +88,7 @@ namespace TEAMModelOS.Controllers
         /// <param name="requert"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [AuthToken(Roles = "Teacher")]
+        [AuthToken(Roles = "teacher")]
         [HttpPost("find")]
         public async Task<IActionResult> Find(JsonElement request)
         {

+ 0 - 1
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -66,7 +66,6 @@ namespace TEAMModelOS.Controllers
                 string defaultschool = null;
                 //TODO 取得Teacher 個人相關數據(課程清單、虛擬教室清單、歷史紀錄清單等),學校數據另外API處理,多校切換時不同
                 var client = _azureCosmos.GetCosmosClient();
-                
                 int total = 0;
                 int tsize = 0;
                 try {