فهرست منبع

新增政策文件等,

CrazyIter_Bin 3 سال پیش
والد
کامیت
6a3d967abf

+ 25 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Homework.cs

@@ -107,4 +107,29 @@ namespace TEAMModelOS.SDK.Models
         public string hw { get; set; }
         public long hwTime { get; set; }
     }
+
+    /*
+     let homework = {
+        id: 'xxxx',// ID由前端创建。因为要保存先保存BLOB
+        name: '作业名称',
+        code: '1595321354',
+        creatorId:'1595321354',
+        school:'hbcn',
+        scope:'private',
+        classes: [],
+        stuLists: [],
+        targets: [],
+        endTime: 1629561599999,
+        startTime: 1629561599999,
+        description: '作业描述',
+        progress: 'finish',//状态
+        allowSupply: false,//是否允许补交作业
+        typeLimit: [],//空数组代表无格式限制,有则是限制的上传格式后缀集合,比如['docx','doc']
+        attachments: [{
+        name: '附件名称.pdf',
+        url: 'xxxxxx',
+        size: 2048
+        }],//附件信息
+     }
+     */
 }

+ 4 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Inner/ListChange.cs

@@ -40,5 +40,9 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         public string school { get; set; }
         public string creatorId { get; set; }
         public string type { get; set; }
+        /// <summary>
+        /// 当状态码大于等于0则表示正常操作,只有当状态码=-1的时候
+        /// </summary>
+        public int listStatus { get; set; } = 1;
     }
 }

+ 33 - 0
TEAMModelOS.SDK/Models/Cosmos/School/StandardFile.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Models
+{
+    public class StandardFile : CosmosEntity
+    {
+        //id为区域编码,pk='StandardFile',code="StandardFile"
+        public StandardFile()
+        {
+            pk = "StandardFile";
+            code = "StandardFile";
+        }
+        public string standard { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<Policy> policy { get; set; }
+        public List<Policy> resource { get; set; }
+    }
+    public class Policy {
+        public string Tag { get; set; }
+        public List<Link> links { get; set; }
+    }
+    public class Link { 
+        public string link { get; set; }
+        public string thum { get; set; }
+        public string title { get; set; }
+        public string subtitle { get; set; }
+        public string time { get; set; }
+    }
+}

+ 65 - 0
TEAMModelOS/Controllers/Research/StandardFileController.cs

@@ -0,0 +1,65 @@
+using Azure.Cosmos;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.Json;
+using System.Threading.Tasks;
+using TEAMModelOS.Filter;
+using TEAMModelOS.Models;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Models;
+
+namespace TEAMModelOS.Controllers
+{
+    [ProducesResponseType(StatusCodes.Status200OK)]
+    [ProducesResponseType(StatusCodes.Status400BadRequest)]
+    //[Authorize(Roles = "IES5")]
+    [Route("research/ability")]
+    [ApiController]
+    public class StandardFileController : ControllerBase
+    {
+        private readonly AzureCosmosFactory _azureCosmos;
+        private readonly SnowflakeId _snowflakeId;
+        private readonly DingDing _dingDing;
+        private readonly Option _option;
+        public StandardFileController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option)
+        {
+            _azureCosmos = azureCosmos;
+            _snowflakeId = snowflakeId;
+            _dingDing = dingDing;
+            _option = option?.Value; ;
+        }
+
+        /*
+         {"abilityId":"册别id:0baf00db-0768-4b62-a8f7-280f6bcebf71","scope":"school","abilityCode":"册别分区键"}
+        */
+        /// <summary>
+        /// 查找能力点 
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("find-id")]
+        [AuthToken(Roles = "teacher,student,admin,area")]
+        public async Task<IActionResult> FindId(JsonElement request)
+        {
+           
+            var client = _azureCosmos.GetCosmosClient();
+            if (!request.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
+            StandardFile file = null;
+            try
+            {
+                await  client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<StandardFile>($"{_areaId}",partitionKey:new Azure.Cosmos.PartitionKey ("StandardFile"));
+                return Ok(new {});
+            }
+            catch (CosmosException ex)
+            { 
+               
+                return Ok(new { file });
+            }
+        }
+    }
+}