CrazyIter_Bin 3 years ago
parent
commit
b21f2365b2

+ 7 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/Inner/CodeValue.cs

@@ -6,6 +6,13 @@ namespace TEAMModelOS.SDK.Models
 {
     public class CodeValue
     {
+        public CodeValue() { 
+        }
+        public CodeValue(string code ,string value)
+        {
+            this.code = code; 
+            this.value=value;
+        }
         public string code { get; set; }
         public string value { get; set; }
     }

+ 5 - 1
TEAMModelOS.SDK/Models/Service/Third/Sc/ScYxptModel.cs

@@ -268,12 +268,16 @@ namespace TEAMModelOS.SDK.Models
     }
     public class PushFail
     {
+        public string type { get; set; }
+        
         public string tmdid { get; set; }
         public string name { get; set; }
         public string picture { get; set; }
         public string school { get; set; }
         public string schoolname { get; set; }
-        public List<KeyValuePair<string, string>> msgs { get; set; }
+        public string code { get; set; }
+        public string msg { get; set; }
+        public List<CodeValue> msgs { get; set; }
     }
     public class ScPush
     {

+ 45 - 47
TEAMModelOS.SDK/Models/Service/Third/ThirdService.cs

@@ -300,25 +300,25 @@ namespace TEAMModelOS.SDK.Models
 
 
         //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
-        public  async static  Task<(int t53122OK, List<KeyValuePair<string, string>> msgs, List<OfflineRecord> allRightOfflineRecords)> check53122(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs,string school,
+        public  async static  Task<(int t53122OK, List<CodeValue> msgs, List<OfflineRecord> allRightOfflineRecords)> check53122(TeacherTrain teacherTrain, List<CodeValue> msgs,string school,
             string schoolPrefix,string sas, AzureStorageFactory _azureStorage)
         {
             int t53122OK = 1;
             if (teacherTrain.offlineRecords.Count <= 0)
             {
                 t53122OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("offlineRecord-count", $"文件个数为0"));
+                msgs.Add(new CodeValue("offlineRecord-count", $"文件个数为0"));
             }
             List<OfflineRecord> allRightOfflineRecords = new List<OfflineRecord>();
             var hasUrl = teacherTrain.offlineRecords.Where(x => !string.IsNullOrWhiteSpace(x.url) && x.size > 0);
             if (!hasUrl.Any())
             {
                 t53122OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("offlineRecord-url", $"需要上传的校本研修作业至少有一个。"));
+                msgs.Add(new CodeValue("offlineRecord-url", $"需要上传的校本研修作业至少有一个。"));
             }
             if (teacherTrain.offlineReport==null) {
                 t53122OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("offlineReport", $"校本研修汇总报告未生成。"));
+                msgs.Add(new CodeValue("offlineReport", $"校本研修汇总报告未生成。"));
 
             }
             List<string> unexistUrl = new List<string>();
@@ -336,36 +336,36 @@ namespace TEAMModelOS.SDK.Models
             if (unexistUrl.Any() && hasUrl.Count() > 0 && hasUrl.Count() == unexistUrl.Count)
             {
                 t53122OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("offlineRecord-url-unexist", $"校本研修文件不存在,{string.Join("  ,   " ,unexistUrl)}"));
+                msgs.Add(new CodeValue("offlineRecord-url-unexist", $"校本研修文件不存在,{string.Join("  ,   " ,unexistUrl)}"));
             }
 
             //不需要检查每一个校本研修的文件记录。
             //teacherTrain.offlineRecords.ForEach(x => {
             //    if (string.IsNullOrEmpty(x.url)) {
-            //        msgs.Add(new KeyValuePair<string, string>("offlineRecord-url", $"链接为空"));
+            //        msgs.Add(new CodeValue("offlineRecord-url", $"链接为空"));
             //    }
             //    if (x.size<=0)
             //    {
-            //        msgs.Add(new KeyValuePair<string, string>("offlineRecord-size", $"文件大小"));
+            //        msgs.Add(new CodeValue("offlineRecord-size", $"文件大小"));
             //    }
             //});
             return (t53122OK, msgs, allRightOfflineRecords);
         }
 
         //5.3.1.17学员课堂实录批量回写-UploadKTSLList
-        public async  static Task<(int t53117OK, List<KeyValuePair<string, string>> msgs)> check53117(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs, string school,
+        public async  static Task<(int t53117OK, List<CodeValue> msgs)> check53117(TeacherTrain teacherTrain, List<CodeValue> msgs, string school,
             string schoolPrefix, string sas, AzureStorageFactory _azureStorage)
         {
             //校验 基本情况是否满足
             int t53117OK = 1;
             if (teacherTrain.classTime <= 0)
             {
-                msgs.Add(new KeyValuePair<string, string>("classTime", $"未获得学时:{teacherTrain.classTime}"));
+                msgs.Add(new CodeValue("classTime", $"未获得学时:{teacherTrain.classTime}"));
                 t53117OK = 0;
             }
             if (teacherTrain.teacherClasses.Count() <= 0)
             {
-                msgs.Add(new KeyValuePair<string, string>("teacherClasses", $"未上传课堂实录:{teacherTrain.teacherClasses.Count()}个视频"));
+                msgs.Add(new CodeValue("teacherClasses", $"未上传课堂实录:{teacherTrain.teacherClasses.Count()}个视频"));
                 t53117OK = 0;
             }
 
@@ -373,7 +373,7 @@ namespace TEAMModelOS.SDK.Models
                 if (string.IsNullOrWhiteSpace(x.url))
                 {
                     t53117OK = 0;
-                    msgs.Add(new KeyValuePair<string, string>("teacherClasses", $"课堂实录链接无效"));
+                    msgs.Add(new CodeValue("teacherClasses", $"课堂实录链接无效"));
                 }
             });
             List<string> unexistUrl = new List<string>();
@@ -389,44 +389,44 @@ namespace TEAMModelOS.SDK.Models
             if (unexistUrl.Any())
             {
                 t53117OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("teacherClasses-url-unexist", $"课堂实录文件不存在,{string.Join("  ,   ", unexistUrl)}"));
+                msgs.Add(new CodeValue("teacherClasses-url-unexist", $"课堂实录文件不存在,{string.Join("  ,   ", unexistUrl)}"));
             }
             return (t53117OK, msgs);
         }
         //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
-        public   static (int t53112OK, List<KeyValuePair<string, string>> msgs) check53112(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
+        public   static (int t53112OK, List<CodeValue> msgs) check53112(TeacherTrain teacherTrain, List<CodeValue> msgs)
         {
             //校验 基本情况是否满足
             int t53112OK = 1;
             if (teacherTrain.finalScore < 0)
             {
                 //总体认定结果0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
+                msgs.Add(new CodeValue("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
                 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}"));
+            //    msgs.Add(new CodeValue("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", $"教师培训总结:字数超过300."));
+                msgs.Add(new CodeValue("summary", $"教师培训总结:字数超过300."));
                 t53112OK = 0;
             }
             if (teacherTrain.totalTime <= 0)
             {
-                msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
+                msgs.Add(new CodeValue("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
                 t53112OK = 0;
             }
             return (t53112OK, msgs);
         }
         //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
-        public  async static Task<(int t53113OK, List<KeyValuePair<string, string>> msgs, List<AbilitySub> abilitySubs, List<AbilitySub>  allRightAbility)> check53113(AzureCosmosFactory _azureCosmos,TeacherTrain teacherTrain, ScTeacherDiagnosis diagnosis, 
-            List<KeyValuePair<string, string>> msgs, string school,
+        public  async static Task<(int t53113OK, List<CodeValue> msgs, List<AbilitySub> abilitySubs, List<AbilitySub>  allRightAbility)> check53113(AzureCosmosFactory _azureCosmos,TeacherTrain teacherTrain, ScTeacherDiagnosis diagnosis, 
+            List<CodeValue> msgs, string school,
             string schoolPrefix, string sas, AzureStorageFactory _azureStorage)
         {
             //校验 基本情况是否满足
@@ -435,18 +435,18 @@ namespace TEAMModelOS.SDK.Models
             List<AbilitySub> abilitySubs = new List<AbilitySub>();
             if (teacherTrain.currency.videoTime < 0)
             {
-                msgs.Add(new KeyValuePair<string, string>("videoTime", $"视频学习时长:{teacherTrain.currency.videoTime}"));
+                msgs.Add(new CodeValue("videoTime", $"视频学习时长:{teacherTrain.currency.videoTime}"));
                 t53113OK = 0;
             }
             if (teacherTrain.currency.submitTime < 0)
             {
-                msgs.Add(new KeyValuePair<string, string>("submitTime", $"认证材料学习:{teacherTrain.currency.submitTime}"));
+                msgs.Add(new CodeValue("submitTime", $"认证材料学习:{teacherTrain.currency.submitTime}"));
                 t53113OK = 0;
             }
             if (teacherTrain.currency.teacherAilities.Count <= 0)
             {
 
-                msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"已学习能力点:0"));
+                msgs.Add(new CodeValue("teacherAilities", $"已学习能力点:0"));
                 t53113OK = 0;
             }
             try {
@@ -458,9 +458,9 @@ namespace TEAMModelOS.SDK.Models
                         if (nos.Count > 0 && teacherTrain.currency.teacherAilities.Count > 0)
                         {
                             var notin = nos.Except(teacherTrain.currency.teacherAilities.Select(x => x.no).Where(z => !string.IsNullOrWhiteSpace(z)));
-                            if (notin.Any())
+                            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))} "));
+                                msgs.Add(new CodeValue("diagnosisNos", $"省平台勾选的能力点编号为学习完成:省平台:{string.Join(",", nos.OrderBy(x => x))}" + $" ,已学习:{string.Join(",", teacherTrain.currency.teacherAilities.Select(x => x.no).OrderBy(x => x))} "));
                                 t53113OK = 0;
                             }
                             else
@@ -486,25 +486,25 @@ namespace TEAMModelOS.SDK.Models
                                         if (abilitySub == null || !abilitySub.uploads.Any())
                                         {
                                             t53113OK = 0;
-                                            msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
+                                            msgs.Add(new CodeValue("uploads", $"未上传认证材料:{x.no},{x.name}"));
                                         }
                                         if (x.zpscore <= 0)
                                         {
                                             t53113OK = 0;
-                                            msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
+                                            msgs.Add(new CodeValue("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
                                         }
                                         if (x.hpscore <= 0)
                                         {
                                             //t53113OK = 0;
                                             //如果只有三个,且互评为未评状态,则直接为合格。
                                             x.hpscore = 1;
-                                            // msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
+                                            // msgs.Add(new CodeValue("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
                                         }
                                         if (x.xzscore <= 0)
                                         {
                                             //t53113OK = 0;
                                             x.xzscore = 1;
-                                            //msgs.Add(new KeyValuePair<string, string>("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
+                                            //msgs.Add(new CodeValue("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
                                         }
                                     });
 
@@ -534,7 +534,7 @@ namespace TEAMModelOS.SDK.Models
                                         {
                                             t53113OK = 0;
                                             var x = teacherTrain.currency.teacherAilities.Find(x => x.id.Equals(abilitySub.id));
-                                            msgs.Add(new KeyValuePair<string, string>("uploads-url", $"{x.no},{x.name}上传的认证材料文件失效:{string.Join("   ,   ", urlUn)}"));
+                                            msgs.Add(new CodeValue("uploads-url", $"{x.no},{x.name}上传的认证材料文件失效:{string.Join("   ,   ", urlUn)}"));
                                         }
                                     }
                                 }
@@ -544,7 +544,7 @@ namespace TEAMModelOS.SDK.Models
                                     if (!abilitySubs.SelectMany(upsl => upsl.uploads).Any())
                                     {
                                         t53113OK = 0;
-                                        msgs.Add(new KeyValuePair<string, string>("uploads-all", $"没有上传认证材料。"));
+                                        msgs.Add(new CodeValue("uploads-all", $"没有上传认证材料。"));
                                     }
                                     else
                                     {
@@ -561,28 +561,29 @@ namespace TEAMModelOS.SDK.Models
                                                 if (x == null || !ab.uploads.Any())
                                                 {
                                                     t53113OK = 0;
-                                                    msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
+                                                    msgs.Add(new CodeValue("uploads", $"未上传认证材料:{x.no},{x.name}"));
                                                 }
                                                 if (x.zpscore <= 0)
                                                 {
                                                     t53113OK = 0;
-                                                    msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
+                                                    msgs.Add(new CodeValue("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
                                                 }
                                                 if (x.hpscore <= 0)
                                                 {
                                                     t53113OK = 0;
                                                     //如果只有三个,且互评为未评状态,则直接为合格。
                                                     x.hpscore = 1;
-                                                    msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
+                                                    msgs.Add(new CodeValue("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}"));
+                                                    msgs.Add(new CodeValue("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
                                                 }
                                             });
                                         }
-
+                                        ///如果上传的文件,失效导致不满足3个能力点
+                                        List<CodeValue> un_msg = new List<CodeValue>();
                                         //检查已经上传的文件是否正确。
                                         foreach (AbilitySub abilitySub in uploaded)
                                         {
@@ -608,36 +609,33 @@ namespace TEAMModelOS.SDK.Models
                                             }
                                             else
                                             {
-                                                t53113OK = 0;
                                                 var x = teacherTrain.currency.teacherAilities.Find(x => x.id.Equals(abilitySub.id));
-                                                msgs.Add(new KeyValuePair<string, string>("uploads-url", $"{x.no},{x.name}上传的认证材料文件失效:{string.Join("   ,   ", urlUn)}"));
+                                                un_msg.Add(new CodeValue("uploads-url", $"{x.no},{x.name}上传的认证材料文件失效:{string.Join("   ,   ", urlUn)}"));
                                             }
                                         }
-
+                                        if (allRightAbility.Count<3) {
+                                            t53113OK = 0;
+                                            msgs.AddRange(un_msg);
+                                        }
                                     }
-
-                                }
-                                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))} "));
                                 }
                             }
                         }
                         else
                         {
-                            msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
+                            msgs.Add(new CodeValue("teacherAilities", $"未同步省平台挑选的能力点"));
                             t53113OK = 0;
                         }
                     }
                     else
                     {
-                        msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
+                        msgs.Add(new CodeValue("teacherAilities", $"未同步省平台挑选的能力点"));
                         t53113OK = 0;
                     }
                 }
                 else
                 {
-                    msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
+                    msgs.Add(new CodeValue("teacherAilities", $"未同步省平台挑选的能力点"));
                     t53113OK = 0;
                 }
             } catch (Exception ex) {
@@ -646,7 +644,7 @@ namespace TEAMModelOS.SDK.Models
             if (allRightAbility.Count < 3)
             {
                 t53113OK = 0;
-                msgs.Add(new KeyValuePair<string, string>("uploads-count", $"完整上传且有效的认证材料的 能力点数量小于3,当前数量:{allRightAbility.Count}"));
+                msgs.Add(new CodeValue("uploads-count", $"完整上传且有效的认证材料的 能力点数量小于3,当前数量:{allRightAbility.Count}"));
             }
 
             return (t53113OK, msgs, abilitySubs, allRightAbility);

+ 329 - 26
TEAMModelOS/Controllers/Third/Sc/ScDataPushController.cs

@@ -16,6 +16,7 @@ using Microsoft.Extensions.Configuration;
 using HTEXLib.COMM.Helpers;
 using TEAMModelOS.SDK;
 using System.Threading;
+using Microsoft.Azure.Cosmos.Table;
 
 namespace TEAMModelOS.Controllers
 {
@@ -58,14 +59,36 @@ namespace TEAMModelOS.Controllers
             AreaSetting areaSetting = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).ReadItemAsync<AreaSetting>($"{areaIdJson}", new PartitionKey("AreaSetting"));
             ScAccessConfig config = areaSetting.accessConfig.ToObject<ScAccessConfig>();
             Dictionary<string, dynamic > checkDatas = new  Dictionary<string, dynamic >();
-
             var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
-            List<ScTeacher> scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "areaId", $"{areaIdJson}" } });
-            List<ScTeacherDiagnosis> scTeacherDiagnoses = await table.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "areaId", $"{areaIdJson}" } });
-            var teammodelossas = _azureStorage.GetBlobContainerSAS99Year("teammodelos", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
+            List<ScTeacher> scTeachers = new List<ScTeacher>();
+            List<ScTeacherDiagnosis> scTeacherDiagnoses = new List<ScTeacherDiagnosis>();
+            if (pushTeachers.IsNotEmpty())
+            {
+                List<string> Codes = new List<string>();
+                pushTeachers.ForEach(tch => {
+                    Codes.Add($" tmdid {QueryComparisons.Equal} '{tch}' ");
+                });
+                string tbqurey = $"PartitionKey {QueryComparisons.Equal} 'ScTeacher' and areaId {QueryComparisons.Equal} '{areaIdJson}' and ( {string.Join(" or ", Codes)} )  ";
+                var result = await table.ExecuteQuerySegmentedAsync(new TableQuery<ScTeacher>().Where(tbqurey), null);
+                scTeachers =  result.Results;
+               
+                List<string> Pxids = new List<string>();
+                scTeachers.ForEach(tch => {
+                    Pxids.Add($" RowKey {QueryComparisons.Equal} '{tch.PXID}' ");
+                });
+                string ditbqurey = $"PartitionKey {QueryComparisons.Equal} 'ScTeacherDiagnosis' and areaId {QueryComparisons.Equal} '{areaIdJson}' and ( {string.Join(" or ", Pxids)} )  ";
+                var diresult = await table.ExecuteQuerySegmentedAsync(new TableQuery<ScTeacherDiagnosis>().Where(ditbqurey), null);
+                scTeacherDiagnoses = diresult.Results;
 
+            }
+            else {
+                scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "areaId", $"{areaIdJson}" } });
+                scTeacherDiagnoses = await table.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "areaId", $"{areaIdJson}" } });
+            }
+            var teammodelossas = _azureStorage.GetBlobContainerSAS99Year("teammodelos", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
 
 
+            List<PushFail> failse = new List<PushFail>();
             List<string> schools = schoolsJson.ToObject<List<string>>();
             foreach (var school in schools) {
                 StringBuilder queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain'");
@@ -133,7 +156,7 @@ namespace TEAMModelOS.Controllers
                     List<Task> tasks = new List<Task>();
                     lists.ForEach(x =>
                     {
-                        tasks.Add(CheckTeacher(x, scTeachers, scTeacherDiagnoses, $"{school}", schoolsas, list53112, list53113, list53117, list53122, teammodelossas, pushDatas, updatePush));
+                        tasks.Add(CheckTeacher(x, scTeachers, scTeacherDiagnoses, $"{school}", schoolsas, list53112, list53113, list53117, list53122, teammodelossas, pushDatas, failse, updatePush));
                     });
                     await Task.WhenAll(tasks);
                     //推送数据
@@ -207,15 +230,32 @@ namespace TEAMModelOS.Controllers
                     }
                 }); 
             }
-            return Ok(new { data = new { results, checkDatas, dicts } });        
+            List<PushFail> fails = new List<PushFail>();
+            failse.ForEach(x =>
+            {
+                var f= fails.FindAll(y => y.tmdid.Equals(x.tmdid));
+                if (f.IsNotEmpty())
+                {
+                    f.ForEach(ff => {
+                        ff.type = $"{ff.type},{x.type}";
+                    });
+                }
+                else {
+                    x.msgs.ForEach(msg =>
+                    {
+                        fails.Add(new PushFail { tmdid = x.tmdid, name = x.name, school = x.school, schoolname = x.schoolname, code = msg.code, msg = msg.value, type = x.type });
+                    });
+                }
+            });
+            return Ok(new { data = new { results, fails, dicts } });        
         }
 
         private async Task CheckTeacher(TeacherTrain x, List<ScTeacher> scTeachers, List<ScTeacherDiagnosis> scTeacherDiagnoses, string school,(string uri ,string sas) schoolsas,
             List<Dictionary<string, object>> list53112, List<Dictionary<string, object>> list53113, List<Dictionary<string, object>> list53117, List<Dictionary<string, object>> list53122,
-            (string uri, string sas ) teammodelossas, Dictionary<string, Dictionary<string, object>> pushDatas,HashSet<TeacherTrain> updatePush
+            (string uri, string sas ) teammodelossas, Dictionary<string, Dictionary<string, object>> pushDatas, List<PushFail> failse, HashSet<TeacherTrain> updatePush
             )
         {
-            List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
+            List<CodeValue> msgs = new List<CodeValue>();
             List<ScTeacher> teacher = scTeachers.FindAll(t => !string.IsNullOrWhiteSpace(t.tmdid) && t.tmdid.Equals(x.id));
             foreach (var t in teacher)
             {
@@ -227,11 +267,11 @@ namespace TEAMModelOS.Controllers
                 ///检查是否全部已经上传
                 bool pushAll = true;
                 int t53112OK = 1, t53113OK=1, t53117OK=1 , t53122OK=1 ;
-                List<KeyValuePair<string, string>> msgs53112 = null;
-                List<KeyValuePair<string, string>> msgs53113 = null;
+                List<CodeValue> msgs53112 = null;
+                List<CodeValue> msgs53113 = null;
 
-                List<KeyValuePair<string, string>> msgs53117 = null;
-                List<KeyValuePair<string, string>> msgs53122 = null;
+                List<CodeValue> msgs53117 = null;
+                List<CodeValue> msgs53122 = null;
                 List<OfflineRecord> allRightOfflineRecords = new List<OfflineRecord>();
                 List<AbilitySub> allRightAbility = new List<AbilitySub>();
                 List<AbilitySub> abilitySubs = new List<AbilitySub>(); 
@@ -485,24 +525,25 @@ namespace TEAMModelOS.Controllers
                 else {
                     if (t53112OK != 1) {
                         pushData.Add("fail-UpdateTeacherListSituation", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112, school = t.schoolCode, schoolname = t.SchoolName });
-                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112 ,school= t.schoolCode,schoolname=t.SchoolName });
+                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53112 ,school= t.schoolCode,schoolname=t.SchoolName,type= "fail-UpdateTeacherListSituation" });
                     }
                     if (t53113OK != 1)
                     {
                         pushData.Add("fail-UpdateTeacherListDiagnosis", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113, school = t.schoolCode, schoolname = t.SchoolName });
-                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113, school = t.schoolCode, schoolname = t.SchoolName });
+                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53113, school = t.schoolCode, schoolname = t.SchoolName,type= "fail-UpdateTeacherListDiagnosis" });
                     }
                     if (t53117OK != 1) {
                         pushData.Add("fail-UploadKTSLList", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117, school = t.schoolCode, schoolname = t.SchoolName });
-                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117, school = t.schoolCode, schoolname = t.SchoolName });
+                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53117, school = t.schoolCode, schoolname = t.SchoolName,type= "fail-UploadKTSLList" });
                     }
                     if (t53122OK != 1) {
                         pushData.Add("fail-UploadSBTARPDFListV2", new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122, school = t.schoolCode, schoolname = t.SchoolName });
-                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122, school = t.schoolCode, schoolname = t.SchoolName });
+                        fails.Add(new PushFail { tmdid = t.tmdid, name = t.TeacherName, msgs = msgs53122, school = t.schoolCode, schoolname = t.SchoolName,type= "fail-UploadSBTARPDFListV2" });
                     }
                     if (pushData.Any())
                     {
-                        pushDatas.Add(t.tmdid, pushData);
+                        pushDatas.Add(t.tmdid,pushData);
+                        failse.AddRange(fails);
                     }
                 }
             }
@@ -512,19 +553,281 @@ namespace TEAMModelOS.Controllers
         [HttpPost("sc-check")]
         public async Task<IActionResult> css(JsonElement json) 
         {
+
+            var client = _azureCosmos.GetCosmosClient();
             JsonElement areaIdJson = json.GetProperty("areaId");
+            // JsonElement school = json.GetProperty("school");
+            JsonElement schoolsJson = json.GetProperty("schools");
+            Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
+            List<Dictionary<string, object>> dicts = new List<Dictionary<string, object>>();
+            List<string> pushTeachers = json.GetProperty("pushTeachers").ToObject<List<string>>();
+            List<ScsResult> results = new List<ScsResult>();
             AreaSetting areaSetting = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).ReadItemAsync<AreaSetting>($"{areaIdJson}", new PartitionKey("AreaSetting"));
             ScAccessConfig config = areaSetting.accessConfig.ToObject<ScAccessConfig>();
-            Dictionary<string, object> parameterContent53123 = new Dictionary<string, object>();
-            parameterContent53123.Add("Content", new { TrainComID = config.trainComID, ProjectID =config.p.First().pd, ProjectItemID =config.p.First().pid, PXID = "277838", TID= "624316" });
-            parameterContent53123.Add("TrainComID", config.trainComID);
-            parameterContent53123.Add("ProjectID", config.p.First().pd);
-            parameterContent53123.Add("ProjectItemID", config.p.First().pid);
-            parameterContent53123.Add("PXID", "277838");
-            parameterContent53123.Add("TID", "624316");
-            ScsResult GetDiagnosisResultByPXIDCommand = await _thirdApisService.Post(config.url, "GetDiagnosisResultByPXIDCommand", config.passKey, config.privateKey, parameterContent53123);
-            return Ok(GetDiagnosisResultByPXIDCommand);
+            Dictionary<string, dynamic> checkDatas = new Dictionary<string, dynamic>();
+            var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+            List<ScTeacher> scTeachers = new List<ScTeacher>();
+            //List<ScTeacherDiagnosis> scTeacherDiagnoses = new List<ScTeacherDiagnosis>();
+            if (pushTeachers.IsNotEmpty())
+            {
+                List<string> Codes = new List<string>();
+                pushTeachers.ForEach(tch => {
+                    Codes.Add($" tmdid {QueryComparisons.Equal} '{tch}' ");
+                });
+                string tbqurey = $"PartitionKey {QueryComparisons.Equal} 'ScTeacher' and areaId {QueryComparisons.Equal} '{areaIdJson}' and ( {string.Join(" or ", Codes)} )  ";
+                var result = await table.ExecuteQuerySegmentedAsync(new TableQuery<ScTeacher>().Where(tbqurey), null);
+                scTeachers = result.Results;
+
+             
+                 
+
+            }
+            else
+            {
+                List<string> schools = schoolsJson.ToObject<List<string>>();
+                if (schools.IsNotEmpty())
+                {
+                    List<string> Codes = new List<string>();
+                    schools.ForEach(school => {
+                        Codes.Add($" schoolCode {QueryComparisons.Equal} '{school}' ");
+                    });
+                    string tbqurey = $"PartitionKey {QueryComparisons.Equal} 'ScTeacher' and areaId {QueryComparisons.Equal} '{areaIdJson}' and ( {string.Join(" or ", Codes)} )  ";
+                    var result = await table.ExecuteQuerySegmentedAsync(new TableQuery<ScTeacher>().Where(tbqurey), null);
+                    scTeachers = result.Results;
+                }
+                else {
+                    scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "areaId", $"{areaIdJson}" } });
+                }
+                
+            }
+            List<PushData> datas = new List<PushData>();
+            foreach (var sc in scTeachers) {
+                Dictionary<string, object> parameterContent53123 = new Dictionary<string, object>();
+                // parameterContent53123.Add("Content", new { TrainComID = config.trainComID, ProjectID =config.p.First().pd, ProjectItemID =config.p.First().pid, PXID = "277838", TID= "624316" });
+                parameterContent53123.Add("TrainComID", config.trainComID);
+                parameterContent53123.Add("ProjectID", config.p.First().pd);
+                parameterContent53123.Add("ProjectItemID", config.p.First().pid);
+                parameterContent53123.Add("PXID",$"{sc.PXID}");
+                parameterContent53123.Add("TID",$"{sc.TID}");
+                ScsResult GetDiagnosisResultByPXIDCommand = await _thirdApisService.Post(config.url, "GetDiagnosisResultByPXIDCommand", config.passKey, config.privateKey, parameterContent53123);
+                if (GetDiagnosisResultByPXIDCommand.result) {
+                    datas.Add(GetDiagnosisResultByPXIDCommand.content.ToObject<PushData>());
+                }
+            }
+            return Ok(datas);
         }
       
     }
+
+    public class DiagnosisInfoItem
+    {
+        /// <summary>
+        /// 技术支持的学情分析
+        /// </summary>
+        public string diagnosisName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string xzpresult { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string zpresult { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string hpresult { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int diagnosisID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string diagnosisNum { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string uptime { get; set; }
+
+    }
+
+
+
+    public class TeacherSc
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public int PXID { get; set; }
+
+        /// <summary>
+        /// 陈芋伶
+        /// </summary>
+        public string TeacherName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int TID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ProjectID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ProjectItemID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string ProjectTitle { get; set; }
+
+        /// <summary>
+        /// 金牛区信息技术2.0提升工程直属学校培训(第一轮)
+        /// </summary>
+        public string ProjectItemTitle { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CityName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string DisName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string SchoolName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CityID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string DistrictID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int SchoolID { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string PXXK { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string PXXD { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string TeacherXK { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string TeacherXD { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Mobile { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Email { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ComPassed { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string ComPassedTime { get; set; }
+
+    }
+
+
+
+    public class FilesItem
+    {
+        /// <summary>
+        /// 信息化教学案例展示
+        /// </summary>
+        public string fileName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int sourceType { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string diagnosisNum { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int filesize { get; set; }
+
+        /// <summary>
+        /// https://teammodelos.blob.core.chinacloudapi.cn/cdqzmd/train/8eae8733-c4cd-40bd-8ada-6fe5e2573e30/1640923152/心得.pdf?sv=2021-04-10&st=2022-06-23T09%3A43%3A07Z&se=2121-05-30T09%3A58%3A07Z&sr=c&sp=r&sig=iFHJSQAHbgOc1I4trUVab%2B2UCV%2BrY%2Blge%2Fjb30yvqjM%3D
+        /// </summary>
+        public string url { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string fileType { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string md5 { get; set; }
+
+    }
+
+
+
+    public class PushData
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<DiagnosisInfoItem> diagnosisInfo { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public TeacherSc teacherInfo { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public List<FilesItem> files { get; set; }
+
+    }
 }

+ 7 - 7
TEAMModelOS/appsettings.Development.json

@@ -21,19 +21,19 @@
   },
   "Azure": {
     "Storage": {
-      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
+      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
     },
     "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     },
     "Redis": {
-      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
+      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
     },
     "ServiceBus": {
-      "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
-      "ActiveTask": "dep-active-task",
-      "ItemCondQueue": "dep-itemcond",
-      "GenPdfQueue": "dep-genpdf"
+      "ConnectionString": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
+      "ActiveTask": "active-task",
+      "ItemCondQueue": "itemcond",
+      "GenPdfQueue": "genpdf"
     }
   },
   "HaBookAuth": {