Bladeren bron

大云数据调整。数据分区,接口参数,业务调整等。

CrazyIter 5 jaren geleden
bovenliggende
commit
2b57f4e27b
100 gewijzigde bestanden met toevoegingen van 1811 en 2857 verwijderingen
  1. 2 10
      TEAMModelGrpc/Models/SyllabusTreeDto.cs
  2. 7 7
      TEAMModelGrpc/Services/ClassroomService.cs
  3. 11 79
      TEAMModelGrpc/Services/ClassroomStudentService.cs
  4. 1 1
      TEAMModelGrpc/Services/CourseService.cs
  5. 12 11
      TEAMModelGrpc/Services/HomeWorkService.cs
  6. 2 2
      TEAMModelGrpc/Services/KnowledgeService.cs
  7. 15 8
      TEAMModelGrpc/Services/SyllabusService.cs
  8. 12 11
      TEAMModelGrpc/Services/VolumeService.cs
  9. 33 38
      TEAMModelGrpc/TEAMModelOS.GRPC.xml
  10. 1 0
      TEAMModelOS.SDK/Context/Attributes/Azure/PartitionKeyAttribute.cs
  11. 238 224
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs
  12. 18 0
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/CosmosDict.cs
  13. 15 0
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/CosmosModelInfo.cs
  14. 8 6
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/IAzureCosmosDBV3Repository.cs
  15. 3 1
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/ID.cs
  16. 9 3
      TEAMModelOS.SDK/Module/AzureCosmosDBV3/SQLHelperParametric.cs
  17. 4 14
      TEAMModelOS.SDK/Module/Cache/CSRedisCacheService.cs
  18. 1 1
      TEAMModelOS.SDK/Module/Grpc/AspNetCore/Internal/BindMethodFinder.cs
  19. 6 1
      TEAMModelOS.SDK/Module/Grpc/AspNetCore/Internal/ProviderServiceBinder.cs
  20. 1 1
      TEAMModelOS.Service/Models/Core/CodeValue.cs
  21. 1 1
      TEAMModelOS.Service/Models/Learn/ProcessRes.cs
  22. 1 1
      TEAMModelOS.Service/Models/Core/ResourceReference.cs
  23. 4 11
      TEAMModelOS.Service/Models/Syllabus/SyllabusNode.cs
  24. 1 1
      TEAMModelOS.Service/Models/Syllabus/SyllabusTree.cs
  25. 2 2
      TEAMModelOS.Service/Models/Learn/Target.cs
  26. 16 28
      TEAMModelOS.Service/Models/Exam/ExamItem.cs
  27. 14 26
      TEAMModelOS.Service/Models/Syllabus/Knowledge.cs
  28. 11 9
      TEAMModelOS.Service/Models/Syllabus/SyllabusResource.cs
  29. 12 5
      TEAMModelOS.Service/Models/Syllabus/Syllabuses.cs
  30. 2 5
      TEAMModelOS.Service/Models/Syllabus/KnowledgeBlock.cs
  31. 1 1
      TEAMModelOS.Service/Models/Syllabus/KnowledgeBlockPoint.cs
  32. 1 1
      TEAMModelOS.Service/Models/Syllabus/KnowledgePoint.cs
  33. 7 11
      TEAMModelOS.Service/Models/Syllabus/SyllabusVolume.cs
  34. 0 16
      TEAMModelOS.Service/Models/Core/ContentVerify.cs
  35. 0 40
      TEAMModelOS.Service/Models/Core/LoginInfo.cs
  36. 0 50
      TEAMModelOS.Service/Models/Core/Teacher.cs
  37. 0 173
      TEAMModelOS.Service/Models/Courses/Course.cs
  38. 0 39
      TEAMModelOS.Service/Models/Courses/CourseStudentsGroup.cs
  39. 0 39
      TEAMModelOS.Service/Models/Exam/SimpleExam.cs
  40. 0 168
      TEAMModelOS.Service/Models/Learn/HomeWork.cs
  41. 0 127
      TEAMModelOS.Service/Models/Learn/LeanProcess.cs
  42. 0 169
      TEAMModelOS.Service/Models/Learn/LearningAutonomous.cs
  43. 13 13
      TEAMModelOS.Service/Models/PowerPoint/Chart.cs
  44. 1 1
      TEAMModelOS.Service/Models/PowerPoint/Item.cs
  45. 1 3
      TEAMModelOS.Service/Models/PowerPoint/Slide.cs
  46. 6 13
      TEAMModelOS.Service/Models/Core/Classroom.cs
  47. 50 0
      TEAMModelOS.Service/Models/SchoolInfo/Course.cs
  48. 8 4
      TEAMModelOS.Service/Models/Exam/ExamAnswer.cs
  49. 7 4
      TEAMModelOS.Service/Models/Exam/ExamInfo.cs
  50. 7 3
      TEAMModelOS.Service/Models/Exam/ExamResult.cs
  51. 1 1
      TEAMModelOS.Service/Models/Core/Campus.cs
  52. 1 1
      TEAMModelOS.Service/Models/Core/Grade.cs
  53. 1 1
      TEAMModelOS.Service/Models/Core/Period.cs
  54. 1 1
      TEAMModelOS.Service/Models/Core/Semester.cs
  55. 1 1
      TEAMModelOS.Service/Models/Core/Subject.cs
  56. 15 13
      TEAMModelOS.Service/Models/Exam/ExamPaper.cs
  57. 8 5
      TEAMModelOS.Service/Models/Core/School.cs
  58. 21 0
      TEAMModelOS.Service/Models/SchoolInfo/Survey.cs
  59. 1 1
      TEAMModelOS.Service/Models/Core/SchoolSetting.cs
  60. 8 18
      TEAMModelOS.Service/Models/Learn/Vote.cs
  61. 11 13
      TEAMModelOS.Service/Models/Core/ClassRoomStudent.cs
  62. 13 61
      TEAMModelOS.Service/Models/Learn/HomeWorkStudent.cs
  63. 13 8
      TEAMModelOS.Service/Models/Learn/LeanRecord.cs
  64. 6 8
      TEAMModelOS.Service/Models/Core/Student.cs
  65. 19 0
      TEAMModelOS.Service/Models/StudentInfo/SurveyRecord.cs
  66. 13 26
      TEAMModelOS.Service/Models/Learn/VoteStudent.cs
  67. 8 5
      TEAMModelOS.Service/Models/Learn/TeacherComments.cs
  68. 53 0
      TEAMModelOS.Service/Models/TeacherInfo/CoursePlan.cs
  69. 102 0
      TEAMModelOS.Service/Models/TeacherInfo/Homework.cs
  70. 74 0
      TEAMModelOS.Service/Models/TeacherInfo/LeanProcess.cs
  71. 8 5
      TEAMModelOS.Service/Models/Learn/LearnUnit.cs
  72. 5 3
      TEAMModelOS.Service/Models/Core/SchoolUser.cs
  73. 1 3
      TEAMModelOS.Service/Services/Analysis/Implements/AchievementService.cs
  74. 1 3
      TEAMModelOS.Service/Services/Analysis/Interfaces/IAchievementService.cs
  75. 6 6
      TEAMModelOS.Service/Services/ChangeFeed/ChangeFeedInvoke.cs
  76. 1 1
      TEAMModelOS.Service/Services/ChangeFeed/IChangeFeedInvoke.cs
  77. 1 1
      TEAMModelOS.Service/Services/ChangeFeed/KnowledgeChangeFeed.cs
  78. 3 3
      TEAMModelOS.Service/Services/ChangeFeed/SyllabusVolumeChangeFeed.cs
  79. 35 36
      TEAMModelOS.Service/Services/Evaluation/Implements/HtmlAnalyzeService.cs
  80. 1 1
      TEAMModelOS.Service/Services/Evaluation/Implements/ImportExerciseService.cs
  81. 1 3
      TEAMModelOS.Service/Services/Evaluation/Interfaces/IHtmlAnalyzeService.cs
  82. 26 27
      TEAMModelOS.Service/Services/PowerPoint/Implement/HtexService.cs
  83. 3 3
      TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeHelper.cs
  84. 4 4
      TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeSvg.cs
  85. 5 5
      TEAMModelOS.Service/Services/Syllabus/Implement/KnowledgeService.cs
  86. 26 26
      TEAMModelOS.Service/Services/Syllabus/Implement/SyllabusService.cs
  87. 19 19
      TEAMModelOS.Service/Services/Syllabus/Implement/VolumeService.cs
  88. 2 2
      TEAMModelOS.Service/Services/Syllabus/Interface/IKnowledgeService.cs
  89. 4 4
      TEAMModelOS.Service/Services/Syllabus/Interface/ISyllabusService.cs
  90. 3 3
      TEAMModelOS.Service/Services/Syllabus/Interface/IVolumeService.cs
  91. 478 580
      TEAMModelOS.Service/TEAMModelOS.Model.xml
  92. 31 1
      TEAMModelOS/ClientApp/src/static/baseDataDefault.json
  93. 13 15
      TEAMModelOS/Controllers/Analysis/AchievementController.cs
  94. 0 208
      TEAMModelOS/Controllers/Analysis/ChangeController.cs
  95. 1 1
      TEAMModelOS/Controllers/BaseController.cs
  96. 1 1
      TEAMModelOS/Controllers/Core/AuthController.cs
  97. 19 33
      TEAMModelOS/Controllers/Core/ClassRoomController.cs
  98. 178 0
      TEAMModelOS/Controllers/Core/ClassStudentController.cs
  99. 0 315
      TEAMModelOS/Controllers/Core/ClassroomStudentController.cs
  100. 0 0
      TEAMModelOS/Controllers/Core/CommonController.cs

+ 2 - 10
TEAMModelGrpc/Models/SyllabusTreeDto.cs

@@ -4,7 +4,6 @@ using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using TEAMModelOS.Service.Models.Syllabus;
 
 
 namespace TEAMModelGrpc.Models
 namespace TEAMModelGrpc.Models
 {
 {
@@ -54,20 +53,13 @@ namespace TEAMModelGrpc.Models
         /// </summary>
         /// </summary>
         [ProtoMember(7)]
         [ProtoMember(7)]
         public int type { get; set; }
         public int type { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        //public string remark { get; set; }
+      
         /// <summary>
         /// <summary>
         /// 节点Key
         /// 节点Key
         /// </summary>
         /// </summary>
         [ProtoMember(8)]
         [ProtoMember(8)]
         public string nodeKey { get; set; }
         public string nodeKey { get; set; }
-        ///// <summary>
-        /////主键
-        ///// </summary>
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string Id { get; set; }
+      
         /// <summary>
         /// <summary>
         /// 父级
         /// 父级
         /// </summary>
         /// </summary>

+ 7 - 7
TEAMModelGrpc/Services/ClassroomService.cs

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Core;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {
@@ -42,8 +42,8 @@ namespace TEAMModelGrpc.Services
                 else
                 else
                 {
                 {
                     classroom.id = Guid.NewGuid().ToString();
                     classroom.id = Guid.NewGuid().ToString();
-                    ClassroomStudent students = new ClassroomStudent();
-                    students.scopeCode = classroom.scopeCode;
+                    ClassStudent students = new ClassStudent();
+                    students.code = classroom.code;
                     students.id = classroom.classroomCode;
                     students.id = classroom.classroomCode;
                     await cosmosrepository.SaveOrUpdate(students);
                     await cosmosrepository.SaveOrUpdate(students);
                     classrooms.Add(await cosmosrepository.SaveOrUpdate(classroom));
                     classrooms.Add(await cosmosrepository.SaveOrUpdate(classroom));
@@ -87,15 +87,15 @@ namespace TEAMModelGrpc.Services
             await cosmosrepository.DeleteAll<Classroom>(listPid.idPks);
             await cosmosrepository.DeleteAll<Classroom>(listPid.idPks);
             if (listPid.idPks.IsNotEmpty())
             if (listPid.idPks.IsNotEmpty())
             {
             {
-                List<ClassroomStudent> students = new List<ClassroomStudent>();
+                List<ClassStudent> students = new List<ClassStudent>();
                 foreach (IdPk classroom in listPid.idPks)
                 foreach (IdPk classroom in listPid.idPks)
                 {
                 {
-                    List<ClassroomStudent> classroomStudents = await cosmosrepository.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", classroom.id }, { "scopeCode", classroom.pk } });
-                    students.AddRange(classroomStudents);
+                    List<ClassStudent> ClassStudents = await cosmosrepository.FindByDict<ClassStudent>(new Dictionary<string, object> { { "id", classroom.id }, { "code", classroom.pk } });
+                    students.AddRange(ClassStudents);
                 }
                 }
                 if (students.Count > 0)
                 if (students.Count > 0)
                 {
                 {
-                    await cosmosrepository.DeleteAll<ClassroomStudent>(students);
+                    await cosmosrepository.DeleteAll<ClassStudent>(students);
                 }
                 }
                 listPid.idPks = await cosmosrepository.DeleteAll<Classroom>(listPid.idPks);
                 listPid.idPks = await cosmosrepository.DeleteAll<Classroom>(listPid.idPks);
             }
             }

+ 11 - 79
TEAMModelGrpc/Services/ClassroomStudentService.cs

@@ -8,14 +8,14 @@ using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Core;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {
-    public class ClassroomStudentService : IGrpcService
+    public class ClassStudentService : IGrpcService
     {
     {
         private IAzureCosmosDBV3Repository _cosmos;
         private IAzureCosmosDBV3Repository _cosmos;
-        public ClassroomStudentService(IAzureCosmosDBV3Repository cosmos)
+        public ClassStudentService(IAzureCosmosDBV3Repository cosmos)
         {
         {
             _cosmos = cosmos;
             _cosmos = cosmos;
         }
         }
@@ -28,10 +28,10 @@ namespace TEAMModelGrpc.Services
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
-        public async Task SaveOrUpdateClassroomStudent(IAsyncStreamReader<ClassroomStudent> requestStream, IServerStreamWriter<ClassroomStudent> responseStream, ServerCallContext context)
+        public async Task SaveOrUpdateClassStudent(IAsyncStreamReader<ClassStudent> requestStream, IServerStreamWriter<ClassStudent> responseStream, ServerCallContext context)
         {
         {
-            List<ClassroomStudent> classrooms = new List<ClassroomStudent>();
-            await foreach (ClassroomStudent students in requestStream.ReadAllAsync())
+            List<ClassStudent> classrooms = new List<ClassStudent>();
+            await foreach (ClassStudent students in requestStream.ReadAllAsync())
             {
             {
                 classrooms.Add(await _cosmos.SaveOrUpdate(students));
                 classrooms.Add(await _cosmos.SaveOrUpdate(students));
             }
             }
@@ -42,75 +42,7 @@ namespace TEAMModelGrpc.Services
 
 
 
 
 
 
-        /// <summary>
-        /// 学生加入教室 或者 修改座位号
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task AddClassroomAsync(IAsyncStreamReader<ClassroomStudent> requestStream, IServerStreamWriter<ClassroomStudent> responseStream, ServerCallContext context) {
-            List<ClassroomStudent> classroomStudents1 = new List<ClassroomStudent>();
-            List<ClassroomStudent> students = new List<ClassroomStudent>();
-            await foreach (ClassroomStudent classroom in requestStream.ReadAllAsync()) {
-                students.Add(classroom);
-
-            }
-            foreach (var classroomStudent in students.GroupBy(x => x.id).ToList())
-            {
-                List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", classroomStudent.Key } });
-                foreach (var classroomStudent1 in classroomStudent)
-                {
-                    classroomStudent1.studentId.ForEach(x => {
-                        if (!classroomStudents[0].studentId.Contains(x))
-                        {
-                            classroomStudents[0].studentId.Add(x);
-                        }
-                    });
-                    //   classroomStudents[0].studentId.UnionWith(classroomStudent1.studentId);
-                }
-                classroomStudents1.AddRange(classroomStudents);
-            }
-            List<ClassroomStudent> students1 = await _cosmos.SaveOrUpdateAll(classroomStudents1);
-            students1.ForEach(x => {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-        /// <summary>
-        /// 学生退出教室
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task DelClassroom(IAsyncStreamReader<ClassroomStudent> requestStream, IServerStreamWriter<ClassroomStudent> responseStream, ServerCallContext context) 
-        {
-            List<ClassroomStudent> students = new List<ClassroomStudent>();
-
-            await foreach (ClassroomStudent classroomStudent in requestStream.ReadAllAsync()) {
-                students.Add(classroomStudent);
-            }
-            List<ClassroomStudent> classroomStudents1 = new List<ClassroomStudent>();
-            foreach (ClassroomStudent item1 in students)
-            {
-                List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", item1.id } });
-                foreach (ClassroomStudent item2 in classroomStudents)
-                {
-
-                    item1.studentId.ForEach(x => { item2.studentId.Remove(x); });
-                    //item2.studentId.ExceptWith(item1.studentId);
-                }
-                classroomStudents1.AddRange(classroomStudents);
-            }
-            List<ClassroomStudent> students1 = await _cosmos.SaveOrUpdateAll(classroomStudents1);
-            students1.ForEach(x => {
-                responseStream.WriteAsync(x);
-            });
-        }
+        
 
 
 
 
 
 
@@ -122,11 +54,11 @@ namespace TEAMModelGrpc.Services
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
-        public async Task FindStudents(StringDto request, IServerStreamWriter<ClassroomStudent> responseStream, ServerCallContext context) 
+        public async Task FindStudents(StringDto request, IServerStreamWriter<ClassStudent> responseStream, ServerCallContext context) 
         {
         {
-            List<ClassroomStudent> classroomStudents = await _cosmos.FindSQL<ClassroomStudent>("select c.id,c.scopeCode from c join A0  in c.studentId where 1=1  and A0 =  \'" + request + "\'");
-            if (classroomStudents.IsNotEmpty()) {
-                classroomStudents.ForEach(  x => { 
+            List<ClassStudent> ClassStudents = await _cosmos.FindSQL<ClassStudent>("select c.id,c.code from c join A0  in c.studentId where 1=1  and A0 =  \'" + request + "\'");
+            if (ClassStudents.IsNotEmpty()) {
+                ClassStudents.ForEach(  x => { 
                 responseStream.WriteAsync(x);
                 responseStream.WriteAsync(x);
                 });
                 });
             }
             }

+ 1 - 1
TEAMModelGrpc/Services/CourseService.cs

@@ -7,7 +7,7 @@ using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Courses;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {

+ 12 - 11
TEAMModelGrpc/Services/HomeWorkService.cs

@@ -10,7 +10,7 @@ using TEAMModelOS.Models;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Learn;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {
@@ -30,11 +30,11 @@ namespace TEAMModelGrpc.Services
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
-        public async Task<HomeWorkStudent> StudentScoring(HomeWorkCommentDto homeWorkCommentDto, ServerCallContext context) 
+        public async Task<HomeworkRecord> StudentScoring(HomeworkCommentDto homeWorkCommentDto, ServerCallContext context) 
         {
         {
-            List<HomeWorkStudent> homeWorkStudents = await _cosmos.FindByDict<HomeWorkStudent>(new Dictionary<string, object> { { "id", homeWorkCommentDto.id }, { "homeWorkId", homeWorkCommentDto.homeWorkId } });
-            List<HomeWork> homeWorks = await _cosmos.FindByDict<HomeWork>(new Dictionary<string, object> { { "id", homeWorkCommentDto.homeWorkId } });
-            HomeWorkStudent data = new HomeWorkStudent();
+            List<HomeworkRecord> homeWorkStudents = await _cosmos.FindByDict<HomeworkRecord>(new Dictionary<string, object> { { "id", homeWorkCommentDto.id }, { "homeWorkId", homeWorkCommentDto.homeWorkId } });
+            List<Homework> homeWorks = await _cosmos.FindByDict<Homework>(new Dictionary<string, object> { { "id", homeWorkCommentDto.homeWorkId } });
+            HomeworkRecord data = new HomeworkRecord();
 
 
             if (homeWorks.IsNotEmpty() && homeWorks[0].other.Contains("comment"))
             if (homeWorks.IsNotEmpty() && homeWorks[0].other.Contains("comment"))
             {
             {
@@ -85,11 +85,11 @@ namespace TEAMModelGrpc.Services
         /// <param name="homeWorkCommentDto"></param>
         /// <param name="homeWorkCommentDto"></param>
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public async Task<HomeWorkStudent> TeacherScoring(HomeWorkScoringDto homeWorkCommentDto, ServerCallContext context)
+        public async Task<HomeworkRecord> TeacherScoring(HomeworkScoringDto homeWorkCommentDto, ServerCallContext context)
         {
         {
 
 
-            List<HomeWorkStudent> homeWorkStudents = await _cosmos.FindByDict<HomeWorkStudent>(new Dictionary<string, object> { { "id", homeWorkCommentDto.id }, { "homeWorkId", homeWorkCommentDto.homeWorkId } });
-            HomeWorkStudent data = new HomeWorkStudent();
+            List<HomeworkRecord> homeWorkStudents = await _cosmos.FindByDict<HomeworkRecord>(new Dictionary<string, object> { { "id", homeWorkCommentDto.id }, { "homeWorkId", homeWorkCommentDto.homeWorkId } });
+            HomeworkRecord data = new HomeworkRecord();
             if (homeWorkStudents.IsNotEmpty())
             if (homeWorkStudents.IsNotEmpty())
             {
             {
 
 
@@ -113,14 +113,15 @@ namespace TEAMModelGrpc.Services
         /// 查询教师评语罐头
         /// 查询教师评语罐头
         /// </summary>
         /// </summary>
         /// <param name="dict"></param>
         /// <param name="dict"></param>
+        /// <param name="responseStream"></param>
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public async Task FindTeacherComments(Dict dict, IServerStreamWriter<TeacherComments> responseStream, ServerCallContext context) 
+        public async System.Threading.Tasks.Task FindTeacherComments(Dict dict, IServerStreamWriter<Comments> responseStream, ServerCallContext context) 
         {
         {
             Dictionary<string, object> keyValuePairs = dict.ToDict();
             Dictionary<string, object> keyValuePairs = dict.ToDict();
-            List<TeacherComments> teacherComments = new List<TeacherComments>();
+            List<Comments> teacherComments = new List<Comments>();
             if (keyValuePairs.IsNotEmpty()) {
             if (keyValuePairs.IsNotEmpty()) {
-                teacherComments = await _cosmos.FindByDict<TeacherComments>(keyValuePairs);
+                teacherComments = await _cosmos.FindByDict<Comments>(keyValuePairs);
                 if (teacherComments.IsNotEmpty()) {
                 if (teacherComments.IsNotEmpty()) {
                     teacherComments.ForEach(x=> { 
                     teacherComments.ForEach(x=> { 
                         responseStream.WriteAsync(x);
                         responseStream.WriteAsync(x);

+ 2 - 2
TEAMModelGrpc/Services/KnowledgeService.cs

@@ -10,8 +10,8 @@ using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {

+ 15 - 8
TEAMModelGrpc/Services/SyllabusService.cs

@@ -8,16 +8,23 @@ using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {
+    /// <summary>
+    /// 课纲业务
+    /// </summary>
     public class SyllabusService : IGrpcService
     public class SyllabusService : IGrpcService
     {
     {
         private ISyllabusService syllabusService;
         private ISyllabusService syllabusService;
         private IAzureCosmosDBV3Repository cosmosDBV3Repository;
         private IAzureCosmosDBV3Repository cosmosDBV3Repository;
-
+        /// <summary>
+        /// 构造函数
+        /// </summary>
+        /// <param name="syllabusService"></param>
+        /// <param name="cosmosDBV3Repository"></param>
         public SyllabusService(ISyllabusService syllabusService, IAzureCosmosDBV3Repository cosmosDBV3Repository)
         public SyllabusService(ISyllabusService syllabusService, IAzureCosmosDBV3Repository cosmosDBV3Repository)
         {
         {
             this.syllabusService = syllabusService;
             this.syllabusService = syllabusService;
@@ -49,8 +56,7 @@ namespace TEAMModelGrpc.Services
         /// <summary>
         /// <summary>
         /// 按节点新增课纲
         /// 按节点新增课纲
         /// </summary>
         /// </summary>
-        /// <param name="request"></param>
-        /// <param name="responseStream"></param>
+        /// <param name="requestStream"></param>
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         public async Task<Response> SaveOrUpdateAsNodes(IAsyncStreamReader<SyllabusNode> requestStream,  ServerCallContext context) 
         public async Task<Response> SaveOrUpdateAsNodes(IAsyncStreamReader<SyllabusNode> requestStream,  ServerCallContext context) 
@@ -68,9 +74,9 @@ namespace TEAMModelGrpc.Services
         }
         }
 
 
         /// <summary>
         /// <summary>
-        /// 按树形新增课纲结构
+        ///  按树形新增课纲结构
         /// </summary>
         /// </summary>
-        /// <param name="request"></param>
+        /// <param name="requestStream"></param>
         /// <param name="responseStream"></param>
         /// <param name="responseStream"></param>
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
@@ -97,6 +103,7 @@ namespace TEAMModelGrpc.Services
         /// 删除课纲
         /// 删除课纲
         /// </summary>
         /// </summary>
         /// <param name="request"></param>
         /// <param name="request"></param>
+        /// <param name="responseStream"></param>
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
@@ -104,7 +111,7 @@ namespace TEAMModelGrpc.Services
         {
         {
             Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
             Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
             keyValuePairs = request.ToDict();
             keyValuePairs = request.ToDict();
-            List<Syllabuses> syllabuses = await syllabusService.DeleteSyllabus(keyValuePairs);//await cosmosDBV3Repository.DeleteAll<Knowledge>(listPid.idPks);
+            List<Syllabus> syllabuses = await syllabusService.DeleteSyllabus(keyValuePairs);//await cosmosDBV3Repository.DeleteAll<Knowledge>(listPid.idPks);
             List<SyllabusTreeDto> syllabusTreeDtos = syllabuses.ToJson().FromJson<List<SyllabusTreeDto>>();
             List<SyllabusTreeDto> syllabusTreeDtos = syllabuses.ToJson().FromJson<List<SyllabusTreeDto>>();
 
 
             syllabusTreeDtos.ForEach(x => { 
             syllabusTreeDtos.ForEach(x => { 

+ 12 - 11
TEAMModelGrpc/Services/VolumeService.cs

@@ -7,8 +7,8 @@ using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelGrpc.Models;
 using TEAMModelGrpc.Models;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
 namespace TEAMModelGrpc.Services
 namespace TEAMModelGrpc.Services
 {
 {
@@ -31,12 +31,12 @@ namespace TEAMModelGrpc.Services
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
-        public async Task SaveOrUpdateVolume(IAsyncStreamReader<SyllabusVolume> requestStream, IServerStreamWriter<SyllabusVolume> responseStream, ServerCallContext context) {
+        public async Task SaveOrUpdateVolume(IAsyncStreamReader<Volume> requestStream, IServerStreamWriter<Volume> responseStream, ServerCallContext context) {
 
 
-            List<SyllabusVolume> volumes = new List<SyllabusVolume>();
-            await foreach (SyllabusVolume syllabusNode in requestStream.ReadAllAsync())
+            List<Volume> volumes = new List<Volume>();
+            await foreach (Volume syllabusNode in requestStream.ReadAllAsync())
             {
             {
-                List<SyllabusVolume> volume = await volumeService.SaveOrUpdateVolume(syllabusNode);
+                List<Volume> volume = await volumeService.SaveOrUpdateVolume(syllabusNode);
                 volumes.AddRange(volume);
                 volumes.AddRange(volume);
             }
             }
             volumes.ForEach(x => {
             volumes.ForEach(x => {
@@ -52,11 +52,11 @@ namespace TEAMModelGrpc.Services
         /// <param name="context"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
-        public async Task FindVolume(Dict request, IServerStreamWriter<SyllabusVolume> responseStream, ServerCallContext context) {
+        public async Task FindVolume(Dict request, IServerStreamWriter<Volume> responseStream, ServerCallContext context) {
 
 
             Dictionary<string, object> dict = request.ToDict();
             Dictionary<string, object> dict = request.ToDict();
 
 
-            List<SyllabusVolume> syllabusVolumes = await azureCosmosDBRepository.FindByDict<SyllabusVolume>(dict);
+            List<Volume> syllabusVolumes = await azureCosmosDBRepository.FindByDict<Volume>(dict);
 
 
             syllabusVolumes.ForEach(x => { 
             syllabusVolumes.ForEach(x => { 
                 responseStream.WriteAsync(x);
                 responseStream.WriteAsync(x);
@@ -65,14 +65,15 @@ namespace TEAMModelGrpc.Services
 
 
 
 
         /// <summary>
         /// <summary>
-        /// 删除册别
+        ///  删除册别
         /// </summary>
         /// </summary>
-        /// <param name="request"></param>
+        /// <param name="listPid"></param>
+        /// <param name="context"></param>
         /// <returns></returns>
         /// <returns></returns>
         [Authorize]
         [Authorize]
         public async Task<ListPid> Delete(ListPid listPid, ServerCallContext context)
         public async Task<ListPid> Delete(ListPid listPid, ServerCallContext context)
         {
         {
-            List<IdPk> idPks = await azureCosmosDBRepository.DeleteAll<SyllabusVolume>(listPid.idPks);
+            List<IdPk> idPks = await azureCosmosDBRepository.DeleteAll<Volume>(listPid.idPks);
             listPid.idPks = idPks;
             listPid.idPks = idPks;
             return listPid;
             return listPid;
         }
         }

+ 33 - 38
TEAMModelGrpc/TEAMModelOS.GRPC.xml

@@ -222,7 +222,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Core.Classroom},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.Classroom},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.ClassroomService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Classroom},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Classroom},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             保存教室
             保存教室
             </summary>
             </summary>
@@ -231,7 +231,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomService.FindVolume(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.Classroom},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.ClassroomService.FindVolume(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Classroom},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询教室
             查询教室
             </summary>
             </summary>
@@ -248,7 +248,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomStudentService.SaveOrUpdateClassroomStudent(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.ClassStudentService.SaveOrUpdateClassStudent(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.ClassStudent},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.ClassStudent},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             保存 或 修改 教室学生关联
             保存 或 修改 教室学生关联
             </summary>
             </summary>
@@ -257,25 +257,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomStudentService.AddClassroomAsync(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.ServerCallContext)">
-            <summary>
-            学生加入教室 或者 修改座位号
-            </summary>
-            <param name="requestStream"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomStudentService.DelClassroom(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.ServerCallContext)">
-            <summary>
-            学生退出教室
-            </summary>
-            <param name="requestStream"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.ClassroomStudentService.FindStudents(TEAMModelGrpc.Models.StringDto,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Core.ClassroomStudent},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.ClassStudentService.FindStudents(TEAMModelGrpc.Models.StringDto,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.ClassStudent},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询学生在哪些教室
             查询学生在哪些教室
             </summary>
             </summary>
@@ -284,7 +266,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.CourseService.FindCourseByDict(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Courses.Course},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.CourseService.FindCourseByDict(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Course},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询课程
             查询课程
             </summary>
             </summary>
@@ -293,7 +275,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.CourseService.SaveCourse(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Courses.Course},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Courses.Course},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.CourseService.SaveCourse(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Course},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Course},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             保存课程
             保存课程
             </summary>
             </summary>
@@ -310,7 +292,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.HomeWorkService.StudentScoring(TEAMModelOS.Models.HomeWorkCommentDto,Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.HomeWorkService.StudentScoring(TEAMModelOS.Models.HomeworkCommentDto,Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             学生作业打分评论
             学生作业打分评论
             </summary>
             </summary>
@@ -318,7 +300,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.HomeWorkService.TeacherScoring(TEAMModelOS.Models.HomeWorkScoringDto,Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.HomeWorkService.TeacherScoring(TEAMModelOS.Models.HomeworkScoringDto,Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             教师作业打分评论
             教师作业打分评论
             </summary>
             </summary>
@@ -326,7 +308,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.HomeWorkService.FindTeacherComments(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Learn.TeacherComments},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.HomeWorkService.FindTeacherComments(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Comments},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询教师评语罐头
             查询教师评语罐头
             </summary>
             </summary>
@@ -334,7 +316,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.KnowledgeService.FinKnowledge(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Syllabus.Knowledge},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.KnowledgeService.FinKnowledge(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询知识点
             查询知识点
             </summary>
             </summary>
@@ -343,7 +325,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.KnowledgeService.SaveKnowledge(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Syllabus.Knowledge},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Syllabus.Knowledge},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.KnowledgeService.SaveKnowledge(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             保存知识点
             保存知识点
             </summary>
             </summary>
@@ -360,6 +342,18 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
+        <member name="T:TEAMModelGrpc.Services.SyllabusService">
+            <summary>
+            课纲业务
+            </summary>
+        </member>
+        <member name="M:TEAMModelGrpc.Services.SyllabusService.#ctor(TEAMModelOS.Service.Services.Interface.ISyllabusService,TEAMModelOS.SDK.Module.AzureCosmosDBV3.IAzureCosmosDBV3Repository)">
+            <summary>
+            构造函数
+            </summary>
+            <param name="syllabusService"></param>
+            <param name="cosmosDBV3Repository"></param>
+        </member>
         <member name="M:TEAMModelGrpc.Services.SyllabusService.FindSyllabusTree(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
         <member name="M:TEAMModelGrpc.Services.SyllabusService.FindSyllabusTree(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查找课纲 
             查找课纲 
@@ -369,20 +363,19 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsNodes(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Syllabus.SyllabusNode},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsNodes(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.SyllabusNode},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             按节点新增课纲
             按节点新增课纲
             </summary>
             </summary>
-            <param name="request"></param>
-            <param name="responseStream"></param>
+            <param name="requestStream"></param>
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
         <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsTree(Grpc.Core.IAsyncStreamReader{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
         <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsTree(Grpc.Core.IAsyncStreamReader{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
-            按树形新增课纲结构
+             按树形新增课纲结构
             </summary>
             </summary>
-            <param name="request"></param>
+            <param name="requestStream"></param>
             <param name="responseStream"></param>
             <param name="responseStream"></param>
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
@@ -392,10 +385,11 @@
             删除课纲
             删除课纲
             </summary>
             </summary>
             <param name="request"></param>
             <param name="request"></param>
+            <param name="responseStream"></param>
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.VolumeService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Syllabus.SyllabusVolume},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Syllabus.SyllabusVolume},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.VolumeService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Volume},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Volume},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             保存册别
             保存册别
             </summary>
             </summary>
@@ -404,7 +398,7 @@
             <param name="context"></param>
             <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
-        <member name="M:TEAMModelGrpc.Services.VolumeService.FindVolume(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Syllabus.SyllabusVolume},Grpc.Core.ServerCallContext)">
+        <member name="M:TEAMModelGrpc.Services.VolumeService.FindVolume(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Volume},Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
             查询册别
             查询册别
             </summary>
             </summary>
@@ -415,9 +409,10 @@
         </member>
         </member>
         <member name="M:TEAMModelGrpc.Services.VolumeService.Delete(TEAMModelGrpc.Models.ListPid,Grpc.Core.ServerCallContext)">
         <member name="M:TEAMModelGrpc.Services.VolumeService.Delete(TEAMModelGrpc.Models.ListPid,Grpc.Core.ServerCallContext)">
             <summary>
             <summary>
-            删除册别
+             删除册别
             </summary>
             </summary>
-            <param name="request"></param>
+            <param name="listPid"></param>
+            <param name="context"></param>
             <returns></returns>
             <returns></returns>
         </member>
         </member>
         <member name="T:TEAMModelGrpc.GreetReflection">
         <member name="T:TEAMModelGrpc.GreetReflection">

+ 1 - 0
TEAMModelOS.SDK/Context/Attributes/Azure/PartitionKeyAttribute.cs

@@ -7,5 +7,6 @@ namespace TEAMModelOS.SDK.Context.Attributes.Azure
     [AttributeUsage(AttributeTargets.Property)]
     [AttributeUsage(AttributeTargets.Property)]
     public class PartitionKeyAttribute : Attribute
     public class PartitionKeyAttribute : Attribute
     {
     {
+      // public string name { get; set; }
     }
     }
 }
 }

+ 238 - 224
TEAMModelOS.SDK/Module/AzureCosmosDBV3/AzureCosmosDBV3Repository.cs

@@ -1,5 +1,6 @@
 using Microsoft.Azure.Cosmos;
 using Microsoft.Azure.Cosmos;
 using Microsoft.Azure.Cosmos.Linq;
 using Microsoft.Azure.Cosmos.Linq;
+using OpenXmlPowerTools;
 using System;
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Collections.Generic;
@@ -21,31 +22,48 @@ using TEAMModelOS.SDK.Module.AzureCosmosDB.Configuration;
 
 
 namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 {
 {
-    public class CosmosModelInfo
+   
+    public  class AzureCosmosDBV3Repository  : IAzureCosmosDBV3Repository
     {
     {
-        public Container container { get; set; }
-        public bool cache { get; set; }
-        public bool monitor { get; set; } = false;
-        public Type type { get; set; }
-    }
 
 
-    public class AzureCosmosDBV3Repository : IAzureCosmosDBV3Repository
-    {
 
 
         private CosmosClient CosmosClient { get; set; }
         private CosmosClient CosmosClient { get; set; }
+        public CosmosDict CosmosDict { get; set; } = new CosmosDict();
         /// <summary>
         /// <summary>
-        /// 线程安全的dict类型
+        /// 数据库名
         /// </summary>
         /// </summary>
-        private Dictionary<string, CosmosModelInfo> DocumentCollectionDict { get; set; } = new Dictionary<string, CosmosModelInfo>();
-
         private string DatabaseId { get; set; }
         private string DatabaseId { get; set; }
+        /// <summary>
+        /// RU
+        /// </summary>
         private int CollectionThroughput { get; set; }
         private int CollectionThroughput { get; set; }
+        /// <summary>
+        /// 数据库对象
+        /// </summary>
         private Database database { get; set; }
         private Database database { get; set; }
+        /// <summary>
+        /// 分页大小
+        /// </summary>
         int pageSize = 200;
         int pageSize = 200;
+        /// <summary>
+        /// 缓存前缀
+        /// </summary>
         private const string CacheCosmosPrefix = "cosmos:";
         private const string CacheCosmosPrefix = "cosmos:";
+        /// <summary>
+        /// 扫描类
+        /// </summary>
         private string[] ScanModel { get; set; }
         private string[] ScanModel { get; set; }
+        /// <summary>
+        /// 超时时间
+        /// </summary>
         private const int timeoutSeconds = 86400;
         private const int timeoutSeconds = 86400;
+        /// <summary>
+        /// ttl时长 1秒
+        /// </summary>
         private const int ttl = 1;
         private const int ttl = 1;
+        /// <summary>
+        /// 更新源通知容器
+        /// </summary>
         private string leaseId = "AleaseContainer";
         private string leaseId = "AleaseContainer";
         public AzureCosmosDBV3Repository(AzureCosmosDBOptions options, CosmosSerializer cosmosSerializer)
         public AzureCosmosDBV3Repository(AzureCosmosDBOptions options, CosmosSerializer cosmosSerializer)
         {
         {
@@ -62,11 +80,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 DatabaseId = options.Database;
                 DatabaseId = options.Database;
                 CollectionThroughput = options.CollectionThroughput;
                 CollectionThroughput = options.CollectionThroughput;
                 ScanModel = options.ScanModel;
                 ScanModel = options.ScanModel;
-                // InitializeDatabase().GetAwaiter().GetResult();
             }
             }
             catch (CosmosException e)
             catch (CosmosException e)
             {
             {
-                // Dispose(true);
                 throw new BizException(e.Message, 500, e.StackTrace);
                 throw new BizException(e.Message, 500, e.StackTrace);
             }
             }
         }
         }
@@ -86,118 +102,105 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 DatabaseId = options.Database;
                 DatabaseId = options.Database;
                 CollectionThroughput = options.CollectionThroughput;
                 CollectionThroughput = options.CollectionThroughput;
                 ScanModel = options.ScanModel;
                 ScanModel = options.ScanModel;
-                // InitializeDatabase().GetAwaiter().GetResult();
             }
             }
             catch (CosmosException e)
             catch (CosmosException e)
             {
             {
-                //   Dispose(true);
                 throw new BizException(e.Message, 500, e.StackTrace);
                 throw new BizException(e.Message, 500, e.StackTrace);
             }
             }
         }
         }
 
 
-
-        public async Task<Dictionary<string, CosmosModelInfo>> InitializeDatabase()
-        {
-            try
+        /// <summary>
+        /// 初始化CosmosDB数据库
+        /// </summary>
+        /// <returns></returns>
+        public async Task<CosmosDict> InitializeDatabase() {
+            database = await CosmosClient.CreateDatabaseIfNotExistsAsync(DatabaseId, CollectionThroughput);
+            FeedIterator<ContainerProperties> resultSetIterator = database.GetContainerQueryIterator<ContainerProperties>();
+            while (resultSetIterator.HasMoreResults)
             {
             {
-                database = await CosmosClient.CreateDatabaseIfNotExistsAsync(DatabaseId, CollectionThroughput);
-                FeedIterator<ContainerProperties> resultSetIterator = database.GetContainerQueryIterator<ContainerProperties>();
-                while (resultSetIterator.HasMoreResults)
+                foreach (ContainerProperties container in await resultSetIterator.ReadNextAsync())
                 {
                 {
-                    foreach (ContainerProperties container in await resultSetIterator.ReadNextAsync())
-                    {
-                        DocumentCollectionDict.TryAdd(container.Id, new CosmosModelInfo { container = database.GetContainer(container.Id), cache = false, monitor = false });
-                    }
+                   CosmosDict.nameCosmos.TryAdd(container.Id, new CosmosModelInfo { container = database.GetContainer(container.Id), cache = false, monitor = false });
                 }
                 }
-                bool isMonitor = false;
-                //获取数据库所有的表
-                List<Type> types = ReflectorExtensions.GetAllTypeAsAttribute<CosmosDBAttribute>(ScanModel);
-                foreach (Type type in types)
+            }
+            bool isMonitor = false;
+            //获取数据库所有的表
+            List<Type> types = ReflectorExtensions.GetAllTypeAsAttribute<CosmosDBAttribute>(ScanModel);
+            foreach (Type type in types)
+            {
+                string PartitionKey = GetPartitionKey(type);
+                string CollectionName = "";
+                int RU = 0;
+                bool cache = false;
+                bool monitor = false;
+                IEnumerable<CosmosDBAttribute> attributes = type.GetCustomAttributes<CosmosDBAttribute>(true);
+                if (attributes != null && !string.IsNullOrEmpty(attributes.First<CosmosDBAttribute>().Name))
                 {
                 {
-                    string PartitionKey = GetPartitionKey(type);
-                    string CollectionName = "";
-                    int RU = 0;
-                    bool cache = false;
-                    bool monitor = false;
-                    IEnumerable<CosmosDBAttribute> attributes = type.GetCustomAttributes<CosmosDBAttribute>(true);
-                    if (!string.IsNullOrEmpty(attributes.First<CosmosDBAttribute>().Name))
-                    {
-                        CollectionName = attributes.First<CosmosDBAttribute>().Name;
-                    }
-                    else
-                    {
-                        CollectionName = type.Name;
-                    }
-                    if (attributes.First<CosmosDBAttribute>().Cache)
-                    {
-                        cache = attributes.First<CosmosDBAttribute>().Cache;
-                    }
-                    if (attributes.First<CosmosDBAttribute>().Monitor)
+                    CollectionName = attributes.First<CosmosDBAttribute>().Name;
+                }
+                else {
+                    throw new BizException("必须指定容器名",ResponseCode.PARAMS_ERROR);
+                }
+                if (attributes.First<CosmosDBAttribute>().Cache)
+                {
+                    cache = attributes.First<CosmosDBAttribute>().Cache;
+                }
+                if (attributes.First<CosmosDBAttribute>().Monitor)
+                {
+                    monitor = attributes.First<CosmosDBAttribute>().Monitor;
+                    if (monitor)
                     {
                     {
-                        monitor = attributes.First<CosmosDBAttribute>().Monitor;
-                        if (monitor)
-                        {
-                            isMonitor = true;
-                        }
+                        isMonitor = true;
                     }
                     }
-                    //else
-                    //{
-                    //    cache = false;
-                    //}
-                    if (attributes.First<CosmosDBAttribute>().RU > 400)
+                }
+                if (attributes.First<CosmosDBAttribute>().RU > 400)
+                {
+                    RU = attributes.First<CosmosDBAttribute>().RU;
+                }
+                else
+                {
+                    RU = CollectionThroughput;
+                }
+                //如果表存在于数据则检查RU是否变动,如果不存在则执行创建DocumentCollection
+                if (CosmosDict.nameCosmos.TryGetValue(CollectionName, out CosmosModelInfo cosmosModelInfo))
+                { //更新RU
+
+                    cosmosModelInfo.cache = cache;
+                    Container container = CosmosClient.GetDatabase(DatabaseId).GetContainer(cosmosModelInfo.container.Id);
+                    int? throughputResponse = await container.ReadThroughputAsync();
+                    if (throughputResponse < RU)
                     {
                     {
-                        RU = attributes.First<CosmosDBAttribute>().RU;
+                        await CosmosClient.GetDatabase(DatabaseId).GetContainer(cosmosModelInfo.container.Id).ReplaceThroughputAsync(RU);
                     }
                     }
-                    else
+                    CosmosModelInfo cosmos = new CosmosModelInfo { container = container, cache = cache, monitor = monitor, type = type };
+                    CosmosDict.nameCosmos[CollectionName] = cosmos;
+                    CosmosDict.typeCosmos.Add(type.Name, cosmos);
+                }
+                else {
+                    ContainerProperties containerProperties = new ContainerProperties { Id = CollectionName, DefaultTimeToLive = -1 };
+                    if (!string.IsNullOrEmpty(PartitionKey))
                     {
                     {
-                        RU = CollectionThroughput;
-                    }
-                    //如果表存在于数据则检查RU是否变动,如果不存在则执行创建DocumentCollection
-                    if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo cosmosModelInfo))
-                    { //更新RU
-
-                        cosmosModelInfo.cache = cache;
-                        Container container = CosmosClient.GetDatabase(DatabaseId).GetContainer(cosmosModelInfo.container.Id);
-                        int? throughputResponse = await container.ReadThroughputAsync();
-                        if (throughputResponse < RU)
-                        {
-                            await CosmosClient.GetDatabase(DatabaseId).GetContainer(cosmosModelInfo.container.Id).ReplaceThroughputAsync(RU);
-                        }
-                        DocumentCollectionDict[CollectionName] = new CosmosModelInfo { container = container, cache = cache, monitor = monitor, type = type };
+                        containerProperties.PartitionKeyPath = "/" + PartitionKey;
                     }
                     }
-                    else
+                    if (RU > CollectionThroughput)
                     {
                     {
-                        ContainerProperties containerProperties = new ContainerProperties { Id = CollectionName ,DefaultTimeToLive=-1 };
-
-                        if (!string.IsNullOrEmpty(PartitionKey))
-                        {
-                            containerProperties.PartitionKeyPath = "/" + PartitionKey;
-                        }
-                        if (RU > CollectionThroughput)
-                        {
-                            CollectionThroughput = RU;
-                        }
-                        Container containerWithConsistentIndexing = await database.CreateContainerIfNotExistsAsync(containerProperties, throughput: CollectionThroughput);
-                        DocumentCollectionDict.TryAdd(CollectionName, new CosmosModelInfo { container = containerWithConsistentIndexing, cache = cache, monitor = monitor, type = type });
+                        CollectionThroughput = RU;
                     }
                     }
+                    Container containerWithConsistentIndexing = await database.CreateContainerIfNotExistsAsync(containerProperties, throughput: CollectionThroughput);
+                    CosmosModelInfo cosmos = new CosmosModelInfo { container = containerWithConsistentIndexing, cache = cache, monitor = monitor, type = type };
+                    CosmosDict.nameCosmos[CollectionName] = cosmos;
+                    CosmosDict.typeCosmos.Add(type.Name, cosmos);
                 }
                 }
-                if (isMonitor)
-                {
-                    ContainerProperties leaseProperties = new ContainerProperties { Id = leaseId, PartitionKeyPath = "/id", DefaultTimeToLive = -1 };
-                    Container leaseContainer = await database.CreateContainerIfNotExistsAsync(leaseProperties, throughput: CollectionThroughput);
-                    DocumentCollectionDict.TryAdd(leaseId, new CosmosModelInfo { container = leaseContainer, cache = false, monitor = false });
-                }
-                return DocumentCollectionDict;
             }
             }
-            catch (CosmosException e)
+            if (isMonitor)
             {
             {
-                throw new BizException(e.Message, 500, e.StackTrace);
+                ContainerProperties leaseProperties = new ContainerProperties { Id = leaseId, PartitionKeyPath = "/id", DefaultTimeToLive = -1 };
+                Container leaseContainer = await database.CreateContainerIfNotExistsAsync(leaseProperties, throughput: CollectionThroughput);
+                CosmosDict.nameCosmos.TryAdd(leaseId, new CosmosModelInfo { container = leaseContainer, cache = false, monitor = false });
             }
             }
+            return CosmosDict;
         }
         }
 
 
-      
-
-
         private string GetPartitionKey<T>()
         private string GetPartitionKey<T>()
         {
         {
             Type type = typeof(T);
             Type type = typeof(T);
@@ -225,7 +228,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
             if (attrProperties.Count <= 0)
             if (attrProperties.Count <= 0)
             {
             {
-                throw new BizException(type.Name + "has no PartitionKey !");
+                throw new BizException(type.Name + " has no PartitionKey !");
             }
             }
             else
             else
             {
             {
@@ -237,41 +240,41 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
         }
         }
 
 
-
         private async Task<CosmosModelInfo> InitializeCollection<T>()
         private async Task<CosmosModelInfo> InitializeCollection<T>()
         {
         {
             Type type = typeof(T);
             Type type = typeof(T);
             string partitionKey = GetPartitionKey<T>();
             string partitionKey = GetPartitionKey<T>();
-            string CollectionName;
+            CosmosDBAttribute cosmosDBAttribute = null;
             IEnumerable<CosmosDBAttribute> attributes = type.GetCustomAttributes<CosmosDBAttribute>(true);
             IEnumerable<CosmosDBAttribute> attributes = type.GetCustomAttributes<CosmosDBAttribute>(true);
-            if (!string.IsNullOrEmpty(attributes.First<CosmosDBAttribute>().Name))
+            if (attributes != null && !string.IsNullOrEmpty(attributes.First<CosmosDBAttribute>().Name))
             {
             {
-                CollectionName = attributes.First<CosmosDBAttribute>().Name;
+                cosmosDBAttribute = attributes.First<CosmosDBAttribute>();
             }
             }
-            else
-            {
-                CollectionName = type.Name;
+            else {
+                throw new BizException(type.Name+"未指定CosmosDB表名",ResponseCode.PARAMS_ERROR);
             }
             }
-            return await InitializeCollection(CollectionName, partitionKey);
+            
+            return await InitializeCollection(cosmosDBAttribute, type.Name, partitionKey);
         }
         }
-
-        private async Task<CosmosModelInfo> InitializeCollection(string CollectionName, string PartitionKey)
+        private async Task<CosmosModelInfo> InitializeCollection(CosmosDBAttribute cosmosDBAttribute, string typeName, string PartitionKey)
         {
         {
             /////内存中已经存在这个表则直接返回
             /////内存中已经存在这个表则直接返回
-            if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo cosmosModelInfo))
+            if (CosmosDict.typeCosmos.TryGetValue(typeName, out CosmosModelInfo cosmosModelInfo))
             {
             {
                 return cosmosModelInfo;
                 return cosmosModelInfo;
             }///如果没有则尝试默认创建
             }///如果没有则尝试默认创建
             else
             else
             {
             {
-                ContainerProperties containerProperties = new ContainerProperties { Id = CollectionName };
+                ContainerProperties containerProperties = new ContainerProperties { Id = cosmosDBAttribute.Name };
                 if (!string.IsNullOrEmpty(PartitionKey))
                 if (!string.IsNullOrEmpty(PartitionKey))
                 {
                 {
-                    containerProperties.PartitionKeyPath = "/" + PartitionKey;
+                    containerProperties.PartitionKeyPath = "/"+ PartitionKey;
                 }
                 }
-                Container containerWithConsistentIndexing = await database.CreateContainerIfNotExistsAsync(containerProperties, throughput: CollectionThroughput);
-                CosmosModelInfo cosmosModel = new CosmosModelInfo { container = containerWithConsistentIndexing, cache = false };
-                DocumentCollectionDict.TryAdd(CollectionName, cosmosModel);
+
+                Container containerWithConsistentIndexing = await database.CreateContainerIfNotExistsAsync(containerProperties, throughput: cosmosDBAttribute.RU);
+                CosmosModelInfo cosmosModel = new CosmosModelInfo { container = containerWithConsistentIndexing, cache = cosmosDBAttribute.Cache,monitor= cosmosDBAttribute.Monitor };
+                CosmosDict. nameCosmos.TryAdd(cosmosDBAttribute.Name, cosmosModel);
+                CosmosDict.typeCosmos.TryAdd(typeName, cosmosModel);
                 return cosmosModel;
                 return cosmosModel;
             }
             }
         }
         }
@@ -281,10 +284,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         /// <typeparam name="T"></typeparam>
         /// <typeparam name="T"></typeparam>
         /// <param name="list"></param>
         /// <param name="list"></param>
         /// <returns></returns>
         /// <returns></returns>
-        private async Task<List<T>> DeleteTTL<T>(List<T> list)where T:ID {
+        private async Task<List<T>> DeleteTTL<T>(List<T> list) where T : ID
+        {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
-            list.ForEach(x=> { x.ttl = ttl; });
-            list= await SaveOrUpdateAll(list);
+            list.ForEach(x => { x.ttl = ttl; });
+            list = await SaveOrUpdateAll(list);
             if (container.cache && RedisHelper.Instance != null)
             if (container.cache && RedisHelper.Instance != null)
             {
             {
                 list.ForEach(async x => {
                 list.ForEach(async x => {
@@ -293,17 +297,22 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
             return list;
             return list;
         }
         }
+
+
         public async Task<List<IdPk>> DeleteAll<T>(List<IdPk> ids) where T : ID
         public async Task<List<IdPk>> DeleteAll<T>(List<IdPk> ids) where T : ID
         {
         {
+
+         //   string pk = GetPartitionKey<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             List<IdPk> idPks = new List<IdPk>();
             List<IdPk> idPks = new List<IdPk>();
             if (container.monitor)
             if (container.monitor)
             {
             {
-                List<T> list= await FindByDict<T>(new Dictionary<string, object>() { { "id", ids.Select(x => x.id).ToArray() } });
-                list= await DeleteTTL(list);
+                List<T> list = await FindByDict<T>(new Dictionary<string, object>() { { "id", ids.Select(x => x.id).ToArray() } });
+                list = await DeleteTTL(list);
                 return ids;
                 return ids;
             }
             }
-            else {
+            else
+            {
                 int pages = (int)Math.Ceiling((double)ids.Count / pageSize);
                 int pages = (int)Math.Ceiling((double)ids.Count / pageSize);
                 Stopwatch stopwatch = Stopwatch.StartNew();
                 Stopwatch stopwatch = Stopwatch.StartNew();
                 for (int i = 0; i < pages; i++)
                 for (int i = 0; i < pages; i++)
@@ -317,11 +326,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                             {
                             {
                                 using (ResponseMessage response = task.Result)
                                 using (ResponseMessage response = task.Result)
                                 {
                                 {
-                                    idPks.Add(new IdPk { id = item.id, pk = item.pk.ToString(), StatusCode = response.StatusCode });
-                                //    if (!response.IsSuccessStatusCode)
-                                //    {
-                                //    }
-                            }
+                                    idPks.Add(new IdPk { id = item.id, pk = item.pk, StatusCode = response.StatusCode });
+                                    //    if (!response.IsSuccessStatusCode)
+                                    //    {
+                                    //    }
+                                }
                             }
                             }
                             ));
                             ));
                     });
                     });
@@ -336,10 +345,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 stopwatch.Stop();
                 stopwatch.Stop();
                 return idPks;
                 return idPks;
             }
             }
-
-           
         }
         }
-
         public async Task<List<IdPk>> DeleteAll<T>(Dictionary<string, object> dict) where T : ID
         public async Task<List<IdPk>> DeleteAll<T>(Dictionary<string, object> dict) where T : ID
         {
         {
             if (dict.Keys.Count > 0)
             if (dict.Keys.Count > 0)
@@ -347,10 +353,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 List<T> list = await FindByDict<T>(dict);
                 List<T> list = await FindByDict<T>(dict);
                 return await DeleteAll(list);
                 return await DeleteAll(list);
             }
             }
-            else {
-                throw new  BizException("参数为空", 500);
+            else
+            {
+                throw new BizException("参数为空", 500);
             }
             }
-           
+
         }
         }
         public async Task<List<IdPk>> DeleteAll<T>(List<T> enyites) where T : ID
         public async Task<List<IdPk>> DeleteAll<T>(List<T> enyites) where T : ID
         {
         {
@@ -362,13 +369,15 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             if (container.monitor)
             if (container.monitor)
             {
             {
                 enyites = await DeleteTTL(enyites);
                 enyites = await DeleteTTL(enyites);
-                foreach (T t in enyites) {
+                foreach (T t in enyites)
+                {
                     object o = type.GetProperty(pk).GetValue(t, null);
                     object o = type.GetProperty(pk).GetValue(t, null);
-                    idPks.Add(new IdPk { id = t.id, pk =o.ToString(), StatusCode = HttpStatusCode .NoContent});
+                    idPks.Add(new IdPk { id = t.id, pk = o.ToString(), StatusCode = HttpStatusCode.NoContent });
                 }
                 }
                 return idPks;
                 return idPks;
             }
             }
-            else {
+            else
+            {
                 int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
                 int pages = (int)Math.Ceiling((double)enyites.Count / pageSize);
                 Stopwatch stopwatch = Stopwatch.StartNew();
                 Stopwatch stopwatch = Stopwatch.StartNew();
                 for (int i = 0; i < pages; i++)
                 for (int i = 0; i < pages; i++)
@@ -408,27 +417,30 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 return idPks;
                 return idPks;
             }
             }
         }
         }
-
         public async Task<IdPk> DeleteAsync<T>(IdPk idPk) where T : ID
         public async Task<IdPk> DeleteAsync<T>(IdPk idPk) where T : ID
         {
         {
             return await DeleteAsync<T>(idPk.id, idPk.pk);
             return await DeleteAsync<T>(idPk.id, idPk.pk);
         }
         }
         public async Task<IdPk> DeleteAsync<T>(string id, string pk) where T : ID
         public async Task<IdPk> DeleteAsync<T>(string id, string pk) where T : ID
         {
         {
+
+          //  pk = GetPartitionKey<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             if (container.monitor)
             if (container.monitor)
             {
             {
-                List<T> list=  await FindByDict<T>(new Dictionary<string, object>() { { "id", id } });
+                List<T> list = await FindByDict<T>(new Dictionary<string, object>() { { "id", id } });
                 if (list.Count > 0)
                 if (list.Count > 0)
                 {
                 {
                     await DeleteTTL<T>(list);
                     await DeleteTTL<T>(list);
                     return new IdPk { id = id, pk = pk, StatusCode = HttpStatusCode.NoContent };
                     return new IdPk { id = id, pk = pk, StatusCode = HttpStatusCode.NoContent };
                 }
                 }
-                else {
+                else
+                {
                     throw new BizException("未找到ID匹配的数据,删除失败");
                     throw new BizException("未找到ID匹配的数据,删除失败");
                 }
                 }
             }
             }
-            else {
+            else
+            {
                 ResponseMessage response = await container.container.DeleteItemStreamAsync(id: id, partitionKey: new PartitionKey(pk));
                 ResponseMessage response = await container.container.DeleteItemStreamAsync(id: id, partitionKey: new PartitionKey(pk));
                 if (container.cache && RedisHelper.Instance != null)
                 if (container.cache && RedisHelper.Instance != null)
                 {
                 {
@@ -436,7 +448,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 }
                 }
                 return new IdPk { id = id, pk = pk, StatusCode = response.StatusCode };
                 return new IdPk { id = id, pk = pk, StatusCode = response.StatusCode };
             }
             }
-            
+
         }
         }
 
 
         public async Task<IdPk> DeleteAsync<T>(T entity) where T : ID
         public async Task<IdPk> DeleteAsync<T>(T entity) where T : ID
@@ -444,33 +456,29 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             string partitionKey = GetPartitionKey<T>();
             string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             Type type = typeof(T);
-            object o = type.GetProperty(partitionKey).GetValue(entity, null);
+             object o = type.GetProperty(partitionKey).GetValue(entity, null);
             if (container.monitor)
             if (container.monitor)
             {
             {
-                await DeleteTTL<T>(new List<T>() { entity});
+                await DeleteTTL<T>(new List<T>() { entity });
                 return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = HttpStatusCode.NoContent };
                 return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = HttpStatusCode.NoContent };
             }
             }
-            else {
+            else
+            {
                 ResponseMessage response = await container.container.DeleteItemStreamAsync(id: entity.id, partitionKey: new PartitionKey(o.ToString()));
                 ResponseMessage response = await container.container.DeleteItemStreamAsync(id: entity.id, partitionKey: new PartitionKey(o.ToString()));
                 if (container.cache && RedisHelper.Instance != null)
                 if (container.cache && RedisHelper.Instance != null)
                 {
                 {
                     await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, entity.id);
                     await RedisHelper.HDelAsync(CacheCosmosPrefix + container.container.Id, entity.id);
                 }
                 }
-                return new IdPk { id = entity.id, pk = o.ToString(), StatusCode = response.StatusCode };
+                return new IdPk { id = entity.id, pk = partitionKey, StatusCode = response.StatusCode };
             }
             }
         }
         }
-        //public async Task<T> DeleteAsync<T>(string id) where T : ID
-        //{
-        //    Container container = await InitializeCollection<T>();
-        //    ItemResponse<T> response = await container.DeleteItemAsync<T>(id: id, partitionKey: new PartitionKey(GetPartitionKey<T>()));
-        //    return response.Resource;
-        //}
-
         public async Task<List<T>> FindAll<T>(List<string> propertys = null) where T : ID
         public async Task<List<T>> FindAll<T>(List<string> propertys = null) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
+            string pk = typeof(T).Name;
             StringBuilder sql;
             StringBuilder sql;
             sql = SQLHelperParametric.GetSQLSelect(propertys);
             sql = SQLHelperParametric.GetSQLSelect(propertys);
+            sql.Append(" where c.pk = " + pk);
             CosmosDbQuery cosmosDbQuery = new CosmosDbQuery { QueryText = sql.ToString() };
             CosmosDbQuery cosmosDbQuery = new CosmosDbQuery { QueryText = sql.ToString() };
             FeedIterator<T> query = container.container.GetItemQueryIterator<T>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition);
             FeedIterator<T> query = container.container.GetItemQueryIterator<T>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition);
             return await ResultsFromFeedIterator(query);
             return await ResultsFromFeedIterator(query);
@@ -514,9 +522,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 
 
             return results;
             return results;
         }
         }
-        public async Task<List<dynamic>> FindByDict(string CollectionName, Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null)
+        public async Task<List<dynamic>> FindByDict(string CollectionName, Dictionary<string, object> dict, List<string> propertys = null)
         {
         {
-            if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo container))
+            if (CosmosDict.typeCosmos.TryGetValue(CollectionName, out CosmosModelInfo container))
             {
             {
                 //StringBuilder sql = new StringBuilder("select value(c) from c");
                 //StringBuilder sql = new StringBuilder("select value(c) from c");
                 //SQLHelper.GetSQL(dict, ref sql);
                 //SQLHelper.GetSQL(dict, ref sql);
@@ -525,9 +533,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 //    QueryText = sql.ToString()
                 //    QueryText = sql.ToString()
 
 
                 //};
                 //};
+
+                string pk = container.type.Name;
                 StringBuilder sql;
                 StringBuilder sql;
                 sql = SQLHelperParametric.GetSQLSelect(propertys);
                 sql = SQLHelperParametric.GetSQLSelect(propertys);
-                CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql);
+                CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql, pk);
                 QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
                 QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
                 FeedIterator<dynamic> query = container.container.GetItemQueryIterator<dynamic>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryRequestOptions);
                 FeedIterator<dynamic> query = container.container.GetItemQueryIterator<dynamic>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryRequestOptions);
                 return await ResultsFromFeedIterator(query);
                 return await ResultsFromFeedIterator(query);
@@ -539,16 +549,27 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 
 
         }
         }
 
 
-        public async Task<List<dynamic>> FindCountByDict(string CollectionName, Dictionary<string, object> dict, string partitionKey = null)
+        public async Task<List<int>> FindCountByDict<T>(Dictionary<string, object> dict) {
+            CosmosModelInfo container = await InitializeCollection<T>();
+            string pk = typeof(T).Name;
+            StringBuilder sql = new StringBuilder("select  value count(c)  from c");
+            CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql, pk);
+            QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
+            FeedIterator<int> query = container.container.GetItemQueryIterator<int>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryRequestOptions);
+            return await ResultsFromFeedIterator(query);
+        }
+
+        public async Task<List<dynamic>> FindCountByDict(string CollectionName, Dictionary<string, object> dict)
         {
         {
-            if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo container))
+            if (CosmosDict.typeCosmos.TryGetValue(CollectionName, out CosmosModelInfo container))
             {
             {
+                string pk = container.type.Name;
                 dict.Remove("@CURRPAGE");
                 dict.Remove("@CURRPAGE");
                 dict.Remove("@PAGESIZE");
                 dict.Remove("@PAGESIZE");
                 dict.Remove("@ASC");
                 dict.Remove("@ASC");
                 dict.Remove("@DESC");
                 dict.Remove("@DESC");
                 StringBuilder sql = new StringBuilder("select  value count(c)  from c");
                 StringBuilder sql = new StringBuilder("select  value count(c)  from c");
-                CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql);
+                CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql, pk);
                 QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
                 QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
                 FeedIterator<dynamic> query = container.container.GetItemQueryIterator<dynamic>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryRequestOptions);
                 FeedIterator<dynamic> query = container.container.GetItemQueryIterator<dynamic>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryRequestOptions);
                 return await ResultsFromFeedIterator(query);
                 return await ResultsFromFeedIterator(query);
@@ -559,16 +580,16 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
         }
         }
 
 
-        public async Task<List<T>> FindByParams<T>(Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null) where T : ID
+        public async Task<List<T>> FindByParams<T>(Dictionary<string, object> dict, List<string> propertys = null) where T : ID
         {
         {
-            return await FindByDict<T>(dict, partitionKey, propertys);
+            return await FindByDict<T>(dict, propertys);
         }
         }
-        public async Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null) where T : ID
+        public async Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, List<string> propertys = null) where T : ID
         {
         {
             StringBuilder sql;
             StringBuilder sql;
             sql = SQLHelperParametric.GetSQLSelect(propertys);
             sql = SQLHelperParametric.GetSQLSelect(propertys);
-
-            CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql);
+            string pk = typeof(T).Name;
+            CosmosDbQuery cosmosDbQuery = SQLHelperParametric.GetSQL(dict, sql, pk);
             QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
             QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
             return await ResultsFromQueryAndOptions<T>(cosmosDbQuery, queryRequestOptions);
             return await ResultsFromQueryAndOptions<T>(cosmosDbQuery, queryRequestOptions);
         }
         }
@@ -623,6 +644,9 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         }
         }
         public async Task<List<T>> FindLinq<T>(Expression<Func<T, bool>> query = null, Expression<Func<T, object>> order = null, bool isDesc = false) where T : ID
         public async Task<List<T>> FindLinq<T>(Expression<Func<T, bool>> query = null, Expression<Func<T, object>> order = null, bool isDesc = false) where T : ID
         {
         {
+
+            string pk = typeof(T).Name;
+            query = query.And(x => x.pk == pk);
             //QueryRequestOptions queryRequestOptions = GetQueryRequestOptions(itemsPerPage);
             //QueryRequestOptions queryRequestOptions = GetQueryRequestOptions(itemsPerPage);
             QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
             QueryRequestOptions queryRequestOptions = GetDefaultQueryRequestOptions(itemsPerPage: GetEffectivePageSize(-1, null));
             FeedIterator<T> feedIterator;
             FeedIterator<T> feedIterator;
@@ -684,33 +708,38 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
 
 
         public async Task<List<T>> FindSQL<T>(string sql, Dictionary<string, object> Parameters = null) where T : ID
         public async Task<List<T>> FindSQL<T>(string sql, Dictionary<string, object> Parameters = null) where T : ID
         {
         {
-            CosmosModelInfo container = await InitializeCollection<T>();
-            QueryRequestOptions queryOptions = GetQueryRequestOptions(GetEffectivePageSize(-1, null));
-            if (Parameters != null)
+            if (sql.Contains(".pk"))
             {
             {
-                CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
+                CosmosModelInfo container = await InitializeCollection<T>();
+                QueryRequestOptions queryOptions = GetQueryRequestOptions(GetEffectivePageSize(-1, null));
+                if (Parameters != null)
+                {
+                    CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
+                    {
+                        QueryText = sql,
+                        Parameters = Parameters
+                    };
+                    FeedIterator<T> feedIterator = container.container
+                    .GetItemQueryIterator<T>(cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryOptions);
+                    return await ResultsFromFeedIterator(feedIterator);
+                }
+                else
                 {
                 {
-                    QueryText = sql,
-                    Parameters = Parameters
-                };
-                FeedIterator<T> feedIterator = container.container
-                .GetItemQueryIterator<T>(cosmosDbQuery.CosmosQueryDefinition, requestOptions: queryOptions);
-                return await ResultsFromFeedIterator(feedIterator);
+                    QueryDefinition queryDefinition = new QueryDefinition(sql);
+                    return await ResultsFromFeedIterator<T>(container.container.GetItemQueryIterator<T>(queryDefinition));
+                }
             }
             }
             else
             else
             {
             {
-                QueryDefinition queryDefinition = new QueryDefinition(sql);
-                return await ResultsFromFeedIterator<T>(container.container.GetItemQueryIterator<T>(queryDefinition));
+                throw new BizException("查询参数必须设置 .pk ", ResponseCode.PARAMS_ERROR);
             }
             }
         }
         }
-
-
-
         public async Task<T> Save<T>(T entity) where T : ID
         public async Task<T> Save<T>(T entity) where T : ID
         {
         {
             try
             try
             {
             {
                 CosmosModelInfo container = await InitializeCollection<T>();
                 CosmosModelInfo container = await InitializeCollection<T>();
+                entity.pk = container.type.Name;
                 ItemResponse<T> response = await container.container.CreateItemAsync<T>(entity);
                 ItemResponse<T> response = await container.container.CreateItemAsync<T>(entity);
                 if (container.cache && RedisHelper.Instance != null)
                 if (container.cache && RedisHelper.Instance != null)
                 {
                 {
@@ -742,7 +771,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             {
             {
                 flag = true;
                 flag = true;
             }
             }
-            string pk = GetPartitionKey<T>();
+            string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             Type type = typeof(T);
             Stopwatch stopwatch = Stopwatch.StartNew();
             Stopwatch stopwatch = Stopwatch.StartNew();
             for (int i = 0; i < pages; i++)
             for (int i = 0; i < pages; i++)
@@ -751,9 +780,10 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 List<KeyValuePair<PartitionKey, Stream>> itemsToInsert = new List<KeyValuePair<PartitionKey, Stream>>();
                 List<KeyValuePair<PartitionKey, Stream>> itemsToInsert = new List<KeyValuePair<PartitionKey, Stream>>();
                 lists.ForEach(async x =>
                 lists.ForEach(async x =>
                 {
                 {
+                    x.pk = type.Name;
                     MemoryStream stream = new MemoryStream();
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
-                    object o = type.GetProperty(pk).GetValue(x, null);
+                    object o = type.GetProperty(partitionKey).GetValue(x, null);
                     KeyValuePair<PartitionKey, Stream> keyValue = new KeyValuePair<PartitionKey, Stream>(new PartitionKey(o.ToString()), stream);
                     KeyValuePair<PartitionKey, Stream> keyValue = new KeyValuePair<PartitionKey, Stream>(new PartitionKey(o.ToString()), stream);
                     itemsToInsert.Add(keyValue);
                     itemsToInsert.Add(keyValue);
                 });
                 });
@@ -790,6 +820,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         public async Task<T> SaveOrUpdate<T>(T entity) where T : ID
         public async Task<T> SaveOrUpdate<T>(T entity) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
+            entity.pk = container.type.Name;
             ItemResponse<T> response = await container.container.UpsertItemAsync(item: entity);
             ItemResponse<T> response = await container.container.UpsertItemAsync(item: entity);
             if (container.cache && RedisHelper.Instance != null)
             if (container.cache && RedisHelper.Instance != null)
             {
             {
@@ -819,7 +850,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             {
             {
                 flag = true;
                 flag = true;
             }
             }
-            string pk = GetPartitionKey<T>();
+            string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             Type type = typeof(T);
             Stopwatch stopwatch = Stopwatch.StartNew();
             Stopwatch stopwatch = Stopwatch.StartNew();
             for (int i = 0; i < pages; i++)
             for (int i = 0; i < pages; i++)
@@ -828,9 +859,10 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 List<KeyValuePair<PartitionKey, Stream>> itemsToInsert = new List<KeyValuePair<PartitionKey, Stream>>();
                 List<KeyValuePair<PartitionKey, Stream>> itemsToInsert = new List<KeyValuePair<PartitionKey, Stream>>();
                 lists.ForEach(async x =>
                 lists.ForEach(async x =>
                 {
                 {
+                    x.pk = type.Name;
                     MemoryStream stream = new MemoryStream();
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
-                    object o = type.GetProperty(pk).GetValue(x, null);
+                     object o = type.GetProperty(partitionKey).GetValue(x, null);
                     KeyValuePair<PartitionKey, Stream> keyValue = new KeyValuePair<PartitionKey, Stream>(new PartitionKey(o.ToString()), stream);
                     KeyValuePair<PartitionKey, Stream> keyValue = new KeyValuePair<PartitionKey, Stream>(new PartitionKey(o.ToString()), stream);
                     itemsToInsert.Add(keyValue);
                     itemsToInsert.Add(keyValue);
                 });
                 });
@@ -864,12 +896,13 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             stopwatch.Stop();
             stopwatch.Stop();
             return enyites;
             return enyites;
         }
         }
-
         public async Task<T> Update<T>(T entity) where T : ID
         public async Task<T> Update<T>(T entity) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
-            string pk = GetPartitionKey<T>();
-            object o = typeof(T).GetProperty(pk).GetValue(entity, null);
+            string partitionKey = GetPartitionKey<T>();
+            Type type = typeof(T);
+            entity.pk = type.Name;
+            object o = type.GetProperty(partitionKey).GetValue(entity, null);
             ItemResponse<T> response = await container.container.ReplaceItemAsync(entity, entity.id, new PartitionKey(o.ToString()));
             ItemResponse<T> response = await container.container.ReplaceItemAsync(entity, entity.id, new PartitionKey(o.ToString()));
             if (container.cache && RedisHelper.Instance != null)
             if (container.cache && RedisHelper.Instance != null)
             {
             {
@@ -885,15 +918,12 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
             return response.Resource;
             return response.Resource;
         }
         }
-
-
         internal class Item
         internal class Item
         {
         {
             public string id { get; set; }
             public string id { get; set; }
             public string pk { get; set; }
             public string pk { get; set; }
             public MemoryStream stream { get; set; }
             public MemoryStream stream { get; set; }
         }
         }
-
         public async Task<List<T>> UpdateAll<T>(List<T> enyites) where T : ID
         public async Task<List<T>> UpdateAll<T>(List<T> enyites) where T : ID
         {
         {
             //await Task.Run(() => Parallel.ForEach(entities, new ParallelOptions { MaxDegreeOfParallelism = 2 }, (item) =>
             //await Task.Run(() => Parallel.ForEach(entities, new ParallelOptions { MaxDegreeOfParallelism = 2 }, (item) =>
@@ -908,7 +938,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             {
             {
                 flag = true;
                 flag = true;
             }
             }
-            string pk = GetPartitionKey<T>();
+            string partitionKey = GetPartitionKey<T>();
             Type type = typeof(T);
             Type type = typeof(T);
             Stopwatch stopwatch = Stopwatch.StartNew();
             Stopwatch stopwatch = Stopwatch.StartNew();
             for (int i = 0; i < pages; i++)
             for (int i = 0; i < pages; i++)
@@ -917,9 +947,10 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 List<Item> itemsToInsert = new List<Item>();
                 List<Item> itemsToInsert = new List<Item>();
                 lists.ForEach(async x =>
                 lists.ForEach(async x =>
                 {
                 {
+                    x.pk = type.Name;
                     MemoryStream stream = new MemoryStream();
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
-                    object o = type.GetProperty(pk).GetValue(x, null);
+                    object o = type.GetProperty(partitionKey).GetValue(x, null);
                     Item keyValue = new Item { id = x.id, pk = o.ToString(), stream = stream };
                     Item keyValue = new Item { id = x.id, pk = o.ToString(), stream = stream };
                     itemsToInsert.Add(keyValue);
                     itemsToInsert.Add(keyValue);
                 });
                 });
@@ -953,26 +984,15 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             stopwatch.Stop();
             stopwatch.Stop();
             return enyites;
             return enyites;
         }
         }
-
-        //public void Dispose()
-        //{
-        //    Dispose(true);
-        //}
-        //protected virtual void Dispose(bool disposing)
-        //{
-        //    if (disposing)
-        //    {
-        //        CosmosClient?.Dispose();
-        //    }
-        //}
-        private async Task<T> FindByIdAsSql<T>(string id) where T : ID
+        private async Task<List<T>> FindByIdAsSql<T>(string id) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
+            string pk = container.type.Name;
             CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
             CosmosDbQuery cosmosDbQuery = new CosmosDbQuery
             {
             {
                 QueryText = @"SELECT *
                 QueryText = @"SELECT *
                             FROM    c 
                             FROM    c 
-                            WHERE   c.id = @id",
+                            WHERE c.pk='" + pk + "' and   c.id = @id",
                 Parameters = new Dictionary<string, object>
                 Parameters = new Dictionary<string, object>
                  {
                  {
 
 
@@ -981,21 +1001,18 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             };
             };
             FeedIterator<T> feedIterator = container.container
             FeedIterator<T> feedIterator = container.container
                .GetItemQueryIterator<T>(cosmosDbQuery.CosmosQueryDefinition);
                .GetItemQueryIterator<T>(cosmosDbQuery.CosmosQueryDefinition);
-            return (await ResultsFromFeedIterator(feedIterator)).SingleOrDefault();
+            return (await ResultsFromFeedIterator(feedIterator)).ToList();
         }
         }
-
-
         public async Task<T> FindByIdPk<T>(string id, string pk) where T : ID
         public async Task<T> FindByIdPk<T>(string id, string pk) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
             ItemResponse<T> response = await container.container.ReadItemAsync<T>(id: id, partitionKey: new PartitionKey(pk));
             ItemResponse<T> response = await container.container.ReadItemAsync<T>(id: id, partitionKey: new PartitionKey(pk));
             return response.Resource;
             return response.Resource;
         }
         }
-
-        public async Task<T> FindById<T>(string id, bool cache = true) where T : ID
+        public async Task<List<T>> FindById<T>(string id, bool cache = true) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
-            if (container.cache && RedisHelper.Instance != null  && cache==true)
+            if (container.cache && RedisHelper.Instance != null && cache == true)
             {
             {
 
 
                 return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, id, timeoutSeconds, () => { return FindByIdAsSql<T>(id); });
                 return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, id, timeoutSeconds, () => { return FindByIdAsSql<T>(id); });
@@ -1007,7 +1024,6 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
 
 
         }
         }
-
         public async Task<List<T>> FindByIds<T>(List<string> ids) where T : ID
         public async Task<List<T>> FindByIds<T>(List<string> ids) where T : ID
         {
         {
             CosmosModelInfo container = await InitializeCollection<T>();
             CosmosModelInfo container = await InitializeCollection<T>();
@@ -1040,46 +1056,44 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                 return await FindByDict<T>(new Dictionary<string, object> { { "id", ids.ToArray() } });
                 return await FindByDict<T>(new Dictionary<string, object> { { "id", ids.ToArray() } });
             }
             }
         }
         }
-
-        public async Task<dynamic> FindById(string CollectionName, string id)
+        public async Task<dynamic> FindById(string typeName, string id)
         {
         {
-            if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo container))
+            if (CosmosDict.typeCosmos.TryGetValue(typeName, out CosmosModelInfo container))
             {
             {
                 if (container.cache && RedisHelper.Instance != null)
                 if (container.cache && RedisHelper.Instance != null)
                 {
                 {
 
 
-                    return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, id, timeoutSeconds, () => { return FindByDict(CollectionName, new Dictionary<string, object> { { "id", id } }); });
+                    return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, id, timeoutSeconds, () => { return FindByDict(typeName, new Dictionary<string, object> { { "id", id } }); });
 
 
                 }
                 }
                 else
                 else
                 {
                 {
-                    return await FindByDict(CollectionName, new Dictionary<string, object> { { "id", id } });
+                    return await FindByDict(typeName, new Dictionary<string, object> { { "id", id } });
                 }
                 }
             }
             }
             else
             else
             {
             {
-                throw new BizException("CollectionName named:" + CollectionName + " dose not exsit in Database!");
+                throw new BizException("CollectionName named:" + typeName + " dose not exsit in Database!");
             }
             }
         }
         }
-
-        public async Task<List<dynamic>> FindByIds(string CollectionName, List<string> ids)
+        public async Task<List<dynamic>> FindByIds(string typeName, List<string> ids)
         {
         {
-            if (DocumentCollectionDict.TryGetValue(CollectionName, out CosmosModelInfo container))
+            if (CosmosDict. typeCosmos.TryGetValue(typeName, out CosmosModelInfo container))
             {
             {
                 if (container.cache && RedisHelper.Instance != null)
                 if (container.cache && RedisHelper.Instance != null)
                 {
                 {
 
 
-                    return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, timeoutSeconds, () => { return FindByDict(CollectionName, new Dictionary<string, object> { { "id", ids.ToArray() } }); });
+                    return await RedisHelper.CacheShellAsync(CacheCosmosPrefix + container.container.Id, timeoutSeconds, () => { return FindByDict(typeName, new Dictionary<string, object> { { "id", ids.ToArray() } }); });
 
 
                 }
                 }
                 else
                 else
                 {
                 {
-                    return await FindByDict(CollectionName, new Dictionary<string, object> { { "id", ids.ToArray() } });
+                    return await FindByDict(typeName, new Dictionary<string, object> { { "id", ids.ToArray() } });
                 }
                 }
             }
             }
             else
             else
             {
             {
-                throw new BizException("CollectionName named:" + CollectionName + " dose not exsit in Database!");
+                throw new BizException("CollectionName named:" + typeName + " dose not exsit in Database!");
             }
             }
         }
         }
     }
     }

+ 18 - 0
TEAMModelOS.SDK/Module/AzureCosmosDBV3/CosmosDict.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
+{
+    public class CosmosDict
+    {
+        /// <summary>
+        /// 表名方式的连接
+        /// </summary>
+        public Dictionary<string, CosmosModelInfo> nameCosmos { get; set; } = new Dictionary<string, CosmosModelInfo>();
+        /// <summary>
+        /// 类类型的连接
+        /// </summary>
+        public Dictionary<string, CosmosModelInfo> typeCosmos { get; set; } = new Dictionary<string, CosmosModelInfo>();
+    }
+}

+ 15 - 0
TEAMModelOS.SDK/Module/AzureCosmosDBV3/CosmosModelInfo.cs

@@ -0,0 +1,15 @@
+using Microsoft.Azure.Cosmos;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
+{
+    public class CosmosModelInfo
+    {
+        public Container container { get; set; }
+        public bool cache { get; set; }
+        public bool monitor { get; set; } = false;
+        public Type type { get; set; }
+    }
+}

+ 8 - 6
TEAMModelOS.SDK/Module/AzureCosmosDBV3/IAzureCosmosDBV3Repository.cs

@@ -74,11 +74,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         /// <param name="query"></param>
         /// <param name="query"></param>
         /// <returns></returns>
         /// <returns></returns>
         Task<List<T>> FindLinq<T>(Expression<Func<T, bool>> query = null, Expression<Func<T, object>> order = null, bool isDesc = false) where T : ID;
         Task<List<T>> FindLinq<T>(Expression<Func<T, bool>> query = null, Expression<Func<T, object>> order = null, bool isDesc = false) where T : ID;
-        Task<List<T>> FindByParams<T>(Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null) where T : ID;
-        Task<List<T>> FindByDict<T>(Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null) where T : ID;
-        Task<List<dynamic>> FindByDict(string CollectionName, Dictionary<string, object> dict, string partitionKey = null, List<string> propertys = null);
-        Task<List<dynamic>> FindCountByDict(string CollectionName, Dictionary<string, object> dict, string partitionKey = null);
-        Task<Dictionary<string,CosmosModelInfo>> InitializeDatabase();
+        Task<List<T>> FindByParams<T>(Dictionary<string, object> dict,  List<string> propertys = null) where T : ID;
+        Task<List<T>> FindByDict<T>(Dictionary<string, object> dict,List<string> propertys = null) where T : ID;
+        Task<List<dynamic>> FindByDict(string CollectionName, Dictionary<string, object> dict, List<string> propertys = null);
+        Task<List<dynamic>> FindCountByDict(string CollectionName, Dictionary<string, object> dict);
+        Task<CosmosDict> InitializeDatabase();
         /// <summary>
         /// <summary>
         /// 根据ID获取  是否从cache获取  默认是
         /// 根据ID获取  是否从cache获取  默认是
         /// </summary>
         /// </summary>
@@ -86,9 +86,11 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
         /// <param name="id"></param>
         /// <param name="id"></param>
         /// <param name="cache"></param>
         /// <param name="cache"></param>
         /// <returns></returns>
         /// <returns></returns>
-        Task<T>FindById<T>(string id,bool cache=true) where T : ID;
+        Task<List<T>>FindById<T>(string id,bool cache=true) where T : ID;
         Task<List<T>> FindByIds<T>(List<string> ids) where T : ID;
         Task<List<T>> FindByIds<T>(List<string> ids) where T : ID;
         Task<dynamic> FindById(string CollectionName, string id);
         Task<dynamic> FindById(string CollectionName, string id);
         Task<List<dynamic>> FindByIds (string CollectionName, List<string> ids);
         Task<List<dynamic>> FindByIds (string CollectionName, List<string> ids);
+        Task<List<int>> FindCountByDict<T>(Dictionary<string, object> dict);
+     
     }
     }
 }
 }

+ 3 - 1
TEAMModelOS.SDK/Module/AzureCosmosDBV3/ID.cs

@@ -9,6 +9,8 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
     {
     {
         string id { get; set; }
         string id { get; set; }
        
        
-         int? ttl { get; set; }
+        int? ttl { get; set; }
+        string pk { get; set; }
+        string code { get; set; }
     }
     }
 }
 }

+ 9 - 3
TEAMModelOS.SDK/Module/AzureCosmosDBV3/SQLHelperParametric.cs

@@ -107,7 +107,7 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
             }
             }
         }
         }
 
 
-        public static CosmosDbQuery GetSQL(Dictionary<string, object> dict, StringBuilder sql)
+        public static CosmosDbQuery GetSQL(Dictionary<string, object> dict, StringBuilder sql,string pk=null)
         {
         {
             if (dict != null)
             if (dict != null)
             {
             {
@@ -265,8 +265,14 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDBV3
                     }
                     }
                     logicOperNum += 1;
                     logicOperNum += 1;
                 }
                 }
-
-                sql.Append(" where 1=1 ").Append(WhereString);
+                if (pk == null)
+                {
+                    sql.Append(" where 1=1 ").Append(WhereString);
+                }
+                else {
+                    sql.Append(" where c.pk='"+pk+"'").Append(WhereString);
+                }
+                
 
 
                 if (ASC != null)
                 if (ASC != null)
                 {
                 {

+ 4 - 14
TEAMModelOS.SDK/Module/Cache/CSRedisCacheService.cs

@@ -15,23 +15,13 @@ namespace TEAMModelOS.SDK.Module.Cache
     {
     {
         protected IDistributedCache _cache;
         protected IDistributedCache _cache;
 
 
-   // private ConnectionMultiplexer _connection;
-
-    private readonly string _instance;
-    public CSRedisCacheService(IDistributedCache cache //RedisCacheOptions options, int database = 0
-        )
-    {
+        public CSRedisCacheService(IDistributedCache cache  )
+        {
             _cache = cache;
             _cache = cache;
-       // _connection = ConnectionMultiplexer.Connect(options.Configuration);
-       //   _cache = _connection.GetDatabase(database);
-       //  _instance = options.InstanceName;
         }
         }
 
 
-    //public string GetKeyForRedis(string key)
-    //{
-    //    return _instance + key;
-    //}
-        /// <summary>
+    
+     /// <summary>
      /// 验证缓存项是否存在
      /// 验证缓存项是否存在
      /// </summary>
      /// </summary>
      /// <param name="key">缓存Key</param>
      /// <param name="key">缓存Key</param>

+ 1 - 1
TEAMModelOS.SDK/Module/Grpc/AspNetCore/Internal/BindMethodFinder.cs

@@ -10,7 +10,7 @@ namespace Grpc.Extension.AspNetCore.Internal
     internal static class BindMethodFinder
     internal static class BindMethodFinder
     {
     {
         private const BindingFlags BindMethodBindingFlags = BindingFlags.Public | BindingFlags.Static;
         private const BindingFlags BindMethodBindingFlags = BindingFlags.Public | BindingFlags.Static;
-
+  
         internal static MethodInfo? GetBindMethod(Type serviceType)
         internal static MethodInfo? GetBindMethod(Type serviceType)
         {
         {
             if (typeof(IGrpcService).IsAssignableFrom(serviceType))
             if (typeof(IGrpcService).IsAssignableFrom(serviceType))

+ 6 - 1
TEAMModelOS.SDK/Module/Grpc/AspNetCore/Internal/ProviderServiceBinder.cs

@@ -140,7 +140,12 @@ namespace Grpc.Extension.AspNetCore.Internal
 
 
             return (invoker, metadata);
             return (invoker, metadata);
         }
         }
-
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="methodName"></param>
+        /// <param name="methodParameters"></param>
+        /// <returns></returns>
         private MethodInfo? GetMethod(string methodName, Type[] methodParameters)
         private MethodInfo? GetMethod(string methodName, Type[] methodParameters)
         {
         {
             Type? currentType = typeof(TService);
             Type? currentType = typeof(TService);

+ 1 - 1
TEAMModelOS.Service/Models/Core/CodeValue.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class CodeValue
     public class CodeValue
     {
     {

+ 1 - 1
TEAMModelOS.Service/Models/Learn/ProcessRes.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 作业附件
     /// 作业附件

+ 1 - 1
TEAMModelOS.Service/Models/Core/ResourceReference.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     [TableName(Name = "CoreResourceReference")]
     [TableName(Name = "CoreResourceReference")]
     public class ResourceReference : TableEntity
     public class ResourceReference : TableEntity

+ 4 - 11
TEAMModelOS.Service/Models/Syllabus/SyllabusNode.cs

@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     [ProtoContract]
     [ProtoContract]
     public class SyllabusNode
     public class SyllabusNode
@@ -53,21 +53,14 @@ namespace TEAMModelOS.Service.Models.Syllabus
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         [ProtoMember(7)]
         [ProtoMember(7)]
         public int type { get; set; }
         public int type { get; set; }
-        /// <summary>
-        /// 备注
-        /// </summary>
-        //public string remark { get; set; }
+        
         /// <summary>
         /// <summary>
         /// 节点Key
         /// 节点Key
         /// </summary>
         /// </summary>
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         [ProtoMember(8)]
         [ProtoMember(8)]
         public string nodeKey { get; set; }
         public string nodeKey { get; set; }
-        ///// <summary>
-        /////主键
-        ///// </summary>
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string Id { get; set; }
+       
         /// <summary>
         /// <summary>
         /// 父级
         /// 父级
         /// </summary>
         /// </summary>
@@ -80,7 +73,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
         /// </summary>
         /// </summary>
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         [ProtoMember(10)]
         [ProtoMember(10)]
-        public string volumeCode { get; set; }
+        public string code { get; set; }
         /// <summary>
         /// <summary>
         /// 数据状态
         /// 数据状态
         /// </summary>
         /// </summary>

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/SyllabusTree.cs

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     public class SyllabusTree :SyllabusNode
     public class SyllabusTree :SyllabusNode
     {
     {

+ 2 - 2
TEAMModelOS.Service/Models/Learn/Target.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 发布对象
     /// 发布对象
@@ -17,7 +17,7 @@ namespace TEAMModelOS.Service.Models.Learn
         public string classroomCode { get; set; }
         public string classroomCode { get; set; }
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         [ProtoMember(2)]
         [ProtoMember(2)]
-        public string scopeCode { get; set; }
+        public string code { get; set; }
         [ProtoMember(3)]
         [ProtoMember(3)]
         public string classroomName { get; set; }
         public string classroomName { get; set; }
 
 

+ 16 - 28
TEAMModelOS.Service/Models/Exam/ExamItem.cs

@@ -4,25 +4,28 @@ using System.ComponentModel.DataAnnotations;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Learn;
 
 
-namespace TEAMModelOS.Service.Models.Exam.Models
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
-    /// 题目信息
+    ///  Teaching materials 教学材料  题目信息
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "ExamItem",Cache =true)]
-    public class ExamItem :ID
+    [CosmosDB(RU = 400, Name = "Common", Cache =true)]
+    public class ItemInfo :ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        //[PartitionKey(name = "ExamItem")]
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
-        public ExamItem()
+        public ItemInfo()
         {
         {
-            children = new List<ExamItem>();
+            children = new List<ItemInfo>();
             option = new List<CodeValue>();
             option = new List<CodeValue>();
             answer = new List<string>();
             answer = new List<string>();
             points = new List<string>();
             points = new List<string>();
             gradeCode = new List<string>();
             gradeCode = new List<string>();
+            repairResource = new List<ProcessRes>();
         }
         }
         public string shaCode { get; set; }
         public string shaCode { get; set; }
         //题干
         //题干
@@ -45,47 +48,32 @@ namespace TEAMModelOS.Service.Models.Exam.Models
         public List<string> points { get; set; }
         public List<string> points { get; set; }
         //认知层次 应用 综合 理解 评鉴 知识
         //认知层次 应用 综合 理解 评鉴 知识
         public string field { get; set; }
         public string field { get; set; }
-        public List<ExamItem> children { get; set; }
+        public List<ItemInfo> children { get; set; }
         // 配分  
         // 配分  
         public double score { get; set; }
         public double score { get; set; }
         /// <summary>
         /// <summary>
         /// 题号
         /// 题号
         /// </summary>
         /// </summary>
         public int order { get; set; }
         public int order { get; set; }
-        //补救内容
+        //补救
         public string repair { get; set; }
         public string repair { get; set; }
+
         /// <summary>
         /// <summary>
         /// 补救资源
         /// 补救资源
         /// </summary>
         /// </summary>
         public List<ProcessRes> repairResource { get; set; }
         public List<ProcessRes> repairResource { get; set; }
-        /// <summary>
-        /// 来源编码  个人 学校
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string scopeCode { get; set; }
+        
 
 
 
 
         public string subjectCode { get; set; }
         public string subjectCode { get; set; }
         public string periodCode { get; set; }
         public string periodCode { get; set; }
         public List<string> gradeCode { get; set; }
         public List<string> gradeCode { get; set; }
-        /// <summary>
-        /// 学段
-        /// </summary>
-       // public string period { get; set; }
-        /// <summary>
-        /// 年级
-        /// </summary>
-      //  public List<string> grade { get; set; }
+        
         /// <summary>
         /// <summary>
         /// 难度
         /// 难度
         /// </summary>
         /// </summary>
         public int level { get; set; }
         public int level { get; set; }
         public string id { get ; set ; }
         public string id { get ; set ; }
-        /// <summary>
-        /// 科目
-        /// </summary>
-      //  public string subject { get; set; }
         /// <summary>
         /// <summary>
         /// 是否综合题的小题
         /// 是否综合题的小题
         /// </summary>
         /// </summary>

+ 14 - 26
TEAMModelOS.Service/Models/Syllabus/Knowledge.cs

@@ -8,19 +8,26 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
-    /// 知识点
+    ///Teaching materials 教学材料 --- 知识点,知识块
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "Knowledge", Cache = true, Monitor = true)]
+    [CosmosDB(RU = 400, Name = "Common", Cache = true )]
     [ProtoContract]
     [ProtoContract]
-    public class Knowledge : ID
+    public class Knowledge: ID
     {
     {
-
-        public Knowledge() {
+        public Knowledge()
+        {
             points = new List<string>();
             points = new List<string>();
         }
         }
+        /// <summary>
+        /// 学校编码 如果是教师私人知识点为醍摩豆id 否则为学校编码 
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        // [PartitionKey(name = "Knowledge")]
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
         [ProtoMember(1)]
         [ProtoMember(1)]
         public string id { get; set; }
         public string id { get; set; }
@@ -50,14 +57,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
         [ProtoMember(5)]
         [ProtoMember(5)]
         public string subjectCode { get; set; }
         public string subjectCode { get; set; }
 
 
-        /// <summary>
-        /// 学校编码 如果是教师私人知识点为醍摩豆id 否则为学校编码 
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [ProtoMember(6)]
-        [PartitionKey]
-        public string scopeCode { get; set; }
-
+       
 
 
 
 
         [ProtoMember(7)]
         [ProtoMember(7)]
@@ -101,17 +101,5 @@ namespace TEAMModelOS.Service.Models.Syllabus
         public string period { get; set; }
         public string period { get; set; }
         public int ownCount { get; set; }
         public int ownCount { get; set; }
         public int openCount { get; set; }
         public int openCount { get; set; }
-
-        ///// <summary>
-        /////  school personal 学校或者个人
-        ///// </summary>
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string scope { get; set; }
-
-        /// <summary>
-        ///  醍摩豆id
-        /// </summary>
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string TEAMModelId { get; set; }
     }
     }
 }
 }

+ 11 - 9
TEAMModelOS.Service/Models/Syllabus/SyllabusResource.cs

@@ -7,20 +7,22 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "SyllabusResource",Cache = true)]
-    public class SyllabusResource : ID
+    /// <summary>
+    /// Teaching materials 教学材料 ---内容资源
+    /// </summary>
+    [CosmosDB(RU = 400, Name = "Common", Cache = true)]
+    public class Resource : ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        // [PartitionKey(name = "SyllabusResource")]
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
         public string id { get; set; }
         public string id { get; set; }
 
 
-        /// <summary>
-        /// 学校编码 如果是教师私人知识点为醍摩豆id 否则为学校编码 
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string scopeCode { get; set; }
+   
 
 
         /// <summary>
         /// <summary>
         /// 文件名字
         /// 文件名字

+ 12 - 5
TEAMModelOS.Service/Models/Syllabus/Syllabuses.cs

@@ -5,11 +5,18 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "Syllabus")]
-    public class Syllabuses : ID
+    /// <summary>
+    /// Teaching materials 教学材料 ---课纲
+    /// </summary>
+    [CosmosDB(RU = 400, Name = "Common")]
+    public class Syllabus : ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        //[PartitionKey(name = "Syllabuses")]
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
         /// <summary>
         /// <summary>
         /// 
         /// 
@@ -21,8 +28,8 @@ namespace TEAMModelOS.Service.Models.Syllabus
         /// 册别编码
         /// 册别编码
         /// </summary>
         /// </summary>
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string volumeCode { get; set; }
+      //  [PartitionKey]
+      //  public string volumeCode { get; set; }
 
 
         public List<SyllabusNode> children { get; set; }
         public List<SyllabusNode> children { get; set; }
     }
     }

+ 2 - 5
TEAMModelOS.Service/Models/Syllabus/KnowledgeBlock.cs

@@ -2,7 +2,7 @@
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     [TableName(Name = "SyllabusKnowledgeBlock")]
     [TableName(Name = "SyllabusKnowledgeBlock")]
     //
     //
@@ -13,10 +13,7 @@ namespace TEAMModelOS.Service.Models.Syllabus
         /// </summary>
         /// </summary>
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         public string Name { get; set; }
         public string Name { get; set; }
-        /// <summary>
-        /// 描述
-        /// </summary>
-        // public string Description { get; set; }
+        
         /// <summary>
         /// <summary>
         /// 上级ID
         /// 上级ID
         /// </summary>
         /// </summary>

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/KnowledgeBlockPoint.cs

@@ -2,7 +2,7 @@
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     [TableName(Name = "SyllabusKnowledgeBlockPoint")]
     [TableName(Name = "SyllabusKnowledgeBlockPoint")]
     //
     //

+ 1 - 1
TEAMModelOS.Service/Models/Syllabus/KnowledgePoint.cs

@@ -2,7 +2,7 @@
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 知识点
     /// 知识点

+ 7 - 11
TEAMModelOS.Service/Models/Syllabus/SyllabusVolume.cs

@@ -8,13 +8,16 @@ using Newtonsoft.Json;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using ProtoBuf;
 using ProtoBuf;
 
 
-namespace TEAMModelOS.Service.Models.Syllabus
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "SyllabusVolume",Monitor =true)]
+    [CosmosDB(RU = 400, Name = "Common", Monitor =true)]
     [ProtoContract]
     [ProtoContract]
-    public class SyllabusVolume :ID
+    public class Volume :ID
     {
     {
-
+        [PartitionKey]
+        public string code { get; set; }
+        // [PartitionKey(name = "SyllabusVolume")]
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         /// <summary>
         /// <summary>
         /// id生成规则
         /// id生成规则
@@ -26,13 +29,6 @@ namespace TEAMModelOS.Service.Models.Syllabus
         /// </summary>
         /// </summary>
         [ProtoMember(2)]
         [ProtoMember(2)]
         public int type { get; set; }
         public int type { get; set; }
-        /// <summary>
-        /// Type 如果为0 则是学校编码  如果为1 则是seminar 专题/研讨/培训
-        /// </summary>
-        [PartitionKey]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [ProtoMember(3)]
-        public string scopeCode { get; set; }
         
         
 
 
         /// <summary>
         /// <summary>

+ 0 - 16
TEAMModelOS.Service/Models/Core/ContentVerify.cs

@@ -1,16 +0,0 @@
-using Microsoft.Azure.Cosmos.Table;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-
-namespace TEAMModelOS.Service.Models.Core
-{
-    [TableName(Name = "CoreContentVerify")]
-    public class ContentVerify : TableEntity
-    {
-        public string Content { get; set; }
-        public string AlgorithmType { get; set; }
-        public string DigestCode { get; set; }
-    }
-}

+ 0 - 40
TEAMModelOS.Service/Models/Core/LoginInfo.cs

@@ -1,40 +0,0 @@
-using Microsoft.Azure.Cosmos.Table;
-using Newtonsoft.Json;
-using System.Text.Json.Serialization;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-
-namespace TEAMModelOS.Service.Models.Core
-{
-    /// <summary>
-    /// 登录信息
-    /// </summary>
-    [TableName(Name = "CoreLoginInfo")]
-    public class LoginInfo : TableEntity
-    {
-        [JsonPropertyName("TEAMModelId")]
-        [JsonProperty("TEAMModelId")]
-        public string TeamModelId { get; set; }
-        public string Phone { get; set; }
-        public string Ticket { get; set; }
-        public string Name { get; set; }
-        public string Token { get; set; }
-        public string CountryCode { get; set; }
-        /// <summary>
-        /// 登录时间
-        /// </summary>
-        public long LoginTime { get; set; }
-        /// <summary>
-        /// 超时时间
-        /// </summary>
-        public long Timeout { get; set; }
-        /// <summary>
-        /// 到期时间
-        /// </summary>
-        public long Expires { get; set; }
-        /// <summary>
-        /// 作用域
-        /// </summary>
-        public string Scope { get; set; }
-
-    }
-}

+ 0 - 50
TEAMModelOS.Service/Models/Core/Teacher.cs

@@ -1,50 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using System.Text.Json.Serialization;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-
-namespace TEAMModelOS.Service.Models.Core
-{
-    [CosmosDB(RU = 400, Name = "CoreTeacher")]
-    public class Teacher:ID
-    {
-        public int? ttl { get; set; } 
-        public string id { get; set; }
-        /// <summary>
-        /// 0 动态id  透過第三方申請,未認證手機號,TEAMModelId暫時為virtualId但是不顯示在介面上,當使用者驗證手機號後TEAMModelId會變為手機號。
-        /// 1 动态id  透過手機號申請,TEAMModelId為手機號
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public int type { get; set; }
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string name { get; set; }
-        public string email { get; set; }
-        public string cellphone { get; set; }
-        [PartitionKey]
-        public string areaCode { get; set; }
-        public int verifyFlg { get; set; }
-        public int status { get; set; } = 0;
-        public long createDate { get; set; }
-        public Password password { get; set; }
-        public string exValue { get; set; }
-        public string product { get; set; }
-        public List<ProductToken> productToken { get; set; }
-        public string shortCode { get; set; }
-        public string profilePicture { get; set; }
-        public string profilePictureUrl { get; set; }
-        [JsonPropertyName("TEAMModelId")]
-        [JsonProperty("TEAMModelId")]
-        public string TEAMModelId { get; set; }
-        public string loginTime { get; set; }
-        public string virtualId { get; set; }
-        public List<Oauth> oauth { get; set; } // 0 1
-        public string haveDevice { get; set; }//2
-        public Classroom classroom { get; set; }
-        public string studentId { get; set; }
-        public int seatNo { get; set; }
-    }
-}

+ 0 - 173
TEAMModelOS.Service/Models/Courses/Course.cs

@@ -1,173 +0,0 @@
-using ProtoBuf;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Syllabus;
-
-namespace TEAMModelOS.Service.Models.Courses
-{
-    /// <summary>
-    /// 课程
-    /// </summary>
-    [CosmosDB(RU = 400, Name = "Course")]
-    [ProtoContract]
-    public class Course : ID
-    {
-        public int? ttl { get; set; } 
-
-        /// <summary>
-        /// 学校编码 如果是教师私人知识点 则为 personal(写死) 否则为学校编码 
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        [ProtoMember(1)]
-        public string scopeCode { get; set; }
-
-
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string TEAMModelId { get; set; }
-        //public string schoolCode { get; set; }
-
-
-        /// <summary>
-        /// 基础信息
-        /// </summary>
-        [ProtoMember(2)]
-        public BaseInfo baseInfo { get; set; }
-
-        ///// <summary>
-        ///// personal:私有 school:校本
-        ///// </summary>
-        //[Required(ErrorMessage = "{0} 必须填写")]
-        //public string scope { get; set; }
-
-        /// <summary>
-        /// 协同教师
-        /// </summary>
-        [ProtoMember(3)]
-        public List<string> assistTeacher { get; set; }
-
-        /// <summary>
-        /// 上课时间表
-        /// </summary>
-        [ProtoMember(4)]
-        public List<CourseTime> courseTime { get; set; }
-
-        /// <summary>
-        /// 课程“教室” Classroom
-        /// </summary>
-        [ProtoMember(5)]
-        public List<string> classroom { get; set; }
-
-        /// <summary>
-        /// 关联课纲 SyllabusNode
-        /// </summary>
-        [ProtoMember(6)]
-        public List<string> syllabus { get; set; }
-
-        /// <summary>
-        /// id
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [ProtoMember(7)]
-        public string id { get; set; }
-
-    }
-
-    /// <summary>
-    /// 基础信息
-    /// </summary>
-    [ProtoContract]
-    public class BaseInfo
-    {
-        /// <summary>
-        /// 课程编码
-        /// </summary>
-        [ProtoMember(1)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string courseCode { get; set; }//'T968475'
-        
-        /// <summary>
-        /// 课程名称
-        /// </summary>
-        [ProtoMember(2)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string courseName { get; set; }// '一次函数极其图像'
-        
-        /// <summary>
-        /// 学段编码
-        /// </summary>
-        [ProtoMember(3)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string periodCode { get; set; }
-        
-        /// <summary>
-        /// 年级编码
-        /// </summary>
-        [ProtoMember(4)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string gradeCode { get; set; }
-        
-        /// <summary>
-        /// 学科编码
-        /// </summary>
-        [ProtoMember(5)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string subjectCode { get; set; }
-        
-        /// <summary>
-        /// 课程公告
-        /// </summary>
-        [ProtoMember(6)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string notice { get; set; }//
-    }
-
-
-    /// <summary>
-    /// 上课时间表
-    /// </summary>
-    [ProtoContract]
-    public class CourseTime
-    {
-
-        /// <summary>
-        /// 上课频率 每日、每周、每月、临时课程
-        /// </summary>
-        [ProtoMember(1)]
-        public string frequencyCode { get; set; }
-        /// <summary>
-        /// 课程开始时间
-        /// </summary>
-        [ProtoMember(2)]
-        public string beginTime { get; set; }
-        /// <summary>
-        /// 课程结束时间
-        /// </summary>
-        [ProtoMember(3)]
-        public string endTime { get; set; }
-        /// <summary>
-        /// 上课班级/教室
-        /// </summary>
-        [ProtoMember(4)]
-        public string classroomCode { get; set; } // Classroom
-        /// <summary>
-        /// 临时课程
-        /// </summary>
-        [ProtoMember(5)]
-        public List<string> frequencyName { get; set; }
-        /// <summary>
-        /// 每月课程
-        /// </summary>
-        //public string month { get; set; }
-        /// <summary>
-        /// 每周课程
-        /// </summary>
-        //public string weekly { get; set; }
-
-    }
-}

+ 0 - 39
TEAMModelOS.Service/Models/Courses/CourseStudentsGroup.cs

@@ -1,39 +0,0 @@
-using ProtoBuf;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-
-namespace TEAMModelOS.Service.Models.Courses
-{ 
-    /// <summary>
-    /// 课程 学生分组
-    /// </summary>
-    [CosmosDB(RU = 400, Name = "CourseStudentsGroup")]
-    public class CourseStudentsGroup :ID
-    {
-        public int? ttl { get; set; }
-        public string id { get; set; }
-        /// <summary>
-        /// 学校编码 如果是教师私人知识点 则为 personal(写死) 否则为学校编码 
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        [ProtoMember(1)]
-        public string scopeCode { get; set; }
-        //public List<ClassGroup> classGroups { get; set; }
-        public string classroomCode { get; set; }
-        public List<GroupStudent> groups { get; set; }
-    }
-
-  
-    public class GroupStudent
-    { 
-        public int seatNo { get; set; }
-        public string groupCode { get; set; }
-        public string groupName { get; set; }
-        public string studentId { get; set; }
-    }
-}

+ 0 - 39
TEAMModelOS.Service/Models/Exam/SimpleExam.cs

@@ -1,39 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-
-namespace TEAMModelOS.Service.Model.Exam.Models
-{
-    /// <summary>
-    /// 考试成绩信息
-    /// </summary>
-    [CosmosDB(RU = 400, Name = "SimpleExam")]
-    public class SimpleExam :ID
-    {
-        public int? ttl { get; set; }
-        public SimpleExam()
-        {
-            Classes = new List<Dictionary<string, int[]>>();
-            Result = new List<List<int>>();
-            Ids = new List<string>();
-            Point = new List<int>();
-        }
-        [JsonProperty(PropertyName = "id")]
-        public string id { get; set; }
-        public string Name { get; set; }
-        public string Time { get; set; }
-        [PartitionKey]
-        public string SubjectCode { get; set; }
-        public string Subject { get; set; }
-
-        public List<Dictionary<string, int[]>> Classes { get; set; }
-        public List<List<int>> Result { get; set; }
-        public List<string> Ids { get; set; }
-        public List<int> Point { get; set; }
-
-       
-    }
-}

+ 0 - 168
TEAMModelOS.Service/Models/Learn/HomeWork.cs

@@ -1,168 +0,0 @@
-using ProtoBuf;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Exam.Models;
-
-namespace TEAMModelOS.Service.Models.Learn
-{
-    /// <summary>
-    /// 作业
-    /// </summary>
-    [ProtoContract]
-    [CosmosDB(RU = 400, Name = "HomeWork")]
-    public class HomeWork:ID
-    {
-        public int? ttl { get; set; } 
-        public HomeWork()
-        {
-            target = new List<Target>();
-            resource = new List<ProcessRes>();
-        }
-
-        [ProtoMember(1)]
-        public string id { get; set; }
-
-        [PartitionKey]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [ProtoMember(2)]
-        public string scopeCode { get; set; }
-
-
-        /// <summary>
-        /// 作业名称
-        /// </summary>
-        [ProtoMember(3)]
-        public string name { get; set; }
-
-        /// <summary>
-        /// 作业发布对象
-        /// </summary>
-        [ProtoMember(4)]
-        public List<Target> target { get; set; }
-
-        /// <summary>
-        /// 发布模式 0 立即发布 1 定时
-        /// </summary>
-        [ProtoMember(5)]
-        public string publishModel { get; set; }
-
-        /// <summary>
-        /// 开始时间
-        /// </summary>
-        [ProtoMember(6)]
-        public long startTime { get; set; }
-
-        /// <summary>
-        /// 结束时间
-        /// </summary>
-        [ProtoMember(7)]
-        public long endTime { get; set; }
-
-        /// <summary>
-        /// 作业反馈类型
-        /// </summary>
-        //public string feedbackType { get; set; }
-
-        /// <summary>
-        /// 题目
-        /// </summary>
-        //public List<ExamItem> ExamItem { get; set; }
-
-
-
-        /// <summary>
-        /// 作业描述
-        /// </summary>
-        [ProtoMember(8)]
-        public string description { get; set; }
-
-  
-        /// <summary>
-        /// 作业附件
-        /// </summary>
-        [ProtoMember(9)]
-        public List<ProcessRes> resource { get; set; }
-
-
-        /// <summary>
-        /// 状态 
-        /// </summary>
-        [ProtoMember(10)]
-        public int state { get; set; }
-
-        //public Subdto subdto { get; set; }
-
-        /// <summary>
-        /// 学生 是否互评 是否可见 
-        /// </summary>
-        [ProtoMember(11)]
-        public List<string> other { get; set; }
-        //创建时间 
-        [ProtoMember(12)]
-        public long createTime { get; set; }
-        //public class Subdto {
-        //    /// <summary>
-        //    /// 提交人数
-        //    /// </summary>
-        //    public int submitted { get; set; }
-
-        //    /// <summary>
-        //    /// 总人数
-        //    /// </summary>
-        //    public int sum { get; set; }
-
-        //}
-
-
-        /// <summary>
-        /// 发布对象
-        ///// </summary>
-        //public class Target {
-        //    [Required(ErrorMessage = "{0} 必须填写")]
-        //    public string classroomCode { get; set; }
-        //    [Required(ErrorMessage = "{0} 必须填写")]
-        //    public string scopeCode { get; set; }
-        //    public string classroomName { get; set; }
-        //}
-
-        /// <summary>
-        /// 作业附件
-        /// </summary>
-        //public class ProcessRes
-        //{
-        //    /// <summary>
-        //    /// 文件名字
-        //    /// </summary>
-        //    public string fileName { get; set; }
-
-        //    /// <summary>
-        //    /// 
-        //    /// </summary>
-        //    public string blobUrl { get; set; }
-
-        //    /// <summary>
-        //    /// 文件大小
-        //    /// </summary>
-        //    public long size { get; set; }
-
-        //    /// <summary>
-        //    /// 缩略图链接  图片视频有 文件没有
-        //    /// </summary>
-        //    public string compressUrl { get; set; }
-
-        //    /// <summary>
-        //    /// 文件类型
-        //    /// </summary>
-        //    public string type { get; set; }
-
-        //    public int order { get; set; }
-
-        //}
-
-
-    }
-}

+ 0 - 127
TEAMModelOS.Service/Models/Learn/LeanProcess.cs

@@ -1,127 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Exam.Models;
-
-namespace TEAMModelOS.Service.Models.Learn
-{
-
-    /// <summary>
-    /// 编序学习
-    /// </summary>
-    [CosmosDB(RU = 400, Name = "LeanProcess")]
-    public class LeanProcess : ID
-    {
-        public int? ttl { get; set; } 
-        public LeanProcess() {
-            steps = new List<LearnUnit>();
-        }
-        
-        public string id { get; set; }
-
-        public string name { get; set; }
-
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string subjectCode { get; set; }
-
-        /// <summary>
-        /// 学段code
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string periodCode { get; set; }
-
-
-        /// <summary>
-        /// 活动介绍
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string Introduce { get; set; }
-
-
-        /// <summary>
-        /// 学习对象
-        /// </summary>
-        //public List<Target> target { get; set; }
-
-
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string scopeCode { get; set; }
-
-
-        /// <summary>
-        /// 最小单元
-        /// </summary>
-        public List<LearnUnit> steps { get; set; }
-       
-
-        //创建时间 
-        //public long createTime { get; set; }
-
-
-        //创建者
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string creator { get; set; }
-        
-        public class Target
-        {
-            public string classroomCode { get; set; }
-
-            public string scopeCode { get; set; }
-        }
-
-
-    }
-
-
-    //public class ProcessStep
-    //{
-    //    public ProcessStep() {
-    //        resource = new List<ProcessRes>();
-    //        item = new List<ExamItem>();
-    //    }
-    //    /// <summary>
-    //    /// 资源内容
-    //    /// [{"name":"","url":"","order":""}]
-    //    /// </summary>
-    //    public List<ProcessRes> resource { get; set; }
-    //    /// <summary>
-    //    /// 题目
-    //    /// </summary>
-    //    public List<ExamItem> item { get; set; }
-    //    [Required(ErrorMessage = "{0} 必须填写")]
-    //    public string name { get; set; }
-    //    public int order { get; set; }
-    //}
-
-    //public class ProcessRes{
-
-    //    [Required(ErrorMessage = "{0} 必须填写")]
-    //    public string fileName { get; set; }
-    //    [Required(ErrorMessage = "{0} 必须填写")]
-    //    public string blobUrl { get; set; }
-    //    public int order { get; set; }
-
-    //    /// <summary>
-    //    /// 文件大小
-    //    /// </summary>
-    //    public long size { get; set; }
-
-    //    /// <summary>
-    //    /// 缩略图链接  图片视频有 文件没有
-    //    /// </summary>
-    //    public string compressUrl { get; set; }
-
-    //    /// <summary>
-    //    /// 文件类型
-    //    /// </summary>
-    //    public string type { get; set; }
-
-
-
-    //}
-
-}

+ 0 - 169
TEAMModelOS.Service/Models/Learn/LearningAutonomous.cs

@@ -1,169 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Text;
-using TEAMModelOS.SDK.Context.Attributes.Azure;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Exam.Models;
-
-namespace TEAMModelOS.Service.Models.Learn
-{
-    /// <summary>
-    /// 自主学习
-    /// </summary>
-    [CosmosDB(RU = 400, Name = "LearningAutonomous")]
-    public class LearningAutonomous:ID
-    {
-        public int? ttl { get; set; } 
-        public LearningAutonomous()
-        {
-            target = new List<Target>();
-            steps = new List<ProcessStep>();
-        }
-
-        public string id { get; set; }
-
-        /// <summary>
-        /// 活动名称
-        /// </summary>
-        public string name { get; set; }
-
-     
-
-        /// <summary>
-        /// 学科code
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string subjectCode { get; set; }
-
-        /// <summary>
-        /// 学段code
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string periodCode { get; set; }
-        /// <summary>
-        /// 活动介绍
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string Introduce { get; set; }
-        /// <summary>
-        /// 学习对象
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public List<Target> target { get; set; }
-
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string scopeCode { get; set; }
-
-        /// <summary>
-        /// 步骤
-        /// </summary>
-        public List<ProcessStep> steps { get; set; }
-
-        /// <summary>
-        /// 是否闯关模式 0 或 1 vue组件不支持true false
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string isOrder { get; set; }
-
-        /// <summary>
-        /// 状态 
-        /// </summary>
-        public int state { get; set; }
-
-
-        /// <summary>
-        /// 发布模式 0 立即发布 1 定时
-        /// </summary>
-        public string publishModel { get; set; }
-
-        /// <summary>
-        /// 创建时间
-        /// </summary>
-        public long createTime { get; set; }
-        
-        /// <summary>
-        /// 创建者
-        /// </summary>
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string creator { get; set; }
-
-        /// <summary>
-        /// 开始时间
-        /// </summary>
-        public long startTime { get; set; }
-
-
-        /// <summary>
-        /// 截至时间 时间戳
-        /// </summary>
-        public int endTime { get; set; }
-
-        //public class Target
-        //{
-        //    public string classroomCode { get; set; }
-
-        //    public string scopeCode { get; set; }
-
-        //    public string classroomName { get; set; }
-        //}
-
-        public class ProcessStep
-        {
-            public ProcessStep()
-            {
-                resource = new List<ProcessRes>();
-                item = new List<ExamItem>();
-            }
-            /// <summary>
-            /// 资源内容
-            /// [{"name":"","url":"","order":""}]
-            /// </summary>
-            public List<ProcessRes> resource { get; set; }
-            /// <summary>
-            /// 题目
-            /// </summary>
-            public List<ExamItem> item { get; set; }
-
-            [Required(ErrorMessage = "{0} 必须填写")]
-            public string name { get; set; }
-        }
-
-        //public class ProcessRes
-        //{
-        //    /// <summary>
-        //    /// 文件名字
-        //    /// </summary>
-        //    [Required(ErrorMessage = "{0} 必须填写")]
-        //    public string fileName { get; set; }
-            
-        //    /// <summary>
-        //    /// 
-        //    /// </summary>
-        //    [Required(ErrorMessage = "{0} 必须填写")]
-        //    public string blobUrl { get; set; }
-            
-            
-        //    public int order { get; set; }
-
-        //    /// <summary>
-        //    /// 文件大小
-        //    /// </summary>
-        //    public long size { get; set; }
-
-        //    /// <summary>
-        //    /// 缩略图链接  图片视频有 文件没有
-        //    /// </summary>
-        //    public string compressUrl { get; set; }
-
-        //    /// <summary>
-        //    /// 文件类型
-        //    /// </summary>
-        //    public string type { get; set; }
-
-
-
-        //}
-    }
-}

+ 13 - 13
TEAMModelOS.Service/Models/PowerPoint/Chart.cs

@@ -59,8 +59,8 @@ namespace TEAMModelOS.Service.Model.PowerPoint
     ///  type radar
     ///  type radar
     ///  radarChart  
     ///  radarChart  
     ///     雷达图 
     ///     雷达图 
-    ///     带数据标记的雷达图<c:radarStyle val="marker"/>
-    ///     填充雷达图 <c:radarStyle val="filled"/>
+    ///     带数据标记的雷达图c:radarStyle val="marker"/>
+    ///     填充雷达图 c:radarStyle val="filled"/>
     /// </summary>
     /// </summary>
     public class RadarChart : CommonChart
     public class RadarChart : CommonChart
     {
     {
@@ -69,12 +69,12 @@ namespace TEAMModelOS.Service.Model.PowerPoint
     /// <summary>
     /// <summary>
     /// type scatter
     /// type scatter
     ///  scatterChart
     ///  scatterChart
-    ///     散点图 <c:scatterStyle val="lineMarker"/>
-    ///     带直线的散点图 <c:scatterStyle val="lineMarker"/>
-    ///     带直线和数据标记的散点图 <c:scatterStyle val="lineMarker"/>
+    ///     散点图 c:scatterStyle val="lineMarker"/>
+    ///     带直线的散点图 c:scatterStyle val="lineMarker"/>
+    ///     带直线和数据标记的散点图c:scatterStyle val="lineMarker"/>
     ///     
     ///     
-    ///     带平滑线和数据标记的散点图 <c:scatterStyle val="smoothMarker"/>
-    ///     带平滑线的散点图<c:scatterStyle val="smoothMarker"/>
+    ///     带平滑线和数据标记的散点图c:scatterStyle val="smoothMarker"/>
+    ///     带平滑线的散点图c:scatterStyle val="smoothMarker"/>
     ///  bubbleChart 气泡图   三维气泡图
     ///  bubbleChart 气泡图   三维气泡图
     /// </summary>
     /// </summary>
     public class ScatterChart : CommonChart
     public class ScatterChart : CommonChart
@@ -99,7 +99,7 @@ namespace TEAMModelOS.Service.Model.PowerPoint
         public bool is3D { get; set; }
         public bool is3D { get; set; }
     }
     }
     /// <summary>
     /// <summary>
-    /// type bar  条形图<c:barDir val="bar"/>   
+    /// type bar  条形图c:barDir val="bar"/>   
     ///  barChart
     ///  barChart
     ///     簇状条形图 clustered
     ///     簇状条形图 clustered
     ///     堆积条形图 stacked
     ///     堆积条形图 stacked
@@ -115,7 +115,7 @@ namespace TEAMModelOS.Service.Model.PowerPoint
         public bool is3D { get; set; }
         public bool is3D { get; set; }
     }
     }
     /// <summary>
     /// <summary>
-    ///  type bar  柱状图<c:barDir val="col"/>
+    ///  type bar  柱状图c:barDir val="col"/>
     ///  barChart
     ///  barChart
     ///     簇状柱形图 clustered
     ///     簇状柱形图 clustered
     ///     堆积柱形图 stacked
     ///     堆积柱形图 stacked
@@ -132,14 +132,14 @@ namespace TEAMModelOS.Service.Model.PowerPoint
         public bool is3D { get; set; }
         public bool is3D { get; set; }
     }
     }
     /// <summary>
     /// <summary>
-    /// type line   
+    ///  type line   
     ///  lineChart
     ///  lineChart
     ///  合并
     ///  合并
     ///     折线图 standard
     ///     折线图 standard
     ///     带数据标记的折线图 standard 
     ///     带数据标记的折线图 standard 
     ///  合并
     ///  合并
     ///     堆积折线图 stacked
     ///     堆积折线图 stacked
-    ///     带标记的堆积折线图 stacked  <c:layout>不为空
+    ///     带标记的堆积折线图 stacked  c:layout>不为空
     ///  合并 
     ///  合并 
     ///     百分比堆积折线图 percentStacked
     ///     百分比堆积折线图 percentStacked
     ///     带数据标记的百分比堆积折线图 percentStacked
     ///     带数据标记的百分比堆积折线图 percentStacked
@@ -157,8 +157,8 @@ namespace TEAMModelOS.Service.Model.PowerPoint
     ///  pieChart
     ///  pieChart
     ///     饼图  不包含   
     ///     饼图  不包含   
     ///  ofPieChart
     ///  ofPieChart
-    ///     子母饼图   包含<c:ofPieType val="pie"/> 且val为 pie
-    ///     复合条饼图 包含<c:ofPieType val="bar"/> 且val为 bar
+    ///     子母饼图   包含 c:ofPieType val="pie"/> 且val为 pie
+    ///     复合条饼图 包含 c:ofPieType val="bar"/> 且val为 bar
     ///  pie3DChart
     ///  pie3DChart
     ///     三维饼图
     ///     三维饼图
     ///  doughnutChart
     ///  doughnutChart

+ 1 - 1
TEAMModelOS.Service/Models/PowerPoint/Item.cs

@@ -6,7 +6,7 @@ namespace TEAMModelOS.Service.Model.PowerPoint
 {
 {
     public abstract class Item
     public abstract class Item
     {
     {
-        // Sp  CxnSp Media Group  Table Chart
+        // Sp  CxnSp Media Group  Table Chart Diagram
         public string type { get; set; }
         public string type { get; set; }
         public Position position { get; set; }
         public Position position { get; set; }
       //  public string Xml { get; set; }
       //  public string Xml { get; set; }

+ 1 - 3
TEAMModelOS.Service/Models/PowerPoint/Slide.cs

@@ -1,8 +1,6 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Exam.Models;
 
 
 namespace TEAMModelOS.Service.Model.PowerPoint
 namespace TEAMModelOS.Service.Model.PowerPoint
 {
 {
@@ -15,7 +13,7 @@ namespace TEAMModelOS.Service.Model.PowerPoint
         public double width { get; set; }
         public double width { get; set; }
         //高度
         //高度
         public double height { get; set; }
         public double height { get; set; }
-        public ExamItem exercise { get; set; }
+        public Models.ItemInfo exercise { get; set; }
         //1 PPTX  2 HTML  来源
         //1 PPTX  2 HTML  来源
         public int source { get; set; }
         public int source { get; set; }
         /// <summary>
         /// <summary>

+ 6 - 13
TEAMModelOS.Service/Models/Core/Classroom.cs

@@ -7,13 +7,13 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     [ProtoContract]
     [ProtoContract]
-    [CosmosDB(RU = 400, Name = "CoreClassroom")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class Classroom:ID
     public class Classroom:ID
-    {   
-       
+    {
+        public string pk { get; set; }
         public   int? ttl { get; set; }
         public   int? ttl { get; set; }
         public Classroom()
         public Classroom()
         {
         {
@@ -21,14 +21,8 @@ namespace TEAMModelOS.Service.Models.Core
         }
         }
 
 
         [ProtoMember(1)]
         [ProtoMember(1)]
-      //  [Required(ErrorMessage = "{0} 必须填写")]
         [JsonPropertyName("id")]
         [JsonPropertyName("id")]
         public string id { get; set; }
         public string id { get; set; }
-
-        [ProtoMember(2)]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [PartitionKey]
-        public string scopeCode { get; set; }
         [ProtoMember(3)]
         [ProtoMember(3)]
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         public string classroomCode { get; set; }
         public string classroomCode { get; set; }
@@ -59,9 +53,8 @@ namespace TEAMModelOS.Service.Models.Core
         [ProtoMember(13)]
         [ProtoMember(13)]
         [Required(ErrorMessage = "{0} 必须填写,请设置个人教室还是学校教室")]
         [Required(ErrorMessage = "{0} 必须填写,请设置个人教室还是学校教室")]
         public int type { get; set; } = 1;
         public int type { get; set; } = 1;
-
-        //public string scope { get; set; }
-        //public string TEAMModelId { get; set; }
+        [PartitionKey]
+        public string code { get; set; }
     }
     }
 }
 }
 
 

+ 50 - 0
TEAMModelOS.Service/Models/SchoolInfo/Course.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+using TEAMModelOS.Service.Models;
+
+namespace TEAMModelOS.Service.Models
+{
+    /// <summary>
+    /// 课程
+    /// </summary>
+    [CosmosDB(RU = 400, Name = "School")]
+    public class Course : ID
+    {
+        /// <summary>
+        /// 课程id
+        /// </summary>
+        public string id { get; set; }
+        public int? ttl { get; set; }
+        public string pk { get; set; }
+        /// <summary>
+        /// 学校编码  或醍摩豆ID
+        /// </summary>
+        [PartitionKey]
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string code { get; set; }
+        /// <summary>
+        /// 课程名称
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string courseName { get; set; }
+        /// <summary>
+        /// 课程编码
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string courseCode { get; set; }
+        /// <summary>
+        /// 学期编码
+        /// </summary>
+        public string semesterCode { get; set; }
+        /// <summary>
+        /// 科目编码
+        /// </summary>
+        public string subjectCode { get; set; }
+
+
+    }
+}

+ 8 - 4
TEAMModelOS.Service/Models/Exam/ExamAnswer.cs

@@ -5,14 +5,16 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Exam.Models
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 考生作答信息
     /// 考生作答信息
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "ExamAnswer")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class ExamAnswer :ID
     public class ExamAnswer :ID
     {
     {
+       // [PartitionKey(name = "ExamAnswer")]
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         public ExamAnswer()
         public ExamAnswer()
         {
         {
@@ -20,12 +22,14 @@ namespace TEAMModelOS.Service.Models.Exam.Models
         }
         }
         [JsonProperty(PropertyName = "id")]
         [JsonProperty(PropertyName = "id")]
         public string id { get; set; }
         public string id { get; set; }
-        [PartitionKey]
-        public string Code { get; set; }
+     //   [PartitionKey]
+      //  public string Code { get; set; }
         /// <summary>
         /// <summary>
         /// 考试活动code
         /// 考试活动code
         /// </summary>
         /// </summary>
         public string examCode { get; set; }
         public string examCode { get; set; }
         public List<List<string>> Answer { get; set; }
         public List<List<string>> Answer { get; set; }
+        [PartitionKey]
+        public string code { get; set; }
     }
     }
 }
 }

+ 7 - 4
TEAMModelOS.Service/Models/Exam/ExamInfo.cs

@@ -6,21 +6,24 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Exam.Models
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 考试基础信息
     /// 考试基础信息
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "ExamInfo")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class ExamInfo :ID
     public class ExamInfo :ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        //  [PartitionKey(name = "ExamInfo")]
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         public ExamInfo() {
         public ExamInfo() {
         }
         }
         [JsonProperty(PropertyName = "id")]
         [JsonProperty(PropertyName = "id")]
         public string id { get; set; }
         public string id { get; set; }
-        [PartitionKey]
-        public string scopeCode { get; set; }
+
         public string name { get; set; }
         public string name { get; set; }
         public int stuCount { get; set; }
         public int stuCount { get; set; }
         public long createTime { get; set; }
         public long createTime { get; set; }

+ 7 - 3
TEAMModelOS.Service/Models/Exam/ExamResult.cs

@@ -4,14 +4,18 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Exam.Models
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 考试成绩信息
     /// 考试成绩信息
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "ExamResult")]
+    [CosmosDB(RU = 400, Name = "School")]
     public  class ExamResult:ID
     public  class ExamResult:ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        // [PartitionKey(name = "ExamResult")]
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         public ExamResult()
         public ExamResult()
         {
         {
@@ -28,7 +32,7 @@ namespace TEAMModelOS.Service.Models.Exam.Models
         public List<List<int>> result { get; set; }
         public List<List<int>> result { get; set; }
         public List<string> ids { get; set; }
         public List<string> ids { get; set; }
         public List<int> point { get; set; }
         public List<int> point { get; set; }
-        [PartitionKey]
+      //  [PartitionKey]
         public string examCode { get; set; }
         public string examCode { get; set; }
         public string schoolCode { get; set; }
         public string schoolCode { get; set; }
         public string paperCode { get; set; }
         public string paperCode { get; set; }

+ 1 - 1
TEAMModelOS.Service/Models/Core/Campus.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class Campus
     public class Campus
     {
     {

+ 1 - 1
TEAMModelOS.Service/Models/Core/Grade.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class Grade
     public class Grade
     {
     {

+ 1 - 1
TEAMModelOS.Service/Models/Core/Period.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class Period
     public class Period
     {
     {

+ 1 - 1
TEAMModelOS.Service/Models/Core/Semester.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class Semester
     public class Semester
     {
     {

+ 1 - 1
TEAMModelOS.Service/Models/Core/Subject.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     public class Subject
     public class Subject
     {
     {

+ 15 - 13
TEAMModelOS.Service/Models/Exam/ExamPaper.cs

@@ -5,27 +5,29 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Exam.Models
-{
+namespace TEAMModelOS.Service.Models
+{ 
     /// <summary>
     /// <summary>
     /// 试卷信息
     /// 试卷信息
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "ExamPaper")]
-    public class ExamPaper : ID
+    [CosmosDB(RU = 400, Name = "School")]
+    public class Paper : ID
     {
     {
+        /// <summary>
+        ///  学校编码,个人编码,考试编码
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
-        public ExamPaper() {
-            item = new List<ExamItem>();
+        public Paper() {
+            item = new List<ItemInfo>();
         }
         }
         [JsonProperty(PropertyName = "id")]
         [JsonProperty(PropertyName = "id")]
         public string id { get; set; }
         public string id { get; set; }
-        [PartitionKey]
-        public string scopeCode { get; set; }
-        /// <summary>
-        /// 考试活动code
-        /// </summary>
-       // public string examCode { get; set; }
-        public List<ExamItem> item { get; set; }
+     
+    
+        public List<ItemInfo> item { get; set; }
         public string subjectCode { get; set; }
         public string subjectCode { get; set; }
         public string periodCode { get; set; }
         public string periodCode { get; set; }
         public List<string> gradeCode { get; set; }
         public List<string> gradeCode { get; set; }

+ 8 - 5
TEAMModelOS.Service/Models/Core/School.cs

@@ -5,12 +5,13 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "CoreSchool")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class School:ID
     public class School:ID
     {
     {
-       
+      //  [PartitionKey(name = "School")]
+        public string pk { get; set; }
         public int? ttl { get; set; } = null;
         public int? ttl { get; set; } = null;
         public School()
         public School()
         {
         {
@@ -19,11 +20,13 @@ namespace TEAMModelOS.Service.Models.Core
         
         
         public string id { get; set; }
         public string id { get; set; }
         public string schoolCode { get; set; }
         public string schoolCode { get; set; }
-        [PartitionKey]
-        public string areaCode { get; set; }
+       // [PartitionKey]
+        //public string areaCode { get; set; }
         public string schoolName { get; set; }
         public string schoolName { get; set; }
         public List<Period> period { get; set; }
         public List<Period> period { get; set; }
         public List<Campus> campuses { get; set; }
         public List<Campus> campuses { get; set; }
+        [PartitionKey]
+        public string code { get; set; }
 
 
     }
     }
 }
 }

+ 21 - 0
TEAMModelOS.Service/Models/SchoolInfo/Survey.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Service.Models
+{
+    /// <summary>
+    /// 问卷调查
+    /// </summary>
+    [CosmosDB(Name = "School", RU =400)]
+    public class Survey : ID
+    {
+        public string id { get;set;}
+        public int? ttl { get;set;}
+        public string pk { get;set;}
+        [PartitionKey]
+        public string code { get;set;}
+    }
+}

+ 1 - 1
TEAMModelOS.Service/Models/Core/SchoolSetting.cs

@@ -3,7 +3,7 @@ using Newtonsoft.Json;
 using System.Text.Json.Serialization;
 using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 學校設定
     /// 學校設定

+ 8 - 18
TEAMModelOS.Service/Models/Learn/Vote.cs

@@ -5,17 +5,20 @@ using System.ComponentModel.DataAnnotations;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using static TEAMModelOS.Service.Models.Learn.VoteStudent;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
     /// 投票
     /// 投票
     /// </summary>
     /// </summary>
     [ProtoContract]
     [ProtoContract]
-    [CosmosDB(RU = 400, Name = "Vote")]
+    [CosmosDB(RU = 400, Name = "School")]
     public class Vote : ID
     public class Vote : ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        //  [PartitionKey(name = "Vote")]
+        public string pk { get; set; }
 
 
         public Vote()
         public Vote()
         {
         {
@@ -28,10 +31,8 @@ namespace TEAMModelOS.Service.Models.Learn
         [ProtoMember(1)]
         [ProtoMember(1)]
         public string id { get; set; }
         public string id { get; set; }
 
 
-        [PartitionKey]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        [ProtoMember(2)]
-        public string scopeCode { get; set; }
+     //  [PartitionKey]
+       
 
 
 
 
         /// <summary>
         /// <summary>
@@ -64,17 +65,6 @@ namespace TEAMModelOS.Service.Models.Learn
         [ProtoMember(7)]
         [ProtoMember(7)]
         public long endTime { get; set; }
         public long endTime { get; set; }
 
 
-        /// <summary>
-        /// 作业反馈类型
-        /// </summary>
-        //public string feedbackType { get; set; }
-
-        /// <summary>
-        /// 题目
-        /// </summary>
-        //public List<ExamItem> ExamItem { get; set; }
-
-
 
 
         /// <summary>
         /// <summary>
         /// 投票描述
         /// 投票描述

+ 11 - 13
TEAMModelOS.Service/Models/Core/ClassRoomStudent.cs

@@ -6,31 +6,29 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
     [ProtoContract]
     [ProtoContract]
-    [CosmosDB(RU = 400, Name = "CoreClassroomStudent", Cache = false)]
-    public class ClassroomStudent : ID
+    [CosmosDB(RU = 400, Name = "Student", Cache = false)]
+    public class ClassStudent : ID
     {
     {
-
-        public ClassroomStudent() {
-            studentId = new List<string>();
+        public string pk { get; set; }
+        public ClassStudent() {
+          //  studentId = new List<string>();
         }
         }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         /// <summary>
         /// <summary>
-        /// classroomCode
+        ///班级id classroomCode
         /// </summary>
         /// </summary>
         [ProtoMember(1)]
         [ProtoMember(1)]
         [Required(ErrorMessage = "{0} 必须填写")]
         [Required(ErrorMessage = "{0} 必须填写")]
         public string id { get; set; } //classroomCode
         public string id { get; set; } //classroomCode
 
 
-        [ProtoMember(2)]
-        [Required(ErrorMessage = "{0} 必须填写")]
+        /// <summary>
+        /// 学生id
+        /// </summary>
         [PartitionKey]
         [PartitionKey]
-        public string scopeCode { get; set; }
-
-        [ProtoMember(3)]
-        public List<string> studentId { get; set; }
+        public string code { get; set; }
 
 
     }
     }
 }
 }

+ 13 - 61
TEAMModelOS.Service/Models/Learn/HomeWorkStudent.cs

@@ -4,32 +4,37 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Exam.Models;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
 
 
     /// <summary>
     /// <summary>
     /// 作业数据
     /// 作业数据
     /// </summary>
     /// </summary>
     [ProtoContract]
     [ProtoContract]
-    [CosmosDB(RU = 400, Name = "HomeWorkStudent")]
-    public class HomeWorkStudent : ID
+    [CosmosDB(RU = 400, Name = "Student")]
+    public class HomeworkRecord : ID
     {
     {
+        /// <summary>
+        /// 学生id
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
-        public HomeWorkStudent() {
+        public HomeworkRecord() {
             content = new List<HomeWorkContent>();
             content = new List<HomeWorkContent>();
             studentComments = new List<StudentComment>();
             studentComments = new List<StudentComment>();
             classroom = new ClassroomItem();
             classroom = new ClassroomItem();
             nativeroom = new ClassroomItem();
             nativeroom = new ClassroomItem();
             teacherComments = new HomeWorkComment();
             teacherComments = new HomeWorkComment();
         }
         }
+        /// <summary>
+        /// 作业活动id
+        /// </summary>
         [ProtoMember(1)]
         [ProtoMember(1)]
         public string id { get; set; }
         public string id { get; set; }
 
 
-        [ProtoMember(2)]
-        [PartitionKey]
-        public string homeWorkId { get; set; }
 
 
 
 
         /// <summary>
         /// <summary>
@@ -39,11 +44,6 @@ namespace TEAMModelOS.Service.Models.Learn
         public string name { get; set; }
         public string name { get; set; }
 
 
 
 
-        /// <summary>
-        /// 醍摩豆id
-        /// </summary>
-        [ProtoMember(4)]
-        public string TEAMModelId { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// 上课班级
         /// 上课班级
@@ -57,13 +57,6 @@ namespace TEAMModelOS.Service.Models.Learn
         [ProtoMember(6)]
         [ProtoMember(6)]
         public ClassroomItem nativeroom{ get; set; }
         public ClassroomItem nativeroom{ get; set; }
 
 
-
-        /// <summary>
-        /// 学号
-        /// </summary>
-        [ProtoMember(7)]
-        public string studentId { get; set; }
-
         /// <summary>
         /// <summary>
         /// 是否提交
         /// 是否提交
         /// </summary>
         /// </summary>
@@ -117,16 +110,6 @@ namespace TEAMModelOS.Service.Models.Learn
     [ProtoContract]
     [ProtoContract]
     public class HomeWorkContent {
     public class HomeWorkContent {
 
 
-        /// <summary>
-        /// 作业反馈类型
-        /// </summary>
-        //public string feedbackType { get; set; }
-
-        /// <summary>
-        /// 在线编辑模式 作答记录
-        /// </summary>
-        //public List<ExamAnswer> examAnswers { get; set; }
-
         /// <summary>
         /// <summary>
         /// 作答记录
         /// 作答记录
         /// </summary>
         /// </summary>
@@ -142,36 +125,6 @@ namespace TEAMModelOS.Service.Models.Learn
     }
     }
 
 
 
 
-    //public class ProcessRes
-    //{
-    //    /// <summary>
-    //    /// 文件名字
-    //    /// </summary>
-    //    public string fileName { get; set; }
-
-    //    /// <summary>
-    //    /// 
-    //    /// </summary>
-    //    public string blobUrl { get; set; }
-
-    //    /// <summary>
-    //    /// 文件大小
-    //    /// </summary>
-    //    public long size { get; set; }
-
-    //    /// <summary>
-    //    /// 缩略图链接  图片视频有 文件没有
-    //    /// </summary>
-    //    public string compressUrl { get; set; }
-
-    //    /// <summary>
-    //    /// 文件类型
-    //    /// </summary>
-    //    public string type { get; set; }
-
-    //    public int order { get; set; }
-
-    //}
     [ProtoContract]
     [ProtoContract]
     public class StudentComment
     public class StudentComment
     {
     {
@@ -305,5 +258,4 @@ namespace TEAMModelOS.Service.Models.Learn
         public long createTime { get; set; }
         public long createTime { get; set; }
 
 
     }
     }
-
 }
 }

+ 13 - 8
TEAMModelOS.Service/Models/Learn/LeanRecord.cs

@@ -4,23 +4,28 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {    /// <summary>
 {    /// <summary>
-     /// 作答记录
+     ///  编序式和学习单元 作答记录
      /// </summary>
      /// </summary>
-    [CosmosDB(RU = 400, Name = "LeanRecord")]
+    [CosmosDB(RU = 400, Name = "Student")]
     public class LeanRecord : ID
     public class LeanRecord : ID
     {
     {
+        /// <summary>
+        /// 学生id
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         public LeanRecord() {
         public LeanRecord() {
             steps = new List<RecordStep>();
             steps = new List<RecordStep>();
         }
         }
-
+        /// <summary>
+        /// learn学习任务id
+        /// </summary>
         public string id { get; set; }
         public string id { get; set; }
-        [PartitionKey]
-        public string processCode { get; set; }
-        
-        public string studentId { get; set; }
+      
 
 
         public List<RecordStep> steps { get; set; }
         public List<RecordStep> steps { get; set; }
     }
     }

+ 6 - 8
TEAMModelOS.Service/Models/Core/Student.cs

@@ -7,11 +7,13 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "CoreStudent")]
+    [CosmosDB(RU = 400, Name = "Student")]
     public class Student :ID
     public class Student :ID
     {
     {
+       // [PartitionKey(name = "Student")]
+        public string pk { get; set; }
         public int? ttl { get; set; } 
         public int? ttl { get; set; } 
         public Student()
         public Student()
         {
         {
@@ -40,12 +42,6 @@ namespace TEAMModelOS.Service.Models.Core
         public string exValue { get; set; }
         public string exValue { get; set; }
         public string product { get; set; }
         public string product { get; set; }
         public List<ProductToken> productToken { get; set; }
         public List<ProductToken> productToken { get; set; }
-        /// <summary>
-        ///   0 1 dynamic   1学校id
-        /// </summary>
-        [PartitionKey]
-        [Required(ErrorMessage = "{0} 必须填写")]
-        public string schoolCode { get; set; }  ///
         public string shortCode { get; set; }
         public string shortCode { get; set; }
         public string profilePicture { get; set; }
         public string profilePicture { get; set; }
         public string profilePictureUrl { get; set; }
         public string profilePictureUrl { get; set; }
@@ -60,6 +56,8 @@ namespace TEAMModelOS.Service.Models.Core
         public string classroomCode { get; set; }
         public string classroomCode { get; set; }
         public string studentId { get; set; }
         public string studentId { get; set; }
         public int seatNo { get; set; }
         public int seatNo { get; set; }
+        [PartitionKey]
+        public string code { get; set; }
     }
     }
 }
 }
 public class Password {
 public class Password {

+ 19 - 0
TEAMModelOS.Service/Models/StudentInfo/SurveyRecord.cs

@@ -0,0 +1,19 @@
+using ProtoBuf;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Service.Models
+{
+    [CosmosDB(RU = 400, Name = "Student")]
+    public class SurveyRecord : ID
+    {
+        public string id { get; set; }
+        public int? ttl { get; set; }
+        public string pk { get; set; }
+        [PartitionKey]
+        public string code { get; set; }
+    }
+}

+ 13 - 26
TEAMModelOS.Service/Models/Learn/VoteStudent.cs

@@ -4,41 +4,35 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using static TEAMModelOS.Service.Models.Learn.Vote;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "VoteStudent")]
-    public class VoteStudent : ID
+    [CosmosDB(RU = 400, Name = "Student")]
+    public class VoteRecord : ID
     {
     {
-
-        public VoteStudent() {
+        /// <summary>
+        /// 学生id
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        public string pk { get; set; }
+        public VoteRecord() {
             classroom = new ClassroomItem();
             classroom = new ClassroomItem();
             nativeroom = new ClassroomItem();
             nativeroom = new ClassroomItem();
            
            
         }
         }
-
+        /// <summary>
+        /// 投票活动id
+        /// </summary>
         [ProtoMember(1)]
         [ProtoMember(1)]
         public string id { get; set; }
         public string id { get; set; }
 
 
-        [ProtoMember(2)]
-        [PartitionKey]
-        public string voteWorkId { get; set; }
-
-
         /// <summary>
         /// <summary>
         /// 姓名
         /// 姓名
         /// </summary>
         /// </summary>
         [ProtoMember(3)]
         [ProtoMember(3)]
         public string name { get; set; }
         public string name { get; set; }
 
 
-
-        /// <summary>
-        /// 醍摩豆id
-        /// </summary>
-        [ProtoMember(4)]
-        public string TEAMModelId { get; set; }
-
         /// <summary>
         /// <summary>
         /// 上课班级
         /// 上课班级
         /// </summary>
         /// </summary>
@@ -51,12 +45,6 @@ namespace TEAMModelOS.Service.Models.Learn
         [ProtoMember(6)]
         [ProtoMember(6)]
         public ClassroomItem nativeroom { get; set; }
         public ClassroomItem nativeroom { get; set; }
 
 
-        /// <summary>
-        /// 学号
-        /// </summary>
-        [ProtoMember(7)]
-        public string studentId { get; set; }
-
         /// <summary>
         /// <summary>
         /// 是否提交
         /// 是否提交
         /// </summary>
         /// </summary>
@@ -69,7 +57,6 @@ namespace TEAMModelOS.Service.Models.Learn
         [ProtoMember(9)]
         [ProtoMember(9)]
         public long submissionTime { get; set; }
         public long submissionTime { get; set; }
 
 
-
         /// <summary>
         /// <summary>
         /// 选项
         /// 选项
         /// </summary>
         /// </summary>

+ 8 - 5
TEAMModelOS.Service/Models/Learn/TeacherComments.cs

@@ -5,13 +5,16 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
     [ProtoContract]
     [ProtoContract]
-    [CosmosDB(RU = 400, Name = "HomeWorkTeacherComments")]
-    public class TeacherComments : ID
+    [CosmosDB(RU = 400, Name = "Teacher")]
+    public class Comments : ID
     {
     {
-        public TeacherComments(){
+        [PartitionKey]
+        public string code { get; set; }
+        public string pk { get; set; }
+        public Comments(){
             comment = new List<Comment>();
             comment = new List<Comment>();
         }
         }
 
 
@@ -27,7 +30,7 @@ namespace TEAMModelOS.Service.Models.Learn
         /// <summary>
         /// <summary>
         /// 醍摩豆id 或者学生id
         /// 醍摩豆id 或者学生id
         /// </summary>
         /// </summary>
-        [PartitionKey]
+      //  [PartitionKey]
         [ProtoMember(3)]
         [ProtoMember(3)]
         public string TEAMModelId { get; set; }
         public string TEAMModelId { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }

+ 53 - 0
TEAMModelOS.Service/Models/TeacherInfo/CoursePlan.cs

@@ -0,0 +1,53 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json.Serialization;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Service.Models
+{
+    [CosmosDB(RU = 400, Name = "Teacher")]
+    public class CoursePlan :ID
+    {
+        
+        public string courseId { get; set; }
+        public string classroomCode { get; set; }
+        public string notice { get; set; }
+        public List<CourseTime> courseTimes { get; set; }
+        public string id { get; set; }
+        public int? ttl { get; set; }
+        public string pk { get; set; }
+        /// <summary>
+        /// 教师  TEAMModelId
+        /// </summary>
+        [PartitionKey]
+        public string code { get; set; }
+        /// <summary>
+        /// 学生分组
+        /// </summary>
+        public List<GroupStudent> groups { get; set; }
+    }
+
+    public class CourseTime {
+
+        public CourseTime() {
+            times = new List<List<string>>();
+        }
+        /// <summary>
+        /// 上课频率类型  按天,周,月等。。。
+        /// </summary>
+        public string type { get; set; }
+        public string title { get; set; }
+        public List<List<string>> times { get; set; }
+    }
+   
+    public class GroupStudent
+    {
+        public int seatNo { get; set; }
+        public string groupCode { get; set; }
+        public string groupName { get; set; }
+        public string studentId { get; set; }
+    }
+}

+ 102 - 0
TEAMModelOS.Service/Models/TeacherInfo/Homework.cs

@@ -0,0 +1,102 @@
+using ProtoBuf;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Service.Models
+{
+    /// <summary>
+    /// 作业
+    /// </summary>
+    [ProtoContract]
+    [CosmosDB(RU = 400, Name = "Teacher")]
+    public class Homework:ID
+    {
+        [PartitionKey]
+        public string code { get; set; }
+        //[PartitionKey(name = "HomeWork")]
+        public string pk { get; set; }
+        public int? ttl { get; set; } 
+        public Homework()
+        {
+            target = new List<Target>();
+            resource = new List<ProcessRes>();
+        }
+
+        [ProtoMember(1)]
+        public string id { get; set; }
+
+     
+
+        /// <summary>
+        /// 作业名称
+        /// </summary>
+        [ProtoMember(3)]
+        public string name { get; set; }
+
+        /// <summary>
+        /// 作业发布对象
+        /// </summary>
+        [ProtoMember(4)]
+        public List<Target> target { get; set; }
+
+        /// <summary>
+        /// 发布模式 0 立即发布 1 定时
+        /// </summary>
+        [ProtoMember(5)]
+        public string publishModel { get; set; }
+
+        /// <summary>
+        /// 开始时间
+        /// </summary>
+        [ProtoMember(6)]
+        public long startTime { get; set; }
+
+        /// <summary>
+        /// 结束时间
+        /// </summary>
+        [ProtoMember(7)]
+        public long endTime { get; set; }
+
+        
+
+
+
+        /// <summary>
+        /// 作业描述
+        /// </summary>
+        [ProtoMember(8)]
+        public string description { get; set; }
+
+  
+        /// <summary>
+        /// 作业附件
+        /// </summary>
+        [ProtoMember(9)]
+        public List<ProcessRes> resource { get; set; }
+
+
+        /// <summary>
+        /// 状态 
+        /// </summary>
+        [ProtoMember(10)]
+        public int state { get; set; }
+
+        //public Subdto subdto { get; set; }
+
+        /// <summary>
+        /// 学生 是否互评 是否可见 
+        /// </summary>
+        [ProtoMember(11)]
+        public List<string> other { get; set; }
+        //创建时间 
+        [ProtoMember(12)]
+        public long createTime { get; set; }
+        
+
+
+    }
+}

+ 74 - 0
TEAMModelOS.Service/Models/TeacherInfo/LeanProcess.cs

@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+
+namespace TEAMModelOS.Service.Models
+{
+
+    /// <summary>
+    /// 编序学习
+    /// </summary>
+    [CosmosDB(RU = 400, Name = "Teacher")]
+    public class LeanProcess : ID
+    {
+        [PartitionKey]
+        public string code { get; set; }
+        //   [PartitionKey(name = "LeanProcess")]
+        public string pk { get; set; }
+        public int? ttl { get; set; } 
+        public LeanProcess() {
+            steps = new List<LearnUnit>();
+        }
+        
+        public string id { get; set; }
+
+        public string name { get; set; }
+
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string subjectCode { get; set; }
+
+        /// <summary>
+        /// 学段code
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string periodCode { get; set; }
+
+
+        /// <summary>
+        /// 活动介绍
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string Introduce { get; set; }
+
+
+        
+    
+
+
+        /// <summary>
+        /// 最小单元
+        /// </summary>
+        public List<LearnUnit> steps { get; set; }
+
+
+
+
+        /// <summary>
+        /// 创建者
+        /// </summary>
+        [Required(ErrorMessage = "{0} 必须填写")]
+        public string creator { get; set; }
+        
+        public class Target
+        {
+            public string classroomCode { get; set; }
+
+            public string code { get; set; }
+        }
+    }
+
+
+}

+ 8 - 5
TEAMModelOS.Service/Models/Learn/LearnUnit.cs

@@ -4,14 +4,18 @@ using System.Text;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Learn
+namespace TEAMModelOS.Service.Models
 {
 {
     /// <summary>
     /// <summary>
-    /// 考试基础信息
+    /// 学习单元
     /// </summary>
     /// </summary>
-    [CosmosDB(RU = 400, Name = "LearnUnit")]
+    [CosmosDB(RU = 400, Name = "Teacher")]
     public class LearnUnit:ID
     public class LearnUnit:ID
     {
     {
+        [PartitionKey]
+        public string code { get; set; }
+        //[PartitionKey(name = "LearnUnit")]
+        public string pk { get; set; }
         public int? ttl { get; set; }
         public int? ttl { get; set; }
         public LearnUnit() {
         public LearnUnit() {
             //syllabus = new List<string>();
             //syllabus = new List<string>();
@@ -36,8 +40,7 @@ namespace TEAMModelOS.Service.Models.Learn
         /// 名称
         /// 名称
         /// </summary>
         /// </summary>
         public string name { get; set; }
         public string name { get; set; }
-        [PartitionKey]
-        public string scopeCode { get; set; }
+     
         public string subjectCode { get; set; }
         public string subjectCode { get; set; }
     }
     }
 }
 }

+ 5 - 3
TEAMModelOS.Service/Models/Core/SchoolUser.cs

@@ -7,14 +7,15 @@ using System.Text.Json.Serialization;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 
 
-namespace TEAMModelOS.Service.Models.Core
+namespace TEAMModelOS.Service.Models
 {
 {
-    [CosmosDB(RU = 400, Name = "School")]
+    [CosmosDB(RU = 400, Name = "Teacher")]
     public class SchoolUser:ID
     public class SchoolUser:ID
     {
     {
         public string id { get; set; }
         public string id { get; set; }
         public string schoolCode { get; set; }
         public string schoolCode { get; set; }
         public string schoolName { get; set; }
         public string schoolName { get; set; }
+        public string userid { get; set; }
         public string name { get; set; }
         public string name { get; set; }
         public string email { get; set; }
         public string email { get; set; }
         public string mobile { get; set; }
         public string mobile { get; set; }
@@ -31,6 +32,7 @@ namespace TEAMModelOS.Service.Models.Core
         public long joinDate { get; set; } = 0;
         public long joinDate { get; set; } = 0;
         [PartitionKey]
         [PartitionKey]
         public string code { get; set; }
         public string code { get; set; }
-        public int? ttl { get; set ; }
+        public int? ttl { get; set; }
+        public string pk { get; set ; }
     }
     }
 }
 }

+ 1 - 3
TEAMModelOS.Service/Services/Analysis/Implements/AchievementService.cs

@@ -1,13 +1,11 @@
 using System;
 using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
-using TEAMModelOS.Service.Model.Exam.Models;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.Service.Analysis.Interfaces;
 using TEAMModelOS.Service.Analysis.Interfaces;
-using TEAMModelOS.Service.Models.Core;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Exam.Models;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelOS.Service.Analysis.Implements
 namespace TEAMModelOS.Service.Analysis.Implements
 {
 {

+ 1 - 3
TEAMModelOS.Service/Services/Analysis/Interfaces/IAchievementService.cs

@@ -1,8 +1,6 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
-using TEAMModelOS.Service.Model.Exam.Models;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Exam.Models;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelOS.Service.Analysis.Interfaces
 namespace TEAMModelOS.Service.Analysis.Interfaces
 {
 {

+ 6 - 6
TEAMModelOS.Service/Services/ChangeFeed/ChangeFeedInvoke.cs

@@ -22,7 +22,7 @@ namespace TEAMModelOS.Service.Services.ChangeFeed
             azureCosmosDBV3Repository = _IAzureCosmosDBV3Repository;
             azureCosmosDBV3Repository = _IAzureCosmosDBV3Repository;
         }
         }
 
 
-        public void     MonitorChangeFeed(Dictionary<string , CosmosModelInfo> dict, IServiceCollection _services) {
+        public void     MonitorChangeFeed(CosmosDict dict, IServiceCollection _services) {
             var serviceCollection = new Microsoft.Extensions.DependencyInjection.ServiceCollection();
             var serviceCollection = new Microsoft.Extensions.DependencyInjection.ServiceCollection();
             ServiceProvider serviceProvider = _services.BuildServiceProvider();  
             ServiceProvider serviceProvider = _services.BuildServiceProvider();  
             List<ServiceDescriptor> services = new List<ServiceDescriptor>();
             List<ServiceDescriptor> services = new List<ServiceDescriptor>();
@@ -32,19 +32,19 @@ namespace TEAMModelOS.Service.Services.ChangeFeed
                     services.Add(service);
                     services.Add(service);
                 }
                 }
             }
             }
-            foreach (string CollectionName in dict.Keys)
+            foreach (string CollectionName in dict.nameCosmos.Keys)
             {
             {
                 if (CollectionName.Equals("AleaseContainer")) 
                 if (CollectionName.Equals("AleaseContainer")) 
                 { 
                 { 
                     continue; 
                     continue; 
                 }
                 }
-                if (dict[CollectionName].monitor) {
-                    ChangeFeedProcessor changeFeedProcessor = dict[CollectionName]
+                if (dict.nameCosmos[CollectionName].monitor) {
+                    ChangeFeedProcessor changeFeedProcessor = dict.nameCosmos[CollectionName]
                         .container
                         .container
                         .GetChangeFeedProcessorBuilder<object>(CollectionName, async (changes, token) => 
                         .GetChangeFeedProcessorBuilder<object>(CollectionName, async (changes, token) => 
-                        await ProcessChanges(changes,  dict[CollectionName].type , services, serviceProvider))
+                        await ProcessChanges(changes,  dict.nameCosmos[CollectionName].type , services, serviceProvider))
                         .WithInstanceName("TEAMModelOS")
                         .WithInstanceName("TEAMModelOS")
-                        .WithLeaseContainer(dict["AleaseContainer"].container)
+                        .WithLeaseContainer(dict.nameCosmos["AleaseContainer"].container)
                         .Build();
                         .Build();
                        changeFeedProcessor.StartAsync();
                        changeFeedProcessor.StartAsync();
                 }
                 }

+ 1 - 1
TEAMModelOS.Service/Services/ChangeFeed/IChangeFeedInvoke.cs

@@ -10,6 +10,6 @@ namespace TEAMModelOS.Service.Services.ChangeFeed
 {
 {
    public interface IChangeFeedInvoke :IBusinessService
    public interface IChangeFeedInvoke :IBusinessService
     {
     {
-          void MonitorChangeFeed(Dictionary<string, CosmosModelInfo> dict , IServiceCollection _services);
+          void MonitorChangeFeed(CosmosDict dict , IServiceCollection _services);
     }
     }
 }
 }

+ 1 - 1
TEAMModelOS.Service/Services/ChangeFeed/KnowledgeChangeFeed.cs

@@ -5,7 +5,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelOS.Service.Services.ChangeFeed
 namespace TEAMModelOS.Service.Services.ChangeFeed
 {
 {

+ 3 - 3
TEAMModelOS.Service/Services/ChangeFeed/SyllabusVolumeChangeFeed.cs

@@ -4,18 +4,18 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelOS.Service.Services.ChangeFeed
 namespace TEAMModelOS.Service.Services.ChangeFeed
 {
 {
-    class SyllabusVolumeChangeFeed : IChangeFeedService<SyllabusVolume>, IChangeService
+    class SyllabusVolumeChangeFeed : IChangeFeedService<Volume>, IChangeService
     {
     {
         private IAzureCosmosDBV3Repository cosmosDBV3Repository;
         private IAzureCosmosDBV3Repository cosmosDBV3Repository;
         public SyllabusVolumeChangeFeed(IAzureCosmosDBV3Repository azureCosmos)
         public SyllabusVolumeChangeFeed(IAzureCosmosDBV3Repository azureCosmos)
         {
         {
             cosmosDBV3Repository = azureCosmos;
             cosmosDBV3Repository = azureCosmos;
         }
         }
-        public void Processor(IReadOnlyCollection<SyllabusVolume> changes)
+        public void Processor(IReadOnlyCollection<Volume> changes)
         {
         {
             Console.WriteLine(DateTimeOffset.Now.UtcTicks + "    "+changes.ToApiJson());
             Console.WriteLine(DateTimeOffset.Now.UtcTicks + "    "+changes.ToApiJson());
         }
         }

+ 35 - 36
TEAMModelOS.Service/Services/Evaluation/Implements/HtmlAnalyzeService.cs

@@ -15,8 +15,7 @@ using TEAMModelOS.SDK.Helper.Common.FileHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.Service.Model.PowerPoint;
 using TEAMModelOS.Service.Model.PowerPoint;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Exam.Models;
+using TEAMModelOS.Service.Models;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 namespace TEAMModelOS.Service.Services.Exam.Implements
 namespace TEAMModelOS.Service.Services.Exam.Implements
 {
 {
@@ -36,7 +35,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             { "Single", "【单选题】|【结束】" }, { "Multiple", "【多选题】|【结束】" },
             { "Single", "【单选题】|【结束】" }, { "Multiple", "【多选题】|【结束】" },
             { "Judge", "【判断题】|【结束】" }, { "Complete", "【填空题】|【结束】" },
             { "Judge", "【判断题】|【结束】" }, { "Complete", "【填空题】|【结束】" },
             { "Subjective", "【问答题】|【结束】" } , { "Compose", "【综合题】|【完结】" }};
             { "Subjective", "【问答题】|【结束】" } , { "Compose", "【综合题】|【完结】" }};
-        public List<ExamItem> AnalyzeWordAsync(string html, string Lang)
+        public List<Models.ItemInfo> AnalyzeWordAsync(string html, string Lang)
         { 
         { 
             //去除class 以及span标签"
             //去除class 以及span标签"
             string classpattern = "class=\"([^\"]*)\"";
             string classpattern = "class=\"([^\"]*)\"";
@@ -45,33 +44,33 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             html = Regex.Replace(html, pattern, "");
             html = Regex.Replace(html, pattern, "");
             html = html.Replace("\t", " ").Replace("<span>", "").Replace("</span>", "").Replace("dir=\"ltr\"", "");
             html = html.Replace("\t", " ").Replace("<span>", "").Replace("</span>", "").Replace("dir=\"ltr\"", "");
             Dictionary<string, List<string>> TestInType = ConvertTest(html);
             Dictionary<string, List<string>> TestInType = ConvertTest(html);
-            List<ExamItem> tests = new List<ExamItem>();
+            List<Models.ItemInfo> tests = new List<Models.ItemInfo>();
             foreach (string key in TestInType.Keys)
             foreach (string key in TestInType.Keys)
             {
             {
                 switch (key)
                 switch (key)
                 {
                 {
                     case "Single":
                     case "Single":
-                        List<ExamItem> exercisesSingle = SingleConvert(key, TestInType[key]);
+                        List<Models.ItemInfo> exercisesSingle = SingleConvert(key, TestInType[key]);
                         exercisesSingle.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesSingle.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesSingle); break;
                         tests.AddRange(exercisesSingle); break;
                     case "Multiple":
                     case "Multiple":
-                        List<ExamItem> exercisesMultiple = MultipleConvert(key, TestInType[key]);
+                        List<Models.ItemInfo> exercisesMultiple = MultipleConvert(key, TestInType[key]);
                         exercisesMultiple.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesMultiple.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesMultiple); break;
                         tests.AddRange(exercisesMultiple); break;
                     case "Judge":
                     case "Judge":
-                        List<ExamItem> exercisesJudge = JudgeConvert(key, TestInType[key]);
+                        List<Models.ItemInfo> exercisesJudge = JudgeConvert(key, TestInType[key]);
                         exercisesJudge.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesJudge.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesJudge); break;
                         tests.AddRange(exercisesJudge); break;
                     case "Complete":
                     case "Complete":
-                        List<ExamItem> exercisesComplete = CompleteConvert(key, TestInType[key]);
+                        List<Models.ItemInfo> exercisesComplete = CompleteConvert(key, TestInType[key]);
                         exercisesComplete.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesComplete.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesComplete); break;
                         tests.AddRange(exercisesComplete); break;
                     case "Subjective":
                     case "Subjective":
-                        List<ExamItem> exercisesSubjective = SubjectiveConvert(key, TestInType[key]);
+                        List<Models.ItemInfo> exercisesSubjective = SubjectiveConvert(key, TestInType[key]);
                         exercisesSubjective.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesSubjective.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesSubjective); break;
                         tests.AddRange(exercisesSubjective); break;
                     case "Compose":
                     case "Compose":
-                        List<ExamItem> exercisesCompose = ComposeConvert(key, TestInType[key], Lang);
+                        List<Models.ItemInfo> exercisesCompose = ComposeConvert(key, TestInType[key], Lang);
                         exercisesCompose.ForEach(x => { x.pShaCode = x.shaCode; });
                         exercisesCompose.ForEach(x => { x.pShaCode = x.shaCode; });
                         tests.AddRange(exercisesCompose);
                         tests.AddRange(exercisesCompose);
                         break;
                         break;
@@ -81,36 +80,36 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return tests;
             return tests;
         }
         }
 
 
-        private List<ExamItem> SingleConvert(string TypeKey, List<string> list)
+        private List<Models.ItemInfo> SingleConvert(string TypeKey, List<string> list)
         {
         {
-            List<ExamItem> testInfos = OptionProcess(TypeKey, list);
+            List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
             return testInfos;
         }
         }
 
 
-        private List<ExamItem> MultipleConvert(string TypeKey, List<string> list)
+        private List<Models.ItemInfo> MultipleConvert(string TypeKey, List<string> list)
         {
         {
-            List<ExamItem> testInfos = OptionProcess(TypeKey, list);
+            List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
             return testInfos;
         }
         }
 
 
-        private List<ExamItem> JudgeConvert(string TypeKey, List<string> list)
+        private List<Models.ItemInfo> JudgeConvert(string TypeKey, List<string> list)
         {
         {
-            List<ExamItem> testInfos = OptionProcess(TypeKey, list);
+            List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
             return testInfos;
         }
         }
 
 
 
 
-        private List<ExamItem> CompleteConvert(string TypeKey, List<string> list)
+        private List<Models.ItemInfo> CompleteConvert(string TypeKey, List<string> list)
         {
         {
-            List<ExamItem> testInfos = CompleteProcess(TypeKey, list);
+            List<Models.ItemInfo> testInfos = CompleteProcess(TypeKey, list);
             return testInfos;
             return testInfos;
         }
         }
-        private List<ExamItem> CompleteProcess(string TypeKey, List<string> tests)
+        private List<Models.ItemInfo> CompleteProcess(string TypeKey, List<string> tests)
         {
         {
             //List<string> tests = ConvertTest(testHtml);
             //List<string> tests = ConvertTest(testHtml);
-            List<ExamItem> testInfos = ConvertTestInfo(tests, TypeKey);
+            List<Models.ItemInfo> testInfos = ConvertTestInfo(tests, TypeKey);
             HtmlDocument doc = new HtmlDocument();
             HtmlDocument doc = new HtmlDocument();
-            foreach (ExamItem testInfo in testInfos)
+            foreach (Models.ItemInfo testInfo in testInfos)
             {
             {
                 List<string> ans = new List<string>();
                 List<string> ans = new List<string>();
                 testInfo.question = testInfo.question.Replace(AnalysisTag, "").Replace(SummaryTag, "").Replace(AnswerTag, "");
                 testInfo.question = testInfo.question.Replace(AnalysisTag, "").Replace(SummaryTag, "").Replace(AnswerTag, "");
@@ -156,11 +155,11 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return testInfos;
             return testInfos;
         }
         }
 
 
-        private List<ExamItem> OptionProcess(string typeKey, List<string> list)
+        private List<Models.ItemInfo> OptionProcess(string typeKey, List<string> list)
         {
         {
             string[] optionsKeys = Options.Select(s => s.ToString()).ToArray();
             string[] optionsKeys = Options.Select(s => s.ToString()).ToArray();
-            List<ExamItem> testInfos = ConvertTestInfo(list, typeKey);
-            foreach (ExamItem testInfo in testInfos)
+            List<Models.ItemInfo> testInfos = ConvertTestInfo(list, typeKey);
+            foreach (Models.ItemInfo testInfo in testInfos)
             {
             {
                 string optsRgex = optionsKeys[0] + "(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?)" + AnswerTag;
                 string optsRgex = optionsKeys[0] + "(\\.|\\.|\\、|\\:|\\:)([\\s\\S]*?)" + AnswerTag;
                 string optsHtml = Regex.Match(testInfo.question, optsRgex).Value;
                 string optsHtml = Regex.Match(testInfo.question, optsRgex).Value;
@@ -191,7 +190,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
                             optHtml = optHtml.Substring(2, optHtml.Length - 6);
                             optHtml = optHtml.Substring(2, optHtml.Length - 6);
                             optHtml = HtmlHelper.DoUselessTag(optHtml);
                             optHtml = HtmlHelper.DoUselessTag(optHtml);
                             textImg.Append(HtmlHelper.DoTextImg(optHtml));
                             textImg.Append(HtmlHelper.DoTextImg(optHtml));
-                            testInfo.option.Add(new CodeValue {code = optionsKeys[i], value = optHtml });
+                            testInfo.option.Add(new CodeValue { code = optionsKeys[i], value = optHtml });
                             //testInfo.option.Add(new Dictionary<string, string> { { "code", optionsKeys[i] }, { "value", optHtml } });
                             //testInfo.option.Add(new Dictionary<string, string> { { "code", optionsKeys[i] }, { "value", optHtml } });
                             //testInfo.option.TryAdd(optionsKeys[i], optHtml);
                             //testInfo.option.TryAdd(optionsKeys[i], optHtml);
                         }
                         }
@@ -222,12 +221,12 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
         }
         }
 
 
 
 
-        private List<ExamItem> SubjectiveConvert(string TypeKey, List<string> tests)
+        private List<Models.ItemInfo> SubjectiveConvert(string TypeKey, List<string> tests)
         {
         {
             // List<string> tests = ConvertTest(testHtml);
             // List<string> tests = ConvertTest(testHtml);
-            List<ExamItem> testInfos = ConvertTestInfo(tests, TypeKey);
+            List<Models.ItemInfo> testInfos = ConvertTestInfo(tests, TypeKey);
 
 
-            foreach (ExamItem testInfo in testInfos)
+            foreach (Models.ItemInfo testInfo in testInfos)
             {
             {
                 testInfo.question = testInfo.question.Replace(AnalysisTag, "").Replace(SummaryTag, "").Replace(AnswerTag, "");
                 testInfo.question = testInfo.question.Replace(AnalysisTag, "").Replace(SummaryTag, "").Replace(AnswerTag, "");
                 testInfo.question = HtmlHelper.DoUselessTag(testInfo.question);
                 testInfo.question = HtmlHelper.DoUselessTag(testInfo.question);
@@ -244,19 +243,19 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return testInfos;
             return testInfos;
         }
         }
 
 
-        private List<ExamItem> ComposeConvert(string TypeKey, List<string> list, string Lang)
+        private List<Models.ItemInfo> ComposeConvert(string TypeKey, List<string> list, string Lang)
         {
         {
-            List<ExamItem> exerciseDtos = new List<ExamItem>();
+            List<Models.ItemInfo> exerciseDtos = new List<Models.ItemInfo>();
             foreach (string html in list)
             foreach (string html in list)
             {
             {
-                ExamItem exercise = new ExamItem() { type = TypeKey };
+                Models.ItemInfo exercise = new Models.ItemInfo() { type = TypeKey };
                 string RegexStr = ComposeStart + "([\\s\\S]*?)" + ComposeEnd;
                 string RegexStr = ComposeStart + "([\\s\\S]*?)" + ComposeEnd;
                 Match mt = Regex.Match(html, RegexStr);
                 Match mt = Regex.Match(html, RegexStr);
                 exercise.question = HtmlHelper.DoUselessTag(mt.Value.Replace(ComposeStart, "").Replace(ComposeEnd, ""));
                 exercise.question = HtmlHelper.DoUselessTag(mt.Value.Replace(ComposeStart, "").Replace(ComposeEnd, ""));
                 string testinfo = Regex.Replace(html, RegexStr, "").Replace(ComposeTag, CompleteStart);
                 string testinfo = Regex.Replace(html, RegexStr, "").Replace(ComposeTag, CompleteStart);
                 //获取综合题的材料加每个小题的sha1Code
                 //获取综合题的材料加每个小题的sha1Code
                 string testQs = HtmlHelper.DoTextImg(exercise.question);
                 string testQs = HtmlHelper.DoTextImg(exercise.question);
-                List<ExamItem> dtos = AnalyzeWordAsync(testinfo, Lang);
+                List<Models.ItemInfo> dtos = AnalyzeWordAsync(testinfo, Lang);
                 if (dtos.IsNotEmpty())
                 if (dtos.IsNotEmpty())
                 {
                 {
                     dtos.ForEach(x => { testQs = testQs + x.shaCode; });
                     dtos.ForEach(x => { testQs = testQs + x.shaCode; });
@@ -268,15 +267,15 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             }
             }
             return exerciseDtos;
             return exerciseDtos;
         }
         }
-        public static List<ExamItem> ConvertTestInfo(List<string> tests, string TypeKey)
+        public static List<Models.ItemInfo> ConvertTestInfo(List<string> tests, string TypeKey)
         {
         {
-            List<ExamItem> testInfos = new List<ExamItem>();
+            List<Models.ItemInfo> testInfos = new List<Models.ItemInfo>();
             foreach (string html in tests)
             foreach (string html in tests)
             {
             {
                 Dictionary<string, string> regex = new Dictionary<string, string>();
                 Dictionary<string, string> regex = new Dictionary<string, string>();
                 Dictionary<string, string> question = new Dictionary<string, string> { { "Summary", TestType[TypeKey].Split("|")[0] + "|" + AnswerTag }, { "Answer", AnswerTag + "|" + AnalysisTag }, { "Analysis", AnalysisTag + "|" + EndedTag } };
                 Dictionary<string, string> question = new Dictionary<string, string> { { "Summary", TestType[TypeKey].Split("|")[0] + "|" + AnswerTag }, { "Answer", AnswerTag + "|" + AnalysisTag }, { "Analysis", AnalysisTag + "|" + EndedTag } };
                 Dictionary<string, string> compquestion = new Dictionary<string, string> { { "Summary", TestType[TypeKey].Split("|")[0] + "|" + AnalysisTag }, { "Analysis", AnalysisTag + "|" + EndedTag } };
                 Dictionary<string, string> compquestion = new Dictionary<string, string> { { "Summary", TestType[TypeKey].Split("|")[0] + "|" + AnalysisTag }, { "Analysis", AnalysisTag + "|" + EndedTag } };
-                ExamItem test = new ExamItem();
+                Models.ItemInfo test = new Models.ItemInfo();
                 test.type = TypeKey;
                 test.type = TypeKey;
                 List<string> keys = new List<string>();
                 List<string> keys = new List<string>();
                 if (TypeKey.Equals("Complete"))
                 if (TypeKey.Equals("Complete"))
@@ -300,7 +299,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
                             test.question = mt.Value.Replace(TestType[TypeKey].Split("|")[0], ""); break;
                             test.question = mt.Value.Replace(TestType[TypeKey].Split("|")[0], ""); break;
                         case "Answer":
                         case "Answer":
                             string Answer = mt.Value;
                             string Answer = mt.Value;
-                            ///单选或多选,判断答案 脱html标签
+                            //单选或多选,判断答案 脱html标签
                             if (TypeKey.Equals("Single") || TypeKey.Equals("Multiple") || TypeKey.Equals("Judge"))
                             if (TypeKey.Equals("Single") || TypeKey.Equals("Multiple") || TypeKey.Equals("Judge"))
                             {
                             {
                                 HtmlDocument doc = new HtmlDocument();
                                 HtmlDocument doc = new HtmlDocument();

+ 1 - 1
TEAMModelOS.Service/Services/Evaluation/Implements/ImportExerciseService.cs

@@ -21,7 +21,7 @@ using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Module.AzureBlob.Container;
 using TEAMModelOS.SDK.Module.AzureBlob.Container;
 using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
 using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
-using TEAMModelOS.Service.Models.Core;
+using TEAMModelOS.Service.Models;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 
 
 namespace TEAMModelOS.Service.Services.Exam.Implements
 namespace TEAMModelOS.Service.Services.Exam.Implements

+ 1 - 3
TEAMModelOS.Service/Services/Evaluation/Interfaces/IHtmlAnalyzeService.cs

@@ -2,14 +2,12 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Model.PowerPoint;
-using TEAMModelOS.Service.Models.Exam.Models;
 
 
 namespace TEAMModelOS.Service.Services.Exam.Interfaces
 namespace TEAMModelOS.Service.Services.Exam.Interfaces
 {
 {
     public interface IHtmlAnalyzeService: IBusinessService
     public interface IHtmlAnalyzeService: IBusinessService
     {
     {
-        List<ExamItem> AnalyzeWordAsync(string htmlString, string Lang);
+        List<Models.ItemInfo> AnalyzeWordAsync(string htmlString, string Lang);
   
   
     }
     }
 }
 }

+ 26 - 27
TEAMModelOS.Service/Services/PowerPoint/Implement/HtexService.cs

@@ -20,7 +20,7 @@ using Fill = TEAMModelOS.Service.Model.PowerPoint.Fill;
 using Media = TEAMModelOS.Service.Model.PowerPoint.Media;
 using Media = TEAMModelOS.Service.Model.PowerPoint.Media;
 using Position = TEAMModelOS.Service.Model.PowerPoint.Position;
 using Position = TEAMModelOS.Service.Model.PowerPoint.Position;
 using TEAMModelOS.Service.Services.PowerPoint.Interface;
 using TEAMModelOS.Service.Services.PowerPoint.Interface;
-using TEAMModelOS.Service.Models.Exam.Models;
+using TEAMModelOS.Service.Models;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 using TEAMModelOS.Service.Services.Exam.Interfaces;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 
 
@@ -44,14 +44,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         public async Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang)
         public async Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang)
         {
         {
             Htex htex = new Htex();
             Htex htex = new Htex();
-            List<ExamItem> items = htmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
+            List<Models.ItemInfo> items = htmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
             string sha=  ShaHashHelper.GetSHA1(htmlString);
             string sha=  ShaHashHelper.GetSHA1(htmlString);
             int index = 0;
             int index = 0;
-            foreach (ExamItem item in items)
+            foreach (Models.ItemInfo item in items)
             {
             {
                 Slide slide = new Slide { exercise = item, index = index, source = 2, flag = 2 };
                 Slide slide = new Slide { exercise = item, index = index, source = 2, flag = 2 };
                 index++;
                 index++;
-                AzureBlobModel model=  await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), sha, index+".json","htex",false);
+                AzureBlobModel model =  await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), sha, index+".json","htex",false);
                 htex.slides.Add(model.BlobUrl);
                 htex.slides.Add(model.BlobUrl);
             }
             }
             htex.page = items.Count;
             htex.page = items.Count;
@@ -118,7 +118,8 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// <summary>
         /// <summary>
         /// 加载PPTX文件
         /// 加载PPTX文件
         /// </summary>
         /// </summary>
-        /// <param name="presentationFile"></param>
+        /// <param name="xdoc"></param>
+        /// <param name="shaCode"></param>
         /// <returns></returns>
         /// <returns></returns>
         public async Task<Htex> ProcessPPTX(XmlDocument xdoc, string shaCode)
         public async Task<Htex> ProcessPPTX(XmlDocument xdoc, string shaCode)
         {
         {
@@ -217,8 +218,8 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             // Open slideLayoutXX.xml
             // Open slideLayoutXX.xml
             var slideLayoutContent = xdoc.GetTextByPath("//pkg:part[@pkg:name='" + layoutFilename + "']");
             var slideLayoutContent = xdoc.GetTextByPath("//pkg:part[@pkg:name='" + layoutFilename + "']");
             NodesTable slideLayoutTables = ShapeHelper.IndexNodes(slideLayoutContent.GetTextByPath("pkg:xmlData/p:sldLayout"));
             NodesTable slideLayoutTables = ShapeHelper.IndexNodes(slideLayoutContent.GetTextByPath("pkg:xmlData/p:sldLayout"));
-            ///ppt/slides/slide5.xml  也包含a:overrideClrMapping
-            ////ppt/slideLayouts/slideLayout13.xml  也包含a:overrideClrMapping
+            //ppt/slides/slide5.xml  也包含a:overrideClrMapping
+            //ppt/slideLayouts/slideLayout13.xml  也包含a:overrideClrMapping
             var sldLayoutClrOvr = slideLayoutContent.GetTextByPath("pkg:xmlData/p:sldLayout/p:clrMapOvr/a:overrideClrMapping");
             var sldLayoutClrOvr = slideLayoutContent.GetTextByPath("pkg:xmlData/p:sldLayout/p:clrMapOvr/a:overrideClrMapping");
             if (sldLayoutClrOvr != null)
             if (sldLayoutClrOvr != null)
             {
             {
@@ -244,7 +245,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             // @masterName: ppt/slideLayouts/_rels/slideLayout1.xml.rels
             // @masterName: ppt/slideLayouts/_rels/slideLayout1.xml.rels
             var slideLayoutResFilename = layoutFilename.Replace("slideLayouts/slideLayout", "slideLayouts/_rels/slideLayout") + ".rels";
             var slideLayoutResFilename = layoutFilename.Replace("slideLayouts/slideLayout", "slideLayouts/_rels/slideLayout") + ".rels";
             var slideLayoutResContent = xdoc.GetTextByPath("//pkg:part[@pkg:name='" + slideLayoutResFilename + "']");
             var slideLayoutResContent = xdoc.GetTextByPath("//pkg:part[@pkg:name='" + slideLayoutResFilename + "']");
-            ///查看js  是替换之前 还是添加
+            //查看js  是替换之前 还是添加
             RelationshipArray = slideLayoutResContent.GetTextByPathList("pkg:xmlData/rel:Relationships/rel:Relationship");
             RelationshipArray = slideLayoutResContent.GetTextByPathList("pkg:xmlData/rel:Relationships/rel:Relationship");
             var masterFilename = "";
             var masterFilename = "";
             Dictionary<string, Dictionary<string, string>> layoutResObj = new Dictionary<string, Dictionary<string, string>>();
             Dictionary<string, Dictionary<string, string>> layoutResObj = new Dictionary<string, Dictionary<string, string>>();
@@ -330,7 +331,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             {
             {
                 var nodes = spTreeNode.ChildNodes;
                 var nodes = spTreeNode.ChildNodes;
                 int order = 1;
                 int order = 1;
-                List<Item> items = new List<Item>();
+                List<Model.PowerPoint.Item> items = new List<Model.PowerPoint.Item>();
                 foreach (XmlNode node in nodes)
                 foreach (XmlNode node in nodes)
                 {
                 {
                     await ProcessNodesInSlide(items, node.Name, node, order, warpObj);
                     await ProcessNodesInSlide(items, node.Name, node, order, warpObj);
@@ -341,27 +342,27 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return slide;
             return slide;
         }
         }
 
 
-        public async Task ProcessNodesInSlide(List<Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
+        public async Task ProcessNodesInSlide(List<Model.PowerPoint.Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
         {
         {
             //  string result = "";
             //  string result = "";
 
 
             switch (nodeKey)
             switch (nodeKey)
             {
             {
                 case "p:sp":    // Shape, Text
                 case "p:sp":    // Shape, Text
-                    Item  spitem= await ProcessSpNode(node, order, warpObj);
+                    Model.PowerPoint.Item  spitem= await ProcessSpNode(node, order, warpObj);
                     if (spitem != null) {
                     if (spitem != null) {
                         items.Add(spitem);
                         items.Add(spitem);
                     }
                     }
                     break;
                     break;
                 case "p:cxnSp":    // Shape, Text (with connection)
                 case "p:cxnSp":    // Shape, Text (with connection)
-                    Item cxnitem =  await ProcessCxnSpNode(node, order, warpObj);
+                    Model.PowerPoint.Item cxnitem =  await ProcessCxnSpNode(node, order, warpObj);
                     if (cxnitem != null)
                     if (cxnitem != null)
                     {
                     {
                         items.Add(cxnitem);
                         items.Add(cxnitem);
                     }
                     }
                     break;
                     break;
                 case "p:pic":    // Picture
                 case "p:pic":    // Picture
-                    Item picitem = await ProcessPicNode(node, order, warpObj);
+                    Model.PowerPoint.Item picitem = await ProcessPicNode(node, order, warpObj);
                     if (picitem != null) {
                     if (picitem != null) {
                         items.Add(picitem);
                         items.Add(picitem);
                     }
                     }
@@ -376,7 +377,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                     var mcFallbackNode = node.GetTextByPath("mc:Fallback/p:sp");
                     var mcFallbackNode = node.GetTextByPath("mc:Fallback/p:sp");
                     if (mcFallbackNode != null)
                     if (mcFallbackNode != null)
                     {
                     {
-                        Item mcitem = await ProcessSpNode(mcFallbackNode, order, warpObj);
+                        Model.PowerPoint.Item mcitem = await ProcessSpNode(mcFallbackNode, order, warpObj);
                         if (mcitem != null)
                         if (mcitem != null)
                         {
                         {
                             items.Add(mcitem);
                             items.Add(mcitem);
@@ -385,7 +386,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                     else {
                     else {
                         mcFallbackNode = node.GetTextByPath("mc:Fallback/p:pic");
                         mcFallbackNode = node.GetTextByPath("mc:Fallback/p:pic");
                         if (mcFallbackNode != null) {
                         if (mcFallbackNode != null) {
-                            Item mcPicitem = await ProcessPicNode(mcFallbackNode, order, warpObj);
+                            Model.PowerPoint.Item mcPicitem = await ProcessPicNode(mcFallbackNode, order, warpObj);
                             if (mcPicitem != null)
                             if (mcPicitem != null)
                             {
                             {
                                 items.Add(mcPicitem);
                                 items.Add(mcPicitem);
@@ -398,7 +399,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
             }
         }
         }
 
 
-        public async Task ProcessGroupSpNode(List<Item> items, XmlNode node, int order, WarpObj warpObj)
+        public async Task ProcessGroupSpNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
         {
         {
             var factor = 1.00 * px96 / px914400;
             var factor = 1.00 * px96 / px914400;
             var xfrmNode = node.GetTextByPath("p:grpSpPr/a:xfrm");
             var xfrmNode = node.GetTextByPath("p:grpSpPr/a:xfrm");
@@ -421,7 +422,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             };
             };
             // Procsee all child nodes
             // Procsee all child nodes
             var nodes = node.ChildNodes;
             var nodes = node.ChildNodes;
-            List<Item> gpIterm = new List<Item>();
+            List<Model.PowerPoint.Item> gpIterm = new List<Model.PowerPoint.Item>();
             foreach (XmlNode nd in nodes)
             foreach (XmlNode nd in nodes)
             {
             {
                 await ProcessNodesInSlide(gpIterm, nd.Name, nd, order, warpObj);
                 await ProcessNodesInSlide(gpIterm, nd.Name, nd, order, warpObj);
@@ -434,7 +435,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             //return result;
             //return result;
         }
         }
 
 
-        public async Task ProcessGraphicFrameNode(List<Item> items, XmlNode node, int order, WarpObj warpObj)
+        public async Task ProcessGraphicFrameNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
         {
         {
         //    var result = "";
         //    var result = "";
             var graphicTypeUri = node.GetTextByPath("a:graphic/a:graphicData/@uri");
             var graphicTypeUri = node.GetTextByPath("a:graphic/a:graphicData/@uri");
@@ -459,7 +460,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             //return result;
             //return result;
         }
         }
 
 
-        public async Task  GenDiagram(List<Item> items,  XmlNode node, int order, WarpObj warpObj)
+        public async Task  GenDiagram(List<Model.PowerPoint.Item> items,  XmlNode node, int order, WarpObj warpObj)
         {
         {
             var xfrmNode = node.GetTextByPath("p:xfrm");
             var xfrmNode = node.GetTextByPath("p:xfrm");
             var dgmRelIds = node.GetTextByPath("a:graphic/a:graphicData/dgm:relIds");
             var dgmRelIds = node.GetTextByPath("a:graphic/a:graphicData/dgm:relIds");
@@ -494,7 +495,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                 diagram.type = "Diagram";
                 diagram.type = "Diagram";
                 diagram.index = order++;
                 diagram.index = order++;
                 // Procsee all child nodes
                 // Procsee all child nodes
-                List<Item> gpIterm = new List<Item>();
+                List<Model.PowerPoint.Item> gpIterm = new List<Model.PowerPoint.Item>();
                 XmlDocument nodeDoc = new XmlDocument();
                 XmlDocument nodeDoc = new XmlDocument();
                 var dgmDrwSpArrayLen = dgmDrwSpArray.Count;
                 var dgmDrwSpArrayLen = dgmDrwSpArray.Count;
                 for (var i = 0; i < dgmDrwSpArrayLen; i++)
                 for (var i = 0; i < dgmDrwSpArrayLen; i++)
@@ -1172,14 +1173,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return borders;
             return borders;
         }
         }
 
 
-        public async Task<Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
+        public async Task<Model.PowerPoint.Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
         {
         {
             var id = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@id");
             var id = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@id");
             var name = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@name");
             var name = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@name");
             return await GenShape("CxnSp", node, null, null, id, name, null, null, order, warpObj);
             return await GenShape("CxnSp", node, null, null, id, name, null, null, order, warpObj);
         }
         }
 
 
-        public async Task<Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
+        public async Task<Model.PowerPoint.Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
         {
         {
 
 
             /*
             /*
@@ -1217,11 +1218,11 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                     // type = getTextByPathList(slideMasterSpNode, ["p:nvSpPr", "p:nvPr", "p:ph", "attrs", "type"]);
                     // type = getTextByPathList(slideMasterSpNode, ["p:nvSpPr", "p:nvPr", "p:ph", "attrs", "type"]);
                 }
                 }
             }
             }
-            Item item = await GenShape("Sp", node, slideLayoutSpNode, slideMasterSpNode, id, name, idx, type, order, warpObj);
+            Model.PowerPoint.Item item = await GenShape("Sp", node, slideLayoutSpNode, slideMasterSpNode, id, name, idx, type, order, warpObj);
             return item;
             return item;
         }
         }
 
 
-        public async Task<Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
+        public async Task<Model.PowerPoint.Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
         {
         {
             var xfrmList = "p:spPr/a:xfrm";
             var xfrmList = "p:spPr/a:xfrm";
             var slideXfrmNode = node.GetTextByPath(xfrmList);
             var slideXfrmNode = node.GetTextByPath(xfrmList);
@@ -2448,8 +2449,6 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// 幻灯片 背景色填充
         /// 幻灯片 背景色填充
         /// </summary>
         /// </summary>
         /// <param name="slideContent"></param>
         /// <param name="slideContent"></param>
-        /// <param name="slideLayoutContent"></param>
-        /// <param name="slideMasterContent"></param>
         /// <param name="index"></param>
         /// <param name="index"></param>
         /// <param name="warpObj"></param>
         /// <param name="warpObj"></param>
         /// <returns></returns>
         /// <returns></returns>
@@ -3095,7 +3094,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                     media.mediaType = "video";
                     media.mediaType = "video";
                     media.index = order;
                     media.index = order;
                 }
                 }
-                ///  处理为AzureBlob 上传
+                //  处理为AzureBlob 上传
                 // vdoMimeType = getMimeType(vdoFileExt);
                 // vdoMimeType = getMimeType(vdoFileExt);
                 // blob = new Blob([uInt8Array], {
                 // blob = new Blob([uInt8Array], {
                 // type: vdoMimeType
                 // type: vdoMimeType

+ 3 - 3
TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeHelper.cs

@@ -74,8 +74,8 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// <summary>
         /// <summary>
         /// 调色补充 Shade Tint  LumMod LumOff 等
         /// 调色补充 Shade Tint  LumMod LumOff 等
         /// </summary>
         /// </summary>
-        /// <param name="xml"></param>
-        /// <param name="color"></param>
+        /// <param name="nodeXml"></param>
+        /// <param name="colorHex"></param>
         /// <returns></returns>
         /// <returns></returns>
         public static string ColorToning(string nodeXml, string colorHex)
         public static string ColorToning(string nodeXml, string colorHex)
         {
         {
@@ -729,7 +729,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                 }
                 }
                 if (type != null)
                 if (type != null)
                 {
                 {
-                    ///会出现相同Key
+                    //会出现相同Key
                     typeTable[type.Value] = child;
                     typeTable[type.Value] = child;
                 }
                 }
             }
             }

+ 4 - 4
TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeSvg.cs

@@ -2934,7 +2934,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         {
         {
          //   string result = "";
          //   string result = "";
           //  result += " <polygon points='" + (w / 2) + " 0,0 " + (h / 2) + "," + (w / 2) + " " + h + "," + w + " " + (h / 2) + "' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
           //  result += " <polygon points='" + (w / 2) + " 0,0 " + (h / 2) + "," + (w / 2) + " " + h + "," + w + " " + (h / 2) + "' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
-              ///              "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
+              //              "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
 
 
             List<SvgShape> shapes = new List<SvgShape>() {new Polygon {
             List<SvgShape> shapes = new List<SvgShape>() {new Polygon {
                 type = "polygon",
                 type = "polygon",
@@ -4479,7 +4479,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             { //gearNum=="9"
             { //gearNum=="9"
                 d = ShapeGear(w, h / 3.5, double.Parse(gearNum));
                 d = ShapeGear(w, h / 3.5, double.Parse(gearNum));
             }
             }
-         ///   result += "<path   d='" + d + "' transform='rotate(20," + (3 / 7.00) * h + "," + (3 / 7.00) * h + ")' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
+         //   result += "<path   d='" + d + "' transform='rotate(20," + (3 / 7.00) * h + "," + (3 / 7.00) * h + ")' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
          //  "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
          //  "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
             List<SvgShape> shapes = new List<SvgShape>() {new SvgPath {
             List<SvgShape> shapes = new List<SvgShape>() {new SvgPath {
                 type = "path",
                 type = "path",
@@ -4665,7 +4665,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// <returns></returns>
         /// <returns></returns>
         private static Svg Plaque(XmlNode node, string shapType, double w, double h, bool imgFillFlg, bool grndFillFlg, int shpId, string fillColor, Border border)
         private static Svg Plaque(XmlNode node, string shapType, double w, double h, bool imgFillFlg, bool grndFillFlg, int shpId, string fillColor, Border border)
         {
         {
-          ///  string result = "";
+          //  string result = "";
             XmlNode shapAdjst = ShapeHelper.GetTextByPath(node, "p:spPr/a:prstGeom/a:avLst/a:gd/@fmla");
             XmlNode shapAdjst = ShapeHelper.GetTextByPath(node, "p:spPr/a:prstGeom/a:avLst/a:gd/@fmla");
             double adj1 = 16667 * px9d6 / px91d4400;
             double adj1 = 16667 * px9d6 / px91d4400;
             double cnsVal1 = 50000 * px9d6 / px91d4400;
             double cnsVal1 = 50000 * px9d6 / px91d4400;
@@ -5516,7 +5516,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
             }
 
 
          //   result += "<path d='" + d_val + "' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
          //   result += "<path d='" + d_val + "' fill='" + (!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")") +
-          ///  "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
+          //  "' stroke='#" + border.Color + "' stroke-width='" + border.Width + "' stroke-dasharray='" + border.Stroke + "' />";
             List<SvgShape> shapes = new List<SvgShape>() {new SvgPath {
             List<SvgShape> shapes = new List<SvgShape>() {new SvgPath {
                 type = "path",
                 type = "path",
                 //Fill =(!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")"),
                 //Fill =(!imgFillFlg ? (grndFillFlg ? "url(#linGrd_" + shpId + ")" : fillColor) : "url(#imgPtrn_" + shpId + ")"),

+ 5 - 5
TEAMModelOS.Service/Services/Syllabus/Implement/KnowledgeService.cs

@@ -3,10 +3,10 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Implement
+namespace TEAMModelOS.Service.Services.Implement
 {
 {
     public class KnowledgeService : IKnowledgeService
     public class KnowledgeService : IKnowledgeService
     {
     {
@@ -23,9 +23,9 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             foreach (IdPk Knowledge in idPks)
             foreach (IdPk Knowledge in idPks)
             {
             {
                 List<Knowledge> knowledges = await _cosmos.FindSQL<Knowledge>($"select value(c) from c join A0  in c.points where 1=1  and  c.type = 0 and A0 =  '"+ Knowledge.id + "' ");
                 List<Knowledge> knowledges = await _cosmos.FindSQL<Knowledge>($"select value(c) from c join A0  in c.points where 1=1  and  c.type = 0 and A0 =  '"+ Knowledge.id + "' ");
-                List<SyllabusResource> Resources = await _cosmos.FindSQL<SyllabusResource>($"select value(c) from c join A0  in c.points where 1=1  and  c.type = 0 and A0 =  '" + Knowledge.id + "' ");
+                List<Resource> Resources = await _cosmos.FindSQL<Resource>($"select value(c) from c join A0  in c.points where 1=1  and  c.type = 0 and A0 =  '" + Knowledge.id + "' ");
                 foreach (Knowledge knowledge in knowledges) knowledge.points.Remove(Knowledge.id);
                 foreach (Knowledge knowledge in knowledges) knowledge.points.Remove(Knowledge.id);
-                foreach (SyllabusResource Resource in Resources) Resource.points.Remove(Knowledge.id);
+                foreach (Resource Resource in Resources) Resource.points.Remove(Knowledge.id);
                 await _cosmos.SaveOrUpdateAll(Resources);
                 await _cosmos.SaveOrUpdateAll(Resources);
                 await _cosmos.SaveOrUpdateAll(knowledges);
                 await _cosmos.SaveOrUpdateAll(knowledges);
             }
             }

+ 26 - 26
TEAMModelOS.Service/Services/Syllabus/Implement/SyllabusService.cs

@@ -7,10 +7,10 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Implement
+namespace TEAMModelOS.Service.Services.Implement
 {
 {
     public class SyllabusService: ISyllabusService
     public class SyllabusService: ISyllabusService
     {
     {
@@ -34,15 +34,15 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             {
             {
                 dict.Add("children[*]." + keyValuePair.Key, keyValuePair.Value);
                 dict.Add("children[*]." + keyValuePair.Key, keyValuePair.Value);
             }
             }
-            List<Syllabuses> data = await azureCosmosDBRepository.FindByDict<Syllabuses>(dict);
+            List<Syllabus> data = await azureCosmosDBRepository.FindByDict<Syllabus>(dict);
             List<SyllabusTree> treess = new List<SyllabusTree>();
             List<SyllabusTree> treess = new List<SyllabusTree>();
             if (data.IsNotEmpty())
             if (data.IsNotEmpty())
             {
             {
-                Dictionary<string, Syllabuses> syllabuses = new Dictionary<string, Syllabuses>();
+                Dictionary<string, Syllabus> syllabuses = new Dictionary<string, Syllabus>();
                 data.ForEach(x => syllabuses.TryAdd(x.id, x));
                 data.ForEach(x => syllabuses.TryAdd(x.id, x));
-                data = new List<Syllabuses>(syllabuses.Values);
+                data = new List<Syllabus>(syllabuses.Values);
                
                
-                foreach (Syllabuses item in data)
+                foreach (Syllabus item in data)
                 {
                 {
 
 
                     List<SyllabusNode> nodedata = item.children;
                     List<SyllabusNode> nodedata = item.children;
@@ -87,15 +87,15 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
         }
         }
         
         
 
 
-        public async Task<List<Syllabuses>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes)
+        public async Task<List<Syllabus>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes)
         {
         {
-            List<Syllabuses> syllabuses;
+            List<Syllabus> syllabuses;
 
 
-            List<Syllabuses> data = await azureCosmosDBRepository.FindByDict<Syllabuses>(new Dictionary<string, object> { { "id", syllabusNodes[0].volumeCode } });
+            List<Syllabus> data = await azureCosmosDBRepository.FindByDict<Syllabus>(new Dictionary<string, object> { { "id", syllabusNodes[0].code } });
             if (data.IsEmpty()) {
             if (data.IsEmpty()) {
-                var syllabus = new Syllabuses { id = syllabusNodes[0].volumeCode, volumeCode = syllabusNodes[0].volumeCode, children = new List<SyllabusNode>() };
+                var syllabus = new Syllabus { id = syllabusNodes[0].code, code = syllabusNodes[0].code, children = new List<SyllabusNode>() };
                 await azureCosmosDBRepository.SaveOrUpdate(syllabus);
                 await azureCosmosDBRepository.SaveOrUpdate(syllabus);
-                data = new List<Syllabuses>() { syllabus };
+                data = new List<Syllabus>() { syllabus };
             }
             }
             List<SyllabusNode> syllabusNodes1 = new List<SyllabusNode>();
             List<SyllabusNode> syllabusNodes1 = new List<SyllabusNode>();
             if (data.IsNotEmpty())
             if (data.IsNotEmpty())
@@ -106,7 +106,7 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                 {
                 {
                     for (int j = 0; j < syllabusNodes.Count; j++)
                     for (int j = 0; j < syllabusNodes.Count; j++)
                     {
                     {
-                        if (data[0].children[i].id == syllabusNodes[j].id && data[0].children[i].volumeCode == syllabusNodes[j].volumeCode)
+                        if (data[0].children[i].id == syllabusNodes[j].id && data[0].children[i].code == syllabusNodes[j].code)
                         {
                         {
                             syllabusNodes1.Remove(data[0].children[i]);
                             syllabusNodes1.Remove(data[0].children[i]);
                             syllabusNodes1.Add(syllabusNodes[j]);
                             syllabusNodes1.Add(syllabusNodes[j]);
@@ -131,7 +131,7 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                         }
                         }
                     }
                     }
                 }
                 }
-                syllabuses = await azureCosmosDBRepository.SaveOrUpdateAll<Syllabuses>(data);
+                syllabuses = await azureCosmosDBRepository.SaveOrUpdateAll<Syllabus>(data);
 
 
             }
             }
             else
             else
@@ -146,14 +146,14 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
         public async Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request)
         public async Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request)
         {
         {
             List<SyllabusNode> nodes = new List<SyllabusNode>();
             List<SyllabusNode> nodes = new List<SyllabusNode>();
-            Syllabuses syllabus = new Syllabuses();
+            Syllabus syllabus = new Syllabus();
 
 
             TreeToList(request, nodes);
             TreeToList(request, nodes);
             // List<SyllabusNode> nods = nodes.ToJson().FromJson<List<SyllabusNode>>() ;
             // List<SyllabusNode> nods = nodes.ToJson().FromJson<List<SyllabusNode>>() ;
             syllabus.children = nodes;
             syllabus.children = nodes;
-            syllabus.id = request[0].volumeCode;
-            syllabus.volumeCode = request[0].volumeCode;
-            await azureCosmosDBRepository.SaveOrUpdate<Syllabuses>(syllabus);
+            syllabus.id = request[0].code;
+            syllabus.code = request[0].code;
+            await azureCosmosDBRepository.SaveOrUpdate<Syllabus>(syllabus);
             List<SyllabusTree> treess = ListToTree(nodes);
             List<SyllabusTree> treess = ListToTree(nodes);
             return treess;
             return treess;
         }
         }
@@ -210,7 +210,7 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             return trees;
             return trees;
         }
         }
 
 
-        public async Task<List<Syllabuses>> DeleteSyllabus(Dictionary<string, object> request)
+        public async Task<List<Syllabus>> DeleteSyllabus(Dictionary<string, object> request)
         {
         {
             Dictionary<string, object> dict = new Dictionary<string, object>();
             Dictionary<string, object> dict = new Dictionary<string, object>();
             foreach (KeyValuePair<string, object> keyValuePair in request)
             foreach (KeyValuePair<string, object> keyValuePair in request)
@@ -218,17 +218,17 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                 dict.Add("children[*]." + keyValuePair.Key, keyValuePair.Value);
                 dict.Add("children[*]." + keyValuePair.Key, keyValuePair.Value);
             }
             }
 
 
-            List<Syllabuses> data = await azureCosmosDBRepository.FindByDict<Syllabuses>(dict);
-            Dictionary<string, Syllabuses> syllabuses = new Dictionary<string, Syllabuses>();
-            List<Syllabuses> data1 = new List<Syllabuses>();
+            List<Syllabus> data = await azureCosmosDBRepository.FindByDict<Syllabus>(dict);
+            Dictionary<string, Syllabus> syllabuses = new Dictionary<string, Syllabus>();
+            List<Syllabus> data1 = new List<Syllabus>();
             if (data.Count > 0)
             if (data.Count > 0)
             {
             {
                 data.ForEach(x => syllabuses.TryAdd(x.id, x));
                 data.ForEach(x => syllabuses.TryAdd(x.id, x));
-                data = new List<Syllabuses>(syllabuses.Values);
+                data = new List<Syllabus>(syllabuses.Values);
 
 
                 //是否全删
                 //是否全删
                 bool flg = false;
                 bool flg = false;
-                foreach (Syllabuses item in data)
+                foreach (Syllabus item in data)
                 {
                 {
                     List<SyllabusNode> nodedata = item.children;
                     List<SyllabusNode> nodedata = item.children;
                     if (request.TryGetValue("id", out object id))
                     if (request.TryGetValue("id", out object id))
@@ -260,13 +260,13 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                     item.children = syllabusNodes;
                     item.children = syllabusNodes;
                     if (item.children.Count == 0)
                     if (item.children.Count == 0)
                     {
                     {
-                        await azureCosmosDBRepository.DeleteAsync<Syllabuses>(item.id, item.volumeCode);
+                        await azureCosmosDBRepository.DeleteAsync<Syllabus>(item.id, item.code);
                         flg = true;
                         flg = true;
                     }
                     }
                 }
                 }
                 if (!flg)
                 if (!flg)
                 {
                 {
-                    data1 = await azureCosmosDBRepository.SaveOrUpdateAll<Syllabuses>(data);
+                    data1 = await azureCosmosDBRepository.SaveOrUpdateAll<Syllabus>(data);
 
 
                 }
                 }
 
 

+ 19 - 19
TEAMModelOS.Service/Services/Syllabus/Implement/VolumeService.cs

@@ -6,10 +6,10 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Extension.SnowFlake;
 using TEAMModelOS.SDK.Extension.SnowFlake;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
-using TEAMModelOS.Service.Services.Syllabus.Interface;
+using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Interface;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Implement
+namespace TEAMModelOS.Service.Services.Implement
 {
 {
     public class VolumeService : IVolumeService
     public class VolumeService : IVolumeService
     {
     {
@@ -21,7 +21,7 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             this.azureCosmosDBRepository = azureCosmosDBRepository;
             this.azureCosmosDBRepository = azureCosmosDBRepository;
         }
         }
 
 
-        public async Task<List<SyllabusVolume>> SaveOrUpdateVolume(SyllabusVolume request)
+        public async Task<List<Volume>> SaveOrUpdateVolume(Volume request)
         {
         {
             if (request.editors != null && request.editors.Count > 5)
             if (request.editors != null && request.editors.Count > 5)
             {
             {
@@ -31,8 +31,8 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             {
             {
                 if (request.type == 0)
                 if (request.type == 0)
                 {
                 {
-                    List<SyllabusVolume> volumesFind = await azureCosmosDBRepository.FindByDict<SyllabusVolume>(new Dictionary<string, object>() {
-                        { "scopeCode",request.scopeCode},{ "periodCode", request.periodCode},
+                    List<Volume> volumesFind = await azureCosmosDBRepository.FindByDict<Volume>(new Dictionary<string, object>() {
+                        { "code",request.code},{ "periodCode", request.periodCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "status",1} ,{ "type",0} });
                         { "status",1} ,{ "type",0} });
@@ -40,15 +40,15 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                     {
                     {
                         throw new BizException("已存在!", ResponseCode.DATA_EXIST);
                         throw new BizException("已存在!", ResponseCode.DATA_EXIST);
                     }
                     }
-                    ///校本课纲
-                    string key = request.scopeCode + IdWorker.getInstance().NextId();
+                    //校本课纲
+                    string key = request.code + IdWorker.getInstance().NextId();
                     request.id = key;
                     request.id = key;
                     request.volumeCode = key;
                     request.volumeCode = key;
                 }
                 }
                 else if (request.type == 1)
                 else if (request.type == 1)
                 {
                 {
-                    List<SyllabusVolume> volumesFind = await azureCosmosDBRepository.FindByDict<SyllabusVolume>(new Dictionary<string, object>() {
-                        { "schoolCode",request.scopeCode},{ "periodCode", request.periodCode},
+                    List<Volume> volumesFind = await azureCosmosDBRepository.FindByDict<Volume>(new Dictionary<string, object>() {
+                        { "code",request.code},{ "periodCode", request.periodCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "TEAMModelId",request.TEAMModelId}, { "status",1} ,{ "type",1} });
                         { "TEAMModelId",request.TEAMModelId}, { "status",1} ,{ "type",1} });
@@ -56,16 +56,16 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                     {
                     {
                         throw new BizException("已存在!", ResponseCode.DATA_EXIST);
                         throw new BizException("已存在!", ResponseCode.DATA_EXIST);
                     }
                     }
-                    ///个人课纲
+                    //个人课纲
                     string key = "dynamic" + request.TEAMModelId.Replace("#", "") + IdWorker.getInstance().NextId();
                     string key = "dynamic" + request.TEAMModelId.Replace("#", "") + IdWorker.getInstance().NextId();
                     request.id = key;
                     request.id = key;
                     request.volumeCode = key;
                     request.volumeCode = key;
                 }
                 }
                 else if (request.type == 2)
                 else if (request.type == 2)
                 {
                 {
-                    ///系统课纲
+                    //系统课纲
                     string key = "system" + IdWorker.getInstance().NextId();
                     string key = "system" + IdWorker.getInstance().NextId();
-                    request.scopeCode = "system";
+                    request.code = "system";
                     request.id = key;
                     request.id = key;
                     request.volumeCode = key;
                     request.volumeCode = key;
                 }
                 }
@@ -74,8 +74,8 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
             {
             {
                 if (request.type == 0)
                 if (request.type == 0)
                 {
                 {
-                    List<SyllabusVolume> volumesFind = await azureCosmosDBRepository.FindByDict<SyllabusVolume>(new Dictionary<string, object>() {
-                    { "schoolCode",request.scopeCode},{ "periodCode", request.periodCode},
+                    List<Volume> volumesFind = await azureCosmosDBRepository.FindByDict<Volume>(new Dictionary<string, object>() {
+                    { "code",request.code},{ "periodCode", request.periodCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName}  ,
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName}  ,
                         { "status",1} ,{ "type",0} });
                         { "status",1} ,{ "type",0} });
@@ -89,8 +89,8 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                 }
                 }
                 else if (request.type == 1)
                 else if (request.type == 1)
                 {
                 {
-                    List<SyllabusVolume> volumesFind = await azureCosmosDBRepository.FindByDict<SyllabusVolume>(new Dictionary<string, object>() {
-                        { "schoolCode",request.scopeCode},{ "periodCode", request.periodCode},
+                    List<Volume> volumesFind = await azureCosmosDBRepository.FindByDict<Volume>(new Dictionary<string, object>() {
+                        { "code",request.code},{ "periodCode", request.periodCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "subjectCode", request.subjectCode},{ "gradeCode", request.gradeCode},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "semesterCode",request.semesterCode},{ "volumeName",request.volumeName},
                         { "TEAMModelId",request.TEAMModelId}, { "status",1} ,{ "type",1} });
                         { "TEAMModelId",request.TEAMModelId}, { "status",1} ,{ "type",1} });
@@ -108,11 +108,11 @@ namespace TEAMModelOS.Service.Services.Syllabus.Implement
                 }
                 }
 
 
             }
             }
-            List<SyllabusVolume> volumes = new List<SyllabusVolume>
+            List<Volume> volumes = new List<Volume>
             {
             {
                 request
                 request
             };
             };
-            List<SyllabusVolume> volume = await azureCosmosDBRepository.SaveOrUpdateAll<SyllabusVolume>(volumes);
+            List<Volume> volume = await azureCosmosDBRepository.SaveOrUpdateAll<Volume>(volumes);
             return volume;
             return volume;
         }
         }
     }
     }

+ 2 - 2
TEAMModelOS.Service/Services/Syllabus/Interface/IKnowledgeService.cs

@@ -4,9 +4,9 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
+using TEAMModelOS.Service.Models;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Interface
+namespace TEAMModelOS.Service.Services.Interface
 {
 {
     public interface IKnowledgeService : IBusinessService
     public interface IKnowledgeService : IBusinessService
     {
     {

+ 4 - 4
TEAMModelOS.Service/Services/Syllabus/Interface/ISyllabusService.cs

@@ -4,9 +4,9 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Syllabus;
+using TEAMModelOS.Service.Models;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Interface
+namespace TEAMModelOS.Service.Services.Interface
 {
 {
     public interface ISyllabusService : IBusinessService
     public interface ISyllabusService : IBusinessService
     {
     {
@@ -23,11 +23,11 @@ namespace TEAMModelOS.Service.Services.Syllabus.Interface
         /// </summary>
         /// </summary>
         /// <param name="syllabusNodes"></param>
         /// <param name="syllabusNodes"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public Task<List<Syllabuses>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes);
+        public Task<List<Syllabus>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes);
 
 
         public Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request);
         public Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request);
 
 
-        public Task<List<Syllabuses>> DeleteSyllabus(Dictionary<string, object> request);
+        public Task<List<Syllabus>> DeleteSyllabus(Dictionary<string, object> request);
 
 
 
 
     }
     }

+ 3 - 3
TEAMModelOS.Service/Services/Syllabus/Interface/IVolumeService.cs

@@ -3,14 +3,14 @@ using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Models.Syllabus;
+using TEAMModelOS.Service.Models;
 
 
-namespace TEAMModelOS.Service.Services.Syllabus.Interface
+namespace TEAMModelOS.Service.Services.Interface
 {
 {
     public interface IVolumeService : IBusinessService
     public interface IVolumeService : IBusinessService
     {
     {
 
 
-        public  Task<List<SyllabusVolume>> SaveOrUpdateVolume(SyllabusVolume request);
+        public  Task<List<Volume>> SaveOrUpdateVolume(Volume request);
 
 
     }
     }
 }
 }

File diff suppressed because it is too large
+ 478 - 580
TEAMModelOS.Service/TEAMModelOS.Model.xml


+ 31 - 1
TEAMModelOS/ClientApp/src/static/baseDataDefault.json

@@ -48,6 +48,21 @@
         "gradeCode": "9",
         "gradeCode": "9",
         "gradeName": "九年级",
         "gradeName": "九年级",
         "alias": "五四制初中四年级,六三制小学三年级"
         "alias": "五四制初中四年级,六三制小学三年级"
+      },
+      {
+        "gradeCode": "10",
+        "gradeName": "十年级",
+        "alias": "高中一年级"
+      },
+      {
+        "gradeCode": "11",
+        "gradeName": "十一年级",
+        "alias": "高中二年级"
+      },
+      {
+        "gradeCode": "12",
+        "gradeName": "十二年级",
+        "alias": "高中三年级"
       }
       }
     ],
     ],
     "subjects": [
     "subjects": [
@@ -244,7 +259,22 @@
       {
       {
         "gradeCode": "9",
         "gradeCode": "9",
         "gradeName": "Grade Nine",
         "gradeName": "Grade Nine",
-        "alias": "Grade One"
+        "alias": "Grade Nine"
+      },
+      {
+        "gradeCode": "10",
+        "gradeName": "Grade Ten",
+        "alias": "Grade Ten"
+      },
+      {
+        "gradeCode": "11",
+        "gradeName": "Grade Eleven",
+        "alias": "Grade Eleven"
+      },
+      {
+        "gradeCode": "12",
+        "gradeName": "Grade Twelve",
+        "alias": "Grade Twelve"
       }
       }
     ]
     ]
   }
   }

+ 13 - 15
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -4,7 +4,6 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using TEAMModelOS.Service.Model.Exam.Models;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
@@ -13,13 +12,12 @@ using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Analysis.Interfaces;
 using TEAMModelOS.Service.Analysis.Interfaces;
 
 
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.Service.Models.Exam.Models;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
 using System.Diagnostics;
 using System.Diagnostics;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.Service.Models;
 
 
 namespace TEAMModelOS.Controllers.Analysis
 namespace TEAMModelOS.Controllers.Analysis
 {
 {
@@ -725,11 +723,11 @@ namespace TEAMModelOS.Controllers.Analysis
             dict.TryGetValue("subjectCode", out object subjectCode);
             dict.TryGetValue("subjectCode", out object subjectCode);
             dict.TryGetValue("schoolCode", out object schoolCode);
             dict.TryGetValue("schoolCode", out object schoolCode);
             dict.TryGetValue("examCode", out object examCode);
             dict.TryGetValue("examCode", out object examCode);
-            dict.TryGetValue("scopeCode", out object scopeCode);
+            dict.TryGetValue("code", out object code);
             Dictionary<string, object> sub = new Dictionary<string, object>
             Dictionary<string, object> sub = new Dictionary<string, object>
             {
             {
                 { "subjectCode",  subjectCode.ToString()},
                 { "subjectCode",  subjectCode.ToString()},
-                { "scopeCode",scopeCode.ToString()}
+                { "code",code.ToString()}
             };
             };
             Dictionary<string, object> examMap = new Dictionary<string, object>
             Dictionary<string, object> examMap = new Dictionary<string, object>
             {
             {
@@ -748,7 +746,7 @@ namespace TEAMModelOS.Controllers.Analysis
             {
             {
                 exams = await FindExamResultRedis(examMap, method + "ExamResource");
                 exams = await FindExamResultRedis(examMap, method + "ExamResource");
             }
             }
-            List<ExamPaper> paper = new List<ExamPaper>();
+            List<Paper> paper = new List<Paper>();
             if (RedisHelper.Instance != null)
             if (RedisHelper.Instance != null)
             {
             {
                 paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "PaperResource",
                 paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "PaperResource",
@@ -978,11 +976,11 @@ namespace TEAMModelOS.Controllers.Analysis
             dict.TryGetValue("subjectCode", out object subjectCode);
             dict.TryGetValue("subjectCode", out object subjectCode);
             dict.TryGetValue("schoolCode", out object schoolCode);
             dict.TryGetValue("schoolCode", out object schoolCode);
             dict.TryGetValue("examCode", out object examCode);
             dict.TryGetValue("examCode", out object examCode);
-            dict.TryGetValue("scopeCode", out object scopeCode);
+            dict.TryGetValue("code", out object code);
             Dictionary<string, object> sub = new Dictionary<string, object>
             Dictionary<string, object> sub = new Dictionary<string, object>
             {
             {
                 { "subjectCode",  subjectCode.ToString()},
                 { "subjectCode",  subjectCode.ToString()},
-                { "scopeCode",scopeCode.ToString()}
+                { "code",code.ToString()}
 
 
             };
             };
             Dictionary<string, object> examMap = new Dictionary<string, object>
             Dictionary<string, object> examMap = new Dictionary<string, object>
@@ -1003,7 +1001,7 @@ namespace TEAMModelOS.Controllers.Analysis
             {
             {
                 exams = await FindExamResultRedis(examMap, method + "KnowledgeResource");
                 exams = await FindExamResultRedis(examMap, method + "KnowledgeResource");
             }
             }
-            List<ExamPaper> paper = new List<ExamPaper>();
+            List<Paper> paper = new List<Paper>();
             if (RedisHelper.Instance != null)
             if (RedisHelper.Instance != null)
             {
             {
                 paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "KnowledgePaperResource",
                 paper = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + method + "KnowledgePaperResource",
@@ -1514,24 +1512,24 @@ namespace TEAMModelOS.Controllers.Analysis
             if (RedisHelper.Instance != null)
             if (RedisHelper.Instance != null)
             {
             {
 
 
-                List<ExamPaper> info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
+                List<Paper> info = await RedisHelper.CacheShellAsync(CacheCosmosPrefix + request.method,
                     ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamPaperRedis(request.@params, request.method); });
                     ShaHashHelper.GetSHA1(JsonNetHelper.ToJson(request.@params)), timeoutSeconds, () => { return FindExamPaperRedis(request.@params, request.method); });
                 builder.Data(info);
                 builder.Data(info);
 
 
             }
             }
             else
             else
             {
             {
-                List<ExamPaper> info = await FindExamPaperRedis(request.@params, request.method);
+                List<Paper> info = await FindExamPaperRedis(request.@params, request.method);
                 builder.Data(info);
                 builder.Data(info);
             }
             }
 
 
             return builder.build();
             return builder.build();
         }
         }
-        public async Task<List<ExamPaper>> FindExamPaperRedis(Dictionary<string, object> dict, string method)
+        public async Task<List<Paper>> FindExamPaperRedis(Dictionary<string, object> dict, string method)
         {
         {
             try
             try
             {
             {
-                List<ExamPaper> info = await azureCosmosDBRepository.FindByDict<ExamPaper>(dict);
+                List<Paper> info = await azureCosmosDBRepository.FindByDict<Paper>(dict);
                 if (RedisHelper.Instance != null)
                 if (RedisHelper.Instance != null)
                 {
                 {
                     if (!RedisHelper.Exists(CacheCosmosPrefix + method))
                     if (!RedisHelper.Exists(CacheCosmosPrefix + method))
@@ -1630,10 +1628,10 @@ namespace TEAMModelOS.Controllers.Analysis
 
 
             //request.@params.TryGetValue("subjectCode", out object subjectCode);
             //request.@params.TryGetValue("subjectCode", out object subjectCode);
             request.@params.TryGetValue("schoolCode", out object schoolCode);
             request.@params.TryGetValue("schoolCode", out object schoolCode);
-            request.@params.TryGetValue("scopeCode", out object scopeCode);
+            request.@params.TryGetValue("code", out object code);
             Dictionary<string, object> eMap = new Dictionary<string, object>
             Dictionary<string, object> eMap = new Dictionary<string, object>
             {
             {
-                { "scopeCode",  scopeCode.ToString()}
+                { "code",  code.ToString()}
             };
             };
             Dictionary<string, object> SCMap = new Dictionary<string, object>
             Dictionary<string, object> SCMap = new Dictionary<string, object>
             {
             {

+ 0 - 208
TEAMModelOS/Controllers/Analysis/ChangeController.cs

@@ -1,208 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using TEAMModelOS.Helper.Common.FileHelper;
-using TEAMModelOS.Service.Model.Exam.Models;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper.JsonPath;
-using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
-using TEAMModelOS.Service.Models.Core;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-
-namespace TEAMModelOS.Controllers.Analysis
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class ChangeController : Controller
-    {
-       
-        private readonly IWebHostEnvironment _hostingEnvironment;
-        public IAzureCosmosDBV3Repository _cosmosrepository;
-        public ChangeController(IWebHostEnvironment hostingEnvironment, IAzureCosmosDBV3Repository cosmosDBRepository)
-        {
-            _hostingEnvironment = hostingEnvironment;
-            _cosmosrepository = cosmosDBRepository;
-        }
-
-
-         
-        [HttpGet("SaveObjectAdas")]
-        public BaseJosnRPCResponse SaveObjectAdas(string identity)
-
-        {
-            // 获取系统路径
-            string contentRootPath = _hostingEnvironment.ContentRootPath;
-            identity = "IES/adas";
-            //string query = "$.info";
-            //int countClasses = 0; 
-            //string queryClass = "$member.1.item_answer[*]";
-            string query = "$.exercise[*]";
-            string queryInfo = "$.info";
-            string queryPoint = "$.testpaper.item[*]";
-            //string queryInfo = "$.exercise.info[*]";
-            string data = FileTool.getJson(contentRootPath, identity);
-            data = FileTool.UnicodeToString(data);
-            JObject parsedJson = JObject.Parse(data);
-            JsonPathContext context = new JsonPathContext
-            { ValueSystem = new JsonNetValueSystem() };
-            List<dynamic> papers = context.SelectNodes(parsedJson,
-            query).Select(node => node.Value).ToList();
-            List<dynamic> info = context.SelectNodes(parsedJson,
-            queryInfo).Select(node => node.Value).ToList();
-            List<dynamic> Itempoint = context.SelectNodes(parsedJson,
-            queryPoint).Select(node => node.Value).ToList();
-
-            int m = 0;
-            //人数总和
-            int Count = 0;
-            //起始坐标
-            int Strat = 0;
-            // 初始化学生人数
-            int Stus = 0;
-            SimpleExam simple = new SimpleExam();
-            List<Student> students = new List<Student>();
-            List<Classroom> classrooms = new List<Classroom>();
-            List<List<List<int>>> ClassPoint = new List<List<List<int>>>();
-            List<List<int>> StuPoint = new List<List<int>>();
-            List<string> StuIds = new List<string>();
-            List<Dictionary<string, int[]>> Classes = new List<Dictionary<string, int[]>>();
-            Dictionary<object, object> ListInfo = new Dictionary<object, object>();
-            List<int> points = new List<int>();
-            //配分数组
-            Itempoint.ForEach(p =>
-            {
-                string pt = p.point;
-                points.Add(int.Parse(pt.Trim()));
-            });
-            //基本信息
-            info.ForEach(e => {
-                simple.Name = e.test_name;
-                simple.Time = e.test_date;
-            });
-            School sc = new School
-            {
-                schoolCode = "qcs",
-                schoolName = "青城山",
-                period = new List<Period> { new Period {periodName = "中专" , periodCode = "zz",grades= new List<Grade> { 
-                    new Grade { gradeName = "初中一年级" ,gradeCode = "7"} } } }
-            };
-            papers.ForEach(x =>
-            {
-            
-            //var c = papers[i].member;
-            string stu = x.info.stucount;
-            int k = int.Parse(stu);
-                string key = x.info.class_name;
-                string schoolName = x.info.school_name;
-                Classroom classInfo = new Classroom
-                {
-                    id = System.Guid.NewGuid().ToString(),
-                    classroomName = key,
-                    scopeCode = schoolName,
-                    studentCount = k,
-                    classroomCode = "qcs"
-                };
-                classrooms.Add(classInfo);
-                Classroom classInfoOfStudent = new Classroom
-                {
-                    classroomName = key,
-                    scopeCode = schoolName,
-                    //studentCount = k,
-                    classroomCode = "qcs"
-                };
-                Dictionary<string, int[]> map = new Dictionary<string, int[]>();
-                int[] Range = new int[2];
-                for (int j = 1; j <= k; j++)
-                {
-                    Student stus = new Student
-                    {
-                        type = 2,
-                        schoolCode = schoolName
-                    };
-                    //stus.classroom = "";
-                    string men = x.member + "";
-                    JObject jArray = JObject.Parse(men);
-                    List<int> point = new List<int>();
-                    //List<string> stuId = new List<string>();
-                    string queryClass = "$." + j + ".item_answer[*]";
-                    string queryStu = "$." + j + ".info";
-                    List<dynamic> answers = context.SelectNodes(jArray,
-                    queryClass).Select(node => node.Value).ToList();
-                    //学生ID集合
-                    List<dynamic> studentIds = context.SelectNodes(jArray,
-                    queryStu).Select(node => node.Value).ToList();
-
-                    if (answers.Count == 0)
-                    {
-                        StuIds.Add("0");
-                        k++;
-                    }
-                    else {
-                        studentIds.ToList<dynamic>().ForEach(s =>
-                        {
-                           
-                            string id = s.studentid;
-                            //id = System.Guid.NewGuid().ToString();
-                            stus.id = id.Trim();
-                            stus.name = s.name;
-                            stus.studentId = id.Trim();
-                            stus.seatNo = s.seatno;
-                            //stus.classroom = classInfoOfStudent;
-                            StuIds.Add(id.Trim());
-                        });
-                        students.Add(stus);
-                    }                   
-                    answers.ToList<dynamic>().ForEach(p =>
-                    {
-                        string pt = p.ans_point;
-                        point.Add(int.Parse(pt.Trim()));
-                    });
-                    StuPoint.Add(point);
-                    Stus++;
-                }
-                //每次人数累加得到实际总人数
-                Count += Stus;
-                if (m == 0)
-                {
-                    Strat = Stus;
-                    Range[0] = 0;
-                    Range[1] = Stus - 1;
-                }
-                else
-                {
-                    Range[0] = Count - Stus;
-                    Range[1] = Count - 1;
-                }
-                
-                map.Add(key, Range);
-                Classes.Add(map);
-                m++;
-                //初始化每个班级人数
-                Stus = 0;
-                
-                //ClassPoint.Add(StuPoint);
-            });
-            simple.Classes = Classes;
-            simple.Ids = StuIds;
-            simple.Point = points;
-            simple.Result = StuPoint;
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            //_examInfoService.SaveToCosmos(simple);
-            //_cosmosrepository.Save(sc);
-            //_cosmosrepository.Save(simple);
-            //_cosmosrepository.SaveAll(classrooms);
-            _cosmosrepository.SaveOrUpdateAll(students);
-            //_examInfoService.SaveListToCosmos(students);
-
-
-            return builder.Data(sc).build();
-            //return builder.build();
-        }
-
-         
-
-    }
-}

+ 1 - 1
TEAMModelOS/Controllers/BaseController.cs

@@ -5,7 +5,7 @@ using TEAMModelOS.SDK.Extension.JwtAuth.JwtHelper;
 using TEAMModelOS.SDK.Extension.JwtAuth.Models;
 using TEAMModelOS.SDK.Extension.JwtAuth.Models;
 using TEAMModelOS.SDK.Context.Constant.Common;
 using TEAMModelOS.SDK.Context.Constant.Common;
 using System.Security.Claims;
 using System.Security.Claims;
-using TEAMModelOS.Service.Models.Core;
+using TEAMModelOS.Service.Models;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers

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

@@ -9,7 +9,7 @@ using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Network.HttpHelper;
 using TEAMModelOS.SDK.Helper.Network.HttpHelper;
 
 
-namespace TEAMModelOS.Controllers.Core
+namespace TEAMModelOS.Controllers
 {
 {
     [Route("api/[controller]")]
     [Route("api/[controller]")]
     [ApiController]
     [ApiController]

+ 19 - 33
TEAMModelOS/Controllers/Core/ClassRoomController.cs

@@ -3,7 +3,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
-using TEAMModelOS.Service.Models.Core;
+using TEAMModelOS.Service.Models;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
@@ -13,7 +13,7 @@ using TEAMModelOS.SDK.Helper.Common.ValidateHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using System.Linq;
 using System.Linq;
 
 
-namespace TEAMModelOS.Controllers.Syllabus
+namespace TEAMModelOS.Controllers
 {
 {
     [Route("api/[controller]")]
     [Route("api/[controller]")]
     [ApiController]
     [ApiController]
@@ -23,8 +23,8 @@ namespace TEAMModelOS.Controllers.Syllabus
         public ClassroomController(IAzureCosmosDBV3Repository _cosmosrepository) {
         public ClassroomController(IAzureCosmosDBV3Repository _cosmosrepository) {
             cosmosrepository = _cosmosrepository;
             cosmosrepository = _cosmosrepository;
         }
         }
-        [HttpPost("SaveOrUpdate")]
-        public async ValueTask<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<Classroom> request)
+        [HttpPost("upsert")]
+        public async ValueTask<BaseJosnRPCResponse> Upsert(JosnRPCRequest<Classroom> request)
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Student> students = null;
             List<Student> students = null;
@@ -32,53 +32,47 @@ namespace TEAMModelOS.Controllers.Syllabus
             if (request.@params.id != null)
             if (request.@params.id != null)
             {
             {
                 await cosmosrepository.SaveOrUpdate(request.@params);
                 await cosmosrepository.SaveOrUpdate(request.@params);
-                students = await cosmosrepository.FindByDict<Student>(new Dictionary<string, object>() { { "classroomCode", request.@params.classroomCode }, { "schoolCode", request.@params.scopeCode } });
+                students = await cosmosrepository.FindByDict<Student>(new Dictionary<string, object>() { { "classroomCode", request.@params.classroomCode }, { "schoolCode", request.@params.code } });
             }
             }
             else
             else
             {
             {
-                List<Classroom> sc = await cosmosrepository.FindByDict<Classroom>(new Dictionary<string, object> { { "classroomCode", request.@params.classroomCode },{ "scopeCode", request.@params.scopeCode } });
-                if (sc.IsNotEmpty()) {
+                List<int> sc = await cosmosrepository.FindCountByDict<Classroom>(new Dictionary<string, object> { { "classroomCode", request.@params.classroomCode } });
+                if (sc.IsNotEmpty() && sc[0]>0) {
                     throw new  BizException("班级代码已经存在!",ResponseCode.DATA_EXIST);
                     throw new  BizException("班级代码已经存在!",ResponseCode.DATA_EXIST);
                 }
                 }
-                request.@params.id = Guid.NewGuid().ToString();
-
+                request.@params.id = request.@params.classroomCode;
                 await cosmosrepository.SaveOrUpdate<Classroom>(request.@params);
                 await cosmosrepository.SaveOrUpdate<Classroom>(request.@params);
                 
                 
             }
             }
-            ClassroomStudent classroomStudent = new ClassroomStudent();
-            List<ClassroomStudent> classroomStudents = await cosmosrepository.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", request.@params.classroomCode }, { "scopeCode", request.@params.scopeCode } });
+            //强制关联原生班级的id
+            List<ClassStudent> classroomStudents = await cosmosrepository.FindByDict<ClassStudent>(new Dictionary<string, object> { { "id", request.@params.classroomCode } });
             if (classroomStudents.IsNotEmpty())
             if (classroomStudents.IsNotEmpty())
             {
             {
-                classroomStudent = classroomStudents[0];
                 if (students.IsNotEmpty()) {
                 if (students.IsNotEmpty()) {
+                    List<ClassStudent> newClassStudents = new List<ClassStudent>();
                     students.ForEach(x=> {
                     students.ForEach(x=> {
-                        if (!classroomStudent.studentId.Contains(x.studentId)) {
-                            classroomStudent.studentId.Add(x.studentId);
+                        if (!classroomStudents.Select(m=>m.code).Contains(x.studentId)) {
+                            newClassStudents.Add(new ClassStudent { code = x.studentId, id= request.@params.classroomCode });
                         }
                         }
                     });
                     });
+                    await cosmosrepository.SaveOrUpdateAll<ClassStudent>(newClassStudents);
                 }
                 }
             }
             }
-            else {
-                classroomStudent.scopeCode = request.@params.scopeCode;
-                classroomStudent.id = request.@params.classroomCode;
-            }
-            await cosmosrepository.SaveOrUpdate<ClassroomStudent>(classroomStudent);
             return builder.Data(request.@params).build();
             return builder.Data(request.@params).build();
         }
         }
 
 
-        [HttpPost("FindClassInfo")]
-        public async Task<BaseJosnRPCResponse> FindClassInfo(JosnRPCRequest<Dictionary<string, object>> request)
+        [HttpPost("Find")]
+        public async Task<BaseJosnRPCResponse> Find(JosnRPCRequest<Dictionary<string, object>> request)
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Classroom> sc = await cosmosrepository.FindByDict<Classroom>(request.@params);
             List<Classroom> sc = await cosmosrepository.FindByDict<Classroom>(request.@params);
-            //sc.First11
             return builder.Data(sc).build();
             return builder.Data(sc).build();
         }
         }
 
 
 
 
 
 
-        [HttpPost("DelClassroom")]
-        public async Task<BaseJosnRPCResponse> DelClassroom(JosnRPCRequest<Dictionary<string, object>> request)
+        [HttpPost("delete")]
+        public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             if (request.@params.TryGetValue("id", out object id))
             if (request.@params.TryGetValue("id", out object id))
@@ -86,15 +80,7 @@ namespace TEAMModelOS.Controllers.Syllabus
                 List<Classroom> sc = await cosmosrepository.FindByDict<Classroom>(request.@params);
                 List<Classroom> sc = await cosmosrepository.FindByDict<Classroom>(request.@params);
                 if (sc.IsNotEmpty())
                 if (sc.IsNotEmpty())
                 {
                 {
-                    //List<IdPk> students = new List<IdPk>();
-                    //foreach (Classroom classroom in sc)
-                    //{
-                    //   // List<ClassroomStudent> classroomStudents = await cosmosrepository.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", classroom.classroomCode }, { "scopeCode", classroom.scopeCode } });
-                    //    students.AddRange(classroomStudents.Select(x=>new IdPk {id=x.id,pk=x.scopeCode }));
-                    //}
-                    List<IdPk> students = new List<IdPk>();
-                    students.AddRange(sc.Select(x => new IdPk { id = x.classroomCode, pk = x.scopeCode }));
-                    await cosmosrepository.DeleteAll<ClassroomStudent>(students);
+                    await cosmosrepository.DeleteAll<ClassStudent>(new Dictionary<string, object> { { "id", sc.Select(x=>x.classroomCode).ToArray()} });
                     List<IdPk> idPks = await cosmosrepository.DeleteAll<Classroom>(sc);
                     List<IdPk> idPks = await cosmosrepository.DeleteAll<Classroom>(sc);
                     builder.Data(idPks);
                     builder.Data(idPks);
                 }
                 }

+ 178 - 0
TEAMModelOS/Controllers/Core/ClassStudentController.cs

@@ -0,0 +1,178 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using TEAMModelOS.SDK.Context.Exception;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
+using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Helper.Common.ValidateHelper;
+using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
+using TEAMModelOS.Service.Models;
+ 
+
+namespace TEAMModelOS.Controllers
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    public class ClassStudentController : BaseController
+    {
+
+        private IAzureCosmosDBV3Repository _cosmos;
+
+        public ClassStudentController(IAzureCosmosDBV3Repository cosmos)
+        {
+            _cosmos = cosmos;
+        }
+
+        /// <summary>
+        ///  获取实时的学生-班级关联信息
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("find")]
+        public async Task<BaseJosnRPCResponse> find(JosnRPCRequest<Dictionary<string,string>> request) {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            // 班级编码
+            if (request.@params.TryGetValue("classroomCode", out string classroomCode)
+                ///学校编码
+                 && request.@params.TryGetValue("schoolCode", out string schoolCode)
+                )
+            {
+                List<ClassStudent> classroomStudents = await _cosmos.FindByDict<ClassStudent>(new Dictionary<string, object> { { "id", classroomCode }});
+                List<Student> students = await _cosmos.FindByDict<Student>(new Dictionary<string, object>() { { "classroomCode", classroomCode }, { "code", schoolCode } });
+                List<dynamic> stus = new List<dynamic>();
+                List<ClassStudent> newClassStudents = new List<ClassStudent>();
+                ///新增的学生
+                if (students.IsNotEmpty())
+                {
+                    students.ForEach(x =>
+                    {
+                        if (!classroomStudents.Select(m=>m.code).Contains(x.studentId))
+                        {
+                            newClassStudents.Add(new ClassStudent() { id = classroomCode, code = x.studentId });
+                        }
+                        var stu = new { x.id, x.name, x.code, x.seatNo, x.studentId, x.classroomCode };
+                        stus.Add(stu);
+                    });
+                }
+                 ///反射已存在的id信息
+                if (classroomStudents.IsNotEmpty())
+                {
+                    var sts = await _cosmos.FindByDict<Student>(new Dictionary<string, object>() { { "studentId", classroomStudents.Select(x=>x.code).ToArray() } });
+                    sts.ForEach(x => {
+                        var stu = new { x.id, x.name, x.code, x.seatNo, x.studentId, x.classroomCode };
+                        stus.Add(stu);
+                    });
+                }
+                //保存新增学生
+                if (newClassStudents.IsNotEmpty()) {
+                    classroomStudents.AddRange( await _cosmos.SaveOrUpdateAll(newClassStudents));
+                }
+                return builder.Data(classroomStudents).Extend(new Dictionary<string, object> { { "students", stus }, { "count", stus.Count } }).build();
+            }
+            else { throw new BizException("参数异常classroomCode,code", ResponseCode.PARAMS_ERROR); }
+        }
+
+        /// <summary>
+        /// 保存或修改教室学生关联
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("save")]
+        public async Task<BaseJosnRPCResponse> Save(JosnRPCRequest<List<ClassStudent>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+
+            if (ValidateHelper.IsValid(request.@params))
+            {
+                List<ClassStudent> students = await _cosmos.SaveOrUpdateAll(request.@params);
+                builder.Data(students);
+            }
+            return builder.build();
+        }
+
+
+        /// <summary>
+        /// 学生加入教室 
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("addStudent")]
+        public async Task<BaseJosnRPCResponse> addStudent(JosnRPCRequest<List<ClassStudent>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (ValidateHelper.IsValid(request.@params))
+            {
+                List<ClassStudent> students = await _cosmos.SaveOrUpdateAll(request.@params);
+                builder.Data(students);
+            }
+            return builder.build();
+        }
+        /// <summary>
+        /// 学生退出教室,只能退出非原生班级的教室
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("Exit")]
+        public async Task<BaseJosnRPCResponse> Exit(JosnRPCRequest<List<ClassStudent>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (ValidateHelper.IsValid(request.@params) && request.@params.Count>0)
+            {
+                List<Student> students = await _cosmos.FindByDict<Student>(new Dictionary<string, object> { { "studentId", request.@params.GroupBy(x => x.id).ToList().Select(x => x.Key).ToArray() } });
+                students.ForEach(x => {
+                    if (!string.IsNullOrEmpty(x.classroomCode)) {
+                        request.@params.ForEach(m =>
+                        {
+                            if (x.classroomCode.Equals(m.id) && x.studentId.Equals(m.code)) {
+                                request.@params.Remove(m);
+                            }
+                        });
+                    }
+                });
+                List<IdPk> idPks = await _cosmos.DeleteAll<ClassStudent>(request.@params.Select(x=> new IdPk { id=x.id,pk=x.code}).ToList());
+                builder.Data(idPks);
+            }
+            return builder.build();
+        }
+      
+        /// <summary>
+        /// 查询教室学生关联 根据id
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("findById")]
+        public async Task<BaseJosnRPCResponse> FindById(JosnRPCRequest<IdPk> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (ValidateHelper.IsValid(request.@params))
+            {
+                ClassStudent classStudent = await _cosmos.FindByIdPk<ClassStudent>(request.@params.id,request.@params.pk);
+                List<Student> students = await _cosmos.FindByDict<Student>(new Dictionary<string, object> { { "studentId",request.@params.pk } });
+                builder.Data(classStudent).Extend(new Dictionary<string, object> { { "student",students.IsNotEmpty()? students[0]:null } });
+            }
+            return builder.build();
+        }
+        /// <summary>
+        /// 查询学生在哪些教室
+        /// </summary>
+        /// <param name="studentId"></param>
+        /// <returns></returns>
+        [HttpPost("findByStu")]
+        public async Task<BaseJosnRPCResponse> FindByStu(JosnRPCRequest<string> studentId)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (!string.IsNullOrEmpty(studentId.@params))
+            {
+                List<ClassStudent> sc = await _cosmos.FindByDict<ClassStudent>(new Dictionary<string, object> { { "code",studentId.@params} });
+                List<Classroom> classrooms = await _cosmos.FindByDict<Classroom>(new Dictionary<string, object> { { "classroomCode", sc.GroupBy(x => x.id).Select(x => x.Key).ToArray() } });
+                builder.Data(classrooms).Extend(new Dictionary<string, object> { { "count", classrooms.Count } });
+            }
+            return builder.build();
+        }
+
+    }
+}

+ 0 - 315
TEAMModelOS/Controllers/Core/ClassroomStudentController.cs

@@ -1,315 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using DocumentFormat.OpenXml.Drawing.Diagrams;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using TEAMModelOS.SDK.Context.Exception;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
-using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.Helper.Common.ValidateHelper;
-using TEAMModelOS.SDK.Module.AzureCosmosDBV3;
-using TEAMModelOS.Service.Models.Core;
-using static TEAMModelOS.Service.Models.Core.ClassroomStudent;
-
-namespace TEAMModelOS.Controllers.Core
-{
-    [Route("api/[controller]")]
-    [ApiController]
-    public class ClassroomStudentController : BaseController
-    {
-
-        private IAzureCosmosDBV3Repository _cosmos;
-
-        public ClassroomStudentController(IAzureCosmosDBV3Repository cosmos)
-        {
-            _cosmos = cosmos;
-        }
-
-        /// <summary>
-        ///  获取实时的学生-班级关联信息
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("OnTime")]
-        public async Task<BaseJosnRPCResponse> ClassroomStudentOnTime(JosnRPCRequest<Dictionary<string,string>> request) {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            if (request.@params.TryGetValue("classroomCode", out string classroomCode) &&
-                request.@params.TryGetValue("scopeCode", out string scopeCode))
-            {
-                List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", classroomCode }, { "scopeCode", scopeCode } });
-                List<Student> students = await _cosmos.FindByDict<Student>(new Dictionary<string, object>() { { "classroomCode", classroomCode }, { "schoolCode", scopeCode } });
-                ClassroomStudent classroomStudent = new ClassroomStudent() { id = classroomCode, scopeCode = scopeCode };
-                List<dynamic> stus = new List<dynamic>();
-                if (classroomStudents.IsNotEmpty())
-                {
-                    classroomStudent = classroomStudents[0];
-                    if (students.IsNotEmpty())
-                    {
-                        students.ForEach(x =>
-                        {
-                            if (!classroomStudent.studentId.Contains(x.studentId))
-                            {
-                                classroomStudent.studentId.Add(x.studentId);
-                            }
-                            var stu = new { x.id, x.name, x.schoolCode, x.seatNo, x.studentId, x.classroomCode };
-                            stus.Add(stu);
-                        });
-                    }
-                    List<string> stuids = new List<string>();
-                    if (classroomStudent.studentId.IsNotEmpty()) {
-                        if (students.IsNotEmpty())
-                        {
-                            classroomStudent.studentId.ForEach(x =>
-                            {
-                                if (!students.Select(x => x.studentId).Contains(x))
-                                {
-                                    stuids.Add(x);
-                                }
-                            });
-                        }
-                        else {
-                            stuids.AddRange(classroomStudent.studentId);
-                        }
-                    }
-                    if (stuids.IsNotEmpty()) {
-                        var   sts = await _cosmos.FindByDict<Student>(new Dictionary<string, object>() { { "studentId", stuids.ToArray() } });
-                        sts.ForEach(x=> {
-                            var stu = new { x.id, x.name, x.schoolCode, x.seatNo, x.studentId, x.classroomCode };
-                            stus.Add(stu);
-                        });
-                    }
-                }
-                classroomStudent = await _cosmos.SaveOrUpdate(classroomStudent);
-                return builder.Data(classroomStudent).Extend(new Dictionary<string, object> { { "students", stus } }).build();
-            }
-            else { throw new BizException("参数异常classroomCode,scopeCode", ResponseCode.PARAMS_ERROR); }
-          
-        }
-
-        /// <summary>
-        /// 保存 或 修改 教室学生关联
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("SaveClassroomStudent")]
-        public async Task<BaseJosnRPCResponse> SaveClassroomStudent(JosnRPCRequest<List<ClassroomStudent>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-
-            if (ValidateHelper.IsValid(request.@params))
-            {
-                List<ClassroomStudent> students = await _cosmos.SaveOrUpdateAll(request.@params);
-                builder.Data(students);
-            }
-            return builder.build();
-        }
-
-
-        /// <summary>
-        /// 学生加入教室 或者 修改座位号
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("AddClassroom")]
-        public async Task<BaseJosnRPCResponse> AddClassroomAsync(JosnRPCRequest<List<ClassroomStudent>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-
-            if (ValidateHelper.IsValid(request.@params))
-            {
-                List<ClassroomStudent> students = request.@params;
-                List<ClassroomStudent> classroomStudents1 = new List<ClassroomStudent>();
-                foreach (var classroomStudent in students.GroupBy(x => x.id).ToList()) {
-                    
-                    List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", classroomStudent.Key } });
-                    foreach (var classroomStudent1 in classroomStudent) 
-                    {
-                        classroomStudent1.studentId.ForEach(x=> {
-                            if (!classroomStudents[0].studentId.Contains(x)) {
-                                classroomStudents[0].studentId.Add(x);
-                            }
-                        });
-                      
-                      //  classroomStudents[0].studentId.UnionWith(classroomStudent1.studentId);
-                    }
-                    classroomStudents1.AddRange(classroomStudents);
-                }
-                List<ClassroomStudent> students1 = await _cosmos.SaveOrUpdateAll(classroomStudents1);
-                builder.Data(students1);
-            }
-            return builder.build();
-        }
-        /// <summary>
-        /// 学生退出教室
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("Exit")]
-        public async Task<BaseJosnRPCResponse> Exit(JosnRPCRequest<List<ClassroomStudent>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            if (ValidateHelper.IsValid(request.@params) && request.@params.Count>0)
-            {
-                List<ClassroomStudent> students = request.@params;
-                List<ClassroomStudent> classroomStudents1 = new List<ClassroomStudent>();
-                foreach (ClassroomStudent item1 in students)
-                {
-                    List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "id", item1.id } });
-                    foreach (ClassroomStudent item2 in classroomStudents)
-                    {
-                        item1.studentId.ForEach(x=> { item2.studentId.Remove(x); });
-
-                       // item2.studentId.ExceptWith(item1.studentId);
-                    }
-                    classroomStudents1.AddRange(classroomStudents);
-                }
-
-                List<ClassroomStudent> students1 = await _cosmos.SaveOrUpdateAll(classroomStudents1);
-                //if (students1.Count > 0) 
-                    builder.Data(students1);
-            }
-            return builder.build();
-        }
-        /// <summary>
-        /// 查询教室学生关联
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("FindClassroom")]
-        public async Task<BaseJosnRPCResponse> FindClassroom(JosnRPCRequest<Dictionary<string, object>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            if (ValidateHelper.IsValid(request.@params))
-            {
-                List<ClassroomStudent> sc = await _cosmos.FindByDict<ClassroomStudent>(request.@params);
-                builder.Data(sc).Extend(new Dictionary<string, object> { { "count", sc.Count } });
-                //select value(c) from c join A0  in c.studentId where 1=1  and A0 =  @studentId0 
-            }
-            return builder.build();
-        }
-        /// <summary>
-        /// 查询教室学生关联 根据id
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("FindClassroomById")]
-        public async Task<BaseJosnRPCResponse> FindClassroomById(JosnRPCRequest<List<string>> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            if (ValidateHelper.IsValid(request.@params))
-            {
-                List<ClassroomStudent> sc = await _cosmos.FindByIds<ClassroomStudent>(request.@params);
-                builder.Data(sc).Extend(new Dictionary<string, object> { { "count", sc.Count } });
-                //select value(c) from c join A0  in c.studentId where 1=1  and A0 =  @studentId0 
-            }
-            return builder.build();
-        }
-        /// <summary>
-        /// 查询学生在哪些教室
-        /// </summary>
-        /// <param name="studentId"></param>
-        /// <returns></returns>
-        [HttpPost("FindStudents")]
-        public async Task<BaseJosnRPCResponse> FindStudents(JosnRPCRequest<string> studentId)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            if (ValidateHelper.IsValid(studentId.@params))
-            {
-                List<ClassroomStudent> sc = await _cosmos.FindSQL<ClassroomStudent>("select c.id,c.scopeCode from c join A0  in c.studentId where 1=1  and A0 =  \'" + studentId.@params + "\'");
-                //select value(c) from c join A0  in c.studentId where 1=1  and A0 =  @studentId0 
-                builder.Data(sc).Extend(new Dictionary<string, object> { { "count", sc.Count } });
-            }
-            return builder.build();
-        }
-        //private async Task NotRepeatSeat(JosnRPCRequest<List<ClassroomStudent>> request, JsonRPCResponseBuilder builder)
-        //{
-        //    List<ClassroomStudent> requestStudent = request.@params;
-        //    List<ClassroomStudent> students1 = new List<ClassroomStudent>();
-        //    List<dynamic> repeatStudent = new List<dynamic>();
-
-        //    for (int s = 0; s < requestStudent.Count; s++)
-        //    {
-
-        //        List<ClassroomStudent> classroomStudents = await _cosmos.FindByDict<ClassroomStudent>(new Dictionary<string, object> { { "classroomCode", requestStudent[s].classroomCode } });
-        //        Dictionary<int, object> seatNo = new Dictionary<int, object>();
-        //        if (classroomStudents.IsNotEmpty())
-        //        {
-        //            // 数据库等待换位置学生序号
-        //            List<Stu> awaitstudent = new List<Stu>();
-
-        //            List<Stu> itemstu = new List<Stu>();
-        //            itemstu.AddRange(classroomStudents[0].studentId);
-        //            for (int x = 0; x < classroomStudents[0].studentId.Count; x++)
-        //            {
-        //                for (int y = 0; y < requestStudent[s].studentId.Count; y++)
-        //                {
-        //                    if (requestStudent[s].studentId[y].studentId == classroomStudents[0].studentId[x].studentId)
-        //                    {
-        //                        itemstu.Remove(classroomStudents[0].studentId[x]);
-        //                        awaitstudent.Add(classroomStudents[0].studentId[x]);
-        //                    }
-        //                }
-        //            }
-        //            foreach (Stu stu in itemstu)
-        //            {
-        //                seatNo.Add(stu.seatNo, stu.studentId);
-        //            }
-
-        //            for (int y = 0; y < requestStudent[s].studentId.Count; y++)
-        //            {
-        //                try
-        //                {
-
-        //                    // 把 请求 学生加入座位队列
-        //                    seatNo.Add(requestStudent[s].studentId[y].seatNo, requestStudent[s].studentId[y].studentId);
-        //                }
-        //                catch
-        //                {
-        //                    //座位重复学生 加入数组
-        //                    var student = new { requestStudent[s].studentId[y].seatNo, requestStudent[s].studentId[y].studentId, classroomStudents[0].classroomCode };
-        //                    repeatStudent.Add(student);
-
-        //                    //回滚
-        //                    if (awaitstudent.IsNotEmpty())
-        //                    {
-        //                        foreach (Stu stu in awaitstudent) { 
-        //                            if(requestStudent[s].studentId[y].studentId == stu.studentId)
-        //                                itemstu.Add(stu);
-        //                        }
-
-
-        //                    }
-        //                    continue;
-        //                }
-
-        //                //标记是否加入数据库查到的学生列表
-        //                bool fig = true;
-        //                itemstu.ForEach(x =>
-        //                {
-        //                    if (x.studentId == requestStudent[s].studentId[y].studentId)
-        //                    {
-        //                        x.seatNo = requestStudent[s].studentId[y].seatNo;
-        //                        fig = false;
-        //                    }
-        //                });
-        //                if (fig) itemstu.Add(requestStudent[s].studentId[y]);
-        //            }
-        //            classroomStudents[0].studentId = itemstu;
-
-        //            ClassroomStudent students = await _cosmos.SaveOrUpdate(classroomStudents[0]);
-        //            students1.Add(students);
-        //        }
-        //    }
-
-        //    if (repeatStudent.Count > 0)
-        //    {
-        //        builder.Extend(new Dictionary<string, object> { { "repeatStudent", repeatStudent } });
-        //    }
-        //    builder.Data(students1);
-        //}
-
-    }
-}

+ 0 - 0
TEAMModelOS/Controllers/Core/CommonController.cs


Some files were not shown because too many files changed in this diff