|
@@ -1209,10 +1209,12 @@ namespace TEAMModelOS.SDK
|
|
|
{
|
|
|
//TODO : 進階查詢選項調整、部分地方可用並行處理
|
|
|
//以學校學生角度去抓資料
|
|
|
- Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs)>> dicClassStuds = new Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs)>>();
|
|
|
- List<(string id, string name, string picture, int year, string no, string periodId, string irs)> notJoinClassStuds = new List<(string id, string name, string picture, int year, string no, string periodId, string irs)>();
|
|
|
+ Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs,List<StudentGuardian> guardians)>> dicClassStuds =
|
|
|
+ new Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs, List<StudentGuardian> guardians)>>();
|
|
|
+ List<(string id, string name, string picture, int year, string no, string periodId, string irs, List<StudentGuardian> guardians)> notJoinClassStuds =
|
|
|
+ new List<(string id, string name, string picture, int year, string no, string periodId, string irs, List<StudentGuardian> guardians)>();
|
|
|
|
|
|
- string queryText = $"SELECT c.id, c.name, c.picture, c.year, c.classId, c.no,c.irs ,c.periodId FROM c WHERE c.code = 'Base-{schoolId}'";
|
|
|
+ string queryText = $"SELECT c.id, c.name, c.picture, c.year, c.classId, c.no,c.irs ,c.periodId,c.guardians FROM c WHERE c.code = 'Base-{schoolId}'";
|
|
|
|
|
|
//回傳用ContinuationToken
|
|
|
string continuationToken = string.Empty;
|
|
@@ -1229,7 +1231,7 @@ namespace TEAMModelOS.SDK
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
- List<(string id, string name, string picture, int year, string no)> students = new List<(string id, string name, string picture, int year, string no)>();
|
|
|
+ List<(string id, string name, string picture, int year, string no, List<StudentGuardian> guardians)> students = new List<(string id, string name, string picture, int year, string no, List<StudentGuardian> guardians)>();
|
|
|
|
|
|
var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
while (accounts.MoveNext())
|
|
@@ -1238,7 +1240,14 @@ namespace TEAMModelOS.SDK
|
|
|
|
|
|
string classId = acc.GetProperty("classId").GetString();
|
|
|
acc.TryGetProperty("irs", out JsonElement irs);
|
|
|
-
|
|
|
+ acc.TryGetProperty("guardians", out JsonElement _guardians);
|
|
|
+ List<StudentGuardian> guardians = new List<StudentGuardian>();
|
|
|
+ if (_guardians.ValueKind.Equals(JsonValueKind.Array)) {
|
|
|
+ guardians= _guardians.Deserialize<List<StudentGuardian>>();
|
|
|
+ if (guardians.Any()) {
|
|
|
+ guardians= guardians.FindAll(x => !string.IsNullOrWhiteSpace(x.mobile)) ;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (string.IsNullOrWhiteSpace(classId))
|
|
|
{
|
|
|
notJoinClassStuds.Add(
|
|
@@ -1249,7 +1258,7 @@ namespace TEAMModelOS.SDK
|
|
|
acc.GetProperty("year").GetInt32(),
|
|
|
acc.GetProperty("no").GetString(),
|
|
|
acc.TryGetProperty("periodId", out JsonElement _periodId) && _periodId.ValueKind.Equals(JsonValueKind.String) ? _periodId.GetString() : null,
|
|
|
- $"{irs}"
|
|
|
+ $"{irs}", guardians
|
|
|
)
|
|
|
);
|
|
|
}
|
|
@@ -1264,14 +1273,14 @@ namespace TEAMModelOS.SDK
|
|
|
acc.GetProperty("picture").GetString(),
|
|
|
acc.GetProperty("year").GetInt32(),
|
|
|
acc.GetProperty("no").GetString(), acc.TryGetProperty("periodId", out JsonElement _periodId) && _periodId.ValueKind.Equals(JsonValueKind.String) ? _periodId.GetString() : null,
|
|
|
- $"{irs}"
|
|
|
+ $"{irs}", guardians
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dicClassStuds.Add(classId,
|
|
|
- new List<(string id, string name, string picture, int year, string no, string periodId, string irs)>()
|
|
|
+ new List<(string id, string name, string picture, int year, string no, string periodId, string irs, List<StudentGuardian> guardians)>()
|
|
|
{
|
|
|
(
|
|
|
acc.GetProperty("id").GetString(),
|
|
@@ -1279,6 +1288,7 @@ namespace TEAMModelOS.SDK
|
|
|
acc.GetProperty("picture").GetString(),
|
|
|
acc.GetProperty("year").GetInt32(),
|
|
|
acc.GetProperty("no").GetString(), acc.TryGetProperty("periodId",out JsonElement _periodId)&& _periodId.ValueKind.Equals(JsonValueKind.String) ? _periodId.GetString() : null,$"{irs}"
|
|
|
+ , guardians
|
|
|
)
|
|
|
}
|
|
|
);
|
|
@@ -1328,7 +1338,8 @@ namespace TEAMModelOS.SDK
|
|
|
gradeId,
|
|
|
periodId = string.IsNullOrEmpty(periodId) ? o.periodId : periodId,
|
|
|
classYear,
|
|
|
- irs = o.irs
|
|
|
+ irs = o.irs,
|
|
|
+ guardians=o.guardians,
|
|
|
|
|
|
});
|
|
|
ret.AddRange(tmp);
|
|
@@ -1349,12 +1360,11 @@ namespace TEAMModelOS.SDK
|
|
|
gradeId = (string)null,
|
|
|
o.periodId,
|
|
|
classYear = -1,
|
|
|
- irs = o.irs
|
|
|
+ irs = o.irs,
|
|
|
+ guardians=o.guardians,
|
|
|
}));
|
|
|
-
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
await _dingDing.SendBotMsg($"IES5,{_option.Location},StudentController/getStudents()\n{ex.Message}\n{ex.StackTrace},", GroupNames.醍摩豆服務運維群組);
|