|
@@ -75,10 +75,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
try
|
|
try
|
|
{
|
|
{
|
|
jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
//默认不指定返回大小
|
|
//默认不指定返回大小
|
|
int? pageSize = null;
|
|
int? pageSize = null;
|
|
@@ -193,7 +194,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
if (!jsonElement.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
|
|
jsonElement.TryGetProperty("areaName", out JsonElement areaName);
|
|
jsonElement.TryGetProperty("areaName", out JsonElement areaName);
|
|
jsonElement.TryGetProperty("isDefault", out JsonElement isDefault);
|
|
jsonElement.TryGetProperty("isDefault", out JsonElement isDefault);
|
|
- jsonElement.TryGetProperty("site", out JsonElement site);
|
|
|
|
|
|
+ //jsonElement.TryGetProperty("site", out JsonElement site); //分开部署,就不需要,一站多用时,取消注释
|
|
var isManyArea = false;
|
|
var isManyArea = false;
|
|
if (!string.IsNullOrEmpty($"{isDefault}"))
|
|
if (!string.IsNullOrEmpty($"{isDefault}"))
|
|
{
|
|
{
|
|
@@ -207,12 +208,13 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
- if ($"{site}".Equals(BIConst.Global))
|
|
|
|
- {
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
- blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
- }
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ //{
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
+ // tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
+ // blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
+ //}
|
|
|
|
|
|
var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_areaId}", new PartitionKey("AreaSetting"));
|
|
var responseSet = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemStreamAsync($"{_areaId}", new PartitionKey("AreaSetting"));
|
|
if (responseSet.Status == 200)
|
|
if (responseSet.Status == 200)
|
|
@@ -291,11 +293,12 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
try
|
|
try
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
AssistSchool schoolAssists = new(); //返回学校列表集合
|
|
AssistSchool schoolAssists = new(); //返回学校列表集合
|
|
string sqlTxt = $"select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard,c.period from c where c.id='{schoolId}'";
|
|
string sqlTxt = $"select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard,c.period from c where c.id='{schoolId}'";
|
|
@@ -409,10 +412,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetAssistSchoolSpace(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssistSchoolSpace(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
List<string> schools = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
List<string> schools = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
List<SchoolSpace> schoolSpaces = new();
|
|
List<SchoolSpace> schoolSpaces = new();
|
|
@@ -527,14 +531,15 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
if (!jsonElement.TryGetProperty("schoolIds", out JsonElement jsSchoolIds)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolIds", out JsonElement jsSchoolIds)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("busy", out JsonElement busy)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("busy", out JsonElement busy)) return BadRequest();
|
|
- jsonElement.TryGetProperty("site", out JsonElement site);
|
|
|
|
|
|
+ //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
|
|
|
|
List<string> schoolIds = jsSchoolIds.ToObject<List<string>>();
|
|
List<string> schoolIds = jsSchoolIds.ToObject<List<string>>();
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("BIDDUserInfo");
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("BIDDUserInfo");
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
string divide = _option.Location;
|
|
string divide = _option.Location;
|
|
- if ($"{site}".Equals(BIConst.Global))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
Dictionary<string, object> dic = new() { { "PartitionKey", $"{parKey}" } };
|
|
Dictionary<string, object> dic = new() { { "PartitionKey", $"{parKey}" } };
|
|
if (!string.IsNullOrEmpty($"{userId}"))
|
|
if (!string.IsNullOrEmpty($"{userId}"))
|
|
@@ -631,10 +636,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetSchoolManage(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetSchoolManage(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement scId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement scId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
List<BaseInfo> scManages = new();
|
|
List<BaseInfo> scManages = new();
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<BaseInfo>(queryText: $"select c.id,c.name,c.picture from c where ARRAY_CONTAINS(c.roles,'admin',true) and c.code='Teacher-{scId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{scId}") }))
|
|
await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<BaseInfo>(queryText: $"select c.id,c.name,c.picture from c where ARRAY_CONTAINS(c.roles,'admin',true) and c.code='Teacher-{scId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{scId}") }))
|
|
@@ -665,16 +671,17 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scName", out JsonElement schoolName)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scName", out JsonElement schoolName)) return BadRequest();
|
|
jsonElement.TryGetProperty("scPic", out JsonElement scpicture);
|
|
jsonElement.TryGetProperty("scPic", out JsonElement scpicture);
|
|
- jsonElement.TryGetProperty("site", out JsonElement site);
|
|
|
|
|
|
+ //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
- if ($"{site}".Equals(BIConst.Global))
|
|
|
|
- {
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
- blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
- }
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ //{
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
+ // tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
+ // blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
+ //}
|
|
StringBuilder strMsg = new($"{_tmdName}【{_tmdId}】账户将{tmdName}【{tmdId}】");
|
|
StringBuilder strMsg = new($"{_tmdName}【{_tmdId}】账户将{tmdName}【{tmdId}】");
|
|
|
|
|
|
Teacher teacher = null;
|
|
Teacher teacher = null;
|
|
@@ -768,10 +775,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement scId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("scId", out JsonElement scId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
SchoolTeacher scTeacher = null;
|
|
SchoolTeacher scTeacher = null;
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Teacher-{scId}"));
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{tmdId}", new PartitionKey($"Teacher-{scId}"));
|
|
@@ -808,22 +816,22 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
List<string> schools = schoolId.ToObject<List<string>>();
|
|
List<string> schools = schoolId.ToObject<List<string>>();
|
|
|
|
|
|
- jsonElement.TryGetProperty("site", out JsonElement site);
|
|
|
|
|
|
+ //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
string _auth = HttpContext.GetXAuth("AuthToken");
|
|
string _auth = HttpContext.GetXAuth("AuthToken");
|
|
var (tmdId, tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(_auth, _option);
|
|
var (tmdId, tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(_auth, _option);
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
- if ($"{site}".Equals(BIConst.Global))
|
|
|
|
- {
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
- blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
- }
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ //{
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
+ // tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
+ // blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
+ //}
|
|
StringBuilder msg = new();
|
|
StringBuilder msg = new();
|
|
List<DelSchoolRel> delSchoolRels = new();
|
|
List<DelSchoolRel> delSchoolRels = new();
|
|
|
|
|
|
-
|
|
|
|
foreach (var tempId in schools)
|
|
foreach (var tempId in schools)
|
|
{
|
|
{
|
|
List<string> scTchIds = new();
|
|
List<string> scTchIds = new();
|
|
@@ -943,10 +951,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetSchoolCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetSchoolCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
DateTimeOffset dtime = DateTimeOffset.UtcNow;
|
|
DateTimeOffset dtime = DateTimeOffset.UtcNow;
|
|
var (weekS, weekE) = TimeHelper.GetStartOrEnd(dtime, "week");
|
|
var (weekS, weekE) = TimeHelper.GetStartOrEnd(dtime, "week");
|
|
@@ -1054,10 +1063,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
|
|
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
RecSchool recSchool = new();
|
|
RecSchool recSchool = new();
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
@@ -1160,10 +1170,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetSchoolDate(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetSchoolDate(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
List<double> weekTrend = new();
|
|
List<double> weekTrend = new();
|
|
int year = DateTimeOffset.UtcNow.Year;
|
|
int year = DateTimeOffset.UtcNow.Year;
|
|
@@ -1277,23 +1288,20 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetAssistSchoolCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssistSchoolCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- DateTimeOffset dateTime = DateTimeOffset.UtcNow;
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
|
|
+ DateTimeOffset dateTime = DateTimeOffset.UtcNow;
|
|
int scAllCnt = 0; //学校
|
|
int scAllCnt = 0; //学校
|
|
int tchAllCnt = 0; //教师数量
|
|
int tchAllCnt = 0; //教师数量
|
|
int tchMonthCnt = 0; //教师本月新增
|
|
int tchMonthCnt = 0; //教师本月新增
|
|
-
|
|
|
|
int stuAllCnt = 0; //所有学校学生
|
|
int stuAllCnt = 0; //所有学校学生
|
|
-
|
|
|
|
int lessAllCnt = 0; //课例总数
|
|
int lessAllCnt = 0; //课例总数
|
|
int lessMthCnt = 0; //本月新增
|
|
int lessMthCnt = 0; //本月新增
|
|
-
|
|
|
|
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 = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
@@ -1358,10 +1366,10 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
{
|
|
{
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
List<YearCnt> yearCnts = new(); //当前的课例,活动,互动统计
|
|
List<YearCnt> yearCnts = new(); //当前的课例,活动,互动统计
|
|
|
|
|
|
@@ -1412,10 +1420,10 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetAssisScCnt(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetAssisScCnt(JsonElement jsonElement)
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
DateTimeOffset dateTime = DateTimeOffset.UtcNow;
|
|
DateTimeOffset dateTime = DateTimeOffset.UtcNow;
|
|
var (days, daye) = TimeHelper.GetStartOrEnd(dateTime);
|
|
var (days, daye) = TimeHelper.GetStartOrEnd(dateTime);
|
|
var (lastDays, lastDaye) = TimeHelper.GetStartOrEnd(dateTime.AddDays(-1));
|
|
var (lastDays, lastDaye) = TimeHelper.GetStartOrEnd(dateTime.AddDays(-1));
|
|
@@ -1510,16 +1518,16 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
{
|
|
{
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("schoolId", out JsonElement schoolId)) return BadRequest();
|
|
|
|
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
AnSchool school = new(); //学校基础基础信息
|
|
AnSchool school = new(); //学校基础基础信息
|
|
int serial = 0; //学校软体数量
|
|
int serial = 0; //学校软体数量
|
|
int service = 0; //学校服务数量
|
|
int service = 0; //学校服务数量
|
|
int hard = 0; //学校硬件数量
|
|
int hard = 0; //学校硬件数量
|
|
|
|
|
|
-
|
|
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
if (response.Status == 200)
|
|
if (response.Status == 200)
|
|
{
|
|
{
|
|
@@ -1570,17 +1578,18 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
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 = "参数错误" });
|
|
if (!jsonElement.TryGetProperty("tmdId", out JsonElement tmdId)) return Ok(new { state = RespondCode.ParamsError, nsg = "参数错误" });
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
-
|
|
|
|
- List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
int adCnt = 0;
|
|
int adCnt = 0;
|
|
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}");
|
|
|
|
+
|
|
if (schoolIds.Count > 0)
|
|
if (schoolIds.Count > 0)
|
|
{
|
|
{
|
|
string scInfoSql = $"select c.id,c.name,c.code,c.picture,c.type,c.size,c.scale from c ";
|
|
string scInfoSql = $"select c.id,c.name,c.code,c.picture,c.type,c.size,c.scale from c ";
|
|
@@ -1660,11 +1669,12 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
public async Task<IActionResult> GetSchool(JsonElement jsonElement)
|
|
public async Task<IActionResult> GetSchool(JsonElement jsonElement)
|
|
{
|
|
{
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schoolId);
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schoolId);
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- StringBuilder sqlTxt = new StringBuilder("select * from c");
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
+ StringBuilder sqlTxt = new("select * from c");
|
|
if (!string.IsNullOrEmpty($"{schoolId}"))
|
|
if (!string.IsNullOrEmpty($"{schoolId}"))
|
|
{
|
|
{
|
|
sqlTxt.Append($" where c.id='{schoolId}'");
|
|
sqlTxt.Append($" where c.id='{schoolId}'");
|
|
@@ -1698,10 +1708,11 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
{
|
|
{
|
|
jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schoolId);
|
|
jsonElement.TryGetProperty("schoolId", out JsonElement schoolId);
|
|
- 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))
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
|
|
+ ////分开部署,就不需要,一站多用时,取消注释
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
long allSize = 0; //全部大小
|
|
long allSize = 0; //全部大小
|
|
int teacherSpace = 0; //学校分配给教师的空间
|
|
int teacherSpace = 0; //学校分配给教师的空间
|
|
long useSize = 0; //已使用大小
|
|
long useSize = 0; //已使用大小
|
|
@@ -1858,17 +1869,17 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
if (!jsonElement.TryGetProperty("school", out JsonElement _school)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("school", out JsonElement _school)) return BadRequest();
|
|
//if (!jsonElement.TryGetProperty("teacher", out JsonElement _teacher)) return BadRequest();
|
|
//if (!jsonElement.TryGetProperty("teacher", out JsonElement _teacher)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("shiftTeacher", out JsonElement _shiftTeacher)) return BadRequest();
|
|
if (!jsonElement.TryGetProperty("shiftTeacher", out JsonElement _shiftTeacher)) return BadRequest();
|
|
- jsonElement.TryGetProperty("site", out JsonElement site);
|
|
|
|
|
|
+ //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var tableClient = _azureStorage.GetCloudTableClient();
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
- if ($"{site}".Equals(BIConst.Global))
|
|
|
|
- {
|
|
|
|
- cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
- tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
- blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
- }
|
|
|
|
|
|
+ //if ($"{site}".Equals(BIConst.Global))
|
|
|
|
+ //{
|
|
|
|
+ // cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
|
|
|
|
+ // tableClient = _azureStorage.GetCloudTableClient(BIConst.Global);
|
|
|
|
+ // blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
|
|
+ //}
|
|
|
|
|
|
SchoolTeacher schoolTeacher = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemAsync<SchoolTeacher>($"{_tmdId}", new PartitionKey($"Teacher-{_school}"));
|
|
SchoolTeacher schoolTeacher = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemAsync<SchoolTeacher>($"{_tmdId}", new PartitionKey($"Teacher-{_school}"));
|
|
if (schoolTeacher.roles.IsNotEmpty() && schoolTeacher.roles.Contains("assist"))
|
|
if (schoolTeacher.roles.IsNotEmpty() && schoolTeacher.roles.Contains("assist"))
|