|
@@ -2,6 +2,7 @@
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
+using Pipelines.Sockets.Unofficial.Arenas;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
@@ -17,6 +18,9 @@ using TEAMModelOS.SDK.DI;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Extension;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Models.Cosmos.BI;
|
|
using TEAMModelOS.SDK.Models.Cosmos.BI;
|
|
|
|
+using TEAMModelOS.SDK.Models.Service.BI;
|
|
|
|
+using static TEAMModelBI.Controllers.BINormal.AreaRelevantController;
|
|
|
|
+using static TEAMModelBI.Controllers.Census.LessonSticsController;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.Census
|
|
namespace TEAMModelBI.Controllers.Census
|
|
{
|
|
{
|
|
@@ -358,17 +362,159 @@ namespace TEAMModelBI.Controllers.Census
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="jsonElement"></param>
|
|
/// <param name="jsonElement"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
|
+ [HttpPost("get-noarea")]
|
|
public async Task<IActionResult> GetNoAreaCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetNoAreaCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
- List<string> scIds = new();
|
|
|
|
|
|
|
|
- string scIdSql = "";
|
|
|
|
|
|
+ int tLessCnt = 0; //课例
|
|
|
|
+ int tActCnt = 0; //活动
|
|
|
|
+ List<string> scIds = new(); //学校id集合
|
|
|
|
+
|
|
|
|
+ string scIdSql = "select value(c.id) from c where c.areaId=null or c.areaId=''";
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: scIdSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: scIdSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
{
|
|
{
|
|
scIds.Add(item);
|
|
scIds.Add(item);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ string comSql = BICommonWay.ManyScSql("c.school", scIds);
|
|
|
|
+ string lesSql = $"select value(count(c.id)) from c where c.pk='LessonRecord' and {comSql}";
|
|
|
|
+ tLessCnt = await CommonFind.GetSqlValueCount(cosmosClient, new List<string>() { "School", "Teacher" }, lesSql);
|
|
|
|
+
|
|
|
|
+ comSql = BICommonWay.ManyScSql(" and c.school", scIds);
|
|
|
|
+ tActCnt = await ActivityWay.GetCnt(cosmosClient, condSql: comSql);
|
|
|
|
+
|
|
|
|
+ return Ok(new { state = 200, scCnt=scIds.Count(), tLessCnt, tActCnt });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 未加区的学校统计详细
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="jsonElement"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpPost("get-noareasc")]
|
|
|
|
+ public async Task<IActionResult> GetNoAareaScCnt(JsonElement jsonElement)
|
|
|
|
+ {
|
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
+ var tableClient = _azureStorage.GetCloudTableClient();
|
|
|
|
+ var table = tableClient.GetTableReference("BIDDUserInfo");
|
|
|
|
+
|
|
|
|
+ var (dayS, dayE) = TimeHelper.GetStartOrEnd(DateTimeOffset.UtcNow);
|
|
|
|
+ var (weekS, weekE) = TimeHelper.GetStartOrEnd(DateTimeOffset.UtcNow, "week");
|
|
|
|
+ var (monthS, monthE) = TimeHelper.GetStartOrEnd(DateTimeOffset.UtcNow, "month");
|
|
|
|
+ var (termS, termE) = TimeHelper.GetStartOrEnd(DateTimeOffset.UtcNow, "term");
|
|
|
|
+
|
|
|
|
+ List<AreaAssist> areaAssists = new(); //顾问信息
|
|
|
|
+
|
|
|
|
+ int scCnt = 0; //学校人数
|
|
|
|
+ int weekScCnt = 0; //本周学校人数
|
|
|
|
+ int motnhScCnt = 0; //本月学校人数
|
|
|
|
+
|
|
|
|
+ int tchCnt = 0; //所有区级老师
|
|
|
|
+ int weekTchCnt = 0; //所有区级老师
|
|
|
|
+ int monthTchCnt = 0; //所有区级老师
|
|
|
|
+
|
|
|
|
+ int stuCnt = 0; //所有区级学生
|
|
|
|
+ int weekStuCnt = 0; //所有区级学生
|
|
|
|
+ int monthStuCnt = 0; //所有区级学生
|
|
|
|
+
|
|
|
|
+ int areaSize = 0; //区级空间
|
|
|
|
+ int weekSize = 0; //本周空间
|
|
|
|
+ int monthSize = 0; //本月空间
|
|
|
|
+
|
|
|
|
+ int allLess = 0; //所有课例
|
|
|
|
+ int weekLess = 0; //周课例
|
|
|
|
+ int monthLess = 0; //月课例
|
|
|
|
+ int termLess = 0; //学期课例
|
|
|
|
+
|
|
|
|
+ int totalTime = 0; //累计学时
|
|
|
|
+ int allActCnt = 0; //所有活动
|
|
|
|
+ int weekActivity = 0; //周活动数量
|
|
|
|
+ int monthActCnt = 0; //月活动数量
|
|
|
|
+ int termActivity = 0; //学期活动
|
|
|
|
+
|
|
|
|
+ int onLineCount = 0; //线上研修人数
|
|
|
|
+ int offlineCount = 0; //线下研修人数
|
|
|
|
+ int classRoomCount = 0; //课堂实录人数
|
|
|
|
+ int submitCount = 0; //认证材料人数
|
|
|
|
+
|
|
|
|
+ int fulfilCount = 0; //已完成
|
|
|
|
+ int carryOnCount = 0; //进行中
|
|
|
|
+ int noCount = 0; //未开始
|
|
|
|
+
|
|
|
|
+ HashSet<string> tchIds = new();
|
|
|
|
+ List<string> scIds = new(); //学校id集合
|
|
|
|
+
|
|
|
|
+ string scIdSql = "select value(c.id) from c where c.areaId=null or c.areaId=''";
|
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: scIdSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
|
+ {
|
|
|
|
+ scIds.Add(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ string scsSql = BICommonWay.ManyScSql("c.school", scIds);
|
|
|
|
+ string cntSql = $"select value(count(c.id)) from c where {scsSql}";
|
|
|
|
+
|
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<int>(queryText: cntSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
|
+ {
|
|
|
|
+ tchCnt += item;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<int>(queryText: cntSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
|
+ {
|
|
|
|
+ stuCnt += item;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var scId in scIds)
|
|
|
|
+ {
|
|
|
|
+ string tchIdSql = $"select value(c.id) from c where array_contains(c.roles,'assist',true) and c.pk='Teacher'";
|
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: tchIdSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{scId}") }))
|
|
|
|
+ {
|
|
|
|
+ tchIds.Add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<string> noIds = new();
|
|
|
|
+ foreach (var item in tchIds)
|
|
|
|
+ {
|
|
|
|
+ List<DingDingUserInfo> ddUsers = await table.QueryWhereString<DingDingUserInfo>($"PartitionKey eq '{_option.Location}' and tmdId eq '{item}'");
|
|
|
|
+ if (ddUsers.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ foreach (var dduser in ddUsers)
|
|
|
|
+ {
|
|
|
|
+ AreaAssist areaAssist = new()
|
|
|
|
+ {
|
|
|
|
+ userId = dduser.userId,
|
|
|
|
+ unionId = dduser.unionId,
|
|
|
|
+ name = dduser.name,
|
|
|
|
+ mobile = dduser.mobile,
|
|
|
|
+ avatar = dduser.avatar,
|
|
|
|
+ tmdId = dduser.tmdId,
|
|
|
|
+ tmdName = dduser.tmdName,
|
|
|
|
+ tmdMobile = dduser.tmdMobile,
|
|
|
|
+ picture = dduser.picture,
|
|
|
|
+ roles = dduser.roles,
|
|
|
|
+ schoolIds = dduser.schoolIds
|
|
|
|
+ };
|
|
|
|
+ areaAssists.Add(areaAssist);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else { noIds.Add(item); }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AreaSetting setting = new()
|
|
|
|
+ {
|
|
|
|
+ allTime = 50,
|
|
|
|
+ classTime = 5,
|
|
|
|
+ submitTime = 15,
|
|
|
|
+ onlineTime = 20,
|
|
|
|
+ offlineTime = 10,
|
|
|
|
+ lessonMinutes = 45,
|
|
|
|
+ };
|
|
|
|
+ string oftenSql = "select value(count(c.id)) from c";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -377,6 +523,7 @@ namespace TEAMModelBI.Controllers.Census
|
|
return Ok(new { state = 200 });
|
|
return Ok(new { state = 200 });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 依据Id查询School容器 数据管理工具——查询工具
|
|
/// 依据Id查询School容器 数据管理工具——查询工具
|
|
/// </summary>
|
|
/// </summary>
|