CrazyIter 5 gadi atpakaļ
vecāks
revīzija
cb74b8693e

+ 1 - 1
TEAMModelOS.Model/BaseInfo/Models/Grades.cs

@@ -4,7 +4,7 @@ using System.Text;
 
 
 namespace TEAMModelOS.Model.BaseInfo.Models
 namespace TEAMModelOS.Model.BaseInfo.Models
 {
 {
-    public class Grades
+    public class Grade
     {
     {
         public string Code { get; set; }
         public string Code { get; set; }
         public string Name { get; set; }
         public string Name { get; set; }

+ 6 - 6
TEAMModelOS.Model/BaseInfo/Models/SSystem.cs

@@ -7,13 +7,13 @@ namespace TEAMModelOS.Model.BaseInfo.Models
     public class Period
     public class Period
     {
     {
         public Period() {
         public Period() {
-            Grade = new List<Grades>();
-            Subject = new List<Subjects>();
-            Semester = new List<Semester>();
+            Grades = new List<Grade>();
+            Subjects = new List<Subject>();
+            Semesters = new List<Semester>();
         }
         }
-        public List<Grades> Grade { get; set; }
-        public List<Subjects> Subject { get; set; }
-        public List<Semester> Semester { get; set; }
+        public List<Grade> Grades { get; set; }
+        public List<Subject> Subjects { get; set; }
+        public List<Semester> Semesters { get; set; }
         public string Name { get; set; }
         public string Name { get; set; }
         public string Code { get; set; }
         public string Code { get; set; }
         public int GradeCount { get; set; }
         public int GradeCount { get; set; }

+ 2 - 4
TEAMModelOS.Model/BaseInfo/Models/SchoolSystem.cs

@@ -6,12 +6,10 @@ using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
 namespace TEAMModelOS.Model.BaseInfo.Models
 namespace TEAMModelOS.Model.BaseInfo.Models
 {
 {
-    public class SchoolSystem
+    public class School
     {
     {
-        public SchoolSystem() {
+        public School() {
             Period = new List<Period>();
             Period = new List<Period>();
-            //Semesters = new List<Semester>();
-
         }
         }
         [JsonProperty(PropertyName = "id")]
         [JsonProperty(PropertyName = "id")]
         public string Id { get; set; }
         public string Id { get; set; }

+ 1 - 0
TEAMModelOS.Model/BaseInfo/Models/Semester.cs

@@ -7,6 +7,7 @@ namespace TEAMModelOS.Model.BaseInfo.Models
     public class Semester
     public class Semester
     {
     {
         public string Name { get; set; }
         public string Name { get; set; }
+        public int  Code { get; set; }
         public string SCount { get; set; }
         public string SCount { get; set; }
         public string Month { get; set; }
         public string Month { get; set; }
         public string Day { get; set; }
         public string Day { get; set; }

+ 65 - 10
TEAMModelOS.Model/BaseInfo/Models/StudentInfo.cs

@@ -1,21 +1,76 @@
-using System;
+using Newtonsoft.Json.Linq;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
+using System.Text.Json;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
 namespace TEAMModelOS.Model.BaseInfo.Models
 namespace TEAMModelOS.Model.BaseInfo.Models
 {
 {
     public class StudentInfo
     public class StudentInfo
     {
     {
-        public string Id { get; set; }
-        public string StudentId { get; set; }
-        public string Password { get; set; }
-        public string Name { get; set; }
-        public string SeatNo { get; set; }
-        public string ClassroomCode{get;set;}
-        public string GradeCode { get; set; }
-        public string PeriodCode { get; set; }
+        public JObject studentInfo_ { get; set; }
+        public Utf8JsonWriter json { get; set; }
+        public StudentInfo()
+        {
+            json.WriteString("aaa","");
+
+            studentInfo_ = new JObject() { new JProperty("id",null)};
+            studentInfo_ = new JObject() { new JProperty("name", null) };
+            studentInfo_ = new JObject() { new JProperty("email", null) };
+            studentInfo_ = new JObject() { new JProperty("cellphone", null) };
+            studentInfo_ = new JObject() { new JProperty("countryCode", null) }; 
+            studentInfo_ = new JObject() { new JProperty("verifyFlg", false) };
+            studentInfo_ = new JObject() { new JProperty("status", 1) }; 
+            studentInfo_ = new JObject() { new JProperty("createDate", null) };
+            studentInfo_ = new JObject() { new JProperty("password", null) };
+            studentInfo_ = new JObject() { new JProperty("exValue", null) };
+            studentInfo_ = new JObject() { new JProperty("oauth", null) };
+            studentInfo_ = new JObject() { new JProperty("product", null) };
+            studentInfo_ = new JObject() { new JProperty("haveDevice", null) };
+            studentInfo_ = new JObject() { new JProperty("schoolCode", null) };
+            studentInfo_ = new JObject() { new JProperty("profilePicture", null) };
+            studentInfo_ = new JObject() { new JProperty("TEAMModelId", null) };
+            studentInfo_ = new JObject() { new JProperty("loginTime", null) };
+            studentInfo_ = new JObject() { new JProperty("virtualId", null) };
+            studentInfo_ = new JObject() { new JProperty("productToken", null) };
+        }
+
+        public string id { get; set; }
+        public string name { get; set; }
+        public string email { get; set; }
+        public string cellphone { get; set; }
+        public string countryCode { get; set; }
+        public string verifyFlg { get; set; }
+        public string status { get; set; }
+        public string createDate { get; set; }
+        public Password password { get; set; }
+        public string exValue { get; set; }
+      //  public string oauth { get; set; }
+        public string product { get;set;}
+        public string haveDevice { get; set; }
         [PartitionKey]
         [PartitionKey]
-        public string SchoolCode { get; set; }
+        public string schoolCode { get; set; }
+       // public string shortCode { get; set; }
+        public string profilePicture { get; set; }
+        public string profilePictureUrl { get; set; }
+        public string TEAMModelId { get; set; }
+        public string loginTime { get; set; }
+        public string virtualId { get; set; }
+       // public List<ProductToken> productToken { get; set; }
+
     }
     }
 }
 }
+public class Password {
+    public string value { get; set; }
+    public bool isSet { get; set; }
+    public bool isReset { get; set; }
+}
+//public class ProductToken
+//{
+//    public string station { get; set; }
+//    public string url { get; set; }
+//    public string licenseStatus { get; set; }
+//    public string exp { get; set; }
+//    public string memberId { get; set; }
+//}

+ 1 - 1
TEAMModelOS.Model/BaseInfo/Models/Subjects.cs

@@ -4,7 +4,7 @@ using System.Text;
 
 
 namespace TEAMModelOS.Model.BaseInfo.Models
 namespace TEAMModelOS.Model.BaseInfo.Models
 {
 {
-    public class Subjects
+    public class Subject
     {
     {
         public string Code { get; set; }
         public string Code { get; set; }
         public string Name { get; set; }
         public string Name { get; set; }

+ 0 - 30
TEAMModelOS.Model/Core/Models/Period.cs

@@ -1,30 +0,0 @@
-using Microsoft.WindowsAzure.Storage.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-
-namespace TEAMModelOS.Model.Core.Models
-{
-    [TableSpace(Name = "Core")]
-    public  class Period : TableEntity
-    {
-
-        /// <summary>
-        /// 名称
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 别名
-        /// </summary>
-        public string Alias { get; set; }
-        /// <summary>
-        /// 类型
-        /// </summary>
-        public string Type { get; set; }
-        /// <summary>
-        /// 语言版本
-        /// </summary>
-        public string Lang { get; set; }
-    }
-}

+ 1 - 0
TEAMModelOS.Model/TEAMModelOS.Model.csproj

@@ -10,6 +10,7 @@
     <Folder Include="BaseInfo\Dtos\" />
     <Folder Include="BaseInfo\Dtos\" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
+    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
     <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
     <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>

+ 335 - 0
TEAMModelOS.SDK/Extension/JsonPath/Jsons.cs

@@ -0,0 +1,335 @@
+#region Copyright (c) 2007 Atif Aziz. All rights reserved.
+//
+// C# implementation of JSONPath[1]
+// [1] http://goessner.net/articles/JsonPath/
+//
+// The MIT License
+//
+// Copyright (c) 2007 Atif Aziz . All rights reserved.
+// Portions Copyright (c) 2007 Stefan Goessner (goessner.net)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+#endregion
+
+namespace JsonPath
+{
+    #region Imports
+
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Globalization;
+    using System.Linq;
+    using System.Text;
+    using System.Text.RegularExpressions;
+
+    #endregion
+
+    partial interface IJsonPathValueSystem
+    {
+        bool HasMember(object value, string member);
+        object GetMemberValue(object value, string member);
+        IEnumerable<string> GetMembers(object value);
+        bool IsObject(object value);
+        bool IsArray(object value);
+        bool IsPrimitive(object value);
+    }
+
+    sealed partial class JsonPathContext
+    {
+        public static readonly JsonPathContext Default = new JsonPathContext();
+
+        public Func<string /* script  */,
+                    object /* value   */,
+                    string /* context */,
+                    object /* result  */>
+            ScriptEvaluator
+        { get; set; }
+
+        public IJsonPathValueSystem ValueSystem { get; set; }
+
+        public IEnumerable<object> Select(object obj, string expr) =>
+            SelectNodes(obj, expr, (v, _) => v);
+
+        public IEnumerable<T> SelectNodes<T>(object obj, string expr, Func<object, string, T> resultor)
+        {
+            if (obj == null) throw new ArgumentNullException(nameof(obj));
+            if (resultor == null) throw new ArgumentNullException(nameof(resultor));
+
+            var i = new Interpreter(ValueSystem, ScriptEvaluator);
+
+            expr = Normalize(expr);
+
+            if (expr.Length >= 1 && expr[0] == '$') // ^\$:?
+                expr = expr.Substring(expr.Length >= 2 && expr[1] == ';' ? 2 : 1);
+
+            return i.Trace(expr, obj, "$", (value, path) => resultor(value, AsBracketNotation(path)));
+        }
+
+        static string Normalize(string expr)
+        {
+            var subx = new List<string>();
+            expr = RegExp.Replace(expr, @"[\['](\??\(.*?\))[\]']", m =>
+            {
+                subx.Add(m.Groups[1].Value);
+                return "[#" + (subx.Count - 1).ToString(CultureInfo.InvariantCulture) + "]";
+            });
+            expr = RegExp.Replace(expr, @"'?\.'?|\['?", ";");
+            expr = RegExp.Replace(expr, @";;;|;;", ";..;");
+            expr = RegExp.Replace(expr, @";$|'?\]|'$", string.Empty);
+            expr = RegExp.Replace(expr, @"#([0-9]+)", m =>
+            {
+                var index = int.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture);
+                return subx[index];
+            });
+            return expr;
+        }
+
+        public static string AsBracketNotation(string[] indicies)
+        {
+            if (indicies == null)
+                throw new ArgumentNullException(nameof(indicies));
+
+            var sb = new StringBuilder();
+
+            foreach (var index in indicies)
+            {
+                if (sb.Length == 0)
+                {
+                    sb.Append('$');
+                }
+                else
+                {
+                    sb.Append('[');
+                    if (RegExp.IsMatch(index, @"^[0-9*]+$"))
+                        sb.Append(index);
+                    else
+                        sb.Append('\'').Append(index).Append('\'');
+                    sb.Append(']');
+                }
+            }
+
+            return sb.ToString();
+        }
+
+        static int? TryParseInt(string str) =>
+            int.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out var n)
+            ? n : (int?)null;
+
+        sealed class Interpreter
+        {
+            readonly Func<string, object, string, object> _eval;
+            readonly IJsonPathValueSystem _system;
+
+            static readonly IJsonPathValueSystem DefaultValueSystem = new BasicValueSystem();
+
+            static readonly char[] Colon = { ':' };
+            static readonly char[] Semicolon = { ';' };
+
+            delegate void WalkCallback(object member, string loc, string expr, object value, string path);
+
+            public Interpreter(IJsonPathValueSystem valueSystem, Func<string, object, string, object> eval)
+            {
+                _eval = eval ?? delegate
+                {
+                    // @ symbol in expr must be interpreted specially to resolve
+                    // to value. In JavaScript, the implementation would look
+                    // like:
+                    //
+                    // return obj && value && eval(expr.replace(/@/g, "value"));
+
+                    return null;
+                };
+                _system = valueSystem ?? DefaultValueSystem;
+            }
+
+            sealed class TraceArgs
+            {
+                public readonly string Expr;
+                public readonly object Value;
+                public readonly string Path;
+
+                public TraceArgs(string expr, object value, string path)
+                {
+                    Expr = expr;
+                    Value = value;
+                    Path = path;
+                }
+            }
+
+            public IEnumerable<T> Trace<T>(string expr, object value, string path, Func<object, string[], T> resultor) =>
+                Trace(Args(expr, value, path), resultor);
+
+            static TraceArgs Args(string expr, object value, string path) =>
+                new TraceArgs(expr, value, path);
+
+            IEnumerable<T> Trace<T>(TraceArgs args, Func<object, string[], T> resultor)
+            {
+                var stack = new Stack<TraceArgs>();
+                stack.Push(args);
+
+                while (stack.Count > 0)
+                {
+                    var popped = stack.Pop();
+                    var expr = popped.Expr;
+                    var value = popped.Value;
+                    var path = popped.Path;
+
+                    if (string.IsNullOrEmpty(expr))
+                    {
+                        if (path != null)
+                            yield return resultor(value, path.Split(Semicolon));
+                        continue;
+                    }
+
+                    var i = expr.IndexOf(';');
+                    var atom = i >= 0 ? expr.Substring(0, i) : expr;
+                    var tail = i >= 0 ? expr.Substring(i + 1) : string.Empty;
+
+                    if (value != null && _system.HasMember(value, atom))
+                    {
+                        stack.Push(Args(tail, Index(value, atom), path + ";" + atom));
+                    }
+                    else if (atom == "*")
+                    {
+                        Walk(atom, tail, value, path, (m, l, x, v, p) => stack.Push(Args(m + ";" + x, v, p)));
+                    }
+                    else if (atom == "..")
+                    {
+                        Walk(atom, tail, value, path, (m, l, x, v, p) =>
+                        {
+                            var result = Index(v, m.ToString());
+                            if (result != null && !_system.IsPrimitive(result))
+                                stack.Push(Args("..;" + x, result, p + ";" + m));
+                        });
+                        stack.Push(Args(tail, value, path));
+                    }
+                    else if (atom.Length > 2 && atom[0] == '(' && atom[atom.Length - 1] == ')') // [(exp)]
+                    {
+                        stack.Push(Args(_eval(atom, value, path.Substring(path.LastIndexOf(';') + 1)) + ";" + tail, value, path));
+                    }
+                    else if (atom.Length > 3 && atom[0] == '?' && atom[1] == '(' && atom[atom.Length - 1] == ')') // [?(exp)]
+                    {
+                        Walk(atom, tail, value, path, (m, l, x, v, p) =>
+                        {
+                            var result = _eval(RegExp.Replace(l, @"^\?\((.*?)\)$", "$1"),
+                                Index(v, m.ToString()), m.ToString());
+
+                            if (Convert.ToBoolean(result, CultureInfo.InvariantCulture))
+                                stack.Push(Args(m + ";" + x, v, p));
+                        });
+                    }
+                    else if (RegExp.IsMatch(atom, @"^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$")) // [start:end:step] Phyton slice syntax
+                    {
+                        foreach (var a in Slice(atom, tail, value, path).Reverse())
+                            stack.Push(a);
+                    }
+                    else if (atom.IndexOf(',') >= 0) // [name1,name2,...]
+                    {
+                        foreach (var part in RegExp.Split(atom, @"'?,'?").Reverse())
+                            stack.Push(Args(part + ";" + tail, value, path));
+                    }
+                }
+            }
+
+            void Walk(string loc, string expr, object value, string path, WalkCallback callback)
+            {
+                if (_system.IsPrimitive(value))
+                    return;
+
+                if (_system.IsArray(value))
+                {
+                    var list = (IList)value;
+                    for (var i = list.Count - 1; i >= 0; i--)
+                        callback(i, loc, expr, value, path);
+                }
+                else if (_system.IsObject(value))
+                {
+                    foreach (var key in _system.GetMembers(value).Reverse())
+                        callback(key, loc, expr, value, path);
+                }
+            }
+
+            static IEnumerable<TraceArgs> Slice(string loc, string expr, object value, string path)
+            {
+                if (!(value is IList list))
+                    yield break;
+
+                var length = list.Count;
+                var parts = loc.Split(Colon);
+                var start = TryParseInt(parts[0]) ?? 0;
+                var end = TryParseInt(parts[1]) ?? list.Count;
+                var step = parts.Length > 2 ? TryParseInt(parts[2]) ?? 1 : 1;
+                start = (start < 0) ? Math.Max(0, start + length) : Math.Min(length, start);
+                end = (end < 0) ? Math.Max(0, end + length) : Math.Min(length, end);
+                for (var i = start; i < end; i += step)
+                    yield return Args(i + ";" + expr, value, path);
+            }
+
+            object Index(object obj, string member) =>
+                _system.GetMemberValue(obj, member);
+        }
+
+        static class RegExp
+        {
+            const RegexOptions Options = RegexOptions.ECMAScript;
+
+            public static bool IsMatch(string input, string pattern) =>
+                Regex.IsMatch(input, pattern, Options);
+
+            public static string Replace(string input, string pattern, string replacement) =>
+                Regex.Replace(input, pattern, replacement, Options);
+
+            public static string Replace(string input, string pattern, MatchEvaluator evaluator) =>
+                Regex.Replace(input, pattern, evaluator, Options);
+
+            public static IEnumerable<string> Split(string input, string pattern) =>
+                Regex.Split(input, pattern, Options);
+        }
+
+        sealed class BasicValueSystem : IJsonPathValueSystem
+        {
+            public bool HasMember(object value, string member) =>
+                !IsPrimitive(value)
+                && (value is IDictionary dict
+                    ? dict.Contains(member)
+                    : value is IList list
+                      && TryParseInt(member) is int i && i >= 0 && i < list.Count);
+
+            public object GetMemberValue(object value, string member)
+                => IsPrimitive(value) ? throw new ArgumentException(null, nameof(value))
+                 : value is IDictionary dict ? dict[member]
+                 : !(value is IList list) ? throw new ArgumentException(nameof(value))
+                 : TryParseInt(member) is int i && i >= 0 && i < list.Count ? list[i]
+                 : null;
+
+            public IEnumerable<string> GetMembers(object value) =>
+                ((IDictionary)value).Keys.Cast<string>();
+
+            public bool IsObject(object value) => value is IDictionary;
+            public bool IsArray(object value) => value is IList;
+
+            public bool IsPrimitive(object value) =>
+                value == null
+                ? throw new ArgumentNullException(nameof(value))
+                : Type.GetTypeCode(value.GetType()) != TypeCode.Object;
+        }
+    }
+}

+ 9 - 0
TEAMModelOS.SDK/Helper/Security/ShaHash/ShaHashHelper.cs

@@ -133,5 +133,14 @@ namespace TEAMModelOS.SDK.Helper.Security.ShaHash
             return builder.ToString();
             return builder.ToString();
             //return Convert.ToBase64String(resbuffer);
             //return Convert.ToBase64String(resbuffer);
         }
         }
+
+        private static string GetSHA256AndBase64(string s)
+        {
+            SHA256 sha256 = new SHA256CryptoServiceProvider();//建立一個SHA256
+            byte[] source = Encoding.Default.GetBytes(s);//將字串轉為Byte[]
+            byte[] crypto = sha256.ComputeHash(source);//進行SHA256加密
+            string resultSha256 = Convert.ToBase64String(crypto);
+            return resultSha256;
+        }
     }
     }
 }
 }

+ 3 - 3
TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs

@@ -277,7 +277,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
 
 
 
 
 
 
-            public async Task<List<T>> FindByparams<T>(Dictionary<string, object> dict)
+            public async Task<List<T>> FindByParams<T>(Dictionary<string, object> dict)
             {
             {
                 //await InitializeCollection<T>();
                 //await InitializeCollection<T>();
                 Type t = typeof(T);
                 Type t = typeof(T);
@@ -467,7 +467,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                         updateOperations.Add(new UnsetUpdateOperation(key));
                         updateOperations.Add(new UnsetUpdateOperation(key));
                     }
                     }
                 }
                 }
-                List<T> list = await FindByparams<T>(dict);
+                List<T> list = await FindByParams<T>(dict);
                 int pageSize = 100;
                 int pageSize = 100;
                 int pages = (int)Math.Ceiling((double)list.Count / pageSize);
                 int pages = (int)Math.Ceiling((double)list.Count / pageSize);
                 string partitionKey = "/" + GetPartitionKey<T>();
                 string partitionKey = "/" + GetPartitionKey<T>();
@@ -516,7 +516,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
             public async Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict)
             public async Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict)
             {
             {
                 DocumentCollection dataCollection = await InitializeCollection<T>();
                 DocumentCollection dataCollection = await InitializeCollection<T>();
-                List<T> list = await FindByparams<T>(dict);
+                List<T> list = await FindByParams<T>(dict);
                 List<Tuple<string, string>> pkIdTuplesToDelete = new List<Tuple<string, string>>();
                 List<Tuple<string, string>> pkIdTuplesToDelete = new List<Tuple<string, string>>();
                 if (list.IsNotEmpty())
                 if (list.IsNotEmpty())
                 {
                 {

+ 1 - 1
TEAMModelOS.SDK/Module/AzureCosmosDB/Interfaces/IAzureCosmosDBRepository.cs

@@ -19,7 +19,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces
         Task<List<T>> FindSQL<T>(string sql);
         Task<List<T>> FindSQL<T>(string sql);
         Task<List<T>> FindSQL<T>(string sql, bool isPK);
         Task<List<T>> FindSQL<T>(string sql, bool isPK);
         Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault);
         Task<List<T>> FindLinq<T>(Func<IQueryable<object>, object> singleOrDefault);
-        Task<List<T>> FindByparams<T>(Dictionary<string, object> dict);
+        Task<List<T>> FindByParams<T>(Dictionary<string, object> dict);
         Task<List<T>> SaveAll<T>(List<T> enyites);
         Task<List<T>> SaveAll<T>(List<T> enyites);
         Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null);
         Task<List<T>> UpdateAll<T>(Dictionary<string, object> dict, Dictionary<string, object> updateFilters, List<string> deleteKeys = null);
         Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict);
         Task<List<T>> DeleteALl<T>(Dictionary<string, object> dict);

+ 1 - 1
TEAMModelOS.Service/Core/Implements/ClassRoomService.cs

@@ -31,7 +31,7 @@ namespace TEAMModelOS.Service.Core.Implements
         public async Task<List<Classroom>> FindClassInfo(Dictionary<string, object> code)
         public async Task<List<Classroom>> FindClassInfo(Dictionary<string, object> code)
         {
         {
 
 
-            return await _cosmosrepository.FindByparams<Classroom>(code);
+            return await _cosmosrepository.FindByParams<Classroom>(code);
         }
         }
     }
     }
 }
 }

+ 1 - 1
TEAMModelOS.Service/Core/Implements/LoginInfoService.cs

@@ -68,7 +68,7 @@ namespace TEAMModelOS.Service.Core.Implements
                     Ticket = ticketInfo.Ticket,
                     Ticket = ticketInfo.Ticket,
                     CountryCode ="86"
                     CountryCode ="86"
                 };
                 };
-                List<TeamModelUser> users = await repository.FindByparams<TeamModelUser>(new Dictionary<string, object>() { { "TeamModelId", ticketInfo.TeamModelId } });
+                List<TeamModelUser> users = await repository.FindByParams<TeamModelUser>(new Dictionary<string, object>() { { "TeamModelId", ticketInfo.TeamModelId } });
                 TeamModelUser user = new TeamModelUser();
                 TeamModelUser user = new TeamModelUser();
                 if (users.IsEmpty())
                 if (users.IsEmpty())
                 {
                 {

+ 4 - 4
TEAMModelOS.Service/Core/Implements/SchoolSystemService.cs

@@ -16,20 +16,20 @@ namespace TEAMModelOS.Service.Core.Implements
             _cosmosrepository = cosmosDBRepository;
             _cosmosrepository = cosmosDBRepository;
         }
         }
 
 
-        public async Task<List<SchoolSystem>> FindSchoolInfo(Dictionary<string, object> code)
+        public async Task<List<School>> FindSchoolInfo(Dictionary<string, object> code)
         {
         {
                      
                      
-            return await _cosmosrepository.FindByparams<SchoolSystem>(code);           
+            return await _cosmosrepository.FindByParams<School>(code);           
         }
         }
 
 
-        public async Task<SchoolSystem> SaveToCosmosDB(SchoolSystem system)
+        public async Task<School> SaveToCosmosDB(School system)
         {           
         {           
             await _cosmosrepository.Save(system);
             await _cosmosrepository.Save(system);
             return system;
             return system;
             
             
         }
         }
 
 
-        public async Task<SchoolSystem> UpdateSchool(SchoolSystem system)
+        public async Task<School> UpdateSchool(School system)
         {
         {
             await _cosmosrepository.ReplaceObject(system, system.Id,system.Code);
             await _cosmosrepository.ReplaceObject(system, system.Id,system.Code);
             return system;
             return system;

+ 3 - 3
TEAMModelOS.Service/Core/Interfaces/ISchoolSystemService.cs

@@ -8,8 +8,8 @@ namespace TEAMModelOS.Service.Core.Interfaces
 {
 {
     public interface ISchoolSystemService : IBusinessService, IBaseService
     public interface ISchoolSystemService : IBusinessService, IBaseService
     {
     {
-        Task<SchoolSystem> SaveToCosmosDB(SchoolSystem system);
-        Task<SchoolSystem> UpdateSchool(SchoolSystem system);
-        Task<List<SchoolSystem>> FindSchoolInfo(Dictionary<string, object> code);
+        Task<School> SaveToCosmosDB(School system);
+        Task<School> UpdateSchool(School system);
+        Task<List<School>> FindSchoolInfo(Dictionary<string, object> code);
     }
     }
 }
 }

+ 1 - 1
TEAMModelOS.Service/Evaluation/Implements/TestPaperService.cs

@@ -21,7 +21,7 @@ namespace TEAMModelOS.Service.Evaluation.Implements
 
 
         public async Task<List<TestPaper>> FindPapersAsync(Dictionary<string, object> paper)
         public async Task<List<TestPaper>> FindPapersAsync(Dictionary<string, object> paper)
         {
         {
-            return await _cosmosrepository.FindByparams<TestPaper>(paper);
+            return await _cosmosrepository.FindByParams<TestPaper>(paper);
         }
         }
 
 
         public async Task<TestPaper> Save(TestPaperDto dto)
         public async Task<TestPaper> Save(TestPaperDto dto)

+ 5 - 3
TEAMModelOS/Controllers/Core/SchoolSystemController.cs

@@ -21,10 +21,10 @@ namespace TEAMModelOS.Controllers.Core
             
             
         }
         }
         [HttpPost("SaveOrUpdateAll")]
         [HttpPost("SaveOrUpdateAll")]
-        public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<SchoolSystem> request)
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<School> request)
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            SchoolSystem data = new SchoolSystem();
+            School data = new School();
             if (request.@params.Id != null)
             if (request.@params.Id != null)
             {
             {
                 data = await schoolSystemService.UpdateSchool(request.@params);
                 data = await schoolSystemService.UpdateSchool(request.@params);
@@ -38,9 +38,11 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSchoolSystem")]
         [HttpPost("FindSchoolSystem")]
         public async Task<BaseJosnRPCResponse> GetSchoolInfo(JosnRPCRequest<Dictionary<string, object>> request) {
         public async Task<BaseJosnRPCResponse> GetSchoolInfo(JosnRPCRequest<Dictionary<string, object>> request) {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SchoolSystem> sc = await schoolSystemService.FindSchoolInfo(request.@params);
+            List<School> sc = await schoolSystemService.FindSchoolInfo(request.@params);
             //sc.First
             //sc.First
             return builder.Data(sc).build();
             return builder.Data(sc).build();
         }
         }
+       
+
     }
     }
 }
 }

+ 9 - 9
TEAMModelOS/Controllers/Core/StudentInfoController.cs

@@ -36,19 +36,19 @@ namespace TEAMModelOS.Controllers.Core
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             Dictionary<string, List<StudentInfo>> dictInfo = new Dictionary<string, List<StudentInfo>>();
             Dictionary<string, List<StudentInfo>> dictInfo = new Dictionary<string, List<StudentInfo>>();
-            foreach (IGrouping<string, StudentInfo> group in request.@params.GroupBy(c => c.ClassroomCode))
-            {
-                dictInfo.Add(group.Key, group.ToList());
-            }
+            //foreach (IGrouping<string, StudentInfo> group in request.@params.GroupBy(c => c.ClassroomCode))
+            //{
+            //    dictInfo.Add(group.Key, group.ToList());
+            //}
             List<StudentInfo> studentInfos = new List<StudentInfo>();
             List<StudentInfo> studentInfos = new List<StudentInfo>();
             foreach (string key in dictInfo.Keys) {
             foreach (string key in dictInfo.Keys) {
-                List<Classroom> classroom= await azureCosmosDBRepository.FindByparams<Classroom>(new Dictionary<string, object> { { "ClassroomCode", key } });
+                List<Classroom> classroom= await azureCosmosDBRepository.FindByParams<Classroom>(new Dictionary<string, object> { { "ClassroomCode", key } });
                 if (classroom.IsNotEmpty()) {
                 if (classroom.IsNotEmpty()) {
                     dictInfo.TryGetValue(key, out List<StudentInfo> sts);
                     dictInfo.TryGetValue(key, out List<StudentInfo> sts);
-                    sts.ForEach(x => { x.GradeCode = classroom[0].Grade;
-                        x.PeriodCode = classroom[0].Period;
-                        x.SchoolCode = classroom[0].SchoolCode;
-                    });
+                    //sts.ForEach(x => { x.GradeCode = classroom[0].Grade;
+                    //    x.PeriodCode = classroom[0].Period;
+                    //    x.SchoolCode = classroom[0].SchoolCode;
+                    //});
                     List<StudentInfo> data = await azureCosmosDBRepository.SaveAll<StudentInfo>(sts);
                     List<StudentInfo> data = await azureCosmosDBRepository.SaveAll<StudentInfo>(sts);
                     studentInfos.AddRange(data);
                     studentInfos.AddRange(data);
                 }
                 }

+ 45 - 4
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -5,11 +5,14 @@ using System.Collections.Generic;
 using System.Reflection;
 using System.Reflection;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.Controllers.Core;
 using TEAMModelOS.Controllers.Core;
+using TEAMModelOS.Model.BaseInfo.Models;
 using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Dtos;
 using TEAMModelOS.Model.Syllabus.Dtos;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.Service.Syllabus.Interfaces;
 using TEAMModelOS.Service.Syllabus.Interfaces;
 
 
 namespace TEAMModelOS.Controllers.Syllabus
 namespace TEAMModelOS.Controllers.Syllabus
@@ -19,12 +22,13 @@ namespace TEAMModelOS.Controllers.Syllabus
     [Authorize]
     [Authorize]
     public class SyllabusController: BaseController
     public class SyllabusController: BaseController
     {
     {
-        private readonly ISyllabusService syllabusService; 
-
+        private readonly ISyllabusService syllabusService;
+        private readonly IAzureCosmosDBRepository azureCosmosDBRepository;
         // HttpClientService httpClientService;
         // HttpClientService httpClientService;
-        public SyllabusController(ISyllabusService _syllabusService) {
+        public SyllabusController(ISyllabusService _syllabusService , IAzureCosmosDBRepository _azureCosmosDBRepository) {
             //httpClientService = _HttpClientService;
             //httpClientService = _HttpClientService;
             syllabusService = _syllabusService;
             syllabusService = _syllabusService;
+            azureCosmosDBRepository = _azureCosmosDBRepository;
         }
         }
         [HttpPost("SaveOrUpdateAll")]
         [HttpPost("SaveOrUpdateAll")]
         public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<List<SyllabusTree>> request )
         public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<List<SyllabusTree>> request )
@@ -66,6 +70,43 @@ namespace TEAMModelOS.Controllers.Syllabus
             }
             }
             return builder.Data(data).build();
             return builder.Data(data).build();
         }
         }
-
+        /// <summary>
+        /// 根据课纲的业务获取
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("GetSchoolInfoAsSyllabus")]
+        public async Task<BaseJosnRPCResponse> GetSchoolInfoAsSyllabus(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (request.@params != null && request.@params.TryGetValue("Code", out _))
+            {
+                List<Model.BaseInfo.Models.School> schoolSystems = await azureCosmosDBRepository.FindByParams<Model.BaseInfo.Models.School>(request.@params);
+                List<dynamic> plist = new List<dynamic>();
+                if (schoolSystems.IsNotEmpty()) {
+                    List<Period> periods=  schoolSystems[0].Period;
+                    foreach (Period period in periods) {
+                        List<dynamic> slist = new List<dynamic>();
+                        foreach (Subject subject in period.Subjects) {
+                            List<dynamic> mlist = new List<dynamic>();
+                            foreach (Semester semester in period.Semesters)
+                            {
+                                dynamic sem = new { semester.Name , semester.Code };
+                                mlist.Add(sem);
+                            }
+                            dynamic sub = new { semester = mlist, subject.Name, subject.Code };
+                            slist.Add(sub);
+                        }
+                        dynamic per = new { subject = slist, period.Name, period.Code };
+                        plist.Add(per);
+                    }
+                }
+                return builder.Data(plist).build();
+            }
+            else
+            {
+                return builder.Error("SchoolCode is null or empty!", "SchoolCode is null or empty!").build();
+            }
+        }
     }
     }
 }
 }