CrazyIter_Bin 3 年 前
コミット
629817f2c5

+ 86 - 39
TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs

@@ -491,22 +491,25 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             var members = yxtrain.SelectMany(x => x.members).ToList();
             if (members.IsNotEmpty())
             {
-                queryText = new StringBuilder($"SELECT distinct value(c) FROM c where c.type='yxtrain' " +
+                queryText = new StringBuilder($"SELECT distinct value(c) FROM c where " +
                     $"and  c.id in ({string.Join(",", members.Select(x => $"'{x.id}'"))}) ");
-                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
+                await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
                 requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
                 {
                     trains.Add(item);
                 }
             }
 
-            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);
-            }
+            //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);
+            //}
+
+            List<ScTeacher> scTeachers= await  _azureStorage.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" },{ "schoolCode",$"{school}" } });
+            List<ScTeacherDiagnosis> scTeacherDiagnoses = await _azureStorage.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis" }, { "schoolCode", $"{school}" } });
             //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
             List<TeacherTrain> trains53112OK = new List<TeacherTrain>();
 
@@ -518,39 +521,75 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
 
             //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
             List<TeacherTrain> trains53122OK = new List<TeacherTrain>();
-
             List<KeyValuePair<TeacherTrain, string>> trainsNO = new List<KeyValuePair<TeacherTrain, string>>();
             List<PushFail> fails = new List<PushFail>();
-            List<ScTeacher> scTeachers = await _azureStorage.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" } });
-            //  List<ScTeacherDiagnosis> diagnoses = await _azureStorage.FindListByDict<ScTeacherDiagnosis>(new Dictionary<string, object> { { "PartitionKey", "ScTeacherDiagnosis", }});
+
+            ScsResult UpdateTeacherListSituation = null;
+            Dictionary<string, object> parameterContent53112 = new Dictionary<string, object>();
+            List<Dictionary<string, object>> list53112 = new List<Dictionary<string, object>>();
+
             trains.ForEach(x => {
-                var teacher = teachers.Find(t => t.id.Equals(x.id));
-                if (teacher == null)
-                {
-                    fails.Add(new PushFail { tmdid = x.id, msgs = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("tmdid-unexistent", "账号不存在!") } });
-                }
-                else
-                {
-                    List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
-                    var binddata = teachers.Where(t => t.id.Equals(x.id)).SelectMany(z => z.binds)
-                        .Where(d => d.data.IsNotEmpty()).SelectMany(d => d.data)
-                        .Where(d => string.IsNullOrEmpty(d) && d.Contains(config.config) && d.Contains(config.path));
-                    if (binddata != null && binddata.Count() > 0)
+                List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
+                List<ScTeacher> teacher =  scTeachers.FindAll(t => t.tmdid.Equals(x.id) );
+                teacher.ForEach(async t => {
+                    ScTeacherDiagnosis diagnosis= scTeacherDiagnoses.Find(x => x.RowKey.Equals(t.PXID));
+                   
+                    (int t53112OK, List<KeyValuePair<string, string>> msgs53112) = check53112(x, msgs);
+                    (int t53113OK, List<KeyValuePair<string, string>> msgs53113, List<AbilitySub> abilitySubs) = await check53113(x, diagnosis, msgs);
+                    (int t53117OK, List<KeyValuePair<string, string>> msgs53117) = check53117(x, msgs);
+                    (int t53122OK, List<KeyValuePair<string, string>> msgs53122) = check53122(x, msgs);
+                    //5.3.1.12学员培训基本情况批量回写-UpdateTeacherListSituation
+                    if (t53112OK == 1)
                     {
-                        var bindData = binddata.First().ToObject<ScBindData>();
-                        if (binddata != null)
-                        {
-                        }
-                        else
-                        {
-                            //如果没有找到绑定信息,则去blob查找。
-                        }
+                        Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+
+
                     }
-                    else
+                    //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
+                    if (t53113OK == 1)
                     {
-                        //如果没有找到绑定信息,则去blob查找。
+
                     }
-                }
+                    //5.3.1.17学员课堂实录批量回写-UploadKTSLList
+                    if (t53117OK == 1)
+                    {
+
+                    }   
+                    //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2
+                    if (t53122OK == 1)
+                    {
+
+                    }
+                });
+
+
+                //var teacher = teachers.Find(t => t.id.Equals(x.id));
+                //if (teacher == null)
+                //{
+                //    fails.Add(new PushFail { tmdid = x.id, msgs = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("tmdid-unexistent", "账号不存在!") } });
+                //}
+                //else
+                //{
+                //    List<KeyValuePair<string, string>> msgs = new List<KeyValuePair<string, string>>();
+                //    var binddata = teachers.Where(t => t.id.Equals(x.id)).SelectMany(z => z.binds)
+                //        .Where(d => d.data.IsNotEmpty()).SelectMany(d => d.data)
+                //        .Where(d => string.IsNullOrEmpty(d) && d.Contains(config.config) && d.Contains(config.path));
+                //    if (binddata != null && binddata.Count() > 0)
+                //    {
+                //        var bindData = binddata.First().ToObject<ScBindData>();
+                //        if (bindData != null)
+                //        {
+                //        }
+                //        else
+                //        {
+                //            //如果没有找到绑定信息,则去blob查找。
+                //        }
+                //    }
+                //    else
+                //    {
+                //        //如果没有找到绑定信息,则去blob查找。
+                //    }
+                //}
             });
             await response.WriteAsJsonAsync(new { });
             return response;
@@ -621,7 +660,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             return (t53112OK, msgs);
         }
         //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
-        public async Task<(int t53113OK, List<KeyValuePair<string, string>> msgs, List<AbilitySub> abilitySubs)> check53113(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
+        public async Task<(int t53113OK, List<KeyValuePair<string, string>> msgs, List<AbilitySub> abilitySubs)> check53113(TeacherTrain teacherTrain, ScTeacherDiagnosis diagnosis, List<KeyValuePair<string, string>> msgs)
         {
             //校验 基本情况是否满足
             int t53113OK = 1;
@@ -643,9 +682,14 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             }
             if (teacherTrain.currency.teacherAilities.Count <= 0 || teacherTrain.currency.teacherAilities.Select(x => x.no).Count() <= 0)
             {
+
                 string insql = "";
                 if (teacherTrain.currency.teacherAilities.IsNotEmpty())
                 {
+                    IEnumerable<string> ds= diagnosis.abilityNos.ToObject<List<string>>().Except(teacherTrain.currency.teacherAilities.Select(x => x.no));
+                    if (ds != null && ds.Count() > 0) {
+                        msgs.Add(new KeyValuePair<string, string>("diagnosisNos", $"省平台勾选的能力点编号为学习完成:省平台:{diagnosis.abilityNos},已学习:{teacherTrain.currency.teacherAilities.Select(x => x.no).ToJsonString()}"));
+                    }
                     insql = $" where c.id in ({string.Join(",", teacherTrain.currency.teacherAilities.Select(o => $"'{o.id}'"))})";
                 }
                 //认证材料
@@ -656,16 +700,19 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                 }
                 teacherTrain.currency.teacherAilities.ForEach(x => {
                     var  abilitySub= abilitySubs.Find(z => z.id.Equals(x.id));
+                    if (abilitySub == null || abilitySub.uploads.IsNotEmpty()) {
+                        msgs.Add(new KeyValuePair<string, string>("uploads", $"未上传认证材料:{x.no},{x.name}"));
+                    }
                     if (x.zpscore <= 0) {
-                        msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料学习,没有完成自评:{x.no},{x.name},{x.zpscore}"));
+                        msgs.Add(new KeyValuePair<string, string>("zpscore", $"认证材料,没有完成自评:{x.no},{x.name},{x.zpscore}"));
                     }
                     if (x.hpscore <= 0)
                     {
-                        msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料学习,没有完成互评:{x.no},{x.name},{x.hpscore}"));
+                        msgs.Add(new KeyValuePair<string, string>("hpscore", $"认证材料,没有完成互评:{x.no},{x.name},{x.hpscore}"));
                     }
                     if (x.xzscore <= 0)
                     {
-                        msgs.Add(new KeyValuePair<string, string>("xzscore", $"认证材料学习,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
+                        msgs.Add(new KeyValuePair<string, string>("xzscore", $"认证材料,没有完成小组评:{x.no},{x.name},{x.xzscore}"));
                     }
                 });
                 t53113OK = 0;

+ 30 - 3
TEAMModelOS.SDK/Models/Service/ActivityService.cs

@@ -181,7 +181,16 @@ namespace TEAMModelOS.SDK
                         try
                         {
                             await updateClassResulte(client, classResults, standerAnswers, member.id, groupChange.listid);
-                            await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.code.Replace("Base-", "")}-{member.id}"));
+                            StuActivity stuActivity= await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.code.Replace("Base-", "")}-{member.id}"));
+                            stuActivity.classIds.Remove(groupChange.listid);
+                            if (stuActivity.classIds.IsNotEmpty())
+                            {
+                                await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(stuActivity,activity.id, new PartitionKey(stuActivity.code));
+                            }
+                            else {
+                                await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.code.Replace("Base-", "")}-{member.id}"));
+                            }
+                           
                         }
                         catch (CosmosException)
                         {
@@ -194,7 +203,16 @@ namespace TEAMModelOS.SDK
                         try
                         {
                             await updateClassResulte(client, classResults, standerAnswers, member.id, groupChange.listid);
-                            await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.id}"));
+                            StuActivity stuActivity= await client.GetContainer(Constant.TEAMModelOS, "Student").ReadItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.id}"));
+                            stuActivity.classIds.Remove(groupChange.listid);
+                            if (stuActivity.classIds.IsNotEmpty())
+                            {
+                                await client.GetContainer(Constant.TEAMModelOS, "Student").ReplaceItemAsync<StuActivity>(stuActivity, activity.id, new PartitionKey(stuActivity.code));
+                            }
+                            else
+                            {
+                                await client.GetContainer(Constant.TEAMModelOS, "Student").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.id}"));
+                            }
                         }
                         catch (CosmosException)
                         {
@@ -206,7 +224,16 @@ namespace TEAMModelOS.SDK
                     {
                         try
                         {
-                            await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.id}"));
+                            StuActivity stuActivity= await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<StuActivity>(activity.id, new PartitionKey($"Activity-{member.id}"));
+                            stuActivity.classIds.Remove(groupChange.listid);
+                            if (stuActivity.classIds.IsNotEmpty())
+                            {
+                                await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(stuActivity, activity.id, new PartitionKey(stuActivity.code));
+                            }
+                            else
+                            {
+                                await client.GetContainer(Constant.TEAMModelOS, "Teacher").DeleteItemAsync<StuActivity> (activity.id, new PartitionKey($"Activity-{member.id}"));
+                            }
                         }
                         catch (CosmosException)
                         {

+ 9 - 2
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -779,8 +779,15 @@ namespace TEAMModelOS.SDK
                             tmdsData.ForEach(y =>
                             {
                                 var tmd = tmdInfos.Find(x => x.id.Equals(y.id));
-                                y.name = tmd?.name;
-                                y.picture = tmd?.picture;
+                                if (tmd != null)
+                                {
+                                    y.name = tmd?.name;
+                                    y.picture = tmd?.picture;
+                                }
+                                else { 
+                                
+                                }
+                               
                             });
                         }
                     }

+ 2 - 2
TEAMModelOS/TEAMModelOS.csproj

@@ -32,8 +32,8 @@
     <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
     <UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
     <Version>5.2203.2</Version>
-    <AssemblyVersion>5.2203.2.1</AssemblyVersion>
-    <FileVersion>5.2203.2.1</FileVersion>
+    <AssemblyVersion>5.2203.2.2</AssemblyVersion>
+    <FileVersion>5.2203.2.2</FileVersion>
     <Description>TEAMModelOS(IES5)版本更新。</Description>
     <PackageReleaseNotes>6.0版本说明</PackageReleaseNotes>
   </PropertyGroup>