|
@@ -59,7 +59,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
else
|
|
|
{
|
|
|
status = 0;
|
|
|
- stuList.members.Add(new Member { id = userid, name = name, no = no, picture = picture, type = type });
|
|
|
+ stuList.members.Add(new Member { id = userid, no = no,type = type });
|
|
|
}
|
|
|
}
|
|
|
else if (type == 2)
|
|
@@ -73,7 +73,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
else
|
|
|
{
|
|
|
status = 0;
|
|
|
- stuList.members.Add(new Member { id = userid, code = school, name = name, no = no, picture = picture, type = type });
|
|
|
+ stuList.members.Add(new Member { id = userid, code = school, no = no, type = type });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -275,16 +275,16 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
- public static async Task<List<GroupList>> GetStutmdidListids(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
|
|
|
+ public static async Task<List<RGroupList>> GetStutmdidListids(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
|
|
|
{
|
|
|
- List<GroupList> groupLists = null;
|
|
|
+ List<RGroupList> groupLists = null;
|
|
|
if (classes.Count == 1 && classes.First().Equals("default") && !string.IsNullOrEmpty(school))
|
|
|
{
|
|
|
//默认的教研组
|
|
|
- List<Member> members = new List<Member>();
|
|
|
+ List<RMember> members = new List<RMember>();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TmdInfo>(queryText: $"SELECT value(c) FROM c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Teacher-{school}") }))
|
|
|
{
|
|
|
- Member member = new Member
|
|
|
+ RMember member = new RMember
|
|
|
{
|
|
|
id = item.id,
|
|
|
name = item.name,
|
|
@@ -293,7 +293,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
};
|
|
|
members.Add(member);
|
|
|
}
|
|
|
- GroupList groupList = new GroupList
|
|
|
+ RGroupList groupList = new RGroupList
|
|
|
{
|
|
|
id = "default",
|
|
|
name = "default",
|
|
@@ -303,18 +303,18 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
type = "research",
|
|
|
members = members
|
|
|
};
|
|
|
- groupLists = new List<GroupList> { groupList };
|
|
|
+ groupLists = new List<RGroupList> { groupList };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Dictionary<string, List<GroupList>> groups = new Dictionary<string, List<GroupList>>();
|
|
|
+ Dictionary<string, List<RGroupList>> groups = new Dictionary<string, List<RGroupList>>();
|
|
|
List<Student> students = new List<Student>();
|
|
|
string sql = string.Join(",", classes.Select(x => $"'{x}'"));
|
|
|
if (!string.IsNullOrEmpty(school))
|
|
|
{
|
|
|
- List<GroupList> schoolList = new List<GroupList>();
|
|
|
+ List<RGroupList> schoolList = new List<RGroupList>();
|
|
|
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<RGroupList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school}") }))
|
|
|
{
|
|
|
schoolList.Add(item);
|
|
@@ -339,9 +339,9 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
}
|
|
|
if (classes.IsNotEmpty())
|
|
|
{
|
|
|
- List<GroupList> privateList = new List<GroupList>();
|
|
|
+ List<RGroupList> privateList = new List<RGroupList>();
|
|
|
sql = string.Join(",", classes.Select(x => $"'{x}'"));
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<GroupList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<RGroupList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList") }))
|
|
|
{
|
|
|
privateList.Add(item);
|
|
@@ -368,8 +368,8 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
|
|
|
{
|
|
|
///行政班(学生搜寻classId动态返回)class
|
|
|
- List<Member> members = students.Where(x => x.classId.Equals(item.id)).Select(y => new Member { id = y.id, code = school, name = y.name, type = 2, picture = y.picture, no = y.no }).ToList();
|
|
|
- GroupList group = new GroupList
|
|
|
+ List<RMember> members = students.Where(x => x.classId.Equals(item.id)).Select(y => new RMember { id = y.id, code = school, name = y.name, type = 2, picture = y.picture, no = y.no }).ToList();
|
|
|
+ RGroupList group = new RGroupList
|
|
|
{
|
|
|
id = item.id,
|
|
|
code = $"GroupList-{school}",
|
|
@@ -389,14 +389,14 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
return groupLists;
|
|
|
}
|
|
|
|
|
|
- public static async Task<(List<GroupList> groups, List<Member> members)> GetGroupListMemberInfo(CosmosClient client, string type, List<GroupList> groups, string groupTbname, DingDing _dingDing)
|
|
|
+ public static async Task<(List<RGroupList> groups, List<RMember> members)> GetGroupListMemberInfo(CosmosClient client, string type, List<RGroupList> groups, string groupTbname, DingDing _dingDing)
|
|
|
{
|
|
|
|
|
|
try {
|
|
|
var members = groups.SelectMany(y => y.members).ToList();
|
|
|
//去重
|
|
|
- List<Member> tmids = members.FindAll(x => x.type == 1).Where((x, i) => members.FindAll(x => x.type == 1).FindIndex(n => n.id.Equals(x.id)) == i).ToList();
|
|
|
- List<Member> students = members.FindAll(x => x.type == 2).Where((x, i) => members.FindAll(x => x.type == 2).FindIndex(n => n.id.Equals(x.id) && n.code.Equals(x.code)) == i).ToList();
|
|
|
+ List<RMember> tmids = members.FindAll(x => x.type == 1).Where((x, i) => members.FindAll(x => x.type == 1).FindIndex(n => n.id.Equals(x.id)) == i).ToList();
|
|
|
+ List<RMember> students = members.FindAll(x => x.type == 2).Where((x, i) => members.FindAll(x => x.type == 2).FindIndex(n => n.id.Equals(x.id) && n.code.Equals(x.code)) == i).ToList();
|
|
|
var stu = students.GroupBy(x => x.code).Select(y => new { key = y.Key, list = y.ToList() });
|
|
|
List<Student> studentsData = new List<Student>();
|
|
|
if (stu != null)
|
|
@@ -457,7 +457,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
//去重
|
|
|
tmdsData = tmdsData.Where((x, i) => tmdsData.FindIndex(n => n.id.Equals(x.id)) == i).ToList();
|
|
|
}
|
|
|
- HashSet<GroupList> changes = new HashSet<GroupList>();
|
|
|
+ HashSet<RGroupList> changes = new HashSet<RGroupList>();
|
|
|
var unexist_tmdid = tmids.Select(x => x.id).Except(tmdsData.Select(y => y.id)).ToList();
|
|
|
groups.ForEach(x =>
|
|
|
{
|
|
@@ -498,10 +498,10 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
{
|
|
|
change.tcount = change.members.Where(x => x.type == 1).Count();
|
|
|
change.scount = change.members.Where(x => x.type == 2).Count();
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, groupTbname).ReplaceItemAsync(change, change.id, new PartitionKey(change.code));
|
|
|
+ GroupList group= change.ToJsonString().ToObject<GroupList>();
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, groupTbname).ReplaceItemAsync(group, group.id, new PartitionKey(group.code));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return (groups, mbs);
|
|
|
} catch (Exception ex) {
|
|
|
await _dingDing.SendBotMsg($"OS,GetGroupListMemberInfo()\n{ex.Message}{ex.StackTrace}\n", GroupNames.醍摩豆服務運維群組);
|