|
@@ -29,8 +29,6 @@ using TEAMModelOS.SDK;
|
|
using TEAMModelOS.SDK.Context.BI;
|
|
using TEAMModelOS.SDK.Context.BI;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Models;
|
|
using TEAMModelOS.SDK.Context.Constant;
|
|
using TEAMModelOS.SDK.Context.Constant;
|
|
-using Microsoft.Azure.Cosmos;
|
|
|
|
-using static TEAMModelBI.Controllers.BITable.TableDingDingInfoController;
|
|
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.BITable
|
|
namespace TEAMModelBI.Controllers.BITable
|
|
{
|
|
{
|
|
@@ -393,9 +391,14 @@ namespace TEAMModelBI.Controllers.BITable
|
|
}
|
|
}
|
|
|
|
|
|
var tempUser = await table.FindListByDict<DingDingUserInfo>(dic);
|
|
var tempUser = await table.FindListByDict<DingDingUserInfo>(dic);
|
|
|
|
+ List<string> oldRoles = new();
|
|
|
|
+
|
|
|
|
+ List<Task<ItemResponse<SchoolTeacher>>> upScTch = new();
|
|
|
|
|
|
foreach (var item in tempUser)
|
|
foreach (var item in tempUser)
|
|
{
|
|
{
|
|
|
|
+ oldRoles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(",")) : new List<string>();
|
|
|
|
+
|
|
stringBuilder.Append($"操作醍摩豆账户{item.tmdName}【{item.tmdId}】修改权限:{string.Join("|", listper.ToArray())}");
|
|
stringBuilder.Append($"操作醍摩豆账户{item.tmdName}【{item.tmdId}】修改权限:{string.Join("|", listper.ToArray())}");
|
|
|
|
|
|
item.roles = listroles.Count > 0 ? string.Join(",", listroles) : "assist";
|
|
item.roles = listroles.Count > 0 ? string.Join(",", listroles) : "assist";
|
|
@@ -405,6 +408,59 @@ namespace TEAMModelBI.Controllers.BITable
|
|
|
|
|
|
roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(",")) : new List<string>();
|
|
roles = !string.IsNullOrEmpty($"{item.roles}") ? new List<string>(item.roles.Split(",")) : new List<string>();
|
|
permissions = !string.IsNullOrEmpty($"{item.permissions}") ? new List<string>(item.permissions.Split(",")) : new List<string>();
|
|
permissions = !string.IsNullOrEmpty($"{item.permissions}") ? new List<string>(item.permissions.Split(",")) : new List<string>();
|
|
|
|
+
|
|
|
|
+ foreach (var itemR in listroles)
|
|
|
|
+ {
|
|
|
|
+ if(itemR.Equals("assist"))
|
|
|
|
+ {
|
|
|
|
+ string sql = $"select value(c) from c where c.pk='Teacher' and c.id='{item.tmdId}'";
|
|
|
|
+ await foreach (var scTch in cosmosCliet.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<SchoolTeacher>(queryText: sql, requestOptions: new QueryRequestOptions() { }))
|
|
|
|
+ {
|
|
|
|
+ if (scTch.roles.Contains("sales"))
|
|
|
|
+ {
|
|
|
|
+ int index = scTch.roles.FindIndex(fi => fi.Contains("sales"));
|
|
|
|
+ if (index >= 0)
|
|
|
|
+ {
|
|
|
|
+ scTch.roles[index] = "assist";
|
|
|
|
+ scTch.job = "顾问";
|
|
|
|
+
|
|
|
|
+ upScTch.Add(cosmosCliet.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(scTch, scTch.id, new PartitionKey($"{scTch.code}")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (itemR.Equals("sales"))
|
|
|
|
+ {
|
|
|
|
+ string sql = $"select value(c) from c where c.pk='Teacher' and c.id='{item.tmdId}'";
|
|
|
|
+ await foreach (var scTch in cosmosCliet.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<SchoolTeacher>(queryText: sql, requestOptions: new QueryRequestOptions() { }))
|
|
|
|
+ {
|
|
|
|
+ if (scTch.roles.Contains("assist"))
|
|
|
|
+ {
|
|
|
|
+ int index = scTch.roles.FindIndex(fi => fi.Contains("assist"));
|
|
|
|
+ if (index >= 0)
|
|
|
|
+ {
|
|
|
|
+ scTch.roles[index] = "sales";
|
|
|
|
+ scTch.job = "销售";
|
|
|
|
+ upScTch.Add(cosmosCliet.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(scTch, scTch.id, new PartitionKey($"{scTch.code}")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (upScTch.Count < 256)
|
|
|
|
+ {
|
|
|
|
+ await Task.WhenAll(upScTch);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ int pages = (upScTch.Count + 255) / 256;
|
|
|
|
+ for (int i = 0; i < pages; i++)
|
|
|
|
+ {
|
|
|
|
+ List<Task<ItemResponse<SchoolTeacher>>> temScTch = upScTch.Skip((i) * 256).Take(256).ToList();
|
|
|
|
+ await Task.WhenAll(temScTch);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
ddUserInfos = await table.UpdateAll<DingDingUserInfo>(ddUserInfos);
|
|
ddUserInfos = await table.UpdateAll<DingDingUserInfo>(ddUserInfos);
|