|
@@ -493,6 +493,8 @@ namespace TEAMModelBI.Controllers.Census
|
|
return Ok(new { state = RespondCode.Ok, scCnt = scIds.Count, tchCnt, stuCnt, allCnt = tLessCnt + tActCnt, tLessCnt, tActCnt });
|
|
return Ok(new { state = RespondCode.Ok, scCnt = scIds.Count, tchCnt, stuCnt, allCnt = tLessCnt + tActCnt, tLessCnt, tActCnt });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #region 新的统计接口
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 学校统计
|
|
/// 学校统计
|
|
/// 新的数据结构
|
|
/// 新的数据结构
|
|
@@ -1007,52 +1009,11 @@ namespace TEAMModelBI.Controllers.Census
|
|
return Ok(new { state = RespondCode.Ok, areaScStats, schoolInfos, weekLess, assists = assits.Where((w, i) => assits.FindIndex(s => s.id.Equals(w.id)) == i).ToList(), saless = saless.Where((w, i) => saless.FindIndex(f => f.id.Equals(w.id)) == i).ToList() });
|
|
return Ok(new { state = RespondCode.Ok, areaScStats, schoolInfos, weekLess, assists = assits.Where((w, i) => assits.FindIndex(s => s.id.Equals(w.id)) == i).ToList(), saless = saless.Where((w, i) => saless.FindIndex(f => f.id.Equals(w.id)) == i).ToList() });
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 学校信息中间件查询接口
|
|
|
|
|
|
+ /// 所有区级的统计
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="jsonElement"></param>
|
|
/// <param name="jsonElement"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- [ProducesDefaultResponseType]
|
|
|
|
- [HttpPost("get-scinfos")]
|
|
|
|
- public async Task<IActionResult> GetScInfos(JsonElement jsonElement)
|
|
|
|
- {
|
|
|
|
- var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
- jsonElement.TryGetProperty("role", out JsonElement role);
|
|
|
|
- jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
- jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
|
|
-
|
|
|
|
- StringBuilder sql = new($"select value(c) from c");
|
|
|
|
-
|
|
|
|
- if (!string.IsNullOrEmpty($"{role}") && !string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{areaId}"))
|
|
|
|
- {
|
|
|
|
- switch ($"{role}")
|
|
|
|
- {
|
|
|
|
- case "assist":
|
|
|
|
- sql.Append($" join a in c.assist where a.id='{tmdId}'");
|
|
|
|
- break;
|
|
|
|
- case "sales":
|
|
|
|
- sql.Append($" join a in c.sales where a.id='{tmdId}'");
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!string.IsNullOrEmpty($"{areaId}") && !string.IsNullOrEmpty($"{role}"))
|
|
|
|
- {
|
|
|
|
- sql.Append($" where c.areaId ='{areaId}'");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //List<string> scId = await CommonFind.FindScIds(cosmosClient, "select value(c.id) from c ", "Base");
|
|
|
|
-
|
|
|
|
- List<BIRelation> scInfos = new();
|
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<BIRelation>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
|
|
|
|
- {
|
|
|
|
- scInfos.Add(item);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return Ok(new { state = RespondCode.Ok, allCnt = scInfos.Count, scInfos });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
[ProducesDefaultResponseType]
|
|
[ProducesDefaultResponseType]
|
|
[HttpPost("get-allscstats")]
|
|
[HttpPost("get-allscstats")]
|
|
public async Task<IActionResult> GetAllAreaStats(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAllAreaStats(JsonElement jsonElement)
|
|
@@ -1150,6 +1111,52 @@ namespace TEAMModelBI.Controllers.Census
|
|
return Ok(new { state = RespondCode.Ok, allScStats });
|
|
return Ok(new { state = RespondCode.Ok, allScStats });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ #endregion 新的统计接口
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 学校信息中间件查询接口
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="jsonElement"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [ProducesDefaultResponseType]
|
|
|
|
+ [HttpPost("get-scinfos")]
|
|
|
|
+ public async Task<IActionResult> GetScInfos(JsonElement jsonElement)
|
|
|
|
+ {
|
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
+ jsonElement.TryGetProperty("role", out JsonElement role);
|
|
|
|
+ jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
+ jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
|
|
+
|
|
|
|
+ StringBuilder sql = new($"select value(c) from c");
|
|
|
|
+
|
|
|
|
+ if (!string.IsNullOrEmpty($"{role}") && !string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{areaId}"))
|
|
|
|
+ {
|
|
|
|
+ switch ($"{role}")
|
|
|
|
+ {
|
|
|
|
+ case "assist":
|
|
|
|
+ sql.Append($" join a in c.assist where a.id='{tmdId}'");
|
|
|
|
+ break;
|
|
|
|
+ case "sales":
|
|
|
|
+ sql.Append($" join a in c.sales where a.id='{tmdId}'");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!string.IsNullOrEmpty($"{areaId}") && !string.IsNullOrEmpty($"{role}"))
|
|
|
|
+ {
|
|
|
|
+ sql.Append($" where c.areaId ='{areaId}'");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //List<string> scId = await CommonFind.FindScIds(cosmosClient, "select value(c.id) from c ", "Base");
|
|
|
|
+
|
|
|
|
+ List<BIRelation> scInfos = new();
|
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<BIRelation>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
|
|
|
|
+ {
|
|
|
|
+ scInfos.Add(item);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Ok(new { state = RespondCode.Ok, allCnt = scInfos.Count, scInfos });
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|