|
@@ -1,4 +1,5 @@
|
|
|
using Azure.Cosmos;
|
|
|
+using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
using HTEXLib.COMM.Helpers;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
@@ -136,9 +137,11 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
public async Task<IActionResult> Upsert(School school)
|
|
|
{
|
|
|
- var (_, _, _, _school) = HttpContext.GetAuthTokenInfo();
|
|
|
+ var (userid, name , _, _school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
+ var tableClient = _azureStorage.GetCloudTableClient();
|
|
|
+ var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
|
School schoolInfo = new ();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var schoolContainer = client.GetContainer(Constant.TEAMModelOS, "School");
|
|
@@ -147,6 +150,18 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
School db_school = JsonDocument.Parse(response.Content).RootElement.Deserialize<School>();
|
|
|
//计算 比较更改前后 学段的年级变化的学段,并重新处理行政班的毕业状态。
|
|
|
+ //开启课例设置是否变更
|
|
|
+ if (db_school.openLessonRecord != school.openLessonRecord)
|
|
|
+ {
|
|
|
+ string openstr = "关闭";
|
|
|
+ if (school.openLessonRecord) {
|
|
|
+ openstr = "开启";
|
|
|
+ }
|
|
|
+ StringBuilder strMsg = new($"{name}【{userid}】{openstr}【{school.name}-{school.id}】的课堂记录菜单");
|
|
|
+ //保存管理员移交至BI
|
|
|
+ await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "open-lesson-record", strMsg?.ToString(), _dingDing, twebsite: "IES5", httpContext: HttpContext);
|
|
|
+ }
|
|
|
+
|
|
|
//变更后
|
|
|
List<KeyValuePair<string, int>> period_gradeCount = new List<KeyValuePair<string, int>>();
|
|
|
school.period.ForEach(z => { period_gradeCount.Add(new KeyValuePair<string, int>(z.id, z.grades.Count)); });
|
|
@@ -170,6 +185,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
teachers.Add(item);
|
|
|
}
|
|
|
+
|
|
|
foreach (var item in teachers)
|
|
|
{
|
|
|
Teacher.TeacherSchool teacherSchool = item.schools.Find(x => x.schoolId.Equals(school.id));
|
|
@@ -191,8 +207,7 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
//创建/修改学校信息中间件
|
|
|
//_ = _httpTrigger.RequestHttpTrigger(new { school = $"{school}" }, _option.Location, "set-sc-birelation");
|
|
|
- var tableClient = _azureStorage.GetCloudTableClient();
|
|
|
- var blobClient = _azureStorage.GetBlobContainerClient(containerName: "0-public");
|
|
|
+
|
|
|
await BIStats.SetSchoolBIRelation(client, blobClient, tableClient, _dingDing, schoolInfo);
|
|
|
|
|
|
return Ok(new { schoolInfo });
|