|
@@ -828,12 +828,12 @@ namespace TEAMModelBI.Controllers.BICommon
|
|
{
|
|
{
|
|
List<string> schIds = new List<string>(); //要取得的學校ID
|
|
List<string> schIds = new List<string>(); //要取得的學校ID
|
|
//取得ID資訊
|
|
//取得ID資訊
|
|
- sqlWhere = $" ((NOT IS_NULL(c.schoolCode) AND c.schoolCode != '') OR (NOT IS_NULL(c.schoolCodeW) AND c.schoolCodeW != ''))";
|
|
|
|
|
|
+ sqlWhere = $" ((IS_DEFINED(c.schoolCode) AND NOT IS_NULL(c.schoolCode)) OR (IS_DEFINED(c.schoolCodeW) AND NOT IS_NULL(c.schoolCodeW))) ";
|
|
//有Email篩選
|
|
//有Email篩選
|
|
if (hasMail)
|
|
if (hasMail)
|
|
{
|
|
{
|
|
- string tmpSql = "IS_DEFINED(c.mail) AND NOT IS_NULL(c.mail)";
|
|
|
|
- sqlWhere += $" AND ({tmpSql}) ";
|
|
|
|
|
|
+ string tmpSql = "(IS_DEFINED(c.mail) AND NOT IS_NULL(c.mail) AND c.mail != '')";
|
|
|
|
+ sqlWhere += $" AND {tmpSql} ";
|
|
}
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(sqlWhere))
|
|
if (!string.IsNullOrWhiteSpace(sqlWhere))
|
|
{
|
|
{
|
|
@@ -841,9 +841,9 @@ namespace TEAMModelBI.Controllers.BICommon
|
|
await foreach (var item in cosmosClientCsv2.GetContainer("Core", "ID2").GetItemQueryIteratorSql<JsonElement>(queryText: sqlTmidEx, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"base-ex") }))
|
|
await foreach (var item in cosmosClientCsv2.GetContainer("Core", "ID2").GetItemQueryIteratorSql<JsonElement>(queryText: sqlTmidEx, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"base-ex") }))
|
|
{
|
|
{
|
|
TmidInfo tmidEx = item.ToObject<TmidInfo>();
|
|
TmidInfo tmidEx = item.ToObject<TmidInfo>();
|
|
|
|
+ tmidEx.schId = (!string.IsNullOrWhiteSpace(tmidEx.schoolCode)) ? tmidEx.schoolCode : (!string.IsNullOrWhiteSpace(tmidEx.schoolCodeW)) ? tmidEx.schoolCodeW : string.Empty;
|
|
tmidExInfos.Add(tmidEx);
|
|
tmidExInfos.Add(tmidEx);
|
|
- if (!string.IsNullOrWhiteSpace(tmidEx.schoolCode) && !schIds.Contains(tmidEx.schoolCode)) schIds.Add(tmidEx.schoolCode);
|
|
|
|
- if (!string.IsNullOrWhiteSpace(tmidEx.schoolCodeW) && !schIds.Contains(tmidEx.schoolCodeW)) schIds.Add(tmidEx.schoolCodeW);
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(tmidEx.schId) && !schIds.Contains(tmidEx.schId)) schIds.Add(tmidEx.schId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//取得學校資訊
|
|
//取得學校資訊
|
|
@@ -932,7 +932,12 @@ namespace TEAMModelBI.Controllers.BICommon
|
|
geoInfo = geoInfos.Where(g => g.id.Equals(geoInfoCrt.id)).FirstOrDefault();
|
|
geoInfo = geoInfos.Where(g => g.id.Equals(geoInfoCrt.id)).FirstOrDefault();
|
|
}
|
|
}
|
|
geoInfo.scCnt++;
|
|
geoInfo.scCnt++;
|
|
- List<TmidInfo> tmidInfoSelected = tmidExInfos.Where(g => (!string.IsNullOrWhiteSpace(g.schoolCode) && g.schoolCode.Equals(schId)) || (!string.IsNullOrWhiteSpace(g.schoolCodeW) && g.schoolCodeW.Equals(schId))).ToList();
|
|
|
|
|
|
+
|
|
|
|
+ //List<TmidInfo> tmidInfoSelectedStrong = tmidExInfos.Where(g => (!string.IsNullOrWhiteSpace(g.schoolCode) && g.schoolCode.Equals(schId))).ToList();
|
|
|
|
+ //List<string> tmidListStrong = tmidInfoSelectedStrong.Select(g => g.id).ToList();
|
|
|
|
+ //List<TmidInfo> tmidInfoSelectedWeek = tmidExInfos.Where(g => !tmidListStrong.Contains(g.id) && (!string.IsNullOrWhiteSpace(g.schoolCodeW) && g.schoolCodeW.Equals(schId))).ToList();
|
|
|
|
+ //List<TmidInfo> tmidInfoSelected = tmidInfoSelectedStrong.Union(tmidInfoSelectedWeek).ToList();
|
|
|
|
+ List<TmidInfo> tmidInfoSelected = tmidExInfos.Where(g => (!string.IsNullOrWhiteSpace(g.schId) && g.schId.Equals(schId))).ToList();
|
|
geoInfo.tchCnt += tmidInfoSelected.Count;
|
|
geoInfo.tchCnt += tmidInfoSelected.Count;
|
|
if (showList && (groupKey.Equals("country") || groupKey.Equals("province") || groupKey.Equals("city")))
|
|
if (showList && (groupKey.Equals("country") || groupKey.Equals("province") || groupKey.Equals("city")))
|
|
{
|
|
{
|
|
@@ -1293,10 +1298,10 @@ namespace TEAMModelBI.Controllers.BICommon
|
|
tmids = tmids.Union(tmids_school).ToList();
|
|
tmids = tmids.Union(tmids_school).ToList();
|
|
tmids = tmids.Union(tmids_direct).ToList();
|
|
tmids = tmids.Union(tmids_direct).ToList();
|
|
tmids = tmids.Distinct().ToList(); //唯一化
|
|
tmids = tmids.Distinct().ToList(); //唯一化
|
|
-#if DEBUG //測試模式時限制TMID帳號,正式站佈署時不生效
|
|
|
|
- List<string> filterTmid = new List<string>() { "1522758684", "1595321354", "1629875867" }; //"1522758684", "1595321354"
|
|
|
|
- tmids = tmids.Intersect(filterTmid).ToList();
|
|
|
|
-#endif
|
|
|
|
|
|
+//#if DEBUG //測試模式時限制TMID帳號,正式站佈署時不生效
|
|
|
|
+// List<string> filterTmid = new List<string>() { "1522758684", "1595321354", "1629875867" }; //"1522758684", "1595321354"
|
|
|
|
+// tmids = tmids.Intersect(filterTmid).ToList();
|
|
|
|
+//#endif
|
|
|
|
|
|
//取得TMID資料
|
|
//取得TMID資料
|
|
List<IdInfo> tmidInfos = new List<IdInfo>();
|
|
List<IdInfo> tmidInfos = new List<IdInfo>();
|
|
@@ -1892,6 +1897,7 @@ namespace TEAMModelBI.Controllers.BICommon
|
|
public string distName { get; set; }
|
|
public string distName { get; set; }
|
|
public string schoolCode { get; set; }
|
|
public string schoolCode { get; set; }
|
|
public string schoolCodeW { get; set; }
|
|
public string schoolCodeW { get; set; }
|
|
|
|
+ public string schId { get; set; }
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 學區、地理位置、機構類型 回傳信息
|
|
/// 學區、地理位置、機構類型 回傳信息
|