CrazyIter_Bin 3 tahun lalu
induk
melakukan
132a38f4c0
28 mengubah file dengan 1616 tambahan dan 909 penghapusan
  1. 17 7
      TEAMModelFunction/MonitorServicesBus.cs
  2. 142 76
      TEAMModelFunction/ScsApisHttpTrigger.cs
  3. 2 2
      TEAMModelFunction/TEAMModelFunction.csproj
  4. 1 1
      TEAMModelFunction/TriggerExamLite.cs
  5. 1 1
      TEAMModelFunction/TriggerHomework.cs
  6. 1 1
      TEAMModelFunction/TriggerStudy.cs
  7. 1 1
      TEAMModelFunction/TriggerSurvey.cs
  8. 1 1
      TEAMModelFunction/TriggerVote.cs
  9. 1 30
      TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs
  10. 19 4
      TEAMModelOS.SDK/Models/Service/SchoolService.cs
  11. 52 13
      TEAMModelOS.SDK/Models/Service/StatisticsService.cs
  12. 0 89
      TEAMModelOS.SDK/Models/Service/Third/ScApisService.cs
  13. 231 0
      TEAMModelOS.SDK/Models/Service/Third/ScYxptModel.cs
  14. 1 1
      TEAMModelOS.SDK/Models/Service/Third/ThirdApisService.cs
  15. 2 2
      TEAMModelOS.sln
  16. 1 1
      TEAMModelOS/Controllers/Common/ExamLiteController.cs
  17. 2 2
      TEAMModelOS/Controllers/Common/HomeworkController.cs
  18. 1 1
      TEAMModelOS/Controllers/Common/StudyController.cs
  19. 2 1
      TEAMModelOS/Controllers/Research/AbilityStatisticsController.cs
  20. 12 6
      TEAMModelOS/Controllers/Research/AbilitySubController.cs
  21. 1 1
      TEAMModelOS/Controllers/Research/AppraiseController.cs
  22. 4 4
      TEAMModelOS/Controllers/Research/ClassVideoController.cs
  23. 679 0
      TEAMModelOS/Controllers/Third/ScApiController.cs
  24. 240 647
      TEAMModelOS/Controllers/Third/ScController.cs
  25. 49 0
      TEAMModelOS/Controllers/XTest/FixDataController.cs
  26. 135 9
      TEAMModelOS/Controllers/XTest/TestController.cs
  27. 2 2
      TEAMModelOS/Services/Common/ActivityStudentService.cs
  28. 16 6
      TEAMModelOS/appsettings.Development.json

+ 17 - 7
TEAMModelFunction/MonitorServicesBus.cs

@@ -346,8 +346,9 @@ namespace TEAMModelFunction
         /// <returns></returns>
         [FunctionName("TeacherTrainChange")]
         public async Task TeacherTrainChangeFunc([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "teacher-train-change", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
-            try {
-               // await _dingDing.SendBotMsg($"teacher-train-change\n{msg}",GroupNames.成都开发測試群組);
+            try
+            {
+                // await _dingDing.SendBotMsg($"teacher-train-change\n{msg}",GroupNames.成都开发測試群組);
                 TeacherTrainChange change = msg.ToObject<TeacherTrainChange>();
                 if (change.update == null || change.update.Count <= 0 || change.tmdids.IsEmpty())
                 {
@@ -367,7 +368,8 @@ namespace TEAMModelFunction
                 {
 
                     List<Task<ItemResponse<TeacherTrain>>> task = new List<Task<ItemResponse<TeacherTrain>>>();
-                    teacherTrains.ForEach(x => {
+                    teacherTrains.ForEach(x =>
+                    {
                         x.update.UnionWith(change.update);
                         task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<TeacherTrain>(x, x.id, new PartitionKey($"TeacherTrain-{change.school}")));
                     });
@@ -376,7 +378,8 @@ namespace TEAMModelFunction
                     if (unchange != null)
                     {
                         task.Clear();
-                        unchange.ToList().ForEach(x => {
+                        unchange.ToList().ForEach(x =>
+                        {
                             TeacherTrain teacherTrain = new TeacherTrain
                             {
                                 pk = "TeacherTrain",
@@ -435,7 +438,8 @@ namespace TEAMModelFunction
                         };
                     }
                     List<Task<TeacherTrain>> task = new List<Task<TeacherTrain>>();
-                    teacherTrains.ForEach(x => {
+                    teacherTrains.ForEach(x =>
+                    {
                         x.update.UnionWith(change.update);
                         task.Add(StatisticsService.StatisticsTeacher(x, setting, area, client, null));
                     });
@@ -444,7 +448,8 @@ namespace TEAMModelFunction
                     if (unchange != null)
                     {
                         task.Clear();
-                        unchange.ToList().ForEach(x => {
+                        unchange.ToList().ForEach(x =>
+                        {
                             task.Add(StatisticsService.StatisticsTeacher(new TeacherTrain
                             {
                                 pk = "TeacherTrain",
@@ -459,7 +464,12 @@ namespace TEAMModelFunction
                         await task.TaskPage(1);
                     }
                 }
-            } catch (Exception ex) {
+            }
+            catch (CosmosException ex) {
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-研修数据变更,重新统计-TeacherTrainChange\n{msg}\n{ex.Message}\n{ex.StackTrace}CosmosException{ex.Status}", GroupNames.成都开发測試群組);
+            }
+            catch (Exception ex)
+            {
                 await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-研修数据变更,重新统计-TeacherTrainChange\n{msg}\n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
             }
         }

+ 142 - 76
TEAMModelFunction/ScsApisHttpTrigger.cs

@@ -43,7 +43,7 @@ namespace TEAMModelFunction
             _thirdApisService = thirdApisService;
         }
         /// <summary>
-        /// 
+        /// 数据推送接口
         /// </summary>
         /// <param name="req"></param>
         /// <param name="log"></param>
@@ -126,81 +126,6 @@ namespace TEAMModelFunction
             return new OkObjectResult(new { });
         }
 
-        public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53112(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
-        {
-            //校验 基本情况是否满足
-            int t53112OK = 1;
-            if (teacherTrain.finalScore < 0)
-            {
-                msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
-                t53112OK = 0;
-            }
-            if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
-            {
-                string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
-                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
-                t53112OK = 0;
-            }
-            if (teacherTrain.totalTime <= 0)
-            {
-                msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
-                t53112OK = 0;
-            }
-            return (t53112OK, msgs);
-        }
-
-        public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53113(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
-        {
-            //校验 基本情况是否满足
-            int t53112OK =1;
-            if (teacherTrain.finalScore < 0)
-            {
-                msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
-                t53112OK = 0;
-            }
-            if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length>300)
-            { 
-                string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
-                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
-                t53112OK = 0;
-            }
-            if (teacherTrain.totalTime <= 0)
-            {
-                msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
-                t53112OK = 0;
-            }
-            return (t53112OK, msgs);
-        }
-
-        public class PushFail {
-            public string tmdid { get; set; }
-            public string name { get; set; }
-            public string picture { get; set; }
-            public List<KeyValuePair<string,string>> msgs { get; set; }
-        }
-        public class ScPush{
-            public string tmdid { get; set; }
-            public string userid { get; set; }
-            public string pxid { get; set; }
-            public int tbase { get; set; } = -1;//基本信息推送状态 -1 未推送,0 推送失败,1推送成功
-            public int tability { get; set; } = -1;//能力点推送状态 -1 未推送,0 推送失败,1推送成功
-            public int tktsl { get; set; } = -1;//课堂实录推送状态 -1 未推送,0 推送失败,1推送成功
-            public int txbyx { get; set; } = -1;//校本研修推送状态 -1 未推送,0 推送失败,1推送成功
-            public string rbase { get; set; }//基本信息推送失败原因
-            public string rability { get; set; }//能力点推送失败原因
-            public string rktsl { get; set; }//课堂实录推送失败原因
-            public string rxbyx { get; set; } //校本研修推送失败原因
-        }
-        public class ScTchTmd{
-            public string tmdid { get; set; }
-            public string name { get; set; }    
-            public string userid { get; set; }
-            public string pxid { get; set; }
-            public string sid { get; set; }
-            public string pd { get; set; }
-            public string pid { get; set; }
-        }
-
         /// <summary>
         /// 5.3.1.1获取项目列表
         /// </summary>
@@ -234,6 +159,99 @@ namespace TEAMModelFunction
             }
         }
 
+
+        /// <summary>
+        ///  5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
+        [FunctionName("GetSchoolList")]
+        public async Task<IActionResult> GetSchoolList([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
+        {
+            List<ScSchool> scSchools = new List<ScSchool>();
+            string data = await new StreamReader(req.Body).ReadToEndAsync();
+            JsonElement accessConfig = data.ToObject<JsonElement>().GetProperty("accessConfig");
+            ScAccessConfig config = $"{accessConfig}".ToObject<ScAccessConfig>();
+            Code = "GetSchoolList";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", config.trainComID);
+            List<ScsResult> results = new List<ScsResult>();
+            try
+            {
+                if (config.p.IsNotEmpty())
+                {
+                    foreach (var ps in config.p)
+                    {
+                        parameterMap["ProjectID"] = ps.pd;
+                        parameterMap["ProjectItemID"] = ps.pid;
+                        ScsResult result = new ScsResult { code = Code, title = " 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表" };
+                        result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                        if (result.result)
+                        {
+                            List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
+                            if (schools.IsNotEmpty())
+                            {
+                                scSchools.AddRange(schools);
+                            }
+                        }
+                        results.Add(result);
+                    }
+                }
+                return new OkObjectResult(new { data = scSchools.ToJsonString() });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetProjectInfoByTrainComID\n{ex.Message}{ex.StackTrace}\n{results.ToJsonString()}", GroupNames.成都开发測試群組);
+                return new OkObjectResult(scSchools);
+            }
+        }
+        /// <summary>
+        /// 5.3.1.2获取学员名单
+        /// </summary>
+        /// <param name="req"></param>
+        /// <param name="log"></param>
+        /// <returns></returns>
+        [FunctionName("GetTeachersListByProject")]
+        public async Task<IActionResult> GetTeachersListByProject([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
+        {
+            List<ScTeacher> scTeachers = new List<ScTeacher>();
+            string data = await new StreamReader(req.Body).ReadToEndAsync();
+            JsonElement accessConfig = data.ToObject<JsonElement>().GetProperty("accessConfig");
+            ScAccessConfig config = $"{accessConfig}".ToObject<ScAccessConfig>();
+            Code = "GetTeachersListByProject";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", config.trainComID);
+            List<ScsResult> results = new List<ScsResult>();
+            try
+            {
+                if (config.p.IsNotEmpty())
+                {
+                    foreach (var ps in config.p)
+                    {
+                        parameterMap["ProjectID"] = ps.pd;
+                        parameterMap["ProjectItemID"] = ps.pid;
+                        ScsResult result = new ScsResult { code = Code, title = "5.3.1.2获取学员名单" };
+                        result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                        if (result.result)
+                        {
+                            List<ScTeacher> teachers = result.content.ToObject<List<ScTeacher>>();
+                            if (teachers.IsNotEmpty())
+                            {
+                                scTeachers.AddRange(teachers);
+                            }
+                        }
+                        results.Add(result);
+                    }
+                }
+                return new OkObjectResult(new { data = scTeachers.ToJsonString() });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetProjectInfoByTrainComID\n{ex.Message}{ex.StackTrace}\n{results.ToJsonString()}", GroupNames.成都开发測試群組);
+                return new OkObjectResult(scTeachers);
+            }
+        }
         /// <summary>
         /// 5.3.1.19获取项目设置的可选能力点
         /// </summary>
@@ -354,5 +372,53 @@ namespace TEAMModelFunction
                 return new OkObjectResult(teacher);
             }
         }
+
+        public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53112(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
+        {
+            //校验 基本情况是否满足
+            int t53112OK = 1;
+            if (teacherTrain.finalScore < 0)
+            {
+                msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
+                t53112OK = 0;
+            }
+            if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
+            {
+                string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
+                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
+                t53112OK = 0;
+            }
+            if (teacherTrain.totalTime <= 0)
+            {
+                msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
+                t53112OK = 0;
+            }
+            return (t53112OK, msgs);
+        }
+
+        public (int t53112OK, List<KeyValuePair<string, string>> msgs) check53113(TeacherTrain teacherTrain, List<KeyValuePair<string, string>> msgs)
+        {
+            //校验 基本情况是否满足
+            int t53112OK = 1;
+            if (teacherTrain.finalScore < 0)
+            {
+                msgs.Add(new KeyValuePair<string, string>("finalScore", $"最终评定结果参数:{teacherTrain.finalScore}"));
+                t53112OK = 0;
+            }
+            if (string.IsNullOrEmpty(teacherTrain.summary) || teacherTrain.summary.Length > 300)
+            {
+                string msg = string.IsNullOrEmpty(teacherTrain.summary) ? "未填写" : teacherTrain.summary.Length > 300 ? "字数超过300." : "";
+                msgs.Add(new KeyValuePair<string, string>("summary", $"教师培训总结:{msg}"));
+                t53112OK = 0;
+            }
+            if (teacherTrain.totalTime <= 0)
+            {
+                msgs.Add(new KeyValuePair<string, string>("totalTime", $"未获得学时:{teacherTrain.totalTime}"));
+                t53112OK = 0;
+            }
+            return (t53112OK, msgs);
+        }
+
+
     }
 }

+ 2 - 2
TEAMModelFunction/TEAMModelFunction.csproj

@@ -4,8 +4,8 @@
     <AzureFunctionsVersion>v3</AzureFunctionsVersion>
     <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
     <Version>5.2112.21</Version>
-    <AssemblyVersion>5.2107.29.1</AssemblyVersion>
-    <FileVersion>5.2107.29.1</FileVersion>
+    <AssemblyVersion>5.2107.29.2</AssemblyVersion>
+    <FileVersion>5.2107.29.2</FileVersion>
   </PropertyGroup>
   <ItemGroup>
     <Compile Remove="AServiceBus.cs" />

+ 1 - 1
TEAMModelFunction/TriggerExamLite.cs

@@ -125,7 +125,7 @@ namespace TEAMModelFunction
                               
                             }
                             await ActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
-                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus,   client);
                             var messageWorkEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
                             messageWorkEnd.ApplicationProperties.Add("name", "ExamLite");
                             if (changeRecords.Count > 0)

+ 1 - 1
TEAMModelFunction/TriggerHomework.cs

@@ -183,7 +183,7 @@ namespace TEAMModelFunction
                                 });
                             }
                             await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
-                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                             var messageWorkEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
                             messageWorkEnd.ApplicationProperties.Add("name", "Homework");
                             if (changeRecords.Count > 0)

+ 1 - 1
TEAMModelFunction/TriggerStudy.cs

@@ -126,7 +126,7 @@ namespace TEAMModelFunction
                                 }
 
                                 await ActivityService.SaveStuActivity(client, _dingDing, null, null, tchActivities);
-                                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus,client);
                                 var messageWorkEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
                                 messageWorkEnd.ApplicationProperties.Add("name", "Study");
                                 if (changeRecords.Count > 0)

+ 1 - 1
TEAMModelFunction/TriggerSurvey.cs

@@ -189,7 +189,7 @@ namespace TEAMModelFunction
                                 
                             }
                             await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
-                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                             //向学生或醍摩豆账号发起通知
                             #region
                             //Notice notice = new Notice()

+ 1 - 1
TEAMModelFunction/TriggerVote.cs

@@ -199,7 +199,7 @@ namespace TEAMModelFunction
                              
                             //   $"{tchActivities.ToJsonString()}\n", GroupNames.成都开发測試群組);
                             await ActivityService.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities, tchActivities);
-                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                             //向学生或醍摩豆账号发起通知
                             #region
                             //Notice notice = new Notice()

+ 1 - 30
TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs

@@ -48,36 +48,7 @@ namespace TEAMModelOS.SDK.Models
             // public HashSet<string> pxid { get; set; } = new HashSet<string>();
             public List<string> data { get; set; }= new List<string>();
         }
-        public class ScBindData {
-
-            /// <summary>
-            /// 学校名称
-            /// </summary>
-            public string type { get; set; } = "scsyxpt";
-            /// <summary>
-            /// 学校名称 SchoolName
-            /// </summary>
-            public string sn { get; set; }
-            /// <summary>
-            /// 学校id  SchoolID
-            /// </summary>
-            public string sid { get; set; }
-            /// <summary>
-            /// 项目id  ProjectID
-            /// </summary>
-            public string pd { get; set; }
-            /// <summary>
-            /// 子项目id  ProjectItemID
-            /// </summary>
-            public string pid { get; set; }
-            
-            public string pxid { get; set; }
-            public string userid { get; set; }
-            public string username { get; set; }
-            public string account { get; set; }
-            public string path { get; set; }
-        }
-
+        
 
         public class DingDingBind
         {

+ 19 - 4
TEAMModelOS.SDK/Models/Service/SchoolService.cs

@@ -16,11 +16,9 @@ namespace TEAMModelOS.SDK
 {
     public class SchoolService
     {
-        public static async Task<dynamic> GenerateSchoolCode(JsonElement json,DingDing _dingDing, IWebHostEnvironment _environment)
+        public static async Task<List<SchoolData>> GenerateSchoolCode(List<SchoolData> schools, DingDing _dingDing, IWebHostEnvironment _environment)
         {
             string path = $"{_environment.ContentRootPath}/JsonFile/Core/region.json";
-
-            var schools = json.GetProperty("schools").ToObject<List<SchoolData>>();
             //var schools = jsonstr.ToObject<JsonElement>().GetProperty("schools").ToObject<List<SchoolData>>();
             schools = schools.Where((x, i) => schools.FindIndex(n => n.name.Equals(x.name)) == i).ToList();
             StreamReader streamReader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
@@ -347,7 +345,23 @@ namespace TEAMModelOS.SDK
                 }
             });
             var dataa = dataz.SelectMany(y => y.list).GroupBy(x => x.id).Select(x => new { key = x.Key, more = x.ToList().Count > 2, count = x.ToList().Count, list = x.ToList() }).ToList();
-            return dataa.Where(x => x.count > 1); 
+            Random random = new Random();
+            List<SchoolData> list = new List<SchoolData>();
+            dataa.ForEach(x =>
+            {
+                if (x.count > 1)
+                {
+                    
+                    x.list.ForEach(y => {
+                        int r= random.Next(25);
+                        int index= random.Next(5);
+                        y.id   = y.id.Insert(index - 1, $"{a_z[r]}").Remove(index, 1);
+                    });
+                }
+                list.AddRange(x.list);
+            });
+
+            return list; 
         }
 
         public static string ToPinYin(string val)
@@ -409,6 +423,7 @@ namespace TEAMModelOS.SDK
             public string name { get; set; }
             public string city { get; set; }
             public string aname { get; set; }
+            public string uid { get; set; }
         }
 
 

+ 52 - 13
TEAMModelOS.SDK/Models/Service/StatisticsService.cs

@@ -89,21 +89,60 @@ namespace TEAMModelOS.SDK
             }
 
         }
-        public static async Task SendServiceBus((string standard, List<string> tmdids, string school, List<string> update, int statistics)list, IConfiguration _configuration, AzureServiceBusFactory _serviceBus) {
-            var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
-            if (list.tmdids.IsNotEmpty() && list.update.IsNotEmpty()) {
-                TeacherTrainChange change = new TeacherTrainChange
+        public static async Task SendServiceBus((string standard, List<string> tmdids, string school, List<string> update, int statistics)list, IConfiguration _configuration, AzureServiceBusFactory _serviceBus, CosmosClient client) {
+            if (list.tmdids.IsNotEmpty() && list.update.IsNotEmpty())
+            {
+                string insql = $"where c.id in ({string.Join(",", list. tmdids.Select(x => $"'{x}'"))})";
+                string selsql = $"select value(c) from c {insql} ";
+                List<TeacherTrain> teacherTrains = new List<TeacherTrain>();
+                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: selsql,
+                      requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"TeacherTrain-{list.school}") }))
                 {
-                    standard = list.standard,
-                    tmdids = list.tmdids,
-                    school = list.school,
-                    update = new HashSet<string>(list.update),
-                    statistics = list.statistics
-                };
-                var messageChange = new ServiceBusMessage(change.ToJsonString());
-                messageChange.ApplicationProperties.Add("name", "TeacherTrainChange");
-                await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
+                    teacherTrains.Add(item);
+                }
+                List<Task<ItemResponse<TeacherTrain>>> task = new List<Task<ItemResponse<TeacherTrain>>>();
+                teacherTrains.ForEach(x => {
+                    x.update.UnionWith(list.update);
+                    task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<TeacherTrain>(x, x.id, new PartitionKey($"TeacherTrain-{list.school}")));
+                });
+                await task.TaskPage(5);
+                var unchange = list.tmdids.Except(teacherTrains.Select(x => x.id));
+                if (unchange != null)
+                {
+                    task.Clear();
+                    unchange.ToList().ForEach(x => {
+                        TeacherTrain teacherTrain = new TeacherTrain
+                        {
+                            pk = "TeacherTrain",
+                            id = x,
+                            code = $"TeacherTrain-{list.school}",
+                            tmdid = x,
+                            school = list.school,
+                            update = new HashSet<string> {  StatisticsService.TeacherAbility,
+                        StatisticsService.TeacherClass, StatisticsService.OfflineRecord }
+                        };
+                        teacherTrain.update.UnionWith(list.update);
+                        task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<TeacherTrain>(teacherTrain, new PartitionKey($"TeacherTrain-{list.school}")));
+                    });
+                    await task.TaskPage(1);
+                }
             }
+
+            //var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
+            //if (list.tmdids.IsNotEmpty() && list.update.IsNotEmpty())
+            //{
+            //    TeacherTrainChange change = new TeacherTrainChange
+            //    {
+            //        standard = list.standard,
+            //        tmdids = list.tmdids,
+            //        school = list.school,
+            //        update = new HashSet<string>(list.update),
+            //        statistics = list.statistics
+            //    };
+            //    var messageChange = new ServiceBusMessage(change.ToJsonString());
+            //    messageChange.ApplicationProperties.Add("name", "TeacherTrainChange");
+            //    await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
+            //}
         }
 
         public static async Task GetAreaAndAreaSetting(  string schoolId, string _standard, CosmosClient client, HttpContext httpContext)

+ 0 - 89
TEAMModelOS.SDK/Models/Service/Third/ScApisService.cs

@@ -42,93 +42,4 @@ namespace TEAMModelOS.SDK
             }
         }
     }
-    public class ScConfig
-    {
-        public string accessConfig { get; set; }
-        public string pxid { get; set; }
-    }
-    public class ScDiagnosis
-    {
-        public string diagnosisName { get; set; }
-        public string DiagnosisDicNum { get; set; }
-        public int ID { get; set; }
-    }
-    public class ScProject
-    {
-        public int ProjectID { get; set; }
-        public string ProjectTitle { get; set; }
-        public int ProjectItemID { get; set; }
-        public string ProjectItemTitle { get; set; }
-        public int TCount { get; set; }
-        public int IsQuota { get; set; }
-        public int IsDiagnosis { get; set; }
-        public int SchoolDiagnosisMinDimension { get; set; }
-        public int SchoolDiagnosisMinCount { get; set; }
-        public int TeacherDiagnosisMinDimension { get; set; }
-    }
-    public class ScTeacher
-    {
-        public int PXID { get; set; }
-        public int TID { get; set; }
-        public string TeacherName { get; set; }
-        public int SchoolID { get; set; }
-        public string SchoolName { get; set; }
-        public int ProjectID { get; set; }
-        public int ProjectItemID { get; set; }
-        public string ProjectTitle { get; set; }
-        public string ProjectItemTitle { get; set; }
-        public string CityID { get; set; }
-        public string DistrictID { get; set; }
-        public string CityName { get; set; }
-        public string DisName { get; set; }
-        public string Account { get; set; }
-    }
-    public class ScAccessConfig : AccessConfig
-    {
-        public string passKey { get; set; }
-        public string trainComID { get; set; }
-        public string privateKey { get; set; }
-        public string url { get; set; }
-        public List<ScsProject> p { get; set; }= new List<ScsProject>();
-    }
-
-    public class ScsProjectDiagnosis
-    {
-        public ScsProject project { get; set; }
-        public List<ScPDiagnosis> diagnoses { get; set; }
-    }
-    public class ScPDiagnosis
-    {
-        public string DiagnosisName { get; set; }
-        public string DiagnosisNum { get; set; }
-        public int DiagnosisID { get; set; }
-    }
-
-    public class ScsProject
-    {
-        /// <summary>
-        /// 项目id
-        /// </summary>
-        public string pd { get; set; }
-        /// <summary>
-        /// 子项目id
-        /// </summary>
-        public string pid { get; set; }
-        /// <summary>
-        /// 项目名称
-        /// </summary>
-        public string pt { get; set; }
-        /// <summary>
-        /// 子项目名称
-        /// </summary>
-        public string pit { get; set; }
-    }
-    public class ScsResult
-    {
-        public bool result { get; set; }
-        public string reason { get; set; }
-        public string content { get; set; }
-        public string code { get; set; }
-        public string title { get; set; }
-    }
 }

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

@@ -0,0 +1,231 @@
+using Microsoft.Azure.Cosmos.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.SDK.Models
+{
+    public class ScYxptModel
+    {
+       
+    }
+    public class ScConfig
+    {
+        public string accessConfig { get; set; }
+        public string pxid { get; set; }
+    }
+    public class ScDiagnosis
+    {
+        public string diagnosisName { get; set; }
+        public string DiagnosisDicNum { get; set; }
+        public int ID { get; set; }
+    }
+    public class ScProject
+    {
+        public int ProjectID { get; set; }
+        public string ProjectTitle { get; set; }
+        public int ProjectItemID { get; set; }
+        public string ProjectItemTitle { get; set; }
+        public int TCount { get; set; }
+        public int IsQuota { get; set; }
+        public int IsDiagnosis { get; set; }
+        public int SchoolDiagnosisMinDimension { get; set; }
+        public int SchoolDiagnosisMinCount { get; set; }
+        public int TeacherDiagnosisMinDimension { get; set; }
+    }
+    [TableName(Name = "ScYxpt")]
+    public class ScSchool : TableEntity
+    {
+        public int schoolid { get; set; }
+       
+        public string schoolname { get; set; }
+        public string schoolnickname { get; set; }
+
+        public int areaid { get; set; }
+        public string areaname { get; set; }
+        public int schoollenid { get; set; }
+        public int schooltypeid { get; set; }
+        public string schooltypename { get; set; }
+        public int proid { get; set; }
+        public int cityid { get; set; }
+        public int disid { get; set; }
+        public int statu { get; set; }
+        public string schoolCode { get; set; }
+        public string dist { get; set; }
+        public string city { get; set; }
+        public string areaId { get; set; }
+    }
+
+    [TableName(Name = "ScYxpt")]
+    public class ScTeacher: TableEntity
+    {
+        public int PXID { get; set; }
+        public int TID { get; set; }
+        public string TeacherName { get; set; }
+        public int SchoolID { get; set; }
+        public string SchoolName { get; set; }
+        public int ProjectID { get; set; }
+        public int ProjectItemID { get; set; }
+        public string ProjectTitle { get; set; }
+        public string ProjectItemTitle { get; set; }
+        public string CityID { get; set; }
+        public string DistrictID { get; set; }
+        public string CityName { get; set; }
+        public string DisName { get; set; }
+        public string Account { get; set; }
+        public string TeacherXK { get; set; }
+        public string TeacherXD { get; set; }
+        public string Mobile { get; set; }
+        public string Email { get; set; }
+        public string tmdid { get; set; }
+    }
+    public class ScAccessConfig : AccessConfig
+    {
+        public string passKey { get; set; }
+        public string trainComID { get; set; }
+        public string privateKey { get; set; }
+        public string url { get; set; }
+        public List<ScsProject> p { get; set; } = new List<ScsProject>();
+    }
+
+    public class ScsProjectDiagnosis
+    {
+        public ScsProject project { get; set; }
+        public List<ScPDiagnosis> diagnoses { get; set; }
+    }
+    public class ScPDiagnosis
+    {
+        public string DiagnosisName { get; set; }
+        public string DiagnosisNum { get; set; }
+        public int DiagnosisID { get; set; }
+    }
+
+    public class ScsProject
+    {
+        /// <summary>
+        /// 项目id
+        /// </summary>
+        public string pd { get; set; }
+        /// <summary>
+        /// 子项目id
+        /// </summary>
+        public string pid { get; set; }
+        /// <summary>
+        /// 项目名称
+        /// </summary>
+        public string pt { get; set; }
+        /// <summary>
+        /// 子项目名称
+        /// </summary>
+        public string pit { get; set; }
+    }
+    public class ScsResult
+    {
+        public bool result { get; set; }
+        public string reason { get; set; }
+        public string content { get; set; }
+        public string code { get; set; }
+        public string title { get; set; }
+    }
+    public class Unbind
+    {
+        public string userid { get; set; }
+        public string id { get; set; }
+        public string name { get; set; }
+        public List<ScBindData> data { get; set; }
+    }
+    public class ScBindData
+    {
+        /// <summary>
+        /// 学校名称
+        /// </summary>
+        public string type { get; set; } = "scsyxpt";
+        /// <summary>
+        /// 学校名称 SchoolName
+        /// </summary>
+        public string sn { get; set; }
+        /// <summary>
+        /// 学校id  SchoolID
+        /// </summary>
+        public string sid { get; set; }
+        /// <summary>
+        /// 项目id  ProjectID
+        /// </summary>
+        public string pd { get; set; }
+        /// <summary>
+        /// 子项目id  ProjectItemID
+        /// </summary>
+        public string pid { get; set; }
+
+        public string pxid { get; set; }
+        public string userid { get; set; }
+        public string username { get; set; }
+        public string account { get; set; }
+        public string path { get; set; }
+    }
+    public class PushFail
+    {
+        public string tmdid { get; set; }
+        public string name { get; set; }
+        public string picture { get; set; }
+        public List<KeyValuePair<string, string>> msgs { get; set; }
+    }
+    public class ScPush
+    {
+        public string tmdid { get; set; }
+        public string userid { get; set; }
+        public string pxid { get; set; }
+        public int tbase { get; set; } = -1;//基本信息推送状态 -1 未推送,0 推送失败,1推送成功
+        public int tability { get; set; } = -1;//能力点推送状态 -1 未推送,0 推送失败,1推送成功
+        public int tktsl { get; set; } = -1;//课堂实录推送状态 -1 未推送,0 推送失败,1推送成功
+        public int txbyx { get; set; } = -1;//校本研修推送状态 -1 未推送,0 推送失败,1推送成功
+        public string rbase { get; set; }//基本信息推送失败原因
+        public string rability { get; set; }//能力点推送失败原因
+        public string rktsl { get; set; }//课堂实录推送失败原因
+        public string rxbyx { get; set; } //校本研修推送失败原因
+    }
+    public class ScTchTmd
+    {
+        public string tmdid { get; set; }
+        public string name { get; set; }
+        public string userid { get; set; }
+        public string pxid { get; set; }
+        public string sid { get; set; }
+        public string pd { get; set; }
+        public string pid { get; set; }
+    }
+    public class ScSSO
+    {
+        public string Webid { get; set; }
+        public string Pxid { get; set; }
+        public string tid { get; set; }
+        public string time { get; set; }
+        public string Encrypt { get; set; }
+        // public string data { get; set; }
+    }
+    public class ScSSOData
+    {
+        public string path { get; set; }
+        public string Pxid { get; set; }
+        public string tid { get; set; }
+        public string time { get; set; }
+        public string Encrypt { get; set; }
+        public string data { get; set; }
+        public string username { get; set; }
+        public string account { get; set; }
+    }
+    public class SSO
+    {
+        public string type { get; set; }
+        public string param { get; set; }
+        public string id_token { get; set; }
+    }
+    public class TmdidImplicit
+    {
+        public string id_token { get; set; }
+        public string access_token { get; set; }
+        public string expires_in { get; set; }
+        public string token_type { get; set; }
+    }
+}

+ 1 - 1
TEAMModelOS.SDK/Models/Service/Third/ThirdApisService.cs

@@ -9,7 +9,7 @@ using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Extension;
-
+using TEAMModelOS.SDK.Models;
 namespace TEAMModelOS.SDK
 {
     public class ThirdApisService

+ 2 - 2
TEAMModelOS.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29418.71
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32014.148
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelOS.SDK", "TEAMModelOS.SDK\TEAMModelOS.SDK.csproj", "{E804B5FA-8D72-4ED4-AF9E-8AA48C17CE76}"
 EndProject

+ 1 - 1
TEAMModelOS/Controllers/Common/ExamLiteController.cs

@@ -142,7 +142,7 @@ namespace TEAMModelOS.Controllers.Common
                     await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(trExam, trExam.id, new PartitionKey($"{trExam.code}"));
                     if (!string.IsNullOrEmpty(standard) && !string.IsNullOrEmpty(school))
                     {
-                        await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string>() { StatisticsService.TeacherExamLite }, 0) , _configuration, _serviceBus);
+                        await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string>() { StatisticsService.TeacherExamLite }, 0) , _configuration, _serviceBus, client);
                     }
                 }
                 else

+ 2 - 2
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -668,7 +668,7 @@ namespace TEAMModelOS.Controllers.Learn
                                         {
                                            
                                         }
-                                        await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{one.id}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord },0)  , _configuration, _serviceBus);
+                                        await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{one.id}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord },0)  , _configuration, _serviceBus, client);
                                         
                                     }
                                 }
@@ -739,7 +739,7 @@ namespace TEAMModelOS.Controllers.Learn
                                 }
                                 if (content.Exists(x => x.prime == true))
                                 {
-                                    await StatisticsService.SendServiceBus(   ($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord }, 0 ), _configuration, _serviceBus);
+                                    await StatisticsService.SendServiceBus(   ($"{standard}", new List<string> { $"{userid}" }, $"{school}", new List<string>() { StatisticsService.OfflineRecord }, 0 ), _configuration, _serviceBus, client);
                                 }
                             }
                             return Ok(new { msgid, taskStatus });

+ 1 - 1
TEAMModelOS/Controllers/Common/StudyController.cs

@@ -553,7 +553,7 @@ namespace TEAMModelOS.Controllers.Common
                 }
                 list.tmdid = new List<string>(tch);
                 await tasky.TaskPage(10);
-                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                 return Ok(new { code = HttpStatusCode.OK });
             }
             catch (Exception ex)

+ 2 - 1
TEAMModelOS/Controllers/Research/AbilityStatisticsController.cs

@@ -434,8 +434,9 @@ namespace TEAMModelOS.Controllers
                         foreach (var up in update) {
                             teacherTrain.update.Add(up);
                         }
-                        
                     }
+                    ///强制教师个人信息统计的时候 都再去统计一次。
+                    teacherTrain.update.Add(StatisticsService.TeacherAbility);
                     if (teacherTrain.update.Count>0) {
                         await StatisticsService.StatisticsTeacher(teacherTrain, setting, area, client, null);
                     }

+ 12 - 6
TEAMModelOS/Controllers/Research/AbilitySubController.cs

@@ -111,7 +111,7 @@ namespace TEAMModelOS.Controllers
                     }
                 }
                 if (!HttpContext.Items.TryGetValue("Standard", out object standard)) return BadRequest();
-                await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}",new List<string> { StatisticsService.TeacherAbility }, 0), _configuration, _serviceBus);
+                await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}",new List<string> { StatisticsService.TeacherAbility }, 0), _configuration, _serviceBus, client);
                 return Ok(new { abilityIds });
             }
             catch (Exception ex)
@@ -402,7 +402,7 @@ namespace TEAMModelOS.Controllers
                     });
                     (string standard, List<string> tmdid, string school, List<string> update, int statistics) list = ($"{standard}", tmdids, school, new List<string> { StatisticsService.TeacherAbility },0);
                     await  abilitySubTasks.TaskPage(10);
-                    await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                    await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                     return Ok(new { status = 200 });
                 }
             }
@@ -494,7 +494,7 @@ namespace TEAMModelOS.Controllers
                             abilitySub.exerciseScore = int.Parse($"{_exercise}");
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
                             status = 1;
-                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{_school}",new List<string> { StatisticsService.TeacherAbility }, 0) , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{_school}",new List<string> { StatisticsService.TeacherAbility }, 0) , _configuration, _serviceBus, client);
                             return Ok(new { status });
                         }
                         else
@@ -542,7 +542,7 @@ namespace TEAMModelOS.Controllers
                             abilitySub.selfTime = now;
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
                             status = 1;
-                            await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility }, 0)  , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility }, 0)  , _configuration, _serviceBus, client);
                         }
                         else
                         {
@@ -724,7 +724,7 @@ namespace TEAMModelOS.Controllers
                                 }
                             }
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<AbilitySub>(abilitySub, $"{_abilityId}", new PartitionKey(code));
-                            await StatisticsService.SendServiceBus(  ($"{standard}",new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility }, 0) , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus(  ($"{standard}",new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility }, 0) , _configuration, _serviceBus, client);
                             status = 1;
                         }
                         return Ok(new { status, abilitySub });
@@ -813,6 +813,12 @@ namespace TEAMModelOS.Controllers
                         {
                            fileRcds = _fileRcd.ToObject<List<TeacherFileRcd>>();
                         }
+
+                        fileRcds.ForEach(x => {
+                            if (x.done && x.type.Equals("video")) {
+                                x.view = (int)x.duration;
+                            }
+                        });
                         TeacherFile teacherFile = null;
                         try
                         {
@@ -880,7 +886,7 @@ namespace TEAMModelOS.Controllers
                             await client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<TeacherFile>(teacherFile, new PartitionKey($"TeacherFile-{_school}"));
                         }
                         if (fileRcds.Exists(x => x.type.Equals("video"))) {
-                            await StatisticsService.SendServiceBus( ($"{standard}",new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility },0) , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus( ($"{standard}",new List<string> { $"{_tmdid}" }, $"{_school}", new List<string> { StatisticsService.TeacherAbility },0) , _configuration, _serviceBus, client);
                         }
                         //获取视文件学习记录
                         List<dynamic> _files = new List<dynamic>();

+ 1 - 1
TEAMModelOS/Controllers/Research/AppraiseController.cs

@@ -130,7 +130,7 @@ namespace TEAMModelOS.Controllers.Research
                         else {
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Appraise>(appraise, appraise.id, new PartitionKey(code));
                         }
-                        await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0) , _configuration, _serviceBus);
+                        await StatisticsService.SendServiceBus(  ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0) , _configuration, _serviceBus, client);
                         return Ok(new { dimensions, score });
                     case bool when $"{_opt}".Equals("Comment", StringComparison.OrdinalIgnoreCase):
                         if (!request.TryGetProperty("comment", out JsonElement _comment)) return BadRequest();

+ 4 - 4
TEAMModelOS/Controllers/Research/ClassVideoController.cs

@@ -233,7 +233,7 @@ namespace TEAMModelOS.Controllers.Research
                      
                 });
                 await  teacherTrains.TaskPage(10);
-                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus);
+                await StatisticsService.SendServiceBus(list, _configuration, _serviceBus, client);
                 return Ok(new { status = 200 });
             }
             else
@@ -281,7 +281,7 @@ namespace TEAMModelOS.Controllers.Research
                             var fid= videoRd.files.Find(x => x.id.Equals($"{_videoId}"));
                             fid.score = int.Parse($"{_score}");
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ClassVideo>(videoRd,videoRd.id, new PartitionKey(code));
-                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}",new List<string> { StatisticsService.TeacherClass }, 0) , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}",new List<string> { StatisticsService.TeacherClass }, 0) , _configuration, _serviceBus, client);
                             return Ok(new { status = 1 });
                         }
                         catch (CosmosException ex)
@@ -331,7 +331,7 @@ namespace TEAMModelOS.Controllers.Research
                                     await client.GetContainer("TEAMModelOS", "Teacher").CreateItemAsync<ClassVideo>(classVideo, new PartitionKey(code));
                                 }
                             }
-                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0)  , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0)  , _configuration, _serviceBus, client);
                             return Ok(new { classVideo });
                         }
                         else {
@@ -354,7 +354,7 @@ namespace TEAMModelOS.Controllers.Research
                                 });
                             }
                             await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ClassVideo>(delvideo, $"{_tmdid}", new PartitionKey(code));
-                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0)  , _configuration, _serviceBus);
+                            await StatisticsService.SendServiceBus( ($"{standard}", new List<string> { $"{_tmdid}" }, $"{school}", new List<string> { StatisticsService.TeacherClass }, 0)  , _configuration, _serviceBus, client);
                             //TODO同时删除话题和点评记录
                             return Ok(new { classVideo = delvideo });
                         }

+ 679 - 0
TEAMModelOS/Controllers/Third/ScApiController.cs

@@ -0,0 +1,679 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.Models;
+using TEAMModelOS.SDK.DI;
+using System.Text.Json;
+using TEAMModelOS.SDK.Models;
+using Microsoft.AspNetCore.Http;
+using TEAMModelOS.SDK.Extension;
+using Azure.Cosmos;
+using System.Text;
+using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
+using Microsoft.Extensions.Options;
+using Azure.Messaging.ServiceBus;
+using Microsoft.Extensions.Configuration;
+using TEAMModelOS.Services.Common;
+using HTEXLib.COMM.Helpers;
+using TEAMModelOS.SDK;
+using System.IdentityModel.Tokens.Jwt;
+using TEAMModelOS.Services;
+using TEAMModelOS.SDK.Models.Service;
+using System.IO;
+using System.Dynamic;
+using Microsoft.AspNetCore.Authorization;
+using Azure.Storage.Blobs.Models;
+using static TEAMModelOS.SDK.Models.Teacher;
+using System.Web;
+using static TEAMModelOS.Controllers.FixDataController;
+
+namespace TEAMModelOS.Controllers
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    ///  
+    [ProducesResponseType(StatusCodes.Status200OK)]
+    [ProducesResponseType(StatusCodes.Status400BadRequest)]
+    //[Authorize(Roles = "IES5")]
+    //[Route("")]
+    //[Route("api/[controller]")]
+    [ApiController]
+    public class ScApiController : ControllerBase
+    {
+       
+    
+        private readonly SnowflakeId _snowflakeId;
+        private readonly AzureCosmosFactory _azureCosmos;
+        private readonly DingDing _dingDing;
+        private readonly Option _option;
+        private readonly AzureStorageFactory _azureStorage;
+        private readonly AzureServiceBusFactory _serviceBus;
+        private readonly AzureRedisFactory _azureRedis;
+        private readonly CoreAPIHttpService _accountHttpService;
+        private readonly ThirdApisService _scsApisService;
+        public readonly string type = "scsyxpt";
+        private readonly HttpTrigger _httpTrigger;
+        /// <summary>
+        /// 机构安全码
+        /// </summary>
+        public string _sc_passKey;
+        /// <summary>
+        /// 机构ID
+        /// </summary>
+        public string _sc_trainComID;
+        /// <summary>
+        /// 机构 AES 密钥
+        /// </summary>
+        public string _sc_privateKey;
+        /// <summary>
+        /// 访问地址
+        /// </summary>
+        public string _sc_url;
+        public IConfiguration _configuration { get; set; }
+        public ScApiController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+         AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService accountHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+        {
+            _azureCosmos = azureCosmos;
+            _snowflakeId = snowflakeId;
+            _dingDing = dingDing;
+            _option = option?.Value;
+            _azureStorage = azureStorage;
+            _serviceBus = serviceBus;
+            _configuration = configuration;
+            _azureRedis = azureRedis;
+            _accountHttpService = accountHttpService;
+            _scsApisService = scsApisService;
+            _sc_passKey = _configuration.GetValue<string>("Third:scsyxpt:passKey");
+            _sc_trainComID = _configuration.GetValue<string>("Third:scsyxpt:trainComID");
+            _sc_privateKey = _configuration.GetValue<string>("Third:scsyxpt:privateKey");
+            _sc_url = _configuration.GetValue<string>("Third:scsyxpt:url");
+            _httpTrigger = httpTrigger;
+        }
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("sc/get-list")]
+        [AllowAnonymous]
+        public async Task<IActionResult> GetProjectList(List<Unbind> unbinds)
+        {
+
+
+            // 5.3.1.1获取项目列表 
+            string trainComID = _sc_trainComID;
+            string Code = "GetProjectInfoByTrainComID";
+            Dictionary<string, object> parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", _sc_trainComID);
+            ScsResult GetProjectInfoByTrainComID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetProjectInfoByTrainComID.code = Code;
+            GetProjectInfoByTrainComID.title = "5.3.1.1获取项目列表";
+
+
+
+            // 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
+            Code = "GetSchoolList";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "60");
+            parameterMap.Add("ProjectItemID", "1068");
+            ScsResult GetSchoolList1 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetSchoolList1.code = Code;
+            GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
+
+            // 5.3.1.19获取项目设置的可选能力点,
+            Code = "GetProjectDiagnosis";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "60");
+            parameterMap.Add("ProjectItemID", "1068");
+            ScsResult GetProjectDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetProjectDiagnosis.code = Code;
+            GetProjectDiagnosis.title = "5.3.1.19获取项目设置的可选能力点";
+            // 补充
+            //  5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
+            Code = "GetDiagnosisListByProject_V2";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            //parameterMap.Add("ProjectID", "22");
+            //parameterMap.Add("ProjectItemID", "22");
+            parameterMap.Add("PXID", "242849");
+            ScsResult GetDiagnosisListByProject_V2 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetDiagnosisListByProject_V2.code = Code;
+            GetDiagnosisListByProject_V2.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
+
+
+            // 5.3.1.2获取学员名单,暂不对接 V1。
+            Code = "GetTeachersListByProject";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "60");
+            parameterMap.Add("ProjectItemID", "1068");
+            ScsResult GetTeachersListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetTeachersListByProject.code = Code;
+            GetTeachersListByProject.title = "5.3.1.2获取学员名单";
+
+            return Ok(new { GetTeachersListByProject, GetDiagnosisListByProject_V2 = GetDiagnosisListByProject_V2, GetProjectInfoByTrainComID = GetProjectInfoByTrainComID, GetSchoolList = GetSchoolList1 });
+
+
+
+
+            // 5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
+            Code = "GetDiagnosisListByProject";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "22");
+            parameterMap.Add("ProjectItemID", "24");
+            parameterMap.Add("PXID", "65321");
+            ScsResult GetDiagnosisListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetDiagnosisListByProject.code = Code;
+            GetDiagnosisListByProject.title = "5.3.1.3通过项目编号获取学员测评能力项";
+
+
+            // 补充
+            //  5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
+            Code = "GetDiagnosisListByProject_V2";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            //parameterMap.Add("ProjectID", "22");
+            //parameterMap.Add("ProjectItemID", "22");
+            parameterMap.Add("PXID", "244188");
+            ScsResult GetDiagnosisListByProject_V2T = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetDiagnosisListByProject_V2T.code = Code;
+            GetDiagnosisListByProject_V2T.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
+
+            ScsResult UpdateTeacherSituation = null;
+            // 5.3.1.4学员培训基本情况回写
+            try
+            {
+                Code = "UpdateTeacherSituation";
+                parameterMap = new Dictionary<string, object>();
+                parameterMap.Add("TrainComID", trainComID);
+                parameterMap.Add("PXID", "65324");
+                parameterMap.Add("TID", "253940");
+                parameterMap.Add("TeacherName", "宋鸿");
+                parameterMap.Add("CourseHour", "50");
+                parameterMap.Add("ResearchText", "");//学习成果描述,字符长度<=300
+                parameterMap.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                UpdateTeacherSituation = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+                UpdateTeacherSituation.code = Code;
+                UpdateTeacherSituation.title = "5.3.1.4学员培训基本情况回写";
+            }
+            catch (Exception ex) { }
+            ScsResult UpdateTeacherDiagnosis = null;
+            try
+            {
+                // 5.3.1.5学员能力点测评结果回写
+                Code = "UpdateTeacherDiagnosis";
+                parameterMap = new Dictionary<string, object>();
+                parameterMap.Add("TrainComID", trainComID);
+                parameterMap.Add("PXID", "65321");
+                parameterMap.Add("TID", "32393");
+                parameterMap.Add("DiagnosisNum", "A1");
+                //0"未认定", 1"合格", 2"优秀", 3"不合格"
+                parameterMap.Add("zpresult", "1");
+                parameterMap.Add("hpresult", "1");
+                parameterMap.Add("xzpresult", "1");
+                List<Dictionary<string, string>> pfilesA = new List<Dictionary<string, string>>();
+                parameterMap.Add("pfiles", pfilesA);
+                Dictionary<string, string> pfileMapA = new Dictionary<string, string>();
+                pfileMapA.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                pfileMapA.Add("fileName", "XXX.pdf");
+                pfileMapA.Add("fileSize", "247767");
+                pfileMapA.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                pfileMapA.Add("fileType", "pdf");
+                pfilesA.Add(pfileMapA);
+                UpdateTeacherDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+                UpdateTeacherDiagnosis.code = Code;
+                UpdateTeacherDiagnosis.title = "5.3.1.5学员能力点测评结果回写";
+            }
+            catch (Exception ex)
+            {
+            }
+
+
+            // 5.3.1.6获取能力测评体系字典值数据
+            Code = "GetDiagnosisDic";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            ScsResult GetDiagnosisDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetDiagnosisDic.code = Code;
+            GetDiagnosisDic.title = "5.3.1.6获取能力测评体系字典值数据";
+
+
+            // 5.3.1.7获取能力测评评价类型字典值数据 ,不用对接
+            Code = "GetDiagnosisItemDic";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("DiagnosisDicID", "3");
+            ScsResult GetDiagnosisItemDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetDiagnosisItemDic.code = Code;
+            GetDiagnosisItemDic.title = "5.3.1.7获取能力测评评价类型字典值数据";
+
+
+            // 5.3.1.8获取能力测评评价类型细则字典值数据,不用对接。
+            Code = "GetchoiceDic";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("DiagnosisItemID", "4");
+            ScsResult GetchoiceDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetchoiceDic.code = Code;
+            GetchoiceDic.title = "5.3.1.8获取能力测评评价类型细则字典值数据";
+
+
+            // 5.3.1.9根据培训ID与机构ID获取老师信息
+            Code = "GetTeacherInfoByPXID";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("PXID", "65321");
+            ScsResult GetTeacherInfoByPXID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetTeacherInfoByPXID.code = Code;
+            GetTeacherInfoByPXID.title = "5.3.1.9根据培训ID与机构ID获取老师信息";
+
+
+            // 5.3.1.10根据培训项目ID与学校ID获取学校方案,用于展示学校的id方案。顺便确认学校的名单。
+            Code = "GetSchoolPlanBySchoolID";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectItemID", "3");
+            parameterMap.Add("SchoolID", "220913");
+            parameterMap.Add("Type", "0");
+            ScsResult GetSchoolPlanBySchoolID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetSchoolPlanBySchoolID.code = Code;
+            GetSchoolPlanBySchoolID.title = "5.3.1.10根据培训项目ID与学校ID获取学校方案";
+
+
+            // 5.3.1.11获取跳转学员信息。用于sso单点,后端验证
+            Code = "GetSingleTeacherByProject";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("Pxid", "65321");
+            parameterMap.Add("Tid", "32393");
+            ScsResult GetSingleTeacherByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetSingleTeacherByProject.code = Code;
+            GetSingleTeacherByProject.title = "5.3.1.11获取跳转学员信息";
+
+            ScsResult UpdateTeacherListSituation = null;
+            Dictionary<string, object> parameterContent = new Dictionary<string, object>();
+            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
+            try
+            { // 5.3.1.12学员培训基本情况批量回写
+                Code = "UpdateTeacherListSituation";
+
+
+                parameterContent.Add("TrainComID", trainComID);
+                parameterContent.Add("List", list);
+                // {"TrainComID":"39","List":[{"ResearchText":"","ComPassed":1,"PXID":"35455","CourseHour":"50.0","TID":"411105","TeacherName":"付绍令"}]}
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+
+                    parameterMapData.Add("PXID", "65324");
+                    parameterMapData.Add("TID", "253940");
+                    parameterMapData.Add("TeacherName", "柏成伟");
+                    parameterMapData.Add("CourseHour", "50");
+                    parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
+                    parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                    list.Add(parameterMapData);
+                    parameterMapData = new Dictionary<string, object>();
+
+                    parameterMapData.Add("PXID", "65324");
+                    parameterMapData.Add("TID", "253940");
+                    parameterMapData.Add("TeacherName", "柏成伟");
+                    parameterMapData.Add("CourseHour", "50");
+                    parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
+                    parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                    list.Add(parameterMapData);
+                    parameterMapData = new Dictionary<string, object>();
+
+                    //parameterMapData.Add("PXID", "22");
+                    //parameterMapData.Add("TID", "21348");
+                    //parameterMapData.Add("TeacherName", "邓泽燕");
+                    //parameterMapData.Add("CourseHour", "50");
+                    //parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
+                    //parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                    //list.Add(parameterMapData);
+                    //parameterMapData = new Dictionary<string, object>();
+                    //parameterMapData.Add("PXID", "35546");
+                    //parameterMapData.Add("TID", "411182");
+                    //parameterMapData.Add("TeacherName", "刘晓莉");
+                    //parameterMapData.Add("CourseHour", "50");
+                    //parameterMapData.Add("ResearchText", "");
+                    //parameterMapData.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
+                    //list.Add(parameterMapData);
+                }
+                UpdateTeacherListSituation = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
+                UpdateTeacherListSituation.code = Code;
+                UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
+            }
+            catch (Exception ex) { }
+
+            ScsResult UpdateTeacherListDiagnosis = null;
+            try
+            { // 5.3.1.13学员能力点测评结果批量回写
+                Code = "UpdateTeacherListDiagnosis";
+                parameterContent = new Dictionary<string, object>();
+                list = new List<Dictionary<string, object>>();
+                parameterContent.Add("TrainComID", trainComID);
+                parameterContent.Add("List", list);
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+
+                    parameterMapData.Add("PXID", "65321");
+                    parameterMapData.Add("TID", "32393");
+                    parameterMapData.Add("DiagnosisNum", "A1");
+                    //0"未认定", 1"合格", 2"优秀", 3"不合格"
+                    parameterMapData.Add("zpresult", "1");
+                    parameterMapData.Add("hpresult", "2");
+                    parameterMapData.Add("xzpresult", "2");
+                    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://srt-read-online.3ren.cn/basebusiness/material/20210422/1619055398463iE97VWe36i001.mp4");
+                    pfileMap.Add("fileName", "697a58c2375f7a031456c893e1e1860c.mp4");
+                    pfileMap.Add("fileSize", "17036168");
+                    pfileMap.Add("md5", "");
+                    pfileMap.Add("fileType", "video");
+                    pfiles.Add(pfileMap);
+
+                    list.Add(parameterMapData);
+
+                    pfileMap = new Dictionary<string, object>();
+                    pfileMap.Add("url", "https://srt-read-online.3ren.cn/basebusiness/material/20210422/1619055446704gbKuNF8eas001.pdf");
+                    pfileMap.Add("fileName", "A6技术支持的课堂反思.pdf");
+                    pfileMap.Add("fileSize", "32192");
+                    pfileMap.Add("md5", "");
+                    pfileMap.Add("fileType", "pdf");
+                    pfiles.Add(pfileMap);
+
+                    list.Add(parameterMapData);
+                }
+
+                //{
+                //    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+
+                //    parameterMapData.Add("PXID", "3062");
+                //    parameterMapData.Add("TID", "401268");
+                //    parameterMapData.Add("DiagnosisNum", "A1");
+                //    //0"未认定", 1"合格", 2"优秀", 3"不合格"
+                //    parameterMapData.Add("zpresult", "1");
+                //    parameterMapData.Add("hpresult", "2");
+                //    parameterMapData.Add("xzpresult", "2");
+                //    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://srt-read-online.3ren.cn/basebusiness/material/20210422/1619058650000bphKFbDVSa001.pdf");
+                //    pfileMap.Add("fileName", "学情分析.pdf");
+                //    pfileMap.Add("fileSize", "94926");
+                //    pfileMap.Add("md5", "");
+                //    pfileMap.Add("fileType", "pdf");
+                //    pfiles.Add(pfileMap);
+
+                //    list.Add(parameterMapData);
+
+                //    pfileMap = new Dictionary<string, object>();
+                //    pfileMap.Add("url", "https://srt-read-online.3ren.cn/basebusiness/material/20210422/1619058698452gF19jmiuML001.mp4");
+                //    pfileMap.Add("fileName", "种子萌发学情分析.mp4");
+                //    pfileMap.Add("fileSize", "12692368");
+                //    pfileMap.Add("md5", "");
+                //    pfileMap.Add("fileType", "video");
+                //    pfiles.Add(pfileMap);
+                //    list.Add(parameterMapData);
+                //}
+                UpdateTeacherListDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
+                UpdateTeacherListDiagnosis.code = Code;
+                UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
+            }
+            catch (Exception ex)
+            {
+            }
+
+
+            ScsResult UploadSBTARPDF = null;
+            try
+            {   // 5.3.1.14学员校本研修PDF回写
+                Code = "UploadSBTARPDF";
+                parameterMap = new Dictionary<string, object>();
+                parameterMap.Add("TrainComID", trainComID);
+                parameterMap.Add("PXID", "16");
+                parameterMap.Add("TID", "16");
+
+                parameterMap.Add("url", "http://image1.cersp.com.cn/scpx/images/article/file/20190318/upload__51f98fc8_1697695ae73__7ffe_00001297.pdf");
+                parameterMap.Add("fileName", "XXX.pdf");
+                parameterMap.Add("fileSize", "247767");
+                parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                parameterMap.Add("fileType", "pdf");
+                UploadSBTARPDF = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+                UploadSBTARPDF.code = Code;
+                UploadSBTARPDF.title = "5.3.1.14学员校本研修PDF回写";
+            }
+            catch (Exception ex)
+            {
+            }
+
+            ScsResult UploadSBTARPDFList = null;
+            try
+            { // 5.3.1.15学员校本教研PDF批量回写
+                Code = "UploadSBTARPDFList";
+                parameterContent = new Dictionary<string, object>();
+                list = new List<Dictionary<string, object>>();
+                parameterContent.Add("TrainComID", trainComID);
+                parameterContent.Add("List", list);
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                    parameterMapData.Add("PXID", "65309");
+                    parameterMapData.Add("TID", "253940");
+                    parameterMapData.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                    parameterMapData.Add("fileName", "XXX.pdf");
+                    parameterMapData.Add("fileSize", "247767");
+                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                    parameterMapData.Add("fileType", "pdf");
+                    list.Add(parameterMapData);
+                }
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                    parameterMapData.Add("PXID", "65306");
+                    parameterMapData.Add("TID", "32393");
+                    parameterMapData.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
+                    parameterMapData.Add("fileName", "XXX.pdf");
+                    parameterMapData.Add("fileSize", "247767");
+                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                    parameterMapData.Add("fileType", "pdf");
+                    list.Add(parameterMapData);
+                }
+                UploadSBTARPDFList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
+                UploadSBTARPDFList.code = Code;
+                UploadSBTARPDFList.title = "5.3.1.15学员校本教研PDF批量回写";
+            }
+            catch (Exception ex) { }
+            ScsResult UploadKTSL = null;
+            try
+            {
+                // 5.3.1.16学员课堂实录回写
+                Code = "UploadKTSL";
+                parameterMap = new Dictionary<string, object>();
+                parameterMap.Add("TrainComID", trainComID);
+                parameterMap.Add("PXID", "16");
+                parameterMap.Add("TID", "16");
+                parameterMap.Add("url", "https://xxx.mp4");
+                parameterMap.Add("url2", "https://xxx.mp4");
+                parameterMap.Add("fileName", "XXX.mp4");
+                parameterMap.Add("fileSize", "247767");
+                parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                parameterMap.Add("fileType", "mp4");
+                UploadKTSL = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+                UploadKTSL.code = Code;
+                UploadKTSL.title = "5.3.1.16学员课堂实录回写";
+            }
+            catch (Exception ex) { }
+            ScsResult UploadKTSLList = null;
+            try
+            {
+                //  5.3.1.17学员课堂实录批量回写
+                Code = "UploadKTSLList";
+                parameterContent = new Dictionary<string, object>();
+                list = new List<Dictionary<string, object>>();
+                parameterContent.Add("TrainComID", trainComID);
+                parameterContent.Add("List", list);
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                    parameterMapData.Add("PXID", "16");
+                    parameterMapData.Add("TID", "16");
+                    parameterMapData.Add("url", "https://xxx.mp4");
+                    parameterMapData.Add("url2", "https://xxx.mp4");
+                    parameterMapData.Add("fileName", "XXX.mp4");
+                    parameterMapData.Add("fileSize", "247767");
+                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                    parameterMapData.Add("fileType", "mp4");
+                    list.Add(parameterMapData);
+                }
+                {
+                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
+                    parameterMapData.Add("PXID", "16");
+                    parameterMapData.Add("TID", "16");
+                    parameterMapData.Add("url", "https://xxx.mp4");
+                    parameterMapData.Add("url2", "https://xxx.mp4");
+                    parameterMapData.Add("fileName", "XXX.mp4");
+                    parameterMapData.Add("fileSize", "247767");
+                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
+                    parameterMapData.Add("fileType", "mp4");
+                    list.Add(parameterMapData);
+                }
+                UploadKTSLList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
+                UploadKTSLList.code = Code;
+                UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
+
+            }
+            catch (Exception ex) { }
+
+            // 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
+            Code = "GetSchoolList";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "22");
+            parameterMap.Add("ProjectItemID", "24");
+            ScsResult GetSchoolList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetSchoolList.code = Code;
+            GetSchoolList.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
+
+
+
+
+
+
+            // 5.3.1.20获取学校设置的可选能力点,
+            Code = "GetSchoolDiagnosis";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "22");
+            parameterMap.Add("ProjectItemID", "21");
+            parameterMap.Add("SchoolID", "200001");
+            ScsResult GetSchoolDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetSchoolDiagnosis.code = Code;
+            GetSchoolDiagnosis.title = "5.3.1.20获取学校设置的可选能力点";
+
+            // 5.3.1.21分页获取学员名单
+            Code = "GetTeachersPageListByProject";
+            parameterMap = new Dictionary<string, object>();
+            parameterMap.Add("TrainComID", trainComID);
+            parameterMap.Add("ProjectID", "22");
+            parameterMap.Add("ProjectItemID", "24");
+            parameterMap.Add("curPage", "1");
+            parameterMap.Add("pageSize", "10");
+            ScsResult GetTeachersPageListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
+            GetTeachersPageListByProject.code = Code;
+            GetTeachersPageListByProject.title = "5.3.1.21分页获取学员名单";
+
+            // 5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写
+            Code = "UploadSBTARPDFListV2";
+            parameterContent = new Dictionary<string, object>();
+            parameterContent.Add("TrainComID", trainComID);
+            list = new List<Dictionary<string, object>>();
+            parameterContent.Add("List", list);
+            {
+                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.Add(parameterMapData);
+            }
+
+            {
+                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.Add(parameterMapData);
+            }
+            ScsResult UploadSBTARPDFListV2 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
+            UploadSBTARPDFListV2.code = Code;
+            UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
+
+
+            return Ok(new
+            {
+                GetProjectInfoByTrainComID,
+                GetTeachersListByProject,
+                GetDiagnosisListByProject,
+                GetDiagnosisListByProject_V2,
+                UpdateTeacherSituation,
+                UpdateTeacherDiagnosis,
+                GetDiagnosisDic,
+                GetDiagnosisItemDic,
+                GetchoiceDic,
+                GetTeacherInfoByPXID,
+                GetSchoolPlanBySchoolID,
+                GetSingleTeacherByProject,
+                UpdateTeacherListSituation,
+                UpdateTeacherListDiagnosis,
+                UploadSBTARPDF,
+                UploadSBTARPDFList,
+                UploadKTSL,
+                UploadKTSLList,
+                GetSchoolList,
+                GetProjectDiagnosis,
+                GetSchoolDiagnosis,
+                GetTeachersPageListByProject,
+                UploadSBTARPDFListV2
+            });
+
+            //return Ok(GetProjectInfoByTrainComID);
+        }
+
+    }
+}

+ 240 - 647
TEAMModelOS/Controllers/Third/ScController.cs

@@ -28,6 +28,8 @@ using Azure.Storage.Blobs.Models;
 using static TEAMModelOS.SDK.Models.Teacher;
 using System.Web;
 using static TEAMModelOS.Controllers.FixDataController;
+using static TEAMModelOS.SDK.SchoolService;
+using Microsoft.AspNetCore.Hosting;
 
 namespace TEAMModelOS.Controllers.Third
 {
@@ -55,6 +57,7 @@ namespace TEAMModelOS.Controllers.Third
         private readonly ThirdApisService _scsApisService;
         public readonly string type = "scsyxpt";
         private readonly HttpTrigger _httpTrigger;
+       private readonly IWebHostEnvironment _environment;
         /// <summary>
         /// 机构安全码
         /// </summary>
@@ -72,7 +75,7 @@ namespace TEAMModelOS.Controllers.Third
         /// </summary>
         public string _sc_url;
         public IConfiguration _configuration { get; set; }
-        public ScController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+        public ScController(IWebHostEnvironment environment,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
           AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService accountHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
         {
             _azureCosmos = azureCosmos;
@@ -90,6 +93,241 @@ namespace TEAMModelOS.Controllers.Third
             _sc_privateKey = _configuration.GetValue<string>("Third:scsyxpt:privateKey");
             _sc_url = _configuration.GetValue<string>("Third:scsyxpt:url");
             _httpTrigger = httpTrigger;
+            _environment = environment;
+        }
+
+
+
+        /// <summary>
+        /// 检查醍摩豆id存在多个学校的情况
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("sc/get-project-school-teacher")]
+        [AllowAnonymous]
+        public async Task<IActionResult> GetProjectSchoolTeacher(JsonElement request) {
+            if (!request.TryGetProperty("accessConfig", out JsonElement accessConfig)) return BadRequest();
+            if (!request.TryGetProperty("ignoreSchools", out JsonElement ignoreSchools)) return BadRequest();
+            if (!request.TryGetProperty("city", out JsonElement city)) return BadRequest();
+            if (!request.TryGetProperty("dist", out JsonElement dist)) return BadRequest();
+            if (!request.TryGetProperty("areaId", out JsonElement areaId)) return BadRequest();
+            if (!request.TryGetProperty("standard", out JsonElement standard)) return BadRequest();
+            List<IdNameCode> ignore = ignoreSchools.ToObject<List<IdNameCode>>();
+            Dictionary<string, object> dict = new Dictionary<string, object> { { "accessConfig", $"{accessConfig}" } };
+            int status = -1;string json = null;
+            //5.3.1.1获取项目列表
+            (status,   json) = await _httpTrigger.RequestHttpTrigger(dict, _option.Location, "GetProjectInfoByTrainComID");
+            List<ScProject> projects = null;
+            List<ScSchool> saveschools = null;
+            List<ScSchool> schools = null;
+            List<ScSchool> matchSchools = null;
+            List<ScSchool> tbschools=null;
+            if (status == 200)
+            {
+                 projects = json.ToObject<List<ScProject>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
+            }
+            // 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
+            (status, json) = await _httpTrigger.RequestHttpTrigger(dict, _option.Location, "GetSchoolList");
+            if (status == 200)
+            {
+                schools = json.ToObject<List<ScSchool>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
+                if (ignore.IsNotEmpty())
+                {
+                    matchSchools = schools.FindAll(x => ignore.Select(y=>y.name).Contains(x.schoolname));
+                    if (matchSchools.IsNotEmpty())
+                    {
+                        if (matchSchools.Count != ignore.Count)
+                        {
+                            var matched = matchSchools.Select(x => x.schoolname);
+                            var unmatch = ignore.Select(y => y.name).Except(matched);
+                            return Ok(new { matched, unmatch });
+                        }
+                        else {
+                            matchSchools.ForEach(x => {
+                               var exschool= ignore.Find(y => y.name.Equals(x.schoolname));
+                                if (exschool != null) {
+                                    x.schoolCode = exschool.id;
+                                    x.areaId = $"{areaId}";
+                                    x.city = $"{city}";
+                                    x.dist = $"{dist}";
+                                }
+                            });
+                        }
+                    }
+                    else {
+                        return Ok(new { unmatch=ignore, schools }) ;
+                    }
+                }
+                //数据校验
+               tbschools = await _azureStorage.FindListByDict<ScSchool>(new Dictionary<string, object>() {  { "PartitionKey", $"ScSchool" } });
+                if (tbschools.IsNotEmpty())
+                {
+                  
+                    var a = tbschools.Select(y => $"{y.RowKey}").ToList();
+                    saveschools = schools.Where(x=>!a.Exists(z=>z.Equals($"{x.schoolid}"))).ToList();
+                    List<SchoolData> schoolDatas = new List<SchoolData>();
+                    saveschools.ForEach(x =>
+                    {
+                        x.RowKey = $"{x.schoolid}";
+                        x.PartitionKey = "ScSchool";
+                        x.areaId = $"{areaId}";
+                        x.city = $"{city}";
+                        x.dist = $"{dist}";
+                        if (string.IsNullOrEmpty(x.schoolCode))
+                        {
+                            schoolDatas.Add(new SchoolData { uid = $"{x.schoolid}", province = "四川省", city = $"{city}", name = x.schoolname });
+                        }
+                    });
+
+                    schoolDatas = await SchoolService.GenerateSchoolCode(schoolDatas, _dingDing, _environment);
+                    saveschools.ForEach(x => {
+
+                        var schoolData = schoolDatas.Find(y => y.uid.Equals($"{x.schoolid}"));
+                        if (schoolData != null && !string.IsNullOrEmpty(schoolData.id))
+                        {
+                            x.schoolCode = schoolData.id;
+                            x.areaId = $"{areaId}";
+                            x.city = $"{city}";
+                            x.dist = $"{dist}";
+                        }
+                    });
+                    saveschools.RemoveAll(x => string.IsNullOrEmpty(x.schoolCode));
+                    saveschools.RemoveAll(x => tbschools.FindAll(z=>!string.IsNullOrEmpty(z.schoolCode)).Exists(y=>y.schoolCode.Equals(x.schoolCode)));
+                    saveschools = await _azureStorage.SaveAll(saveschools);
+                }
+                else {
+                    List<SchoolData> schoolDatas = new List<SchoolData>();
+                    schools.ForEach(x =>
+                    {
+                        x.RowKey = $"{x.schoolid}";
+                        x.PartitionKey = "ScSchool";
+                        x.areaId = $"{areaId}";
+                        x.city = $"{city}";
+                        x.dist = $"{dist}";
+                        if (string.IsNullOrEmpty(x.schoolCode))
+                        {
+                            schoolDatas.Add(new SchoolData { uid = $"{x.schoolid}", province = "四川省", city = $"{city}", name = x.schoolname });
+                        }
+                        
+                    });
+                    schoolDatas   = await SchoolService.GenerateSchoolCode(schoolDatas, _dingDing, _environment);
+                    schools.ForEach(x => {
+                       
+                        var schoolData =  schoolDatas.Find(y => y.uid.Equals($"{x.schoolid}"));
+                        if (schoolData != null && !string.IsNullOrEmpty(schoolData.id)) {
+                            x.schoolCode = schoolData.id;
+                            x.areaId = $"{areaId}";
+                            x.city = $"{city}";
+                            x.dist = $"{dist}";
+                        }
+                    });
+
+                   schools.RemoveAll(x => string.IsNullOrEmpty(x.schoolCode));
+                   saveschools = await _azureStorage.SaveAll(schools);
+                }
+            }
+           
+            List<string> unsave = new List<string>();
+            if (saveschools.IsNotEmpty()) {
+               var ex    = schools.Select(x => $"{x.schoolid}").Except(saveschools.Select(y=>y.RowKey));
+                if (ex.Count() > 0) {
+                    unsave.AddRange(ex);
+                }
+            }
+            if (tbschools.IsNotEmpty())
+            {
+                var ex = schools.Select(x => $"{x.schoolid}").Except(tbschools.Select(y => y.RowKey));
+                if (ex.Count() > 0)
+                {
+                    unsave.AddRange(ex);
+                }
+            }
+
+            var areaschools = await _azureStorage.FindListByDict<ScSchool>(new Dictionary<string, object>() { { "PartitionKey", $"ScSchool" } ,{ "areaId",$"{areaId}" } });
+
+            List<School> cosbdschools = new List<School>();
+            await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<School>(queryText: $"select value(c) from c where c.areaId='{areaId}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
+            {
+                cosbdschools.Add(item);
+            }
+
+            var tbs = areaschools.FindAll(x => areaschools.Select(z => z.schoolCode).Except(cosbdschools.Select(x => x.id)).Contains(x.schoolCode));
+            List<CSchool> cSchools = new List<CSchool>();
+            foreach (var sch in tbs) {
+                cSchools.Add(new CSchool
+                {
+                    id = sch.schoolCode,
+                    name = sch.schoolname,
+                   // admin = "1530606136",
+                    period = new List<string>() { sch.schooltypename },
+                    size = 100,
+                });
+            
+            }
+           
+            var client = _azureCosmos.GetCosmosClient();
+            List<School> schoolsfailed = new List<School>();
+            List<School> schoolsScucess = new List<School>();
+            List<string> failedmsg= new List<string>();
+            foreach (var sc in cSchools)
+            {
+                List<Period> periods = new List<Period>();
+                string campusId = Guid.NewGuid().ToString();
+                sc.period.ForEach(x => {
+                    periods.Add(new Period { id = Guid.NewGuid().ToString(), name = x, campusId = campusId });
+                });
+                School school = new School
+                {
+                    id = sc.id,
+                    name = sc.name,
+                    size = sc.size,
+                    code = "Base",
+                    campuses = new List<Campus> { new Campus { name = sc.name, id = campusId } },
+                    region = "中国",
+                    province = "四川省",
+                    city = $"{city}",
+                    timeZone = new SDK.Models.TimeZone { label = "(UTC+08:00) 北京,重庆,香港特别行政区,乌鲁木齐", value = "+08:00" },
+                    type = 1,
+                    pk = "School",
+                    ttl = -1,
+                    schoolCode = sc.id,
+                    dist=$"{dist}",
+                    period = periods,
+                    areaId =$"{areaId}",
+                    standard=$"{standard}"
+                };
+                try
+                {
+                    
+
+                    await client.GetContainer(Constant.TEAMModelOS, "School").CreateItemAsync<School>(school, new PartitionKey(school.code));
+                    schoolsScucess.Add(school);
+                }
+                catch (CosmosException ex)
+                {
+                    failedmsg.Add($"{school.ToJsonString()}\n \n{ex.Status}{ex.Message }\n {ex.StackTrace}");
+                    schoolsfailed.Add(school);
+                }
+                catch (Exception ex) {
+                    failedmsg.Add($"{school.ToJsonString()}\n{ex.Message }\n {ex.StackTrace}");
+                    schoolsfailed.Add(school);
+                }
+            }
+
+            // 5.3.1.2获取学员名单
+            (status, json) = await _httpTrigger.RequestHttpTrigger(dict, _option.Location, "GetTeachersListByProject");
+            if (status == 200)
+            {
+                List<ScTeacher> teachers = json.ToObject<List<ScTeacher>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
+            }
+            return Ok(new {
+                projects, msg=$"Table中已经有:{tbschools.Count}个学校,省平台获取到:{schools.Count}个学校,本次保存有:{saveschools?.Count},没有被保存的学校:{unsave.Count},创建失败的学校有:{schoolsfailed.Count()},创建成功的的学校有:{schoolsScucess.Count()}",
+                schoolsfailed,
+                failedmsg,
+                schoolsScucess,
+               tbsch= tbschools.Select(x=>new { x.schoolname,x.schoolCode})
+            });
         }
 
         /// <summary>
@@ -750,651 +988,6 @@ namespace TEAMModelOS.Controllers.Third
             }
         }
 
-        public class Unbind
-        {
-            public string userid { get; set; }
-            public string id { get; set; }
-            public string name { get; set; }
-            public List<ScBindData> data { get; set; }
-        }
-        /// <summary>
-        ///
-        /// </summary>
-        /// <param name="json"></param>
-        /// <returns></returns>
-        [ProducesDefaultResponseType]
-        [HttpPost("sc/get-list")]
-        [AllowAnonymous]
-        public async Task<IActionResult> GetProjectList(List<Unbind> unbinds)
-        {
-      
-
-            // 5.3.1.1获取项目列表 
-            string trainComID = _sc_trainComID;
-            string Code = "GetProjectInfoByTrainComID";
-            Dictionary<string, object> parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", _sc_trainComID);
-            ScsResult GetProjectInfoByTrainComID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetProjectInfoByTrainComID.code = Code;
-            GetProjectInfoByTrainComID.title = "5.3.1.1获取项目列表";
-
-           Code = "GetSingleTeacherByProject";
-            //parameterMap = new Dictionary<string, object>();
-            //List<dynamic> dynamics = new List<dynamic>();
-            //List<string> un = new List<string>();
-            //foreach (var x in unbinds) {
-            //    parameterMap = new Dictionary<string, object>();
-            //    parameterMap.Add("TrainComID", trainComID);
-            //    parameterMap.Add("Pxid", x.data[0].pxid);
-            //    parameterMap.Add("Tid", x.userid);
-            //    ScsResult GetSingleTeacherByProject1 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            //    GetSingleTeacherByProject1.code = Code;
-            //    GetSingleTeacherByProject1.title = "5.3.1.11获取跳转学员信息";
-            //    if (GetSingleTeacherByProject1.result)
-            //    {
-            //        ScTeacher scTeacher = GetSingleTeacherByProject1.content.ToObject<ScTeacher>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
-
-            //        x.data[0].username = scTeacher.TeacherName;
-            //        x.data[0].userid = $"{scTeacher.TID}";
-            //        x.data[0].account = scTeacher.Account;
-            //    }
-            //    else {
-            //        un.Add($"{GetSingleTeacherByProject1.reason},{GetSingleTeacherByProject1.content},{parameterMap.ToJsonString()}");
-            //    }
-
-            //    dynamics.Add(new { x.data[0].sn, x.name, x.id, x.data[0].username, x.data[0].userid, x.data[0].account, x.data[0].pxid, });
-            //}
-            //return Ok(new { dynamics ,un });
-
-
-
-
-            // 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
-            Code = "GetSchoolList";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "60");
-            parameterMap.Add("ProjectItemID", "1068");
-            ScsResult GetSchoolList1 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetSchoolList1.code = Code;
-            GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
-
-            // 5.3.1.19获取项目设置的可选能力点,
-            Code = "GetProjectDiagnosis";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "60");
-            parameterMap.Add("ProjectItemID", "1068");
-            ScsResult GetProjectDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetProjectDiagnosis.code = Code;
-            GetProjectDiagnosis.title = "5.3.1.19获取项目设置的可选能力点";
-            // 补充
-            //  5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
-            Code = "GetDiagnosisListByProject_V2";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            //parameterMap.Add("ProjectID", "22");
-            //parameterMap.Add("ProjectItemID", "22");
-            parameterMap.Add("PXID", "242849");
-            ScsResult GetDiagnosisListByProject_V2 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetDiagnosisListByProject_V2.code = Code;
-            GetDiagnosisListByProject_V2.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
-            return Ok(new { GetDiagnosisListByProject_V2= GetDiagnosisListByProject_V2,GetProjectInfoByTrainComID= GetProjectInfoByTrainComID ,GetSchoolList = GetSchoolList1 });
-
-            // 5.3.1.2获取学员名单,暂不对接 V1。
-            Code = "GetTeachersListByProject";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "22");
-            parameterMap.Add("ProjectItemID", "24");
-            ScsResult GetTeachersListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetTeachersListByProject.code = Code;
-            GetTeachersListByProject.title = "5.3.1.2获取学员名单";
-
-
-            // 5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
-            Code = "GetDiagnosisListByProject";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "22");
-            parameterMap.Add("ProjectItemID", "24");
-            parameterMap.Add("PXID", "65321");
-            ScsResult GetDiagnosisListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetDiagnosisListByProject.code = Code;
-            GetDiagnosisListByProject.title = "5.3.1.3通过项目编号获取学员测评能力项";
-
-
-            // 补充
-            //  5.3.1.3通过项目编号获取学员测评能力项,需要确认每个教师是是否一样。
-            Code = "GetDiagnosisListByProject_V2";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            //parameterMap.Add("ProjectID", "22");
-            //parameterMap.Add("ProjectItemID", "22");
-            parameterMap.Add("PXID", "244188");
-            ScsResult GetDiagnosisListByProject_V2T = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetDiagnosisListByProject_V2T.code = Code;
-            GetDiagnosisListByProject_V2T.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
-
-            ScsResult UpdateTeacherSituation = null;
-            // 5.3.1.4学员培训基本情况回写
-            try
-            {
-                Code = "UpdateTeacherSituation";
-                parameterMap = new Dictionary<string, object>();
-                parameterMap.Add("TrainComID", trainComID);
-                parameterMap.Add("PXID", "65324");
-                parameterMap.Add("TID", "253940");
-                parameterMap.Add("TeacherName", "宋鸿");
-                parameterMap.Add("CourseHour", "50");
-                parameterMap.Add("ResearchText", "");//学习成果描述,字符长度<=300
-                parameterMap.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                UpdateTeacherSituation = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-                UpdateTeacherSituation.code = Code;
-                UpdateTeacherSituation.title = "5.3.1.4学员培训基本情况回写";
-            }
-            catch (Exception ex) { }
-            ScsResult UpdateTeacherDiagnosis = null;
-            try
-            {
-                // 5.3.1.5学员能力点测评结果回写
-                Code = "UpdateTeacherDiagnosis";
-                parameterMap = new Dictionary<string, object>();
-                parameterMap.Add("TrainComID", trainComID);
-                parameterMap.Add("PXID", "65321");
-                parameterMap.Add("TID", "32393");
-                parameterMap.Add("DiagnosisNum", "A1");
-                //0"未认定", 1"合格", 2"优秀", 3"不合格"
-                parameterMap.Add("zpresult", "1");
-                parameterMap.Add("hpresult", "1");
-                parameterMap.Add("xzpresult", "1");
-                List<Dictionary<string, string>> pfilesA = new List<Dictionary<string, string>>();
-                parameterMap.Add("pfiles", pfilesA);
-                Dictionary<string, string> pfileMapA = new Dictionary<string, string>();
-                pfileMapA.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                pfileMapA.Add("fileName", "XXX.pdf");
-                pfileMapA.Add("fileSize", "247767");
-                pfileMapA.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                pfileMapA.Add("fileType", "pdf");
-                pfilesA.Add(pfileMapA);
-                UpdateTeacherDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-                UpdateTeacherDiagnosis.code = Code;
-                UpdateTeacherDiagnosis.title = "5.3.1.5学员能力点测评结果回写";
-            }
-            catch (Exception ex)
-            {
-            }
-
-
-            // 5.3.1.6获取能力测评体系字典值数据
-            Code = "GetDiagnosisDic";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            ScsResult GetDiagnosisDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetDiagnosisDic.code = Code;
-            GetDiagnosisDic.title = "5.3.1.6获取能力测评体系字典值数据";
-
-
-            // 5.3.1.7获取能力测评评价类型字典值数据 ,不用对接
-            Code = "GetDiagnosisItemDic";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("DiagnosisDicID", "3");
-            ScsResult GetDiagnosisItemDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetDiagnosisItemDic.code = Code;
-            GetDiagnosisItemDic.title = "5.3.1.7获取能力测评评价类型字典值数据";
-
-
-            // 5.3.1.8获取能力测评评价类型细则字典值数据,不用对接。
-            Code = "GetchoiceDic";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("DiagnosisItemID", "4");
-            ScsResult GetchoiceDic = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetchoiceDic.code = Code;
-            GetchoiceDic.title = "5.3.1.8获取能力测评评价类型细则字典值数据";
-
-
-            // 5.3.1.9根据培训ID与机构ID获取老师信息
-            Code = "GetTeacherInfoByPXID";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("PXID", "65321");
-            ScsResult GetTeacherInfoByPXID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetTeacherInfoByPXID.code = Code;
-            GetTeacherInfoByPXID.title = "5.3.1.9根据培训ID与机构ID获取老师信息";
-
-
-            // 5.3.1.10根据培训项目ID与学校ID获取学校方案,用于展示学校的id方案。顺便确认学校的名单。
-            Code = "GetSchoolPlanBySchoolID";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectItemID", "3");
-            parameterMap.Add("SchoolID", "220913");
-            parameterMap.Add("Type", "0");
-            ScsResult GetSchoolPlanBySchoolID = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetSchoolPlanBySchoolID.code = Code;
-            GetSchoolPlanBySchoolID.title = "5.3.1.10根据培训项目ID与学校ID获取学校方案";
-
-
-            // 5.3.1.11获取跳转学员信息。用于sso单点,后端验证
-            Code = "GetSingleTeacherByProject";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("Pxid", "65321");
-            parameterMap.Add("Tid", "32393");
-            ScsResult GetSingleTeacherByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetSingleTeacherByProject.code = Code;
-            GetSingleTeacherByProject.title = "5.3.1.11获取跳转学员信息";
-
-            ScsResult UpdateTeacherListSituation = null;
-            Dictionary<string, object> parameterContent = new Dictionary<string, object>();
-            List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
-            try
-            { // 5.3.1.12学员培训基本情况批量回写
-                Code = "UpdateTeacherListSituation";
-
-
-                parameterContent.Add("TrainComID", trainComID);
-                parameterContent.Add("List", list);
-                // {"TrainComID":"39","List":[{"ResearchText":"","ComPassed":1,"PXID":"35455","CourseHour":"50.0","TID":"411105","TeacherName":"付绍令"}]}
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-
-                    parameterMapData.Add("PXID", "65324");
-                    parameterMapData.Add("TID", "253940");
-                    parameterMapData.Add("TeacherName", "柏成伟");
-                    parameterMapData.Add("CourseHour", "50");
-                    parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
-                    parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                    list.Add(parameterMapData);
-                    parameterMapData = new Dictionary<string, object>();
-
-                    parameterMapData.Add("PXID", "65324");
-                    parameterMapData.Add("TID", "253940");
-                    parameterMapData.Add("TeacherName", "柏成伟");
-                    parameterMapData.Add("CourseHour", "50");
-                    parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
-                    parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                    list.Add(parameterMapData);
-                    parameterMapData = new Dictionary<string, object>();
-
-                    //parameterMapData.Add("PXID", "22");
-                    //parameterMapData.Add("TID", "21348");
-                    //parameterMapData.Add("TeacherName", "邓泽燕");
-                    //parameterMapData.Add("CourseHour", "50");
-                    //parameterMapData.Add("ResearchText", "学习成果描述,字符长度<=300");
-                    //parameterMapData.Add("ComPassed", "2");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                    //list.Add(parameterMapData);
-                    //parameterMapData = new Dictionary<string, object>();
-                    //parameterMapData.Add("PXID", "35546");
-                    //parameterMapData.Add("TID", "411182");
-                    //parameterMapData.Add("TeacherName", "刘晓莉");
-                    //parameterMapData.Add("CourseHour", "50");
-                    //parameterMapData.Add("ResearchText", "");
-                    //parameterMapData.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                    //list.Add(parameterMapData);
-                }
-                UpdateTeacherListSituation = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
-                UpdateTeacherListSituation.code = Code;
-                UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
-            }
-            catch (Exception ex) { }
-
-            ScsResult UpdateTeacherListDiagnosis = null;
-            try
-            { // 5.3.1.13学员能力点测评结果批量回写
-                Code = "UpdateTeacherListDiagnosis";
-                parameterContent = new Dictionary<string, object>();
-                list = new List<Dictionary<string, object>>();
-                parameterContent.Add("TrainComID", trainComID);
-                parameterContent.Add("List", list);
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-
-                    parameterMapData.Add("PXID", "65321");
-                    parameterMapData.Add("TID", "32393");
-                    parameterMapData.Add("DiagnosisNum", "A1");
-                    //0"未认定", 1"合格", 2"优秀", 3"不合格"
-                    parameterMapData.Add("zpresult", "1");
-                    parameterMapData.Add("hpresult", "2");
-                    parameterMapData.Add("xzpresult", "2");
-                    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://srt-read-online.3ren.cn/basebusiness/material/20210422/1619055398463iE97VWe36i001.mp4");
-                    pfileMap.Add("fileName", "697a58c2375f7a031456c893e1e1860c.mp4");
-                    pfileMap.Add("fileSize", "17036168");
-                    pfileMap.Add("md5", "");
-                    pfileMap.Add("fileType", "video");
-                    pfiles.Add(pfileMap);
-
-                    list.Add(parameterMapData);
-
-                    pfileMap = new Dictionary<string, object>();
-                    pfileMap.Add("url", "https://srt-read-online.3ren.cn/basebusiness/material/20210422/1619055446704gbKuNF8eas001.pdf");
-                    pfileMap.Add("fileName", "A6技术支持的课堂反思.pdf");
-                    pfileMap.Add("fileSize", "32192");
-                    pfileMap.Add("md5", "");
-                    pfileMap.Add("fileType", "pdf");
-                    pfiles.Add(pfileMap);
-
-                    list.Add(parameterMapData);
-                }
-
-                //{
-                //    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-
-                //    parameterMapData.Add("PXID", "3062");
-                //    parameterMapData.Add("TID", "401268");
-                //    parameterMapData.Add("DiagnosisNum", "A1");
-                //    //0"未认定", 1"合格", 2"优秀", 3"不合格"
-                //    parameterMapData.Add("zpresult", "1");
-                //    parameterMapData.Add("hpresult", "2");
-                //    parameterMapData.Add("xzpresult", "2");
-                //    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://srt-read-online.3ren.cn/basebusiness/material/20210422/1619058650000bphKFbDVSa001.pdf");
-                //    pfileMap.Add("fileName", "学情分析.pdf");
-                //    pfileMap.Add("fileSize", "94926");
-                //    pfileMap.Add("md5", "");
-                //    pfileMap.Add("fileType", "pdf");
-                //    pfiles.Add(pfileMap);
-
-                //    list.Add(parameterMapData);
-
-                //    pfileMap = new Dictionary<string, object>();
-                //    pfileMap.Add("url", "https://srt-read-online.3ren.cn/basebusiness/material/20210422/1619058698452gF19jmiuML001.mp4");
-                //    pfileMap.Add("fileName", "种子萌发学情分析.mp4");
-                //    pfileMap.Add("fileSize", "12692368");
-                //    pfileMap.Add("md5", "");
-                //    pfileMap.Add("fileType", "video");
-                //    pfiles.Add(pfileMap);
-                //    list.Add(parameterMapData);
-                //}
-                UpdateTeacherListDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
-                UpdateTeacherListDiagnosis.code = Code;
-                UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
-            }
-            catch (Exception ex)
-            {
-            }
-
-
-            ScsResult UploadSBTARPDF = null;
-            try
-            {   // 5.3.1.14学员校本研修PDF回写
-                Code = "UploadSBTARPDF";
-                parameterMap = new Dictionary<string, object>();
-                parameterMap.Add("TrainComID", trainComID);
-                parameterMap.Add("PXID", "16");
-                parameterMap.Add("TID", "16");
-
-                parameterMap.Add("url", "http://image1.cersp.com.cn/scpx/images/article/file/20190318/upload__51f98fc8_1697695ae73__7ffe_00001297.pdf");
-                parameterMap.Add("fileName", "XXX.pdf");
-                parameterMap.Add("fileSize", "247767");
-                parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                parameterMap.Add("fileType", "pdf");
-                UploadSBTARPDF = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-                UploadSBTARPDF.code = Code;
-                UploadSBTARPDF.title = "5.3.1.14学员校本研修PDF回写";
-            }
-            catch (Exception ex)
-            {
-            }
-
-            ScsResult UploadSBTARPDFList = null;
-            try
-            { // 5.3.1.15学员校本教研PDF批量回写
-                Code = "UploadSBTARPDFList";
-                parameterContent = new Dictionary<string, object>();
-                list = new List<Dictionary<string, object>>();
-                parameterContent.Add("TrainComID", trainComID);
-                parameterContent.Add("List", list);
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", "65309");
-                    parameterMapData.Add("TID", "253940");
-                    parameterMapData.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                    parameterMapData.Add("fileName", "XXX.pdf");
-                    parameterMapData.Add("fileSize", "247767");
-                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                    parameterMapData.Add("fileType", "pdf");
-                    list.Add(parameterMapData);
-                }
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", "65306");
-                    parameterMapData.Add("TID", "32393");
-                    parameterMapData.Add("url", "https://scnltsfiles.scedu.com.cn/upload/infofj/202104011628463774.pdf");
-                    parameterMapData.Add("fileName", "XXX.pdf");
-                    parameterMapData.Add("fileSize", "247767");
-                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                    parameterMapData.Add("fileType", "pdf");
-                    list.Add(parameterMapData);
-                }
-                UploadSBTARPDFList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
-                UploadSBTARPDFList.code = Code;
-                UploadSBTARPDFList.title = "5.3.1.15学员校本教研PDF批量回写";
-            }
-            catch (Exception ex) { }
-            ScsResult UploadKTSL = null;
-            try
-            {
-                // 5.3.1.16学员课堂实录回写
-                Code = "UploadKTSL";
-                parameterMap = new Dictionary<string, object>();
-                parameterMap.Add("TrainComID", trainComID);
-                parameterMap.Add("PXID", "16");
-                parameterMap.Add("TID", "16");
-                parameterMap.Add("url", "https://xxx.mp4");
-                parameterMap.Add("url2", "https://xxx.mp4");
-                parameterMap.Add("fileName", "XXX.mp4");
-                parameterMap.Add("fileSize", "247767");
-                parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                parameterMap.Add("fileType", "mp4");
-                UploadKTSL = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-                UploadKTSL.code = Code;
-                UploadKTSL.title = "5.3.1.16学员课堂实录回写";
-            }
-            catch (Exception ex) { }
-            ScsResult UploadKTSLList = null;
-            try
-            {
-                //  5.3.1.17学员课堂实录批量回写
-                Code = "UploadKTSLList";
-                parameterContent = new Dictionary<string, object>();
-                list = new List<Dictionary<string, object>>();
-                parameterContent.Add("TrainComID", trainComID);
-                parameterContent.Add("List", list);
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", "16");
-                    parameterMapData.Add("TID", "16");
-                    parameterMapData.Add("url", "https://xxx.mp4");
-                    parameterMapData.Add("url2", "https://xxx.mp4");
-                    parameterMapData.Add("fileName", "XXX.mp4");
-                    parameterMapData.Add("fileSize", "247767");
-                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                    parameterMapData.Add("fileType", "mp4");
-                    list.Add(parameterMapData);
-                }
-                {
-                    Dictionary<string, object> parameterMapData = new Dictionary<string, object>();
-                    parameterMapData.Add("PXID", "16");
-                    parameterMapData.Add("TID", "16");
-                    parameterMapData.Add("url", "https://xxx.mp4");
-                    parameterMapData.Add("url2", "https://xxx.mp4");
-                    parameterMapData.Add("fileName", "XXX.mp4");
-                    parameterMapData.Add("fileSize", "247767");
-                    parameterMapData.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
-                    parameterMapData.Add("fileType", "mp4");
-                    list.Add(parameterMapData);
-                }
-                UploadKTSLList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
-                UploadKTSLList.code = Code;
-                UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
-
-            }
-            catch (Exception ex) { }
-
-            // 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表
-            Code = "GetSchoolList";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "22");
-            parameterMap.Add("ProjectItemID", "24");
-            ScsResult GetSchoolList = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetSchoolList.code = Code;
-            GetSchoolList.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
-
-
-
-         
-
-
-            // 5.3.1.20获取学校设置的可选能力点,
-            Code = "GetSchoolDiagnosis";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "22");
-            parameterMap.Add("ProjectItemID", "21");
-            parameterMap.Add("SchoolID", "200001");
-            ScsResult GetSchoolDiagnosis = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetSchoolDiagnosis.code = Code;
-            GetSchoolDiagnosis.title = "5.3.1.20获取学校设置的可选能力点";
-
-            // 5.3.1.21分页获取学员名单
-            Code = "GetTeachersPageListByProject";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", trainComID);
-            parameterMap.Add("ProjectID", "22");
-            parameterMap.Add("ProjectItemID", "24");
-            parameterMap.Add("curPage", "1");
-            parameterMap.Add("pageSize", "10");
-            ScsResult GetTeachersPageListByProject = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterMap);
-            GetTeachersPageListByProject.code = Code;
-            GetTeachersPageListByProject.title = "5.3.1.21分页获取学员名单";
-
-            // 5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写
-            Code = "UploadSBTARPDFListV2";
-            parameterContent = new Dictionary<string, object>();
-            parameterContent.Add("TrainComID", trainComID);
-            list = new List<Dictionary<string, object>>();
-            parameterContent.Add("List", list);
-            {
-                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.Add(parameterMapData);
-            }
-
-            {
-                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.Add(parameterMapData);
-            }
-            ScsResult UploadSBTARPDFListV2 = await _scsApisService.Post(_sc_url, Code, _sc_passKey, _sc_privateKey, parameterContent);
-            UploadSBTARPDFListV2.code = Code;
-            UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
-
-
-            return Ok(new
-            {
-                GetProjectInfoByTrainComID,
-                GetTeachersListByProject,
-                GetDiagnosisListByProject,
-                GetDiagnosisListByProject_V2,
-                UpdateTeacherSituation,
-                UpdateTeacherDiagnosis,
-                GetDiagnosisDic,
-                GetDiagnosisItemDic,
-                GetchoiceDic,
-                GetTeacherInfoByPXID,
-                GetSchoolPlanBySchoolID,
-                GetSingleTeacherByProject,
-                UpdateTeacherListSituation,
-                UpdateTeacherListDiagnosis,
-                UploadSBTARPDF,
-                UploadSBTARPDFList,
-                UploadKTSL,
-                UploadKTSLList,
-                GetSchoolList,
-                GetProjectDiagnosis,
-                GetSchoolDiagnosis,
-                GetTeachersPageListByProject,
-                UploadSBTARPDFListV2
-            });
-
-            //return Ok(GetProjectInfoByTrainComID);
-        }
-
-        public record ScSSO{
-            public string Webid { get; set; }
-            public string Pxid { get; set; }
-            public string tid { get; set; }
-            public string time { get; set; }
-            public string Encrypt { get; set; }
-           // public string data { get; set; }
-        }
-        public record ScSSOData
-        {
-            public string path { get; set; }
-            public string Pxid { get; set; }
-            public string tid { get; set; }
-            public string time { get; set; }
-            public string Encrypt { get; set; }
-            public string data { get; set; }
-            public string username { get; set; }
-            public string account { get; set; }
-        }
-        public record SSO
-        {
-            public string type { get; set; }
-            public string param { get; set; }
-            public string id_token { get; set; }
-        }
-        public record TmdidImplicit { 
-            public string id_token { get; set; }
-            public string access_token { get; set; }
-            public string expires_in { get; set; }
-            public string token_type { get; set; }
-        }
+       
     }
 }

+ 49 - 0
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -54,6 +54,55 @@ namespace TEAMModelOS.Controllers
             _serviceBus = serviceBus;
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("fix-teacher-statistics")]
+        public async Task<IActionResult> FixTeacherStatistics(JsonElement json)
+        {
+            var client = _azureCosmos.GetCosmosClient();
+            List<TeacherTrain> teacherTrains = new List<TeacherTrain>();
+            string sql = $"SELECT distinct value(c) FROM c where  c.pk='TeacherTrain'  ";
+            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: sql))
+            {
+                teacherTrains.Add(item);
+            }
+            foreach (var train in teacherTrains)
+            {
+                train.update.Add(StatisticsService.TeacherAbility);
+                await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(train, train.id, new PartitionKey(train.code));
+
+            }
+            return Ok();
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        [ProducesDefaultResponseType]
+        [HttpPost("fix-teacher-file")]
+        public async Task<IActionResult> FixTeacherFile(JsonElement json) {
+            var client = _azureCosmos.GetCosmosClient();
+            List<TeacherFile> teacherFiles = new List<TeacherFile>();
+            string sql = $"SELECT distinct value(c) FROM c join b in c.fileRecords  where c.pk='TeacherFile' and b.type='video'  and b.done=true and b.duration>0 and b.view<TRUNC(b.duration) ";
+            await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherFile>(queryText: sql))
+            {
+                teacherFiles.Add(item);
+            }
+            foreach (var flie in teacherFiles) {
+                var records = flie.fileRecords.FindAll(x => x.type.Equals("video") && x.duration > 0 && x.view < (int)x.duration);
+                records.ForEach(x => { x.view =(int) x.duration; });
+                await  client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(flie, flie.id, new PartitionKey(flie.code));
+                TeacherTrain train =  await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<TeacherTrain>(flie.id,  new PartitionKey($"TeacherTrain-{flie.code.Replace("TeacherFile-","")}"));
+                train.update.Add(StatisticsService.TeacherAbility);
+                await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(train, train.id, new PartitionKey(train.code));
+
+            }
+            return Ok();
+        }
         /// <summary>
         /// 批量导入自动加入学校
         /// </summary>

+ 135 - 9
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -29,6 +29,7 @@ using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.Services.Common;
 using static TEAMModelOS.SDK.Models.Teacher;
+using static TEAMModelOS.SDK.SchoolService;
 
 namespace TEAMModelOS.Controllers
 {
@@ -55,13 +56,7 @@ namespace TEAMModelOS.Controllers
             _httpClient= httpClient;
         }
          
-        public class SchoolData{
-            public string province { get; set; }
-            public string id { get; set; }
-            public string name { get; set; }
-            public string city { get; set; }
-            public string address { get; set; }
-        }
+      
         /*
 [
 {"method":"台北市","params":{"CountryId":"TW","CityId":"30"}},1
@@ -97,6 +92,133 @@ namespace TEAMModelOS.Controllers
         [HttpPost("get-schools")]
         public async Task<IActionResult> GetSchools(JsonElement json) {
 
+            string msg = "{\"standard\":\"standard3\",\"tmdids\":[\"1635136038\"],\"school\":\"pbjyey\",\"update\":[\"TeacherAbility\"],\"statistics\":0}";
+            try
+            {
+                // await _dingDing.SendBotMsg($"teacher-train-change\n{msg}",GroupNames.成都开发測試群組);
+                TeacherTrainChange change = msg.ToObject<TeacherTrainChange>();
+                
+                var client = _azureCosmos.GetCosmosClient();
+                string insql = $"where c.id in ({string.Join(",", change.tmdids.Select(x => $"'{x}'"))})";
+                string selsql = $"select value(c) from c {insql} ";
+                List<TeacherTrain> teacherTrains = new List<TeacherTrain>();
+
+                await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: selsql,
+                      requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"TeacherTrain-{change.school}") }))
+                {
+                    teacherTrains.Add(item);
+                }
+
+                if (change.statistics != 1)
+                {
+
+                    List<Task<ItemResponse<TeacherTrain>>> task = new List<Task<ItemResponse<TeacherTrain>>>();
+                    teacherTrains.ForEach(x =>
+                    {
+                        x.update.UnionWith(change.update);
+                        task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<TeacherTrain>(x, x.id, new PartitionKey($"TeacherTrain-{change.school}")));
+                    });
+                    await task.TaskPage(5);
+                    var unchange = change.tmdids.Except(teacherTrains.Select(x => x.id));
+                    if (unchange != null)
+                    {
+                        task.Clear();
+                        unchange.ToList().ForEach(x =>
+                        {
+                            TeacherTrain teacherTrain = new TeacherTrain
+                            {
+                                pk = "TeacherTrain",
+                                id = x,
+                                code = $"TeacherTrain-{change.school}",
+                                tmdid = x,
+                                school = change.school,
+                                update = new HashSet<string> {  StatisticsService.TeacherAbility,
+                        StatisticsService.TeacherClass, StatisticsService.OfflineRecord }
+                            };
+                            teacherTrain.update.UnionWith(change.update);
+                            task.Add(client.GetContainer(Constant.TEAMModelOS, "Teacher").UpsertItemAsync<TeacherTrain>(teacherTrain, new PartitionKey($"TeacherTrain-{change.school}")));
+                        });
+                        await task.TaskPage(1);
+                    }
+                }
+                else
+                {
+                    Area area = null;
+                    string sql = $"select value(c) from c where c.standard='{change.standard}'";
+                    await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<Area>(queryText: sql,
+                          requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-Area") }))
+                    {
+                        area = item;
+                    }
+                    AreaSetting setting = null;
+                    if (area != null)
+                    {
+                        try
+                        {
+                            //优先找校级
+                            setting = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<AreaSetting>(change.school, new PartitionKey("AreaSetting"));
+                        }
+                        catch (CosmosException)
+                        {
+                            try
+                            {
+                                setting = await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<AreaSetting>(area.id, new PartitionKey("AreaSetting"));
+                            }
+                            catch (CosmosException)
+                            {
+                                setting = null;
+                            }
+                        }
+                    }
+                    if (setting == null)
+                    {
+                        setting = new AreaSetting
+                        {
+                            allTime = 50,
+                            classTime = 5,
+                            submitTime = 15,
+                            onlineTime = 20,
+                            offlineTime = 10,
+                            lessonMinutes = 45,
+                        };
+                    }
+                    List<Task<TeacherTrain>> task = new List<Task<TeacherTrain>>();
+                    teacherTrains.ForEach(x =>
+                    {
+                        x.update.UnionWith(change.update);
+                        task.Add(StatisticsService.StatisticsTeacher(x, setting, area, client, null));
+                    });
+                    await task.TaskPage(1);
+                    var unchange = change.tmdids.Except(teacherTrains.Select(x => x.id));
+                    if (unchange != null)
+                    {
+                        task.Clear();
+                        unchange.ToList().ForEach(x =>
+                        {
+                            task.Add(StatisticsService.StatisticsTeacher(new TeacherTrain
+                            {
+                                pk = "TeacherTrain",
+                                id = x,
+                                code = $"TeacherTrain-{change.school}",
+                                tmdid = x,
+                                school = change.school,
+                                update = new HashSet<string> {  StatisticsService.TeacherAbility,
+                                StatisticsService.TeacherClass, StatisticsService.OfflineRecord }
+                            }, setting, area, client, null));
+                        });
+                        await task.TaskPage(1);
+                    }
+                }
+            }
+            catch (CosmosException ex)
+            {
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-研修数据变更,重新统计-TeacherTrainChange\n{msg}\n{ex.Message}\n{ex.StackTrace}CosmosException{ex.Status}", GroupNames.成都开发測試群組);
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-研修数据变更,重新统计-TeacherTrainChange\n{msg}\n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+            }
+            /*
             string path = $"{_environment.ContentRootPath}/JsonFile/Core/city.json";
             StreamReader streamReader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
             StringBuilder stringBuilder = new StringBuilder();
@@ -149,6 +271,8 @@ namespace TEAMModelOS.Controllers
             }
             await _dingDing.SendBotMsg($"os,test,{nodatas.ToJsonString()}", GroupNames.成都开发測試群組);
             return Ok(schoolInfos);
+            */
+            return Ok();
         }
 
         public   async Task<(List<SchoolInfo> schoolInfos,List<string> nodata)> GetSchoolAsync(List<string> regions) {
@@ -212,8 +336,10 @@ namespace TEAMModelOS.Controllers
         /// <returns></returns>
         [ProducesDefaultResponseType]
         [HttpPost("generate-school-codes")]
-        public async Task<IActionResult> GenerateSchoolCodes(JsonElement json) {
-            dynamic data = await  SchoolService.GenerateSchoolCode(json, _dingDing, _environment);
+        public async Task<IActionResult> GenerateSchoolCodes(JsonElement json)
+        {
+            List<SchoolData> schoolss = json.GetProperty("schools").ToObject<List<SchoolData>>();
+            dynamic data = await  SchoolService.GenerateSchoolCode(schoolss, _dingDing, _environment);
             return Ok(data);
         }
 

+ 2 - 2
TEAMModelOS/Services/Common/ActivityStudentService.cs

@@ -179,7 +179,7 @@ namespace TEAMModelOS.Services.Common
                                     activity.taskStatus = taskStatus;
                                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, vote.id, new PartitionKey($"Activity-{userid}"));
                                     if (!string.IsNullOrEmpty(standard) && !string.IsNullOrEmpty(school)) {
-                                      await  StatisticsService.SendServiceBus(  ($"{standard}",new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherVote }, 0)  , _configuration, _serviceBus);
+                                      await  StatisticsService.SendServiceBus(  ($"{standard}",new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherVote }, 0)  , _configuration, _serviceBus, client);
                                     }
                                 }
                                 catch(CosmosException cosex) {
@@ -719,7 +719,7 @@ namespace TEAMModelOS.Services.Common
                                         await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<StuActivity>(activity, survey.id, new PartitionKey($"Activity-{userid}"));
                                         if (!string.IsNullOrEmpty(standard) && !string.IsNullOrEmpty(school))
                                         {
-                                            await StatisticsService.SendServiceBus( ($"{standard}",new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherSurvey }, 0)  , _configuration, _serviceBus);
+                                            await StatisticsService.SendServiceBus( ($"{standard}",new List<string> { $"{userid}" }, $"{school}", new List<string> { StatisticsService.TeacherSurvey }, 0)  , _configuration, _serviceBus, client);
                                         }
                                     } catch (CosmosException cosex) {
                                         if (cosex.Status == 404) {

+ 16 - 6
TEAMModelOS/appsettings.Development.json

@@ -21,16 +21,16 @@
   },
   "Azure": {
     "Storage": {
-      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn"
-      //"ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
+      //"ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn"
+      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
     },
     "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
-      //"ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
+      //"ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     },
     "Redis": {
-      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
-      //"ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
+      //"ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
+      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
     },
     "ServiceBus": {
       "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
@@ -61,11 +61,21 @@
     //  "privateKey": "4DB15444DEEDBB28B718ACB09217B5FC", //机构 AES 密钥
     //  "url": "http://testscts.scedu.com.cn/webservice/EduService.asmx/RequestService"
     //}
+
+    ///醍摩豆-蒲江县
     "scsyxpt": {
       "passKey": "fst4clhyXqrhXblY", //机构安全码
       "trainComID": "3069", //机构ID
       "privateKey": "52C1C240E4BE086DD15DB10814E243E6", //机构 AES 密钥
       "url": "https://scts.scedu.com.cn/webservice/EduService.asmx/RequestService"
     }
+
+    ///英鼎教育-金牛区
+    //"scsyxpt": {
+    //  "passKey": "MSmZQnjvySxwB8KZ", //机构安全码
+    //  "trainComID": "3072", //机构ID
+    //  "privateKey": "CA00580BB7BFA3817334CFA38257AC9A", //机构 AES 密钥
+    //  "url": "https://scts.scedu.com.cn/webservice/EduService.asmx/RequestService"
+    //}
   }
 }