|
@@ -1250,12 +1250,12 @@ namespace TEAMModelOS.SDK
|
|
|
{
|
|
|
//TODO : 進階查詢選項調整、部分地方可用並行處理
|
|
|
//以學校學生角度去抓資料
|
|
|
- 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)>();
|
|
|
+ Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs,string imei,List<StudentGuardian> guardians)>> dicClassStuds =
|
|
|
+ new Dictionary<string, List<(string id, string name, string picture, int year, string no, string periodId, string irs, string imei, List<StudentGuardian> guardians)>>();
|
|
|
+ List<(string id, string name, string picture, int year, string no, string periodId, string irs, string imei, List<StudentGuardian> guardians)> notJoinClassStuds =
|
|
|
+ new List<(string id, string name, string picture, int year, string no, string periodId, string irs, string imei, List<StudentGuardian> guardians)>();
|
|
|
|
|
|
- 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}'";
|
|
|
+ string queryText = $"SELECT c.id, c.name, c.picture, c.year, c.classId, c.no,c.irs ,c.periodId,c.guardians ,c.imei FROM c WHERE c.code = 'Base-{schoolId}'";
|
|
|
|
|
|
//回傳用ContinuationToken
|
|
|
string continuationToken = string.Empty;
|
|
@@ -1283,6 +1283,7 @@ namespace TEAMModelOS.SDK
|
|
|
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()) {
|
|
@@ -1299,7 +1300,9 @@ 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}", guardians
|
|
|
+ $"{irs}",
|
|
|
+ acc.TryGetProperty("imei", out JsonElement _imei) && _imei.ValueKind.Equals(JsonValueKind.String) ? _imei.GetString() : null,
|
|
|
+ guardians
|
|
|
)
|
|
|
);
|
|
|
}
|
|
@@ -1314,22 +1317,27 @@ 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
|
|
|
+ $"{irs}",
|
|
|
+ acc.TryGetProperty("imei", out JsonElement _imei) && _imei.ValueKind.Equals(JsonValueKind.String) ? _imei.GetString() : null,
|
|
|
+ guardians
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
dicClassStuds.Add(classId,
|
|
|
- new List<(string id, string name, string picture, int year, string no, string periodId, string irs, List<StudentGuardian> guardians)>()
|
|
|
+ new List<(string id, string name, string picture, int year, string no, string periodId, string irs,string imei, List<StudentGuardian> guardians)>()
|
|
|
{
|
|
|
(
|
|
|
acc.GetProperty("id").GetString(),
|
|
|
acc.GetProperty("name").GetString(),
|
|
|
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
|
|
|
+ acc.GetProperty("no").GetString(), acc.TryGetProperty("periodId",out JsonElement _periodId)&& _periodId.ValueKind.Equals(JsonValueKind.String) ? _periodId.GetString() : null,
|
|
|
+ $"{irs}"
|
|
|
+ ,
|
|
|
+ acc.TryGetProperty("imei", out JsonElement _imei) && _imei.ValueKind.Equals(JsonValueKind.String) ? _imei.GetString() : null,
|
|
|
+ guardians
|
|
|
)
|
|
|
}
|
|
|
);
|
|
@@ -1380,6 +1388,7 @@ namespace TEAMModelOS.SDK
|
|
|
periodId = string.IsNullOrEmpty(periodId) ? o.periodId : periodId,
|
|
|
classYear,
|
|
|
irs = o.irs,
|
|
|
+ imie=o.imei,
|
|
|
guardians=o.guardians,
|
|
|
|
|
|
});
|
|
@@ -1402,7 +1411,8 @@ namespace TEAMModelOS.SDK
|
|
|
o.periodId,
|
|
|
classYear = -1,
|
|
|
irs = o.irs,
|
|
|
- guardians=o.guardians,
|
|
|
+ imie = o.imei,
|
|
|
+ guardians =o.guardians,
|
|
|
}));
|
|
|
return ret;
|
|
|
}
|
|
@@ -1933,8 +1943,9 @@ namespace TEAMModelOS.SDK
|
|
|
account.TryGetProperty("irs", out JsonElement irsjson);
|
|
|
string irs = $"{irsjson}";
|
|
|
//用來記錄最後更改完的資料
|
|
|
- (string salt, string pw, string name, int year, string picture, string gender, string mail, string mobile, string classId, string no, string periodId, string irs , List<StudentGuardian> guardians) tmpData
|
|
|
- = (studentInfos[id].salt, studentInfos[id].pw, studentInfos[id].name, studentInfos[id].year, studentInfos[id].picture, studentInfos[id].gender, studentInfos[id].mail, studentInfos[id].mobile, studentInfos[id].classId, studentInfos[id].no, studentInfos[id].periodId, studentInfos[id].irs, studentInfos[id]. guardians);
|
|
|
+ (string salt, string pw, string name, int year, string picture, string gender, string mail, string mobile, string classId, string no, string periodId, string irs ,string imei, List<StudentGuardian> guardians) tmpData
|
|
|
+ = (studentInfos[id].salt, studentInfos[id].pw, studentInfos[id].name, studentInfos[id].year, studentInfos[id].picture, studentInfos[id].gender, studentInfos[id].mail, studentInfos[id].mobile, studentInfos[id].classId, studentInfos[id].no, studentInfos[id].periodId,
|
|
|
+ studentInfos[id].irs, studentInfos[id].imei, studentInfos[id]. guardians);
|
|
|
|
|
|
bool isUpPwDone = false;
|
|
|
bool isWrong = false;
|
|
@@ -2078,12 +2089,12 @@ namespace TEAMModelOS.SDK
|
|
|
if (studentInfos[id].imei != null && studentInfos[id].imei.Length == 0)
|
|
|
{
|
|
|
writer.WriteNull("imei");
|
|
|
- tmpData.irs = null;
|
|
|
+ tmpData.imei = null;
|
|
|
}
|
|
|
else if (string.IsNullOrWhiteSpace(studentInfos[id].imei))
|
|
|
{
|
|
|
element.WriteTo(writer);
|
|
|
- tmpData.irs = element.Value.GetString();
|
|
|
+ tmpData.imei = element.Value.GetString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2097,32 +2108,12 @@ namespace TEAMModelOS.SDK
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //如果有錯誤,如座號重覆等,就會跳過該次更新。
|
|
|
- if (isWrong)
|
|
|
- {
|
|
|
- await writer.DisposeAsync();
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!account.TryGetProperty("irs", out JsonElement _irs) || _irs.ValueKind.Equals(JsonValueKind.Undefined))
|
|
|
- {
|
|
|
- writer.WriteString("irs", studentInfos[id].irs);
|
|
|
- }
|
|
|
- if (!account.TryGetProperty("imei", out JsonElement _imei) || _imei.ValueKind.Equals(JsonValueKind.Undefined))
|
|
|
- {
|
|
|
- writer.WriteString("imei", studentInfos[id].imei);
|
|
|
- }
|
|
|
- //若密碼和鹽沒有更新,就把舊的資料寫回去
|
|
|
- if (!isUpPwDone)
|
|
|
- {
|
|
|
- writer.WriteString("salt", account.GetProperty("salt").GetString());
|
|
|
- writer.WriteString("pw", account.GetProperty("pw").GetString());
|
|
|
- }
|
|
|
if (studentInfos[id].guardians.IsNotEmpty())
|
|
|
{
|
|
|
writer.WriteStartArray("guardians");
|
|
|
-
|
|
|
- foreach (var guardian in studentInfos[id].guardians) {
|
|
|
+
|
|
|
+ foreach (var guardian in studentInfos[id].guardians)
|
|
|
+ {
|
|
|
writer.WriteStartObject();
|
|
|
writer.WriteString("relation", guardian.relation);
|
|
|
writer.WriteString("name", guardian.name);
|
|
@@ -2134,12 +2125,30 @@ namespace TEAMModelOS.SDK
|
|
|
}
|
|
|
writer.WriteEndArray();
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
writer.WriteStartArray("guardians");
|
|
|
- writer.WriteStartObject();
|
|
|
- writer.WriteEndObject();
|
|
|
+ //writer.WriteStartObject();
|
|
|
+ //writer.WriteEndObject();
|
|
|
writer.WriteEndArray();
|
|
|
}
|
|
|
+ //如果有錯誤,如座號重覆等,就會跳過該次更新。
|
|
|
+ if (isWrong)
|
|
|
+ {
|
|
|
+ await writer.DisposeAsync();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!account.TryGetProperty("irs", out JsonElement _irs) || _irs.ValueKind.Equals(JsonValueKind.Undefined))
|
|
|
+ {
|
|
|
+ writer.WriteString("irs", studentInfos[id].irs);
|
|
|
+ }
|
|
|
+ //若密碼和鹽沒有更新,就把舊的資料寫回去
|
|
|
+ if (!isUpPwDone)
|
|
|
+ {
|
|
|
+ writer.WriteString("salt", account.GetProperty("salt").GetString());
|
|
|
+ writer.WriteString("pw", account.GetProperty("pw").GetString());
|
|
|
+ }
|
|
|
+
|
|
|
writer.WriteEndObject();
|
|
|
writer.Flush();
|
|
|
|