CrazyIter_Bin пре 2 година
родитељ
комит
fb0d0b05c3

+ 14 - 1
TEAMModelOS.FunctionV4/HttpTrigger/IESHttpTrigger.cs

@@ -146,7 +146,20 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             //同步知识块。
                             if (old != null)
                             {
+                                //如果之前的是1 来源于区级,后面因区级删除,应该还原为0。
+                                var oldBlocks = old.blocks.Select(x => x.name).ToHashSet() ;
+                                var dimBlocks = dim.SelectMany(d => d.blocks);
+                                //增加的
+                                var addBlocks = dimBlocks.Except(oldBlocks);
+                                //减少的
+                                var cutBlocks = oldBlocks.Except(dimBlocks);
+                                foreach (var add in addBlocks) {
+                                    old.blocks.Add(new Block { name = add,source = 1 });
+                                }
+                                //减少的还原为0
+                                old.blocks.ForEach(ob => { 
                                 
+                                });
                             }
                             else { 
                                 
@@ -171,7 +184,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                 string data = await new StreamReader(req.Body).ReadToEndAsync();
                  var  json = JsonDocument.Parse(data).RootElement;
                 jsondata = json;
-              await  _dingDing.SendBotMsg( "毕业状态变更:"+json.ToJsonString(), GroupNames.成都开发測試群組);
+                //await  _dingDing.SendBotMsg( "毕业状态变更:"+json.ToJsonString(), GroupNames.成都开发測試群組);
                 string schoolId = null;
                 if (json.TryGetProperty("schoolId", out JsonElement _schoolId))
                 {

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/School/Knowledge.cs

@@ -48,6 +48,10 @@ namespace TEAMModelOS.SDK.Models
     }
     public class Block { 
         public string name { get; set; }
+        /// <summary>
+        /// 默认学校添加的 0,  1,区级统一设置的(学校不能删除,不能编辑)。
+        /// </summary>
+        public int source { get; set; } = 0;
         public List<string> points { get; set; }
     }
     /*

+ 23 - 2
TEAMModelOS.SDK/Models/Service/SchoolService.cs

@@ -41,6 +41,9 @@ namespace TEAMModelOS.SDK
                  (queryText: sql,
                 requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school_base.id}") }))
             {
+                if ("7974c5b5-1e7e-41b1-9ff1-86fdec5ef050".Equals(item.id)) {
+                    int a = 0;
+                }
                 bool isgraduate = false;
                 if (!string.IsNullOrWhiteSpace(item.periodId))
                 {
@@ -49,17 +52,35 @@ namespace TEAMModelOS.SDK
                     {
                         var gradeCount = period.grades.Count();
                         //2022-2016=6(待判断月份日期是否是毕业)  2022-2017=5(未毕业)
-                        if (nowYear - item.year >= gradeCount)
+                        if (nowYear - item.year > gradeCount)
+                        {
+                            isgraduate = true;
+                        }
+                        else if (nowYear - item.year == gradeCount)
                         {
                             var semester = period.semesters.Find(x => x.start == 1);
                             if (semester != null)
                             {
-                                if (nowMonth > semester.month && nowDay > semester.day)
+                                if (nowMonth > semester.month)
                                 {
                                     isgraduate = true;
                                 }
+                                else if (nowMonth == semester.month)
+                                {
+                                    if (nowDay >= semester.day)
+                                    {
+                                        isgraduate = true;
+                                    }
+                                    else
+                                    {
+                                    }
+                                }
+                                else { isgraduate = false; }
                             }
                         }
+                        else {
+                            isgraduate =false;
+                        }
                     }
                 }
                 if (isgraduate)