CrazyIter_Bin 3 anos atrás
pai
commit
4632e8bda8

+ 9 - 5
TEAMModelAPI/Controllers/School/GroupListController.cs

@@ -40,7 +40,8 @@ namespace TEAMModelAPI.Controllers
         private readonly Option _option;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        public GroupListController(CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration)
+        private readonly AzureServiceBusFactory _serviceBus;
+        public GroupListController(CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, AzureServiceBusFactory serviceBus)
         {
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
@@ -49,6 +50,7 @@ namespace TEAMModelAPI.Controllers
             _option = option?.Value;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService;
+            _serviceBus = serviceBus;
         }
 
         /*
@@ -181,7 +183,7 @@ namespace TEAMModelAPI.Controllers
         public async Task<IActionResult> ImportClassMembers(JsonElement json)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            if (!json.TryGetProperty("periodId", out JsonElement _periodId)) { return Ok(new { error = 1, msg = "学段信息错误!" }); }
+            if (!json.TryGetProperty("periodId", out JsonElement _periodId)) { return Ok(new { error = 2, msg = "学段信息错误!" }); }
             if (json.TryGetProperty("students", out JsonElement _students)) { return Ok(new { error = 1, msg = "学生列表格式错误!" }); } 
             if (_students.ValueKind.Equals(JsonValueKind.Array))
             {
@@ -190,17 +192,19 @@ namespace TEAMModelAPI.Controllers
                 if (period != null)
                 {
                     List<Student> webStudents = _students.ToObject<List<Student>>();
+                    List<Student> preStudents = await StudentService.GeStudentData(_azureCosmos, school, webStudents);
+                    var retUpsert = await StudentService.upsertStudents(_azureCosmos, _dingDing, _option, school, json.GetProperty("students").EnumerateArray());
+                    await StudentService.CheckStudent(_serviceBus, _configuration, _azureCosmos, school, webStudents, preStudents);
+                    return this.Ok(new { code = $"Base-{school}", students = retUpsert.studs, retUpsert.classDuplNos, retUpsert.errorIds });
                 }
                 else 
                 {
-                    return Ok(new { error = 1, msg = "学段信息错误!" }); 
+                    return Ok(new { error = 2, msg = "学段信息错误!" }); 
                 }
             }
             else {
                 return Ok(new { error = 1, msg = "学生列表格式错误" });
             }
-            
-         
             return Ok();
         }
 

+ 1 - 1
TEAMModelOS.FunctionV4/TEAMModelOS.FunctionV4.csproj

@@ -30,7 +30,7 @@
 		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.0.0-preview2" />
 		<!--<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="3.0.9" />-->
 		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="5.0.0" />
-		<PackageReference Include="SPS.SBCompressor" Version="0.5.2" />
+		<PackageReference Include="SPS.SBCompressor" Version="0.6.0" />
 		<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
 	</ItemGroup>
 	<ItemGroup>

+ 9 - 9
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -16,23 +16,23 @@
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.2.0" />
     <PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
     <PackageReference Include="Azure.Identity" Version="1.5.0" />
-    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.6.0" />
+    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.7.0" />
     <PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
-    <PackageReference Include="Azure.Storage.Blobs.Batch" Version="12.7.0" />
-    <PackageReference Include="Azure.Storage.Queues" Version="12.8.0" />
+    <PackageReference Include="Azure.Storage.Blobs.Batch" Version="12.8.0" />
+    <PackageReference Include="Azure.Storage.Queues" Version="12.9.0" />
     <PackageReference Include="ClouDASLibx" Version="1.2.7" />
     <PackageReference Include="DocumentFormat.OpenXml" Version="2.15.0" />
-    <PackageReference Include="HtmlAgilityPack" Version="1.11.39" />
-    <PackageReference Include="Lib.AspNetCore.ServerSentEvents" Version="7.0.0" />
-    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
+    <PackageReference Include="HtmlAgilityPack" Version="1.11.42" />
+    <PackageReference Include="Lib.AspNetCore.ServerSentEvents" Version="8.1.0" />
+    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
     <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
-    <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.1" />
-    <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.2" />
+    <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.3" />
+    <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.3" />
     <PackageReference Include="Microsoft.Identity.Client" Version="4.39.0" />
     <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
     <PackageReference Include="NUnit" Version="3.13.2" />
     <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
-    <PackageReference Include="StackExchange.Redis" Version="2.2.88" />
+    <PackageReference Include="StackExchange.Redis" Version="2.5.43" />
     <PackageReference Include="SvgNet" Version="2.2.2" />
     <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
     <PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="2.0.0-preview" />