Browse Source

1、编写通知接口, 2、处理身份统计的问题查询,3、处理资源统计的问题。

Li 2 years ago
parent
commit
31cbda7cba

+ 270 - 0
TEAMModelBI/Controllers/BICommon/BINoticeController.cs

@@ -0,0 +1,270 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Options;
+using System.Net.Http;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK;
+using TEAMModelOS.Models;
+using System.Text.Json;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Constant;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Extension;
+using TEAMModelBI.Models;
+using System.Linq;
+using TEAMModelBI.Filter;
+using TEAMModelOS.SDK.Models.Cosmos.BI;
+using Azure.Cosmos;
+using System;
+using TEAMModelOS.SDK.Models.Service.BI;
+using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
+using TEAMModelBI.Tool.Extension;
+using TEAMModelOS.SDK.Models;
+using DocumentFormat.OpenXml.Spreadsheet;
+using System.Net.Http.Json;
+
+namespace TEAMModelBI.Controllers.BICommon
+{
+    [Route("notice")]
+    [ApiController]
+    public class BINoticeController : ControllerBase
+    {
+        private readonly AzureCosmosFactory _azureCosmos;
+        private readonly DingDing _dingDing;
+        private readonly Option _option;
+        private readonly AzureStorageFactory _azureStorage;
+        private readonly IConfiguration _configuration;
+        private readonly AzureServiceBusFactory _serviceBus;
+        private readonly IHttpClientFactory _http;
+        private readonly CoreAPIHttpService _coreAPIHttpService;
+        private readonly IWebHostEnvironment _environment; //读取文件
+        private readonly HttpClient _httpClient;
+
+        public BINoticeController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment, HttpClient httpClient)
+        {
+            _azureCosmos = azureCosmos;
+            _dingDing = dingDing;
+            _azureStorage = azureStorage;
+            _option = option?.Value;
+            _configuration = configuration;
+            _serviceBus = serviceBus;
+            _http = http;
+            _coreAPIHttpService = coreAPIHttpService;
+            _environment = hostingEnvironment;
+            _httpClient = httpClient;
+        }
+
+        /// <summary>
+        /// 查询账户信息
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [AuthToken(Roles = "admin,rdc,assist,sales")]
+        [HttpPost("get-info")]
+        public async Task<IActionResult> GetInfo(JsonElement jsonElement)
+        {
+            jsonElement.TryGetProperty("ids", out JsonElement _ids);
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            List<string> ids = new();
+            ids = _ids.ToObject<List<string>>();
+            List<TmdUserinfo> userinfos = new();
+            List<string> noFound = new();
+            if (ids.Count > 0)
+            {
+                var content = new StringContent(ids.ToArray().ToJsonString(), Encoding.UTF8, "application/json");
+                string idJson = await _coreAPIHttpService.GetUserInfos(content);
+                userinfos = idJson.ToObject<List<TmdUserinfo>>();
+
+                foreach (var item in ids)
+                {
+                    var tempId = userinfos.Where(s => s.id.Equals(item)).ToList();
+                    var tempMail = userinfos.Where(s => !string.IsNullOrEmpty($"{s.mail}") && s.mail.Equals(item)).ToList();
+                    var tempmobile = userinfos.Where(s => !string.IsNullOrEmpty($"{s.mobile}") && s.mobile.Equals(item)).ToList();
+                    if (tempId.Count == 0 && tempMail.Count == 0 && tempmobile.Count == 0)
+                        noFound.Add(item);
+                }
+            }
+
+            return Ok(new { state = RespondCode.Ok, userinfos, noFound });
+        }
+
+        /// <summary>
+        /// 依据学校id查询学校教师信息
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        //[AuthToken(Roles = "admin,rdc,assist,sales")]
+        [HttpPost("get-tchinfos")]
+        public async Task<IActionResult> GetSchoolTeacher(JsonElement jsonElement)
+        {
+            if (!jsonElement.TryGetProperty("scId", out JsonElement scId)) return BadRequest();
+
+            List<IdInfo> idInfos = new();
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+
+            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS,"School").GetItemQueryIterator<IdInfo>(queryText: "select c.id,c.name,c.picture from c",requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{scId}") }))
+            {
+                idInfos.Add(item);
+            }
+
+            return Ok(new { state = RespondCode.Ok, idInfos });
+        }
+
+        /// <summary>
+        /// BI发布端外消息
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [AuthToken(Roles = "admin,rdc,assist,sales")]
+        [HttpPost("push-info")]
+        public async Task<IActionResult> PushNotion(JsonElement jsonElement) 
+        {
+            try
+            {
+                var (_tmdId, _tmdName, _, _, _, _) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
+
+                jsonElement.TryGetProperty("type", out JsonElement type);
+                jsonElement.TryGetProperty("jumpUrl", out JsonElement jumpUrl);
+                jsonElement.TryGetProperty("callbackUrl", out JsonElement callbackUrl);
+                if (!jsonElement.TryGetProperty("theme", out JsonElement theme)) return BadRequest();
+                if (!jsonElement.TryGetProperty("content", out JsonElement content)) return BadRequest();
+                jsonElement.TryGetProperty("tmdIds", out JsonElement _tmdIds);
+                jsonElement.TryGetProperty("schoolIds", out JsonElement _schoolIds);
+                jsonElement.TryGetProperty("areaIds", out JsonElement _areaIds);
+                if (!jsonElement.TryGetProperty("crowdType", out JsonElement _crowdType)) return BadRequest();
+                jsonElement.TryGetProperty("sendTime", out JsonElement sendTime);
+                jsonElement.TryGetProperty("source", out JsonElement source);
+
+                var cosmosClient = _azureCosmos.GetCosmosClient();
+                DateTimeOffset dateTime = DateTimeOffset.UtcNow;
+
+                List<IdNameCode> idNameCodes = new();
+                BINotice bINotice = new();
+                List<string> tmdIds = new();
+                List<string> schoolIds = new();
+                List<string> areaIds = new();
+
+                if (!string.IsNullOrEmpty($"{sendTime}"))
+                    dateTime = DateTimeOffset.Parse($"{sendTime}");
+                if (string.IsNullOrEmpty($"{_tmdIds}") && string.IsNullOrEmpty($"{_schoolIds}") && string.IsNullOrEmpty($"{_areaIds}"))
+                    return Ok(new { state = RespondCode.ParamsError, msg = "发送人群不能为空" });
+                if (!string.IsNullOrEmpty($"{_tmdIds}"))
+                    tmdIds = _tmdIds.ToObject<List<string>>();
+                if (!string.IsNullOrEmpty($"{_schoolIds}"))
+                    schoolIds = _schoolIds.ToObject<List<string>>();
+                if (!string.IsNullOrEmpty($"{_areaIds}"))
+                    areaIds = _areaIds.ToObject<List<string>>();
+
+                Crowd crowd = new()
+                {
+                    tmdIds = tmdIds.Count > 0 ? tmdIds : new List<string>(),
+                    schoolIds = schoolIds.Count > 0 ? schoolIds : new List<string>(),
+                    areaIds = areaIds.Count > 0 ? areaIds : new List<string>(),
+                    type = $"{_crowdType}"
+                };
+
+                if (tmdIds.Count > 0)
+                {
+                    StringBuilder tchSql = new($"select c.id, c.name,c.code,c.picture,c.nickname from c ");
+                    if (tmdIds.Count > 0)
+                    {
+                        tchSql.Append(BICommonWay.ManyScSql(" where c.id ", tmdIds));
+                        await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<IdNameCode>(queryText: tchSql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
+                        {
+                            var tempId = idNameCodes.FindAll(fa => fa.id.Equals(item)).ToList();
+                            if (tempId.Count == 0)
+                                idNameCodes.Add(item);
+                        }
+                    }
+                }
+
+                if (areaIds.Count > 0)
+                {
+                    StringBuilder scAreaSql = new($"select value(c.id) from c");
+                    if (schoolIds.Count > 0)
+                    {
+                        scAreaSql.Append(BICommonWay.ManyScSql(" where c.areaId", areaIds));
+                        await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<string>(queryText: scAreaSql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
+                        {
+                            var tempScId = schoolIds.FindAll(fa => fa.Equals(item)).ToList();
+                            if (tempScId.Count == 0)
+                                schoolIds.Add(item);
+                        }
+                    }
+                }
+
+                if (schoolIds.Count > 0)
+                {
+                    StringBuilder scTchSql = new($"select c.id, c.name, c.picture,c.nickname from c where c.pk='Teacher'");
+                    if (schoolIds.Count > 0)
+                    {
+                        scTchSql.Append(BICommonWay.ManyScSql(" and c.code", schoolIds, $"Teacher-"));
+                        await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<IdNameCode>(queryText: scTchSql.ToString(), requestOptions: new QueryRequestOptions() { }))
+                        {
+                            var tempId = idNameCodes.FindAll(fa => fa.id.Equals(item)).ToList();
+                            if (tempId.Count == 0)
+                                idNameCodes.Add(item);
+                        }
+                    }
+                }
+
+                bINotice = new()
+                {
+                    id = Guid.NewGuid().ToString(),
+                    code = "BINotice",
+                    type = !string.IsNullOrEmpty($"{type}") ? type.GetInt32() : 0,
+                    jumpUrl = !string.IsNullOrEmpty($"{jumpUrl}") ? $"{jumpUrl}" : "",
+                    callbackUrl = !string.IsNullOrEmpty($"{callbackUrl}") ? $"{callbackUrl}" : "",
+                    theme = $"{theme}",
+                    content = $"{content}",
+                    crowd = crowd,
+                    crowdIds = tmdIds,
+                    createId = _tmdId,
+                    sendTime = dateTime.ToUnixTimeMilliseconds(),//发布时间待解决
+                    createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
+                    source = !string.IsNullOrEmpty($"{source}") ? $"{source}" : "BI"
+                };
+
+                bINotice = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Common").CreateItemAsync<BINotice>(bINotice, new PartitionKey("BINotice"));
+                //BI发送端外通知
+                _coreAPIHttpService.BIPushNotify(bINotice, new Dictionary<string, object> { { "tmdid", _tmdIds }, { "tmdname", _tmdName } }, _option.Location, _configuration, _dingDing);
+
+                return Ok(new { state = RespondCode.Ok, bINotice });
+            }
+            catch (Exception ex)
+            {
+                _ = _dingDing.SendBotMsg($"BI,  notion/PushNotion() \n{ex.Message}\n{ex.StackTrace}\n", GroupNames.成都开发測試群組);
+                return BadRequest();
+            }
+        }
+
+        /// <summary>
+        /// 查询发布的消息信息
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [AuthToken(Roles = "admin,rdc,assist,sales")]
+        [HttpPost("get-infos")]
+        public async Task<IActionResult> GetInfos(JsonElement jsonElement)
+        {
+            jsonElement.TryGetProperty("id", out JsonElement id);
+
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            List<BINotice> bINotices = new();
+            StringBuilder sql = new("select value(c) from c");
+            if (!string.IsNullOrEmpty($"{id}")) 
+                sql.Append($" where c.id='{id}'");
+            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS,"Common").GetItemQueryIterator<BINotice>(queryText:sql.ToString(),requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("BINotice") }))
+            {
+                bINotices.Add(item);
+            }
+
+            return Ok(new { state = RespondCode.Ok, bINotices });
+        }
+
+
+    }
+}

+ 8 - 1
TEAMModelBI/Controllers/Census/SchoolController.cs

@@ -564,6 +564,7 @@ namespace TEAMModelBI.Controllers.Census
                     scStats.monthStu = statsInfo.monthStu;
                     scStats.room = statsInfo.room;
                     scStats.witRoom = statsInfo.witRoom;
+                    scStats.resourceCnt = statsInfo.resourceCnt;
                     scStats.size = statsInfo.size;
                     scStats.scCreateTime = statsInfo.scCreateTime;
                     scStats.upTime = statsInfo.upTime;
@@ -694,7 +695,7 @@ namespace TEAMModelBI.Controllers.Census
             {
                 switch ($"{role}")
                 {
-                    case "assists":
+                    case "assist":
                         scSql.Append($" join a in c.assists where a.id='{tmdId}'");
                         lastScSql.Append($" join a in c.assists where a.id='{tmdId}'");
                         break;
@@ -763,6 +764,7 @@ namespace TEAMModelBI.Controllers.Census
                 areaScStats.monthStu = statsInfo.monthStu;
                 areaScStats.room = statsInfo.room;
                 areaScStats.witRoom = statsInfo.witRoom;
+                areaScStats.resourceCnt = statsInfo.witRoom;
                 areaScStats.size = statsInfo.size;
                 areaScStats.scCreateTime = statsInfo.scCreateTime;
                 areaScStats.upTime = statsInfo.upTime;
@@ -963,6 +965,7 @@ namespace TEAMModelBI.Controllers.Census
                 areaScStats.monthStu = statsInfo.monthStu;
                 areaScStats.room = statsInfo.room;
                 areaScStats.witRoom = statsInfo.witRoom;
+                areaScStats.resourceCnt = statsInfo.resourceCnt;
                 areaScStats.size = statsInfo.size;
                 //areaScStats.useSize = statsInfo.useSize;
                 areaScStats.lessStats.open = statsInfo.lesson.all;
@@ -1122,6 +1125,7 @@ namespace TEAMModelBI.Controllers.Census
                 allScStats.monthStu = statsInfo.monthStu;
                 allScStats.room = statsInfo.room;
                 allScStats.witRoom = statsInfo.witRoom;
+                allScStats.resourceCnt = statsInfo.witRoom;
                 allScStats.size = statsInfo.size;
                 allScStats.scCreateTime = statsInfo.scCreateTime;
                 allScStats.upTime = statsInfo.upTime;
@@ -1292,6 +1296,7 @@ namespace TEAMModelBI.Controllers.Census
             public int monthTch { get; set; }
             public int room { get; set; }
             public int witRoom { get; set; }
+            public int resourceCnt { get; set; }
             public int size { get; set; }
             public long useSize { get; set; }
             public int stu { get; set; }
@@ -1323,6 +1328,7 @@ namespace TEAMModelBI.Controllers.Census
             public int monthStu { get; set; }
             public int room { get; set; }
             public int witRoom { get; set; }
+            public int resourceCnt { get; set; }
             public int size { get; set; }
             public long scCreateTime { get; set; }
             public long upTime { get; set; }
@@ -1351,6 +1357,7 @@ namespace TEAMModelBI.Controllers.Census
             public int monthStu { get; set; }
             public int room { get; set; }
             public int witRoom { get; set; }
+            public int resourceCnt { get; set; }
             public int size { get; set; }
             public long scCreateTime { get; set; }
             public long upTime { get; set; }

+ 1 - 0
TEAMModelBI/Tool/CosmosBank/StatsWay.cs

@@ -74,6 +74,7 @@ namespace TEAMModelBI.Tool.CosmosBank
 
             statsInfo.room = await JointlySingleQuery.GetValueInt(cosmosClient, "School", currSql, $"Room-{scBase.id}");
             statsInfo.witRoom = await JointlySingleQuery.GetValueInt(cosmosClient, "School", $"{currSql} where (c.serial != null or c.serial != '' or IS_DEFINED(c.serial) = true)", $"Room-{scBase.id}");
+            statsInfo.resourceCnt = await JointlySingleQuery.GetValueInt(cosmosClient, "School", currSql, $"Bloblog-{scBase.id}");
 
             statsInfo.lesson = await GetLessStats(cosmosClient, statsInfo.id);
             statsInfo.activity = await GetActStats(cosmosClient, statsInfo.id);

+ 71 - 0
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -1,8 +1,10 @@
 using HTEXLib.COMM.Helpers;
+using HTEXLib.Helpers.ShapeHelpers;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
 using OpenXmlPowerTools;
 using System;
@@ -23,6 +25,8 @@ using TEAMModelOS.Models;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
+using TEAMModelOS.SDK.Models.Cosmos.BI;
+using static TEAMModelOS.SDK.CoreAPIHttpService;
 
 namespace TEAMModelOS.SDK
 {
@@ -336,6 +340,73 @@ namespace TEAMModelOS.SDK
                 _ = _dingDing.SendBotMsg($"{location},通知V2发送异常\n{ex.Message}\n{ex.StackTrace}\n{replaceData.ToJsonString()}\n{toTeachers.ToJsonString()}\n{notifyCode}", GroupNames.醍摩豆服務運維群組);
             }
         }
+
+        /// <summary>
+        /// BI发送端外通知消息
+        /// </summary>
+        /// <param name="bINotice"></param>
+        /// <param name="notifyCode"></param>
+        /// <param name="notifyType"></param>
+        /// <param name="replaceData"></param>
+        /// <param name="location"></param>
+        /// <param name="_configuration"></param>
+        /// <param name="_dingDing"></param>
+        public void BIPushNotify(BINotice bINotice, Dictionary<string, object> replaceData,string location, IConfiguration _configuration, DI.DingDing _dingDing)
+        {
+
+            try
+            {
+                var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
+                var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
+                var url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
+                string site = location;
+                if (location.Contains("China"))
+                {
+                    location = "China";
+                }
+                else if (location.Contains("Global"))
+                {
+                    location = "Global";
+                }
+                var client = _httpClient;
+                var token = CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location).Result;
+                if (client.DefaultRequestHeaders.Contains("Authorization"))
+                {
+                    client.DefaultRequestHeaders.Remove("Authorization");
+                    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                }
+                else
+                {
+                    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                }
+
+                NotifyData notifyData = new NotifyData
+                {
+                    hubName = bINotice.crowd.type,
+                    sender = bINotice.source,
+                    tags = bINotice.crowdIds,
+                    title = bINotice.theme,
+                    body = bINotice.content,
+                    eventId = $"BI-send",
+                    eventName = $"BI_SendNotice",
+                    data = bINotice.ToString()
+                };
+
+                string result = "";
+                HttpResponseMessage responseMessage = _httpClient.PostAsJsonAsync($"{url}/service/PushNotify", notifyData).Result;
+                if (responseMessage.StatusCode == HttpStatusCode.OK)
+                {
+                    string content = responseMessage.Content.ReadAsStringAsync().Result;
+                    result = content;
+                }
+                else
+                    result = $"{responseMessage.StatusCode},推送返回的状态码。";
+            }
+            catch (Exception ex)
+            {
+                _ = _dingDing.SendBotMsg($"{location},BI通知V2发送异常\n{ex.Message}\n{ex.StackTrace}\n{replaceData.ToJsonString()}\n{bINotice.ToJsonString()}", GroupNames.成都开发測試群組);
+            }
+        }
         public class NotifyData { 
             public string hubName { get; set; }
             public string sender { get; set; }

+ 82 - 0
TEAMModelOS.SDK/Models/Cosmos/BI/BICommon/Notice.cs

@@ -0,0 +1,82 @@
+using Microsoft.Azure.Cosmos.Table;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.SDK.Models.Cosmos.BI
+{
+    public class BINotice : CosmosEntity
+    {
+        public BINotice()
+        {
+            code = "BINotice";
+            pk = "BINotice";
+        }
+        /// <summary>
+        /// 消息类型  0系统  1普通类型  2提示类型   3 特殊类型  
+        /// </summary>
+        public int type { get; set; } = 0;
+        /// <summary>
+        /// 跳转地址
+        /// </summary>
+        public string jumpUrl { get; set; }
+        /// <summary>
+        /// 回调方法
+        /// </summary>
+        public string callbackUrl { get; set; }
+        /// <summary>
+        /// 消息标题
+        /// </summary>
+        public string theme { get; set; }
+        /// <summary>
+        /// 消息内容
+        /// </summary>
+        public string content { get; set; }
+
+        /// <summary>
+        /// 接收人群
+        /// </summary>
+        public Crowd crowd { get; set; }
+
+        /// <summary>
+        /// 接收人id集合
+        /// </summary>
+        public List<string> crowdIds { get; set; }
+
+        /// <summary>
+        /// 创建者id
+        /// </summary>
+        public string createId { get; set; }
+
+        /// <summary>
+        /// 发送时间
+        /// </summary>
+        public long sendTime { get; set; }
+
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        public long createTime { get; set; }
+        /// <summary>
+        /// 发送消息来源, 默认(BI)、IES5、HiTA
+        /// </summary>
+        public string source { get; set; } = "BI";
+    }
+
+    /// <summary>
+    /// 发送人群
+    /// </summary>
+    public class Crowd
+    {
+        public List<string> tmdIds { get; set; }
+        public List<string> schoolIds { get; set; }
+        public List<string> areaIds { get; set; }
+        /// <summary>
+        /// 接收类型
+        /// </summary>
+        public string type { get; set; }
+    }
+}

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/BI/StatsInfo.cs

@@ -113,6 +113,10 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI
         /// </summary>
         public int witRoom { get; set; }
 
+        /// <summary>
+        /// 资源数量
+        /// </summary>
+        public int resourceCnt { get; set; }
         /// <summary>
         /// 学校创建时间
         /// </summary>

+ 2 - 0
TEAMModelOS.SDK/Models/Service/BIStatsWay/SchoolStatsWay.cs

@@ -108,6 +108,7 @@ namespace TEAMModelOS.SDK.Models.Service.BIStatsWay
 
             statsInfo.room = await JointlySingleQuery.GetValueInt(cosmosClient, "School",  $"Room-{scBase.id}" ,currSql);
             statsInfo.witRoom = await JointlySingleQuery.GetValueInt(cosmosClient, "School",  $"Room-{scBase.id}", $"{currSql} where (c.serial != null or c.serial != '' or IS_DEFINED(c.serial) = true)");
+            statsInfo.resourceCnt = await JointlySingleQuery.GetValueInt(cosmosClient, "School",  $"Bloblog-{scBase.id}", currSql);
 
             statsInfo.upTime = dateTime.ToUnixTimeMilliseconds();
             statsInfo.lesson = await LessonRecordStatsWay.GetSchoolAll(cosmosClient, statsInfo.schoolId, year);
@@ -147,6 +148,7 @@ namespace TEAMModelOS.SDK.Models.Service.BIStatsWay
                 monthStu = statsInfos.Select(s => s.monthStu).Sum(),
                 room = statsInfos.Select(s => s.room).Sum(),
                 witRoom = statsInfos.Select(s => s.witRoom).Sum(),
+                resourceCnt = statsInfos.Select(s => s.resourceCnt).Sum(),
                 size = statsInfos.Select(s => s.size).Sum(),
                 useSize = statsInfos.Select(s => s.useSize).Sum()
             };