Browse Source

update ,省平台数据接口推送校验。

CrazyIter_Bin 3 năm trước cách đây
mục cha
commit
5d16f7933c

+ 133 - 64
TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs

@@ -542,7 +542,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             }
             }
             if (members.IsNotEmpty())
             if (members.IsNotEmpty())
             {
             {
-                queryText = new StringBuilder($"SELECT distinct value(c) FROM c where " +
+                queryText = new StringBuilder($"SELECT distinct value(c) FROM c where 1=1  " +
                     $"and  c.id in ({string.Join(",", members.Select(x => $"'{x.id}'"))}) ");
                     $"and  c.id in ({string.Join(",", members.Select(x => $"'{x.id}'"))}) ");
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
                 requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
                 requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
@@ -563,8 +563,9 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             List<ScTeacherDiagnosis> scTeacherDiagnoses = await table.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "schoolCode", $"{school}" } });
             List<ScTeacherDiagnosis> scTeacherDiagnoses = await table.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "schoolCode", $"{school}" } });
             
             
             List<KeyValuePair<TeacherTrain, string>> trainsNO = new List<KeyValuePair<TeacherTrain, string>>();
             List<KeyValuePair<TeacherTrain, string>> trainsNO = new List<KeyValuePair<TeacherTrain, string>>();
-            List<PushFail> fails = new List<PushFail>();
-            
+          
+            List<ScsResult> results = new List<ScsResult>();
+            Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
             int pages = (trains.Count + 19) / 20; //pages = (total + max -1) / max;
             int pages = (trains.Count + 19) / 20; //pages = (total + max -1) / max;
             for (int i = 0; i < pages; i++) {
             for (int i = 0; i < pages; i++) {
                 List<TeacherTrain> lists = trains.Skip((i) * 20).Take(20).ToList();
                 List<TeacherTrain> lists = trains.Skip((i) * 20).Take(20).ToList();
@@ -600,13 +601,16 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                 parameterContent53122.Add("TrainComID", config.trainComID);
                 parameterContent53122.Add("TrainComID", config.trainComID);
                 parameterContent53122.Add("List", list53122);
                 parameterContent53122.Add("List", list53122);
                 //装载数据
                 //装载数据
+               
                 foreach (var x in lists) {
                 foreach (var x in lists) {
                     List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
                     List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
-                    List<ScTeacher> teacher = scTeachers.FindAll(t => t.tmdid.Equals(x.id));
+                    List<ScTeacher> teacher = scTeachers.FindAll(t => !string.IsNullOrWhiteSpace(t.tmdid) &&  t.tmdid.Equals(x.id));
                     foreach (var t in teacher)
                     foreach (var t in teacher)
                     {
                     {
-                        ScTeacherDiagnosis diagnosis = scTeacherDiagnoses.Find(x => x.RowKey.Equals(t.PXID));
-
+                        List<PushFail> fails = new List<PushFail>();
+                        Dictionary<string,object> pushData = new Dictionary<string, object>();
+                        string json = scTeacherDiagnoses.ToJsonString();
+                        ScTeacherDiagnosis diagnosis = scTeacherDiagnoses.Find(x => x.RowKey.Equals($"{t.PXID}"));
                         (int t53112OK, List<KeyValuePair<string, string>> msgs53112) = check53112(x, msgs);
                         (int t53112OK, List<KeyValuePair<string, string>> msgs53112) = check53112(x, msgs);
                         (int t53113OK, List<KeyValuePair<string, string>> msgs53113, List<AbilitySub> abilitySubs) = await check53113(x, diagnosis, msgs);
                         (int t53113OK, List<KeyValuePair<string, string>> msgs53113, List<AbilitySub> abilitySubs) = await check53113(x, diagnosis, msgs);
                         (int t53117OK, List<KeyValuePair<string, string>> msgs53117) = check53117(x, msgs);
                         (int t53117OK, List<KeyValuePair<string, string>> msgs53117) = check53117(x, msgs);
@@ -648,15 +652,18 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                                     break;
                                     break;
                             }
                             }
                             parameterMapData.Add("ComPassed", ComPassed);//0、未认定  1、合格  2、优秀  3、不合格  4、其他
                             parameterMapData.Add("ComPassed", ComPassed);//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                            pushData.Add("success-UpdateTeacherListSituation", parameterMapData);
                             list53112.Add(parameterMapData);
                             list53112.Add(parameterMapData);
                         }
                         }
                         else
                         else
                         {
                         {
+                            pushData.Add("fail-UpdateTeacherListSituation", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112 });
                         }
                         }
                         //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
                         //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
                         if (t53113OK == 1)
                         if (t53113OK == 1)
                         {
                         {
+                           List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
                             x.currency.teacherAilities.ForEach(a => {
                             x.currency.teacherAilities.ForEach(a => {
                                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                                 parameterMapData.Add("PXID", $"{t.PXID}");
                                 parameterMapData.Add("PXID", $"{t.PXID}");
@@ -744,15 +751,20 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                                     });
                                     });
                                 }
                                 }
                                 list53113.Add(parameterMapData);
                                 list53113.Add(parameterMapData);
+                                parameterMapDatas.Add(parameterMapData);
                             });
                             });
+                            pushData.Add("success-UpdateTeacherListDiagnosis", parameterMapDatas);
+
                         }
                         }
                         else
                         else
                         {
                         {
+                            pushData.Add("fail-UpdateTeacherListDiagnosis", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113 });
                         }
                         }
                         //5.3.1.17学员课堂实录批量回写-UploadKTSLList
                         //5.3.1.17学员课堂实录批量回写-UploadKTSLList
                         if (t53117OK == 1)
                         if (t53117OK == 1)
                         {
                         {
+                            List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
                             x.teacherClasses.ForEach(clss =>
                             x.teacherClasses.ForEach(clss =>
                             {
                             {
                                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
@@ -766,10 +778,13 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                                 string fileext = clss.url.Substring(clss.url.LastIndexOf(".") > 0 ? clss.url.LastIndexOf(".") + 1 : 0);
                                 string fileext = clss.url.Substring(clss.url.LastIndexOf(".") > 0 ? clss.url.LastIndexOf(".") + 1 : 0);
                                 parameterMapData.Add("fileType", fileext);
                                 parameterMapData.Add("fileType", fileext);
                                 list53117.Add(parameterMapData);
                                 list53117.Add(parameterMapData);
+                                parameterMapDatas.Add(parameterMapData);
                             });
                             });
+                            pushData.Add("success-UploadKTSLList", parameterMapDatas);
                         }
                         }
                         else
                         else
                         {
                         {
+                            pushData.Add("fail-UploadKTSLList", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117 });
                         }
                         }
                         //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
                         //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
@@ -780,43 +795,51 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             parameterMapData.Add("TID", $"{t.TID}");
                             parameterMapData.Add("TID", $"{t.TID}");
                             List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
                             List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
                             x.offlineRecords.ForEach(record => {
                             x.offlineRecords.ForEach(record => {
-                                Dictionary<string, object> fileMap = new Dictionary<string, object>();
-                                fileMap.Add("url", record.url);
-                                fileMap.Add("fileName", record.name);
-                                fileMap.Add("fileSize", record.size);
-                                fileMap.Add("md5", record.hash);
-                                string fileext = record.url.Substring(record.url.LastIndexOf(".") > 0 ? record.url.LastIndexOf(".") + 1 : 0);
-                                fileMap.Add("fileType", fileext);
-                                files.Add(fileMap);
+                                if (!string.IsNullOrWhiteSpace(record.url)) {
+                                    Dictionary<string, object> fileMap = new Dictionary<string, object>();
+                                    fileMap.Add("url", record.url);
+                                    fileMap.Add("fileName", record.name);
+                                    fileMap.Add("fileSize", record.size);
+                                    fileMap.Add("md5", record.hash);
+                                    string fileext = record.url.Substring(record.url.LastIndexOf(".") > 0 ? record.url.LastIndexOf(".") + 1 : 0);
+                                    fileMap.Add("fileType", fileext);
+                                    files.Add(fileMap);
+                                }
                             });
                             });
                             parameterMapData.Add("files", files);
                             parameterMapData.Add("files", files);
                             list53122.Add(parameterMapData);
                             list53122.Add(parameterMapData);
+                            pushData.Add("success-UploadSBTARPDFListV2", parameterMapData);
                         }
                         }
                         else
                         else
                         {
                         {
+                            pushData.Add("fail-UploadSBTARPDFListV2", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122 });
                             fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122 });
                         }
                         }
+                        pushDatas.Add(t.tmdid,pushData);
                     }
                     }
                 }
                 }
                 //推送数据
                 //推送数据
-                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterContent53112);
+                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
                 UpdateTeacherListSituation.code = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.code = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
 
 
-                UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterContent53113);
+                UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
                 UpdateTeacherListDiagnosis.code = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.code = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
 
 
-                UploadKTSLList = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterContent53117);
+                UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
                 UploadKTSLList.code = "UploadKTSLList";
                 UploadKTSLList.code = "UploadKTSLList";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
 
 
-                UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterContent53122);
+                UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
                 UploadSBTARPDFListV2.code = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.code = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
-
+                results.Add(UpdateTeacherListSituation);
+                results.Add(UpdateTeacherListDiagnosis);
+                results.Add(UploadKTSLList);
+                results.Add(UploadSBTARPDFListV2);
             }
             }
-            await response.WriteAsJsonAsync(new { });
+            await response.WriteAsJsonAsync(new { data= new { results, pushDatas } });
             return response;
             return response;
         }
         }
         //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
         //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
@@ -826,15 +849,20 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             {
             {
                 msgs.Add(new KeyValuePair<string, string>("offlineRecord-count", $"文件个数为0"));
                 msgs.Add(new KeyValuePair<string, string>("offlineRecord-count", $"文件个数为0"));
             }
             }
-            teacherTrain.offlineRecords.ForEach(x => {
-                if (string.IsNullOrEmpty(x.url)) {
-                    msgs.Add(new KeyValuePair<string, string>("offlineRecord-url", $"链接为空"));
-                }
-                if (x.size<=0)
-                {
-                    msgs.Add(new KeyValuePair<string, string>("offlineRecord-size", $"文件大小"));
-                }
-            });
+            var hasUrl= teacherTrain.offlineRecords.Where(x => !string.IsNullOrWhiteSpace(x.url) && x.size > 0);
+            if (!hasUrl.Any()) {
+                msgs.Add(new KeyValuePair<string, string>("offlineRecord-url", $"需要上传的校本研修作业至少有一个。"));
+            }
+            //不需要检查每一个校本研修的文件记录。
+            //teacherTrain.offlineRecords.ForEach(x => {
+            //    if (string.IsNullOrEmpty(x.url)) {
+            //        msgs.Add(new KeyValuePair<string, string>("offlineRecord-url", $"链接为空"));
+            //    }
+            //    if (x.size<=0)
+            //    {
+            //        msgs.Add(new KeyValuePair<string, string>("offlineRecord-size", $"文件大小"));
+            //    }
+            //});
             return (t53122OK, msgs);
             return (t53122OK, msgs);
         }
         }
 
 
@@ -871,10 +899,17 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                 msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
                 msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
                 t53112OK = 0;
                 t53112OK = 0;
             }
             }
-            if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
+            //if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
+            //{
+            //    string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
+            //    msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
+            //    t53112OK = 0;
+            //}
+
+            if (!string.IsNullOrEmpty(teacherTrain.summary)  &&  teacherTrain.summary.Length > 300)
             {
             {
-                string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
-                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
+                //string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
+                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:字数超过300."));
                 t53112OK = 0;
                 t53112OK = 0;
             }
             }
             if (teacherTrain.totalTime <= 0)
             if (teacherTrain.totalTime <= 0)
@@ -900,48 +935,82 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                 msgs.Add(new KeyValuePair<string, string>("submitTime", $"认证材料学习:{teacherTrain.currency.submitTime}"));
                 msgs.Add(new KeyValuePair<string, string>("submitTime", $"认证材料学习:{teacherTrain.currency.submitTime}"));
                 t53113OK = 0;
                 t53113OK = 0;
             }
             }
-            if (teacherTrain.currency.teacherAilities.Count <= 0  || teacherTrain.currency.teacherAilities.Select(x=>x.no).Count()<=0)
+            if (teacherTrain.currency.teacherAilities.Count <= 0  )
             {
             {
-                msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"能力点不匹配:{teacherTrain.currency.submitTime}"));
+                
+                msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"已学习能力点:0"));
                 t53113OK = 0;
                 t53113OK = 0;
             }
             }
-            if (teacherTrain.currency.teacherAilities.Count <= 0 || teacherTrain.currency.teacherAilities.Select(x => x.no).Count() <= 0)
+            if (diagnosis != null)
             {
             {
-
-                string insql = "";
-                if (teacherTrain.currency.teacherAilities.IsNotEmpty())
-                {
-                    IEnumerable<string> ds= diagnosis.abilityNos.ToObject<List<string>>().Except(teacherTrain.currency.teacherAilities.Select(x => x.no));
-                    if (ds != null && ds.Count() > 0) {
-                        msgs.Add(new KeyValuePair<string, string>("diagnosisNos", $"省平台勾选的能力点编号为学习完成:省平台:{diagnosis.abilityNos},已学习:{teacherTrain.currency.teacherAilities.Select(x => x.no).ToJsonString()}"));
-                    }
-                    insql = $" where c.id in ({string.Join(",", teacherTrain.currency.teacherAilities.Select(o => $"'{o.id}'"))})";
-                }
-                //认证材料
-                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
-                         .GetItemQueryIterator<AbilitySub>(queryText: $"select value(c) from c {insql}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilitySub-{teacherTrain.school}-{teacherTrain.id}") }))
+                if (!string.IsNullOrWhiteSpace(diagnosis.abilityNos))
                 {
                 {
-                    abilitySubs.Add(item);
-                }
-                teacherTrain.currency.teacherAilities.ForEach(x => {
-                    var  abilitySub= abilitySubs.Find(z => z.id.Equals(x.id));
-                    if (abilitySub == null || abilitySub.uploads.IsNotEmpty()) {
-                        msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
-                    }
-                    if (x.zpscore <= 0) {
-                        msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
-                    }
-                    if (x.hpscore <= 0)
+                    List<string> nos = diagnosis.abilityNos.ToObject<List<string>>();
+                    if (nos.Count > 0 && teacherTrain.currency.teacherAilities.Count > 0)
                     {
                     {
-                        msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
+                        var notin = nos.Except(teacherTrain.currency.teacherAilities.Select(x => x.no).Where(z=>!string.IsNullOrWhiteSpace(z)));
+                        if (notin.Any())
+                        {
+                            msgs.Add(new KeyValuePair<string, string>("diagnosisNos", $"省平台勾选的能力点编号为学习完成:省平台:{string.Join(",", nos.OrderBy(x => x))}" + $" ,已学习:{string.Join(",", teacherTrain.currency.teacherAilities.Select(x => x.no).OrderBy(x=>x))} "));
+                            t53113OK = 0;
+                        }
+                        else {
+                            string insql = "";
+                            if (teacherTrain.currency.teacherAilities.IsNotEmpty())
+                            {
+                                var abilites=  teacherTrain.currency.teacherAilities.Where(c => !string.IsNullOrWhiteSpace(c.no) &&   nos.Contains(c.no));
+                                insql = $" where c.id in ({string.Join(",", abilites.Select(o => $"'{o.id}'"))})";
+                            }
+                            //认证材料
+                            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher")
+                                     .GetItemQueryIterator<AbilitySub>(queryText: $"select value(c) from c {insql}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"AbilitySub-{teacherTrain.school}-{teacherTrain.id}") }))
+                            {
+                                abilitySubs.Add(item);
+                            }
+                            teacherTrain.currency.teacherAilities.ForEach(x => {
+                                var abilitySub = abilitySubs.Find(z => z.id.Equals(x.id));
+                                if (abilitySub == null || !abilitySub.uploads.Any())
+                                {
+                                    t53113OK = 0;
+                                    msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
+                                }
+                                if (x.zpscore <= 0)
+                                {
+                                    t53113OK = 0;
+                                    msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
+                                }
+                                if (x.hpscore <= 0)
+                                {
+                                    t53113OK = 0;
+                                    msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
+                                }
+                                if (x.xzscore <= 0)
+                                {
+                                    t53113OK = 0;
+                                    msgs.Add(new KeyValuePair<string, string>("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
+                                }
+                            });
+                            if (t53113OK != 1) {
+                                msgs.Add(new KeyValuePair<string, string>("diagnosisNos", $"省平台勾选的能力点编号为学习完成:省平台:{string.Join(",", nos.OrderBy(x=>x))}" + $" ,已学习:{string.Join(",", teacherTrain.currency.teacherAilities.Select(x => x.no).OrderBy(x => x))} "));
+                            }
+                        }
                     }
                     }
-                    if (x.xzscore <= 0)
-                    {
-                        msgs.Add(new KeyValuePair<string, string>("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
+                    else {
+                        msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
+                        t53113OK = 0;
                     }
                     }
-                });
+                }
+                else {
+                    msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
+                    t53113OK = 0;
+                }
+            }
+            else {
+                msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
                 t53113OK = 0;
                 t53113OK = 0;
             }
             }
+
+            
             return (t53113OK, msgs, abilitySubs);
             return (t53113OK, msgs, abilitySubs);
         }
         }
     }
     }

+ 16 - 1
TEAMModelOS.FunctionV4/local.settings.json

@@ -4,7 +4,6 @@
     "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=teammodellog;AccountKey=lxVDrgs+6rKtmASL3k1WrarrEd5Rk42wS1Mu5+sqQlPya1JLSlFDtnZUvMPeHHe7zlESfn/1NY7CZdGviy2UCw==;EndpointSuffix=core.chinacloudapi.cn",
     "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=teammodellog;AccountKey=lxVDrgs+6rKtmASL3k1WrarrEd5Rk42wS1Mu5+sqQlPya1JLSlFDtnZUvMPeHHe7zlESfn/1NY7CZdGviy2UCw==;EndpointSuffix=core.chinacloudapi.cn",
     "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
     "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
     "Azure:Storage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn",
     "Azure:Storage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn",
-    //"Azure:Storage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn",
     "Azure:ServiceBus:ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
     "Azure:ServiceBus:ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
     "Azure:Cosmos:ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;",
     "Azure:Cosmos:ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;",
     "Azure:Redis:ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240",
     "Azure:Redis:ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240",
@@ -16,4 +15,20 @@
     "HaBookAuth:CoreService:clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
     "HaBookAuth:CoreService:clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
     "HaBookAuth:CoreService:clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346"
     "HaBookAuth:CoreService:clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346"
   }
   }
+
+  //"Values": {
+  //  "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=teammodellog;AccountKey=lxVDrgs+6rKtmASL3k1WrarrEd5Rk42wS1Mu5+sqQlPya1JLSlFDtnZUvMPeHHe7zlESfn/1NY7CZdGviy2UCw==;EndpointSuffix=core.chinacloudapi.cn",
+  //  "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
+  //  "Azure:Storage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn",
+  //  "Azure:ServiceBus:ConnectionString": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
+  //  "Azure:Cosmos:ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
+  //  "Azure:Redis:ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False",
+  //  "Azure:ServiceBus:ActiveTask": "active-task",
+  //  "Azure:ServiceBus:ItemCondQueue": "itemcond",
+  //  "Option:Location": "China-Dep",
+  //  "HaBookAuth:CoreService:sendnotification": "https://api2.teammodel.cn/service/sendnotification",
+  //  "HaBookAuth:CoreAPI": "https://api2.teammodel.cn",
+  //  "HaBookAuth:CoreService:clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
+  //  "HaBookAuth:CoreService:clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346"
+  //}
 }
 }

+ 1 - 1
TEAMModelOS.SDK/DI/HttpTrigger/HttpTrigger.cs

@@ -38,7 +38,7 @@ namespace TEAMModelOS.SDK.DI
             string domain = "";
             string domain = "";
             if (location.Equals("China-Dep"))
             if (location.Equals("China-Dep"))
             {
             {
-                domain = keys[2];
+                domain = keys[0];
             }
             }
             else if (location.Equals("China-Test"))
             else if (location.Equals("China-Test"))
             {
             {

+ 23 - 16
TEAMModelOS.SDK/Helper/Security/AESCrypt/AESHelper.cs

@@ -38,25 +38,32 @@ namespace TEAMModelOS.SDK
         /// <returns></returns>
         /// <returns></returns>
         public static string AESDecrypt(string toDecrypt, string key)
         public static string AESDecrypt(string toDecrypt, string key)
         {
         {
-            byte[] keyArray = hexStringTobyte(key);
-            byte[] dest = hexStringTobyte(toDecrypt);
-            RijndaelManaged rDel = new RijndaelManaged();
-            rDel.KeySize = 128;
-            rDel.BlockSize = 128;
-            rDel.Key = keyArray;
-            rDel.Mode = CipherMode.ECB;
-            rDel.Padding = PaddingMode.PKCS7;
-            ICryptoTransform cTransform = rDel.CreateDecryptor();
-            try
+            if (string.IsNullOrWhiteSpace(toDecrypt))
             {
             {
-                byte[] resultArray = cTransform.TransformFinalBlock(dest, 0, dest.Length);
-                return UTF8Encoding.UTF8.GetString(resultArray);
+                return "";
             }
             }
-            catch (Exception ex) {
-                return toDecrypt;
+            else {
 
 
-            }
-            
+                byte[] keyArray = hexStringTobyte(key);
+                byte[] dest = hexStringTobyte(toDecrypt);
+                RijndaelManaged rDel = new();
+                rDel.KeySize = 128;
+                rDel.BlockSize = 128;
+                rDel.Key = keyArray;
+                rDel.Mode = CipherMode.ECB;
+                rDel.Padding = PaddingMode.PKCS7;
+                ICryptoTransform cTransform = rDel.CreateDecryptor();
+                try
+                {
+                    byte[] resultArray = cTransform.TransformFinalBlock(dest, 0, dest.Length);
+                    return UTF8Encoding.UTF8.GetString(resultArray);
+                }
+                catch (Exception ex)
+                {
+                    return toDecrypt;
+
+                }
+            }   
         }
         }
 
 
 
 

+ 12 - 0
TEAMModelOS.SDK/Models/Service/Third/ThirdService.cs

@@ -7,6 +7,7 @@ using System.Linq;
 using System.Text;
 using System.Text;
 using System.Text.Json;
 using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
+using TEAMModelOS.Models;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Extension;
 using static TEAMModelOS.SDK.Models.Teacher;
 using static TEAMModelOS.SDK.Models.Teacher;
@@ -285,5 +286,16 @@ namespace TEAMModelOS.SDK.Models
             return abilities;
             return abilities;
         }
         }
 
 
+        public static async Task<string> SchoolDataPush(  AreaSetting setting, HttpTrigger httpTrigger, List<string> pushTeachers, Option _option, string school)
+        {
+            setting.accessConfig.ToObject<JsonElement>().TryGetProperty("config", out JsonElement _config);
+            if ($"{_config}".Equals("scsyxpt")) {
+
+                Dictionary<string, object> dict = new Dictionary<string, object>() { { "accessConfig", setting.accessConfig }, { "pushTeachers", pushTeachers }, { "school", school } };
+                (int status, string json) = await httpTrigger.RequestHttpTrigger(dict, _option.Location, "SchoolDataPush");
+                return json;
+            }
+            return null ;
+        }
     }
     }
 }
 }

+ 33 - 1
TEAMModelOS/Controllers/Normal/AbilityStatisticsController.cs

@@ -33,12 +33,14 @@ namespace TEAMModelOS.Controllers
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly Option _option;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        public AbilityStatisticsController(CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option)
+        private readonly HttpTrigger _httpTrigger;
+        public AbilityStatisticsController(HttpTrigger httpTrigger,CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
             _option = option?.Value;
             _option = option?.Value;
             _coreAPIHttpService=coreAPIHttpService;
             _coreAPIHttpService=coreAPIHttpService;
+            _httpTrigger = httpTrigger;
         }
         }
         /// <summary>
         /// <summary>
         /// 更新教师最终学习分数。
         /// 更新教师最终学习分数。
@@ -277,6 +279,36 @@ namespace TEAMModelOS.Controllers
             public int trainCount { get; set; }
             public int trainCount { get; set; }
         }
         }
 
 
+        /// <summary>
+        /// 校级数据统计
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("push-school-data")]
+        //[AuthToken(Roles = "teacher,admin,area")]
+        //[Authorize(Roles = "IES")]
+        public async Task<IActionResult> SchoolDataPush(JsonElement request) {
+            var client = _azureCosmos.GetCosmosClient();
+            request.TryGetProperty("standard", out JsonElement standard);
+            request.TryGetProperty("school", out JsonElement _school);
+            request.TryGetProperty("pushTeachers", out JsonElement _pushTeachers);
+            List<string> pushTeachers = _pushTeachers.ToObject<List<string>>();
+            (string accessConfig, Area area, AreaSetting setting) = await ThirdService.GetAccessConfig(client, $"{standard}");
+            School school= await client.GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemAsync<School>($"{_school}",new PartitionKey("Base"));
+            if (setting.id.Equals($"{school.areaId}"))
+            {
+                string  json = await ThirdService.SchoolDataPush(setting, _httpTrigger, pushTeachers, _option, $"{_school}");
+                if (!string.IsNullOrWhiteSpace(json)) {
+                    JsonElement element = json.ToObject<JsonElement>();
+                    return Ok(new { element });
+                }
+            }
+            else {
+                return BadRequest("学校不属于该区");
+            }
+            return Ok(pushTeachers);
+        }
         /// <summary>
         /// <summary>
         /// 校级数据统计
         /// 校级数据统计
         /// </summary>
         /// </summary>