Browse Source

Merge branch 'develop' into cmy/develop-bi

chenmy 2 years ago
parent
commit
4eefdef1e1

+ 49 - 42
TEAMModelBI/Controllers/Census/SchoolController.cs

@@ -493,6 +493,8 @@ namespace TEAMModelBI.Controllers.Census
             return Ok(new { state = RespondCode.Ok, scCnt = scIds.Count, tchCnt, stuCnt, allCnt = tLessCnt + tActCnt, tLessCnt, tActCnt });
         }
 
+        #region   新的统计接口
+
         /// <summary>
         /// 学校统计     
         /// 新的数据结构
@@ -1007,52 +1009,11 @@ namespace TEAMModelBI.Controllers.Census
             return Ok(new { state = RespondCode.Ok, areaScStats, schoolInfos, weekLess, assists = assits.Where((w, i) => assits.FindIndex(s => s.id.Equals(w.id)) == i).ToList(), saless = saless.Where((w, i) => saless.FindIndex(f => f.id.Equals(w.id)) == i).ToList() });
         }
 
-
         /// <summary>
-        /// 学校信息中间件查询接口
+        /// 所有区级的统计
         /// </summary>
         /// <param name="jsonElement"></param>
         /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("get-scinfos")]
-        public async Task<IActionResult> GetScInfos(JsonElement jsonElement)
-        {
-            var cosmosClient = _azureCosmos.GetCosmosClient();
-            jsonElement.TryGetProperty("role", out JsonElement role);
-            jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
-            jsonElement.TryGetProperty("areaId", out JsonElement areaId);
-
-            StringBuilder sql = new($"select value(c) from c");
-
-            if (!string.IsNullOrEmpty($"{role}") && !string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{areaId}"))
-            {
-                switch ($"{role}")
-                {
-                    case "assist":
-                        sql.Append($" join a in c.assist where a.id='{tmdId}'");
-                        break;
-                    case "sales":
-                        sql.Append($" join a in c.sales where a.id='{tmdId}'");
-                        break;
-                }
-            }
-
-            if (!string.IsNullOrEmpty($"{areaId}") && !string.IsNullOrEmpty($"{role}"))
-            {
-                sql.Append($" where c.areaId ='{areaId}'");
-            }
-
-            //List<string> scId = await CommonFind.FindScIds(cosmosClient, "select value(c.id) from c ", "Base");
-
-            List<BIRelation> scInfos = new();
-            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<BIRelation>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
-            {
-                scInfos.Add(item);
-            }
-
-            return Ok(new { state = RespondCode.Ok, allCnt = scInfos.Count, scInfos });
-        }
-
         [ProducesDefaultResponseType]
         [HttpPost("get-allscstats")]
         public async Task<IActionResult> GetAllAreaStats(JsonElement jsonElement)
@@ -1150,6 +1111,52 @@ namespace TEAMModelBI.Controllers.Census
             return Ok(new { state = RespondCode.Ok, allScStats });
         }
 
+        #endregion   新的统计接口
+
+        /// <summary>
+        /// 学校信息中间件查询接口
+        /// </summary>
+        /// <param name="jsonElement"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("get-scinfos")]
+        public async Task<IActionResult> GetScInfos(JsonElement jsonElement)
+        {
+            var cosmosClient = _azureCosmos.GetCosmosClient();
+            jsonElement.TryGetProperty("role", out JsonElement role);
+            jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
+            jsonElement.TryGetProperty("areaId", out JsonElement areaId);
+
+            StringBuilder sql = new($"select value(c) from c");
+
+            if (!string.IsNullOrEmpty($"{role}") && !string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{areaId}"))
+            {
+                switch ($"{role}")
+                {
+                    case "assist":
+                        sql.Append($" join a in c.assist where a.id='{tmdId}'");
+                        break;
+                    case "sales":
+                        sql.Append($" join a in c.sales where a.id='{tmdId}'");
+                        break;
+                }
+            }
+
+            if (!string.IsNullOrEmpty($"{areaId}") && !string.IsNullOrEmpty($"{role}"))
+            {
+                sql.Append($" where c.areaId ='{areaId}'");
+            }
+
+            //List<string> scId = await CommonFind.FindScIds(cosmosClient, "select value(c.id) from c ", "Base");
+
+            List<BIRelation> scInfos = new();
+            await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<BIRelation>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("BIRel") }))
+            {
+                scInfos.Add(item);
+            }
+
+            return Ok(new { state = RespondCode.Ok, allCnt = scInfos.Count, scInfos });
+        }
 
 
         /// <summary>

+ 3 - 3
TEAMModelOS.SDK/Context/Attributes/Filter/ApiTokenAttribute.cs

@@ -175,8 +175,8 @@ namespace TEAMModelOS.Filter
                             {
                                 issuer = keys[3];
                             }
-                            //if (iss.Equals(issuer))
-                            //{
+                            if (iss.Equals(issuer))
+                            {
                                 //aud  受众
                                 id = jwt.Payload.Sub;//主题,又是应用APP,或者企业id 
                                 jti = jwt.Payload.Jti;//jwt唯一标识
@@ -303,7 +303,7 @@ namespace TEAMModelOS.Filter
                                     {
                                     }
                                 }
-                            //}
+                            }
                         }
                         else
                         {

+ 6 - 3
TEAMModelOS.SDK/Models/Cosmos/BI/BINormal/BizConfig.cs

@@ -266,11 +266,14 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI.BINormal
         /// </summary>
 
         public string webhook { get; set; }
-
         /// <summary>
-        /// 是否https 0 否,1 是 
+        /// webhook的访问金钥
+        /// </summary>
+        public string webhookToken { get; set; }
+        /// <summary>
+        /// webhook的访问金钥
         /// </summary>
-        public int https { get; set; } = 0;
+        public string webhookHead { get; set; }
 
         /// <summary>
         /// 授权的token ,存放 scope="business",Sub="合作方id",  9e40e436-f958-498d-93cf-4242b77a17ab

+ 5 - 5
TEAMModelOS/Controllers/OpenApi/Business/BizCustomizeController.cs

@@ -60,7 +60,7 @@ namespace TEAMModelOS.Controllers
         [ProducesDefaultResponseType]
         [HttpPost("create-vrar-lesson-shanda")]
         [ApiToken(Auth = "2003", Name = "VR·AR开课/上传课例信息", TName = "VR·AR開課/上傳課例信息", EName = "Start VR·AR lesson/upload VR·AR lesson ", RWN = "W", Limit = false)]
-        public async Task<IActionResult> UpLessonRec(JsonElement jsonElement)
+        public async Task<IActionResult> UpdateLesson(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
 
@@ -291,9 +291,9 @@ namespace TEAMModelOS.Controllers
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [HttpPost("get-lesson-records")]
+        [HttpPost("get-vrar-lessons")]
         [ApiToken(Auth = "2004", Name = "获取学校课例", TName = "獲取學校課例", EName = "Get school lessons", RWN = "R", Limit = false)]
-        public async Task<IActionResult> GetLessonRec(JsonElement jsonElement)
+        public async Task<IActionResult> GetLesson(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
             jsonElement.TryGetProperty("lessonId", out JsonElement lessId);
@@ -319,9 +319,9 @@ namespace TEAMModelOS.Controllers
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
-        [HttpPost("get-lesson-analysis")]
+        [HttpPost("get-vrar-lesson-analysis")]
         [ApiToken(Auth = "2006", Name = "获取学校课例", TName = "獲取學校課例", EName = "Get school lessons", RWN = "R", Limit = false)]
-        public async Task<IActionResult> GetLessonStats(JsonElement jsonElement)
+        public async Task<IActionResult> GetLessonAnslysis(JsonElement jsonElement)
         {
             var (id, school) = HttpContext.GetApiTokenInfo();
             if (!jsonElement.TryGetProperty("lessonId", out JsonElement lessonId)) return Ok(new { responseDate = new ResponseData<dynamic>() { code = RespondCode.ParamsError, msg = "lessId参数错误", data = null } });  //上课人ID  ;