浏览代码

数据回写。

CrazyIter_Bin 3 年之前
父节点
当前提交
ddd8b140da
共有 2 个文件被更改,包括 177 次插入81 次删除
  1. 145 47
      TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs
  2. 32 34
      TEAMModelOS/Controllers/Third/ScApiController.cs

+ 145 - 47
TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs

@@ -522,24 +522,36 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             List<Dictionary<string, object>> list53112 = new List<Dictionary<string, object>>();
             parameterContent53112.Add("TrainComID", config.trainComID);
             parameterContent53112.Add("List", list53112);
-
-
-
-            //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
+             
+            //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
+            //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
+            //5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写-UploadSBTARPDFListV2   100条限制
             List<TeacherTrain> trains53122OK = new List<TeacherTrain>();
-
-            trains.ForEach(x => {
+            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);
+            foreach (var x in trains) {
                 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));
-                   
+                List<ScTeacher> teacher = scTeachers.FindAll(t => t.tmdid.Equals(x.id));
+                foreach (var t in teacher) {
+                    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);
@@ -560,7 +572,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                         string ComPassed = "0";
                         switch (x.finalScore)
                         {
-                            case -2 :
+                            case -2:
                                 ComPassed = "4";
                                 break;
                             case -1:
@@ -586,49 +598,135 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                     //5.3.1.13学员能力点测评结果批量回写-UpdateTeacherListDiagnosis
                     if (t53113OK == 1)
                     {
+                        x.currency.teacherAilities.ForEach(a => {
+                            Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                            parameterMapData.Add("PXID", $"{t.PXID}");
+                            parameterMapData.Add("TID", $"{t.TID}");
+                            parameterMapData.Add("DiagnosisNum", $"{a.no}");
+                            //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 = "0";
+                                    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 = "0";
+                                    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 = "0";
+                                    break;
+                            }
+                            parameterMapData.Add("zpresult", zpscore);
+                            parameterMapData.Add("hpresult", hpscore);
+                            parameterMapData.Add("xzpresult", xzpresult);
+                            List<Dictionary<string, object>> pfiles = new List<Dictionary<string, object>>();
+                            parameterMapData.Add("pfiles", pfiles);
 
+                            AbilitySub abilitySub = abilitySubs.Find(sub => sub.id.Equals(a.id));
+                            if (abilitySub != null)
+                            {
+                                abilitySub.uploads.ForEach(upload => {
+                                    upload.urls.ForEach(url => {
+                                        Dictionary<string, object> pfileMap = new Dictionary<string, object>();
+                                        pfileMap.Add("url", url.url);
+                                        pfileMap.Add("fileName", url.name);
+                                        pfileMap.Add("fileSize", url.size);
+                                        pfileMap.Add("md5", url.hash);
+                                        string fileext = url.url.Substring(url.url.LastIndexOf(".") > 0 ? url.url.LastIndexOf(".") + 1 : 0);
+                                        pfileMap.Add("fileType", fileext);
+                                        pfiles.Add(pfileMap);
+                                    });
+                                });
+                            }
+                            list53113.Add(parameterMapData);
+                        });
                     }
                     //5.3.1.17学员课堂实录批量回写-UploadKTSLList
                     if (t53117OK == 1)
                     {
-
-                    }   
+                        x.teacherClasses.ForEach(clss =>
+                        {
+                            Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                            parameterMapData.Add("PXID", $"{t.PXID}");
+                            parameterMapData.Add("TID", $"{t.TID}");
+                            parameterMapData.Add("url", clss.url);//添加访问授权
+                            parameterMapData.Add("url2", clss.url);
+                            parameterMapData.Add("fileName", clss.name);
+                            parameterMapData.Add("fileSize", clss.size);
+                            parameterMapData.Add("md5", clss.hash);
+                            string fileext = clss.url.Substring(clss.url.LastIndexOf(".") > 0 ? clss.url.LastIndexOf(".") + 1 : 0);
+                            parameterMapData.Add("fileType", fileext);
+                            list53117.Add(parameterMapData);
+                        });
+                    }
                     //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 => {
+                            Dictionary<string, object> fileMap = new Dictionary<string, object>();
+                            fileMap.Add("url", record.url);
+                            fileMap.Add("fileName", record.name);
+                            fileMap.Add("fileSize", record.size);
+                            fileMap.Add("md5", record.hash);
+                            string fileext = record.url.Substring(record.url.LastIndexOf(".") > 0 ? record.url.LastIndexOf(".") + 1 : 0);
+                            fileMap.Add("fileType", fileext);
+                            files.Add(fileMap);
+                        });
+                        parameterMapData.Add("files", files);
+                        list53122.Add(parameterMapData);
                     }
-                });
-
-
-                //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;
         }

+ 32 - 34
TEAMModelOS/Controllers/Third/ScApiController.cs

@@ -612,23 +612,22 @@ namespace TEAMModelOS.Controllers
                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                 parameterMapData.Add("PXID", "65309");
                 parameterMapData.Add("TID", "253940");
-                List<Dictionary<string, object>> pfiles = new List<Dictionary<string, object>>();
-                parameterMapData.Add("pfiles", pfiles);
-                Dictionary<string, object> pfileMap = new Dictionary<string, object>();
-                pfileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                pfileMap.Add("fileName", "XXX.pdf");
-                pfileMap.Add("fileSize", "247767");
-                pfileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                pfileMap.Add("fileType", "pdf");
-                pfiles.Add(pfileMap);
-                pfileMap = new Dictionary<string, object>(); //添加第二个校本研修方案
-                pfileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                pfileMap.Add("fileName", "XXX.pdf");
-                pfileMap.Add("fileSize", "247767");
-                pfileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                pfileMap.Add("fileType", "pdf");
-                pfiles.Add(pfileMap);
-                parameterMapData.Add("files", pfiles);
+                List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
+                Dictionary<string, object> fileMap = new Dictionary<string, object>();
+                fileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                fileMap.Add("fileName", "XXX.pdf");
+                fileMap.Add("fileSize", "247767");
+                fileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                fileMap.Add("fileType", "pdf");
+                files.Add(fileMap);
+                fileMap = new Dictionary<string, object>(); //添加第二个校本研修方案
+                fileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                fileMap.Add("fileName", "XXX.pdf");
+                fileMap.Add("fileSize", "247767");
+                fileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                fileMap.Add("fileType", "pdf");
+                files.Add(fileMap);
+                parameterMapData.Add("files", files);
                 list.Add(parameterMapData);
             }
 
@@ -636,23 +635,22 @@ namespace TEAMModelOS.Controllers
                 Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
                 parameterMapData.Add("PXID", "65306");
                 parameterMapData.Add("TID", "32393");
-                List<Dictionary<string, object>> pfiles = new List<Dictionary<string, object>>();
-                parameterMapData.Add("pfiles", pfiles);
-                Dictionary<string, object> pfileMap = new Dictionary<string, object>();
-                pfileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                pfileMap.Add("fileName", "XXX.pdf");
-                pfileMap.Add("fileSize", "247767");
-                pfileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                pfileMap.Add("fileType", "pdf");
-                pfiles.Add(pfileMap);
-                pfileMap = new Dictionary<string, object>(); //添加第二个校本研修方案
-                pfileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                pfileMap.Add("fileName", "XXX.pdf");
-                pfileMap.Add("fileSize", "247767");
-                pfileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                pfileMap.Add("fileType", "pdf");
-                pfiles.Add(pfileMap);
-                parameterMapData.Add("files", pfiles);
+                List<Dictionary<string, object>> files = new List<Dictionary<string, object>>();
+                Dictionary<string, object> fileMap = new Dictionary<string, object>();
+                fileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                fileMap.Add("fileName", "XXX.pdf");
+                fileMap.Add("fileSize", "247767");
+                fileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                fileMap.Add("fileType", "pdf");
+                files.Add(fileMap);
+                fileMap = new Dictionary<string, object>(); //添加第二个校本研修方案
+                fileMap.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                fileMap.Add("fileName", "XXX.pdf");
+                fileMap.Add("fileSize", "247767");
+                fileMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                fileMap.Add("fileType", "pdf");
+                files.Add(fileMap);
+                parameterMapData.Add("files", files);
                 list.Add(parameterMapData);
             }
             ScsResult UploadSBTARPDFListV2 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);