Browse Source

返回第三方用户权限

Li 3 years ago
parent
commit
6556e8812b

+ 28 - 2
TEAMModelBI/Controllers/BITable/CompanyUserController.cs

@@ -5,6 +5,7 @@ using System;
 using System.Collections.Generic;
 using System.Text.Json;
 using System.Threading.Tasks;
+using TEAMModelBI.Models;
 using TEAMModelBI.Tool.Context;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK.Context.Constant;
@@ -128,7 +129,7 @@ namespace TEAMModelBI.Controllers.BITable
         }
 
         /// <summary>
-        /// 查询用户的关联
+        /// 查询用户信息
         /// </summary>
         /// <param name="jsonElement"></param>
         /// <returns></returns>
@@ -202,14 +203,39 @@ namespace TEAMModelBI.Controllers.BITable
             var table = tableClient.GetTableReference("IESOpenApi");
 
             List<BizRelUser> bizRelUsers = new();
+            List<RelBizInfo> relBizInfos = new();
 
             if (!string.IsNullOrEmpty($"{userId}"))
                 bizRelUsers = await table.QueryWhereString<BizRelUser>($"PartitionKey eq 'BizRelUser' and userId eq '{userId}'");
             else
                 //bizRelUsers = await table.FindListByDict<BizRelUser>(new Dictionary<string, object>() { { "PartitionKey ", "BizRelUser" } });
                 bizRelUsers = await table.QueryWhereString<BizRelUser>($"PartitionKey eq 'BizRelUser'");
+            if (bizRelUsers.Count > 0) 
+            {
+                if (bizRelUsers.Count > 0)
+                {
+                    foreach (var item in bizRelUsers)
+                    {
+                        BusinessConfig businessConfig = table.Get<BusinessConfig>("BusinessConfig", item.bizId);
+                        RelBizInfo relBizInfo = new()
+                        {
+                            userRowKey = item.userId,
+                            relId = item.RowKey,
+                            bizRowKey = item.bizId,
+                            roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(',')) : new List<string>()
+                        };
+                        if (businessConfig != null)
+                        {
+                            relBizInfo.bizName = businessConfig.name;
+                            relBizInfo.bizCredit = businessConfig.credit;
+                            relBizInfo.bizPicture = businessConfig.picture;
+                            relBizInfos.Add(relBizInfo);
+                        }
+                    }
+                }
+            }
 
-            return Ok(new { state = RespondCode.Ok, bizRelUsers });
+            return Ok(new { state = RespondCode.Ok, relBizInfos });
         }
 
 

+ 2 - 1
TEAMModelBI/Controllers/LoginController.cs

@@ -660,7 +660,8 @@ namespace TEAMModelBI.Controllers
                                 {
                                     userRowKey = item.userId,
                                     relId = item.RowKey,
-                                    bizRowKey = item.bizId
+                                    bizRowKey = item.bizId,
+                                    roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(',')) : new List<string>()
                                 };
                                 if (businessConfig != null) 
                                 {

+ 4 - 1
TEAMModelBI/Models/MonthStartEnd.cs

@@ -1,4 +1,6 @@
-namespace TEAMModelBI.Models
+using System.Collections.Generic;
+
+namespace TEAMModelBI.Models
 {
     public class MonthStartEnd
     {
@@ -62,6 +64,7 @@
         public string bizName { get; set; }
         public string bizCredit { get; set; }
         public string bizPicture { get; set; }
+        public List<string> roles { get; set; }
 
     }