Ver Fonte

查询,

CrazyIter_Bin há 3 anos atrás
pai
commit
16f873daf0

+ 10 - 2
TEAMModelOS.SDK/Models/Cosmos/Common/GroupList.cs

@@ -34,6 +34,10 @@ namespace TEAMModelOS.SDK.Models
         //学生所在的学校
         public string code { get; set; }
         /// <summary>
+        /// 名称
+        /// </summary>
+        public string name { get; set; }
+        /// <summary>
         ///类型 1 tmdid,2 student
         /// </summary>
         public int type { get; set; }
@@ -42,9 +46,13 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public string picture { get; set; }
         /// <summary>
-        /// IRS WebIRS编号。
+        ///座号
         /// </summary>
         public string no { get; set; }
-        public string role { get; set; }
+        /// <summary>
+        /// IRS WebIRS编号。
+        /// </summary>
+        public string irs { get; set; }
+        public string tag { get; set; }
     }
 }

+ 2 - 1
TEAMModelOS/Controllers/Item/ItemController.cs

@@ -17,6 +17,7 @@ using Azure.Messaging.ServiceBus;
 using Microsoft.Extensions.Configuration;
 using TEAMModelOS.Services.Common;
 using HTEXLib.COMM.Helpers;
+using StackExchange.Redis;
 
 namespace TEAMModelOS.Controllers
 {
@@ -102,7 +103,7 @@ namespace TEAMModelOS.Controllers
                     School school =await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{schoolCode}", new PartitionKey("Base"));
                     List<string> nocachePeriods = new List<string>();
                     foreach (var period in school.period) {
-                        var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{schoolCode}", $"{period.id}");
+                        var value = await _azureRedis.GetRedisClient(8).HashGetAsync($"ItemCond:{schoolCode}", $"{period.id}"); 
                         ItemCond itemCond = null;
                         if (value != default && !value.IsNullOrEmpty)
                         {

+ 51 - 0
TEAMModelOS/Controllers/School/GroupListController.cs

@@ -19,6 +19,8 @@ using Azure.Messaging.ServiceBus;
 using Microsoft.Extensions.Configuration;
 using TEAMModelOS.Filter;
 using HTEXLib.COMM.Helpers;
+using System.Text;
+
 namespace TEAMModelOS.Controllers
 {
     [ProducesResponseType(StatusCodes.Status200OK)]
@@ -46,12 +48,61 @@ namespace TEAMModelOS.Controllers
         //处理通用名单
         [ProducesDefaultResponseType]
         [AuthToken(Roles = "teacher,admin")]
+        [HttpPost("get-grouplists-members")]
+        public async Task<IActionResult> GetGrouplistsMembers(JsonElement json)
+        {
+            try
+            {
+                if (!json.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
+                if (!json.TryGetProperty("schoolId", out JsonElement _schoolId)) return BadRequest();
+                if (!json.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
+                if (!json.TryGetProperty("type", out JsonElement type)) return BadRequest();
+                json.TryGetProperty("periodId", out JsonElement periodId);
+                json.TryGetProperty("no", out JsonElement no);
+
+                var client = _azureCosmos.GetCosmosClient();
+            }
+            catch (CosmosException)
+            {
+            }
+            return Ok();
+        }
+        //处理通用名单
+        [ProducesDefaultResponseType]
+        [AuthToken(Roles = "teacher,admin")]
         [HttpPost("get-grouplists")]
         public async Task<IActionResult> GetGrouplists(JsonElement json)
         {
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
+                if (!json.TryGetProperty("tmdid", out JsonElement _tmdid)) return BadRequest();
+                if (!json.TryGetProperty("schoolId", out JsonElement _schoolId)) return BadRequest();
+                if (!json.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
+                if (!json.TryGetProperty("type", out JsonElement type)) return BadRequest();
+                json.TryGetProperty("periodId", out JsonElement periodId);
+                json.TryGetProperty("no", out JsonElement no);
+                StringBuilder sql = new StringBuilder($"SELECT distinct c.id,c.code,c.name,c.no,c.periodId,c.scope,c.school,c.creatorId,c.type FROM c where c.type='{type}'");
+                if (!string.IsNullOrEmpty($"{periodId}")) {
+                    sql.Append($" and c.periodId='{periodId}'");
+                }
+                if (!string.IsNullOrEmpty($"{no}"))
+                {
+                    sql.Append($" and c.no='{no}'");
+                }
+                List<dynamic> groups = new List<dynamic>();
+                string tbname = "Teacher";
+                string code =$"GroupList";
+                if ($"{scope}".Equals("school", StringComparison.OrdinalIgnoreCase)) {
+                    tbname = "School";
+                    code = $"GroupList-{_schoolId}";
+                }
+                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, tbname).GetItemQueryIterator<dynamic>(queryText: sql.ToString(),
+                 requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))
+                {
+                    groups.Add(item);
+                }
+                return Ok(new { groups });
             }
             catch (CosmosException)
             {

+ 1 - 0
TEAMModelOS/Controllers/Third/ScController.cs

@@ -504,6 +504,7 @@ namespace TEAMModelOS.Controllers.Third
             parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("ProjectID", "22");
+            parameterMap.Add("ProjectItemID", "22");
             parameterMap.Add("SchoolID", "200001");
             ScsResult GetSchoolDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
             GetSchoolDiagnosis.code = Code;