|
@@ -18,6 +18,7 @@ using TEAMModelBI.Tool;
|
|
using MathNet.Numerics.LinearAlgebra.Double;
|
|
using MathNet.Numerics.LinearAlgebra.Double;
|
|
using TEAMModelBI.Tool.CosmosBank;
|
|
using TEAMModelBI.Tool.CosmosBank;
|
|
using TEAMModelOS.SDK.Context.BI;
|
|
using TEAMModelOS.SDK.Context.BI;
|
|
|
|
+using TEAMModelOS.SDK.Models.Service.BI;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.Census
|
|
namespace TEAMModelBI.Controllers.Census
|
|
{
|
|
{
|
|
@@ -546,13 +547,27 @@ namespace TEAMModelBI.Controllers.Census
|
|
|
|
|
|
foreach (var area in areaInfos)
|
|
foreach (var area in areaInfos)
|
|
{
|
|
{
|
|
- List<string> schooId = await CommonFind.FindSchoolIds(cosmosClient,$"select c.id from c where c.areaId='{area.id}'","Base");
|
|
|
|
- List<string> tecId = await CommonFind.FindRolesId(cosmosClient, schooId);
|
|
|
|
|
|
+ string comSql = $"select value(c.id) from c where c.areaId='{area.id}'";
|
|
|
|
+ List<string> scIds = await CommonFind.GetValueSingle(cosmosClient, "School", comSql, "Base");
|
|
|
|
+ int tLessCnt = 0;
|
|
|
|
+ int tActCnt = 0;
|
|
|
|
|
|
- area.lessCount = await LessonStatisWay.GetAll(cosmosClient, schooId, tecId);
|
|
|
|
- area.activityCount = await ActivityWay.GetAll(cosmosClient, schooId, tecId);
|
|
|
|
- }
|
|
|
|
|
|
+ string Sql = $"select value(c.id) from c where c.areaId='{area.id}'";
|
|
|
|
+ if (scIds.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ 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, comSql);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ area.lessCnt = tLessCnt;
|
|
|
|
+ area.actCnt = tActCnt;
|
|
|
|
+ area.allCnt = tLessCnt + tActCnt;
|
|
|
|
+ }
|
|
|
|
+ areaInfos = areaInfos.Where(w => w.allCnt != 0).ToList();
|
|
|
|
|
|
return Ok(new { state = 200 , areaInfos });
|
|
return Ok(new { state = 200 , areaInfos });
|
|
}
|
|
}
|
|
@@ -594,8 +609,9 @@ namespace TEAMModelBI.Controllers.Census
|
|
public string name { get; set; }
|
|
public string name { get; set; }
|
|
public string standard { get; set; }
|
|
public string standard { get; set; }
|
|
public string standardName { get; set; }
|
|
public string standardName { get; set; }
|
|
- public int lessCount { get; set; }
|
|
|
|
- public int activityCount { get; set; }
|
|
|
|
|
|
+ public int lessCnt { get; set; }
|
|
|
|
+ public int actCnt { get; set; }
|
|
|
|
+ public int allCnt { get; set; }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|