Explorar o código

优化互动信息

Li %!s(int64=2) %!d(string=hai) anos
pai
achega
00ff2db914

+ 2 - 1
TEAMModelOS.SDK/Models/Service/BIStatsWay/LessonRecordStatsWay.cs

@@ -46,7 +46,7 @@ namespace TEAMModelOS.SDK.Models.Service.BIStatsWay
             lessStats.less = await JointlySingleQuery.GetValueInt(cosmosClient, "School", $"{currSql} and c.upload = 1", $"LessonRecord-{id}");
 
             List<LessRelStats> lessRelStats = new();
-            string sql = $"select c.id,c.code,c.startTime,c.clientInteractionCount from c where c.pk='LessonRecord' and c.startTime >= {lastYearS} and c.startTime <= {yearE}";
+            string sql = $"select c.id,c.code,c.startTime,c.clientInteractionCount from c where c.pk='LessonRecord' and c.startTime >= {yearS} and c.startTime <= {yearE}";
             await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<LessRelStats>(queryText: sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{id}") }))
             {
                 lessRelStats.Add(item);
@@ -64,6 +64,7 @@ namespace TEAMModelOS.SDK.Models.Service.BIStatsWay
             lessStats.lastMonthInter = lessRelStats.FindAll(f => f.startTime >= lastMthS && f.startTime <= LastmthE).ToList().Select(s => s.clientInteractionCount).Sum();
             lessStats.monthInter = lessRelStats.FindAll(f => f.startTime >= mthS && f.startTime <= mthE).ToList().Select(s => s.clientInteractionCount).Sum();
             //lessStats.lastYearInter = lessRelStats.FindAll(f => f.startTime >= lastYearS && f.startTime <= lastYearE).ToList().Select(s => s.clientInteractionCount).Sum();
+            lessStats.lastYearInter = await JointlySingleQuery.GetValueInt(cosmosClient, "School", $"select value(sum(c.clientInteractionCount)) from c where c.startTime >= {lastYearS} and c.startTime <= {lastYearE}", $"LessonRecord-{id}");
             lessStats.yearInter = lessRelStats.FindAll(f => f.startTime >= yearS && f.startTime <= yearE).ToList().Select(s => s.clientInteractionCount).Sum();
 
             DateTimeOffset lyearDay = new(DateTimeOffset.UtcNow.Year - 1, DateTimeOffset.UtcNow.Month, DateTimeOffset.UtcNow.Day, DateTimeOffset.UtcNow.Hour, DateTimeOffset.UtcNow.Minute, DateTimeOffset.UtcNow.Second, TimeSpan.Zero);