|
@@ -670,6 +670,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
jsonElement.TryGetProperty("tmdPic", out JsonElement picture);
|
|
jsonElement.TryGetProperty("tmdPic", out JsonElement picture);
|
|
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("scAreaId", out JsonElement scAreaId);
|
|
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();
|
|
@@ -683,6 +684,19 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
// blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
// blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public", BIConst.Global);
|
|
//}
|
|
//}
|
|
StringBuilder strMsg = new($"{_tmdName}【{_tmdId}】账户将{tmdName}【{tmdId}】");
|
|
StringBuilder strMsg = new($"{_tmdName}【{_tmdId}】账户将{tmdName}【{tmdId}】");
|
|
|
|
+ string areaId = null;
|
|
|
|
+ if (string.IsNullOrEmpty($"{scAreaId}"))
|
|
|
|
+ {
|
|
|
|
+ var resScInfo = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync($"{schoolId}", new PartitionKey("Base"));
|
|
|
|
+
|
|
|
|
+ if (resScInfo.Status == 200)
|
|
|
|
+ {
|
|
|
|
+ using var tchJson = await JsonDocument.ParseAsync(resScInfo.ContentStream);
|
|
|
|
+ School scInfo = tchJson.ToObject<School>();
|
|
|
|
+ areaId = scInfo.areaId;
|
|
|
|
+ }else areaId = $"{scAreaId}";
|
|
|
|
+ }
|
|
|
|
+ else { areaId = $"{scAreaId}"; }
|
|
|
|
|
|
Teacher teacher = null;
|
|
Teacher teacher = null;
|
|
SchoolTeacher schoolTeacher = null;
|
|
SchoolTeacher schoolTeacher = null;
|
|
@@ -695,7 +709,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
var existArea = teacher.schools.Find(f => f.schoolId.Equals($"{schoolId}"));
|
|
var existArea = teacher.schools.Find(f => f.schoolId.Equals($"{schoolId}"));
|
|
if (existArea == null)
|
|
if (existArea == null)
|
|
{
|
|
{
|
|
- teacher.schools.Add(new Teacher.TeacherSchool { schoolId = $"{schoolId}", name = $"{schoolName}", status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), picture = string.IsNullOrEmpty($"{scpicture}") ? "" : $"{scpicture}", areaId = "" });
|
|
|
|
|
|
+ teacher.schools.Add(new Teacher.TeacherSchool { schoolId = $"{schoolId}", name = $"{schoolName}", status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), picture = string.IsNullOrEmpty($"{scpicture}") ? "" : $"{scpicture}", areaId = areaId });
|
|
teacher = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));
|
|
teacher = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));
|
|
strMsg.Append($"账户基础信息添加学校,");
|
|
strMsg.Append($"账户基础信息添加学校,");
|
|
}
|
|
}
|
|
@@ -710,7 +724,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
teacher.size = 1;
|
|
teacher.size = 1;
|
|
teacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
teacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
//教师存在,在该教师信息中添加要管理的学校信息
|
|
//教师存在,在该教师信息中添加要管理的学校信息
|
|
- teacher.schools.Add(new Teacher.TeacherSchool { schoolId = $"{schoolId}", name = $"{schoolName}", status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), picture = string.IsNullOrEmpty($"{scpicture}") ? "" : $"{scpicture}", areaId = "" });
|
|
|
|
|
|
+ teacher.schools.Add(new Teacher.TeacherSchool { schoolId = $"{schoolId}", name = $"{schoolName}", status = "join", time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), picture = string.IsNullOrEmpty($"{scpicture}") ? "" : $"{scpicture}", areaId = areaId });
|
|
teacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<Teacher>(teacher, new PartitionKey("Base"));
|
|
teacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").CreateItemAsync<Teacher>(teacher, new PartitionKey("Base"));
|
|
strMsg.Append($"添加基础信息,并添加学校");
|
|
strMsg.Append($"添加基础信息,并添加学校");
|
|
}
|
|
}
|