CrazyIter_Bin před 3 roky
rodič
revize
ef9ca16f18

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

@@ -1,45 +0,0 @@
-using Azure.Cosmos;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Extension;
-using TEAMModelOS.SDK.Models;
-
-namespace TEAMModelOS.SDK
-{
-    public  static class ScApisService
-    {
-        public static string Code { get; set; }
-        public static Dictionary<string, object> parameterMap = null;
-        public static async Task<List<string>> GetDiagnosisListByProject_V2(ScConfig scconfig, ThirdApisService _thirdApisService) {
-            ScAccessConfig config = scconfig.accessConfig.ToObject<ScAccessConfig>();
-            List<string> abilityNos = null;
-            Code = "GetDiagnosisListByProject_V2";
-            parameterMap = new Dictionary<string, object>();
-            parameterMap.Add("TrainComID", config.trainComID);
-            //parameterMap.Add("ProjectID", "22");
-            //parameterMap.Add("ProjectItemID", "22");
-            parameterMap.Add("PXID", scconfig.pxid);
-            ScsResult result = new ScsResult {code=Code,title= "5.3.1.3通过项目编号获取学员测评能力项V2" };
-
-            try {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
-                if (result.result)
-                {
-                    List<ScDiagnosis> diagnoses = result.content.ToObject<List<ScDiagnosis>>();
-                    if (diagnoses != null)
-                    {
-                        abilityNos = diagnoses.Select(x => x.DiagnosisDicNum).ToList();
-                    }
-                }
-                return abilityNos;
-            } catch (Exception ex) {
-                //await dingDing.SendBotMsg($"IES5.ScApisService:getDiagnosisListByProject_V2\n{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
-                return abilityNos;
-            }
-        }
-    }
-}

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

@@ -11,14 +11,15 @@ namespace TEAMModelOS.SDK.Models
     {
        
     }
-    public class ScConfig
-    {
-        public string accessConfig { get; set; }
-        public string pxid { get; set; }
-    }
+    
     [TableName(Name = "ScYxpt")]
     public class ScTeacherDiagnosis :TableEntity
     {
+
+        /// <summary>
+        /// pk="ScTeacherDiagnosis"
+        /// rk=$"{PXID}"
+        /// </summary>
         public string areaId { get; set; }
         public string schoolCode { get; set; }
         public string abilityNos { get; set; }
@@ -27,6 +28,17 @@ namespace TEAMModelOS.SDK.Models
     [TableName(Name = "ScYxpt")]
     public class ScProjectDiagnosis : TableEntity
     {
+        ///学校的
+        /// <summary>
+        /// pk="ScSchoolDiagnosis"
+        /// rk=$"{ProjectItemID}-{schoolCode}"  1086-206811
+        /// </summary>
+
+        ///项目的
+        /// <summary>
+        /// pk="ScProjectDiagnosis"
+        /// rk=$"{ProjectItemID}"
+        /// </summary>
         public string abilityNos { get; set; }
         public string areaId{get;set;}
         public string schoolCode { get; set; }
@@ -55,6 +67,10 @@ namespace TEAMModelOS.SDK.Models
     [TableName(Name = "ScYxpt")]
     public class ScSchool : TableEntity
     {
+        /// <summary>
+        /// pk="ScSchool"
+        /// rk=$"{schoolid}"
+        /// </summary>
         public int schoolid { get; set; }
        
         public string schoolname { get; set; }
@@ -76,10 +92,15 @@ namespace TEAMModelOS.SDK.Models
         public int ProjectID { get; set; }
         public int ProjectItemID { get; set; }
     }
+    
 
     [TableName(Name = "ScYxpt")]
     public class ScTeacher: TableEntity
     {
+        /// <summary>
+        /// pk="ScTeacher"
+        /// rk=$"{PXID}"
+        /// </summary>
         public int PXID { get; set; }
         public int TID { get; set; }
         public string TeacherName { get; set; }
@@ -106,8 +127,31 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public int status { get; set; }
     }
+
+    [TableName(Name = "ScYxpt")]
+    public class ScConfig : TableEntity
+    {
+        /// <summary>
+        /// pk="ScConfig"
+        /// rk=$"{pd}-{pid}"
+        /// </summary>
+        public string homeworkType { get; set; }
+        public string path { get; set; }
+        public string config { get; set; }
+        public string passKey { get; set; }
+        public string trainComID { get; set; }
+        public string privateKey { get; set; }
+        public string url { get; set; }
+        public string pd { get; set; }
+        public string pt { get; set; }
+        public string pid { get; set; }
+        public string pit { get; set; }
+        public string areaId { get; set; }
+        public string standard { get; set; }
+    }
     public class ScAccessConfig : AccessConfig
     {
+        
         public string passKey { get; set; }
         public string trainComID { get; set; }
         public string privateKey { get; set; }

+ 12 - 4
TEAMModelOS/Controllers/Third/ScController.cs

@@ -950,6 +950,10 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> Sso([FromQuery] ScSSO scsso,string path)
         {
             var HostName = HttpContext.GetHostName();
+            //var rurl = new StringBuilder($"https://{_option.HostName}/sso");
+            var rurl = new StringBuilder($"https://{HostName}/sso");
+            
+           
             if (path.Equals("sc"))
             {
                 path = $"scpjx";
@@ -958,9 +962,6 @@ namespace TEAMModelOS.Controllers
             {
                 path = $"sc{path}";
             }
-
-            //var rurl = new StringBuilder($"https://{_option.HostName}/sso");
-            var rurl = new StringBuilder($"https://{HostName}/sso");
             try {
               
                 string parmas = $"Pxid={scsso.Pxid}&Webid={scsso.Webid}&tid={scsso.tid}&time={scsso.time}";
@@ -979,6 +980,13 @@ namespace TEAMModelOS.Controllers
                 {
                     return Redirect(rurl.Append($"?status=1").ToString());
                 }
+                List<ScTeacher> scTeachers = await _azureStorage.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "TID", scsso.tid }, { "RowKey", $"{scsso.Pxid}" } });
+                if (!scTeachers.IsNotEmpty())
+                {
+                    //没有同步省平台
+                    string enurl = $"status=5&param={HttpUtility.UrlEncode(new { scsso.Pxid, scsso.tid}.ToJsonString(), Encoding.UTF8)}";
+                    return Redirect(rurl.Append($"?{enurl}").ToString());
+                }
                 string setsql = $"select  value(c) from c where contains(c.accessConfig,'{path}')  and contains(c.accessConfig,'scsyxpt') ";
                 AreaSetting setting = null;
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Normal").GetItemQueryIterator<AreaSetting>(queryText: setsql,
@@ -995,7 +1003,7 @@ namespace TEAMModelOS.Controllers
                 Dictionary<string, object> dict = new Dictionary<string, object> { { "accessConfig", accessConfig }, { "pxid", scsso.Pxid }, { "tid", scsso.tid }, { "areaId", $"{setting.id}" } };
                 string SchoolName = "", SchoolID = "", ProjectID = "", ProjectItemID = "", TeacherName = "" , Account="";
 
-                List<ScTeacher> scTeachers = await _azureStorage.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "TID", scsso.tid }, { "RowKey", $"{scsso.Pxid}" } });
+                
                 if (scTeachers.IsNotEmpty())
                 {
                     ScTeacher scTeacher = scTeachers[0];

+ 11 - 11
TEAMModelOS/appsettings.Development.json

@@ -81,19 +81,19 @@
     //}
 
     ///醍摩豆-蒲江县
-    //"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 密钥
+      "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"
+    //}
   }
 }