|
@@ -39,7 +39,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
var redisClinet8 = _azureRedis.GetRedisClient(8);
|
|
|
var datetime = DateTimeOffset.UtcNow;
|
|
|
var ynow = datetime.Year;
|
|
|
- List<string> calPropList = new List<string>() { "deviceNoAuth", "deviceAuth", "lessonRecord", "useIES", "useIES5Resource", "useWebIrs", "useDeviceIrs", "useHaboard", "useHita", "lessonLengMin", "stuShow", "stuLessonLengMin", "tGreen", "lTypeCoop", "lTypeIact", "lTypeMis", "lTypeTst", "lTypeDif", "lessonCnt928", "lessonCntId", "lessonCntDevice", "lessonCntIdDevice", "mission", "missionFin", "item", "interact" }; //要計算的ProdAnalysis欄位列表
|
|
|
+ List<string> calPropList = new List<string>() { "lessonRecord", "useIES", "useIES5Resource", "useWebIrs", "useDeviceIrs", "useHaboard", "useHita", "lessonLengMin", "stuShow", "stuLessonLengMin", "tGreen", "lTypeCoop", "lTypeIact", "lTypeMis", "lTypeTst", "lTypeDif", "lessonCnt928", "lessonCntId", "lessonCntDevice", "lessonCntIdDevice", "mission", "missionFin", "item", "interact" }; //要計算的ProdAnalysis欄位列表
|
|
|
//取得CS Redis TeachingData (IOT紀錄只有三個月分)
|
|
|
List<IotTeachingData> IotTeachingDataList = new List<IotTeachingData>();
|
|
|
if (y.Equals(ynow.ToString()))
|
|
@@ -126,29 +126,32 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
switch (IotTeachingDatRow.authType)
|
|
|
{
|
|
|
case "0": //928授權
|
|
|
- prodAnalysisRow.deviceNoAuth++;
|
|
|
+ if (!prodAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) prodAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
|
|
|
prodAnalysisRow.lessonCnt928++;
|
|
|
break;
|
|
|
|
|
|
case "1": //ID授權
|
|
|
- prodAnalysisRow.deviceNoAuth++;
|
|
|
+ if (!prodAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) prodAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
|
|
|
prodAnalysisRow.lessonCntId++;
|
|
|
break;
|
|
|
|
|
|
case "2": //機器授權
|
|
|
- prodAnalysisRow.deviceAuth++;
|
|
|
+ if (!prodAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) prodAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
|
|
|
prodAnalysisRow.lessonCntDevice++;
|
|
|
break;
|
|
|
|
|
|
case "3": //ID+機器授權
|
|
|
- prodAnalysisRow.deviceAuth++;
|
|
|
+ if (!prodAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) prodAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
|
|
|
prodAnalysisRow.lessonCntIdDevice++;
|
|
|
break;
|
|
|
}
|
|
|
+ prodAnalysisRow.deviceNoAuth = prodAnalysisRow.deviceNoAuthList.Count;
|
|
|
+ prodAnalysisRow.deviceAuth = prodAnalysisRow.deviceAuthList.Count;
|
|
|
if (!string.IsNullOrWhiteSpace(IotTeachingDatRow.tmid) && !prodAnalysisRow.tmidList.Contains(IotTeachingDatRow.tmid))
|
|
|
{
|
|
|
prodAnalysisRow.tmidList.Add(IotTeachingDatRow.tmid);
|
|
|
}
|
|
|
+ prodAnalysisRow.tmidCnt = prodAnalysisRow.tmidList.Count;
|
|
|
prodAnalysisRow.lessonRecord++;
|
|
|
if (IotTeachingDatRow.useIES.Equals("1")) prodAnalysisRow.useIES++;
|
|
|
prodAnalysisRow.useIES5Resource += IotTeachingDatRow.useIES5Resource;
|
|
@@ -158,7 +161,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
if (IotTeachingDatRow.useHita.Equals("1")) prodAnalysisRow.useHita++;
|
|
|
prodAnalysisRow.lessonLengMin += IotTeachingDatRow.lessonLengMin;
|
|
|
prodAnalysisRow.stuShow += IotTeachingDatRow.stuShow;
|
|
|
- prodAnalysisRow.stuLessonLengMin = prodAnalysisRow.lessonLengMin * prodAnalysisRow.stuShow;
|
|
|
+ prodAnalysisRow.stuLessonLengMin += IotTeachingDatRow.lessonLengMin * IotTeachingDatRow.stuShow;
|
|
|
if (IotTeachingDatRow.tPoint >= 70) prodAnalysisRow.tGreen++;
|
|
|
if (IotTeachingDatRow.lTypeCoop.Equals("1")) prodAnalysisRow.lTypeCoop++;
|
|
|
if (IotTeachingDatRow.lTypeIact.Equals("1")) prodAnalysisRow.lTypeIact++;
|
|
@@ -259,7 +262,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
cosmosAllSchSumDay.dateTime = dateTime.ToUnixTimeSeconds();
|
|
|
cosmosAllSchSumDay.deviceList = cosmosAllSchSumDay.deviceList.Union(cosmosSchRow.deviceList).ToList();
|
|
|
cosmosAllSchSumDay.deviceCnt = cosmosAllSchSumDay.deviceList.Count;
|
|
|
+ cosmosAllSchSumDay.deviceAuthList = cosmosAllSchSumDay.deviceAuthList.Union(cosmosSchRow.deviceAuthList).ToList();
|
|
|
+ cosmosAllSchSumDay.deviceAuth = cosmosAllSchSumDay.deviceAuthList.Count;
|
|
|
+ cosmosAllSchSumDay.deviceNoAuthList = cosmosAllSchSumDay.deviceNoAuthList.Union(cosmosSchRow.deviceNoAuthList).ToList();
|
|
|
+ cosmosAllSchSumDay.deviceNoAuth = cosmosAllSchSumDay.deviceNoAuthList.Count;
|
|
|
cosmosAllSchSumDay.tmidList = cosmosAllSchSumDay.tmidList.Union(cosmosSchRow.tmidList).ToList();
|
|
|
+ cosmosAllSchSumDay.tmidCnt = cosmosAllSchSumDay.tmidList.Count;
|
|
|
if (cosmosAllSchSumDayDic.ContainsKey(toolType)) cosmosAllSchSumDayDic[toolType] = cosmosAllSchSumDay;
|
|
|
else cosmosAllSchSumDayDic.Add(toolType, cosmosAllSchSumDay);
|
|
|
}
|
|
@@ -327,7 +335,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
SchDataNow.deviceList = SchDataNow.deviceList.Union(SchDataTodo.deviceList).ToList();
|
|
|
SchDataNow.deviceCnt = SchDataNow.deviceList.Count;
|
|
|
+ SchDataNow.deviceAuthList = SchDataNow.deviceAuthList.Union(SchDataTodo.deviceAuthList).ToList();
|
|
|
+ SchDataNow.deviceAuth = SchDataNow.deviceAuthList.Count;
|
|
|
+ SchDataNow.deviceNoAuthList = SchDataNow.deviceNoAuthList.Union(SchDataTodo.deviceNoAuthList).ToList();
|
|
|
+ SchDataNow.deviceNoAuth = SchDataNow.deviceNoAuthList.Count;
|
|
|
SchDataNow.tmidList = SchDataNow.tmidList.Union(SchDataTodo.tmidList).ToList();
|
|
|
+ SchDataNow.tmidCnt = SchDataNow.tmidList.Count;
|
|
|
}
|
|
|
//無此校資料 => 該校資料放入
|
|
|
else
|
|
@@ -405,7 +418,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
cosmosAllSchSumMonth.dateTime = dateTime.ToUnixTimeSeconds();
|
|
|
cosmosAllSchSumMonth.deviceList = cosmosAllSchSumMonth.deviceList.Union(cosmosSchRow.deviceList).ToList();
|
|
|
cosmosAllSchSumMonth.deviceCnt = cosmosAllSchSumMonth.deviceList.Count;
|
|
|
+ cosmosAllSchSumMonth.deviceAuthList = cosmosAllSchSumMonth.deviceAuthList.Union(cosmosSchRow.deviceAuthList).ToList();
|
|
|
+ cosmosAllSchSumMonth.deviceAuth = cosmosAllSchSumMonth.deviceAuthList.Count;
|
|
|
+ cosmosAllSchSumMonth.deviceNoAuthList = cosmosAllSchSumMonth.deviceNoAuthList.Union(cosmosSchRow.deviceNoAuthList).ToList();
|
|
|
+ cosmosAllSchSumMonth.deviceNoAuth = cosmosAllSchSumMonth.deviceNoAuthList.Count;
|
|
|
cosmosAllSchSumMonth.tmidList = cosmosAllSchSumMonth.tmidList.Union(cosmosSchRow.tmidList).ToList();
|
|
|
+ cosmosAllSchSumMonth.tmidCnt = cosmosAllSchSumMonth.tmidList.Count;
|
|
|
if (cosmosAllSchSumMonthDic.ContainsKey(toolType)) cosmosAllSchSumMonthDic[toolType] = cosmosAllSchSumMonth;
|
|
|
else cosmosAllSchSumMonthDic.Add(toolType, cosmosAllSchSumMonth);
|
|
|
}
|
|
@@ -451,7 +469,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
SchDataNow.deviceList = SchDataNow.deviceList.Union(SchDataTodo.deviceList).ToList();
|
|
|
SchDataNow.deviceCnt = SchDataNow.deviceList.Count;
|
|
|
+ SchDataNow.deviceAuthList = SchDataNow.deviceAuthList.Union(SchDataTodo.deviceAuthList).ToList();
|
|
|
+ SchDataNow.deviceAuth = SchDataNow.deviceAuthList.Count;
|
|
|
+ SchDataNow.deviceNoAuthList = SchDataNow.deviceNoAuthList.Union(SchDataTodo.deviceNoAuthList).ToList();
|
|
|
+ SchDataNow.deviceNoAuth = SchDataNow.deviceNoAuthList.Count;
|
|
|
SchDataNow.tmidList = SchDataNow.tmidList.Union(SchDataTodo.tmidList).ToList();
|
|
|
+ SchDataNow.tmidCnt = SchDataNow.tmidList.Count;
|
|
|
}
|
|
|
//無此校資料 => 該校資料放入
|
|
|
else
|
|
@@ -519,7 +542,12 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
SchDataNow.dateTime = dateTime.ToUnixTimeSeconds();
|
|
|
SchDataNow.deviceList = SchDataNow.deviceList.Union(yearCosmosSchData.deviceList).ToList();
|
|
|
SchDataNow.deviceCnt = SchDataNow.deviceList.Count;
|
|
|
+ SchDataNow.deviceAuthList = SchDataNow.deviceAuthList.Union(yearCosmosSchData.deviceAuthList).ToList();
|
|
|
+ SchDataNow.deviceAuth = SchDataNow.deviceAuthList.Count;
|
|
|
+ SchDataNow.deviceNoAuthList = SchDataNow.deviceNoAuthList.Union(yearCosmosSchData.deviceNoAuthList).ToList();
|
|
|
+ SchDataNow.deviceNoAuth = SchDataNow.deviceNoAuthList.Count;
|
|
|
SchDataNow.tmidList = SchDataNow.tmidList.Union(yearCosmosSchData.tmidList).ToList();
|
|
|
+ SchDataNow.tmidCnt = SchDataNow.tmidList.Count;
|
|
|
}
|
|
|
await _azureCosmosClient.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync<ProdAnalysisCosmos>(SchDataNow);
|
|
|
}
|