Browse Source

Merge remote-tracking branch 'origin/develop' into develop

osbert 6 years ago
parent
commit
fbddd495fa
56 changed files with 1276 additions and 586 deletions
  1. 1 0
      TEAMModelOS.Model/Core/Dtos/RootUser.cs
  2. 1 0
      TEAMModelOS.Model/Core/Models/RoleIdentityClaim.cs
  3. 22 0
      TEAMModelOS.Model/Core/Models/RoleIdentityClaimValue.cs
  4. 2 2
      TEAMModelOS.Model/Core/Models/RoleUser.cs
  5. 3 3
      TEAMModelOS.Model/Core/Models/SchoolClass.cs
  6. 22 0
      TEAMModelOS.Model/Core/Models/SchoolSubject.cs
  7. 12 0
      TEAMModelOS.Model/Core/Models/SchoolTerm.cs
  8. 76 0
      TEAMModelOS.Model/Syllabus/Models/SchoolVolume.cs
  9. 61 0
      TEAMModelOS.Model/Syllabus/Models/Volume.cs
  10. 21 0
      TEAMModelOS.Model/Syllabus/Models/VolumeEditor.cs
  11. 1 0
      TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/BaseJosnRPCRequest.cs
  12. 56 3
      TEAMModelOS.SDK/Helper/Common/DateTimeHelper/DateTimeHelper.cs
  13. 38 32
      TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs
  14. 2 2
      TEAMModelOS.SDK/Module/AzureTable/Configuration/AzureTableServiceCollectionExtensions.cs
  15. 60 17
      TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs
  16. 38 0
      TEAMModelOS.Service/Core/Implements/BaseService.cs
  17. 5 39
      TEAMModelOS.Service/Core/Implements/GradeService.cs
  18. 25 20
      TEAMModelOS.Service/Core/Implements/LoginInfoService.cs
  19. 3 42
      TEAMModelOS.Service/Core/Implements/PeriodService.cs
  20. 3 39
      TEAMModelOS.Service/Core/Implements/RoleService.cs
  21. 9 8
      TEAMModelOS.Service/Core/Implements/SchoolService.cs
  22. 3 42
      TEAMModelOS.Service/Core/Implements/SubjectService.cs
  23. 11 0
      TEAMModelOS.Service/Core/Implements/TermService.cs
  24. 15 0
      TEAMModelOS.Service/Core/Interfaces/IBaseService.cs
  25. 7 5
      TEAMModelOS.Service/Core/Interfaces/IGradeService.cs
  26. 2 1
      TEAMModelOS.Service/Core/Interfaces/ILoginInfoService.cs
  27. 7 5
      TEAMModelOS.Service/Core/Interfaces/IPeriodService.cs
  28. 6 5
      TEAMModelOS.Service/Core/Interfaces/IRoleService.cs
  29. 2 1
      TEAMModelOS.Service/Core/Interfaces/ISchoolService.cs
  30. 7 6
      TEAMModelOS.Service/Core/Interfaces/ISubjectService.cs
  31. 10 0
      TEAMModelOS.Service/Core/Interfaces/ITermService.cs
  32. 2 4
      TEAMModelOS.Service/Syllabus/Implements/SyllabusService.cs
  33. 12 0
      TEAMModelOS.Service/Syllabus/Implements/VolumeService.cs
  34. 11 0
      TEAMModelOS.Service/Syllabus/Interfaces/IVolumeService.cs
  35. 2 2
      TEAMModelOS/ClientApp/app.js
  36. 90 49
      TEAMModelOS/ClientApp/common/Syllabus.vue
  37. 1 1
      TEAMModelOS/ClientApp/locale/index.js
  38. 3 1
      TEAMModelOS/ClientApp/router/index.js
  39. 33 17
      TEAMModelOS/ClientApp/store/api.js
  40. 2 2
      TEAMModelOS/ClientApp/utils/http.js
  41. 17 9
      TEAMModelOS/ClientApp/view/index.vue
  42. 15 7
      TEAMModelOS/Controllers/Core/GradeController.cs
  43. 16 4
      TEAMModelOS/Controllers/Core/PeriodController.cs
  44. 47 6
      TEAMModelOS/Controllers/Core/RoleController.cs
  45. 1 1
      TEAMModelOS/Controllers/Core/SchoolController.cs
  46. 2 2
      TEAMModelOS/Controllers/Core/SeedDataController.cs
  47. 19 6
      TEAMModelOS/Controllers/Core/SubjectController.cs
  48. 53 0
      TEAMModelOS/Controllers/Core/TermController.cs
  49. 55 0
      TEAMModelOS/Controllers/Syllabus/VolumeController.cs
  50. 3 27
      TEAMModelOS/Controllers/ValuesController.cs
  51. 50 25
      TEAMModelOS/JsonFile/Core/RoleClaim.json
  52. 1 0
      TEAMModelOS/SeedData/RoleClaim.cs
  53. 178 78
      TEAMModelOS/SeedData/SeedDataService.cs
  54. 38 20
      TEAMModelOS/appsettings.Development.json
  55. 91 53
      TEAMModelOS/appsettings.json
  56. 3 0
      TeamModelOS.Test.JsonPath/Program.cs

+ 1 - 0
TEAMModelOS.Model/Core/Dtos/RootUser.cs

@@ -9,5 +9,6 @@ namespace TEAMModelOS.Model.Core.Dtos
         public string NickName { get; set; }
         public string TeamModelId { get; set; }
         public string Phone { get; set; }
+        public string AreaCode { get; set; }
     }
 }

+ 1 - 0
TEAMModelOS.Model/Core/Models/RoleIdentityClaim.cs

@@ -14,5 +14,6 @@ namespace TEAMModelOS.Model.Core.Models
         public int RoleLevel { get; set; }
         public string RoleLevelName { get; set; }
         public string ClaimType { get; set; }
+        public int Order { get; set; }
     }
 }

+ 22 - 0
TEAMModelOS.Model/Core/Models/RoleIdentityClaimValue.cs

@@ -0,0 +1,22 @@
+using MessagePack;
+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")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class RoleIdentityClaimValue :TableEntity
+    {
+        public string TeamModelId { get; set; }
+        public string RoleCode { get; set; }
+        public string ClaimType { get; set; }
+        public string ClaimCode { get; set; }
+        public int ClaimOrder { get; set; }
+        public string GroupKey { get; set; }
+        public string ClaimName { get; set; }
+    }
+}

+ 2 - 2
TEAMModelOS.Model/Core/Models/RoleUser.cs

@@ -17,7 +17,7 @@ namespace TEAMModelOS.Model.Core.Models
         public string TeamModelId { get; set; }
         public string RoleCode { get; set; }
         public string RoleName { get; set; }
-        //public string SchoolCode { get; set; }
-        //public string SchoolName { get; set; }
+        public string AreaCode { get; set; }
+        
     }
 }

+ 3 - 3
TEAMModelOS.Model/Core/Models/SchoolClass.cs

@@ -46,7 +46,7 @@ namespace TEAMModelOS.Model.Core.Models
         /// <summary>
         /// 年级编码   1 2 3 4 5 6 
         /// </summary>
-        public string GradeCode { get; set; }
+        public int GradeCode { get; set; }
         /// <summary>
         /// 年级名称  一年级 二年级
         /// </summary>
@@ -54,7 +54,7 @@ namespace TEAMModelOS.Model.Core.Models
         /// <summary>
         /// 绑定 届数code  2019
         /// </summary>
-        public string SessionCode { get; set; }
+        public int SessionCode { get; set; }
         /// <summary>
         /// 绑定 届数  2019届
         /// </summary>
@@ -62,7 +62,7 @@ namespace TEAMModelOS.Model.Core.Models
         /// <summary>
         /// 绑定学期code
         /// </summary>
-        public string TermCode { get; set; }
+        public int TermCode { get; set; }
         /// <summary>
         /// 绑定学期名称
         /// </summary>

+ 22 - 0
TEAMModelOS.Model/Core/Models/SchoolSubject.cs

@@ -2,6 +2,7 @@
 using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
@@ -11,9 +12,30 @@ namespace TEAMModelOS.Model.Core.Models
     [MessagePackObject(keyAsPropertyName: true)]
     public class SchoolSubject :TableEntity
     {
+        /// <summary>
+        /// 学科名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
         public string Name { get; set; }
+        /// <summary>
+        /// 学科编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
         public string Code { get; set; }
+        /// <summary>
+        /// 学校编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
         public string SchoolCode { get; set; }
+        /// <summary>
+        /// 学校名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
         public string SchoolName { get; set; }
+        /// <summary>
+        /// 删除状态
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public int Status { get; set; } = 1;
     }
 }

+ 12 - 0
TEAMModelOS.Model/Core/Models/SchoolTerm.cs

@@ -11,9 +11,21 @@ namespace TEAMModelOS.Model.Core.Models
     [MessagePackObject(keyAsPropertyName: true)]
     public class SchoolTerm :TableEntity
     {
+        /// <summary>
+        /// 学期名称
+        /// </summary>
         public string Name { get; set; }
+        /// <summary>
+        /// 学期编码
+        /// </summary>
         public int Code { get; set; }
+        /// <summary>
+        /// 学校编码
+        /// </summary>
         public string SchoolCode { get; set; }
+        /// <summary>
+        /// 学校名称
+        /// </summary>
         public string SchoolName { get; set; }
     }
 }

+ 76 - 0
TEAMModelOS.Model/Syllabus/Models/SchoolVolume.cs

@@ -0,0 +1,76 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Syllabus.Models
+{
+    [TableSpace(Name = "Syllabus")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class SchoolVolume : TableEntity
+    {
+        /// <summary>
+        /// 册别名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string Name { get; set; }
+        /// <summary>
+        /// 学段编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string PeriodCode { get; set; }
+        /// <summary>
+        /// 学段名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string PeriodName { get; set; }
+        /// <summary>
+        /// 年级编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public int GradeCode { get; set; }
+        /// <summary>
+        /// 年级名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string GradeName { get; set; }
+        /// <summary>
+        /// 学期编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public int TermCode { get; set; }
+        /// <summary>
+        /// 学期名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string TermName { get; set; }
+        /// <summary>
+        /// 科目编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SubjectCode { get; set; }
+        /// <summary>
+        /// 科目名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SubjectName { get; set; }
+        /// <summary>
+        /// 学校编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SchoolCode { get; set; }
+        /// <summary>
+        /// 学校名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SchoolName { get; set; }
+        /// <summary>
+        /// 状态
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public int Status { get; set; } = 1;
+    }
+}

+ 61 - 0
TEAMModelOS.Model/Syllabus/Models/Volume.cs

@@ -0,0 +1,61 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Syllabus.Models
+{
+    [TableSpace(Name = "Syllabus")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class Volume : TableEntity
+    {
+        /// <summary>
+        /// 册别名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string Name { get; set; }
+        /// <summary>
+        /// 学段编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string PeriodCode { get; set; }
+        /// <summary>
+        /// 学段名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string PeriodName { get; set; }
+        /// <summary>
+        /// 年级编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string GradeCode { get; set; }
+        /// <summary>
+        /// 年级名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string GradeName { get; set; }
+        /// <summary>
+        /// 学期编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string TermCode { get; set; }
+        /// <summary>
+        /// 学期名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string TermName { get; set; }
+        /// <summary>
+        /// 科目编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SubjectCode { get; set; }
+        /// <summary>
+        /// 科目名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string SubjectName { get; set; }
+    }
+}

+ 21 - 0
TEAMModelOS.Model/Syllabus/Models/VolumeEditor.cs

@@ -0,0 +1,21 @@
+using MessagePack;
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+
+namespace TEAMModelOS.Model.Syllabus.Models
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    [TableSpace(Name = "Syllabus")]
+    [MessagePackObject(keyAsPropertyName: true)]
+    public class VolumeEditor : TableEntity
+    {
+        public string VolumeCode { get; set; }
+        public string TeamModelId { get; set; }
+        public string TeamModelName { get; set; }
+    }
+}

+ 1 - 0
TEAMModelOS.SDK/Extension/DataResult/JsonRpcRequest/BaseJosnRPCRequest.cs

@@ -11,5 +11,6 @@ namespace TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest
         public string method { get; set; }
         public int id { get; set; } = 1;
         public int timeOffset { get; set; }
+        public string lang { get; set; } = "zh-CN";
     }
 }

+ 56 - 3
TEAMModelOS.SDK/Helper/Common/DateTimeHelper/DateTimeHelper.cs

@@ -75,8 +75,62 @@ namespace TEAMModelOS.SDK.Helper.Common.DateTimeHelper
         {
             return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
         }
-
-
+        /// <summary>
+        /// 获取当前年
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentYear()
+        {
+            return DateTime.Now.Year;
+        }
+        /// <summary>
+        /// 获取当前月份
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentMonth()
+        {
+            return DateTime.Now.Month;
+        }
+        /// <summary>
+        /// 获取星期几
+        /// </summary>
+        /// <returns></returns>
+        public static DayOfWeek GetCurrentDayOfWeek()
+        {
+            return DateTime.Now.DayOfWeek;
+        }
+        /// <summary>
+        /// 获取本年第几天
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentDayOfYear()
+        {
+            return DateTime.Now.DayOfYear;
+        }
+        /// <summary>
+        /// 获取当前小时
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentHour()
+        {
+            return DateTime.Now.Hour;
+        }
+        /// <summary>
+        /// 获取当前分钟
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentMinute()
+        {
+            return DateTime.Now.Minute;
+        }
+        /// <summary>
+        /// 获取当前秒
+        /// </summary>
+        /// <returns></returns>
+        public static int GetCurrentSecond()
+        {
+            return DateTime.Now.Second;
+        }
         /// <summary>
         /// 获得 GMT+8 时间
         /// </summary>
@@ -86,7 +140,6 @@ namespace TEAMModelOS.SDK.Helper.Common.DateTimeHelper
 
             TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");//设置时区
             DateTime easternTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, easternZone);
-
             return easternTime;
         }
 

+ 38 - 32
TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs

@@ -41,8 +41,8 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
             private DocumentClient CosmosClient { get; set; }
             private DocumentCollection CosmosCollection { get; set; }
 
-            private string _Database { get; set; }
-            private int _CollectionThroughput { get; set; }
+            private string  Database { get; set; }
+            private int CollectionThroughput { get; set; }
             public AzureCosmosDBRepository(AzureCosmosDBOptions options)
             {
                 try
@@ -65,9 +65,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                     {
                         throw new BizException("请设置正确的AzureCosmosDB数据库配置信息!");
                     }
-                    _Database = options.Database;
-                    _CollectionThroughput = options.CollectionThroughput;
-                    CosmosClient.CreateDatabaseIfNotExistsAsync(new Database { Id = _Database });
+                    Database = options.Database;
+                CollectionThroughput = options.CollectionThroughput;
+                    CosmosClient.CreateDatabaseIfNotExistsAsync(new Database { Id = Database });
                     // _connectionString = options.ConnectionString;
                 }
                 catch (DocumentClientException de)
@@ -102,9 +102,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                         collectionDefinition.PartitionKey.Paths.Add("/" + partitionKey);
 
                     }
-                    // CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri(_Database), collectionDefinition);
+                    // CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri(Database), collectionDefinition);
                     CosmosCollection = await this.CosmosClient.CreateDocumentCollectionIfNotExistsAsync(
-                        UriFactory.CreateDatabaseUri(_Database), collectionDefinition, new RequestOptions { OfferThroughput = _CollectionThroughput }
+                        UriFactory.CreateDatabaseUri(Database), collectionDefinition, new RequestOptions { OfferThroughput = CollectionThroughput }
                         );
                 }
 
@@ -118,6 +118,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 List<PropertyInfo> attrProperties = new List<PropertyInfo>();
                 foreach (PropertyInfo property in properties)
                 {
+                    if (property.Name.Equals("PartitionKey"))
+                    {
+                        attrProperties.Add(property);
+                        break;
+                    }
                     object[] attributes = property.GetCustomAttributes(true);
                     foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
                     {
@@ -146,7 +151,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 Type t = typeof(T);
                 DocumentCollection documentCollection = await InitializeCollection<T>();
                 ResourceResponse<Document> doc =
-                    await CosmosClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
+                    await CosmosClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(Database, t.Name), entity);
                 //Console.WriteLine(doc.ActivityId);
 
 
@@ -158,7 +163,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 Type t = typeof(T);
                 await InitializeCollection<T>();
                 ResourceResponse<Document> doc =
-                    await CosmosClient.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), entity);
+                    await CosmosClient.UpsertDocumentAsync(UriFactory.CreateDocumentCollectionUri(Database, t.Name), entity);
                 return entity;
             }
             public async Task<string> ReplaceObject<T>(T entity, string key)
@@ -168,7 +173,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 try
                 {
                     ResourceResponse<Document> doc =
-                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, key), entity);
+                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, key), entity);
                     return key;
                 }
                 catch (Exception e)
@@ -187,7 +192,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 try
                 {
                     ResourceResponse<Document> doc =
-                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, key),
+                    await CosmosClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, key),
                     entity,
                     new RequestOptions { PartitionKey = new PartitionKey(partitionKey) });
                     return key;
@@ -210,7 +215,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 //await InitializeCollection<T>();
                 //查询条数 -1是全部
                 FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions).AsDocumentQuery();
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name), queryOptions).AsDocumentQuery();
                 while (query.HasMoreResults)
                 {
                     foreach (T obj in await query.ExecuteNextAsync())
@@ -219,7 +224,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                     }
                 }
                 return objs;
-                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name),sql);
 
             }
 
@@ -231,11 +236,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 await InitializeCollection<T>();
                 //查询条数 -1是全部
                 FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 };
-                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name), queryOptions);
 
                 //  query.Where();
                 return objs;
-                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name),sql);
 
             }
 
@@ -244,7 +249,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 Type t = typeof(T);
                 List<T> objs = new List<T>();
                 await InitializeCollection<T>();
-                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql);
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name), sql);
                 foreach (var item in query)
                 {
                     objs.Add(item);
@@ -261,7 +266,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 await InitializeCollection<T>();
                 //查询条数 -1是全部
                 FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), sql, queryOptions);
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name), sql, queryOptions);
                 foreach (var item in query)
                 {
                     objs.Add(item);
@@ -281,7 +286,6 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
 
                 string PKname = "";
                 PropertyInfo[] properties = t.GetProperties();
-                List<PropertyInfo> attrProperties = new List<PropertyInfo>();
                 foreach (PropertyInfo property in properties)
                 {
                     object[] attributes = property.GetCustomAttributes(true);
@@ -313,11 +317,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 await InitializeCollection<T>();
                 //查询条数 -1是全部
                 FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = open };
-                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name), queryOptions);
+                var query = CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name), queryOptions);
 
                 List<T> list = DynamicLinq.GenerateFilter<T>(query, filters).ToList();
                 return list;
-                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(_Database, t.Name),sql);
+                //return CosmosClient.CreateDocumentQuery<T>(UriFactory.CreateDocumentCollectionUri(Database, t.Name),sql);
 
             }
             public async Task<string> DeleteAsync<T>(string id)
@@ -325,7 +329,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                 Type t = typeof(T);
                 await InitializeCollection<T>();
                 ResourceResponse<Document> doc =
-                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, id));
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, id));
                 //Console.WriteLine(doc.ActivityId);
                 return id;
             }
@@ -339,13 +343,13 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                     string pkValue = entity.GetType().GetProperty(PartitionKey).GetValue(entity).ToString();
                     string idValue = entity.GetType().GetProperty("id").GetValue(entity).ToString();
                     ResourceResponse<Document> doc =
-                  await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, idValue), new RequestOptions { PartitionKey = new PartitionKey(pkValue) });
+                  await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, idValue), new RequestOptions { PartitionKey = new PartitionKey(pkValue) });
                 }
                 else
                 {
                     string idValue = entity.GetType().GetProperty("id").GetValue(entity).ToString();
                     ResourceResponse<Document> doc =
-                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, idValue));
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, idValue));
                 }
 
 
@@ -359,7 +363,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
 
                 await InitializeCollection<T>();
                 ResourceResponse<Document> doc =
-                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(_Database, t.Name, id), new RequestOptions { PartitionKey = new PartitionKey(partitionKey) });
+                    await CosmosClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(Database, t.Name, id), new RequestOptions { PartitionKey = new PartitionKey(partitionKey) });
                 //Console.WriteLine(doc.ActivityId);
                 return id;
 
@@ -393,8 +397,8 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                     {
                         documentsToImportInBatch.Add(lists[j].ToJson());
                     }
-                    var tasks = new List<Task>();
-                    tasks.Add(Task.Run(async () =>
+                var tasks = new List<Task>
+                { Task.Run(async () =>
                     {
                         do
                         {
@@ -421,8 +425,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                         totalRequestUnitsConsumed += bulkImportResponse.TotalRequestUnitsConsumed;
                         totalTimeTakenSec += bulkImportResponse.TotalTimeTaken.TotalSeconds;
                     },
-                    token));
-                    await Task.WhenAll(tasks);
+                token)
+                };
+                await Task.WhenAll(tasks);
                 }
                 return enyites;
             }
@@ -477,8 +482,8 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                         string id = lists[j].GetType().GetProperty("id").GetValue(lists[j]) + "";
                         updateItemsInBatch.Add(new UpdateItem(id, partitionKeyValue, updateOperations));
                     }
-                    var tasks = new List<Task>();
-                    tasks.Add(Task.Run(async () =>
+                var tasks = new List<Task>
+                { Task.Run(async () =>
                     {
                         do
                         {
@@ -502,8 +507,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
                         totalRequestUnitsConsumed += bulkUpdateResponse.TotalRequestUnitsConsumed;
                         totalTimeTakenSec += bulkUpdateResponse.TotalTimeTaken.TotalSeconds;
                     },
-                    token));
-                    await Task.WhenAll(tasks);
+                token)
+                };
+                await Task.WhenAll(tasks);
                 }
                 return list;
             }

+ 2 - 2
TEAMModelOS.SDK/Module/AzureTable/Configuration/AzureTableServiceCollectionExtensions.cs

@@ -30,7 +30,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
             {
                 Builder = services.AddServerBuilder();
             }
-            services.AddSingleton<IAzureTableDBRepository, AzureTableDBRepository>();
+            //services.AddSingleton<IAzureTableDBRepository, AzureTableDBRepository>();
             return Builder;
         }
 
@@ -42,7 +42,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
         /// <returns></returns>
         public static AzureTableServiceBuilder AddConnection(this AzureTableServiceBuilder builder, AzureTableOptions databaseOptions)
         {
-            builder.Services.AddSingleton(databaseOptions);
+            //builder.Services.AddSingleton(databaseOptions);
             return builder;
         }
         

+ 60 - 17
TEAMModelOS.SDK/Module/AzureTable/Implements/AzureTableDBRepository.cs

@@ -13,6 +13,8 @@ using TEAMModelOS.SDK.Context.Exception;
 using System.Reflection;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Context.Configuration;
+using Microsoft.Extensions.Configuration;
 
 namespace TEAMModelOS.SDK.Module.AzureTable.Implements
 {
@@ -23,8 +25,28 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
 
         private readonly CloudTableClient tableClient;
         private CloudTable Table { get; set; }
-        public AzureTableDBRepository(AzureTableOptions options)
+        //public AzureTableDBRepository(AzureTableOptions options)
+        //{
+        //    if (!string.IsNullOrEmpty(options.ConnectionString))
+        //    {
+        //        tableClient = TableClientSingleton.getInstance(options.ConnectionString).GetTableClient();
+        //    }
+        //    else if (AzureTableConfig.AZURE_CHINA.Equals(options.AzureTableDialect))
+        //    {
+        //        AESCrypt crypt = new AESCrypt();
+        //        tableClient = TableClientSingleton.getInstance(crypt.Decrypt(china, options.AzureTableDialect)).GetTableClient();
+        //    }
+        //    else if (AzureTableConfig.AZURE_GLOBAL.Equals(options.AzureTableDialect))
+        //    {
+        //        AESCrypt crypt = new AESCrypt();
+        //        tableClient = TableClientSingleton.getInstance(crypt.Decrypt(global, options.AzureTableDialect)).GetTableClient();
+        //    }
+        //    else { throw new BizException("请设置正确的AzureTable数据库配置信息!"); }
+
+        //}
+        public AzureTableDBRepository()
         {
+            AzureTableOptions options=  BaseConfigModel.Configuration.GetSection("Azure:Table").Get<AzureTableOptions>();
             if (!string.IsNullOrEmpty(options.ConnectionString))
             {
                 tableClient = TableClientSingleton.getInstance(options.ConnectionString).GetTableClient();
@@ -40,10 +62,6 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                 tableClient = TableClientSingleton.getInstance(crypt.Decrypt(global, options.AzureTableDialect)).GetTableClient();
             }
             else { throw new BizException("请设置正确的AzureTable数据库配置信息!"); }
-
-        }
-        public AzureTableDBRepository()
-        {
         }
         private async Task<string> InitializeTable<T>()
         {
@@ -154,7 +172,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
             var exQuery = new TableQuery<T>();
             if (!string.IsNullOrEmpty(id))
             {
-                string typeStr = SwitchType(id, "RowKey");
+                string typeStr = SwitchType<T>(id, "RowKey");
                 exQuery.Where(typeStr);
                 // exQuery.Where(TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, id));
                 return await QueryObject<T>(exQuery, TableName);
@@ -180,7 +198,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                 {
                     if (dict[key] != null && !string.IsNullOrEmpty(dict[key].ToString()))
                     {
-                        string typeStr = SwitchType(dict[key], key);
+                        string typeStr = SwitchType<T>(dict[key], key);
 
                         if (index == 1)
                         {
@@ -196,6 +214,9 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                         }
                         index++;
                     }
+                    else {
+                        throw new Exception("The parameter must have value!");
+                    }
                 }
 
                 exQuery.Where(builder.ToString());
@@ -215,7 +236,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
             if (!string.IsNullOrEmpty(key) && value != null && !string.IsNullOrEmpty(value.ToString()))
             {
 
-                string typeStr = SwitchType(value, key);
+                string typeStr = SwitchType<T>(value, key);
                 exQuery.Where(typeStr);
                 //exQuery.Where(TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, value));
                 return await QueryList<T>(exQuery, TableName);
@@ -229,6 +250,8 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
 
         public async Task<T> FindOneByDict<T>(IDictionary<string, object> dict) where T : TableEntity, new()
         {
+
+
             string TableName = await InitializeTable<T>();
             var exQuery = new TableQuery<T>();
             StringBuilder builder = new StringBuilder();
@@ -242,7 +265,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                     {
 
 
-                        string typeStr = SwitchType(dict[key], key);
+                        string typeStr = SwitchType<T>(dict[key], key);
 
                         if (index == 1)
                         {
@@ -256,6 +279,10 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                         }
                         index++;
                     }
+                    else
+                    {
+                        throw new Exception("The parameter must have value!");
+                    }
                 }
                 exQuery.Where(builder.ToString());
                 return await QueryObject<T>(exQuery, TableName);
@@ -267,21 +294,29 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
 
         }
 
-        private static string SwitchType(object obj, string key)
+        private static string SwitchType<T>(object obj, string key)
         {
-            Type s = obj.GetType();
-            TypeCode typeCode = Type.GetTypeCode(s);
+            Type objType = typeof(T);
+            PropertyInfo property = objType.GetProperty(key);
+
+            //Type s = obj.GetType();
+            //TypeCode typeCode = Type.GetTypeCode(s);
+            if (property == null) {
+                return null;
+            }
+            TypeCode typeCode = Type.GetTypeCode(property.PropertyType);
+
 
             switch (typeCode)
             {
 
                 case TypeCode.String: return TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, obj.ToString());
-                case TypeCode.Int32: return TableQuery.GenerateFilterConditionForInt(key, QueryComparisons.Equal, (int)obj);
+                case TypeCode.Int32: return TableQuery.GenerateFilterConditionForInt(key, QueryComparisons.Equal, int.Parse( obj.ToString()));
                 case TypeCode.Double: return TableQuery.GenerateFilterConditionForDouble(key, QueryComparisons.Equal, (double)obj);
                 case TypeCode.Byte: return TableQuery.GenerateFilterConditionForBinary(key, QueryComparisons.Equal, (byte[])obj);
                 case TypeCode.Boolean: return TableQuery.GenerateFilterConditionForBool(key, QueryComparisons.Equal, (bool)obj);
                 case TypeCode.DateTime: return TableQuery.GenerateFilterConditionForDate(key, QueryComparisons.Equal, (DateTimeOffset)obj);
-                case TypeCode.Int64: return TableQuery.GenerateFilterConditionForLong(key, QueryComparisons.Equal, (long)obj);
+                case TypeCode.Int64: return TableQuery.GenerateFilterConditionForLong(key, QueryComparisons.Equal, long.Parse(obj.ToString()));
 
                 default: return null;
             }
@@ -294,7 +329,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
             if (!string.IsNullOrEmpty(key) && value != null && !string.IsNullOrEmpty(value.ToString()))
             {
 
-                string typeStr = SwitchType(value, key);
+                string typeStr = SwitchType<T>(value, key);
                 exQuery.Where(typeStr);
                 //exQuery.Where(TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal,
                 //                                                          value));
@@ -322,7 +357,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                 {
                     if (dict[key] != null && !string.IsNullOrEmpty(dict[key].ToString()))
                     {
-                        string typeStr = SwitchType(dict, key);
+                        string typeStr = SwitchType<T>(dict, key);
 
                         if (index == 1)
                         {
@@ -338,6 +373,10 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                         }
                         index++;
                     }
+                    else
+                    {
+                        throw new Exception("The parameter must have value!");
+                    }
                 }
                 exQuery.Where(builder.ToString());
                 return await QueryList<T>(exQuery, TableName);
@@ -606,7 +645,7 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                 {
                     if (dict[key] != null && !string.IsNullOrEmpty(dict[key].ToString()))
                     {
-                        string typeStr = SwitchType(dict, key);
+                        string typeStr = SwitchType<T>(dict, key);
                         if (index == 1)
                         {
                             // builder.Append(TableQuery.GenerateFilterCondition(key, QueryComparisons.Equal, dict[key].ToString()));
@@ -620,6 +659,10 @@ namespace TEAMModelOS.SDK.Module.AzureTable.Implements
                         }
                         index++;
                     }
+                    else
+                    {
+                        throw new Exception("The parameter must have value!");
+                    }
                 }
                 exQuery.Where(builder.ToString());
                 return await QueryList<T>(azureTableToken, exQuery, TableName);

+ 38 - 0
TEAMModelOS.Service/Core/Implements/BaseService.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.WindowsAzure.Storage.Table;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Implements
+{
+    public class BaseService : AzureTableDBRepository, IBaseService
+    {
+        public async Task<List<T>> FindListByDictHasAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
+        {
+            if (dict.Count <= 0)
+            {
+                return  await FindAll<T>();
+            }
+            else
+            {
+                return await FindListByDict<T>(dict);
+            }
+        }
+        public async Task<int> DeleteAll<T>(Dictionary<string, object> dict) where T : TableEntity, new()
+        {
+            List<T> list = await FindListByDict<T>(dict);
+            if (list.IsNotEmpty())
+            {
+                list = await DeleteAll<T>(list);
+                return list.Count;
+            }
+            else {
+                return 0; 
+            }
+        }
+    }
+}

+ 5 - 39
TEAMModelOS.Service/Core/Implements/GradeService.cs

@@ -4,54 +4,20 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Implements
 {
-    public  class GradeService : IGradeService
+    public  class GradeService : BaseService,  IGradeService
     {
-        private IAzureTableDBRepository _repository;
+        //private IAzureTableDBRepository _repository;
         private IHttpContextAccessor _httpContextAccessor;
-        public GradeService(IAzureTableDBRepository repository, IHttpContextAccessor httpContextAccessor)
+        public GradeService( IHttpContextAccessor httpContextAccessor)
         {
             _httpContextAccessor = httpContextAccessor;
-            _repository = repository;
-        }
-
-        public async Task<List<Grade>> FindGradesByDict(Dictionary<string, object> dict)
-        {
-            if (dict.Count <= 0)
-            {
-                return await _repository.FindAll<Grade>();
-            }
-            else
-            {
-                return await _repository.FindListByDict<Grade>(dict);
-            }
-        }
-        public async Task<Grade> FindGradeByDict(Dictionary<string, object> dict)
-        {
-            return await _repository.FindOneByDict<Grade>(dict);
-        }
-        
-        public async Task<Grade> FindGradeByRowKey(string rowKey)
-        {
-            return await _repository.FindByRowKey<Grade>(rowKey);
-        }
-
-        public async Task<List<SchoolGrade>> FindSchoolGradesByDict(Dictionary<string, object> dict)
-        {
-            if (dict != null && dict.Count > 0)
-            {
-                return await _repository.FindListByDict<SchoolGrade>(dict);
-
-            }
-            else
-            {
-                return null;
-                //return await _repository.FindAll<SchoolGrade>();
-            }
+            //_repository = repository;
         }
     }
 }

+ 25 - 20
TEAMModelOS.Service/Core/Implements/LoginInfoService.cs

@@ -23,28 +23,27 @@ using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Network.HttpHelper;
 using TEAMModelOS.SDK.Helper.Security.BCryptHelper;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Implements
 {
-    public class LoginInfoService : ILoginInfoService
+    public class LoginInfoService : BaseService,  ILoginInfoService
     {
-        private IAzureTableDBRepository _repository;
-        private IOptions<JwtSetting> _options;
-        private IHttpContextAccessor _httpContextAccessor;
-        private HttpClientUserInfo _httpClientService;
-        public LoginInfoService(IAzureTableDBRepository repository, IOptions<JwtSetting> options, IHttpContextAccessor httpContextAccessor  , HttpClientUserInfo httpClientService)
+        //private IAzureTableDBRepository _repository;
+        private readonly IOptions<JwtSetting> _options;
+        private readonly HttpClientUserInfo _httpClientService;
+        public LoginInfoService( IOptions<JwtSetting> options, HttpClientUserInfo httpClientService)
         {
-            _httpContextAccessor = httpContextAccessor;
             _options = options;
-            _repository = repository;
+           // _repository = repository;
             _httpClientService = httpClientService;
         }
 
         public async Task<LoginResult> CheckLoginAsync(TicketInfo ticketInfo) {
 
-            string jtoken = HttpContextHelper.GetValueInHttp(_httpContextAccessor.HttpContext.Request, Constants.AUTHORIZATION);
+           // string jtoken = HttpContextHelper.GetValueInHttp(_httpContextAccessor.HttpContext.Request, Constants.AUTHORIZATION);
             if (string.IsNullOrEmpty(ticketInfo.Token))
             {
                 LoginResult result = new LoginResult();
@@ -55,7 +54,7 @@ namespace TEAMModelOS.Service.Core.Implements
                 }
                 string code = BCryptHelper.Ecrypt(ticketInfo.Ticket + ticketInfo.TeamModelId);
                 bool f = BCryptHelper.Verify(ticketInfo.Ticket + ticketInfo.TeamModelId, ticketInfo.Sign);
-                LoginInfo login = _repository.FindOneByKey<LoginInfo>("Ticket", ticketInfo.Ticket).Result;
+                LoginInfo login = FindOneByKey<LoginInfo>("Ticket", ticketInfo.Ticket).Result;
                 if (login != null && !string.IsNullOrEmpty(login.Token))
                 {
                     result.CheckTicket = true;
@@ -63,7 +62,7 @@ namespace TEAMModelOS.Service.Core.Implements
                     result.JwtToken = token;
                     login.Token = token.Access_token;
                     result.JwtToken.Scope = login.Scope;
-                    await _repository.Update<LoginInfo>(login);
+                    await Update<LoginInfo>(login);
                     return result;
                 }
                 JosnRPCRequest<Dictionary<string, object>> request = new JosnRPCRequest<Dictionary<string, object>>
@@ -94,7 +93,7 @@ namespace TEAMModelOS.Service.Core.Implements
                             Ticket = ticketInfo.Ticket,
                             CountryCode = response.result.countryCode
                         };
-                        TeamModelUser user= await _repository.FindOneByKey<TeamModelUser>("TeamModelId", response.result.id);
+                        TeamModelUser user= await FindOneByKey<TeamModelUser>("TeamModelId", response.result.id);
                         if (user == null || string.IsNullOrEmpty(user.RowKey))
                         {
                             user = new TeamModelUser { RowKey = Guid.NewGuid().ToString(), PartitionKey = loginInfo.CountryCode ,RegisterTime=DateTimeHelper.ConvertToTimeStamp13(DateTime.Now) };
@@ -110,8 +109,8 @@ namespace TEAMModelOS.Service.Core.Implements
                         loginInfo.Token = jwtToken.Access_token;
                         loginInfo.Scope = jwtToken.Scope;
                         result.JwtToken = jwtToken;
-                        await _repository.Save<LoginInfo>(loginInfo);
-                        await _repository.SaveOrUpdate<TeamModelUser>(user);
+                        await Save<LoginInfo>(loginInfo);
+                        await SaveOrUpdate<TeamModelUser>(user);
                         return result;
                     }
                     else
@@ -141,7 +140,7 @@ namespace TEAMModelOS.Service.Core.Implements
                 {
                     { "Token", ticketInfo.Token }
                 };
-                LoginInfo loginInfo = _repository.FindOneByDict<LoginInfo>(msp).Result;
+                LoginInfo loginInfo = FindOneByDict<LoginInfo>(msp).Result;
                 if (loginInfo != null && !string.IsNullOrEmpty(loginInfo.Token))
                 {
                     return new LoginResult { JwtToken = new JwtResponse { Access_token=loginInfo.Token ,Scope=loginInfo.Scope}, CheckTicket = true };
@@ -156,18 +155,24 @@ namespace TEAMModelOS.Service.Core.Implements
         {
             Dictionary<string, object> dict = new Dictionary<string, object>
             {
-                { "Phone", loginInfo.CountryCode + loginInfo.Phone },
+                { "Phone", loginInfo.Phone },
+                { "AreaCode", loginInfo.CountryCode },
                 { "TeamModelId",  loginInfo.TeamModelId }
             };
             string role = "";
-            List<RoleUser> roleUsers = await _repository.FindListByDict<RoleUser>(dict);
-            if (roleUsers.IsNotEmpty()) {
+            List<RoleUser> roleUsers = await FindListByDict<RoleUser>(dict);
+            if (roleUsers.IsNotEmpty())
+            {
                 foreach (RoleUser roleUser in roleUsers)
                 {
                     role = role + roleUser.RoleCode + ",";
                 }
+                role = role.Substring(0, role.Length - 1);
+            }
+            else {
+                role = "Teacher";
             }
-            role= role.Substring(0, role.Length - 1);
+           
             ClaimModel model = new ClaimModel
             {
                 Scope = "WebApp"
@@ -184,7 +189,7 @@ namespace TEAMModelOS.Service.Core.Implements
 
         public Task<LoginInfo> SaveLoginInfoAsync(LoginInfo loginInfo)
         {
-            return _repository.Save<LoginInfo>(loginInfo);
+            return Save<LoginInfo>(loginInfo);
         }
     }
 }

+ 3 - 42
TEAMModelOS.Service/Core/Implements/PeriodService.cs

@@ -4,54 +4,15 @@ using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Implements
 {
-   public class PeriodService : IPeriodService
+   public class PeriodService : BaseService, IPeriodService
     {
-        IAzureTableDBRepository azureTableDBRepository;
-        public PeriodService(IAzureTableDBRepository _azureTableDBRepository)
-        {
-            azureTableDBRepository = _azureTableDBRepository;
-        }
+      
      
-        public async Task<int> DeleteAll(Dictionary<string, object> dict)
-        {
-            List<Period> periods=  await  azureTableDBRepository.FindListByDict<Period>(dict);
-            periods=  await azureTableDBRepository.DeleteAll<Period>(periods);
-            return periods.Count; 
-        }
-
-        public async Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict)
-        {
-            if (dict != null && dict.Keys.Count > 0)
-            {
-                return await azureTableDBRepository.FindListByDict<Period>(dict);
-            }
-            else {
-                return await azureTableDBRepository.FindAll<Period>();
-            }
-            
-        }
-        public async Task<List<SchoolPeriod>> FindSchoolPeriodsByDict(Dictionary<string, object> dict)
-        {
-            if (dict != null && dict.Count > 0)
-            {
-                return await azureTableDBRepository.FindListByDict<SchoolPeriod>(dict);
-
-            }
-            else
-            {
-                return null; 
-                //throw new BizException("");
-                //  return await azureTableDBRepository.FindAll<SchoolPeriod>();
-            }
-        }
-        public async Task<Period> saveOrUpdate(Period period)
-        {
-            return  await azureTableDBRepository.SaveOrUpdate<Period>(period);
-        }
     }
 }

+ 3 - 39
TEAMModelOS.Service/Core/Implements/RoleService.cs

@@ -4,50 +4,14 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Implements
 {
-    public class RoleService : IRoleService
+    public class RoleService : BaseService, IRoleService
     {
-        private IAzureTableDBRepository _repository;
-        private IHttpContextAccessor _httpContextAccessor;
-        public RoleService(IAzureTableDBRepository repository, IHttpContextAccessor httpContextAccessor)
-        {
-            _httpContextAccessor = httpContextAccessor;
-            _repository = repository;
-        }
-
-        public async Task<List<Role>> FindRolesByDict(Dictionary<string, object> dict)
-        {
-            if (dict.Count <= 0)
-            {
-                return await _repository.FindAll<Role>();
-            }
-            else
-            {
-                return await _repository.FindListByDict<Role>(dict);
-            }
-        }
-        public async Task<Role> FindRoleByDict(Dictionary<string, object> dict) {
-            return await _repository.FindOneByDict<Role>(dict);
-        }
-        public async Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict)
-        {
-            if (dict != null && dict.Count > 0)
-            {
-                return await _repository.FindListByDict<SchoolRole>(dict);
-               
-            }
-            else
-            {
-                return null;
-                //return await _repository.FindAll<SchoolRole>();
-            }
-        }
-        public async Task<Role> FindRoleByRowKey(string rowKey) {
-            return await _repository.FindByRowKey<Role>(rowKey);
-        }
+        
     }
 }

File diff suppressed because it is too large
+ 9 - 8
TEAMModelOS.Service/Core/Implements/SchoolService.cs


+ 3 - 42
TEAMModelOS.Service/Core/Implements/SubjectService.cs

@@ -3,53 +3,14 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Implements
 {
-    public class SubjectService : ISubjectService
+    public class SubjectService : BaseService, ISubjectService
     {
-        IAzureTableDBRepository azureTableDBRepository;
-        public SubjectService(IAzureTableDBRepository _azureTableDBRepository)
-        {
-            azureTableDBRepository = _azureTableDBRepository;
-        }
-
-        public async Task<int> DeleteAll(Dictionary<string, object> dict)
-        {
-            List<Period> periods = await azureTableDBRepository.FindListByDict<Period>(dict);
-            periods = await azureTableDBRepository.DeleteAll<Period>(periods);
-            return periods.Count;
-        }
-
-        public async Task<List<Subject>> FindSubjectsByDict(Dictionary<string, object> dict)
-        {
-            if (dict != null && dict.Keys.Count > 0)
-            {
-                return await azureTableDBRepository.FindListByDict<Subject>(dict);
-            }
-            else
-            {
-                return await azureTableDBRepository.FindAll<Subject>();
-            }
-
-        }
-        public async Task<List<SchoolSubject>> FindSchoolSubjectsByDict(Dictionary<string, object> dict) {
-            if (dict != null && dict.Count > 0)
-            {
-                return await azureTableDBRepository.FindListByDict<SchoolSubject>(dict);
-
-            }
-            else
-            {
-                return null;
-                //return await _repository.FindAll<SchoolGradeSubject>();
-            }
-        }
-        public async Task<Subject> saveOrUpdate(Subject subject)
-        {
-            return await azureTableDBRepository.SaveOrUpdate<Subject>(subject);
-        }
+        
     }
 }

+ 11 - 0
TEAMModelOS.Service/Core/Implements/TermService.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Implements
+{
+    public class TermService: BaseService, ITermService
+    {
+    }
+}

+ 15 - 0
TEAMModelOS.Service/Core/Interfaces/IBaseService.cs

@@ -0,0 +1,15 @@
+using Microsoft.WindowsAzure.Storage.Table;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+
+namespace TEAMModelOS.Service.Core.Interfaces
+{
+    public interface IBaseService: IBusinessService, IAzureTableDBRepository
+    {
+        Task<List<T>> FindListByDictHasAll<T>(Dictionary<string, object> dict) where T : TableEntity, new();
+        Task<int> DeleteAll<T>(Dictionary<string, object> dict) where T : TableEntity, new();
+    }
+}

+ 7 - 5
TEAMModelOS.Service/Core/Interfaces/IGradeService.cs

@@ -3,15 +3,17 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface IGradeService : IBusinessService
+    public interface IGradeService : IBusinessService, IBaseService
     {
        
-        Task<List<Grade>> FindGradesByDict(Dictionary<string, object> dict);
-        Task<Grade> FindGradeByDict(Dictionary<string, object> dict);
-        Task<Grade> FindGradeByRowKey(string rowKey);
-        Task<List<SchoolGrade>> FindSchoolGradesByDict(Dictionary<string, object> dict);
+        //Task<List<Grade>> FindGradesByDict(Dictionary<string, object> dict);
+        //Task<Grade> FindGradeByDict(Dictionary<string, object> dict);
+        //Task<Grade> FindGradeByRowKey(string rowKey);
+        //Task<List<SchoolGrade>> FindSchoolGradesByDict(Dictionary<string, object> dict);
+       // Task<SchoolGrade> SaveOrUpdateSchoolGrade(SchoolGrade schoolGrade);
     }
 }

+ 2 - 1
TEAMModelOS.Service/Core/Interfaces/ILoginInfoService.cs

@@ -3,10 +3,11 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Dtos;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface ILoginInfoService :IBusinessService
+    public interface ILoginInfoService : IBusinessService, IBaseService
     {
         Task<LoginResult> CheckLoginAsync(TicketInfo loginInfo);
     }

+ 7 - 5
TEAMModelOS.Service/Core/Interfaces/IPeriodService.cs

@@ -3,14 +3,16 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface IPeriodService :IBusinessService
+    public interface IPeriodService :IBusinessService , IBaseService
     {
-        Task<Period> saveOrUpdate(Period period);
-        Task<int > DeleteAll(Dictionary<string, object> dict);
-        Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict);
-        Task<List<SchoolPeriod>> FindSchoolPeriodsByDict(Dictionary<string, object> dict);
+       // Task<Period> SaveOrUpdate(Period period);
+        //Task<int > DeleteAll(Dictionary<string, object> dict);
+        //Task<List<Period>> FindPeriodsByDict(Dictionary<string, object> dict);
+        //Task<List<SchoolPeriod>> FindSchoolPeriodsByDict(Dictionary<string, object> dict);
+       // Task<SchoolPeriod> SaveOrUpdateSchoolPeriod(SchoolPeriod schoolPeriod);
     }
 }

+ 6 - 5
TEAMModelOS.Service/Core/Interfaces/IRoleService.cs

@@ -3,15 +3,16 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface IRoleService : IBusinessService
+    public interface IRoleService : IBusinessService, IBaseService
     {
-        Task<List<Role>> FindRolesByDict(Dictionary<string, object> dict);
-        Task<Role> FindRoleByDict(Dictionary<string, object> dict);
-        Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict);
-        Task<Role> FindRoleByRowKey(string rowKey);
+        //Task<List<Role>> FindRolesByDict(Dictionary<string, object> dict);
+        //Task<Role> FindRoleByDict(Dictionary<string, object> dict);
+        ////Task<List<SchoolRole>> FindSchoolRolesByDict(Dictionary<string, object> dict);
+        //Task<Role> FindRoleByRowKey(string rowKey);
 
     }
 }

+ 2 - 1
TEAMModelOS.Service/Core/Interfaces/ISchoolService.cs

@@ -4,10 +4,11 @@ using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Dtos;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-   public interface ISchoolService :IBusinessService
+   public interface ISchoolService : IBusinessService, IBaseService
     {
         /// <summary>
         /// 查看各个地区城市学校信息

+ 7 - 6
TEAMModelOS.Service/Core/Interfaces/ISubjectService.cs

@@ -3,15 +3,16 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 
 namespace TEAMModelOS.Service.Core.Interfaces
 {
-    public interface ISubjectService  :IBusinessService
+    public interface ISubjectService  : IBusinessService, IBaseService
     {
-        Task<Subject> saveOrUpdate(Subject subject);
-        Task<int> DeleteAll(Dictionary<string, object> dict);
-        Task<List<Subject>> FindSubjectsByDict(Dictionary<string, object> dict);
-
-        Task<List<SchoolSubject>> FindSchoolSubjectsByDict(Dictionary<string, object> dict);
+      //  Task<Subject> SaveOrUpdate(Subject subject);
+        //Task<int> DeleteAll(Dictionary<string, object> dict);
+        //Task<List<Subject>> FindSubjectsByDict(Dictionary<string, object> dict);
+      //  Task<List<SchoolSubject>> FindSchoolSubjectsByDict(Dictionary<string, object> dict);
+       // Task<SchoolSubject> SaveOrUpdateSchoolSubject(SchoolSubject schoolSubject);
     }
 }

+ 10 - 0
TEAMModelOS.Service/Core/Interfaces/ITermService.cs

@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.Service.Core.Interfaces
+{
+    public interface ITermService : IBusinessService, IBaseService
+    {
+    }
+}

+ 2 - 4
TEAMModelOS.Service/Syllabus/Implements/SyllabusService.cs

@@ -17,11 +17,9 @@ namespace TEAMModelOS.Service.Syllabus.Implements
     public class SyllabusService : ISyllabusService
     {
 
-        private IAzureTableDBRepository _azureTableDBRepository;
-        private IHttpContextAccessor _httpContextAccessor;
-        public SyllabusService(IAzureTableDBRepository azureTableDBRepository , IHttpContextAccessor httpContextAccessor) {
+        private readonly IAzureTableDBRepository _azureTableDBRepository;
+        public SyllabusService(IAzureTableDBRepository azureTableDBRepository) {
             _azureTableDBRepository = azureTableDBRepository;
-            _httpContextAccessor = httpContextAccessor;
         }
 
 

+ 12 - 0
TEAMModelOS.Service/Syllabus/Implements/VolumeService.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.Service.Core.Implements;
+using TEAMModelOS.Service.Syllabus.Interfaces;
+
+namespace TEAMModelOS.Service.Syllabus.Implements
+{
+    public class VolumeService :BaseService, IVolumeService
+    {
+    }
+}

+ 11 - 0
TEAMModelOS.Service/Syllabus/Interfaces/IVolumeService.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Service.Syllabus.Interfaces
+{
+    public interface IVolumeService : IBusinessService, IBaseService
+    {
+    }
+}

+ 2 - 2
TEAMModelOS/ClientApp/app.js

@@ -1,5 +1,6 @@
 import Vue from 'vue'
 //import axios from 'axios'
+import i18n from '@/locale';
 import router from './router/index'
 import store from './store'
 import { sync } from 'vuex-router-sync'
@@ -7,7 +8,6 @@ import App from 'components/app-root'
 import { FontAwesomeIcon } from './icons'
 import iView from 'iview';
 import 'iview/dist/styles/iview.css';
-import i18n from '@/locale';
 import commons from "@/utils/public.js";
 import apiTools from '@/store/api.js';
 import { fetch, post } from '@/utils/http';
@@ -41,7 +41,7 @@ Vue.component('icon', FontAwesomeIcon);
 
 //使用钩子函数对路由进行权限跳转
 //router.beforeEach((to, from, next) => {
-//  const role = localStorage.getItem('token');
+//const role = localStorage.getItem('token');
 //  if (!role && to.path !== '/') {
 //    next('/');
 //  } else {

+ 90 - 49
TEAMModelOS/ClientApp/common/Syllabus.vue

@@ -8,7 +8,7 @@
             <Icon type="logo-buffer" size="18" />
             <span>新增科目</span>
           </div>
-          <div class="header-right-item" @click="addTerm">
+          <div class="header-right-item" @click="addTerm" v-if="currentSubjectList.length > 0">
             <Icon type="ios-browsers" size="18" />
             <span>新增册别/课纲</span>
           </div>
@@ -21,20 +21,20 @@
       <div class="list-wrap">
         <!-- 左边科目列表 -->
         <div class="list-col list-left">
-          <div v-for="item in subjectList" :class='["subject-item", item.id==s_click_id ? "term-item-active" : ""]' @click="subjectClick(item.id)">
+          <div v-for="item in currentSubjectList" :class='["subject-item", item.rowKey==s_click_id ? "term-item-active" : ""]' @click="subjectClick(item.rowKey)">
             <span class="subject-name">
-              <Input v-if="item.id==c_edit_id" clearable type="text" v-model="item.name"
+              <Input v-if="item.rowKey==c_edit_id" clearable type="text" v-model="item.name"
                      @on-blur="editSubject(item)"
                      @on-enter="editSubject(item)"
                      @click.stop.native="inputFocus($event)" />
               <span v-else>{{item.name}}</span>
 
-              <span class="s-block-tools" v-show="item.id==c_subject_id">
+              <span class="s-block-tools" v-show="item.rowKey==c_subject_id">
                 <Icon type="md-create" @click="handleEditSubject(item,$event)" />
                 <Icon type="md-trash" @click="handleDeleteSubject" />
               </span>
             </span>
-            <span class="subject-term-num">册数 | {{item.termNum}}</span>
+            <span class="subject-term-num">册数 | {{item.termNum?item.termNum:0}}</span>
           </div>
         </div>
         <!-- 中间册别列表 -->
@@ -95,24 +95,39 @@
       <!-- 新增科目弹窗  -->
       <Modal v-model="addSubjectModal"
              title="新增科目"
+             class-name="subject-modal"
              ok-text="确认"
              cancel-text="取消"
              @on-ok="handleAddSubject"
              @on-cancel="">
-        <p class="modal-title">请输入新科目名称</p>
-        <Input v-model="subjectName" style="margin:5px" />
+        <p class="modal-title">请选择需要添加的新科目</p>
+        <CheckboxGroup v-model="newSubjectList">
+          <Checkbox v-for="(item,index) in subjectList" :label="index" :key="index">{{item.name}}</Checkbox>
+        </CheckboxGroup>
       </Modal>
 
       <!-- 新增册别弹窗 -->
       <Modal v-model="addTermModal"
-         title="新增册别"
-         ok-text="确认"
-         cancel-text="取消"
-         @on-ok="handleAddTerm"
-         @on-cancel="">
-      <p class="modal-title">请输入新册别名称</p>
-      <Input v-model="termName" style="margin:5px" />
-    </Modal>
+             title="新增册别"
+             class-name="subject-modal"
+             ok-text="确认"
+             cancel-text="取消"
+             @on-ok="handleAddTerm"
+             @on-cancel="">
+        <p class="modal-title">当前科目:{{s_click_id}}</p>
+        <!--<p class="modal-title">请选择学段:</p>
+        <Select v-model="model1" style="width:200px">
+          <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
+        </Select>
+        <p class="modal-title">请选择年级:</p>
+        <Select v-model="model1" style="width:200px">
+          <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
+        </Select>
+        <p class="modal-title">请输入册别名称:</p>
+        <Select v-model="model1" style="width:200px">
+          <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
+        </Select>-->
+      </Modal>
     </div>
   </div>
 </template>
@@ -127,6 +142,7 @@
     data() {
       return {
         subjectList: [],
+        currentSubjectList: [],
         termList: [],
         treeData: [],
         userList:[],
@@ -138,7 +154,7 @@
         t_edit_id:null,
         addSubjectModal: false,
         addTermModal: false,
-        subjectName: "",
+        newSubjectList: [],
         termName: "",
         selectGrade: "1年级",
         gradeList: [],
@@ -146,35 +162,41 @@
       }
     },
     created() {
-      for (let i = 0; i < 10; i++) {
-        this.subjectList.push({
-          id:i,
-          name: "科目名称" + i,
-          termNum:i+5
-        })
-
-        this.termList.push({
-          id:i,
-          name: "册别名称",
-          period: "小学",
-          term: "一年级上学期",
-          count:i+10,
-          userNum:i+5
-        })
-
-        this.gradeList.push({
-          id:i,
-          name: i+ "年级",
-        })
-
-        this.userList.push({
-          id:i,
-          headImg: "https://account.habookaclass.biz/dist/6854ccd21afb6b1f994e1556c2360dd8.ico",
-          name: "郭富城",
-          role: "老师",
-          index: i.toString()
-        })
-      }
+
+      this.$api.FindSubjectsByDict().then(res => {
+        console.log(res);
+        this.subjectList = res.result.data;
+      })
+
+      //for (let i = 0; i < 10; i++) {
+      //  this.subjectList.push({
+      //    id:i,
+      //    name: "科目名称" + i,
+      //    termNum:i+5
+      //  })
+
+      //  this.termList.push({
+      //    id:i,
+      //    name: "册别名称",
+      //    period: "小学",
+      //    term: "一年级上学期",
+      //    count:i+10,
+      //    userNum:i+5
+      //  })
+
+      //  this.gradeList.push({
+      //    id:i,
+      //    name: i+ "年级",
+      //  })
+
+      //  this.userList.push({
+      //    id:i,
+      //    headImg: "https://account.habookaclass.biz/dist/6854ccd21afb6b1f994e1556c2360dd8.ico",
+      //    name: "郭富城",
+      //    role: "老师",
+      //    index: i.toString()
+      //  })
+      //}
     },
     methods: {
 
@@ -193,12 +215,12 @@
       //点击编辑科目
       handleEditSubject(data, e) {
         e.stopPropagation();
-        this.c_edit_id = data.id;
+        this.c_edit_id = data.rowKey;
       },
       //点击编辑册别
       handleEditTerm(data, e) {
         e.stopPropagation();
-        this.t_edit_id = data.id;
+        this.t_edit_id = data.rowKey;
       },
       //编辑科目input失焦
       editSubject(data) {
@@ -212,13 +234,28 @@
       inputFocus(e) {
         //e.cancelBubble = true;
       },
-
+      //点击添加科目
       addSubject() {
+        let currentList = this.currentSubjectList;
+        let allList = this.subjectList;
+        console.log(currentList);
+        for (let i of currentList) {
+          if (allList.indexOf(i) != -1) {
+            allList.splice(allList.indexOf(i), 1);
+          }
+        }
         this.addSubjectModal = true;
+        this.newSubjectList = [];
       },
 
+      //确认添加科目
       handleAddSubject() {
-        console.log(this.subjectName);
+        let newList = this.newSubjectList;
+        for (let i of newList) {
+          this.currentSubjectList.push(this.subjectList[i]);
+        }
+        this.s_click_id = this.currentSubjectList[0].rowKey;
+
       },
 
       addTerm() {
@@ -319,6 +356,10 @@
     cursor:pointer;
   }
 
+  /deep/ .subject-modal .ivu-checkbox{
+    margin:10px;
+  }
+
   .list-wrap {
     width:100%;
     height:100%;

+ 1 - 1
TEAMModelOS/ClientApp/locale/index.js

@@ -16,7 +16,7 @@ localStorage.setItem('local', lang);
 
 Vue.config.lang = lang
 
-Vue.locale = () => {}
+Vue.locale = () => { }
 const messages = {
   'zh-CN': customZhCn,
   'zh-TW': customZhTw,

+ 3 - 1
TEAMModelOS/ClientApp/router/index.js

@@ -4,9 +4,11 @@ import { routes } from './routes'
 
 Vue.use(VueRouter)
 
+let lang = localStorage.getItem('local');
 let router = new VueRouter(
 {
-  mode: 'history',
+    mode: 'history',
+    //base: "/" + lang + "/",
   routes
 },
 )

+ 33 - 17
TEAMModelOS/ClientApp/store/api.js

@@ -12,22 +12,22 @@ export default {
   getLoginRoles: function (data) {
     return post('api/role/GetLoginRoles', data);
   },
-  //查找所有学段
-  FindPeriods:function(data){
-    return post('api/Syllabus/FindPeriods', data);
-  },
-  //查找学段对应学科
-  FindSubjects: function (data) {
-    return post('api/Syllabus/FindSubjects', data);
-  },
-  //查找学科对应版本
-  FindEditions: function (data) {
-    return post('api/Syllabus/FindEditions', data);
-  },
-  //查找版本对应册别
-  FindTerms: function (data) {
-    return post('api/Syllabus/FindTerms', data);
-  },
+  ////查找所有学段
+  //FindPeriods:function(data){
+  //  return post('api/Syllabus/FindPeriods', data);
+  //},
+  ////查找学段对应学科
+  //FindSubjects: function (data) {
+  //  return post('api/Syllabus/FindSubjects', data);
+  //},
+  ////查找学科对应版本
+  //FindEditions: function (data) {
+  //  return post('api/Syllabus/FindEditions', data);
+  //},
+  ////查找版本对应册别
+  //FindTerms: function (data) {
+  //  return post('api/Syllabus/FindTerms', data);
+  //},
   //查找地区对应学校列表
   getSchoolList: function (data) {
     return post('api/School/getSchool', data);
@@ -36,7 +36,23 @@ export default {
   getAuthSchool: function (data) {
     return post('api/School/AuthorizedAISchool', data);
   },
- 
+  //获取当前学校全部学科
+  FindSubjectsByDict: function (data) {
+    return post('api/subject/FindSubjectsByDict', data);
+  },
+  //获取当前学校全部学科
+  FindGradesByDict: function (data) {
+    return post('api/grade/FindGradesByDict', data);
+  },
+  //获取当前学校全部学科
+  FindPeriodsByDict: function (data) {
+    return post('api/period/FindPeriodsByDict', data);
+  },
+  //获取登录人员身份信息
+  getLoginClaim: function (data) {
+    return post('api/role/GetLoginClaim', data);
+  },
+
 
 
 

+ 2 - 2
TEAMModelOS/ClientApp/utils/http.js

@@ -1,7 +1,7 @@
 import axios from 'axios';
 import Vue from 'vue'
 import router from '@/router/index'
-axios.defaults.timeout = 5000;
+axios.defaults.timeout = 10000; //设置超时时长
 axios.defaults.baseURL ='';
 
 //http request 拦截器
@@ -14,7 +14,7 @@ axios.interceptors.request.use(
       config.headers = {
         'Content-Type': 'application/json',
         'Authorization': "Bearer " + localStorage.getItem('token'),
-        'token': localStorage.getItem('token')
+        'lang': localStorage.getItem('local')
       }
     } else {
       config.headers = {

+ 17 - 9
TEAMModelOS/ClientApp/view/index.vue

@@ -17,8 +17,8 @@
       <div class="auth-wrap centerCol" v-else>
         <Button type="primary" size="large" class="btn-login animated fadeIn" @click="handleLogin('login')" v-show="!isLogin">{{$t('index.login')}}</Button>
         <Button type="primary" size="large" class="btn-login animated fadeIn" @click="handleLogin('regist')" v-show="!isLogin">{{$t('index.register')}}</Button>
-        <Button type="primary" size="large" class="btn-login animated fadeIn" @click="handleAuth()" v-show="!hasAuthSchool">去授权</Button>
-        <p v-show="isLogin" class="suc-text">{{$t('index.authSchool')}}: {{schoolInfo.schoolName}}</p>
+        <!--<Button type="primary" size="large" class="btn-login animated fadeIn" @click="handleAuth()" v-show="!hasAuthSchool">去授权</Button>
+        <p v-show="isLogin" class="suc-text">{{$t('index.authSchool')}}: {{schoolInfo.schoolName}}</p>-->
         <div v-show="isLogin" class="suc-text select-role">
           <span>{{$t('index.currentRole')}}:</span>
           <Select v-model="currentRole" style="width:200px" @on-change="handleRoleChange">
@@ -61,9 +61,6 @@
         moduleList: [{
           name: "学情分析",
           link: "/saindex"
-        }, {
-          name: "课纲系统",
-          link: "/sak"
         }, {
           name: "课纲管理",
           link: "/sak"
@@ -157,6 +154,9 @@
             that.username = decode.name;
             that.isLogin = true;
             that.isSelectRole = true;
+
+            that.getLoginClaim();
+
             that.$Spin.hide();
           } else {
             that.$Message.warning("服务器错误!未返回token");
@@ -168,12 +168,20 @@
       },
       //判断当前登录用户是否有授权学校
       getAuthSchool(roleCode) {
-        this.$api.getAuthSchool({ RoleCode: roleCode }).then(res => {
-          this.schoolInfo = res.result.data;
-          this.hasAuthSchool = true;
-          localStorage.setItem('schoolInfo', JSON.stringify(res.result.data));
+        //this.$api.getAuthSchool({ RoleCode: roleCode }).then(res => {
+        //  this.schoolInfo = res.result.data;
+        //  this.hasAuthSchool = true;
+        //  localStorage.setItem('schoolInfo', JSON.stringify(res.result.data));
+        //})
+      },
+      getLoginClaim() {
+        this.$api.getLoginClaim({}).then(res => {
+          console.log(res);
         })
       },
+
+
+
       //退出操作清除存储数据
       handleExit() {
         localStorage.clear();

+ 15 - 7
TEAMModelOS/Controllers/Core/GradeController.cs

@@ -14,29 +14,37 @@ namespace TEAMModelOS.Controllers.Core
 {
     [Route("api/[controller]")]
     [ApiController]
-    //[Authorize]
+    [Authorize]
     public class GradeController :BaseController
     {
-        private IGradeService _GradeSeservice;
-        private IHttpContextAccessor _httpContextAccessor;
-        public GradeController(IGradeService GradeService, IHttpContextAccessor httpContextAccessor)
+        private readonly IGradeService _GradeSeservice;
+        public GradeController(IGradeService GradeService)
         {
             _GradeSeservice = GradeService;
-            _httpContextAccessor = httpContextAccessor;
         }
         [HttpPost("FindGradesByDict")]
         public async Task<BaseJosnRPCResponse> FindGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Grade> Grades = await _GradeSeservice.FindGradesByDict(request.@params);
+            List<Grade> Grades = await _GradeSeservice.FindListByDictHasAll<Grade>(request.@params);
             return builder.Data(Grades).build();
         }
         [HttpPost("FindSchoolGradesByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SchoolGrade> Grades = await _GradeSeservice.FindSchoolGradesByDict(request.@params);
+            List<SchoolGrade> Grades = await _GradeSeservice.FindListByDict<SchoolGrade>(request.@params);
             return builder.Data(Grades).build();
         }
+
+        [HttpPost("SaveOrUpdateSchoolPeriod")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolPeriod(JosnRPCRequest<SchoolGrade> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            SchoolGrade data = await _GradeSeservice.SaveOrUpdate<SchoolGrade>(request.@params);
+            return builder.Data(data).build();
+        }
     }
 }

+ 16 - 4
TEAMModelOS/Controllers/Core/PeriodController.cs

@@ -1,3 +1,4 @@
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace TEAMModelOS.Controllers.Core
 {
     [Route("api/[controller]")]
     [ApiController]
+    [Authorize]
     public class PeriodController :BaseController
     {
         public IPeriodService _periodService;
@@ -24,30 +26,40 @@ namespace TEAMModelOS.Controllers.Core
         public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Period> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Period data = await _periodService.saveOrUpdate(request.@params);
+            Period data = await _periodService.SaveOrUpdate<Period>(request.@params);
             return builder.Data(data).build();
         }
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            int count  = await _periodService.DeleteAll(request.@params);
+            int count  = await _periodService.DeleteAll<Period>(request.@params);
             return builder.Data(count).build();
         }
 
         [HttpPost("FindPeriodsByDict")]
         public async Task<BaseJosnRPCResponse> FindPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Period> data = await _periodService.FindPeriodsByDict(request.@params);
+            List<Period> data = await _periodService.FindListByDictHasAll<Period>(request.@params);
             return builder.Data(data).build();
         }
 
         [HttpPost("FindSchoolPeriodsByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SchoolPeriod> data = await _periodService.FindSchoolPeriodsByDict(request.@params);
+            List<SchoolPeriod> data = await _periodService.FindListByDict<SchoolPeriod>(request.@params);
+            return builder.Data(data).build();
+        }
+        [HttpPost("SaveOrUpdateSchoolPeriod")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolPeriod(JosnRPCRequest<SchoolPeriod> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            SchoolPeriod data = await _periodService.SaveOrUpdate<SchoolPeriod>(request.@params);
             return builder.Data(data).build();
         }
     }

+ 47 - 6
TEAMModelOS/Controllers/Core/RoleController.cs

@@ -22,18 +22,17 @@ namespace TEAMModelOS.Controllers.Core
     [Authorize]
     public class RoleController : BaseController
     {
-        private IRoleService _roleSeservice;
-        private IHttpContextAccessor _httpContextAccessor;
-        public RoleController(IRoleService roleService, IHttpContextAccessor httpContextAccessor)
+        private readonly IRoleService _roleSeservice;
+        public RoleController(IRoleService roleService)
         {
             _roleSeservice = roleService;
-            _httpContextAccessor = httpContextAccessor;
         }
         [HttpPost("FindRoleByDict")]
         public async Task<BaseJosnRPCResponse> FindRoleByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Role> roles = await _roleSeservice.FindRolesByDict(request.@params);
+            List<Role> roles = await _roleSeservice.FindListByDictHasAll<Role>(request.@params);
             return builder.Data(roles).build();
         }
         [HttpPost("GetLoginRoles")]
@@ -45,14 +44,56 @@ namespace TEAMModelOS.Controllers.Core
             if (rolecodes.IsNotEmpty()) {
                 foreach (string code in rolecodes)
                 {
-                    Role role = await _roleSeservice.FindRoleByRowKey(code);
+                    Role role = await _roleSeservice.FindByRowKey<Role>(code);
                     if (role != null && !string.IsNullOrEmpty(role.RowKey))
                     {
+                        List<RoleIdentityClaim> identityClaims = await _roleSeservice.FindListByDict<RoleIdentityClaim>(new Dictionary<string, object> {
+                            {"PartitionKey",request.lang },{"RoleCode",role.RowKey },{"RoleLevel",role.Level }
+                        });
                         roles.Add(role);
                     }
                 }
             }
             return builder.Data(roles).build();
         }
+
+        [HttpPost("GetLoginClaim")]
+        public async Task<BaseJosnRPCResponse> GetLoginClaim(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<string> rolecodes = GetLoginUser(JwtClaimTypes.Role);
+            List<string> Id = GetLoginUser(JwtClaimTypes.Id);
+            List<Role> roles = new List<Role>();
+            List<Dictionary<string, object>> roleClaims = new List<Dictionary<string, object>>();
+            if (rolecodes.IsNotEmpty())
+            {
+                foreach (string code in rolecodes)
+                {
+                    List<RoleIdentityClaimValue> claimValues=  await _roleSeservice.FindListByDict<RoleIdentityClaimValue>(
+                    new Dictionary<string, object> { { "RoleCode", code },{ "TeamModelId", Id[0]}, { "PartitionKey", request.lang} });
+                    List<string> keys = new List<string>();
+                    List<Dictionary<string, object>> claims = new List<Dictionary<string, object>>();
+                    foreach (IGrouping<string, RoleIdentityClaimValue> group in claimValues.GroupBy(c =>c.GroupKey))
+                    {
+
+                        List<RoleIdentityClaimValue> claimValue = claimValues.Where(x => x.GroupKey.Equals(group.Key)).ToList();
+                        claimValue= claimValue.OrderBy(s => s.ClaimOrder).ToList() ;
+                        Dictionary<string, object> claim = new Dictionary<string, object>
+                        {
+                            { "claim", claimValue },
+                            { "group", group.Key }
+                        };
+                        claims.Add(claim);
+                    }
+                    Dictionary<string, object> roleClaim = new Dictionary<string, object>
+                    {
+                        { "roleClaim", claims },
+                        { "role", await _roleSeservice.FindOneByDict<Role>(new Dictionary<string, object> { { "RowKey", code }, { "PartitionKey", request.lang } }) }
+                    };
+                    roleClaims.Add(roleClaim);
+                }
+            }
+            return builder.Data(roleClaims).build();
+        }
     }
 }

+ 1 - 1
TEAMModelOS/Controllers/Core/SchoolController.cs

@@ -23,7 +23,7 @@ namespace TEAMModelOS.Controllers.Core
     [ApiController]
     public class SchoolController : BaseController
     {
-        private ISchoolService _schoolInfoService;
+        private readonly ISchoolService _schoolInfoService;
 
         public SchoolController(ISchoolService schoolInfoService)
         {

+ 2 - 2
TEAMModelOS/Controllers/Core/SeedDataController.cs

@@ -27,10 +27,10 @@ namespace TEAMModelOS.Controllers.Core
         /// <returns></returns>
         [HttpGet("Seed")]
         [AllowAnonymous]
-        public  BaseJosnRPCResponse Seed()
+        public BaseJosnRPCResponse Seed()
         {
             JsonRPCResponseBuilder responseBuilder = JsonRPCResponseBuilder.custom();
-            //_seedDataService.SeedArea();
+              _seedDataService.SeedClass();
             return responseBuilder.build(); 
         }
     }

+ 19 - 6
TEAMModelOS/Controllers/Core/SubjectController.cs

@@ -1,3 +1,4 @@
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace TEAMModelOS.Controllers.Core
 {
     [Route("api/[controller]")]
     [ApiController]
+    [Authorize]
     public class SubjectController :BaseController
     {
         public ISubjectService  _subjectService;
@@ -24,30 +26,41 @@ namespace TEAMModelOS.Controllers.Core
         public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Subject> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            Subject data = await _subjectService.saveOrUpdate(request.@params);
+            Subject data = await _subjectService.SaveOrUpdate<Subject>(request.@params);
+            return builder.Data(data).build();
+        }
+        [HttpPost("SaveOrUpdateSchoolSubject")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolSubject(JosnRPCRequest<SchoolSubject> request)
+        {
+            request.@params.RowKey = request.@params.SchoolCode + "-" + request.@params.Code;
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            SchoolSubject data = await _subjectService.SaveOrUpdate<SchoolSubject>(request.@params);
             return builder.Data(data).build();
         }
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            int count = await _subjectService.DeleteAll(request.@params);
+            int count = await _subjectService.DeleteAll<Subject>(request.@params);
             return builder.Data(count).build();
         }
 
         [HttpPost("FindSubjectsByDict")]
         public async Task<BaseJosnRPCResponse> FindList(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<Subject> data = await _subjectService.FindSubjectsByDict(request.@params);
+            List<Subject> data = await _subjectService.FindListByDictHasAll<Subject>(request.@params);
             return builder.Data(data).build();
         }
 
-        [HttpPost("FindSchoolGradesByDict")]
-        public async Task<BaseJosnRPCResponse> FindSchoolGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        [HttpPost("FindSchoolSubjectsByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolSubjectsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
+            request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SchoolSubject> Grades = await _subjectService.FindSchoolSubjectsByDict(request.@params);
+            List<SchoolSubject> Grades = await _subjectService.FindListByDict<SchoolSubject>(request.@params);
             return builder.Data(Grades).build();
         }
     }

+ 53 - 0
TEAMModelOS/Controllers/Core/TermController.cs

@@ -0,0 +1,53 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.Service.Core.Interfaces;
+
+namespace TEAMModelOS.Controllers.Core
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    [Authorize]
+    public class TermController : BaseController
+    {
+        public ITermService  _termService;
+        public TermController(ITermService termService)
+        {
+            _termService = termService;
+        }
+
+       
+        [HttpPost("SaveOrUpdateSchoolTerm")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolTerm(JosnRPCRequest<SchoolSubject> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            SchoolTerm data = await _termService.SaveOrUpdate<SchoolTerm>(request.@params);
+            return builder.Data(data).build();
+        }
+        [HttpPost("DeleteInfo")]
+        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            request.@params.TryAdd("PartitionKey", request.lang);
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            int count = await _termService.DeleteAll<SchoolTerm>(request.@params);
+            return builder.Data(count).build();
+        }
+
+      
+
+        [HttpPost("FindSchoolTermsByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolTermsByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            request.@params.TryAdd("PartitionKey", request.lang);
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<SchoolTerm> Grades = await _termService.FindListByDict<SchoolTerm>(request.@params);
+            return builder.Data(Grades).build();
+        }
+    }
+}

+ 55 - 0
TEAMModelOS/Controllers/Syllabus/VolumeController.cs

@@ -0,0 +1,55 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using TEAMModelOS.Controllers.Core;
+using TEAMModelOS.Model.Core.Models;
+using TEAMModelOS.Model.Syllabus.Models;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.Service.Core.Interfaces;
+using TEAMModelOS.Service.Syllabus.Interfaces;
+
+namespace TEAMModelOS.Controllers.Syllabus
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    [Authorize]
+    public class VolumeController : BaseController
+    {
+        public IVolumeService _volumeService;
+        public VolumeController(IVolumeService volumeService)
+        {
+            _volumeService = volumeService;
+        }
+
+       
+        [HttpPost("SaveOrUpdateSchoolVolume")]
+        public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolTerm(JosnRPCRequest<SchoolVolume> request)
+        {
+            request.@params.RowKey = request.@params.SchoolCode + "-" + request.@params.PeriodCode +"-"+request.@params.SubjectCode+ "-G" + request.@params.GradeCode + "-T"+ request.@params.TermCode;
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            SchoolVolume data = await _volumeService.SaveOrUpdate<SchoolVolume>(request.@params);
+            return builder.Data(data).build();
+        }
+        [HttpPost("DeleteInfo")]
+        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            request.@params.TryAdd("PartitionKey", request.lang);
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            int count = await _volumeService.DeleteAll<SchoolTerm>(request.@params);
+            return builder.Data(count).build();
+        }
+
+        [HttpPost("FindSchoolVolumesByDict")]
+        public async Task<BaseJosnRPCResponse> FindSchoolTermsByDict(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            request.@params.TryAdd("PartitionKey", request.lang);
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            List<SchoolVolume> Grades = await _volumeService.FindListByDict<SchoolVolume>(request.@params);
+            return builder.Data(Grades).build();
+        }
+    }
+}

+ 3 - 27
TEAMModelOS/Controllers/ValuesController.cs

@@ -32,37 +32,13 @@ namespace TEAMModelOS.Controllers
             object[] attributes = type.GetCustomAttributes(true);
             foreach (object attribute in attributes) //2.通过映射,找到成员属性上关联的特性类实例,
             {
-                if (attribute is TableSpaceAttribute)
+                if (attribute is TableSpaceAttribute tableSpace)
                 {
-                    TableSpaceAttribute tableSpace =  (TableSpaceAttribute)attribute;
-                    Name = tableSpace.Name+ Name;
+                    Name = tableSpace.Name + Name;
                 }
             }
             return Name;
         }
-        // GET api/values/5
-        [HttpGet("{id}")]
-        public ActionResult<string> Get(int id)
-        {
-            return null;
-        }
-
-        // POST api/values
-        [HttpPost]
-        public void Post([FromBody] string value)
-        {
-        }
-
-        // PUT api/values/5
-        [HttpPut("{id}")]
-        public void Put(int id, [FromBody] string value)
-        {
-        }
-
-        // DELETE api/values/5
-        [HttpDelete("{id}")]
-        public void Delete(int id)
-        {
-        }
+       
     }
 }

+ 50 - 25
TEAMModelOS/JsonFile/Core/RoleClaim.json

@@ -2,126 +2,151 @@
   {
     "RoleLevelName": "校级",
     "RoleLevel": 10801,
-    "ClaimType": "TeamModelId"
+    "ClaimType": "TeamModelId",
+    "Order": 2
   },
   {
     "RoleLevelName": "校级",
     "RoleLevel": 10801,
-    "ClaimType": "RoleCode"
+    "ClaimType": "RoleCode",
+    "Order": 3
   },
   {
     "RoleLevelName": "校级",
     "RoleLevel": 10801,
-    "ClaimType": "SchoolCode"
+    "ClaimType": "SchoolCode",
+    "Order": 1
   },
   {
     "RoleLevelName": "校区",
     "RoleLevel": 10901,
-    "ClaimType": "TeamModelId"
+    "ClaimType": "TeamModelId",
+    "Order": 3
   },
   {
     "RoleLevelName": "校区",
     "RoleLevel": 10901,
-    "ClaimType": "RoleCode"
+    "ClaimType": "RoleCode",
+    "Order": 4
   },
   {
     "RoleLevelName": "校区",
     "RoleLevel": 10901,
-    "ClaimType": "SchoolCode"
+    "ClaimType": "SchoolCode",
+    "Order": 1
   },
   {
     "RoleLevelName": "校区",
     "RoleLevel": 10901,
-    "ClaimType": "CampusCode"
+    "ClaimType": "CampusCode",
+    "Order": 2
   },
   {
     "RoleLevelName": "学段",
     "RoleLevel": 11001,
-    "ClaimType": "TeamModelId"
+    "ClaimType": "TeamModelId",
+    "Order": 4
   },
   {
     "RoleLevelName": "学段",
     "RoleLevel": 11001,
-    "ClaimType": "RoleCode"
+    "ClaimType": "RoleCode",
+    "Order": 5
   },
   {
     "RoleLevelName": "学段",
     "RoleLevel": 11001,
-    "ClaimType": "SchoolCode"
+    "ClaimType": "SchoolCode",
+    "Order": 1
   },
   {
     "RoleLevelName": "学段",
     "RoleLevel": 11001,
-    "ClaimType": "CampusCode"
+    "ClaimType": "CampusCode",
+    "Order": 2
   },
   {
     "RoleLevelName": "学段",
     "RoleLevel": 11001,
-    "ClaimType": "PeriodCode"
+    "ClaimType": "PeriodCode",
+    "Order": 3
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "TeamModelId"
+    "ClaimType": "TeamModelId",
+    "Order": 5
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "RoleCode"
+    "ClaimType": "RoleCode",
+    "Order": 6
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "SchoolCode"
+    "ClaimType": "SchoolCode",
+    "Order": 1
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "CampusCode"
+    "ClaimType": "CampusCode",
+    "Order": 2
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "PeriodCode"
+    "ClaimType": "PeriodCode",
+    "Order": 3
   },
   {
     "RoleLevelName": "年级",
     "RoleLevel": 11101,
-    "ClaimType": "GradeCode"
+    "ClaimType": "GradeCode",
+    "Order": 4
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "TeamModelId"
+    "ClaimType": "TeamModelId",
+    "Order": 6
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "RoleCode"
+    "ClaimType": "RoleCode",
+    "Order": 7
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "SchoolCode"
+    "ClaimType": "SchoolCode",
+    "Order": 1
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "CampusCode"
+    "ClaimType": "CampusCode",
+    "Order": 2
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "PeriodCode"
+    "ClaimType": "PeriodCode",
+    "Order": 3
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "GradeCode"
+    "ClaimType": "GradeCode",
+    "Order": 4
   },
   {
     "RoleLevelName": "班级",
     "RoleLevel": 11201,
-    "ClaimType": "ClassCode"
+    "ClaimType": "ClassCode",
+    "Order": 5
   }
 ]

+ 1 - 0
TEAMModelOS/SeedData/RoleClaim.cs

@@ -12,5 +12,6 @@ namespace TEAMModelOS.SeedData
         public string ClaimType { get; set; }
         public int RoleLevel { get; set; }
         public string RoleLevelName { get; set; }
+        public int Order { get; set; }
     }
 }

+ 178 - 78
TEAMModelOS/SeedData/SeedDataService.cs

@@ -9,35 +9,97 @@ using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Syllabus.Models;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Helper.Common.FileHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+using TEAMModelOS.SDK.Module.AzureTable.Implements;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
+using TEAMModelOS.Service.Core.Implements;
 using TEAMModelOS.Service.Core.Interfaces;
 
 namespace TEAMModelOS.SeedData
 {
-    public class SeedDataService : IBusinessService
+    public class SeedDataService : BaseService ,IBusinessService
     {
-        string Lang = "zh-CN";
-        private readonly IAzureTableDBRepository _azureTableDBRepository;
-        public SeedDataService(IAzureTableDBRepository azureTableDBRepository) {
-            _azureTableDBRepository = azureTableDBRepository;
-        }
+       private readonly string Lang = "zh-CN";
+        //private readonly IAzureTableDBRepository _azureTableDBRepository;
+        //public SeedDataService(IAzureTableDBRepository azureTableDBRepository) {
+        //    _azureTableDBRepository = azureTableDBRepository;
+        //}
 
         public void SeedData()
         {
             SeedRootAdmin();
-            SeedRole();
-            SeedSchool();
-            SeedTextBook();
-            SeedRoleClaim();
+            //SeedRoleClaim();
+            //SeedRole();
+            //SeedSchool();
+            //SeedTextBook();
+            
+            
+            //SeedSchoolRole();
+            //SeedSubject();
+            //SeedGrade();
+            //SeedOrgStructure();
+          
+            //SeedIdentityClaim();
+            // SeedClass();
             //SeedArea();
-            SeedSchoolRole();
-            SeedSubject();
-            SeedGrade();
-            SeedOrgStructure();
         }
+        public async void SeedIdentityClaim() {
+            List<RoleUser> deleteSchoolAdmin = await FindListByKey<RoleUser>("RoleCode", "SchoolAdmin");
+            await DeleteAll<RoleUser>(deleteSchoolAdmin);
 
+            List<RootUser> admins = BaseConfigModel.Configuration.GetSection("RoleUser:Admin").Get<List<RootUser>>();
+            List<string> roles = new List<string> { "SchoolAdmin" };
+            int size = await DeleteAll<RoleIdentityClaimValue>(new Dictionary<string, object> { { "RoleCode", "SchoolAdmin" } });
+            List<RoleIdentityClaimValue> claimValues = new List<RoleIdentityClaimValue>();
+            foreach (string role in roles) {
+                List<RoleIdentityClaim> roleIdentityClaims= await FindListByDict<RoleIdentityClaim>(
+                    new Dictionary<string, object> { { "PartitionKey", Lang},{ "RoleCode",role } });
+                List<School> schools = await FindListByDict<School>(
+                    new Dictionary<string, object> { { "PartitionKey", Lang } });
+                foreach (RootUser rootUser in admins)
+                {
+                    foreach (School school in schools)
+                    {
+                        string groupKey = Guid.NewGuid().ToString();
+                        foreach (RoleIdentityClaim roleIdentityClaim in roleIdentityClaims) {
+                            string ClaimValue = "";
+                            string ClaimName = "";
+                            if (roleIdentityClaim.ClaimType.Equals("SchoolCode"))
+                            {
+                                ClaimValue=school.code;
+                                ClaimName = school.name;
+                            }
+                            if (roleIdentityClaim.ClaimType.Equals("RoleCode"))
+                            {
+                                ClaimValue = role;
+                                ClaimName = "管理员";
+                            }
+                            if (roleIdentityClaim.ClaimType.Equals("TeamModelId"))
+                            {
+                                ClaimValue = rootUser.TeamModelId;
+                                ClaimName =rootUser.NickName;
+                            }
+                            RoleIdentityClaimValue claimValue = new RoleIdentityClaimValue
+                            {
+                                PartitionKey = Lang,
+                                RowKey = Guid.NewGuid().ToString(),
+                                TeamModelId = rootUser.TeamModelId,
+                                RoleCode = role,
+                                ClaimType = roleIdentityClaim.ClaimType,
+                                ClaimCode = ClaimValue,
+                                ClaimOrder = roleIdentityClaim.Order,
+                                ClaimName = ClaimName,
+                                GroupKey = groupKey
+                            };
+                            claimValues.Add(claimValue);
+                        }
+                    }
+                }
+            }
+            await SaveOrUpdateAll<RoleIdentityClaimValue>(claimValues);
+        }
         public async void SeedSubject() {
             List<Subject> subjects = new List<Subject> {
                 new Subject{ RowKey="Subject_Chinese",PartitionKey=Lang,Name="语文" },
@@ -52,7 +114,7 @@ namespace TEAMModelOS.SeedData
                 new Subject{ RowKey="Subject_Science",PartitionKey=Lang,Name="科学" },
                 new Subject{ RowKey="Subject_Information",PartitionKey=Lang,Name="信息" }
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<Subject>(subjects);
+            await SaveOrUpdateAll<Subject>(subjects);
         }
 
         public async void SeedGrade()
@@ -65,13 +127,13 @@ namespace TEAMModelOS.SeedData
                 new Grade{ RowKey="5",PartitionKey=Lang,Name="五年级" ,Alias="五年级"},
                 new Grade{ RowKey="6",PartitionKey=Lang,Name="六年级" ,Alias="五四制初中一年级,六三制小学六年级"},
                 new Grade{ RowKey="7",PartitionKey=Lang,Name="七年级" ,Alias="五四制初中二年级,六三制初中一年级"},
-                new Grade{ RowKey="8",PartitionKey=Lang,Name="八年级" ,Alias="五四制初中三年级,六三制小学二年级"},
-                new Grade{ RowKey="9",PartitionKey=Lang,Name="九年级" ,Alias="五四制初中四年级,六三制小学三年级"},
+                new Grade{ RowKey="8",PartitionKey=Lang,Name="八年级" ,Alias="五四制初中三年级,六三制初中二年级"},
+                new Grade{ RowKey="9",PartitionKey=Lang,Name="九年级" ,Alias="五四制初中四年级,六三制初中三年级"},
                 new Grade{ RowKey="10",PartitionKey=Lang,Name="高中一年级" ,Alias="十年级"},
                 new Grade{ RowKey="11",PartitionKey=Lang,Name="高中二年级" ,Alias="十一年级"},
                 new Grade{ RowKey="12",PartitionKey=Lang,Name="高中三年级" ,Alias="十二年级" }
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<Grade>(grades);
+            await SaveOrUpdateAll<Grade>(grades);
         }
         public async void SeedSchool()
         {
@@ -87,11 +149,64 @@ namespace TEAMModelOS.SeedData
             }
             schools.ForEach(m => {
                 m.RowKey = m.code + "";
-                m.PartitionKey = m.countryId + "";
+                m.PartitionKey = Lang;
             });
-            await _azureTableDBRepository.SaveOrUpdateAll<School>(schools);
+            await SaveOrUpdateAll<School>(schools);
         }
+        public async void SeedClass()
+        {
+           
+            List<School> schools = await FindListByDictHasAll<School>(new Dictionary<string, object> { {
+                    "PartitionKey", Lang } });
+            foreach (School school in schools) {
 
+                List<SchoolCampus> schoolCampuses = await FindListByDict<SchoolCampus>(new Dictionary<string, object> {
+                    { "PartitionKey", Lang }, { "SchoolCode", school.RowKey } });
+                foreach (SchoolCampus schoolCampus in schoolCampuses)
+                {
+                    List<SchoolPeriod> periods = await FindListByDict<SchoolPeriod>(new Dictionary<string, object> {
+                        { "PartitionKey", Lang }, { "SchoolCode", school.RowKey } });
+                    foreach (SchoolPeriod schoolPeriod in periods)
+                    {
+                        List<SchoolSession> schoolSessions = await FindListByDict<SchoolSession>(new Dictionary<string, object> {
+                            { "PartitionKey", Lang }, { "SchoolCode", school.RowKey }, { "PeriodCode", schoolPeriod.Code } });
+                        foreach (SchoolSession schoolSession in schoolSessions) {
+                            List<SchoolClass> schoolClasses = new List<SchoolClass>();
+                            for (int i = 1; i <= 10; i++) {
+                                int dis =6- (schoolSession.Code - DateTimeHelper.GetCurrentYear());
+                                SchoolGrade schoolGrade=  await FindOneByDict<SchoolGrade>(new Dictionary<string, object> {
+                                    { "PartitionKey", Lang }, { "SchoolCode", school.RowKey }, { "PeriodCode", schoolPeriod.Code } ,{ "Code",dis} });
+
+                                string gcode = schoolGrade.Code >= 10 ? schoolGrade.Code + "" :"0"+ schoolGrade.Code;
+                                string key = school.code + "C" + schoolCampus.Code + schoolPeriod.Code + "G" + gcode + "S" + schoolSession.Code + "T" + 2+"C"+i;
+                                SchoolClass schoolClass = new SchoolClass()
+                                {
+                                    RowKey = key,
+                                    Code = key,
+                                    PartitionKey = Lang,
+                                    Name = i + "班",
+                                    SchoolCode = school.RowKey,
+                                    SchoolName = school.name,
+                                    CampusCode = schoolCampus.RowKey,
+                                    CampusName = schoolCampus.Name,
+                                    PeriodCode = schoolPeriod.Code,
+                                    PeriodName = schoolPeriod.Name,
+                                    GradeCode = schoolGrade.Code,
+                                    GradeName = schoolGrade.Name,
+                                    TermCode=2,
+                                    TermName="下学期",
+                                    SessionCode=schoolSession.Code,
+                                    SessionName=schoolSession.Name
+                                };
+                                schoolClasses.Add(schoolClass);
+                            }
+                             await SaveOrUpdateAll<SchoolClass>(schoolClasses);
+                        }
+                    }
+                }
+            }
+         
+        }
         public async void SeedOrgStructure()
         { 
             List<Period> periods = new List<Period> {
@@ -108,16 +223,16 @@ namespace TEAMModelOS.SeedData
                 //new Period { PartitionKey= "zh-tw" ,Alias="高中", Name="高級中學",RowKey="Period_34",Type="Period",Lang=Lang },
                 
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<Period>(periods);
+            await SaveOrUpdateAll<Period>(periods);
             ///创建智慧学区
             List<SchoolArea> schoolAreas = new List<SchoolArea> { new SchoolArea { PartitionKey = Lang,RowKey= "SchoolArea100001", Name="成都市高新区醍摩豆智慧学区" ,Code=100001} };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolArea>(schoolAreas);
+            await SaveOrUpdateAll<SchoolArea>(schoolAreas);
             ///创建智慧学区成员学校
             List<SchoolAreaMember> schoolAreaMembers = new List<SchoolAreaMember> {
                 new SchoolAreaMember {RowKey= "100001-2151002664" ,PartitionKey=Lang,AreaCode="100001",AreaName="成都市高新区醍摩豆智慧学区",SchoolCode="2151002664",SchoolName="成都师范银都紫藤小学" },
                 new SchoolAreaMember {RowKey= "100001-2151022409" ,PartitionKey=Lang,AreaCode="100001",AreaName="成都市高新区醍摩豆智慧学区",SchoolCode="2151022409",SchoolName="成都高新区芳草小学" }
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolAreaMember>(schoolAreaMembers);
+            await SaveOrUpdateAll<SchoolAreaMember>(schoolAreaMembers);
             ///创建学校的分校区
             List<SchoolCampus> schoolCampuses = new List<SchoolCampus> {
                 new SchoolCampus {RowKey ="2151002664C1",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code=1,Name="南校区" },
@@ -125,7 +240,7 @@ namespace TEAMModelOS.SeedData
                 new SchoolCampus {RowKey ="2151022409C1",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=1,Name="南校区" },
                 new SchoolCampus {RowKey ="2151022409C2",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2,Name="北校区" },
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolCampus>(schoolCampuses);
+            await SaveOrUpdateAll<SchoolCampus>(schoolCampuses);
             ///学校开学学期规则
             List<SchoolTerm> schoolTerms = new List<SchoolTerm> {
                 new SchoolTerm {RowKey ="2151002664T1",PartitionKey=Lang, SchoolCode= "2151002664",SchoolName= "成都师范银都紫藤小学", Code=1,Name="上学期" },
@@ -133,13 +248,13 @@ namespace TEAMModelOS.SeedData
                 new SchoolTerm {RowKey ="2151022409T1",PartitionKey=Lang, SchoolCode= "2151022409",SchoolName= "成都高新区芳草小学", Code=1,Name="上学期" },
                 new SchoolTerm {RowKey ="2151022409T2",PartitionKey=Lang, SchoolCode= "2151022409",SchoolName= "成都高新区芳草小学",Code=2,Name="下学期" },
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolTerm>(schoolTerms);
+            await SaveOrUpdateAll<SchoolTerm>(schoolTerms);
             ///学校包含的学段 可新增别的学段
             List<SchoolPeriod> schoolPeriods = new List<SchoolPeriod> {
                 new SchoolPeriod {RowKey ="2151002664Period_21",PartitionKey=Lang, SchoolCode= "2151002664", SchoolName= "成都师范银都紫藤小学", Code="Period_21",Name="小学" },
                 new SchoolPeriod {RowKey ="2151022409Period_21",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code="Period_21",Name="小学" },
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolPeriod>(schoolPeriods);
+            await SaveOrUpdateAll<SchoolPeriod>(schoolPeriods);
 
             ///
 
@@ -160,7 +275,7 @@ namespace TEAMModelOS.SeedData
                 new SchoolGrade {RowKey ="2151022409Period_21G05",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=5,Name="五年级",PeriodCode="Period_21",PeriodName="小学"},
                 new SchoolGrade {RowKey ="2151022409Period_21G06",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=6,Name="六年级",PeriodCode="Period_21",PeriodName="小学"}
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolGrade>(schoolGrades);
+            await SaveOrUpdateAll<SchoolGrade>(schoolGrades);
             ///学校 学生行政届数划分模拟
             List<SchoolSession> schoolSessions = new List<SchoolSession> {
                 //紫藤
@@ -178,7 +293,7 @@ namespace TEAMModelOS.SeedData
                 new SchoolSession {RowKey ="2151022409Period_21S2023",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2023,Name="2023级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201709,Graduate=201907},
                 new SchoolSession {RowKey ="2151022409Period_21S2024",PartitionKey=Lang, SchoolCode= "2151022409", SchoolName= "成都高新区芳草小学", Code=2024,Name="2024级",PeriodCode="Period_21",PeriodName="小学",Enrollment=201809,Graduate=201907}
             };
-            await _azureTableDBRepository.SaveOrUpdateAll<SchoolSession>(schoolSessions);
+            await SaveOrUpdateAll<SchoolSession>(schoolSessions);
             ///学校 班级模拟
         }
         public async void SeedArea()
@@ -191,7 +306,7 @@ namespace TEAMModelOS.SeedData
                 m.RowKey = m.SysAddID + "";
                 m.PartitionKey = m.CountryId + "";
             });
-            await _azureTableDBRepository.SaveOrUpdateAll<Region>(regions);
+            await SaveOrUpdateAll<Region>(regions);
         }
         
         public async void SeedRoleClaim()
@@ -200,14 +315,16 @@ namespace TEAMModelOS.SeedData
             string areaString = FileHelper.FileToString(path);
             List<RoleClaim> claims = MessagePackHelper.JsonToObject<List<RoleClaim>>(areaString);
             foreach (RoleClaim claim in claims) {
-                Dictionary<string, object> dict = new Dictionary<string, object>();
-                dict.Add("RoleLevel",claim.RoleLevel);
-                dict.Add("ClaimType", claim.ClaimType);
-                List<RoleIdentityClaim> identityClaims = await _azureTableDBRepository.FindListByDict<RoleIdentityClaim>(dict);
-                await _azureTableDBRepository.DeleteAll<RoleIdentityClaim>(identityClaims);
+                Dictionary<string, object> dict = new Dictionary<string, object>
+                {
+                    { "RoleLevel", claim.RoleLevel },
+                    { "ClaimType", claim.ClaimType }
+                };
+                List<RoleIdentityClaim> identityClaims = await FindListByDict<RoleIdentityClaim>(dict);
+                await DeleteAll<RoleIdentityClaim>(identityClaims);
             }
             List<RoleIdentityClaim> roleIdentityClaims = new List<RoleIdentityClaim>();
-            List<Role> roles = await _azureTableDBRepository.FindAll<Role>();
+            List<Role> roles = await FindAll<Role>();
             foreach (Role role in roles) {
                 List<RoleClaim>  roleClaims=  claims.Where(c => c.RoleLevel == role.Level).ToList();
                 if (roleClaims.IsNotEmpty()) {
@@ -219,69 +336,52 @@ namespace TEAMModelOS.SeedData
                             RoleName = role.Name,
                             RoleLevel = roleClaim.RoleLevel,
                             RoleLevelName= roleClaim.RoleLevelName,
+                            Order=roleClaim.Order,
                             ClaimType=roleClaim.ClaimType
                         };
                         roleIdentityClaims.Add(identityClaim);
                     }
                 }
             }
-          await _azureTableDBRepository.SaveOrUpdateAll(roleIdentityClaims);
+          await SaveOrUpdateAll(roleIdentityClaims);
         }
 
         public async void SeedRootAdmin()
         {
             List<RootUser> roots = BaseConfigModel.Configuration.GetSection("RoleUser:Root").Get<List<RootUser>>();
             List<RootUser> admins = BaseConfigModel.Configuration.GetSection("RoleUser:Admin").Get<List<RootUser>>();
-
-            List<RoleUser> deleteUsers = await _azureTableDBRepository.FindListByKey<RoleUser>("RoleCode", "Root");
-            await _azureTableDBRepository.DeleteAll<RoleUser>(deleteUsers);
-            List<RoleUser> deleteAdmin = await _azureTableDBRepository.FindListByKey<RoleUser>("RoleCode", "Admin");
-            await _azureTableDBRepository.DeleteAll<RoleUser>(deleteAdmin);
-            List<RoleUser> deleteTeacher = await _azureTableDBRepository.FindListByKey<RoleUser>("RoleCode", "Teacher");
-            await _azureTableDBRepository.DeleteAll<RoleUser>(deleteTeacher);
-            List<RoleUser> deleteSchoolAdmin = await _azureTableDBRepository.FindListByKey<RoleUser>("RoleCode", "SchoolAdmin");
-            await _azureTableDBRepository.DeleteAll<RoleUser>(deleteSchoolAdmin);
-            List<RoleUser>  usersRoot = MessagePackHelper.JsonToObject<List<RoleUser>>(roots.ToJson());
-            usersRoot.ForEach(m => {
-                m.RowKey = Guid.NewGuid().ToString();
-                m.PartitionKey = "Root";
-                m.RoleCode = "Root";
-                m.RoleName = "超级管理员";
-                //m.SchoolCode = "default";
-                //m.SchoolName = "系统默认";
-            });
-            await _azureTableDBRepository.SaveOrUpdateAll<RoleUser>(usersRoot);
-            List<RoleUser>  usersAdmin = MessagePackHelper.JsonToObject<List<RoleUser>>(admins.ToJson());
-            usersAdmin.ForEach(m => {
-                m.RowKey = Guid.NewGuid().ToString();
-                m.PartitionKey = "Admin";
-                m.RoleCode = "Admin";
-                m.RoleName = "系统管理员";
-                //m.SchoolCode = "default";
-                //m.SchoolName = "系统默认";
-            });
-            await _azureTableDBRepository.SaveOrUpdateAll<RoleUser>(usersAdmin);
-            //RoleUser roleUser = new RoleUser { RowKey = Guid.NewGuid().ToString(), PartitionKey = "Teacher" ,RoleCode= "Teacher",RoleName= "任课教师", SchoolCode = "2151022409", SchoolName= "成都高新区芳草小学" };
+            //List<RoleUser>  usersRoot = MessagePackHelper.JsonToObject<List<RoleUser>>(roots.ToJson());
+            //usersRoot.ForEach(m => {
+            //    m.RowKey = Guid.NewGuid().ToString();
+            //    m.PartitionKey = "Root";
+            //    m.RoleCode = "Root";
+            //    m.RoleName = "超级管理员";
+            //});
+            //await SaveOrUpdateAll<RoleUser>(usersRoot);
+            //List<RoleUser>  usersAdmin = MessagePackHelper.JsonToObject<List<RoleUser>>(admins.ToJson());
+            //usersAdmin.ForEach(m => {
+            //    m.RowKey = Guid.NewGuid().ToString();
+            //    m.PartitionKey = "Admin";
+            //    m.RoleCode = "Admin";
+            //    m.RoleName = "系统管理员";
+            //});
+            //await SaveOrUpdateAll<RoleUser>(usersAdmin);
             List<RoleUser> usersTeacher = MessagePackHelper.JsonToObject<List<RoleUser>>(admins.ToJson());
             usersTeacher.ForEach(m => {
-                m.RowKey = Guid.NewGuid().ToString();
+                m.RowKey = m.AreaCode+m.Phone+ "Teacher";
                 m.PartitionKey = "Teacher";
                 m.RoleCode = "Teacher";
                 m.RoleName = "任课教师";
-                //m.SchoolCode = "2151022409";
-                //m.SchoolName = "成都高新区芳草小学";
             });
-            await _azureTableDBRepository.SaveOrUpdateAll<RoleUser>(usersTeacher);
-            List<RoleUser> usersSchoolAdmin = MessagePackHelper.JsonToObject<List<RoleUser>>(admins.ToJson());
+            await SaveOrUpdateAll<RoleUser>(usersTeacher);
+            List<RoleUser> usersSchoolAdmin = MessagePackHelper.JsonToObject<List<RoleUser>>(roots.ToJson());
             usersSchoolAdmin.ForEach(m => {
-                m.RowKey = Guid.NewGuid().ToString();
+                m.RowKey = m.AreaCode + m.Phone + "SchoolAdmin";
                 m.PartitionKey = "SchoolAdmin";
                 m.RoleCode = "SchoolAdmin";
                 m.RoleName = "学校管理员";
-                //m.SchoolCode = "2151022409";
-                //m.SchoolName = "成都高新区芳草小学";
             });
-            await _azureTableDBRepository.SaveOrUpdateAll<RoleUser>(usersSchoolAdmin);
+            await SaveOrUpdateAll<RoleUser>(usersSchoolAdmin);
         }
 
      
@@ -314,12 +414,12 @@ namespace TEAMModelOS.SeedData
                 new SchoolRole {RowKey="2151002664-ClassAdmin",RoleName="班主任",RoleCode="ClassAdmin",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" },
                 new SchoolRole {RowKey="2151002664-Teacher",RoleName="科任教师",RoleCode="Teacher",RoleLevel=11201,RoleLevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang ,SchoolCode="2151002664" ,SchoolName="成都师范银都紫藤小学" }
             };
-            await _azureTableDBRepository.SaveOrUpdateAll(roles);
+            await SaveOrUpdateAll(roles);
 
         }
 
 
-        public void SeedRole() {
+        public async void SeedRole() {
             List<Role> roles = new List<Role> {
                 new Role {Name="超级管理员",RowKey="Root",Level=10101,LevelName="全部",Remarks="",Status=1 ,PartitionKey=Lang },
                 new Role {Name="普通管理员",RowKey="Admin",Level=10101,LevelName="全部",Remarks="",Status=1 ,PartitionKey=Lang },
@@ -344,7 +444,7 @@ namespace TEAMModelOS.SeedData
                 new Role {Name="科任教师",RowKey="Teacher",Level=11201,LevelName="班级",Remarks="",Status=1 ,PartitionKey=Lang },
                 new Role {Name="学生",RowKey="Student",Level=11301,LevelName="学生",Remarks="",Status=1 ,PartitionKey=Lang },
             };
-            _azureTableDBRepository.SaveOrUpdateAll<Role>(roles);
+           await SaveOrUpdateAll<Role>(roles);
         }
 
      

+ 38 - 20
TEAMModelOS/appsettings.Development.json

@@ -45,7 +45,7 @@
   "Language": [
     {
       "Name": "臺灣",
-      "CountryCode": "886",
+      "CountryCode": "",
       "SmsLang": "CHT",
       "Language": "zh-tw"
     },
@@ -63,7 +63,7 @@
     },
     {
       "Name": "大陆",
-      "CountryCode": "86",
+      "CountryCode": "",
       "SmsLang": "CHS",
       "Language": "zh-ch"
     },
@@ -89,94 +89,112 @@
     "Root": [
       {
         "NickName": "黄贺彬",
-        "Phone": "8615283771540",
+        "Phone": "15283771540",
+        "AreaCode": "86",
         "TeamModelId": "huanghb#8838"
       },
       {
         "NickName": "李棋坤",
-        "Phone": "8613096300695",
+        "Phone": "13096300695",
+        "AreaCode": "86",
         "TeamModelId": "13096300695#0901"
       },
       {
         "NickName": "Jaelys",
-        "Phone": "886988896630",
+        "Phone": "988896630",
+        "AreaCode": "886",
         "TeamModelId": "jaelys8888#2881"
       },
       {
         "NickName": "周胜",
-        "Phone": "8617781294959",
+        "Phone": "17781294959",
+        "AreaCode": "86",
         "TeamModelId": "habook053#9876"
       },
       {
         "NickName": "周响军",
-        "Phone": "8618482133094",
+        "Phone": "18482133094",
+        "AreaCode": "86",
         "TeamModelId": "18482133094#8280"
       },
       {
         "NickName": "陈明洋",
-        "Phone": "8618281911681",
+        "Phone": "18281911681",
+        "AreaCode": "86",
         "TeamModelId": "cmy471520959#8762"
       },
       {
         "NickName": "郭杰",
-        "Phone": "8615196634728",
+        "Phone": "15196634728",
+        "AreaCode": "86",
         "TeamModelId": "cdhabook#2182"
       }
     ],
     "Admin": [
       {
         "NickName": "Power",
-        "Phone": "886935180824",
+        "Phone": "935180824",
+        "AreaCode": "886",
         "TeamModelId": "13096300695#0901"
       },
       {
         "NickName": "台北梁仁楷",
-        "Phone": "8613263110175",
+        "Phone": "13263110175",
+        "AreaCode": "86",
         "TeamModelId": "steven#7306"
       },
       {
         "NickName": "陈权",
-        "Phone": "8613880505117",
+        "Phone": "13880505117",
+        "AreaCode": "86",
         "TeamModelId": "eric#3850"
       },
       {
         "NickName": "王彬琰",
-        "Phone": "8613982151576",
+        "Phone": "13982151576",
+        "AreaCode": "86",
         "TeamModelId": "wendy#3938"
       },
       {
         "NickName": "刘彬",
-        "Phone": "8618981903918",
+        "Phone": "18981903918",
+        "AreaCode": "86",
         "TeamModelId": "lb18981903918#6134"
       },
       {
         "NickName": "黄贺彬",
-        "Phone": "8615283771540",
+        "Phone": "15283771540",
+        "AreaCode": "86",
         "TeamModelId": "huanghb#8838"
       },
       {
         "NickName": "李棋坤",
-        "Phone": "8613096300695",
+        "Phone": "13096300695",
+        "AreaCode": "86",
         "TeamModelId": "13096300695#0901"
       },
       {
         "NickName": "周胜",
-        "Phone": "8617781294959",
+        "Phone": "17781294959",
+        "AreaCode": "86",
         "TeamModelId": "habook053#9876"
       },
       {
         "NickName": "周响军",
-        "Phone": "8618482133094",
+        "Phone": "18482133094",
+        "AreaCode": "86",
         "TeamModelId": "18482133094#8280"
       },
       {
         "NickName": "陈明洋",
-        "Phone": "8618281911681",
+        "Phone": "18281911681",
+        "AreaCode": "86",
         "TeamModelId": "cmy471520959#8762"
       },
       {
         "NickName": "郭杰",
-        "Phone": "8615196634728",
+        "Phone": "15196634728",
+        "AreaCode": "86",
         "TeamModelId": "cdhabook#2182"
       }
     ]

+ 91 - 53
TEAMModelOS/appsettings.json

@@ -85,80 +85,118 @@
       }
     ]
   },
- "RoleUser": {
+  "RoleUser": {
     "Root": [
       {
         "NickName": "黄贺彬",
-        "Phone": "8615283771540",
+        "Phone": "15283771540",
+        "AreaCode": "86",
         "TeamModelId": "huanghb#8838"
       },
       {
         "NickName": "李棋坤",
-        "Phone": "8613096300695",
+        "Phone": "13096300695",
+        "AreaCode": "86",
         "TeamModelId": "13096300695#0901"
       },
       {
         "NickName": "Jaelys",
-        "Phone": "886988896630",
+        "Phone": "988896630",
+        "AreaCode": "886",
         "TeamModelId": "jaelys8888#2881"
       },
       {
         "NickName": "周胜",
-        "Phone": "8617781294959",
+        "Phone": "17781294959",
+        "AreaCode": "86",
         "TeamModelId": "habook053#9876"
       },
       {
         "NickName": "周响军",
-        "Phone": "8618482133094",
+        "Phone": "18482133094",
+        "AreaCode": "86",
         "TeamModelId": "18482133094#8280"
+      },
+      {
+        "NickName": "陈明洋",
+        "Phone": "18281911681",
+        "AreaCode": "86",
+        "TeamModelId": "cmy471520959#8762"
+      },
+      {
+        "NickName": "郭杰",
+        "Phone": "15196634728",
+        "AreaCode": "86",
+        "TeamModelId": "cdhabook#2182"
       }
     ],
-  "Admin": [
-    {
-      "NickName": "Power",
-      "Phone": "886935180824",
-      "TeamModelId": "13096300695#0901"
-    },
-    {
-      "NickName": "台北梁仁楷",
-      "Phone": "8613263110175",
-      "TeamModelId": "steven#7306"
-    },
-    {
-      "NickName": "陈权",
-      "Phone": "8613880505117",
-      "TeamModelId": "eric#3850"
-    },
-    {
-      "NickName": "王彬琰",
-      "Phone": "8613982151576",
-      "TeamModelId": "wendy#3938"
-    },
-    {
-      "NickName": "刘彬",
-      "Phone": "8618981903918",
-      "TeamModelId": "lb18981903918#6134"
-    },
-    {
-      "NickName": "黄贺彬",
-      "Phone": "8615283771540",
-      "TeamModelId": "huanghb#8838"
-    },
-    {
-      "NickName": "李棋坤",
-      "Phone": "8613096300695",
-      "TeamModelId": "13096300695#0901"
-    },
-    {
-      "NickName": "周胜",
-      "Phone": "8617781294959",
-      "TeamModelId": "habook053#9876"
-    },
-    {
-      "NickName": "周响军",
-      "Phone": "8618482133094",
-      "TeamModelId": "18482133094#8280"
-    }
-  ]
+    "Admin": [
+      {
+        "NickName": "Power",
+        "Phone": "935180824",
+        "AreaCode": "886",
+        "TeamModelId": "13096300695#0901"
+      },
+      {
+        "NickName": "台北梁仁楷",
+        "Phone": "13263110175",
+        "AreaCode": "86",
+        "TeamModelId": "steven#7306"
+      },
+      {
+        "NickName": "陈权",
+        "Phone": "13880505117",
+        "AreaCode": "86",
+        "TeamModelId": "eric#3850"
+      },
+      {
+        "NickName": "王彬琰",
+        "Phone": "13982151576",
+        "AreaCode": "86",
+        "TeamModelId": "wendy#3938"
+      },
+      {
+        "NickName": "刘彬",
+        "Phone": "18981903918",
+        "AreaCode": "86",
+        "TeamModelId": "lb18981903918#6134"
+      },
+      {
+        "NickName": "黄贺彬",
+        "Phone": "15283771540",
+        "AreaCode": "86",
+        "TeamModelId": "huanghb#8838"
+      },
+      {
+        "NickName": "李棋坤",
+        "Phone": "13096300695",
+        "AreaCode": "86",
+        "TeamModelId": "13096300695#0901"
+      },
+      {
+        "NickName": "周胜",
+        "Phone": "17781294959",
+        "AreaCode": "86",
+        "TeamModelId": "habook053#9876"
+      },
+      {
+        "NickName": "周响军",
+        "Phone": "18482133094",
+        "AreaCode": "86",
+        "TeamModelId": "18482133094#8280"
+      },
+      {
+        "NickName": "陈明洋",
+        "Phone": "18281911681",
+        "AreaCode": "86",
+        "TeamModelId": "cmy471520959#8762"
+      },
+      {
+        "NickName": "郭杰",
+        "Phone": "15196634728",
+        "AreaCode": "86",
+        "TeamModelId": "cdhabook#2182"
+      }
+    ]
   }
 }

File diff suppressed because it is too large
+ 3 - 0
TeamModelOS.Test.JsonPath/Program.cs