Ver Fonte

AZFunction追加IOT統計地理位置架構

jeff há 3 meses atrás
pai
commit
7afb923899

+ 3 - 0
TEAMModelOS.Function/TEAMModelOS.Function.csproj

@@ -63,6 +63,9 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToPublishDirectory>Never</CopyToPublishDirectory>
     </None>
+	<None Update="Services\ipip.ipdb">
+	  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+	</None>
   </ItemGroup>
   <ItemGroup>
     <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />

+ 102 - 99
TEAMModelOS.SDK/Models/Service/BI/BIProdAnalysis.cs

@@ -1113,110 +1113,113 @@ namespace TEAMModelOS.SDK.Models.Service.BI
                             else if (IotTeachingDatRow.deviceId.Contains("HiTA-")) toolType = "HiTA";
                         }
                         Geo geo = IotTeachingDatRow.geo;
-                        string countryId = (!string.IsNullOrWhiteSpace(geo.countryId)) ? geo.countryId : string.Empty;
-                        string provinceId = (!string.IsNullOrWhiteSpace(geo.provinceId)) ? geo.provinceId : string.Empty;
-                        string cityId = (!string.IsNullOrWhiteSpace(geo.cityId)) ? geo.cityId : string.Empty;
-                        string distId = (!string.IsNullOrWhiteSpace(geo.distId)) ? geo.distId : string.Empty;
-                        string geoId = $"{countryId}-{provinceId}-{cityId}-{distId}";
-                        if (!string.IsNullOrWhiteSpace(geo.countryId))
+                        if(geo != null)
                         {
-                            bool addFlg = false;
-                            GeoAnalysis geoAnalysisRow = GeoAnalysisList.Where(s => s.geoId.Equals(geoId) && s.toolType.Equals(toolType)).FirstOrDefault();
-                            //無此geoId數據=>創建
-                            if (geoAnalysisRow == null)
-                            {
-                                geoAnalysisRow = new GeoAnalysis();
-                                geoAnalysisRow.geoId = geoId;
-                                geoAnalysisRow.geo = geo;
-                                geoAnalysisRow.toolType = toolType;
-                                addFlg = true;
-                            }
-                            //欄位加總
-                            if (!geoAnalysisRow.deviceList.Contains(IotTeachingDatRow.deviceId))
+                            string countryId = (!string.IsNullOrWhiteSpace(geo.countryId)) ? geo.countryId : string.Empty;
+                            string provinceId = (!string.IsNullOrWhiteSpace(geo.provinceId)) ? geo.provinceId : string.Empty;
+                            string cityId = (!string.IsNullOrWhiteSpace(geo.cityId)) ? geo.cityId : string.Empty;
+                            string distId = (!string.IsNullOrWhiteSpace(geo.distId)) ? geo.distId : string.Empty;
+                            string geoId = $"{countryId}-{provinceId}-{cityId}-{distId}";
+                            if (!string.IsNullOrWhiteSpace(geo.countryId))
                             {
-                                geoAnalysisRow.deviceList.Add(IotTeachingDatRow.deviceId);
-                            }
-                            geoAnalysisRow.deviceCnt = geoAnalysisRow.deviceList.Count;
-                            switch (IotTeachingDatRow.authType)
-                            {
-                                case "0": //928授權
-                                    if (!geoAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
-                                    geoAnalysisRow.lessonCnt928++;
-                                    break;
+                                bool addFlg = false;
+                                GeoAnalysis geoAnalysisRow = GeoAnalysisList.Where(s => s.geoId.Equals(geoId) && s.toolType.Equals(toolType)).FirstOrDefault();
+                                //無此geoId數據=>創建
+                                if (geoAnalysisRow == null)
+                                {
+                                    geoAnalysisRow = new GeoAnalysis();
+                                    geoAnalysisRow.geoId = geoId;
+                                    geoAnalysisRow.geo = geo;
+                                    geoAnalysisRow.toolType = toolType;
+                                    addFlg = true;
+                                }
+                                //欄位加總
+                                if (!geoAnalysisRow.deviceList.Contains(IotTeachingDatRow.deviceId))
+                                {
+                                    geoAnalysisRow.deviceList.Add(IotTeachingDatRow.deviceId);
+                                }
+                                geoAnalysisRow.deviceCnt = geoAnalysisRow.deviceList.Count;
+                                switch (IotTeachingDatRow.authType)
+                                {
+                                    case "0": //928授權
+                                        if (!geoAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
+                                        geoAnalysisRow.lessonCnt928++;
+                                        break;
 
-                                case "1": //ID授權
-                                    if (!geoAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
-                                    geoAnalysisRow.lessonCntId++;
-                                    break;
+                                    case "1": //ID授權
+                                        if (!geoAnalysisRow.deviceNoAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceNoAuthList.Add(IotTeachingDatRow.deviceId);
+                                        geoAnalysisRow.lessonCntId++;
+                                        break;
 
-                                case "2": //機器授權
-                                    if (!geoAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
-                                    geoAnalysisRow.lessonCntDevice++;
-                                    break;
+                                    case "2": //機器授權
+                                        if (!geoAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
+                                        geoAnalysisRow.lessonCntDevice++;
+                                        break;
 
-                                case "3": //ID+機器授權
-                                    if (!geoAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
-                                    geoAnalysisRow.lessonCntIdDevice++;
-                                    break;
-                            }
-                            geoAnalysisRow.deviceNoAuth = geoAnalysisRow.deviceNoAuthList.Count;
-                            geoAnalysisRow.deviceAuth = geoAnalysisRow.deviceAuthList.Count;
-                            if (!geoAnalysisRow.tmidList.Contains(IotTeachingDatRow.tmid))
-                            {
-                                geoAnalysisRow.tmidList.Add(IotTeachingDatRow.tmid);
-                            }
-                            geoAnalysisRow.tmidCnt = geoAnalysisRow.tmidList.Count;
-                            geoAnalysisRow.lessonRecord++;
-                            if (IotTeachingDatRow.useIES.Equals("1")) geoAnalysisRow.useIES++;
-                            geoAnalysisRow.useIES5Resource += IotTeachingDatRow.useIES5Resource;
-                            if (IotTeachingDatRow.useWebIrs.Equals("1")) geoAnalysisRow.useWebIrs++;
-                            if (IotTeachingDatRow.useDeviceIrs.Equals("1")) geoAnalysisRow.useDeviceIrs++;
-                            if (IotTeachingDatRow.useHaboard.Equals("1")) geoAnalysisRow.useHaboard++;
-                            if (IotTeachingDatRow.useHita.Equals("1")) geoAnalysisRow.useHita++;
-                            geoAnalysisRow.lessonLengMin += IotTeachingDatRow.lessonLengMin;
-                            if (IotTeachingDatRow.lessonLengMin.Equals(0)) geoAnalysisRow.lessonLeng0++;
-                            geoAnalysisRow.stuShow += IotTeachingDatRow.stuShow;
-                            geoAnalysisRow.stuLessonLengMin += IotTeachingDatRow.lessonLengMin * IotTeachingDatRow.stuShow;
-                            if (IotTeachingDatRow.tPoint >= 70) geoAnalysisRow.tGreen++;
-                            if (IotTeachingDatRow.lessonLengMin >= 10 && IotTeachingDatRow.tPoint > 0) geoAnalysisRow.tLesson++;
-                            if (IotTeachingDatRow.lTypeCoop.Equals("1")) geoAnalysisRow.lTypeCoop++;
-                            if (IotTeachingDatRow.lTypeIact.Equals("1")) geoAnalysisRow.lTypeIact++;
-                            if (IotTeachingDatRow.lTypeMis.Equals("1")) geoAnalysisRow.lTypeMis++;
-                            if (IotTeachingDatRow.lTypeTst.Equals("1")) geoAnalysisRow.lTypeTst++;
-                            if (IotTeachingDatRow.lTypeDif.Equals("1")) geoAnalysisRow.lTypeDif++;
-                            if (IotTeachingDatRow.lTypeCoop.Equals("0") && IotTeachingDatRow.lTypeIact.Equals("0") && IotTeachingDatRow.lTypeMis.Equals("0") && IotTeachingDatRow.lTypeTst.Equals("0") && IotTeachingDatRow.lTypeDif.Equals("0")) geoAnalysisRow.lTypeNone++;
-                            geoAnalysisRow.mission += IotTeachingDatRow.mission;
-                            geoAnalysisRow.missionFin += IotTeachingDatRow.missionFin;
-                            geoAnalysisRow.item += IotTeachingDatRow.item;
-                            geoAnalysisRow.interact += IotTeachingDatRow.interact;
-                            if (IotTeachingDatRow.sendSok.Equals("1")) geoAnalysisRow.sendSok++;
-                            if (IotTeachingDatRow.learnPeer.Equals("1")) geoAnalysisRow.learnPeer++;
-                            if (IotTeachingDatRow.learnCoop.Equals("1")) geoAnalysisRow.learnCoop++;
-                            if (IotTeachingDatRow.useWordCloud.Equals("1")) geoAnalysisRow.useWordCloud++;
-                            if (IotTeachingDatRow.useClouDAS.Equals("1")) geoAnalysisRow.useClouDAS++;
-                            if (IotTeachingDatRow.useGPT.Equals("1")) geoAnalysisRow.useGPT++;
-                            if (IotTeachingDatRow.useIes5Test.Equals("1")) geoAnalysisRow.useIes5Test++;
-                            if (IotTeachingDatRow.usePaperTest.Equals("1")) geoAnalysisRow.usePaperTest++;
-                            if (IotTeachingDatRow.useExcelTest.Equals("1")) geoAnalysisRow.useExcelTest++;
-                            if (IotTeachingDatRow.useScoreBoard.Equals("1")) geoAnalysisRow.useScoreBoard++; //課堂中使用記分板
-                            if (IotTeachingDatRow.learnParticipationCnt.Equals("1")) geoAnalysisRow.learnParticipationCnt++; //學習參與度次數
-                            geoAnalysisRow.learnParticipationT += IotTeachingDatRow.learnParticipation; //學習參與度指數(總和)
-                            decimal learnParticipationTmp = (geoAnalysisRow.learnParticipationCnt > 0) ? (decimal)geoAnalysisRow.learnParticipationT / (decimal)geoAnalysisRow.learnParticipationCnt : 0;
-                            geoAnalysisRow.learnParticipation = Math.Round(learnParticipationTmp, 2); //學習參與度指數(平均)
-                            geoAnalysisRow.coopMission += IotTeachingDatRow.coopMission; //協作任務數
-                            geoAnalysisRow.coopWork += IotTeachingDatRow.coopWork; //協作作品數
-                            geoAnalysisRow.coopContributionT += IotTeachingDatRow.coopContributionT; //協作總貢獻度
-                            geoAnalysisRow.peerAct += IotTeachingDatRow.peerAct; //互評活動次數
-                            geoAnalysisRow.peerStuParticipationT += IotTeachingDatRow.peerStuParticipationT; //互評學生參與總次數
-                            if (IotTeachingDatRow.useTransMode.Equals("1")) geoAnalysisRow.useTransMode++; //有使用透明模式
-                            if (IotTeachingDatRow.useMiniMode.Equals("1")) geoAnalysisRow.useMiniMode++; //有使用最小化模式
-                            if (!string.IsNullOrWhiteSpace(ver) && !geoAnalysisRow.verList.Contains(ver))
-                            {
-                                geoAnalysisRow.verList.Add(ver);
-                            }
-                            if (addFlg)
-                            {
-                                GeoAnalysisList.Add(geoAnalysisRow);
+                                    case "3": //ID+機器授權
+                                        if (!geoAnalysisRow.deviceAuthList.Contains(IotTeachingDatRow.deviceId)) geoAnalysisRow.deviceAuthList.Add(IotTeachingDatRow.deviceId);
+                                        geoAnalysisRow.lessonCntIdDevice++;
+                                        break;
+                                }
+                                geoAnalysisRow.deviceNoAuth = geoAnalysisRow.deviceNoAuthList.Count;
+                                geoAnalysisRow.deviceAuth = geoAnalysisRow.deviceAuthList.Count;
+                                if (!geoAnalysisRow.tmidList.Contains(IotTeachingDatRow.tmid))
+                                {
+                                    geoAnalysisRow.tmidList.Add(IotTeachingDatRow.tmid);
+                                }
+                                geoAnalysisRow.tmidCnt = geoAnalysisRow.tmidList.Count;
+                                geoAnalysisRow.lessonRecord++;
+                                if (IotTeachingDatRow.useIES.Equals("1")) geoAnalysisRow.useIES++;
+                                geoAnalysisRow.useIES5Resource += IotTeachingDatRow.useIES5Resource;
+                                if (IotTeachingDatRow.useWebIrs.Equals("1")) geoAnalysisRow.useWebIrs++;
+                                if (IotTeachingDatRow.useDeviceIrs.Equals("1")) geoAnalysisRow.useDeviceIrs++;
+                                if (IotTeachingDatRow.useHaboard.Equals("1")) geoAnalysisRow.useHaboard++;
+                                if (IotTeachingDatRow.useHita.Equals("1")) geoAnalysisRow.useHita++;
+                                geoAnalysisRow.lessonLengMin += IotTeachingDatRow.lessonLengMin;
+                                if (IotTeachingDatRow.lessonLengMin.Equals(0)) geoAnalysisRow.lessonLeng0++;
+                                geoAnalysisRow.stuShow += IotTeachingDatRow.stuShow;
+                                geoAnalysisRow.stuLessonLengMin += IotTeachingDatRow.lessonLengMin * IotTeachingDatRow.stuShow;
+                                if (IotTeachingDatRow.tPoint >= 70) geoAnalysisRow.tGreen++;
+                                if (IotTeachingDatRow.lessonLengMin >= 10 && IotTeachingDatRow.tPoint > 0) geoAnalysisRow.tLesson++;
+                                if (IotTeachingDatRow.lTypeCoop.Equals("1")) geoAnalysisRow.lTypeCoop++;
+                                if (IotTeachingDatRow.lTypeIact.Equals("1")) geoAnalysisRow.lTypeIact++;
+                                if (IotTeachingDatRow.lTypeMis.Equals("1")) geoAnalysisRow.lTypeMis++;
+                                if (IotTeachingDatRow.lTypeTst.Equals("1")) geoAnalysisRow.lTypeTst++;
+                                if (IotTeachingDatRow.lTypeDif.Equals("1")) geoAnalysisRow.lTypeDif++;
+                                if (IotTeachingDatRow.lTypeCoop.Equals("0") && IotTeachingDatRow.lTypeIact.Equals("0") && IotTeachingDatRow.lTypeMis.Equals("0") && IotTeachingDatRow.lTypeTst.Equals("0") && IotTeachingDatRow.lTypeDif.Equals("0")) geoAnalysisRow.lTypeNone++;
+                                geoAnalysisRow.mission += IotTeachingDatRow.mission;
+                                geoAnalysisRow.missionFin += IotTeachingDatRow.missionFin;
+                                geoAnalysisRow.item += IotTeachingDatRow.item;
+                                geoAnalysisRow.interact += IotTeachingDatRow.interact;
+                                if (IotTeachingDatRow.sendSok.Equals("1")) geoAnalysisRow.sendSok++;
+                                if (IotTeachingDatRow.learnPeer.Equals("1")) geoAnalysisRow.learnPeer++;
+                                if (IotTeachingDatRow.learnCoop.Equals("1")) geoAnalysisRow.learnCoop++;
+                                if (IotTeachingDatRow.useWordCloud.Equals("1")) geoAnalysisRow.useWordCloud++;
+                                if (IotTeachingDatRow.useClouDAS.Equals("1")) geoAnalysisRow.useClouDAS++;
+                                if (IotTeachingDatRow.useGPT.Equals("1")) geoAnalysisRow.useGPT++;
+                                if (IotTeachingDatRow.useIes5Test.Equals("1")) geoAnalysisRow.useIes5Test++;
+                                if (IotTeachingDatRow.usePaperTest.Equals("1")) geoAnalysisRow.usePaperTest++;
+                                if (IotTeachingDatRow.useExcelTest.Equals("1")) geoAnalysisRow.useExcelTest++;
+                                if (IotTeachingDatRow.useScoreBoard.Equals("1")) geoAnalysisRow.useScoreBoard++; //課堂中使用記分板
+                                if (IotTeachingDatRow.learnParticipationCnt.Equals("1")) geoAnalysisRow.learnParticipationCnt++; //學習參與度次數
+                                geoAnalysisRow.learnParticipationT += IotTeachingDatRow.learnParticipation; //學習參與度指數(總和)
+                                decimal learnParticipationTmp = (geoAnalysisRow.learnParticipationCnt > 0) ? (decimal)geoAnalysisRow.learnParticipationT / (decimal)geoAnalysisRow.learnParticipationCnt : 0;
+                                geoAnalysisRow.learnParticipation = Math.Round(learnParticipationTmp, 2); //學習參與度指數(平均)
+                                geoAnalysisRow.coopMission += IotTeachingDatRow.coopMission; //協作任務數
+                                geoAnalysisRow.coopWork += IotTeachingDatRow.coopWork; //協作作品數
+                                geoAnalysisRow.coopContributionT += IotTeachingDatRow.coopContributionT; //協作總貢獻度
+                                geoAnalysisRow.peerAct += IotTeachingDatRow.peerAct; //互評活動次數
+                                geoAnalysisRow.peerStuParticipationT += IotTeachingDatRow.peerStuParticipationT; //互評學生參與總次數
+                                if (IotTeachingDatRow.useTransMode.Equals("1")) geoAnalysisRow.useTransMode++; //有使用透明模式
+                                if (IotTeachingDatRow.useMiniMode.Equals("1")) geoAnalysisRow.useMiniMode++; //有使用最小化模式
+                                if (!string.IsNullOrWhiteSpace(ver) && !geoAnalysisRow.verList.Contains(ver))
+                                {
+                                    geoAnalysisRow.verList.Add(ver);
+                                }
+                                if (addFlg)
+                                {
+                                    GeoAnalysisList.Add(geoAnalysisRow);
+                                }
                             }
                         }
                     }

+ 6 - 0
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -56,4 +56,10 @@
 	<ItemGroup>
 	  <ProjectReference Include="..\TEAMModelOS.Extension\IES.Exam\IES.ExamLibrary\IES.ExamLibrary.csproj" />
 	</ItemGroup>
+	
+	<ItemGroup>
+	  <None Update="JsonFile/Region/*.json">
+		<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+	  </None>
+	</ItemGroup>
 </Project>