Parcourir la source

1、处理BI系统V2通知,2处理学校列表管理员的问题

Li il y a 2 ans
Parent
commit
81bf52b697

+ 1 - 1
TEAMModelBI/Controllers/BINormal/AreaRelevantController.cs

@@ -424,7 +424,7 @@ namespace TEAMModelBI.Controllers.BINormal
         /// <returns></returns>
         [ProducesDefaultResponseType]
         [HttpPost("get-schools")]
-        public async Task<IActionResult> GetSchools(JsonElement jsonElement) 
+        public async Task<IActionResult> GetSchools(JsonElement jsonElement)
         {
             jsonElement.TryGetProperty("areaId", out JsonElement areaId);
             //jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释

+ 8 - 1
TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

@@ -30,6 +30,8 @@ using TEAMModelOS.SDK.Context.BI;
 using TEAMModelOS.SDK.DI.CoreAPI;
 using System.Text;
 using DocumentFormat.OpenXml.Bibliography;
+using Microsoft.Extensions.Hosting;
+using Microsoft.AspNetCore.Hosting;
 
 namespace TEAMModelBI.Controllers.BINormal
 {
@@ -46,8 +48,9 @@ namespace TEAMModelBI.Controllers.BINormal
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly IHttpClientFactory _http;
         private readonly CoreAPIHttpService _coreAPIHttpService;
+        private readonly IWebHostEnvironment _environment; //读取文件
 
-        public BatchAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService) 
+        public BatchAreaController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService, AzureServiceBusFactory serviceBus, IHttpClientFactory http, CoreAPIHttpService coreAPIHttpService, IWebHostEnvironment hostingEnvironment) 
         {
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
@@ -58,6 +61,7 @@ namespace TEAMModelBI.Controllers.BINormal
             _serviceBus = serviceBus;
             _http = http;
             _coreAPIHttpService = coreAPIHttpService;
+            _environment = hostingEnvironment;
         }
 
         /// <summary>
@@ -825,6 +829,9 @@ namespace TEAMModelBI.Controllers.BINormal
 
                 //发送消息分区键
                 string partitionCode = "DelBeforeCopyAbility-mark";
+                //v2通知
+                Teacher targetTeacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"1", new PartitionKey($"Base"));
+                _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "transfer-admin_school", Constant.NotifyType_IES5_Management, new Dictionary<string, object> { { "tmdname", "账号名称" }, { "schooName", "学校名称" }, { "schoolId", $"学校id" }, { "tmdid", "账号id" } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
 
                 //执行复制操作
                 BatchCopyFile batchCopyFile = new();

+ 6 - 2
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -32,9 +32,8 @@ using TEAMModelOS.SDK.Context.Constant;
 using Pipelines.Sockets.Unofficial.Arenas;
 using Microsoft.Identity.Client;
 using TEAMModelOS.SDK.Models.Dtos;
-using static TEAMModelBI.Controllers.BITest.TestController;
-using static TEAMModelBI.Controllers.BISchool.BatchSchoolController;
 using DocumentFormat.OpenXml.Spreadsheet;
+using DocumentFormat.OpenXml.Wordprocessing;
 
 namespace TEAMModelBI.Controllers.BISchool
 {
@@ -433,6 +432,10 @@ namespace TEAMModelBI.Controllers.BISchool
                 else if(upSc.Count == 1)
                     await _dingDing.SendBotMsg($"BI,{_option.Location} \n 单个建校信息:{noticeDD}", GroupNames.成都开发測試群組);
 
+                //v2通知
+                Teacher targetTeacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>($"1", new PartitionKey($"Base"));
+                _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "transfer-admin_school", Constant.NotifyType_IES5_Management, new Dictionary<string, object> { { "tmdname", "账号名称" }, { "schooName", "学校名称" }, { "schoolId", $"学校id" }, { "tmdid", "账号id" } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
+
                 //保存操作记录
                 await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "school-batchAdd", stringBuilder?.ToString(), _dingDing, httpContext: HttpContext);
                 if (schools.Count == foundSchools.biSchools.Count || userScs.Count == foundSchools.biSchools.Count)
@@ -576,6 +579,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     }
 
                     item.assists = await CommonFind.FindSchoolRoles(cosmosClient, item.id, "assist");
+                    item.scAdmin = await CommonFind.FindSchoolRoles(cosmosClient, item.id, "admin");                    
                     item.lessonCount = await CommonFind.GetSqlValueCount(cosmosClient, "School", $"select value(count(c.id)) from c ", $"LessonRecord-{item.id}");
                 }
 

+ 11 - 0
TEAMModelBI/Controllers/BITest/TestController.cs

@@ -1460,6 +1460,17 @@ namespace TEAMModelBI.Controllers.BITest
 
         }
 
+        [HttpPost("get-noticev2")]
+        public async Task<IActionResult> SetNoticeV2()
+        {
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            //v2通知
+            Teacher targetTeacher = await cosmosClient.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>("1636016499", new PartitionKey("Base"));
+            _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = targetTeacher.id, name = targetTeacher.name, code = targetTeacher.lang } }, "create-school", Constant.NotifyType_IES5_Management, new Dictionary<string, object> { { "tmdname", $"{targetTeacher.name}" }, { "schooName", "商务智能学校(BI)" }, { "schoolId", "cswznb" }, { "tmdid", $"{targetTeacher.id}" } }, _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
+
+
+            return Ok(new { state = RespondCode.Ok });
+        }
 
         public class linqTest
         {

+ 2 - 16
TEAMModelBI/Lang/en-us.json

@@ -1,18 +1,4 @@
 {
-  "request_school": [ "Apply to join school", "{tmdname}({tmdid}) applying to join {schooName}." ],  
-  "invite_school": [ "Invite to join school", "{schooName} has invited you to join." ], 
-  "remove_school": [ "Remove from school", "{schooName} removed you from the school's teacher list." ],  
-  "request-join_school": [ "Agree to join school", "{schooName} has agreed you to join the school." ], 
-  "invite-join_school": [ "Accepting join school invitation", "{tmdname} has accepted an invitation to join {schooName}." ], 
-  "coedit_syllabus": [ "Invite to co-edit syllabus", "{tmdname} invites you to co-edit school-based syllabus, Volume name: {volumeName}, Node name: {syllabusName}." ],  
-  "share_syllabus": [ "Receive shared syllabus", "{tmdname} shared personal syllabus with you, Volume name: {volumeName}, Node name: {syllabusName}." ],  
-  "transfer-admin_school": [ "Transfer administrator", "{tmdname} will transfer the administrator of {schooName} to you." ],  
-  "scoring-arb_school": [ "Assign arbitration exam scoring task", "{tmdname} of {schoolname} has assign you an arbitration exam scoring task." ],  
-  "scoring-err_school": [ "Assign abnormal exam paper grading task", "{tmdname} of {schoolname} has assign you an abnormal exam paper grading task." ],  
-  "scoring-mark_school": [ "Assign exam paper grading task", "{tmdname} of {schoolname} has assign you an exam paper grading task." ],  
-  "scan-join_groupList": [ "Join course notice", "{tmdname} join the {groupListName} course via QRcode scanning" ], 
-  "scan-join_school": [ "Join school notice", "{tmdname} join school, {schoolName}, via QRcode scanning" ],  
-  "submitanswer_homework": [ "Homework submission notice", "{tmdname} has submitted a homework({homeworkName})" ],  
-  "expire-school_lessonRecord": [ "Lesson record expiration notice", "Your lesson record, {lessonRecordName}, on {schoolname} will expire at {expireTime}" ],  
-  "expire-private_lessonRecord": [ "Lesson record expiration notice", "Your lesson record, {lessonRecordName} will expire at {expireTime}" ]  
+  "create-school": [ "Create schools in batches", "{tmdname}You successfully created schools in batch with Bi" ],
+  "copy-file_area": [ "Batch copy file start", "{tmdname}您用BI创区成功开始复制区域文件" ]
 }

+ 11 - 9
TEAMModelBI/Lang/zh-cn.json

@@ -1,18 +1,20 @@
 {
   "request_school": [ "申请加入学校通知", "{tmdname}({tmdid})申请加入{schooName}。" ],
   "invite_school": [ "邀请加入学校通知", "{schooName}邀请您加入学校。" ],
-  "remove_school": [ "从学校移除通知", "{schooName}将您从学校教师名单中移除。" ], 
+  "remove_school": [ "从学校移除通知", "{schooName}将您从学校教师名单中移除。" ],
   "request-join_school": [ "同意申请加入学校通知", "{schooName}已同意您申请加入学校。" ],
-  "invite-join_school": [ "同意邀请加入学校通知", "{tmdname}已接受加入{schooName}的邀请。" ], 
-  "coedit_syllabus": [ "邀请共编课纲通知", "{tmdname}邀请你参与共编校本课纲,册别名称:{volumeName},课纲节点名称:{syllabusName}。" ], 
+  "invite-join_school": [ "同意邀请加入学校通知", "{tmdname}已接受加入{schooName}的邀请。" ],
+  "coedit_syllabus": [ "邀请共编课纲通知", "{tmdname}邀请你参与共编校本课纲,册别名称:{volumeName},课纲节点名称:{syllabusName}。" ],
   "share_syllabus": [ "课纲分享接收通知", "{tmdname}向您分享了个人课纲,册别名称:{volumeName},课纲节点名称:{syllabusName}。" ],
-  "transfer-admin_school": [ "管理员移交通知", "{tmdname}将{schooName}的管理员移交给您。" ], 
-  "scoring-arb_school": [ "仲裁卷阅卷任务通知", "{schoolname}的{tmdname}向您发送了仲裁卷阅卷任务。" ], 
+  "transfer-admin_school": [ "管理员移交通知", "{tmdname}将{schooName}的管理员移交给您。" ],
+  "scoring-arb_school": [ "仲裁卷阅卷任务通知", "{schoolname}的{tmdname}向您发送了仲裁卷阅卷任务。" ],
   "scoring-err_school": [ "异常卷阅卷任务通知", "{schoolname}的{tmdname}向您发送了异常卷阅卷任务。" ],
   "scoring-mark_school": [ "普通阅卷任务通知", "{schoolname}的{tmdname}向您发送了普通卷阅卷任务。" ],
-  "scan-join_groupList": [ "扫码加入名单通知", "{tmdname}扫码加入名单,名单:{groupListName}" ], 
+  "scan-join_groupList": [ "扫码加入名单通知", "{tmdname}扫码加入名单,名单:{groupListName}" ],
   "scan-join_school": [ "扫码加入学校通知", "{tmdname}扫码加入学校,学校名称:{schoolName}" ],
-  "submitanswer_homework": [ "作业提交通知", "{tmdname}已提交作业,作业名称({homeworkName})" ], 
-  "expire-school_lessonRecord": [ "课例到期通知", "您在{schoolname}的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ], 
-  "expire-private_lessonRecord": [ "课例到期通知", "您的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ] 
+  "submitanswer_homework": [ "作业提交通知", "{tmdname}已提交作业,作业名称({homeworkName})" ],
+  "expire-school_lessonRecord": [ "课例到期通知", "您在{schoolname}的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ],
+  "expire-private_lessonRecord": [ "课例到期通知", "您的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ],
+  "create-school": [ "批量创建学校", "{tmdname}您用BI批量创建学校成功" ],
+  "copy-file_area": [ "批复制文件开始", "{tmdname}您用BI创区成功开始复制区域文件" ]
 }

+ 2 - 16
TEAMModelBI/Lang/zh-tw.json

@@ -1,18 +1,4 @@
 {
-  "request_school": [ "申请加入学校通知", "{tmdname}({tmdid})申请加入{schooName}。" ], 
-  "invite_school": [ "邀请加入学校通知", "{schooName}邀请您加入学校。" ], 
-  "remove_school": [ "从学校移除通知", "{schooName}将您从学校教师名单中移除。" ],  
-  "request-join_school": [ "同意申请加入学校通知", "{schooName}已同意您申请加入学校。" ],  
-  "invite-join_school": [ "同意邀请加入学校通知", "{tmdname}已接受加入{schooName}的邀请。" ],  
-  "coedit_syllabus": [ "邀请共编课纲通知", "{tmdname}邀请你参与共编校本课纲,册别名称:{volumeName},课纲节点名称:{syllabusName}。" ], 
-  "share_syllabus": [ "课纲分享接收通知", "{tmdname}向您分享了个人课纲,册别名称:{volumeName},课纲节点名称:{syllabusName}。" ], 
-  "transfer-admin_school": [ "管理员移交通知", "{tmdname}将{schooName}的管理员移交给您。" ],  
-  "scoring-arb_school": [ "仲裁卷阅卷任务通知", "{schoolname}的{tmdname}向您发送了仲裁卷阅卷任务。" ], 
-  "scoring-err_school": [ "异常卷阅卷任务通知", "{schoolname}的{tmdname}向您发送了异常卷阅卷任务。" ],  
-  "scoring-mark_school": [ "普通阅卷任务通知", "{schoolname}的{tmdname}向您发送了普通卷阅卷任务。" ],  
-  "scan-join_groupList": [ "扫码加入名单通知", "{tmdname}扫码加入名单,名单:{groupListName}" ],  
-  "scan-join_school": [ "扫码加入学校通知", "{tmdname}扫码加入学校,学校名称:{schoolName}" ],  
-  "submitanswer_homework": [ "作业提交通知", "{tmdname}已提交作业,作业名称({homeworkName})" ], 
-  "expire-school_lessonRecord": [ "课例到期通知", "您在{schoolname}的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ],  
-  "expire-private_lessonRecord": [ "课例到期通知", "您的课例将在{expireTime}到期,课例名称:{lessonRecordName}" ]  
+  "create-school": [ "批量創建學校", "{tmdname}您用BI批量創建學校成功" ],
+  "copy-file_area": [ "批復制文件開始", "{tmdname}您用BI创区成功开始复制区域文件" ]
 }

+ 1 - 0
TEAMModelBI/Models/AssistSchool.cs

@@ -38,6 +38,7 @@ namespace TEAMModelBI.Models
         /// </summary>
         public List<Period> period { get; set; }
         public List<SchoolTeacherRoles> assists { get; set; } = new List<SchoolTeacherRoles>();
+        public List<SchoolTeacherRoles> scAdmin { get; set; } = new List<SchoolTeacherRoles>();
         //public int serial { get; set; } //软体
         //public int service { get; set; } //服务
         //public int hard { get; set; } //硬体