CrazyIter_Bin 3 yıl önce
ebeveyn
işleme
7e88a716e2

+ 2 - 1
TEAMModelOS.SDK/Models/Cosmos/Teacher/Research/TeacherTrain.cs

@@ -124,7 +124,8 @@ namespace TEAMModelOS.SDK.Models
         /// 待更新的属性
         /// </summary>
         public HashSet<string> update { get; set; } = new HashSet<string>();
-        public string push { get; set; }
+        public HashSet<string> pushes { get; set; } = new HashSet<string>();
+         
         public Attachment offlineReport { get; set; }
        
     }

+ 2 - 0
TEAMModelOS.SDK/Models/Service/Third/Sc/ScYxptModel.cs

@@ -271,6 +271,8 @@ namespace TEAMModelOS.SDK.Models
         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 class ScPush

+ 138 - 131
TEAMModelOS.SDK/Models/Service/Third/ThirdService.cs

@@ -445,138 +445,66 @@ namespace TEAMModelOS.SDK.Models
                 msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"已学习能力点:0"));
                 t53113OK = 0;
             }
-            if (diagnosis != null)
-            {
-                if (!string.IsNullOrWhiteSpace(diagnosis.abilityNos))
+            try {
+                if (diagnosis != null)
                 {
-                    List<string> nos = diagnosis.abilityNos.ToObject<List<string>>();
-                    if (nos.Count > 0 && teacherTrain.currency.teacherAilities.Count > 0)
+                    if (!string.IsNullOrWhiteSpace(diagnosis.abilityNos))
                     {
-                        var notin = nos.Except(teacherTrain.currency.teacherAilities.Select(x => x.no).Where(z => !string.IsNullOrWhiteSpace(z)));
-                        if (notin.Any())
+                        List<string> nos = diagnosis.abilityNos.ToObject<List<string>>();
+                        if (nos.Count > 0 && teacherTrain.currency.teacherAilities.Count > 0)
                         {
-                            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}") }))
+                            var notin = nos.Except(teacherTrain.currency.teacherAilities.Select(x => x.no).Where(z => !string.IsNullOrWhiteSpace(z)));
+                            if (notin.Any())
                             {
-                                abilitySubs.Add(item);
+                                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;
                             }
-
-                            if (abilitySubs.Count() <= 3)
+                            else
                             {
-                                teacherTrain.currency.teacherAilities.ForEach(x =>
+                                string insql = "";
+                                if (teacherTrain.currency.teacherAilities.IsNotEmpty())
                                 {
-                                    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;
-                                        //如果只有三个,且互评为未评状态,则直接为合格。
-                                        x.hpscore = 1;
-                                       // msgs.Add(new KeyValuePair<string, string>("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}"));
-                                    }
-                                });
+                                    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);
+                                }
 
-                                foreach (AbilitySub abilitySub in abilitySubs)
+                                if (abilitySubs.Count() <= 3)
                                 {
-                                    //当前能力点上传的文件是否完全有效
-                                    bool isAllRight = true;
-                                    List<string> urlUn = new List<string>();
-                                    foreach (var subUpload in abilitySub.uploads)
+                                    teacherTrain.currency.teacherAilities.ForEach(x =>
                                     {
-                                        foreach (var url in subUpload.urls)
+                                        var abilitySub = abilitySubs.Find(z => z.id.Equals(x.id));
+                                        if (abilitySub == null || !abilitySub.uploads.Any())
                                         {
-                                            string blobItem = url.url.Replace($"{schoolPrefix}/", "");
-                                            bool Exist = await _azureStorage.GetBlobContainerClient(school).GetBlobClient(blobItem).ExistsAsync();
-                                            if (!Exist)
-                                            {
-                                                isAllRight = false;
-                                                urlUn.Add($"{url.url}?{sas}");
-                                            }
+                                            t53113OK = 0;
+                                            msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
                                         }
-                                    }
-                                    if (isAllRight)
-                                    {
-                                        allRightAbility.Add(abilitySub);
-                                    }
-                                    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)}"));
-                                    }
-                                }
-                            }
-                            else {
-                                //一个都没上传
-                                if (!abilitySubs.SelectMany(upsl => upsl.uploads).Any())
-                                {
-                                    t53113OK = 0;
-                                    msgs.Add(new KeyValuePair<string, string>("uploads-all", $"没有上传认证材料。"));
-                                }
-                                else {
-                                    //检查上传了认证材料的能力点,超过三个的。
-                                    var uploaded = abilitySubs.FindAll(x => x.uploads.Count > 0);
-                                    //不足三个的则需要记录
-                                    if (uploaded.Count < 3) {
-                                        t53113OK = 0;
-                                        ///少于三个的,需要判断另外的不满足情况的
-                                        abilitySubs.RemoveAll(x => x.uploads.Count > 0);
-                                        abilitySubs.ForEach(ab => {
-                                           var x =  teacherTrain.currency.teacherAilities.Find(x => x.id.Equals(ab.id));
-                                            if (x == null || !ab.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;
-                                                //如果只有三个,且互评为未评状态,则直接为合格。
-                                                x.hpscore = 1;
-                                                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}"));
-                                            }
-                                        });
-                                    }
-                                    
-                                     //检查已经上传的文件是否正确。
-                                    foreach(AbilitySub abilitySub in uploaded)
+                                        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;
+                                            //如果只有三个,且互评为未评状态,则直接为合格。
+                                            x.hpscore = 1;
+                                            // msgs.Add(new KeyValuePair<string, string>("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}"));
+                                        }
+                                    });
+
+                                    foreach (AbilitySub abilitySub in abilitySubs)
                                     {
                                         //当前能力点上传的文件是否完全有效
                                         bool isAllRight = true;
@@ -602,18 +530,100 @@ 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 KeyValuePair<string, string>("uploads-url", $"{x.no},{x.name}上传的认证材料文件失效:{string.Join("   ,   ", urlUn)}"));
                                         }
                                     }
-                                   
                                 }
+                                else
+                                {
+                                    //一个都没上传
+                                    if (!abilitySubs.SelectMany(upsl => upsl.uploads).Any())
+                                    {
+                                        t53113OK = 0;
+                                        msgs.Add(new KeyValuePair<string, string>("uploads-all", $"没有上传认证材料。"));
+                                    }
+                                    else
+                                    {
+                                        //检查上传了认证材料的能力点,超过三个的。
+                                        var uploaded = abilitySubs.FindAll(x => x.uploads.Count > 0);
+                                        //不足三个的则需要记录
+                                        if (uploaded.Count < 3)
+                                        {
+                                            t53113OK = 0;
+                                            ///少于三个的,需要判断另外的不满足情况的
+                                            abilitySubs.RemoveAll(x => x.uploads.Count > 0);
+                                            abilitySubs.ForEach(ab => {
+                                                var x = teacherTrain.currency.teacherAilities.Find(x => x.id.Equals(ab.id));
+                                                if (x == null || !ab.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;
+                                                    //如果只有三个,且互评为未评状态,则直接为合格。
+                                                    x.hpscore = 1;
+                                                    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))} "));
+                                        //检查已经上传的文件是否正确。
+                                        foreach (AbilitySub abilitySub in uploaded)
+                                        {
+                                            //当前能力点上传的文件是否完全有效
+                                            bool isAllRight = true;
+                                            List<string> urlUn = new List<string>();
+                                            foreach (var subUpload in abilitySub.uploads)
+                                            {
+                                                foreach (var url in subUpload.urls)
+                                                {
+                                                    string blobItem = url.url.Replace($"{schoolPrefix}/", "");
+                                                    bool Exist = await _azureStorage.GetBlobContainerClient(school).GetBlobClient(blobItem).ExistsAsync();
+                                                    if (!Exist)
+                                                    {
+                                                        isAllRight = false;
+                                                        urlUn.Add($"{url.url}?{sas}");
+                                                    }
+                                                }
+                                            }
+                                            if (isAllRight)
+                                            {
+                                                allRightAbility.Add(abilitySub);
+                                            }
+                                            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)}"));
+                                            }
+                                        }
+
+                                    }
+
+                                }
+                                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", $"未同步省平台挑选的能力点"));
+                            t53113OK = 0;
+                        }
                     }
                     else
                     {
@@ -626,11 +636,8 @@ namespace TEAMModelOS.SDK.Models
                     msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
                     t53113OK = 0;
                 }
-            }
-            else
-            {
-                msgs.Add(new KeyValuePair<string, string>("teacherAilities", $"未同步省平台挑选的能力点"));
-                t53113OK = 0;
+            } catch (Exception ex) {
+                throw new Exception($"{ex.StackTrace},{ex.Message}");
             }
             if (allRightAbility.Count < 3)
             {

+ 393 - 296
TEAMModelOS/Controllers/Third/Sc/ScDataPushController.cs

@@ -48,127 +48,177 @@ namespace TEAMModelOS.Controllers
              
             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>();
-            JsonElement school = json.GetProperty("school");
-            List<string> pushTeachers = json.GetProperty("pushTeachers").ToObject<List<string>>();
-            StringBuilder queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain'");
-            List<GroupList> yxtrain = new List<GroupList>();
-            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: queryText.ToString(),
-            requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school}") }))
-            {
-                yxtrain.Add(item);
-            }
-            List<TeacherTrain> trains = new List<TeacherTrain>();
-            var members = yxtrain.SelectMany(x => x.members).ToList();
-            //指定推送一部分的教师 
-            if (pushTeachers.IsNotEmpty())
-            {
-                members = members.FindAll(x => pushTeachers.Contains(x.id));
-            }
-            if (members.IsNotEmpty())
-            {
-                queryText = new StringBuilder($"SELECT distinct value(c) FROM c where 1=1  " +
-                    $"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(),
-                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
+            Dictionary<string, dynamic > checkDatas = new  Dictionary<string, dynamic >();
+
+
+
+
+            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'");
+                List<GroupList> yxtrain = new List<GroupList>();
+                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: queryText.ToString(),
+                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{school}") }))
                 {
-                    trains.Add(item);
+                    yxtrain.Add(item);
                 }
-            }
+                List<TeacherTrain> trains = new List<TeacherTrain>();
+                var members = yxtrain.SelectMany(x => x.members).ToList();
+                //指定推送一部分的教师 
+                if (pushTeachers.IsNotEmpty())
+                {
+                    members = members.FindAll(x => pushTeachers.Contains(x.id));
+                }
+                if (members.IsNotEmpty())
+                {
+                    queryText = new StringBuilder($"SELECT distinct value(c) FROM c where 1=1  " +
+                        $"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(),
+                    requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
+                    {
+                        trains.Add(item);
+                    }
+                }
+                var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+                List<ScTeacher> scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "schoolCode", $"{school}" } });
+                List<ScTeacherDiagnosis> scTeacherDiagnoses = await table.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "schoolCode", $"{school}" } });
 
-            //string sql = $" SELECT value(c) FROM c join a in c.binds where ARRAY_LENGTH(c.binds)>0 and a.type='{config.config}' ";
-            //List<Teacher> teachers = new List<Teacher>();
-            //await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<Teacher>(queryText: sql,
-            //    requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
-            //{
-            //    teachers.Add(item);
-            //}
-            var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
-            List<ScTeacher> scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "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<ScsResult> results = new List<ScsResult>();
-            Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
-            List<Dictionary<string, object>> dicts = new List<Dictionary<string, object>>();
-            int pages = (trains.Count + 49) / 50; //pages = (total + max -1) / max;
+                int pages = (trains.Count + 49) / 50; //pages = (total + max -1) / max;
 
-            var teammodelossas= _azureStorage.GetBlobContainerSAS99Year("teammodelos", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
-            var schoolsas = _azureStorage.GetBlobContainerSAS99Year($"{school}", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
-            for (int i = 0; i < pages; i++)
-            {
-                List<TeacherTrain> lists = trains.Skip((i) * 50).Take(50).ToList();
-                //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
-                List<TeacherTrain> trains53112OK = new List<TeacherTrain>();
-                ScsResult UpdateTeacherListSituation = null;
-                Dictionary<string, object> parameterContent53112 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> list53112 = new List<Dictionary<string, object>>();
-                parameterContent53112.Add("TrainComID", config.trainComID);
-                parameterContent53112.Add("List", list53112);
+                var teammodelossas = _azureStorage.GetBlobContainerSAS99Year("teammodelos", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
+                var schoolsas = _azureStorage.GetBlobContainerSAS99Year($"{school}", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
+                HashSet<TeacherTrain> updatePush = new HashSet<TeacherTrain>();
+                for (int i = 0; i < pages; i++)
+                {
+                    List<TeacherTrain> lists = trains.Skip((i) * 50).Take(50).ToList();
+                    //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
+                    List<TeacherTrain> trains53112OK = new List<TeacherTrain>();
+                    ScsResult UpdateTeacherListSituation = null;
+                    Dictionary<string, object> parameterContent53112 = new Dictionary<string, object>();
+                    List<Dictionary<string, object>> list53112 = new List<Dictionary<string, object>>();
+                    parameterContent53112.Add("TrainComID", config.trainComID);
+                    parameterContent53112.Add("List", list53112);
 
-                //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis  300条限制 
-                List<TeacherTrain> trains53113OK = new List<TeacherTrain>();
-                ScsResult UpdateTeacherListDiagnosis = null;
-                Dictionary<string, object> parameterContent53113 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> list53113 = new List<Dictionary<string, object>>();
-                parameterContent53113.Add("TrainComID", config.trainComID);
-                parameterContent53113.Add("List", list53113);
+                    //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis  300条限制 
+                    List<TeacherTrain> trains53113OK = new List<TeacherTrain>();
+                    ScsResult UpdateTeacherListDiagnosis = null;
+                    Dictionary<string, object> parameterContent53113 = new Dictionary<string, object>();
+                    List<Dictionary<string, object>> list53113 = new List<Dictionary<string, object>>();
+                    parameterContent53113.Add("TrainComID", config.trainComID);
+                    parameterContent53113.Add("List", list53113);
 
-                //5.3.1.17学员课堂实录批量回写-UploadKTSLList     300条限制 
-                List<TeacherTrain> trains53117OK = new List<TeacherTrain>();
-                ScsResult UploadKTSLList = null;
-                Dictionary<string, object> parameterContent53117 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> list53117 = new List<Dictionary<string, object>>();
-                parameterContent53117.Add("TrainComID", config.trainComID);
-                parameterContent53117.Add("List", list53117);
+                    //5.3.1.17学员课堂实录批量回写-UploadKTSLList     300条限制 
+                    List<TeacherTrain> trains53117OK = new List<TeacherTrain>();
+                    ScsResult UploadKTSLList = null;
+                    Dictionary<string, object> parameterContent53117 = new Dictionary<string, object>();
+                    List<Dictionary<string, object>> list53117 = new List<Dictionary<string, object>>();
+                    parameterContent53117.Add("TrainComID", config.trainComID);
+                    parameterContent53117.Add("List", list53117);
 
-                //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2   100条限制
-                List<TeacherTrain> trains53122OK = new List<TeacherTrain>();
-                ScsResult UploadSBTARPDFListV2 = null;
-                Dictionary<string, object> parameterContent53122 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> list53122 = new List<Dictionary<string, object>>();
-                parameterContent53122.Add("TrainComID", config.trainComID);
-                parameterContent53122.Add("List", list53122);
-                //装载数据
-                dicts.Add(parameterContent53112);
-                dicts.Add(parameterContent53113);
-                dicts.Add(parameterContent53117);
-                dicts.Add(parameterContent53122);
-               List<Task> tasks= new List<Task>();
-                lists.ForEach(x =>
-                {
-                    tasks.Add(CheckTeacher(x, scTeachers, scTeacherDiagnoses, $"{school}", schoolsas, list53112, list53113, list53117, list53122, teammodelossas, pushDatas));
-                });
-                await Task.WhenAll(tasks);
-                //推送数据
-                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
-                UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
-                UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
+                    //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2   100条限制
+                    List<TeacherTrain> trains53122OK = new List<TeacherTrain>();
+                    ScsResult UploadSBTARPDFListV2 = null;
+                    Dictionary<string, object> parameterContent53122 = new Dictionary<string, object>();
+                    List<Dictionary<string, object>> list53122 = new List<Dictionary<string, object>>();
+                    parameterContent53122.Add("TrainComID", config.trainComID);
+                    parameterContent53122.Add("List", list53122);
+                    //装载数据
+                    List<Task> tasks = new List<Task>();
+                    lists.ForEach(x =>
+                    {
+                        tasks.Add(CheckTeacher(x, scTeachers, scTeacherDiagnoses, $"{school}", schoolsas, list53112, list53113, list53117, list53122, teammodelossas, pushDatas, updatePush));
+                    });
+                    await Task.WhenAll(tasks);
+                    //推送数据
+                    if (list53112.IsNotEmpty())
+                    {
 
-                UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
-                UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
-                UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
+                        dicts.Add(parameterContent53112);
+                        UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
+                        UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
+                        UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
+                        results.Add(UpdateTeacherListSituation);
+                    }
 
-                UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
-                UploadKTSLList.bizcode = "UploadKTSLList";
-                UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
+                    if (list53113.IsNotEmpty())
+                    {
+                        dicts.Add(parameterContent53113);
+                        UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
+                        UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
+                        UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
+                        results.Add(UpdateTeacherListDiagnosis);
+                    }
 
-                UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
-                UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
-                UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
-                results.Add(UpdateTeacherListSituation);
-                results.Add(UpdateTeacherListDiagnosis);
-                results.Add(UploadKTSLList);
-                results.Add(UploadSBTARPDFListV2);
+                    if (list53117.IsNotEmpty())
+                    {
+                        dicts.Add(parameterContent53117);
+                        UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
+                        UploadKTSLList.bizcode = "UploadKTSLList";
+                        UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
+                        results.Add(UploadKTSLList);
+                    }
+
+                    if (list53122.IsNotEmpty())
+                    {
+                        dicts.Add(parameterContent53122);
+                        UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
+                        UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
+                        UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
+                        results.Add(UploadSBTARPDFListV2);
+                    }
+                }
+                List<Task<ItemResponse<TeacherTrain>>> tas = new List<Task<ItemResponse<TeacherTrain>>>();
+                updatePush.ToList().ForEach(x =>
+                {
+                    tas.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReplaceItemAsync(x, x.id, new PartitionKey(x.code)));
+                });
+                await Task.WhenAll(tas);
+               
+                pushDatas.Keys.ToList().ForEach(x => {
+                    if (pushDatas[x].Keys.Any())
+                    {
+                        Dictionary<string, dynamic> dict = new Dictionary<string, dynamic>();
+                        dict.Add($"tmdid", x);
+                         
+                        List<string> types = new List<string>();
+                        pushDatas[x].Keys.ToList().ForEach(y => {
+                            if (y.Contains("fail-"))
+                            {
+                                types.Add(y);
+                            }
+                        });
+                        dict.Add($"msg", pushDatas[x][pushDatas[x].Keys.First()]);
+                        dict.Add($"types", types);
+                        if (types.Any())
+                        {
+                            checkDatas[x] = dict;
+                        }
+                    }
+                });
+                
             }
-            return Ok(new { data = new { results, pushDatas, dicts } });        
+            
+
+
+           
+            
+            return Ok(new { data = new { results, checkDatas, dicts } });        
         }
 
-        private async Task CheckTeacher(TeacherTrain x, List<ScTeacher> scTeachers, List<ScTeacherDiagnosis> scTeacherDiagnoses, string school,(string sas,string uri) schoolsas,
+        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
+            (string uri, string sas ) teammodelossas, Dictionary<string, Dictionary<string, object>> pushDatas,HashSet<TeacherTrain> updatePush
             )
         {
             List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
@@ -179,240 +229,287 @@ namespace TEAMModelOS.Controllers
                 Dictionary<string, object> pushData = new Dictionary<string, object>();
                 string jsonTech = scTeacherDiagnoses.ToJsonString();
                 ScTeacherDiagnosis diagnosis = scTeacherDiagnoses.Find(x => x.RowKey.Equals($"{t.PXID}"));
-                (int t53112OK, List<KeyValuePair<string, string>> msgs53112) = ThirdService.check53112(x, msgs);
-                (int t53113OK, List<KeyValuePair<string, string>> msgs53113, List<AbilitySub> abilitySubs, List<AbilitySub> allRightAbility) = await ThirdService.check53113(_azureCosmos, x, diagnosis, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
-                (int t53117OK, List<KeyValuePair<string, string>> msgs53117) = await ThirdService.check53117(x, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
-                (int t53122OK, List<KeyValuePair<string, string>> msgs53122) = await ThirdService.check53122(x, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
 
-                //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
-                if (t53112OK == 1)
+                ///检查是否全部已经上传
+                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<KeyValuePair<string, string>> msgs53117 = null;
+                List<KeyValuePair<string, string>> msgs53122 = null;
+                List<AbilitySub> allRightAbility = new List<AbilitySub>();
+                List<AbilitySub> abilitySubs = new List<AbilitySub>(); 
+                if (!x.pushes.Contains("53112")) {
+                    pushAll = false;
+                    (t53112OK,   msgs53112) = ThirdService.check53112(x, msgs);
+                }
+                if (!x.pushes.Contains("53113")) {
+                    pushAll = false;
+                    ( t53113OK,   msgs53113,   abilitySubs, allRightAbility) = await ThirdService.check53113(_azureCosmos, x, diagnosis, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
+                }
+                if (!x.pushes.Contains("53117"))
                 {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", $"{t.PXID}");
-                    parameterMapData.Add("TID", $"{t.TID}");
-                    parameterMapData.Add("TeacherName", $"{t.TeacherName}");
-                    parameterMapData.Add("CourseHour", $"{x.totalTime}");
-                    parameterMapData.Add("ResearchText", $"{x.summary}");
-                    /// <summary>
-                    ///省上标准  最终结果 0未认定,1合格,2优秀,3不合格,4其他
-                    ///系统标准 -2 其他 -1 未认定,0不合格,1合格,2优秀
-                    /// </summary>
-                    string ComPassed = "0";
-                    switch (x.finalScore)
-                    {
-                        case -2:
-                            ComPassed = "4";
-                            break;
-                        case -1:
-                            ComPassed = "0";
-                            break;
-                        case 0:
-                            ComPassed = "3";
-                            break;
-                        case 1:
-                            ComPassed = "1";
-                            break;
-                        case 2:
-                            ComPassed = "2";
-                            break;
-                        default:
-                            ComPassed = "4";
-                            break;
-                    }
-                    parameterMapData.Add("ComPassed", ComPassed);//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                    pushData.Add("success-UpdateTeacherListSituation", parameterMapData);
-                    list53112.Add(parameterMapData);
+                    pushAll = false;
+                    (  t53117OK,   msgs53117) = await ThirdService.check53117(x, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
                 }
-                else
+                if (!x.pushes.Contains("53122"))
                 {
-                    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 });
+                    pushAll = false;
+                    (  t53122OK,  msgs53122) = await ThirdService.check53122(x, msgs, $"{school}", schoolsas.uri, schoolsas.sas, _azureStorage);
                 }
-                //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
-                if (t53113OK == 1)
+                if (pushAll== false &&  t53112OK == 1 && t53113OK == 1 && t53117OK == 1 && t53122OK == 1)
                 {
-                    List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
-                    var uploadedAbility = abilitySubs.FindAll(ab => ab.uploads.Count > 0);
-                    x.currency.teacherAilities.ForEach(a => {
+                    //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
+                    if (t53112OK == 1)
+                    {
                         Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                         parameterMapData.Add("PXID", $"{t.PXID}");
                         parameterMapData.Add("TID", $"{t.TID}");
-                        parameterMapData.Add("DiagnosisNum", $"{a.no}");
-                        List<Dictionary<string, object>> pfiles = new List<Dictionary<string, object>>();
-                        parameterMapData.Add("pfiles", pfiles);
-
-                        AbilitySub allRight = allRightAbility.Find(sub => sub.id.Equals(a.id));
-                        if (allRight != null)
-                        {
-                            allRight.uploads.ForEach(upload => {
-                                upload.urls.ForEach(url => {
-                                    Dictionary<string, object> pfileMap = new Dictionary<string, object>();
-                                    string fileext = url.url.Substring(url.url.LastIndexOf(".") > 0 ? url.url.LastIndexOf(".") + 1 : 0);
-                                    pfileMap.Add("url", $"{url.url}?{schoolsas.sas}");
-                                    pfileMap.Add("fileName", url.name.Length > 95 ? $"{url.name.Substring(0, 95)}.{fileext}" : url.name);
-                                    pfileMap.Add("fileSize", $"{url.size}");
-                                    pfileMap.Add("md5", url.hash);
-
-                                    pfileMap.Add("fileType", fileext);
-                                    pfiles.Add(pfileMap);
-                                });
-                            });
-                        }
-
-
-                        //0"未认定", 1"合格", 2"优秀", 3"不合格"
-                        //系统 -1 未认定,0 不合格,1 合格,2 优秀
-                        string zpscore = "0";
-                        switch (a.zpscore)
-                        {
-                            case -1:
-                                zpscore = "0";
-                                break;
-                            case 0:
-                                zpscore = "3";
-                                break;
-                            case 1:
-                                zpscore = "1";
-                                break;
-                            case 2:
-                                zpscore = "2";
-                                break;
-                            default:
-                                zpscore = "4";
-                                break;
-                        }
-                        string hpscore = "0";
-                        switch (a.hpscore)
+                        parameterMapData.Add("TeacherName", $"{t.TeacherName}");
+                        parameterMapData.Add("CourseHour", $"{x.totalTime}");
+                        parameterMapData.Add("ResearchText", $"{x.summary}");
+                        /// <summary>
+                        ///省上标准  最终结果 0未认定,1合格,2优秀,3不合格,4其他
+                        ///系统标准 -2 其他 -1 未认定,0不合格,1合格,2优秀
+                        /// </summary>
+                        string ComPassed = "0";
+                        switch (x.finalScore)
                         {
-                            case -1:
-                                hpscore = "0";
-                                break;
-                            case 0:
-                                hpscore = "3";
-                                break;
-                            case 1:
-                                hpscore = "1";
-                                break;
-                            case 2:
-                                hpscore = "2";
+                            case -2:
+                                ComPassed = "4";
                                 break;
-                            default:
-                                hpscore = "4";
-                                break;
-                        }
-                        string xzpresult = "0";
-                        switch (a.xzscore)
-                        {
                             case -1:
-                                xzpresult = "0";
+                                ComPassed = "0";
                                 break;
                             case 0:
-                                xzpresult = "3";
+                                ComPassed = "3";
                                 break;
                             case 1:
-                                xzpresult = "1";
+                                ComPassed = "1";
                                 break;
                             case 2:
-                                xzpresult = "2";
+                                ComPassed = "2";
                                 break;
                             default:
-                                xzpresult = "4";
+                                ComPassed = "4";
                                 break;
                         }
-                        ///上传了三个,且当前没有上传的能力点,标记为为学习状态。
-                        if (uploadedAbility.Count >= 3)
+                        parameterMapData.Add("ComPassed", ComPassed);//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                        pushData.Add("success-UpdateTeacherListSituation", parameterMapData);
+                        x.pushes.Add("53112");
+                        updatePush.Add(x);
+                        list53112.Add(parameterMapData);
+                    }
+                    //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
+                    if (t53113OK == 1)
+                    {
+                        List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
+                        var uploadedAbility = abilitySubs.FindAll(ab => ab.uploads.Count > 0);
+                        x.currency.teacherAilities.ForEach(a =>
                         {
-                            if (pfiles.Count == 0)
+                            Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                            parameterMapData.Add("PXID", $"{t.PXID}");
+                            parameterMapData.Add("TID", $"{t.TID}");
+                            parameterMapData.Add("DiagnosisNum", $"{a.no}");
+                            List<Dictionary<string, object>> pfiles = new List<Dictionary<string, object>>();
+                            parameterMapData.Add("pfiles", pfiles);
+
+                            AbilitySub allRight = allRightAbility.Find(sub => sub.id.Equals(a.id));
+                            if (allRight != null)
                             {
-                                zpscore = "4";
-                                hpscore = "4";
-                                xzpresult = "4";
+                                allRight.uploads.ForEach(upload =>
+                                {
+                                    upload.urls.ForEach(url =>
+                                    {
+                                        Dictionary<string, object> pfileMap = new Dictionary<string, object>();
+                                        string fileext = url.url.Substring(url.url.LastIndexOf(".") > 0 ? url.url.LastIndexOf(".") + 1 : 0);
+                                        pfileMap.Add("url", $"{url.url}?{schoolsas.sas}");
+                                        pfileMap.Add("fileName", url.name.Length > 95 ? $"{url.name.Substring(0, 95)}.{fileext}" : url.name);
+                                        pfileMap.Add("fileSize", $"{url.size}");
+                                        pfileMap.Add("md5", url.hash);
+
+                                        pfileMap.Add("fileType", fileext);
+                                        pfiles.Add(pfileMap);
+                                    });
+                                });
                             }
-                        }
-                        parameterMapData.Add("zpresult", zpscore);
-                        parameterMapData.Add("hpresult", hpscore);
-                        parameterMapData.Add("xzpresult", xzpresult);
 
-                        list53113.Add(parameterMapData);
-                        parameterMapDatas.Add(parameterMapData);
-                    });
-                    pushData.Add("success-UpdateTeacherListDiagnosis", parameterMapDatas);
 
-                }
-                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 });
-                }
-                //5.3.1.17学员课堂实录批量回写-UploadKTSLList
-                if (t53117OK == 1)
-                {
-                    List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
-                    x.teacherClasses.ForEach(clss =>
+                            //0"未认定", 1"合格", 2"优秀", 3"不合格"
+                            //系统 -1 未认定,0 不合格,1 合格,2 优秀
+                            string zpscore = "0";
+                            switch (a.zpscore)
+                            {
+                                case -1:
+                                    zpscore = "0";
+                                    break;
+                                case 0:
+                                    zpscore = "3";
+                                    break;
+                                case 1:
+                                    zpscore = "1";
+                                    break;
+                                case 2:
+                                    zpscore = "2";
+                                    break;
+                                default:
+                                    zpscore = "4";
+                                    break;
+                            }
+                            string hpscore = "0";
+                            switch (a.hpscore)
+                            {
+                                case -1:
+                                    hpscore = "0";
+                                    break;
+                                case 0:
+                                    hpscore = "3";
+                                    break;
+                                case 1:
+                                    hpscore = "1";
+                                    break;
+                                case 2:
+                                    hpscore = "2";
+                                    break;
+                                default:
+                                    hpscore = "4";
+                                    break;
+                            }
+                            string xzpresult = "0";
+                            switch (a.xzscore)
+                            {
+                                case -1:
+                                    xzpresult = "0";
+                                    break;
+                                case 0:
+                                    xzpresult = "3";
+                                    break;
+                                case 1:
+                                    xzpresult = "1";
+                                    break;
+                                case 2:
+                                    xzpresult = "2";
+                                    break;
+                                default:
+                                    xzpresult = "4";
+                                    break;
+                            }
+                            ///上传了三个,且当前没有上传的能力点,标记为为学习状态。
+                            if (uploadedAbility.Count >= 3)
+                            {
+                                if (pfiles.Count == 0)
+                                {
+                                    zpscore = "4";
+                                    hpscore = "4";
+                                    xzpresult = "4";
+                                }
+                            }
+                            parameterMapData.Add("zpresult", zpscore);
+                            parameterMapData.Add("hpresult", hpscore);
+                            parameterMapData.Add("xzpresult", xzpresult);
+
+                            list53113.Add(parameterMapData);
+                            parameterMapDatas.Add(parameterMapData);
+                        });
+                        x.pushes.Add("53113");
+                        updatePush.Add(x);
+                        pushData.Add("success-UpdateTeacherListDiagnosis", parameterMapDatas);
+
+                    }
+                    //5.3.1.17学员课堂实录批量回写-UploadKTSLList
+                    if (t53117OK == 1)
+                    {
+                        List<Dictionary<string, object>> parameterMapDatas = new List<Dictionary<string, object>>();
+                        x.teacherClasses.ForEach(clss =>
+                        {
+                            Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                            string fileext = clss.url.Substring(clss.url.LastIndexOf(".") > 0 ? clss.url.LastIndexOf(".") + 1 : 0);
+                            parameterMapData.Add("PXID", $"{t.PXID}");
+                            parameterMapData.Add("TID", $"{t.TID}");
+                            parameterMapData.Add("url", $"{clss.url}?{schoolsas.sas}");//添加访问授权
+                            parameterMapData.Add("url2", $"{clss.url}?{schoolsas.sas}");
+                            parameterMapData.Add("fileName", clss.name.Length > 95 ? $"{clss.name.Substring(0, 95)}.{fileext}" : clss.name);
+                            parameterMapData.Add("fileSize", $"{clss.size}");
+                            parameterMapData.Add("md5", clss.hash);
+
+                            parameterMapData.Add("fileType", fileext);
+                            list53117.Add(parameterMapData);
+                            parameterMapDatas.Add(parameterMapData);
+                        });
+                        x.pushes.Add("53117");
+                        updatePush.Add(x);
+                        pushData.Add("success-UploadKTSLList", parameterMapDatas);
+                    }
+                    //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
+                    if (t53122OK == 1)
                     {
                         Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                        string fileext = clss.url.Substring(clss.url.LastIndexOf(".") > 0 ? clss.url.LastIndexOf(".") + 1 : 0);
                         parameterMapData.Add("PXID", $"{t.PXID}");
                         parameterMapData.Add("TID", $"{t.TID}");
-                        parameterMapData.Add("url", $"{clss.url}?{schoolsas.sas}");//添加访问授权
-                        parameterMapData.Add("url2", $"{clss.url}?{schoolsas.sas}");
-                        parameterMapData.Add("fileName", clss.name.Length > 95 ? $"{clss.name.Substring(0, 95)}.{fileext}" : clss.name);
-                        parameterMapData.Add("fileSize", $"{clss.size}");
-                        parameterMapData.Add("md5", clss.hash);
+                        List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
+                        x.offlineRecords.ForEach(record =>
+                        {
+                            if (!string.IsNullOrWhiteSpace(record.url))
+                            {
+                                Dictionary<string, object> fileMap = new Dictionary<string, object>();
+                                string fileext = record.url.Substring(record.url.LastIndexOf(".") > 0 ? record.url.LastIndexOf(".") + 1 : 0);
+                                fileMap.Add("url", $"{record.url}?{schoolsas.sas}");
+                                fileMap.Add("fileName", record.name.Length > 95 ? $"{record.name.Substring(0, 95)}.{fileext}" : record.name);
+                                fileMap.Add("fileSize", $"{record.size}");
+                                fileMap.Add("md5", record.hash);
 
-                        parameterMapData.Add("fileType", fileext);
-                        list53117.Add(parameterMapData);
-                        parameterMapDatas.Add(parameterMapData);
-                    });
-                    pushData.Add("success-UploadKTSLList", parameterMapDatas);
-                }
-                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 });
-                }
-                //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
-                if (t53122OK == 1)
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", $"{t.PXID}");
-                    parameterMapData.Add("TID", $"{t.TID}");
-                    List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
-                    x.offlineRecords.ForEach(record => {
-                        if (!string.IsNullOrWhiteSpace(record.url))
+                                fileMap.Add("fileType", fileext);
+                                files.Add(fileMap);
+                            }
+                        });
+                        if (x.offlineReport != null)
                         {
                             Dictionary<string, object> fileMap = new Dictionary<string, object>();
-                            string fileext = record.url.Substring(record.url.LastIndexOf(".") > 0 ? record.url.LastIndexOf(".") + 1 : 0);
-                            fileMap.Add("url", $"{record.url}?{schoolsas.sas}");
-                            fileMap.Add("fileName", record.name.Length > 95 ? $"{record.name.Substring(0, 95)}.{fileext}" : record.name);
-                            fileMap.Add("fileSize", $"{record.size}");
-                            fileMap.Add("md5", record.hash);
-
+                            fileMap.Add("url", $"{x.offlineReport.blob}?{teammodelossas.sas}");
+                            fileMap.Add("fileName", x.offlineReport.name);
+                            fileMap.Add("fileSize", $"{x.offlineReport.size}");
+                            fileMap.Add("md5", x.offlineReport.hash);
+                            string fileext = x.offlineReport.extension;
                             fileMap.Add("fileType", fileext);
                             files.Add(fileMap);
                         }
-                    });
-                    if (x.offlineReport != null)
+                        parameterMapData.Add("files", files);
+                        list53122.Add(parameterMapData);
+                        x.pushes.Add("53122");
+                        updatePush.Add(x);
+                        pushData.Add("success-UploadSBTARPDFListV2", parameterMapData);
+                    }
+                    if (!pushAll)
                     {
-                        Dictionary<string, object> fileMap = new Dictionary<string, object>();
-                        fileMap.Add("url", $"{x.offlineReport.blob}?{teammodelossas.sas}");
-                        fileMap.Add("fileName", x.offlineReport.name);
-                        fileMap.Add("fileSize", $"{x.offlineReport.size}");
-                        fileMap.Add("md5", x.offlineReport.hash);
-                        string fileext = x.offlineReport.extension;
-                        fileMap.Add("fileType", fileext);
-                        files.Add(fileMap);
+                        if (pushData.Any()) {
+                            pushDatas.Add(t.tmdid, pushData);
+                        }
                     }
-                    parameterMapData.Add("files", files);
-                    list53122.Add(parameterMapData);
-                    pushData.Add("success-UploadSBTARPDFListV2", parameterMapData);
                 }
-                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 });
+                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 });
+                    }
+                    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 });
+                    }
+                    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 });
+                    }
+                    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 });
+                    }
+                    if (pushData.Any())
+                    {
+                        pushDatas.Add(t.tmdid, pushData);
+                    }
                 }
-                pushDatas.Add(t.tmdid, pushData);
             }
         }