CrazyIter_Bin 3 lat temu
rodzic
commit
319f825e1b

+ 30 - 3
TEAMModelOS.FunctionV4/CosmosDB/TriggerHomework.cs

@@ -100,6 +100,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 addTmdidsCls.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) && y.type == 1)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tmdActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -118,7 +127,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = work.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
                             }
@@ -126,6 +135,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 addStudentsCls.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) &&y.code.Equals(work.school) && y.type ==2)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     stuActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -144,7 +162,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = work.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
                             }
@@ -162,6 +180,15 @@ namespace TEAMModelOS.FunctionV4
                                 }
                                 tchList.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classInfos.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) && y.type == 1)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tchActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -180,7 +207,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = work.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = work.tchLists
+                                        classIds = classIds.ToList()
                                     });
                                      
                                 });

+ 30 - 3
TEAMModelOS.FunctionV4/CosmosDB/TriggerVote.cs

@@ -115,6 +115,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 tmds.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) && y.type == 1)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tmdActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -133,7 +142,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = vote.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
                             }
@@ -141,6 +150,15 @@ namespace TEAMModelOS.FunctionV4
                             {
                                 addStudentsCls.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classLists.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) && y.code.Equals(vote.school) && y.type == 2)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     stuActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -159,7 +177,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = vote.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
                             }
@@ -177,6 +195,15 @@ namespace TEAMModelOS.FunctionV4
                                 }
                                 tchList.ForEach(x =>
                                 {
+                                    HashSet<string> classIds = new HashSet<string>();
+                                    classInfos.ForEach(z => {
+                                        z.members.ForEach(y => {
+                                            if (y.id.Equals(x) && y.type == 1)
+                                            {
+                                                classIds.Add(z.id);
+                                            }
+                                        });
+                                    });
                                     tchActivities.Add(new StuActivity
                                     {
                                         pk = "Activity",
@@ -195,7 +222,7 @@ namespace TEAMModelOS.FunctionV4
                                         owner = vote.owner,
                                         createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                         taskStatus = -1,
-                                        classIds = classes
+                                        classIds = classIds.ToList()
                                     });
                                 });
 

+ 1 - 0
TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs

@@ -118,6 +118,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
                             if (schools.IsNotEmpty())
                             {
+                                schools.ForEach(x => { x.ProjectID = int.Parse(ps.pd); x.ProjectItemID = int.Parse(ps.pid); });
                                 scSchools.AddRange(schools);
                             }
                         }

+ 2 - 0
TEAMModelOS.SDK/Models/Service/Third/Sc/ScYxptModel.cs

@@ -73,6 +73,8 @@ namespace TEAMModelOS.SDK.Models
         public string dist { get; set; }
         public string city { get; set; }
         public string areaId { get; set; }
+        public int ProjectID { get; set; }
+        public int ProjectItemID { get; set; }
     }
 
     [TableName(Name = "ScYxpt")]

+ 3 - 0
TEAMModelOS/Controllers/Third/ScController.cs

@@ -250,6 +250,7 @@ namespace TEAMModelOS.Controllers
             if (!request.TryGetProperty("standard", out JsonElement standard)) return BadRequest();
             List<IdNameCode> ignore = ignoreSchools.ToObject<List<IdNameCode>>();
             Dictionary<string, object> dict = new Dictionary<string, object> { { "accessConfig", $"{accessConfig}" },{ "areaId",$"{areaId}" } };
+           
             int status = -1;string json = null;
             //5.3.1.1获取项目列表
             (status,   json) = await _httpTrigger.RequestHttpTrigger(dict, _option.Location, "GetProjectInfoByTrainComID");
@@ -333,6 +334,7 @@ namespace TEAMModelOS.Controllers
                         var schoolData = schoolDatas.Find(y => y.uid.Equals($"{x.schoolid}"));
                         if (schoolData != null && !string.IsNullOrEmpty(schoolData.id))
                         {
+                           
                             x.schoolCode = schoolData.id;
                             x.areaId = $"{areaId}";
                             x.city = $"{city}";
@@ -374,6 +376,7 @@ namespace TEAMModelOS.Controllers
                             x.areaId = $"{areaId}";
                             x.city = $"{city}";
                             x.dist = $"{dist}";
+                          
                         }
                     });
 

+ 15 - 0
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -1278,5 +1278,20 @@ namespace TEAMModelOS.Controllers
             List<string> infos = await FixDataService.FixExamPublish(client, data);
             return Ok(new { infos });
         }
+        /// <summary>
+        /// 修复评测publish字段内容
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "teacher")]
+        [HttpPost("fix-scapi-data")]
+        public async Task<IActionResult> FixScApiData(JsonElement data)
+        {
+            await  _azureStorage.FindListByDict<ScSchool>(new Dictionary<string, object> { { "PartitionKey", "ScSchool" }  });
+            
+            return Ok(new {  });
+        }
     }
 }