CrazyIter_Bin 2 years ago
parent
commit
2ab70ef106

+ 0 - 74
TEAMModelOS/Controllers/OpenApi/Business/BizCustomizeController.cs

@@ -1,74 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Configuration;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK;
-using TEAMModelOS.Models;
-using Microsoft.Extensions.Options;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Models.Dtos;
-using TEAMModelOS.SDK.Context.Constant;
-using System.Collections.Generic;
-using System.Text.Json;
-using TEAMModelOS.SDK.Extension;
-using Top.Api;
-using TEAMModelOS.SDK.Models.Cosmos.Student;
-
-namespace TEAMModelOS.Controllers
-{
-    /// <summary>
-    /// 企业定制接口
-    /// </summary>
-    [Route("business")]
-    [ApiController]
-    public class BizCustomizeController : ControllerBase
-    {
-        public AzureCosmosFactory _azureCosmos;
-        private readonly AzureStorageFactory _azureStorage;
-        private readonly AzureRedisFactory _azureRedis;
-        private readonly DingDing _dingDing;
-        private readonly Option _option;
-        private readonly IConfiguration _configuration;
-        private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly AzureServiceBusFactory _serviceBus;
-        public BizCustomizeController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, DingDing dingDing, CoreAPIHttpService coreAPIHttpService, IOptionsSnapshot<Option> option, IConfiguration configuration)
-        {
-            _azureCosmos = azureCosmos;
-            _azureStorage = azureStorage;
-            _azureRedis = azureRedis;
-            _dingDing = dingDing;
-            _option = option?.Value;
-            _configuration = configuration;
-            _coreAPIHttpService = coreAPIHttpService;
-            _serviceBus = serviceBus;
-        }
-
-
-        /// <summary>
-        /// 设置学生画像
-        /// </summary>
-        /// <param name="portrait"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("upsert-student-portrait")]
-        public async Task<IActionResult> UpsertStudentPortrait(JsonElement jsonElement)
-        {
-            ResponseData<dynamic> responseData = null;
-            if (!jsonElement.TryGetProperty("schoolCode", out JsonElement schoolCode)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "schoolCode为空!" });
-            if (!jsonElement.TryGetProperty("studentId", out JsonElement studentId)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "studentId为空!" });
-            if (!jsonElement.TryGetProperty("name", out JsonElement name)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "name为空!" });
-            if (!jsonElement.TryGetProperty("classId", out JsonElement classId)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "classId为空!" });
-            if (!jsonElement.TryGetProperty("periodId", out JsonElement periodId)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "periodId为空!" });
-            if (!jsonElement.TryGetProperty("subjectId", out JsonElement subjectId)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "subjectId为空!" });
-            if (!jsonElement.TryGetProperty("semesterData", out JsonElement semesterData)) return Ok(responseData = new() { code = RespondCode.ParamsError, msg = "semesterData为空!" });
-            List<SemesterData> semesterDatas = semesterData.ToObject<List<SemesterData>>();
-
-
-
-
-            return Ok(responseData = new() { code = RespondCode.Ok, msg = "成功" });
-        }
-
-
-    }
-}

+ 2 - 2
TEAMModelOS/Controllers/OpenApi/Business/BizKnowledgeController.cs

@@ -54,8 +54,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetKnowledges(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetKnowledges(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetKnowledges(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
     }
 }

+ 67 - 0
TEAMModelOS/Controllers/OpenApi/Business/BizOverallEducationController.cs

@@ -0,0 +1,67 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK;
+using TEAMModelOS.Models;
+using Microsoft.Extensions.Options;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Models.Dtos;
+using TEAMModelOS.SDK.Context.Constant;
+using System.Collections.Generic;
+using System.Text.Json;
+using TEAMModelOS.SDK.Extension;
+using Top.Api;
+using TEAMModelOS.SDK.Models.Cosmos.Student;
+using DocumentFormat.OpenXml.Math;
+using DocumentFormat.OpenXml.Wordprocessing;
+using TEAMModelOS.Filter;
+
+namespace TEAMModelOS.Controllers
+{
+    /// <summary>
+    /// 企业定制接口
+    /// </summary>
+    [Route("business")]
+    [ApiController]
+    public class BizOverallEducationController : ControllerBase
+    {
+        public AzureCosmosFactory _azureCosmos;
+        private readonly AzureStorageFactory _azureStorage;
+        private readonly AzureRedisFactory _azureRedis;
+        private readonly DingDing _dingDing;
+        private readonly Option _option;
+        private readonly IConfiguration _configuration;
+        private readonly CoreAPIHttpService _coreAPIHttpService;
+        private readonly AzureServiceBusFactory _serviceBus;
+        public BizOverallEducationController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, DingDing dingDing, CoreAPIHttpService coreAPIHttpService, IOptionsSnapshot<Option> option, IConfiguration configuration)
+        {
+            _azureCosmos = azureCosmos;
+            _azureStorage = azureStorage;
+            _azureRedis = azureRedis;
+            _dingDing = dingDing;
+            _option = option?.Value;
+            _configuration = configuration;
+            _coreAPIHttpService = coreAPIHttpService;
+            _serviceBus = serviceBus;
+        }
+
+
+        /// <summary>
+        /// 设置学生画像
+        /// </summary>
+        /// <param name="portrait"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("upsert-student-portrait")]
+        [ApiToken(Auth = "1901", Name = "设置学生全面教育画像", TName = "設置學生全面教育畫像", EName = "Set up students overall education portrait", RWN = "W", Limit = false)]
+        public async Task<IActionResult> UpsertStudentPortrait(JsonElement jsonElement)
+        {
+            var (id, school) = HttpContext.GetApiTokenInfo();
+            var responseData = await OpenApiService.UpsertStudentPortrait(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
+        }
+
+
+    }
+}

+ 4 - 4
TEAMModelOS/Controllers/OpenApi/Business/BizSyllabusController.cs

@@ -57,8 +57,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetSyllabus(JsonElement jsonElement) 
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetSyllabus(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetSyllabus(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
 
         /// <summary>
@@ -72,8 +72,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetVolumes(JsonElement jsonElement) 
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetVolumes(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetVolumes(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
 
     }

+ 46 - 1
TEAMModelOS/Controllers/OpenApi/OpenApiService.cs

@@ -29,6 +29,7 @@ using Azure.Messaging.ServiceBus;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK.Models.Service;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BINormal;
+using TEAMModelOS.SDK.Models.Cosmos.Student;
 
 namespace TEAMModelOS.Controllers
 {
@@ -1330,7 +1331,6 @@ namespace TEAMModelOS.Controllers
                 {
                     knowledges.Add(new {  item.periodId,  item.subjectId,  item.points,  item.blocks, item.id });
                 }
-
                
                 if (knowledges.Any())
                 {
@@ -1349,7 +1349,52 @@ namespace TEAMModelOS.Controllers
                 return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务器错误!" };
             }
         }
+        /// <summary>
+        /// 查询知识
+        /// [ApiToken(Auth = "1701", Name = "查询知识点",TName ="",EName ="", RWN = "R", Limit = false)]
+        /// </summary>
+        /// <param name="_azureCosmos"></param>
+        /// <param name="_dingDing"></param>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        public static async Task<ResponseData<dynamic>> UpsertStudentPortrait(AzureCosmosFactory _azureCosmos, DingDing _dingDing, string bizId, string school, JsonElement json) {
+            try {
+                ResponseData<dynamic> responseData = new();
+                var client = _azureCosmos.GetCosmosClient();
+                if (!json.TryGetProperty("schoolCode", out JsonElement schoolCode))
+                {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "schoolCode为空!" };
+                }
+                if (!json.TryGetProperty("studentId", out JsonElement studentId)) {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "studentId为空!" };
+                }
+                if (!json.TryGetProperty("name", out JsonElement name)) {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "name为空!" };
+                }
+                if (!json.TryGetProperty("classId", out JsonElement classId)) {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "classId为空!" };
+                }
+                if (!json.TryGetProperty("periodId", out JsonElement periodId)) { 
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "periodId为空!" }; 
+                }
+                if (!json.TryGetProperty("subjectId", out JsonElement subjectId)) {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "subjectId为空!" };
+                }
+                if (!json.TryGetProperty("semesterData", out JsonElement semesterData)) {
+                    return responseData = new() { code = RespondCode.ParamsError, msg = "semesterData为空!" };
+                }
 
+                if(!$"{subjectId}".Equals("") && !$"{subjectId}".Equals("") && !$"{subjectId}".Equals("") && !$"{subjectId}".Equals(""))
+                {
+
+                }
+                List<SemesterData> semesterDatas = semesterData.ToObject<List<SemesterData>>();
+                return responseData = new() { code = RespondCode.Ok, msg = "成功" };
+            } catch (Exception ex) {
+                await _dingDing.SendBotMsg($"OpenApi,{Environment.GetEnvironmentVariable("Option:Location")} OpenApiService/UpsertStudentPortrait()  参数:bizId:{bizId},school:{school},参数json:{json.ToJsonString()} \n  {ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+                return new ResponseData<dynamic>() { code = RespondCode.Error, msg = "服务器错误!" };
+            }
+        }
 
         public static void GenApiTableRecord(AzureStorageFactory azureStorage)
         {

+ 2 - 2
TEAMModelOS/Controllers/OpenApi/OpenSchool/ScKnowledgeController.cs

@@ -48,8 +48,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetKnowledges(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetKnowledges(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetKnowledges(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
 
     }

+ 4 - 4
TEAMModelOS/Controllers/OpenApi/OpenSchool/ScSyllabusController.cs

@@ -48,8 +48,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetSyllabus(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetSyllabus(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetSyllabus(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
 
         /// <summary>
@@ -63,8 +63,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetVolumes(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetVolumes(_azureCosmos, _dingDing, id, school, jsonElement);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetVolumes(_azureCosmos, _dingDing, id, school, jsonElement);
+            return Ok(new { responseData });
         }
     }
 }

+ 2 - 2
TEAMModelOS/Controllers/OpenApi/OpenSchool/ScTeacherController.cs

@@ -47,8 +47,8 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> GetTeacherList(JsonElement json)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
-            var responseDate = await OpenApiService.GetTeacherList(_azureCosmos, _coreAPIHttpService, _dingDing, id, school, json);
-            return Ok(new { responseDate });
+            var responseData = await OpenApiService.GetTeacherList(_azureCosmos, _coreAPIHttpService, _dingDing, id, school, json);
+            return Ok(new { responseData });
         }