CrazyIter_Bin 3 роки тому
батько
коміт
89eaf86b12

+ 61 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/GroupList.cs

@@ -33,7 +33,6 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public int scount { get; set; }
         public List<Member> members { get; set; } = new List<Member>();
-
     }
     public class Member
     {
@@ -64,5 +63,66 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public string irs { get; set; }
         public string tag { get; set; }
+        /// <summary>
+        /// 行政班
+        /// </summary>
+        public string classId { get; set; }
+    }
+    public class GroupListDto
+    {
+        public string id { get; set; }
+        public string code { get; set; }
+        public string name { get; set; }
+        //标记该名单唯一code
+        public string no { get; set; }
+        public string periodId { get; set; }
+        //课程id,需要标记则标记
+        //public string courseId { get; set; }
+        public string scope { get; set; }
+        public string school { get; set; }
+        public string creatorId { get; set; }
+        /// <summary>
+        ///教学班teach ,行政班(学生搜寻classId动态返回)class ,教研组research,学科组(学科搜寻动态返回)subject,好友friend,管理manage,群组group等
+        /// </summary>
+        public string type { get; set; } = "teach";
+        public int year { get; set; }
+        /// <summary>
+        /// 醍摩豆id成员数量
+        /// </summary>
+        public int tcount { get; set; }
+        /// <summary>
+        /// 校内账号成员数量
+        /// </summary>
+        public int scount { get; set; }
+    }
+    public class CourseGroupList
+    {
+        public string scope { get; set; }
+        public string subject { get; set; }
+        public string period { get; set; }
+        public string name { get; set; }
+        public string id { get; set; }
+        public List<GroupListDto> groups { get; set; } = new List<GroupListDto>();
+    }
+    public class TeachCourse
+    {
+        public string scope { get; set; }
+
+        public IdName subject { get; set; }
+        public IdName period { get; set; }
+        public string name { get; set; }
+        public string id { get; set; }
+        public TeachSchedule schedule { get; set; }
+    }
+    public class TeachSchedule
+    {
+        public string classId { get; set; }
+        public string stulist { get; set; }
+        public string teacherId { get; set; }
+    }
+    public class IdName
+    {
+        public string id { get; set; }
+        public string name { get; set; }
     }
 }

+ 2 - 1
TEAMModelOS.SDK/Models/Service/GroupListService.cs

@@ -406,7 +406,7 @@ namespace TEAMModelOS.SDK.Models.Service
                         var ids = item.list.Select(x => x.id).ToList();
                         if (ids.IsNotEmpty())
                         {
-                            StringBuilder stuSql = new StringBuilder($"SELECT distinct c.name,c.id,c.code,c.picture,c.no FROM c ");
+                            StringBuilder stuSql = new StringBuilder($"SELECT distinct c.name,c.id,c.code,c.picture,c.no,c.classId FROM c ");
                             string insql = string.Join(",", ids.Select(x => $"'{x}'"));
                             stuSql.Append($"where  c.id in ({insql})");
                             await foreach (var student in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: stuSql.ToString(),
@@ -488,6 +488,7 @@ namespace TEAMModelOS.SDK.Models.Service
                     x.name = student?.name;
                     x.picture = student?.picture;
                     x.no = student?.no;
+                    x.classId = student?.classId;
                 });
                 var mbs = tmids;
                 mbs.AddRange(students);

+ 2 - 57
TEAMModelOS/Controllers/School/GroupListController.cs

@@ -166,33 +166,7 @@ namespace TEAMModelOS.Controllers
             }
 
         }
-        private class GroupListDto
-        {
-            public string id { get; set; }
-            public string code { get; set; }
-            public string name { get; set; }
-            //标记该名单唯一code
-            public string no { get; set; }
-            public string periodId { get; set; }
-            //课程id,需要标记则标记
-            //public string courseId { get; set; }
-            public string scope { get; set; }
-            public string school { get; set; }
-            public string creatorId { get; set; }
-            /// <summary>
-            ///教学班teach ,行政班(学生搜寻classId动态返回)class ,教研组research,学科组(学科搜寻动态返回)subject,好友friend,管理manage,群组group等
-            /// </summary>
-            public string type { get; set; } = "teach";
-            public int year { get; set; }
-            /// <summary>
-            /// 醍摩豆id成员数量
-            /// </summary>
-            public int tcount { get; set; }
-            /// <summary>
-            /// 校内账号成员数量
-            /// </summary>
-            public int scount { get; set; }
-        }
+        
         /// <summary>
         /// 获取发布活动的名单
         /// </summary>
@@ -360,36 +334,7 @@ namespace TEAMModelOS.Controllers
             }
             return Ok(new { error = 1, msg = "参数异常" });
         }
-        private class CourseGroupList
-        {
-            public string scope { get; set; }
-            public string subject { get; set; }
-            public string period { get; set; }
-            public string name { get; set; }
-            public string id { get; set; }
-            public List<GroupListDto> groups { get; set; } = new List<GroupListDto>();
-        }
-        private class TeachCourse
-        {
-            public string scope { get; set; }
-
-            public IdName subject { get; set; }
-            public IdName period { get; set; }
-            public string name { get; set; }
-            public string id { get; set; }
-            public TeachSchedule schedule { get; set; }
-        }
-        private class TeachSchedule
-        {
-            public string classId { get; set; }
-            public string stulist { get; set; }
-            public string teacherId { get; set; }
-        }
-        private class IdName
-        {
-            public string id { get; set; }
-            public string name { get; set; }
-        }
+        
         /// <summary>
         /// 根据任意名单id获取成员信息。
         /// </summary>

+ 12 - 3
TEAMModelOS/Controllers/XTest/DataMigrationController.cs

@@ -85,10 +85,11 @@ namespace TEAMModelOS.Controllers
                         }
                         GroupList group = new GroupList
                         {
+                            year=DateTimeOffset.UtcNow.Year,
                             pk = "GroupList",
                             id = item.id,
                             code = $"GroupList-{school.id}",
-                            name = item.id,
+                            name = item.name,
                             ttl = -1,
                             no = item.no,
                             periodId = string.IsNullOrEmpty(item.periodId) ? school.period[0]?.id : item.periodId,
@@ -96,6 +97,8 @@ namespace TEAMModelOS.Controllers
                             creatorId = item.creatorId,
                             type = "teach",
                             members = members,
+                            tcount = members.FindAll(x => x.type == 1).Count,
+                            scount = members.FindAll(x => x.type == 2).Count,
                             school = school.id
                         };
                         await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
@@ -119,16 +122,19 @@ namespace TEAMModelOS.Controllers
                         }
                         GroupList group = new GroupList
                         {
+                            year = DateTimeOffset.UtcNow.Year,
                             pk = "GroupList",
                             id = item.id,
                             code = $"GroupList-{school.id}",
-                            name = item.id,
+                            name = item.name,
                             ttl = -1,
                             no = item.no,
                             scope = "school",
                             creatorId = item.creatorId,
                             type = "research",
                             members = members,
+                            tcount = members.FindAll(x => x.type == 1).Count,
+                            scount = members.FindAll(x => x.type == 2).Count,
                             school = school.id
                         };
                         await client.GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(group, new PartitionKey(group.code));
@@ -158,15 +164,18 @@ namespace TEAMModelOS.Controllers
                     }
                     GroupList group = new GroupList
                     {
+                        year = DateTimeOffset.UtcNow.Year,
                         pk = "GroupList",
                         id = item.id,
                         code = $"GroupList",
-                        name = item.id,
+                        name = item.name,
                         ttl = -1,
                         no = item.no,
                         scope = "school",
                         creatorId = item.creatorId,
                         type = "teach",
+                        tcount = members.FindAll(x => x.type == 1).Count,
+                        scount = members.FindAll(x => x.type == 2).Count,
                         members = members,
 
                     };

+ 2 - 2
TEAMModelOS/appsettings.Development.json

@@ -26,8 +26,8 @@
       //"ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
     },
     "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
-      //"ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
+      //"ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     },
     "Redis": {
       "ConnectionString": "106.12.23.251:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"