|
@@ -1419,7 +1419,9 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
[HttpPost("get-assisscbase")]
|
|
[HttpPost("get-assisscbase")]
|
|
public async Task<IActionResult> GetAssistSchoolCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssistSchoolCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
- if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
|
|
|
|
+ jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
+ jsonElement.TryGetProperty("role", out JsonElement role);
|
|
|
|
+
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
////分开部署,就不需要,一站多用时,取消注释
|
|
////分开部署,就不需要,一站多用时,取消注释
|
|
@@ -1436,7 +1438,22 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
List<ScRankCnt> scRankCnts = new(); //学校开课、上传, 课例排名
|
|
List<ScRankCnt> scRankCnts = new(); //学校开课、上传, 课例排名
|
|
var (start, end) = TimeHelper.GetStartOrEnd(dateTime, "month");
|
|
var (start, end) = TimeHelper.GetStartOrEnd(dateTime, "month");
|
|
|
|
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
|
|
+ List<string> schoolIds = new();
|
|
|
|
+ if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
|
+ {
|
|
|
|
+ switch ($"{role}")
|
|
|
|
+ {
|
|
|
|
+ case "admin":
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}","admin");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ schoolIds = await CommonFind.GetValueSingle(cosmosClient,"School","select value(c.id) from c","Base");
|
|
|
|
+
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
string scIdSql = BICommonWay.ManyScSql("c.schoolId", schoolIds);
|
|
string scIdSql = BICommonWay.ManyScSql("c.schoolId", schoolIds);
|
|
@@ -1497,9 +1514,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetAssisSc(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssisSc(JsonElement jsonElement)
|
|
{
|
|
{
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
+ jsonElement.TryGetProperty("role", out JsonElement role);
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schooId);
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schooId);
|
|
//jsonElement.TryGetProperty("site", out JsonElement site); //分开部署,就不需要,一站多用时,取消注释
|
|
//jsonElement.TryGetProperty("site", out JsonElement site); //分开部署,就不需要,一站多用时,取消注释
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
|
+
|
|
//if ($"{site}".Equals(BIConst.Global))
|
|
//if ($"{site}".Equals(BIConst.Global))
|
|
// cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
// cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
@@ -1509,7 +1528,23 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
string scSql = null;
|
|
string scSql = null;
|
|
if (!string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}"))
|
|
if (!string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}"))
|
|
{
|
|
{
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
|
|
+ //List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ List<string> schoolIds = new();
|
|
|
|
+ if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
|
+ {
|
|
|
|
+ switch ($"{role}")
|
|
|
|
+ {
|
|
|
|
+ case "admin":
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}", "admin");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
|
|
|
|
+
|
|
if (schoolIds.Count == 0) return Ok(new { state = RespondCode.Ok, yearCnts, });
|
|
if (schoolIds.Count == 0) return Ok(new { state = RespondCode.Ok, yearCnts, });
|
|
scSql = BICommonWay.ManyScSql("c.school", schoolIds);
|
|
scSql = BICommonWay.ManyScSql("c.school", schoolIds);
|
|
}
|
|
}
|
|
@@ -1551,7 +1586,8 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
[HttpPost("get-assissccnt")]
|
|
[HttpPost("get-assissccnt")]
|
|
public async Task<IActionResult> GetAssisScCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssisScCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
- if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
|
|
|
|
+ jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
+ jsonElement.TryGetProperty("role", out JsonElement role);
|
|
//jsonElement.TryGetProperty("site", out JsonElement site); //分开部署,就不需要,一站多用时,取消注释
|
|
//jsonElement.TryGetProperty("site", out JsonElement site); //分开部署,就不需要,一站多用时,取消注释
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
//if ($"{site}".Equals(BIConst.Global))
|
|
//if ($"{site}".Equals(BIConst.Global))
|
|
@@ -1562,6 +1598,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
var (years, yeare) = TimeHelper.GetStartOrEnd(dateTime, "year");
|
|
var (years, yeare) = TimeHelper.GetStartOrEnd(dateTime, "year");
|
|
var (lastYears, lastYeare) = TimeHelper.GetStartOrEnd(dateTime, "lastYear");
|
|
var (lastYears, lastYeare) = TimeHelper.GetStartOrEnd(dateTime, "lastYear");
|
|
|
|
|
|
|
|
+
|
|
int lessAll = 0; //所以课例
|
|
int lessAll = 0; //所以课例
|
|
int lessLastdayCnt = 0; //昨天的课例
|
|
int lessLastdayCnt = 0; //昨天的课例
|
|
int lessDayCnt = 0; //今天的课例
|
|
int lessDayCnt = 0; //今天的课例
|
|
@@ -1580,7 +1617,22 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
int lastYearActCnt = 0; //去年活动
|
|
int lastYearActCnt = 0; //去年活动
|
|
int yearActCnt = 0; //今年活动
|
|
int yearActCnt = 0; //今年活动
|
|
|
|
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
|
|
+ List<string> schoolIds = new();
|
|
|
|
+ if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
|
+ {
|
|
|
|
+ switch ($"{role}")
|
|
|
|
+ {
|
|
|
|
+ case "admin":
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}", "admin");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
|
|
|
|
+
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
|
|
|
|
@@ -1706,7 +1758,8 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
[HttpPost("get-proded")]
|
|
[HttpPost("get-proded")]
|
|
public async Task<IActionResult> GetProdEd(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetProdEd(JsonElement jsonElement)
|
|
{
|
|
{
|
|
- if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return Ok(new { state = RespondCode.ParamsError, nsg = "参数错误" });
|
|
|
|
|
|
+ jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
|
+ jsonElement.TryGetProperty("role", out JsonElement role);
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
////分开部署,就不需要,一站多用时,取消注释
|
|
////分开部署,就不需要,一站多用时,取消注释
|
|
@@ -1717,7 +1770,22 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
int allCnt = 0;
|
|
int allCnt = 0;
|
|
List<ScProdEd> scInfos = new();
|
|
List<ScProdEd> scInfos = new();
|
|
List<string> products = new();
|
|
List<string> products = new();
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
|
|
+ //List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ List<string> schoolIds = new();
|
|
|
|
+ if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
|
+ {
|
|
|
|
+ switch ($"{role}")
|
|
|
|
+ {
|
|
|
|
+ case "admin":
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}", "admin");
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
|
|
|
|
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
@@ -2054,7 +2122,6 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
else { return Ok(new { status = 201, msg = $"{_tmdName}【{_tmdId}】账号不是顾问" }); }
|
|
else { return Ok(new { status = 201, msg = $"{_tmdName}【{_tmdId}】账号不是顾问" }); }
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 管理员所管理的学校信息
|
|
/// 管理员所管理的学校信息
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -2069,6 +2136,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
List<ManageScInfo> mScInfos = new();
|
|
List<ManageScInfo> mScInfos = new();
|
|
|
|
+ List<ManageScInfo> noScInfos = new();
|
|
List<string> scIds = new();
|
|
List<string> scIds = new();
|
|
|
|
|
|
string mScSql = $"SELECT value(REPLACE(c.code, 'Teacher-', '')) FROM c where array_contains(c.roles,'admin',true) and c.pk='Teacher' and c.id='{tmdId}'";
|
|
string mScSql = $"SELECT value(REPLACE(c.code, 'Teacher-', '')) FROM c where array_contains(c.roles,'admin',true) and c.pk='Teacher' and c.id='{tmdId}'";
|
|
@@ -2090,7 +2158,16 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
mScInfos = await CommonFind.GetObject<ManageScInfo>(cosmosClient, "School", scSql, "Base");
|
|
mScInfos = await CommonFind.GetObject<ManageScInfo>(cosmosClient, "School", scSql, "Base");
|
|
}
|
|
}
|
|
|
|
|
|
- return Ok(new { state = RespondCode.Ok, mScInfos });
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty($"{areaId}"))
|
|
|
|
+ {
|
|
|
|
+ string noScInfoSql = $"select c.id,c.name,c.code,c.picture,c.region,c.province,c.city,c.dist,c.areaId from c where c.areaId='{areaId}'";
|
|
|
|
+ List<ManageScInfo> areaAllScInfos = await CommonFind.GetObject<ManageScInfo>(cosmosClient, "School", noScInfoSql, "Base");
|
|
|
|
+
|
|
|
|
+ noScInfos = areaAllScInfos.Where(w => !mScInfos.Any(a => a.id == w.id)).ToList();
|
|
|
|
+ //noScInfos = areaAllScInfos.Except(mScInfos).ToList();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Ok(new { state = RespondCode.Ok, mScInfos, noScInfos });
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|