소스 검색

T P变更

zhouj1203@hotmail.com 3 년 전
부모
커밋
60fb9078e9
2개의 변경된 파일11개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      TEAMModelFunction/MonitorServicesBus.cs
  2. 10 3
      TEAMModelOS.SDK/Models/Service/LessonService.cs

+ 1 - 1
TEAMModelFunction/MonitorServicesBus.cs

@@ -870,7 +870,7 @@ namespace TEAMModelFunction
                     }
                     //计算课堂更新前后的差值
                     LessonDis lessonDis= LessonService.DisLessonCount(oldlessonRecord, lessonRecord);
-                    await LessonService.FixLessonCount(client, _dingDing, lessonRecord);
+                    await LessonService.FixLessonCount(client, _dingDing, lessonRecord,lessonDis);
                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(lessonRecord,$"{_lessonId}", new PartitionKey(code));
                 }
             }

+ 10 - 3
TEAMModelOS.SDK/Models/Service/LessonService.cs

@@ -73,7 +73,7 @@ namespace TEAMModelOS.SDK.Models.Service
             return lessonDis;
         }
 
-        public static async Task FixLessonCount(CosmosClient client, DingDing _dingDing, LessonRecord data)
+        public static async Task FixLessonCount(CosmosClient client, DingDing _dingDing, LessonRecord data, LessonDis lessonDis)
         {
             try
             {
@@ -85,12 +85,12 @@ namespace TEAMModelOS.SDK.Models.Service
                 string code = string.Empty;
                 if (data.scope.Equals("school"))
                 {
-                    code = $"LessonCount-{data.school}";
+                    code = $"LessonCount-{data.school}-{year}";
                     tbname = "School";
                 }
                 else
                 {
-                    code = $"LessonCount";
+                    code = $"LessonCount-{year}";
                     tbname = "Teacher";
                 }
                 var response = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemStreamAsync(data.id.ToString(), new PartitionKey(code));
@@ -100,11 +100,15 @@ namespace TEAMModelOS.SDK.Models.Service
                     LessonCount count = json.ToObject<LessonCount>();
                     if (count.courseIds.Count > 0)
                     {
+                        count.tCount[day] += lessonDis.disTCount;
+                        count.pCount[day] += lessonDis.disPCount;
+                        count.ptCount[day] += lessonDis.disDCount;
                         if (!count.courseIds.Contains(data.courseId))
                         {
                             count.courseIds.Add(data.courseId);
                             count.beginCount[day] += 1;
                         }
+
                     }
                     await client.GetContainer("TEAMModelOS", tbname).ReplaceItemAsync(count, count.id, new PartitionKey(code));
                 }
@@ -120,6 +124,9 @@ namespace TEAMModelOS.SDK.Models.Service
                     List<double> list = new List<double>(da);
                     list[day] += 1;
                     count.beginCount.AddRange(list);
+                    count.tCount[day] += lessonDis.disTCount;
+                    count.pCount[day] += lessonDis.disPCount;
+                    count.ptCount[day] += lessonDis.disDCount;
                     count.courseIds.Add(data.courseId);
                     await client.GetContainer("TEAMModelOS", "tbname").CreateItemAsync(count, new PartitionKey(code));
                 }