|
@@ -44,6 +44,13 @@ namespace TEAMModelOS.SDK
|
|
|
}
|
|
|
public static (int status, GroupList stuList) JoinList(GroupList stuList, string userid, int type, string school)
|
|
|
{
|
|
|
+ int status = -1;
|
|
|
+ if (!string.IsNullOrWhiteSpace(stuList.school) && !string.IsNullOrWhiteSpace(school)) {
|
|
|
+ if (!stuList.school.Equals(school)) {
|
|
|
+ status = 3;//不允许跨校加入名单
|
|
|
+ return (status, stuList);
|
|
|
+ }
|
|
|
+ }
|
|
|
string irs=string.Empty;
|
|
|
List<string> irsOrder= stuList.members.Select(x => x.irs)?.Where(y => !string.IsNullOrEmpty(y)&& Regex.IsMatch(y, @"^\d*$")).OrderBy(x => int.Parse(x)).ToList();
|
|
|
if (!irsOrder.Contains("0"))
|
|
@@ -70,7 +77,7 @@ namespace TEAMModelOS.SDK
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- int status = -1;
|
|
|
+
|
|
|
if (string.IsNullOrEmpty($"{userid}"))
|
|
|
{
|
|
|
//加入学生或醍摩豆ID为空
|
|
@@ -88,6 +95,7 @@ namespace TEAMModelOS.SDK
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ //加入成功
|
|
|
status = 0;
|
|
|
stuList.members.Add(new Member { id = userid,type = type, irs = irs, no = irs });
|
|
|
}
|
|
@@ -120,8 +128,29 @@ namespace TEAMModelOS.SDK
|
|
|
isnew = true;
|
|
|
}
|
|
|
string tbname = list.scope.Equals("private") ? "Teacher" : "School";
|
|
|
- list.tcount = list.members.Where(x => x.type == 1).Count();
|
|
|
- list.scount = list.members.Where(x => x.type == 2).Count();
|
|
|
+ var tmembers = list.members.Where(x => x.type == 1);
|
|
|
+ var smembers= list.members.Where(x => x.type == 2);
|
|
|
+ list.scount = smembers.Count();
|
|
|
+ list.tcount = tmembers.Count();
|
|
|
+ //if (smembers.Count() > 0 && smembers.Select(x => x.code).ToHashSet().Count()>=2) {
|
|
|
+ // //处理移除多个学校的名单,只保留一个学校的。
|
|
|
+ // if (string.IsNullOrWhiteSpace(list.school))
|
|
|
+ // {
|
|
|
+ // HashSet<string> codes = smembers.Select(x => x.code).ToHashSet();
|
|
|
+ // list.school = codes.First();
|
|
|
+ // codes.Remove(codes.First());
|
|
|
+ // list.members.RemoveAll(x => codes.Contains(x.code));
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // list.members.RemoveAll(x => x.code.Equals(list.school));
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ if (string.IsNullOrWhiteSpace(list.school) && smembers.Count() >= 1) {
|
|
|
+ list.school = smembers.First().code;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(list.school) && smembers.Count() == 0 && list.scope.Equals("private")) {
|
|
|
+ list.school = null;
|
|
|
+ }
|
|
|
//学生名单,教研组会触发活动中间表刷新
|
|
|
if (list.type.Equals("teach") || list.type.Equals("research") || list.type.Equals("yxtrain")|| list.type.Equals("activity"))
|
|
|
{
|
|
@@ -380,7 +409,8 @@ namespace TEAMModelOS.SDK
|
|
|
sql = string.Join(",", classes.Select(x => $"'{x}'"));
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<GroupListDto>(queryText: $"select {SummarySql} from c where c.id in ({sql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList") }))
|
|
|
- {
|
|
|
+ {
|
|
|
+ // if(item.school.Equals(""))
|
|
|
privateList.Add(item);
|
|
|
}
|
|
|
if (privateList.IsNotEmpty())
|