Ver Fonte

Merge branch 'develop3.0-tmd' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0-tmd

zhousheng há 4 anos atrás
pai
commit
4b99b1f282
41 ficheiros alterados com 2088 adições e 1272 exclusões
  1. 42 9
      TEAMModelFunction/MonitorCosmosDB.cs
  2. 76 26
      TEAMModelFunction/TriggerExam.cs
  3. 147 169
      TEAMModelFunction/TriggerSurvey.cs
  4. 157 169
      TEAMModelFunction/TriggerVote.cs
  5. 3 3
      TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs
  6. 4 1
      TEAMModelOS.SDK/Models/Cosmos/Common/Survey.cs
  7. 5 4
      TEAMModelOS.SDK/Models/Cosmos/Common/Vote.cs
  8. 1 1
      TEAMModelOS.SDK/Models/Cosmos/School/Course.cs
  9. 5 1
      TEAMModelOS.SDK/Models/Cosmos/School/ExamInfo.cs
  10. 10 3
      TEAMModelOS/ClientApp/src/api/courseMgmt.js
  11. 19 17
      TEAMModelOS/ClientApp/src/common/BaseLayout.vue
  12. 6 1
      TEAMModelOS/ClientApp/src/components/questionnaire/BaseProgress.vue
  13. 11 1
      TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue
  14. 5 0
      TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/QuesNaire.vue
  15. 11 3
      TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue
  16. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/courseManage.js
  17. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/cusMgt.js
  18. 2 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-CN/survey.js
  19. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/courseManage.js
  20. 1 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/cusMgt.js
  21. 2 1
      TEAMModelOS/ClientApp/src/locale/lang/zh-TW/survey.js
  22. 204 5
      TEAMModelOS/ClientApp/src/view/learnactivity/CreatePrivEva.vue
  23. 4 4
      TEAMModelOS/ClientApp/src/view/newcourse/CourseClassroom.less
  24. 1 2
      TEAMModelOS/ClientApp/src/view/newcourse/MgtStuList.vue
  25. 35 3
      TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.less
  26. 573 535
      TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue
  27. 15 4
      TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.less
  28. 143 146
      TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.vue
  29. 4 6
      TEAMModelOS/ClientApp/src/view/newcourse/TeaTable.vue
  30. 0 1
      TEAMModelOS/ClientApp/src/view/newcourse/TimeSetting.vue
  31. 7 0
      TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue
  32. 74 21
      TEAMModelOS/Controllers/Common/ExamController.cs
  33. 85 41
      TEAMModelOS/Controllers/Common/SurveyController.cs
  34. 37 4
      TEAMModelOS/Controllers/Common/VoteController.cs
  35. 127 44
      TEAMModelOS/Controllers/School/ClassRoomController.cs
  36. 140 36
      TEAMModelOS/Controllers/School/CourseController.cs
  37. 3 3
      TEAMModelOS/Controllers/School/StudentController.cs
  38. 3 0
      TEAMModelOS/Controllers/XTest/TestController.cs
  39. 113 0
      TEAMModelOS/Properties/ServiceDependencies/teammodelos-test - Web Deploy/profile.arm.json
  40. 5 2
      TEAMModelOS/Services/Common/ActivityStudentService.cs
  41. 5 1
      TEAMModelOS/Services/Common/ActivityTeacherService.cs

+ 42 - 9
TEAMModelFunction/MonitorCosmosDB.cs

@@ -16,15 +16,13 @@ namespace TEAMModelFunction
 {
     public class MonitorCosmosDB
     {
-        private readonly IHttpClientFactory _clientFactory;
         private readonly AzureCosmosFactory _azureCosmos;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureStorageFactory _azureStorage;
         private readonly DingDing _dingDing;
         private readonly AzureRedisFactory _azureRedis;
-        public MonitorCosmosDB(IHttpClientFactory clientFactory, AzureCosmosFactory azureCosmos, AzureServiceBusFactory azureServiceBus, AzureStorageFactory azureStorage, DingDing dingDing, AzureRedisFactory azureRedis)
+        public MonitorCosmosDB( AzureCosmosFactory azureCosmos, AzureServiceBusFactory azureServiceBus, AzureStorageFactory azureStorage, DingDing dingDing, AzureRedisFactory azureRedis)
         {
-            _clientFactory = clientFactory;
             _azureCosmos = azureCosmos;
             _serviceBus = azureServiceBus;
             _azureStorage = azureStorage;
@@ -32,6 +30,13 @@ namespace TEAMModelFunction
             _azureRedis = azureRedis;
         }
 
+        //[FunctionName("Common")]
+        //public async Task Common([HttpTrigger(
+        //    databaseName: "TEAMModelOS",
+        //    collectionName: "Common",
+        //    ConnectionStringSetting = "Azure:Cosmos:ConnectionString",
+        //    LeaseCollectionName = "leases")]IReadOnlyList<Document> inputs, ILogger log)
+
         [FunctionName("Common")]
         public async Task Common([CosmosDBTrigger(
             databaseName: "TEAMModelOS",
@@ -50,13 +55,29 @@ namespace TEAMModelFunction
                     string pk = input.GetPropertyValue<string>("pk");
                     if (!string.IsNullOrWhiteSpace(pk))
                     {
+                        int ttl = input.GetPropertyValue<int>("ttl");
                         long stime = input.GetPropertyValue<long>("startTime");
                         long etime = input.GetPropertyValue<long>("endTime");
                         string school = input.GetPropertyValue<string>("school");
                         string code = input.GetPropertyValue<string>("code");
-                        await _dingDing.SendBotMsg($"CosmosDBTrigger,{pk}\n" +
-                                        $"Start Time:{DateTimeOffset.FromUnixTimeMilliseconds(stime).AddHours(8)}\n" +
-                                        $"End Time:{DateTimeOffset.FromUnixTimeMilliseconds(etime).AddHours(8)}",
+                        string owner = input.GetPropertyValue<string>("owner");
+                        string progress = input.GetPropertyValue<string>("progress");
+                        string scope = input.GetPropertyValue<string>("scope");
+                        string name = input.GetPropertyValue<string>("name");
+                        int? status = input.GetPropertyValue<int?>("status");
+                        var data = new TriggerData {
+                            stime = stime,
+                            etime = etime,
+                            school = school,
+                            code = code,
+                            owner = owner,
+                            progress = progress,
+                            scope = scope,
+                            ttl = ttl,
+                            id = input.Id,
+                            status = status
+                        };
+                        await _dingDing.SendBotMsg($"CosmosDBTrigger,{pk}触发变更\n{data.ToJsonString()}"  ,
                                         GroupNames.成都开发測試群組);
                         switch (pk)
                         {
@@ -64,10 +85,10 @@ namespace TEAMModelFunction
                                 TriggerExam.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client,input,code,stime,etime,school);
                                 break;
                             case "Vote":
-                                TriggerVote.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school, _azureRedis);
+                                TriggerVote.Trigger( _serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
                                 break;
                             case "Survey":
-                                TriggerSurvey.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school, _azureRedis, _clientFactory);
+                                TriggerSurvey.Trigger( _serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
                                 break;
 
                         }
@@ -75,6 +96,18 @@ namespace TEAMModelFunction
                 }
             }
         }
-        
+    }
+    public class TriggerData {
+        public int? status { get; set; }
+        public string name { get; set; }
+        public long stime { get; set; }
+        public long etime { get; set; }
+        public string school { get; set; }
+        public string code { get; set; }
+        public string owner { get; set; }
+        public string progress { get; set; }
+        public string scope { get; set; }
+        public int ttl { get; set; }
+        public string id { get; set; }
     }
 }

+ 76 - 26
TEAMModelFunction/TriggerExam.cs

@@ -10,6 +10,7 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos;
+using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelFunction
 {
@@ -154,33 +155,73 @@ namespace TEAMModelFunction
                                 result.info.id = cla;
                                 if (info.scope.Equals("private", StringComparison.OrdinalIgnoreCase))
                                 {
-                                    var sresponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.creatorId}"));
+                                    
+                                    List<string> ans = new List<string>();
+                                    List<double> ansPoint = new List<double>();
+                                    List<string> ids = new List<string>();
+                                    foreach (double p in info.papers[m].point)
+                                    {
+                                        //ans.Add(new List<string>());
+                                        ansPoint.Add(-1);
+                                    }
+                                    var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"Class-{info.school}"));
                                     if (sresponse.Status == 200)
                                     {
                                         using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
                                         Class classroom = json.ToObject<Class>();
                                         result.info.name = classroom.name;
                                         result.gradeId = classroom.gradeId;
-                                        List<string> ans = new List<string>();
-                                        List<double> ansPoint = new List<double>();
-                                        foreach (double p in info.papers[m].point)
-                                        {
-                                            //ans.Add(new List<string>());
-                                            ansPoint.Add(-1);
-                                        }
-                                        //处理班级学生名单
-                                        List<Student> students = new List<Student>();
-                                        await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<Student>(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{code}") }))
-                                        {
-                                            students.Add(item);
-                                        }
-                                        foreach (Student stu in students)
+                                        //处理班级人数
+                                        await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{info.school}") }))
                                         {
-                                            result.studentIds.Add(stu.id);
-                                            result.studentAnswers.Add(ans);
-                                            result.studentScores.Add(ansPoint);
-                                            result.sum.Add(0);
-                                        }
+                                            using var json_stu = await JsonDocument.ParseAsync(item.ContentStream);
+                                            if (json_stu.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                                            {
+                                                var accounts = json_stu.RootElement.GetProperty("Documents").EnumerateArray();
+                                                while (accounts.MoveNext())
+                                                {
+                                                    JsonElement account = accounts.Current;
+                                                    ids.Add(account.GetProperty("id").GetString());
+                                                }
+                                            }
+                                        }                                                                               
+                                    }
+                                    var stuResponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(cla, new Azure.Cosmos.PartitionKey($"StuList"));
+                                    if (sresponse.Status == 200) {
+                                        using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
+                                        StuList stuList = json.ToObject<StuList>();
+                                        result.info.name = stuList.name;
+                                        //处理发布对象为自选名单(个人)
+
+                                        foreach (Students students in stuList.students)
+                                                {
+                                                    if (students.code.Contains(code))
+                                                    {
+                                                        if (!ids.Contains(students.id))
+                                                        {
+                                                            ids.Add(students.id);
+                                                        }
+                                                    }
+                                                    else
+                                                    {
+                                                        ids.Add(students.id);
+                                                    }
+                                                }
+                                                if (stuList.tmids.Count > 0)
+                                                {
+                                                    foreach (string tid in stuList.tmids)
+                                                    {
+                                                        ids.Add(tid);
+                                                    }
+                                                }
+
+                                    }
+                                    foreach (string stu in ids)
+                                    {
+                                        result.studentIds.Add(stu);
+                                        result.studentAnswers.Add(ans);
+                                        result.studentScores.Add(ansPoint);
+                                        result.sum.Add(0);
                                     }
                                 }
                                 else {
@@ -198,15 +239,24 @@ namespace TEAMModelFunction
                                             //ans.Add(new List<string>());
                                             ansPoint.Add(-1);
                                         }
-                                        //处理班级学生名单
-                                        List<Student> students = new List<Student>();
-                                        await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<Student>(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{code}") }))
+                                        List<string> ids = new List<string>();
+                                        //处理班级人数
+                                        await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{classroom.id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{info.school}") }))
                                         {
-                                            students.Add(item);
+                                            using var json_stu = await JsonDocument.ParseAsync(item.ContentStream);
+                                            if (json_stu.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                                            {
+                                                var accounts = json_stu.RootElement.GetProperty("Documents").EnumerateArray();
+                                                while (accounts.MoveNext())
+                                                {
+                                                    JsonElement account = accounts.Current;
+                                                    ids.Add(account.GetProperty("id").GetString());
+                                                }
+                                            }
                                         }
-                                        foreach (Student stu in students)
+                                        foreach (string stu in ids)
                                         {
-                                            result.studentIds.Add(stu.id);
+                                            result.studentIds.Add(stu);
                                             result.studentAnswers.Add(ans);
                                             result.studentScores.Add(ansPoint);
                                             result.sum.Add(0);

+ 147 - 169
TEAMModelFunction/TriggerSurvey.cs

@@ -1,6 +1,7 @@
 using Azure.Cosmos;
 using Azure.Messaging.ServiceBus;
 using Azure.Storage.Blobs.Models;
+using Azure.Storage.Sas;
 using Microsoft.Azure.Documents;
 using System;
 using System.Collections.Generic;
@@ -20,165 +21,145 @@ namespace TEAMModelFunction
 {
    public class TriggerSurvey
     {
-        public static async void Trigger(AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
-               CosmosClient client, Document input, string code, long stime, long etime, string school,AzureRedisFactory _azureRedis, System.Net.Http.IHttpClientFactory _clientFactory)
+        public static async void Trigger( AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+               CosmosClient client, Document input, TriggerData tdata,AzureRedisFactory _azureRedis)
         {
-            Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(input.Id, new Azure.Cosmos.PartitionKey($"{code}"));
+            if ((tdata.status != null && tdata.status.Value == 404) || tdata.ttl > 0)
+            {
+                return;
+            }
+            var adid = tdata.id;
+            var adcode = $"Activity-{tdata.owner}";
+            ActivityData data = null;
+            try
+            {
+                if (tdata.scope == "school")
+                {
+                    data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                }
+                else if (tdata.scope == "private")
+                {
+                    data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                }
+            }
+            catch { data = null; }
+            Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(input.Id, new Azure.Cosmos.PartitionKey($"{tdata.code}"));
             List<ChangeRecord> changeRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input.Id }, { "PartitionKey", survey.progress } });
-            ActivityData data = null ;
             if (survey != null) {
-                var adid = survey.id;
-                var adcode = $"Activity-{survey.owner}";
-                try {
-                    if (survey.scope == "school")
-                    {
-                        data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                    }
-                    else if (survey.scope == "private")
-                    {
-                        data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                    }
-                } catch { data = null; }
-                await _dingDing.SendBotMsg($"问卷调查【{survey.name}-{survey.id}---{survey.ttl}】正在操作", GroupNames.成都开发測試群組);
-                if (survey.ttl >= 1)
+                switch (survey.progress)
                 {
-                  
-                    _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Record:{survey.id}");
-                    _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Submit:{survey.id}");
-                    if (data != null)
-                    {
-                        data.ttl = 1;
-                        if (survey.scope == "school")
+                    case "pending":
+                        var messageSurvey = new ServiceBusMessage(new { id = input.Id, progress = "going", code = tdata.code }.ToJsonString());
+                        messageSurvey.ApplicationProperties.Add("name", "Survey");
+                        if (changeRecords.Count > 0)
                         {
-                            data = await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                            await _serviceBus.GetServiceBusClient().cancelMessage("active-task", changeRecords[0].sequenceNumber);
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(tdata.stime));
+                            changeRecords[0].sequenceNumber = start;
+                            await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
                         }
-                        else if (survey.scope == "private")
+                        else
                         {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                    }
-                    await _dingDing.SendBotMsg($"问卷调查【{survey.name}-{survey.id}】被删除", GroupNames.成都开发測試群組);
-                    return;
-                }
-                else {
-                    switch (survey.progress)
-                    {
-                        case "pending":
-                            var messageSurvey = new ServiceBusMessage(new { id = input.Id, progress = "going", code = code }.ToJsonString());
-                            messageSurvey.ApplicationProperties.Add("name", "Survey");
-                            if (changeRecords.Count > 0)
-                            {
-                                await _serviceBus.GetServiceBusClient().cancelMessage("active-task", changeRecords[0].sequenceNumber);
-                                long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                changeRecords[0].sequenceNumber = start;
-                                await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
-                            }
-                            else
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(tdata.stime));
+                            ChangeRecord changeRecord = new ChangeRecord
                             {
-                                long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurvey, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                ChangeRecord changeRecord = new ChangeRecord
-                                {
-                                    RowKey = input.Id,
-                                    PartitionKey = "pending",
-                                    sequenceNumber = start,
-                                    msgId = messageSurvey.MessageId
-                                };
-                                await _azureStorage.Save<ChangeRecord>(changeRecord);
-                            }
-                            break;
-                        case "going":
-
-                            if (survey.scope == "school")
-                            {
-                                data = new ActivityData
-                                {
-                                    id = survey.id,
-                                    code = $"Activity-{survey.owner}",
-                                    type = "survey",
-                                    name = survey.name,
-                                    startTime = survey.startTime,
-                                    endTime = survey.endTime,
-                                    scode = survey.code,
-                                    scope = survey.scope,
-                                    classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
-                                    tmdids = survey.tmdids.IsNotEmpty() ? survey.tmdids : new List<string> { "" },
-                                    progress = "going",
-                                    owner = survey.owner,
-                                    subjects = new List<string> { "" }
-                                };
-                                await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            else if (survey.scope == "private")
-                            {
-                                data = new ActivityData
-                                {
-                                    id = survey.id,
-                                    code = $"Activity-Common",
-                                    type = "survey",
-                                    name = survey.name,
-                                    startTime = survey.startTime,
-                                    endTime = survey.endTime,
-                                    scode = survey.code,
-                                    scope = survey.scope,
-                                    progress = "going",
-                                    classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
-                                    owner = survey.owner,
-                                    tmdids = new List<string> { "" },
-                                    subjects = new List<string> { "" }
-                                };
-                                await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            var messageSurveyEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = code }.ToJsonString());
-                            messageSurveyEnd.ApplicationProperties.Add("name", "Survey");
-                            if (changeRecords.Count > 0)
+                                RowKey = input.Id,
+                                PartitionKey = "pending",
+                                sequenceNumber = start,
+                                msgId = messageSurvey.MessageId
+                            };
+                            await _azureStorage.Save<ChangeRecord>(changeRecord);
+                        }
+                        break;
+                    case "going":
+                        if (survey.scope == "school")
+                        {
+                            data = new ActivityData
                             {
-                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurveyEnd, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                await _serviceBus.GetServiceBusClient().cancelMessage("active-task", changeRecords[0].sequenceNumber);
-                                changeRecords[0].sequenceNumber = end;
-                                await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
-                            }
-                            else
+                                id = survey.id,
+                                code = $"Activity-{survey.owner}",
+                                type = "survey",
+                                name = survey.name,
+                                startTime = survey.startTime,
+                                endTime = survey.endTime,
+                                scode = survey.code,
+                                scope = survey.scope,
+                                classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
+                                tmdids = survey.tmdids.IsNotEmpty() ? survey.tmdids : new List<string> { "" },
+                                progress = "going",
+                                owner = survey.owner,
+                                subjects = new List<string> { "" }
+                            };
+                            await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        else if (survey.scope == "private")
+                        {
+                            data = new ActivityData
                             {
-                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurveyEnd, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                ChangeRecord changeRecord = new ChangeRecord
-                                {
-                                    RowKey = input.Id,
-                                    PartitionKey = "going",
-                                    sequenceNumber = end,
-                                    msgId = messageSurveyEnd.MessageId
-                                };
-                                await _azureStorage.Save<ChangeRecord>(changeRecord);
-                            }
-                            break;
-                        case "finish":
-                            var records = await _azureRedis.GetRedisClient(8).HashGetAllAsync($"Survey:Record:{survey.id}");
-                            List<dynamic> recs = new List<dynamic>();
-                            foreach (var rcd in records)
+                                id = survey.id,
+                                code = $"Activity-Common",
+                                type = "survey",
+                                name = survey.name,
+                                startTime = survey.startTime,
+                                endTime = survey.endTime,
+                                scode = survey.code,
+                                scope = survey.scope,
+                                progress = "going",
+                                classes = survey.classes.IsNotEmpty() ? survey.classes : new List<string> { "" },
+                                owner = survey.owner,
+                                tmdids = new List<string> { "" },
+                                subjects = new List<string> { "" }
+                            };
+                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        var messageSurveyEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
+                        messageSurveyEnd.ApplicationProperties.Add("name", "Survey");
+                        if (changeRecords.Count > 0)
+                        {
+                            long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurveyEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
+                            await _serviceBus.GetServiceBusClient().cancelMessage("active-task", changeRecords[0].sequenceNumber);
+                            changeRecords[0].sequenceNumber = end;
+                            await _azureStorage.SaveOrUpdate<ChangeRecord>(changeRecords[0]);
+                        }
+                        else
+                        {
+                            long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageSurveyEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
+                            ChangeRecord changeRecord = new ChangeRecord
                             {
-                                var value = rcd.Value.ToString().ToObject<JsonElement>();
-                                recs.Add(new { index = rcd.Name.ToString(), ans = value });
-                            }
-                            var cods = new { records = recs };
-                            //问卷整体情况
-                            await _azureStorage.UploadFileByContainer(survey.owner, cods.ToJsonString(), "survey", $"{survey.id}/record.json");
-                            //结算每道题的答题情况
-
-                            var ContainerClient = _azureStorage.GetBlobContainerClient(survey.owner);
-                            var route = ContainerClient.Uri.ToString();
-                            List<BlobItem> items = await ContainerClient.List($"survey/{survey.id}/urecord");
+                                RowKey = input.Id,
+                                PartitionKey = "going",
+                                sequenceNumber = end,
+                                msgId = messageSurveyEnd.MessageId
+                            };
+                            await _azureStorage.Save<ChangeRecord>(changeRecord);
+                        }
+                        break;
+                    case "finish":
+                        var records = await _azureRedis.GetRedisClient(8).HashGetAllAsync($"Survey:Record:{survey.id}");
+                        List<dynamic> recs = new List<dynamic>();
+                        foreach (var rcd in records)
+                        {
+                            var value = rcd.Value.ToString().ToObject<JsonElement>();
+                            recs.Add(new { index = rcd.Name.ToString(), ans = value });
+                        }
+                        var cods = new { records = recs };
+                        //问卷整体情况
+                        await _azureStorage.UploadFileByContainer(survey.owner, cods.ToJsonString(), "survey", $"{survey.id}/record.json");
+                        //结算每道题的答题情况
+                        var ContainerClient =  _azureStorage.GetBlobContainerClient(survey.owner);
+                           
+                        //获取
+                        try {
+                            List<string> items = await ContainerClient.List($"survey/{survey.id}/urecord");
                             List<SurveyRecord> surveyRecords = new List<SurveyRecord>();
-                            //获取
-
-                            foreach (BlobItem item in items)
+                            foreach (string item in items)
                             {
-                                BlobAuth blobAuth = _azureStorage.GetBlobSasUriRead(survey.owner, $"{item.Name}");
-                                var url = $"{route}/{item.Name}?{blobAuth.sas}";
-                                var response = await _clientFactory.CreateClient().GetAsync(new Uri(url));
-                                var json = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
+                                var Download = await _azureStorage.GetBlobContainerClient(survey.owner).GetBlobClient(item).DownloadAsync();
+                                var json = await JsonDocument.ParseAsync(Download.Value.Content);
                                 var Record = json.RootElement.ToObject<SurveyRecord>();
                                 surveyRecords.Add(Record);
                             }
-                            List<Task<string>> tasks = new List<Task<string>>();
+                            await _dingDing.SendBotMsg($"问卷调查问题结算数据{surveyRecords.ToJsonString()}", GroupNames.成都开发測試群組);
                             for (int index = 0; index < survey.ans.Count; index++)
                             {
                                 string url = $"{survey.id}/qrecord/{index}.json";
@@ -217,35 +198,32 @@ namespace TEAMModelFunction
                                         }
                                     }
                                 }
-                                tasks.Add(_azureStorage.UploadFileByContainer(survey.owner, question.ToJsonString(), "survey", url, false));
-                            }
-                            if (string.IsNullOrEmpty(survey.recordUrl))
-                            {
-                                survey.recordUrl = $"/survey/{survey.id}/record.json";
-                                await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<Survey>(survey, survey.id, new Azure.Cosmos.PartitionKey(survey.code));
-                            }
-                            else
-                            {
-                                //异动,且已经有结算记录则不必再继续。
-                                break;
-                            }
-                            await Task.WhenAll(tasks);
-                            //更新结束状态
-                            data.progress = "finish";
-                            if (survey.scope == "school")
-                            {
-                                await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
+                                await _azureStorage.UploadFileByContainer(survey.owner, question.ToJsonString(), "survey", url);
                             }
-                            else if (survey.scope == "private")
-                            {
-                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            break;
-                    }
+                        } catch (Exception ex) {
+                            await _dingDing.SendBotMsg($"问卷调查问题结算异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+                        }
+                        if (string.IsNullOrEmpty(survey.recordUrl))
+                        {
+                            survey.recordUrl = $"/survey/{survey.id}/record.json";
+                            await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<Survey>(survey, survey.id, new Azure.Cosmos.PartitionKey(survey.code));
+                        }
+                        // await Task.WhenAll(tasks);
+                        //更新结束状态
+                        data.progress = "finish";
+                        if (survey.scope == "school")
+                        {
+                            await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        else if (survey.scope == "private")
+                        {
+                            await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Record:{survey.id}");
+                        _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Submit:{survey.id}");
+                        break;
                 }
-               
             }
-            
         }
     }
     /**

+ 157 - 169
TEAMModelFunction/TriggerVote.cs

@@ -19,189 +19,177 @@ namespace TEAMModelFunction
     public static class TriggerVote
     {
 
-        public static async void Trigger(AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
-            CosmosClient client, Document input, string code, long stime, long etime, string school, AzureRedisFactory _azureRedis)
+        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+            CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis)
         {
-            Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(input.Id, new Azure.Cosmos.PartitionKey($"{code}"));
+            if ((tdata.status != null && tdata.status.Value == 404)||tdata.ttl>0)
+            {
+                return;
+            }
+            var adid = tdata.id;
+            var adcode = $"Activity-{tdata.owner}";
+            ActivityData data = null;
+            try
+            {
+                if (tdata.scope == "school")
+                {
+                    data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                }
+                else if (tdata.scope == "private")
+                {
+                    data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                }
+            }
+            catch
+            {
+                data = null;
+            }
+            await _dingDing.SendBotMsg($"投票活动【{tdata.name}-{tdata.id}-ttl={tdata.ttl}】正在操作", GroupNames.成都开发測試群組);
+            Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(input.Id, new Azure.Cosmos.PartitionKey($"{tdata.code}"));
             List<ChangeRecord> voteRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", input.Id }, { "PartitionKey", vote.progress } });
-            ActivityData data=null;
             if (vote != null) {
-                var adid = vote.id;
-                var adcode =   $"Activity-{vote.owner}";
-                try {
-                    if (vote.scope == "school")
-                    {
-                        data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                    }
-                    else if (vote.scope == "private")
-                    {
-                        data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                    }
-                } catch {
-                    data = null;
-                }
-                if (vote.ttl >= 1)
+                switch (vote.progress)
                 {
-                    //TODO  处理TTL删除业务
-                    _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Record:{vote.id}");
-                    _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Count:{vote.id}");
-                    if (data != null) {
-                        data.ttl = 1;
-                        if (vote.scope == "school")
+                    case "pending":
+                        var messageVote = new ServiceBusMessage(new { id = input.Id, progress = "going", code = tdata.code }.ToJsonString());
+                        messageVote.ApplicationProperties.Add("name", "Vote");
+                        if (voteRecords.Count > 0)
                         {
-                            data = await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data,adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(tdata.stime));
+                            await _serviceBus.GetServiceBusClient().cancelMessage("active-task", voteRecords[0].sequenceNumber);
+                            voteRecords[0].sequenceNumber = start;
+                            await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
                         }
-                        else if (vote.scope == "private")
+                        else
                         {
-                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data,adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
-                        }
-                    }
-                    await _dingDing.SendBotMsg($"投票活动【{vote.name}-{vote.id}】被删除", GroupNames.醍摩豆服務運維群組);
-                    return;
-                }
-                else
-                {
-                    switch (vote.progress)
-                    {
-                        case "pending":
-                            var messageVote = new ServiceBusMessage(new { id = input.Id, progress = "going", code = code }.ToJsonString());
-                            messageVote.ApplicationProperties.Add("name", "Vote");
-                            if (voteRecords.Count > 0)
-                            {
-                                long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                await _serviceBus.GetServiceBusClient().cancelMessage("active-task", voteRecords[0].sequenceNumber);
-                                voteRecords[0].sequenceNumber = start;
-                                await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
-                            }
-                            else
+                            long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(tdata.stime));
+                            ChangeRecord changeRecord = new ChangeRecord
                             {
-                                long start = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVote, DateTimeOffset.FromUnixTimeMilliseconds(stime));
-                                ChangeRecord changeRecord = new ChangeRecord
-                                {
-                                    RowKey = input.Id,
-                                    PartitionKey = "pending",
-                                    sequenceNumber = start,
-                                    msgId = messageVote.MessageId
-                                };
-                                await _azureStorage.Save<ChangeRecord>(changeRecord);
-                            }
-                            break;
-                        case "going":
-                            if (vote.scope == "school")
-                            {
-                                data = new ActivityData
-                                {
-                                    id = vote.id,
-                                    code = $"Activity-{vote.owner}",
-                                    type = "vote",
-                                    name = vote.name,
-                                    startTime = vote.startTime,
-                                    endTime = vote.endTime,
-                                    scode = vote.code,
-                                    scope = vote.scope,
-                                    classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
-                                    tmdids = vote.tmdids.IsNotEmpty() ? vote.tmdids : new List<string> { "" },
-                                    progress = "going",
-                                    owner = vote.owner,
-                                    subjects = new List<string> { "" }
-                                };
-                                await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            else if (vote.scope == "private")
-                            {
-                                data = new ActivityData
-                                {
-                                    id = vote.id,
-                                    code = $"Activity-Common",
-                                    type = "vote",
-                                    name = vote.name,
-                                    startTime = vote.startTime,
-                                    endTime = vote.endTime,
-                                    scode = vote.code,
-                                    scope = vote.scope,
-                                    progress = "going",
-                                    classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
-                                    owner = vote.owner,
-                                    tmdids = new List<string> { "" },
-                                    subjects = new List<string> { "" }
-                                };
-                                await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            var messageVoteEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = code }.ToJsonString());
-                            messageVoteEnd.ApplicationProperties.Add("name", "Vote");
-                            if (voteRecords.Count > 0)
-                            {
-                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVoteEnd, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                await _serviceBus.GetServiceBusClient().cancelMessage("active-task", voteRecords[0].sequenceNumber);
-                                voteRecords[0].sequenceNumber = end;
-                                await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
-                            }
-                            else
+                                RowKey = input.Id,
+                                PartitionKey = "pending",
+                                sequenceNumber = start,
+                                msgId = messageVote.MessageId
+                            };
+                            await _azureStorage.Save<ChangeRecord>(changeRecord);
+                        }
+                        break;
+                    case "going":
+                        if (vote.scope == "school")
+                        {
+                            data = new ActivityData
                             {
-                                long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVoteEnd, DateTimeOffset.FromUnixTimeMilliseconds(etime));
-                                ChangeRecord changeRecord = new ChangeRecord
-                                {
-                                    RowKey = input.Id,
-                                    PartitionKey = "going",
-                                    sequenceNumber = end,
-                                    msgId = messageVoteEnd.MessageId
-                                };
-                                await _azureStorage.Save<ChangeRecord>(changeRecord);
-                            }
-                            break;
-                        case "finish":
-                            //获取投票活动的所有投票记录
-                            var records = await _azureRedis.GetRedisClient(8).HashGetAllAsync($"Vote:Record:{vote.id}");
-                            //获取投票活动的选项及投票数
-                            var counts = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Vote:Count:{vote.id}");
-                            List<dynamic> countcds = new List<dynamic>();
-                            if (counts != null && counts.Length > 0)
+                                id = vote.id,
+                                code = $"Activity-{vote.owner}",
+                                type = "vote",
+                                name = vote.name,
+                                startTime = vote.startTime,
+                                endTime = vote.endTime,
+                                scode = vote.code,
+                                scope = vote.scope,
+                                classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
+                                tmdids = vote.tmdids.IsNotEmpty() ? vote.tmdids : new List<string> { "" },
+                                progress = "going",
+                                owner = vote.owner,
+                                subjects = new List<string> { "" }
+                            };
+                            await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        else if (vote.scope == "private")
+                        {
+                            data = new ActivityData
                             {
-                                foreach (var count in counts)
-                                {
-                                    countcds.Add(new { code = count.Element.ToString(), count = (int)count.Score });
-                                }
-                            }
-                            List<Task<string>> tasks = new List<Task<string>>();
-                            List<VoteRecord> recordsBlob = new List<VoteRecord>();
-                            foreach (var rcd in records)
+                                id = vote.id,
+                                code = $"Activity-Common",
+                                type = "vote",
+                                name = vote.name,
+                                startTime = vote.startTime,
+                                endTime = vote.endTime,
+                                scode = vote.code,
+                                scope = vote.scope,
+                                progress = "going",
+                                classes = vote.classes.IsNotEmpty() ? vote.classes : new List<string> { "" },
+                                owner = vote.owner,
+                                tmdids = new List<string> { "" },
+                                subjects = new List<string> { "" }
+                            };
+                            await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<ActivityData>(data, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        var messageVoteEnd = new ServiceBusMessage(new { id = input.Id, progress = "finish", code = tdata.code }.ToJsonString());
+                        messageVoteEnd.ApplicationProperties.Add("name", "Vote");
+                        if (voteRecords.Count > 0)
+                        {
+                            long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVoteEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
+                            await _serviceBus.GetServiceBusClient().cancelMessage("active-task", voteRecords[0].sequenceNumber);
+                            voteRecords[0].sequenceNumber = end;
+                            await _azureStorage.SaveOrUpdate<ChangeRecord>(voteRecords[0]);
+                        }
+                        else
+                        {
+                            long end = await _serviceBus.GetServiceBusClient().SendScheduleMessageAsync("active-task", messageVoteEnd, DateTimeOffset.FromUnixTimeMilliseconds(tdata.etime));
+                            ChangeRecord changeRecord = new ChangeRecord
                             {
-                                var value = rcd.Value.ToString().ToObject<VoteRecord>();
-                                recordsBlob.Add(value);
-                            }
-                            //分组每个人的 
-                            var gp = recordsBlob.GroupBy(x => x.userid).Select(x => new { key = x.Key, list = x.ToList() });
-                            foreach (var g in gp)
+                                RowKey = input.Id,
+                                PartitionKey = "going",
+                                sequenceNumber = end,
+                                msgId = messageVoteEnd.MessageId
+                            };
+                            await _azureStorage.Save<ChangeRecord>(changeRecord);
+                        }
+                        break;
+                    case "finish":
+                        //获取投票活动的所有投票记录
+                        var records = await _azureRedis.GetRedisClient(8).HashGetAllAsync($"Vote:Record:{vote.id}");
+                        //获取投票活动的选项及投票数
+                        var counts = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Vote:Count:{vote.id}");
+                        List<dynamic> countcds = new List<dynamic>();
+                        if (counts != null && counts.Length > 0)
+                        {
+                            foreach (var count in counts)
                             {
-                                tasks.Add(_azureStorage.UploadFileByContainer(vote.owner, g.list.ToJsonString(), "vote", $"{vote.id}/urecord/{g.key}.json"));
+                                countcds.Add(new { code = count.Element.ToString(), count = (int)count.Score });
                             }
-                            //处理活动方的记录, 
-                            string url = $"/vote/{vote.id}/record.json";
-                            tasks.Add(_azureStorage.UploadFileByContainer(vote.owner, new { options = countcds, records = recordsBlob }.ToJsonString(), "vote", $"{vote.id}/record.json"));
-                            //处理投票者的记录
+                        }
+                        List<Task<string>> tasks = new List<Task<string>>();
+                        List<VoteRecord> recordsBlob = new List<VoteRecord>();
+                        foreach (var rcd in records)
+                        {
+                            var value = rcd.Value.ToString().ToObject<VoteRecord>();
+                            recordsBlob.Add(value);
+                        }
+                        //分组每个人的 
+                        var gp = recordsBlob.GroupBy(x => x.userid).Select(x => new { key = x.Key, list = x.ToList() });
+                        foreach (var g in gp)
+                        {
+                            tasks.Add(_azureStorage.UploadFileByContainer(vote.owner, g.list.ToJsonString(), "vote", $"{vote.id}/urecord/{g.key}.json"));
+                        }
+                        //处理活动方的记录, 
+                        string url = $"/vote/{vote.id}/record.json";
+                        tasks.Add(_azureStorage.UploadFileByContainer(vote.owner, new { options = countcds, records = recordsBlob }.ToJsonString(), "vote", $"{vote.id}/record.json"));
+                        //处理投票者的记录
 
-                            if (string.IsNullOrEmpty(vote.recordUrl))
-                            {
-                                vote.recordUrl = url;
-                                await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<Vote>(vote, vote.id, new Azure.Cosmos.PartitionKey(vote.code));
-                            }
-                            else { 
-                                //异动,且已经有结算记录则不必再继续。
-                                break; 
-                            }
-                            await Task.WhenAll(tasks);
-                            data.progress = "finish";
-                            //更新结束状态
-                            if (vote.scope == "school")
-                            {
-                                await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            else if (vote.scope == "private")
-                            {
-                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
-                            }
-                            break;
-                    }
+                        if (string.IsNullOrEmpty(vote.recordUrl))
+                        {
+                            vote.recordUrl = url;
+                            await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync<Vote>(vote, vote.id, new Azure.Cosmos.PartitionKey(vote.code));
+                        }
+                        else { 
+                            //异动,且已经有结算记录则不必再继续。
+                            //break; 
+                        }
+                        await Task.WhenAll(tasks);
+                        data.progress = "finish";
+                        //更新结束状态
+                        if (vote.scope == "school")
+                        {
+                            await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        else if (vote.scope == "private")
+                        {
+                            await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<ActivityData>(data, data.id, new Azure.Cosmos.PartitionKey(data.code));
+                        }
+                        _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Record:{vote.id}");
+                        _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Count:{vote.id}");
+                        break;
                 }
             }
            

+ 3 - 3
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs

@@ -41,12 +41,12 @@ namespace TEAMModelOS.SDK.DI
             }
         }
 
-        public static async Task<List<BlobItem>> List(this BlobContainerClient client, string prefix = null) {
+        public static async Task<List<string>> List(this BlobContainerClient client, string prefix = null) {
             try
             {
-                List<BlobItem> items = new List<BlobItem>();
+                List<string> items = new List<string>();
                 await foreach (BlobItem item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix)) {
-                    items.Add(item);
+                    items.Add(item.Name);
                 }
                 return items;
             }

+ 4 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/Survey.cs

@@ -76,7 +76,10 @@ namespace TEAMModelOS.SDK.Models
         /// 客观题所有选项[["A","B","C","D"],["A","B"],[],["A","B"]]
         /// </summary>
         public List<List<string>> ans { get; set; }
-
+        /// <summary>
+        /// TTL删除改变状态使用
+        /// </summary>
+        public int? status { get; set; } = 0;
     }
 
     /// <summary>

+ 5 - 4
TEAMModelOS.SDK/Models/Cosmos/Common/Vote.cs

@@ -74,10 +74,7 @@ namespace TEAMModelOS.SDK.Models
         ///  scope 为school时 是学校的班级  为private 时是私人班级
         /// </summary>
         public List<string> classes { get; set; }
-        /// <summary>
-        /// (100:待发布 200:已发布 300:已结束)
-        /// </summary>
-        public int status { get; set; }
+        
         /// <summary>
         /// 开始时间
         /// </summary>
@@ -98,6 +95,10 @@ namespace TEAMModelOS.SDK.Models
         /// 投票记录
         /// </summary>
         public string recordUrl { get; set; }
+        /// <summary>
+        /// TTL删除改变状态使用
+        /// </summary>
+        public int? status { get; set; } = 0;
     }
     /// <summary>
     /// 投票选项

+ 1 - 1
TEAMModelOS.SDK/Models/Cosmos/School/Course.cs

@@ -55,7 +55,7 @@ namespace TEAMModelOS.SDK.Models
     public class Schedule
     {
         public string classId { get; set; }
-        public Teachers teacher { get; set; } = new Teachers();
+        public string teacherId { get; set; }
         public string stulist { get; set; }
         public List<timeInfo> time { get; set; } = new List<timeInfo>();
         public string notice { get; set; }

+ 5 - 1
TEAMModelOS.SDK/Models/Cosmos/School/ExamInfo.cs

@@ -57,7 +57,7 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         public string publish { get; set; }
 
-        public int status { get; set; }
+       
         public int year { get; set; }
         public string range { get; set; }
         public string source { get; set; }
@@ -79,6 +79,10 @@ namespace TEAMModelOS.SDK.Models
         /// 所有试卷阅卷状态
         /// </summary>
         //public List<int> marks { get; set; }
+        /// <summary>
+        /// TTL删除改变状态使用
+        /// </summary>
+        public int? status { get; set; } = 0;
     }
     public class Custom {
         public string id { get; set; }

+ 10 - 3
TEAMModelOS/ClientApp/src/api/courseMgmt.js

@@ -55,15 +55,18 @@ export default {
     getSchoolTeacher: function (data) {
         return post('/school/teacher/get-teacher-all', data)
     },
-    //获取教师标准课程列表
+    //获取教师标准课程列表 (废弃原来courseManagement)
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     getSchoolCusMgt: function (data) {
         return post('/school/course/find-course', data)
     },
     //获取教师个人课程列表
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     getPrivateCusMgt: function (data) {
         return post('/school/course/find-teacher-course', data)
     },
-    //新增/修改个人课程
+    //新增/修改个人课程 
+    // (课程数据结构调整后校本和个人课程结构相同,用统一的API,此API废弃)
     upsertPrivateCus: function (data) {
         return post('/school/course/upsert-teacher-course', data)
     },
@@ -81,6 +84,10 @@ export default {
     },
     //根据学生id换取详细信息
     findStuSummary: function (data) {
-        return post('/student/find-summary-student', data)
+        return post('/student/get-summary-student', data)
+    },
+    //根据stulist ids换取详细信息
+    findListSummary: function (data) {
+        return post('/school/course/get-summary-list', data)
     }
 }

+ 19 - 17
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -109,19 +109,20 @@ export default {
                             role: 'admin',
                             permission: 'classroom-upd|classroom-read'
                         },
-                        {
-                            icon: 'iconfont icon-kecheng',
-                            name: this.$t('system.menu.cusSetting'),
-                            router: '/home/ManageCourse',
-                            tag: 'x',
-                            role: 'admin',
-                            permission: 'course-read|course-upd',
-                        },
+                        //课程设置
+                        // {
+                        //     icon: 'iconfont icon-kecheng',
+                        //     name: this.$t('system.menu.cusSetting'),
+                        //     router: '/home/ManageCourse',
+                        //     tag: 'x',
+                        //     role: 'admin',
+                        //     permission: 'course-read|course-upd',
+                        // },
                         {
                             icon: 'iconfont icon-kecheng',
                             name: '课程管理',
                             router: '/home/NewCusMgt',
-                            tag: '+',
+                            tag: '',
                             role: 'admin',
                             permission: '',
                         },
@@ -133,14 +134,15 @@ export default {
                         //   role:'admin',
                         //   permission:'',
                         //},
-                        {
-                            icon: 'iconfont icon-schedule',
-                            name: this.$t('system.menu.cusPlanMgt'),
-                            router: '/home/NewCoursePlan',
-                            tag: 'x',
-                            role: 'admin',
-                            permission: 'coursePlan-read|coursePlan-upd',
-                        },
+                        // 排课管理
+                        // {
+                        //     icon: 'iconfont icon-schedule',
+                        //     name: this.$t('system.menu.cusPlanMgt'),
+                        //     router: '/home/NewCoursePlan',
+                        //     tag: 'x',
+                        //     role: 'admin',
+                        //     permission: 'coursePlan-read|coursePlan-upd',
+                        // },
                         {
                             icon: 'iconfont icon-auth',
                             name: this.$t('system.menu.authMgt'),

+ 6 - 1
TEAMModelOS/ClientApp/src/components/questionnaire/BaseProgress.vue

@@ -30,7 +30,12 @@
 						left: 'center',
 						top: 'center'
 					},
-					tooltip: {},
+					tooltip: {
+						trigger: 'item',
+						formatter: function(params) {
+							return `问卷完成度:${ (((that.total - that.noAnswerdCount) / that.total) * 100).toFixed(2) }%`
+						}
+					},
 					angleAxis: {
 						max: 100,
 						clockwise: false, // 逆时针

+ 11 - 1
TEAMModelOS/ClientApp/src/components/questionnaire/BaseQnForm.vue

@@ -21,7 +21,7 @@
 			</FormItem>
 
 			<FormItem :label="$t('survey.form.time')" prop="rangeTime">
-				<DatePicker type="datetimerange" @on-change="onChangeRange" format="yyyy-MM-dd HH:mm" :class="!qnFormEdit ? 'qn-form-disabled':''"
+				<DatePicker type="datetimerange" @on-change="onChangeRange" @on-open-change="onOpenChange" format="yyyy-MM-dd HH:mm" :class="!qnFormEdit ? 'qn-form-disabled':''"
 				 :editable="isDateEdit" :placeholder="$t('survey.form.endTimePlace')" :value="[qnForm.startTime,qnForm.endTime]">
 
 				</DatePicker>
@@ -130,12 +130,22 @@
 					this.qnForm.rangeTime = null
 					this.ruleValidate.rangeTime[0].message = this.$t('survey.form.ruleStartTime')
 				} else {
+					console.log(this.getTimestampByString(arr[0]))
 					this.qnForm.startTime = this.getTimestampByString(arr[0])
 					this.qnForm.endTime = this.getTimestampByString(arr[1])
 					this.qnForm.rangeTime = arr
 					this.ruleValidate.rangeTime[0].message = this.$t('survey.form.ruleTime')
 				}
 			},
+			
+			/* 如果是第一次点击 则设置默认值为当前时间 默认结束为一天后的当前时间 */
+			onOpenChange(flag){
+				if(flag && !this.qnForm.rangeTime){
+					this.qnForm.startTime = Date.now()
+					this.qnForm.endTime = Date.now() + 86400000
+					this.qnForm.rangeTime = [Date.now(),Date.now() + 86400000]
+				}
+			},
 
 			getTimestampByString(str) {
 				str = str.substring(0, 19);

+ 5 - 0
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/QuesNaire.vue

@@ -41,6 +41,11 @@
 			<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.already') }}</p>
 		</div>
 		
+		<div v-if="!alreadyAnswered && surveyInfo.progress === 'finish'" style="text-align: center;padding-top: 15%;">
+			<Icon type="md-stopwatch" color="#00ad6c" size="80"/>
+			<p style="font-size: 30px;color:#00ad6c;font-weight: 600; margin:20px;">{{ $t('survey.studentWeb.overtime') }}</p>
+		</div>
+		
 
 		<!--問卷完成後,在時間結束前仍可修改答案再提交-->
 		<div v-if="surveyInfo.progress !== 'finish' && !alreadyAnswered">

+ 11 - 3
TEAMModelOS/ClientApp/src/components/vote/BaseVoteForm.vue

@@ -21,7 +21,7 @@
 
 			<FormItem :label="$t('vote.form.time')" prop="rangeTime">
 				<!-- <DatePicker type="datetime" :class="!voteFormEdit ? 'vote-form-disabled':''" :editable="isDateEdit" placeholder="请选择投票结束时间" v-model="voteForm.endTime"  :options="endTimeOptions"></DatePicker> -->
-				<DatePicker type="datetimerange" transfer @on-change="onChangeRange" :options="options3" format="yyyy-MM-dd HH:mm"
+				<DatePicker type="datetimerange" transfer @on-change="onChangeRange" @on-open-change="onOpenChange" :options="options3" format="yyyy-MM-dd HH:mm"
 				 :class="!voteFormEdit ? 'vote-form-disabled':''" :editable="isDateEdit" :value="[voteForm.startTime,voteForm.endTime]"
 				 :placeholder="$t('vote.form.endTimePlace')"></DatePicker>
 			</FormItem>
@@ -220,7 +220,15 @@
 					this.voteForm.rangeTime = arr
 					this.ruleValidate.rangeTime[0].message = this.$t('vote.form.ruleDate')
 				}
-				console.log(this.rangeTime)
+			},
+			
+			/* 如果是第一次点击 则设置默认值为当前时间 默认结束为一天后的当前时间 */
+			onOpenChange(flag){
+				if(flag && !this.voteForm.rangeTime){
+					this.voteForm.startTime = Date.now()
+					this.voteForm.endTime = Date.now() + 86400000
+					this.voteForm.rangeTime = [Date.now(),Date.now() + 86400000]
+				}
 			},
 
 			getTimestampByString(str) {
@@ -250,7 +258,7 @@
 							let fileName = this.$tools.guid()
 							let isReset = this.voteForm.isReset.length > 0
 							params.code = this.getCurCode
-							params.scope = this.getCurScope
+							params.scope = this.$route.name === 'personalVote' && this.classType === 'private' ? 'private' : 'school'
 							params.name = this.voteForm.name
 							params.startTime = this.voteForm.startTime
 							params.endTime = this.voteForm.endTime

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/courseManage.js

@@ -47,7 +47,7 @@ export default {
         placeHolder3: '请选择年级'
     },
     classroom: {
-        classroomList: '班级列表',
+        classroomList: '课程名单',
         studentCount: '学生人数:',
         headmaster: '班主任:',
         classroomManage: '班级管理',

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/cusMgt.js

@@ -55,7 +55,7 @@ export default {
     noScCus:'暂无校本课程',
     privCus:'个人课程',
     noPrivCus:'暂未创建课程',
-    noCusClass:'暂无上课班级',
+    noCusClass:'暂未安排课程名单',
     delStu:'删除学生',
     addStu:'添加学生',
     noGroup:'未分组',

+ 2 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-CN/survey.js

@@ -87,6 +87,7 @@ export default {
 		description:'描述',
 		content:'内容',
 		submit:'提交问卷',
-		already:'该活动已成功提交作答记录'
+		already:'该活动已成功提交作答记录',
+		overtime:'当前活动已结束'
 	}
 }

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/courseManage.js

@@ -47,7 +47,7 @@ export default {
         placeHolder3: '請選擇年級'
     },
     classroom: {
-        classroomList: '教室清單',
+        classroomList: '课程名单',
         studentCount: '學生人數:',
         headmaster: '班主任:',
         classroomManage: '班級管理',

+ 1 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/cusMgt.js

@@ -54,7 +54,7 @@ export default {
     noScCus: '暫無校本課程',
     privCus: '個人課程',
     noPrivCus: '暫未創建課程',
-    noCusClass: '暫無上課班級',
+    noCusClass: '暫未安排課程名單',
     delStu: '删除學生',
     addStu: '添加學生',
     noGroup: '未分組',

+ 2 - 1
TEAMModelOS/ClientApp/src/locale/lang/zh-TW/survey.js

@@ -87,6 +87,7 @@ export default {
 		description: '描述',
 		content: '內容',
 		submit: '提交問卷',
-		already:'該活動已成功提交作答記錄'
+		already:'該活動已成功提交作答記錄',
+		overtime:'當前活動已結束'
 	}
 }

+ 204 - 5
TEAMModelOS/ClientApp/src/view/learnactivity/CreatePrivEva.vue

@@ -36,7 +36,9 @@
                             </FormItem>
                             <!-- 使用级联选择 课程--》班级 -->
                             <FormItem :label="$t('learnActivity.createEv.evTarget')" prop="targets">
-                                <el-cascader size="small" :show-all-levels="false" clearable filterable v-model="evaluationInfo.targets" @visible-change="visibleChange" :options="evaluationInfo.scope == 'teacher' ? schoolTree : privateTree" :props="props" @change="treeChange" style="width:100%;">
+                                <!-- <el-cascader size="small" :show-all-levels="false" clearable filterable v-model="evaluationInfo.targets" @visible-change="visibleChange" :options="evaluationInfo.scope == 'teacher' ? schoolTree : privateTree" :props="props" @change="treeChange" style="width:100%;">
+                                </el-cascader> -->
+                                <el-cascader size="small" :show-all-levels="false" clearable filterable v-model="evaluationInfo.targets" @visible-change="visibleChange" :props="props" @change="treeChange" style="width:100%;">
                                 </el-cascader>
                             </FormItem>
 
@@ -101,14 +103,136 @@ export default {
         ManualPaper
     },
     data() {
+        const _this = this
         return {
             isEdit: false,
             props: {
                 multiple: true,
+                lazy: true,
+                lazyLoad(node, resolve) {
+                    const { level } = node
+                    let scope = _this.evaluationInfo.scope == "teacher" ? 'school' : 'teacher'
+                    if (level == 0) {
+                        if (_this.courseList.length == 0) {
+                            let requestData = {
+                                'code': _this.$store.state.userInfo.TEAMModelId,
+                                'schoolId': _this.$store.state.userInfo.schoolCode,
+                                'scope': 'private'
+                            }
+                            _this.$api.courseMgmt.findCourse(requestData).then(
+                                (res) => {
+                                    if (res.error == null) {
+                                        _this.courseList = res.courses
+                                        let scope = _this.evaluationInfo.scope == "teacher" ? 'school' : 'teacher'
+                                        let curCus = _this.courseList.filter(item => {
+                                            return item.scope == scope
+                                        })
+                                        let nodes = curCus.map(item => {
+                                            return {
+                                                value: item.id,
+                                                label: item.name,
+                                                leaf: level >= 1
+                                            }
+                                        })
+                                        resolve(nodes)
+                                    } else {
+                                        _this.$Message.error('API ERROR!')
+                                    }
+                                },
+                                (err) => {
+                                    _this.$Message.error('API ERROR!')
+                                }
+                            )
+                        } else {
+
+                            let curCus = _this.courseList.filter(item => {
+                                return item.scope == scope
+                            })
+                            let nodes = curCus.map(item => {
+                                return {
+                                    value: item.id,
+                                    label: item.name,
+                                    leaf: true
+                                }
+                            })
+                            resolve(nodes)
+                        }
+                    } else if (level == 1) {
+                        console.log(node)
+                        let course = node.data
+                        let requestData = {
+                            'code': scope == 'school' ? _this.$store.state.userInfo.schoolCode : _this.$store.state.userInfo.TEAMModelId,
+                            'scope': scope,
+                            'id': course.value
+                        }
+                        _this.$api.courseMgmt.findCusInfo(requestData).then(
+                            (res) => {
+                                if (!res.error) {
+                                    if (res.courses && res.courses.length > 0) {
+                                        res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
+                                        res.courses[0].schedule.forEach(item => {
+                                            if (item.classId) {
+                                                let classInfo = _this.schoolClassList.find(classItem => {
+                                                    return classItem.id == item.classId
+                                                })
+                                                if (classInfo) {
+                                                    item.classInfo = {
+                                                        id: item.classId,
+                                                        name: classInfo.name
+                                                    }
+                                                } else {
+                                                    item.classInfo = {
+                                                        id: item.classId,
+                                                        name: '未找到'
+                                                    }
+                                                }
+                                            }
+                                            if (item.stulist) {
+                                                let listInfo = _this.stuList.find(listItem => {
+                                                    return listItem.id == item.stulist
+                                                })
+                                                if (listInfo) {
+                                                    item.listName = listInfo.name
+                                                } else {
+                                                    item.listName = '未找到对应名单'
+                                                }
+                                            }
+
+                                        })
+                                    }
+                                    let schedule = res.courses[0].schedule.filter(item => {
+                                        return item.teacher.id == _this.$store.state.userInfo.TEAMModelId //teacherId尚未处理,暂时用teacher.id
+                                    })
+                                    console.log('***',schedule)
+                                    let nodes = schedule.map(item => {
+                                        return {
+                                            value: item.stulist || item.classId,
+                                            label: item.listName || item.classInfo.name,
+                                            leaf: false
+                                        }
+                                    })
+                                    resolve(nodes)
+                                }
+                            }
+                        )
+                    }
+
+                    // setTimeout(() => {
+                    //     const nodes = Array.from({ length: level + 1 })
+                    //         .map(item => ({
+                    //             value: ++id,
+                    //             label: `选项${id}`,
+                    //             leaf: level >= 2
+                    //         }));
+                    //     // 通过调用resolve将子节点数据返回,通知组件数据加载完成
+                    //     resolve(nodes);
+                    // }, 1000);
+                }
             },
             schoolBase: {
                 period: []
             },
+            courseList: [],
             schoolTree: [],
             privateTree: [],
             schoolClassList: [],
@@ -174,7 +298,81 @@ export default {
             this.evaluationInfo.targets = []
             this.evaluationInfo.targetClassIds = []
         },
-        //获取个人课程列表
+        //新结构 校本和个人课程一个API返回
+        getCourseList() {
+            let requestData = {
+                'code': this.$store.state.userInfo.TEAMModelId,
+                'schoolId': this.$store.state.userInfo.schoolCode,
+                'scope': 'private'
+            }
+            this.$api.courseMgmt.findCourse(requestData).then(
+                (res) => {
+                    if (res.error == null) {
+                        this.courseList = res.courses
+                    } else {
+                        this.$Message.error('API ERROR!')
+                    }
+                },
+                (err) => {
+                    this.$Message.error('API ERROR!')
+                }
+            )
+        },
+        //获取课程完整信息
+        getCusInfo(id) {
+            if (this.courseListShow[this.curCusIndex]) {
+                let requestData = {
+                    'code': this.$store.state.userInfo.schoolCode,
+                    'scope': 'school',
+                    'id': id
+                }
+                this.$api.courseMgmt.findCusInfo(requestData).then(
+                    (res) => {
+                        if (!res.error) {
+                            if (res.courses && res.courses.length > 0) {
+                                res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
+                                res.courses[0].schedule.forEach(item => {
+                                    if (item.classId) {
+                                        let classInfo = this.classList.find(classItem => {
+                                            return classItem.id == item.classId
+                                        })
+                                        if (classInfo) {
+                                            item.classInfo = {
+                                                id: item.classId,
+                                                name: classInfo.name
+                                            }
+                                        } else {
+                                            item.classInfo = {
+                                                id: item.classId,
+                                                name: '未找到'
+                                            }
+                                        }
+                                    }
+                                    if (item.stulist) {
+                                        let listInfo = this.stuList.find(listItem => {
+                                            return listItem.id == item.stulist
+                                        })
+                                        if (listInfo) {
+                                            item.listName = listInfo.name
+                                        } else {
+                                            item.listName = '未找到对应名单'
+                                        }
+                                    }
+
+                                })
+                            }
+                            this.$set(this.courseListShow, this.curCusIndex, res.courses[0])
+                            this.selectTea(0)
+                        }
+                    }
+                ).finally(() => {
+                    setTimeout(() => {
+                        this.tableLoading = false
+                    }, 500)
+                })
+            }
+        },
+        //获取个人课程列表 (废弃)
         getPrivateCus() {
             let requestData = {
                 id: this.$store.state.userInfo.TEAMModelId
@@ -211,8 +409,8 @@ export default {
                 }
             )
         },
-        //获取标准课程列表
-        getCourseList() {
+        //获取标准课程列表 (废弃)
+        getSchoolCourse() {
             let requestData = {
                 'code': this.$store.state.userInfo.schoolCode,
                 'id': this.$store.state.userInfo.TEAMModelId
@@ -617,8 +815,9 @@ export default {
             this.activeTab = 'preview'
         }
 
+        // this.getSchoolCourse()
+        // this.getPrivateCus()
         this.getCourseList()
-        this.getPrivateCus()
 
     },
     mounted() {

+ 4 - 4
TEAMModelOS/ClientApp/src/view/newcourse/CourseClassroom.less

@@ -336,9 +336,9 @@
 /*111*/
 
 .course-classroom-list {
-    width: 350px;
+    width: 100%;
     height: 100%;
-    border-right: 1px solid @borderColor;
+    // border-right: 1px solid @borderColor;
 
     .course-classroom-list-header {
         width: 100%;
@@ -353,7 +353,6 @@
         }
 
         .course-classroom-label {
-            margin-left: 10px;
             color: @second-textColor;
         }
     }
@@ -393,7 +392,8 @@
 }
 
 .course-classroom-info {
-    width: ~"calc(100% - 351px)";
+    // width: ~"calc(100% - 351px)";
+    width: 100%;
     height: 100%;
     padding-left: 10px;
 

+ 1 - 2
TEAMModelOS/ClientApp/src/view/newcourse/MgtStuList.vue

@@ -76,7 +76,7 @@
             </div>
         </Split>
         <!-- 创建名单 -->
-        <Modal v-model="addStuStatus" :title="$t('cusMgt.addStu')" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal" :loading="modalLoading">
+        <Modal v-model="addStuStatus" title="创建自定义名单" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal" :loading="modalLoading">
             <div class="dark-iview-input list-name-box">
                 <span>名称:</span>
                 <Input v-model="listName" placeholder="请输入名单名称..." style="width: 300px" />
@@ -178,7 +178,6 @@ export default {
             }
         },
         confirmAddStu() {
-            console.log(this.selections)
             if (!this.listName) {
                 this.$Message.warning('请输入名单名称')
                 this.modalLoading = false

+ 35 - 3
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.less

@@ -14,14 +14,15 @@
     flex-direction: row;
 
     .course-list {
-        width: 400px;
+        width: 100%;
         height: 100%;
-        border-right: 1px solid @borderColor;
+        // border-right: 1px solid @borderColor;
         padding-left: 10px;
     }
 
     .course-info-wrap {
-        width: ~"calc(100% - 400px)";
+        // width: ~"calc(100% - 400px)";
+        width: 100%;
         height: 100%;
         padding-left: 15px;
         display: flex;
@@ -56,6 +57,7 @@
     cursor: pointer;
     color:white;
     font-size:18px;
+    margin-top: 12px;
 }
 .course-list {
     /*width: 100%;*/
@@ -148,4 +150,34 @@
     .attr-label{
         color: #a5a5a5;
     }
+}
+.tea-class-item{
+    padding: 10px;
+    color: white;
+    border-bottom: 1px solid @borderColor;
+    cursor: pointer;
+    .class-attr-item{
+        margin: 5px 0px;
+    }
+    .attr-label{
+        color: #a5a5a5;
+    }
+    .class-name{
+        font-size: 14px;
+    }
+    .def-class-name{
+        color: #a5a5a5;
+    }
+    .class-label{
+        font-size: 12px;
+        color: #19be6b;
+        border: 1px solid #19be6b;
+        padding: 0px 0px;
+        margin-left: 5px;
+        vertical-align: text-top;
+    }
+}
+.list-name-box{
+    color: #a5a5a5;
+    margin-bottom: -30px;
 }

Diff do ficheiro suprimidas por serem muito extensas
+ 573 - 535
TEAMModelOS/ClientApp/src/view/newcourse/MyCourse.vue


+ 15 - 4
TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.less

@@ -169,12 +169,9 @@
         cursor: pointer;
     }
 }
-
-.tea-class-item{
-    color: white;
-}
 .tea-class-item{
     padding: 10px;
+    color: white;
     border-bottom: 1px solid @borderColor;
     cursor: pointer;
     .class-attr-item{
@@ -247,4 +244,18 @@
     font-size: 18px;
     cursor: pointer;
     vertical-align: middle;
+}
+.add-tea-header{
+    height: 40px;
+    line-height: 40px;
+    color: white;
+    padding-left: 15px;
+    position: sticky;
+    top: 0px;
+    background: #303030;
+    z-index: 9999;
+    .add-list-label{
+        color: #a5a5a5;
+        margin-right: 5px;
+    }
 }

+ 143 - 146
TEAMModelOS/ClientApp/src/view/newcourse/NewCusMgt.vue

@@ -43,7 +43,7 @@
                 </div>
                 <div class="cus-list-content">
                     <vuescroll>
-                        <div v-for="(item,index) in courseListShow" :key="index" @click="curCusIndex = index" :class="['block-bg','cus-item',curCusIndex == index ? 'block-bg-active':'']">
+                        <div v-for="(item,index) in courseListShow" :key="index" @click="selectCus(index)" :class="['block-bg','cus-item',curCusIndex == index ? 'block-bg-active':'']">
                             <p class="cus-name">
                                 <span class="cus-id">
                                     {{item.no}}
@@ -67,7 +67,7 @@
                     <div slot="left" class="teacher-list">
                         <div class="teacher-list-header">
                             <span>教师</span>
-                            <Icon type="md-add" size="16" class="tea-action-icon" @click="isAddStuList = true" />
+                            <Icon type="md-add" size="16" class="tea-action-icon" @click="addTeaStatus = true" />
                             <Icon type="md-trash" size="16" class="tea-action-icon" @click="removeTeacher" />
                         </div>
                         <div class="tea-list-content">
@@ -84,7 +84,7 @@
                         </div>
                     </div>
                     <!-- 上课名单、上课时段设置 -->
-                    <div slot="right" class="class-setting"  v-show="!isAddStuList">
+                    <div slot="right" class="class-setting" v-show="!isAddStuList && !addTeaStatus">
                         <div class="teacher-list-header">
                             <span @click="curTab = 0" :class="curTab == 0 ? 'tab-label line-bottom line-bottom-active':'tab-label line-bottom'">
                                 课程名单
@@ -174,7 +174,7 @@
                                         </Table>
                                     </div>
                                 </Split>
-                                <EmptyData v-show="schdList.length == 0" textContent="暂无课程名单,请先前往添加名单"></EmptyData>
+                                <EmptyData v-show="schdList.length == 0" textContent="暂无课程名单,请添加名单"></EmptyData>
                             </div>
                             <!-- 教师课表 -->
                             <vuescroll v-show="curTab == 1">
@@ -193,7 +193,7 @@
                     <div slot="right" class="class-setting dark-el-cascader dark-iview-select dark-iview-table" v-show="isAddStuList">
                         <div class="add-list-header">
                             <!-- <span class="add-list-label">教师:</span>
-                            <Select ref="sltStuList" clearable label-in-value v-model="schedule.teacher.id" style="width:200px;margin-right:30px" size="small" @on-change="setTeaName">
+                            <Select ref="sltStuList" clearable label-in-value v-model="schedule.teacherId" style="width:200px;margin-right:30px" size="small" @on-change="setTeaName">
                                 <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
                             </Select> -->
                             <span class="add-list-label">教室:</span>
@@ -244,6 +244,32 @@
                             </template>
                         </Table>
                     </div>
+                    <!-- 添加授课教师UI -->
+                    <div slot="right" class="class-setting dark-iview-input dark-iview-table" v-show="addTeaStatus">
+                        <vuescroll>
+                            <div class="add-tea-header">
+                                <Input search placeholder="" style="width:240px;margin-top:4px" size="small" />
+                                <div class="action-btn-wrap">
+                                    <span class="action-btn" style="margin-right:40px" @click="confirmAddTea">
+                                        <Icon type="md-add" size="16" />
+                                        <span>确认添加</span>
+                                    </span>
+                                    <span class="action-btn" @click="cancelAddTea">
+                                        <Icon type="md-close" size="16" />
+                                        <span>取消添加</span>
+                                    </span>
+                                </div>
+                            </div>
+                            <Table :columns="teaCol" :data="teacherList" style="margin-top:10px" @on-selection-change="(selection)=>{sltTeachers = selection}">
+                                <template slot-scope="{ row }" slot="picture">
+                                    <PersonalPhoto :name="row.name" :picture="row.picture" />
+                                </template>
+                                <template slot-scope="{ row }" slot="job">
+                                    <span>{{row.job || '--'}}</span>
+                                </template>
+                            </Table>
+                        </vuescroll>
+                    </div>
                 </Split>
             </div>
         </Split>
@@ -270,23 +296,14 @@
                         </Option>
                     </Select>
                 </FormItem>
-                <!-- <FormItem :label="$t('cusMgt.cusTeachers')" prop="teachers">
-                    <Select label-in-value multiple v-model="teacherId" :placeholder="$t('cusMgt.teacherHolder')" :max-tag-count="3" filterable @on-change="getTeahcers">
-                        <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
-                    </Select>
-                </FormItem> -->
             </Form>
         </Modal>
         <!-- 添加授课教师 -->
-        <Modal v-model="addTeaStatus" title="添加教师" class-name="dark-iview-modal dark-iview-select" @on-ok="confirmAddTea">
+        <!-- <Modal v-model="addTeaStatus" title="添加教师" class-name="dark-iview-modal dark-iview-select" @on-ok="confirmAddTea">
             <Select ref="addTea" label-in-value multiple clearable :placeholder="$t('cusMgt.teacherHolder')" :max-tag-count="3" filterable @on-change="seltChange">
                 <Option v-for="(item,index) in $store.state.teachers.teacherList" :value="item.id" :key="index">{{ item.name }}</Option>
             </Select>
-        </Modal>
-        <!-- 创建名单 -->
-        <Modal v-model="addStuStatus" :title="$t('cusMgt.addStu')" width="1200" @on-ok="confirmAddStu" class-name="dark-iview-modal">
-            <StudentList @getSelectInfo="(selction)=>{selections = selction}"></StudentList>
-        </Modal>
+        </Modal> -->
         <!-- 时段设置 -->
         <Drawer title="时段设置" class-name="dark-iview-drawer" :closable="false" v-model="showTime" :width="450">
             <TimeSetting :periodId="filterPeriod"></TimeSetting>
@@ -332,6 +349,36 @@ export default {
             preStus: [],
             stuList: [],
             isDefault: true,
+            teacherList: [],
+            sltTeachers: [],
+            teaCol: [
+                {
+                    type: 'selection',
+                    width: 60,
+                    align: 'center'
+                },
+                {
+                    title: ' ',
+                    slot: 'picture',
+                    align: 'center ',
+                    width: '120'
+                },
+                {
+                    title: '姓名',
+                    key: 'name',
+                    align: 'center '
+                },
+                {
+                    title: 'id',
+                    key: 'id',
+                    align: 'center '
+                },
+                {
+                    title: '职位',
+                    slot: 'job',
+                    align: 'center '
+                }
+            ],
             classColumn: [
                 {
                     title: ' ',
@@ -392,7 +439,6 @@ export default {
                     align: 'center'
                 },
             ],
-            addTeachers: [],
             curClassIndex: 0,
             hasTimeTable: false,
             selections: [],
@@ -408,7 +454,6 @@ export default {
             schoolBase: {
                 period: []
             },
-            teacherId: [],
             actionType: 0, //0新增 1编辑
             delCusList: [],
             courseBaseInfo: {
@@ -449,23 +494,22 @@ export default {
                     id: '',
                     name: ''
                 },
-                teacher: {
-                    id: '',
-                    name: ''
-                },
+                teacherId:'',
+                teacherName:'',
                 stulist: '',
-                time: [
-                    // {
-                    //     week: "Mon",
-                    //     start: "8:00",
-                    //     end: "8:40"
-                    // }
-                ],
+                time: [],
                 notice: ''
             }
         }
     },
     methods: {
+        selectCus(index) {
+            this.selectClass(0)
+            this.selectTea(0)
+            this.cancelAddTea()
+            this.cancelAddSchd()
+            this.curCusIndex = index
+        },
         selectTab(index) {
             this.curTab = index
             this.setDefClass()
@@ -483,14 +527,17 @@ export default {
         },
         //设置课程时段
         selectCell(data) {
-            console.log('data', data)
             let teacher = this.teaList[this.curTeaIndex] ? this.teaList[this.curTeaIndex].id : ''
             if (!teacher) {
                 this.$Message.warning("暂无教师信息,无法完成课程时段设置")
                 return
             }
+            if (!data.setClass) {
+                this.$Message.warning("暂无教室信息,无法完成课程时段设置")
+                return
+            }
             let schedule = this.courseListShow[this.curCusIndex].schedule.find(item => {
-                return item.classId == data.setClass && item.teacher.id == this.teaList[this.curTeaIndex].id
+                return item.classId == data.setClass && item.teacherId == this.teaList[this.curTeaIndex].id
             })
             if (schedule) {
                 schedule.time.push({
@@ -503,7 +550,7 @@ export default {
         //取消课程时段设置
         cancelCell(data) {
             let schedule = this.courseListShow[this.curCusIndex].schedule.find(item => {
-                return item.classId == data.setClass && item.teacher.id == this.teaList[this.curTeaIndex].id
+                return item.classId == data.setClass && item.teacherId == this.teaList[this.curTeaIndex].id
             })
             if (schedule) {
                 for (let index in schedule.time) {
@@ -529,7 +576,8 @@ export default {
         //设置默认授课老师
         setDefaultTea() {
             this.isAddStuList = true
-            this.schedule.teacher = this.teaList[this.curTeaIndex]
+            this.schedule.teacherId = this.teaList[this.curTeaIndex].id
+            this.schedule.teacherName = this.teaList[this.curTeaIndex].name
         },
         //查询名单列表
         findStuList() {
@@ -546,7 +594,7 @@ export default {
                 }
             )
         },
-        //教室列表
+        //选择教室列表
         selectClass(index) {
             this.curClassIndex = index
             this.setIsDefault()
@@ -610,17 +658,8 @@ export default {
                 }
             })
         },
-        //下拉选择授课教师,并设置教师名称
-        setTeaName(data) {
-            console.log(data)
-            if (data) {
-                this.schedule.teacher.name = data.label
-                console.log(this.schedule)
-            }
-        },
         //设置教室名称
         setClassName(data, option) {
-            console.log(data, option)
             let curClass = this.classList.find(item => {
                 return item.id == data
             })
@@ -639,8 +678,8 @@ export default {
                         this.$api.schoolSetting.getClassroomStudent(params).then(
                             (res) => {
                                 if (!res.error) {
-                                    this.preStus = res.classrooms[0] ? res.classrooms[0].students : []
-                                    curClass.students = res.classrooms[0] ? res.classrooms[0].students : []
+                                    this.preStus = res.stus.length ? res.stus[0] : []
+                                    curClass.students = res.stus.length ? res.stus[0] : []
                                 } else {
                                     this.$Message.error('API error!')
                                 }
@@ -655,25 +694,27 @@ export default {
                 this.isUpd = true
                 if (curClass) this.schdList[this.curClassIndex].classInfo.name = curClass.name
             }
-
-            console.log(this)
         },
         //确认添加名单
         confirmAddSchd() {
-            if (!this.schedule.teacher.id) {
+            if (!this.schedule.teacherId) {
                 this.$Message.warning('请设置授课老师')
                 return
             }
-            if (!(this.schedule.classInfo.id || this.schedule.stulist)) {
+            if (!(this.schedule.classId || this.schedule.stulist)) {
                 this.$Message.warning('请设置教室或者名单')
                 return
             }
+            this.courseListShow[this.curCusIndex].schedule.forEach((item, index) => {
+                if (item.teacherId == this.schedule.teacherId && !item.stulist && !item.classId) {
+                    this.courseListShow[this.curCusIndex].schedule.splice(index, 1)
+                }
+            })
             this.courseListShow[this.curCusIndex].schedule.push(this.schedule)
-            console.log(this.courseListShow[this.curCusIndex])
             this.isAddStuList = false
             this.updCusInfo()
             this.initSchedule()
-            this.selectTea(0)
+            // this.selectTea(0)
         },
         //取消添加Schd
         cancelAddSchd() {
@@ -687,41 +728,40 @@ export default {
                     id: '',
                     name: ''
                 },
-                teacher: {
-                    id: '',
-                    name: ''
-                },
+                teacherId:'',
+                teacherName:'',
                 stulist: '',
                 time: [],
                 notice: ''
             }
         },
-        // // (废弃)
-        // seltChange(data) {
-        //     this.addTeachers = data
-        // },
-        // //确认添加教师 (废弃)
-        // confirmAddTea() {
-        //     let teachers = this.addTeachers.map(item => {
-        //         return {
-        //             id: item.value,
-        //             name: item.label
-        //         }
-        //     })
-        //     let ids = this.courseListShow[this.curCusIndex].teachers.map(item => {
-        //         return item.id
-        //     })
-        //     let isUpd = false
-        //     teachers.forEach(item => {
-        //         if (ids.indexOf(item.id) == -1) {
-        //             this.courseListShow[this.curCusIndex].teachers.push(item)
-        //             isUpd = true
-        //         }
-        //     })
-        //     this.addTeachers = []
-        //     this.$refs['addTea'].clearSingleSelect()
-        //     if (isUpd) this.updCusInfo()
-        // },
+        //取消添加老师
+        cancelAddTea() {
+            this.addTeaStatus = false
+        },
+        //确认添加教师
+        confirmAddTea() {
+            this.addTeaStatus = false
+            if (this.sltTeachers.length > 0) {
+                let ids = this.teaList.map(item => {
+                    return item.id
+                })
+                this.sltTeachers.forEach(item => {
+                    if (ids.indexOf(item.id) == -1) {
+                        this.courseListShow[this.curCusIndex].schedule.push({
+                            classId: '',
+                            teacherName: item.name,
+                            teacherId: item.id,
+                            stulist: '',
+                            time: [],
+                            notice: ''
+                        })
+                    }
+                })
+                this.updCusInfo()
+                this.sltTeachers = []
+            }
+        },
         // 更新课程数据
         updCusInfo() {
             this.courseListShow[this.curCusIndex].code = this.courseListShow[this.curCusIndex].code.replace('Course-', '')
@@ -733,7 +773,6 @@ export default {
                 res => {
                     this.$Message.success('更新成功')
                     this.isUpd = false
-                    // this.$Modal.remove()
                 }
             ).catch(() => {
                 this.$Message.error('更新失败')
@@ -743,8 +782,7 @@ export default {
         removeStuList() {
             this.$Modal.confirm({
                 title: '移除名单',
-                content: `是否确认移除${this.schdList[this.curClassIndex].className || this.schdList[this.curClassIndex].listName}?`,
-                // loading:true,
+                content: `是否确认移除${this.schdList[this.curClassIndex].listName || this.schdList[this.curClassIndex].classInfo.name }?`,
                 onOk: () => {
                     for (let i in this.courseListShow[this.curCusIndex].schedule) {
                         let curSchd = this.schdList[this.curClassIndex]
@@ -755,9 +793,6 @@ export default {
                     }
                     this.updCusInfo()
                     this.selectClass(0)
-                },
-                onCancel: () => {
-                    // this.$Message.info('Clicked cancel')
                 }
             })
         },
@@ -769,12 +804,12 @@ export default {
                 onOk: () => {
                     let curTeacher = this.teaList[this.curTeaIndex]
                     for (let i in this.courseListShow[this.curCusIndex].schedule) {
-                        if (this.courseListShow[this.curCusIndex].schedule[i].teacher.id == curTeacher.id) {
+                        if (this.courseListShow[this.curCusIndex].schedule[i].teacherId == curTeacher.id) {
                             this.courseListShow[this.curCusIndex].schedule.splice(i, 1)
                             i -= 1
                         }
                     }
-                    this.curTeaIndex = -1
+                    this.curTeaIndex = 0
                     this.updCusInfo()
                 },
                 onCancel: () => { }
@@ -791,9 +826,6 @@ export default {
             //     name: 'CoursePlan'
             // })
             this.$Message.warning('课表模式开发中...')
-        },
-        confirmAddStu() {
-
         },
         dropdownStates(flag) {
             if (!flag) this.filterByPeriod()
@@ -804,23 +836,6 @@ export default {
             })
             this.getCusInfo()
         },
-        // getTeahcers(val) {
-        //     this.courseBaseInfo.teachers.length = []
-        //     for (let item of val) {
-        //         this.courseBaseInfo.teachers.push({
-        //             id: item.value,
-        //             name: item.label
-        //         })
-        //     }
-        // },
-        //id换名字
-        //获取名字集合
-        getTeacherName(ids) {
-            let names = ids.map(item => {
-                return item.name
-            })
-            return names.join(', ')
-        },
         //关键字搜索课程
         searchCourse() {
             this.courseListShow = this.courseList.filter((item, index) => {
@@ -866,7 +881,6 @@ export default {
                 this.$api.courseMgmt.findCusInfo(requestData).then(
                     (res) => {
                         if (!res.error) {
-                            // [this.curCusIndex] = res.courses[0]
                             if (res.courses && res.courses.length > 0) {
                                 res.courses[0].schedule = res.courses[0].schedule ? res.courses[0].schedule : []
                                 res.courses[0].schedule.forEach(item => {
@@ -898,7 +912,6 @@ export default {
                                     }
 
                                 })
-                                console.log('res', res)
                             }
                             this.$set(this.courseListShow, this.curCusIndex, res.courses[0])
                             this.selectTea(0)
@@ -930,7 +943,6 @@ export default {
                 teachers: [],
                 option: 'insert'
             }
-            this.teacherId.length = 0
         },
         //显示确认删除对话框
         showConfirmDel(index) {
@@ -964,7 +976,6 @@ export default {
                 })
                 let code = this.$store.state.userInfo.schoolCode
                 this.$api.courseMgmt.deleteCourse({
-                    // ids, code
                     id: this.courseListShow[this.curCusIndex].id,
                     code: this.courseListShow[this.curCusIndex].code.replace('Course-', ''),
                     scope: this.courseListShow[this.curCusIndex].scope || 'school',
@@ -981,7 +992,6 @@ export default {
                                 }
                             }
                             this.keyWord = ''
-                            // this.searchCourse()
                             this.filterByPeriod()
                         } else {
                             this.$Message.error(this.$t('cusMgt.delErr'))
@@ -1008,9 +1018,6 @@ export default {
                 }
             } else {
                 this.courseBaseInfo = this.courseListShow[index]
-                // this.teacherId = this.courseBaseInfo.teachers.map(item => {
-                //     return item.id
-                // })
                 this.addCourseStatus = true
             }
         },
@@ -1036,13 +1043,11 @@ export default {
                                     this.courseList.push(this.courseBaseInfo)
                                     this.$Message.success(this.$t('cusMgt.addOk'))
                                 } else {
-                                    // this.courseListShow[index].teachers = this._.cloneDeep(this.courseBaseInfo.teachers)
                                     this.$Message.success(this.$t('cusMgt.editOk'))
                                 }
                                 this.keyWord = ''
                                 this.searchCourse()
                                 this.filterByPeriod()
-                                this.teacherId = []
                             } else {
                                 this.$Message.error('API ERROR!')
                             }
@@ -1098,7 +1103,6 @@ export default {
                                 stulist.students = res.stus
                                 stulist.full = true
                                 this.students = res.stus
-                                console.log('stuinfo', this.students)
                             }
                         )
                     }
@@ -1123,8 +1127,8 @@ export default {
             this.$api.schoolSetting.getClassroomStudent(params).then(
                 (res) => {
                     if (!res.error) {
-                        this.students = res.classrooms[0] ? res.classrooms[0].students : []
-                        this.schdList[this.curClassIndex].students = res.classrooms[0] ? res.classrooms[0].students : []
+                        this.students = res.stus.length ? res.stus[0] : []
+                        this.schdList[this.curClassIndex].students = res.stus.length ? res.stus[0] : []
                     } else {
                         this.$Message.error('API error!')
                     }
@@ -1132,12 +1136,7 @@ export default {
                 (err) => {
                     this.$Message.error('API error!')
                 }
-            ).finally(() => {
-                setTimeout(() => {
-                    // this.tableLoading = false
-                    console.log(this.courseListShow[this.curCusIndex])
-                }, 500)
-            })
+            )
         }
     },
     created() {
@@ -1156,14 +1155,14 @@ export default {
             }
         )
         this.$store.dispatch('teachers/getTeacherList').then(res => {
+            this.teacherList = this.$store.state.teachers.teacherList.filter(item => {
+                return item.status == 'join'
+            })
         })
         this.getCourseList()
         this.findStuList()
     },
     computed: {
-        // async students() {
-
-        // },
         //级联选择年级班级
         csOptions() {
             let data = []
@@ -1186,7 +1185,6 @@ export default {
                     })
                 }
             }
-            console.log('数据', data)
             return data
         },
         filterPeriodName() {
@@ -1208,9 +1206,11 @@ export default {
         schdList() {
             if (this.courseListShow && this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex] && this.teaList.length) {
                 let schds = this.courseListShow[this.curCusIndex].schedule.filter(item => {
-                    return item.teacher.id == this.teaList[this.curTeaIndex].id
+                    return item.teacherId == this.teaList[this.curTeaIndex].id
+                })
+                return schds.filter(item => {
+                    return (item.classId || item.stulist)
                 })
-                return schds
             } else {
                 return []
             }
@@ -1225,12 +1225,14 @@ export default {
         teaList() {
             if (this.courseListShow && this.courseListShow[this.curCusIndex] && this.courseListShow[this.curCusIndex].schedule) {
                 let all = this.courseListShow[this.curCusIndex].schedule.map(item => {
-                    return item.teacher
+                    // return item.teacher
+                    return {
+                        id: item.teacherId,
+                        name: item.teacherName
+                    }
                 })
                 const res = new Map()
                 let removeRep = all.filter((a) => !res.has(a.id) && res.set(a.id, 1))
-
-                console.log(removeRep)
                 return removeRep
             } else {
                 return []
@@ -1240,15 +1242,7 @@ export default {
     watch: {
         curCusIndex() {
             this.getCusInfo()
-        },
-        // schdList:{
-        //     handler(){
-        //         console.log('watch',this.isDefault)
-        //         this.setIsDefault()
-        //         console.log('watch',this.isDefault)
-        //     },
-        //     deep:true
-        // }
+        }
     }
 }
 </script>
@@ -1259,6 +1253,9 @@ export default {
 .class-setting thead {
     background: #505050;
 }
+.class-setting .ivu-input {
+    border-radius: 16px;
+}
 .add-list-header .el-input--small .el-input__inner {
     height: 26px;
     line-height: 26px;

+ 4 - 6
TEAMModelOS/ClientApp/src/view/newcourse/TeaTable.vue

@@ -113,7 +113,6 @@
             </Table>
         </vuescroll>
         <Modal v-model="modalStatus" title="授课教室" @on-ok="modalOk" @on-cancel="modalCancel" class-name="dark-iview-modal dark-iview-select">
-            <!-- <span class="label">: </span> -->
             <Select v-model="setClass" style="display:inline-block;">
                 <Option v-for="(item,index) in teaClassList" :key="index" :value="item.classId">{{item.classInfo.name}}</Option>
             </Select>
@@ -211,7 +210,6 @@ export default {
     },
     methods: {
         copyCell(row, col) {
-            // this.modalStatus = true
             this.$emit('selectCell', { row, col, 'setClass': this.setClass })
         },
         selectCell(row, col) {
@@ -228,7 +226,6 @@ export default {
             }
         },
         cancelCell(row, col) {
-            console.log('id',row.weeklies[col].classId)
             this.$emit('cancelCell', { row, col, setClass: row.weeklies[col].classId })
         },
         modalCancel() {
@@ -270,6 +267,9 @@ export default {
         )
     },
     watch: {
+        teacher(){
+            this.setClass = ''
+        }
     },
     computed: {
         timetable() {
@@ -305,13 +305,12 @@ export default {
                                     return classItem.id == schedItem.classId
                                 })
                                 if (this.teacher) {
-                                    if (this.teacher != schedItem.teacher.id) {
+                                    if (this.teacher != schedItem.teacherId) {
                                         return false
                                     }
                                 }
                                 schedItem.time.forEach(timeItem => {
                                     if (timeItem.id == item.id) {
-                                        console.log('1212', timeItem)
                                         item.weeklies[timeItem.week].courseName = cusItem.name
                                         item.weeklies[timeItem.week].classId = schedItem.classId
                                         item.weeklies[timeItem.week].classroomName = classInfo ? classInfo.name : '暂无数据'
@@ -322,7 +321,6 @@ export default {
                         }
                     })
                 })
-                console.log('timetable', timetable)
                 return timetable
             } else {
                 return []

+ 0 - 1
TEAMModelOS/ClientApp/src/view/newcourse/TimeSetting.vue

@@ -210,7 +210,6 @@ export default {
                 let curPrd = this.schoolBase.period.find(item => {
                     return item.id == this.periodId
                 })
-                console.log('haha', curPrd)
                 if (curPrd) {
                     this.timetable = curPrd.timetable
                 } else {

+ 7 - 0
TEAMModelOS/ClientApp/src/view/questionnaire/ManageQuestionnaire.vue

@@ -434,6 +434,13 @@
 				})
 			},
 			
+			/* 根据学生ID集合 来换取学生详细数据 */
+			getStudentsList(ids){
+				return new Promise((r,j) => {
+					
+				})
+			},
+			
 			/* 获取未作答学生清单 */
 			getNoFinishList(answerdList,allList){
 				let result = []

+ 74 - 21
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -20,6 +20,7 @@ using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
+using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelOS.Controllers
 {
@@ -66,37 +67,89 @@ namespace TEAMModelOS.Controllers
                 string code = request.code;
                 request.code = "Exam-" + request.code;
                 request.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                int count = 0;
+                int stuCount = 0;
                 for (int i = 0; i < request.targetClassIds.Count; i++)
                 {
-                    /*if (request.scope.Equals("private"))
+                    List<string> ids = new List<string>();
+                    //处理班级人数(公共部分的校本名单)
+                    //List<Student> students = new List<Student>();
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{request.school}") }))
                     {
-                        var sresponse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(request.targetClassIds[i], new PartitionKey($"Class-{request.creatorId}"));
-                        if (sresponse.Status == 200)
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
                         {
-                            using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
-                            Class classroom = json.ToObject<Class>();
-                            
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
+                            {
+                                JsonElement account = accounts.Current;
+                                ids.Add(account.GetProperty("id").GetString());
+                            }
+                        }
+                    }
+                    if (request.scope.Equals("private"))
+                    {                        
+                        //处理发布对象为自选名单(个人)
+                        List<StuList> stuLists = new List<StuList>();
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
+                        {
+                            stuLists.Add(item);
+                        }
+                        if (stuLists.Count > 0) {
+                            foreach (StuList stuList in stuLists) {
+                                foreach (Students students in stuList.students) {
+                                    if (students.code.Contains(code))
+                                    {
+                                        if (!ids.Contains(students.id))
+                                        {
+                                            ids.Add(students.id);
+                                        }
+                                    }
+                                    else {
+                                        ids.Add(students.id);
+                                    }
+                                }
+                                if (stuList.tmids.Count > 0) {
+                                    foreach (string tid in stuList.tmids) {
+                                        ids.Add(tid);
+                                    }
+                                }
+                            }
+                          
                         }
                     }
                     else
                     {
-                        var sresponse = await client.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(request.targetClassIds[i], new PartitionKey($"Class-{request.school}"));
-                        if (sresponse.Status == 200)
+                        //发布对象为自选名单(校本)
+                        List<StuList> stuLists = new List<StuList>();
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
                         {
-                            using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
-                            Class classroom = json.ToObject<Class>();                          
+                            stuLists.Add(item);
+                        }
+                        if (stuLists.Count > 0)
+                        {
+                            foreach (StuList stuList in stuLists)
+                            {
+                                foreach (Students students in stuList.students)
+                                {
+                                    if (students.code.Contains(code))
+                                    {
+                                        if (!ids.Contains(students.id))
+                                        {
+                                            ids.Add(students.id);
+                                        }
+                                    }
+                                    else
+                                    {
+                                        ids.Add(students.id);
+                                    }
+                                }                               
+                            }
+
                         }
-                    }*/
-                    //处理班级人数
-                    List<Student> students = new List<Student>();
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<Student>(queryText: $"select c.id from c where c.classId = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{code}") }))
-                    {
-                        students.Add(item);
                     }
-                    count += students.Count;
+                    stuCount += ids.Count;
                 }
-                request.stuCount = count;
+                request.stuCount = stuCount;
                 if (string.IsNullOrEmpty(request.id))
                 {
                     request.id = Guid.NewGuid().ToString();
@@ -223,7 +276,7 @@ namespace TEAMModelOS.Controllers
             try
             {
                 if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
-                var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope from c ";
+                var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c ";
                 if (requert.TryGetProperty("classIds", out JsonElement classIds)) {
                     List<string> ids = classIds.ToObject<List<string>>();
                     HashSet<string> strs = new HashSet<string>();
@@ -239,7 +292,7 @@ namespace TEAMModelOS.Controllers
                         strs.Add($"array_contains(c.targetClassIds,'{ssr}')");
                     }
                     string ss = string.Join(" or ", strs);
-                    query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope from c where ({ss})";
+                    query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c where ({ss})";
                 };
                 var client = _azureCosmos.GetCosmosClient();
                 List<ExamInfo> examInfo = new List<ExamInfo>();                

+ 85 - 41
TEAMModelOS/Controllers/Common/SurveyController.cs

@@ -25,6 +25,7 @@ using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
 using System.Net.Http;
 using TEAMModelOS.SDK.Models.Cosmos;
 using Azure.Messaging.ServiceBus;
+using Azure.Storage.Sas;
 
 namespace TEAMModelOS.Controllers
 {
@@ -297,8 +298,38 @@ namespace TEAMModelOS.Controllers
                 if (flag)
                 {
                     //使用ttl删除,并处理相关事务逻辑
-                    survey.ttl = 2;
+                    survey.ttl = 1;
+                    survey.status = 404;
                     survey = await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(survey, new PartitionKey($"{survey.code}"));
+                    var adid = survey.id;
+                    var adcode = $"Activity-{survey.owner}";
+                    ActivityData data = null;
+                    try
+                    {
+                        if (survey.scope == "school")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                        }
+                        else if (survey.scope == "private")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                        }
+                    }
+                    catch { data = null; }
+                    _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Record:{survey.id}");
+                    _azureRedis.GetRedisClient(8).KeyDelete($"Survey:Submit:{survey.id}");
+                    if (data != null)
+                    {
+                        if (survey.scope == "school")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "School").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
+                        }
+                        else if (survey.scope == "private")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
+                        }
+                    }
+                    await _dingDing.SendBotMsg($"问卷调查【{survey.name}-{survey.id}】被删除", GroupNames.成都开发測試群組);
                     return Ok(new { flag });
                 }
                 else
@@ -478,7 +509,6 @@ namespace TEAMModelOS.Controllers
                 //活动分区
                 if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(id.GetString(), new PartitionKey($"{code}"));
-                survey.ttl = 1;
                 List<ChangeRecord> changeRecords = await _azureStorage.FindListByDict<ChangeRecord>(new Dictionary<string, object>() { { "RowKey", $"{id}" }, { "PartitionKey", survey.progress } });
                 ActivityData data = null;
                 if (survey != null)
@@ -536,59 +566,73 @@ namespace TEAMModelOS.Controllers
 
                                 var ContainerClient = _azureStorage.GetBlobContainerClient(survey.owner);
                                 var route = ContainerClient.Uri.ToString();
-                                List<BlobItem> items = await ContainerClient.List($"survey/{survey.id}/urecord");
-                                List<SurveyRecord> surveyRecords = new List<SurveyRecord>();
+
                                 //获取
 
-                                foreach (BlobItem item in items)
+                                try
                                 {
-                                    BlobAuth blobAuth = _azureStorage.GetBlobSasUriRead(survey.owner, $"{item.Name}");
-                                    var url = $"{route}/{item.Name}?{blobAuth.sas}";
-                                    var response = await _clientFactory.CreateClient().GetAsync(new Uri(url));
-                                    var json = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
-                                    var Record = json.RootElement.ToObject<SurveyRecord>();
-                                    surveyRecords.Add(Record);
-                                }
-                                List<Task<string>> tasks = new List<Task<string>>();
-                                for (int index = 0; index < survey.ans.Count; index++)
-                                {
-                                    string url = $"{survey.id}/qrecord/{index}.json";
-                                    QuestionRecord question = new QuestionRecord() { index = index };
-                                    foreach (SurveyRecord record in surveyRecords)
+                                    List<string> items = await ContainerClient.List($"survey/{survey.id}/urecord");
+                                    List<SurveyRecord> surveyRecords = new List<SurveyRecord>();
+                                    (string uri, string sas) blobAuth = _azureStorage.GetBlobContainerSAS(survey.owner, BlobContainerSasPermissions.Read);
+                                    string sas = blobAuth.sas;
+                                    var rcode = await _clientFactory.CreateClient().GetAsync(new Uri($"{route}/survey/{survey.id}/record.json?{sas}"));
+                                    var jsonc = await JsonDocument.ParseAsync(await rcode.Content.ReadAsStreamAsync());
+                                    var Recordc = jsonc.RootElement.ToObject<JsonElement>();
+                                    HttpClient httpClient = _clientFactory.CreateClient();
+                                    await _dingDing.SendBotMsg($"问卷调查问题结算数据11111--->>{Recordc.ToJsonString()}", GroupNames.成都开发測試群組);
+                                    foreach (string item in items)
+                                    {
+                                        var url = $"{route}/{item}?{sas}";
+                                        var response = await httpClient.GetAsync(new Uri(url));
+                                        var json = await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
+                                        var Record = json.RootElement.ToObject<SurveyRecord>();
+                                        surveyRecords.Add(Record);
+                                    }
+                                    await _dingDing.SendBotMsg($"问卷调查问题结算数据{surveyRecords.ToJsonString()}", GroupNames.成都开发測試群組);
+                                    for (int index = 0; index < survey.ans.Count; index++)
                                     {
-                                        if (record.ans.Count == survey.ans.Count)
+                                        string url = $"{survey.id}/qrecord/{index}.json";
+                                        QuestionRecord question = new QuestionRecord() { index = index };
+                                        foreach (SurveyRecord record in surveyRecords)
                                         {
-                                            foreach (var an in record.ans[index])
+                                            if (record.ans.Count == survey.ans.Count)
                                             {
-                                                //
-                                                if (question.opt.ContainsKey(an))
+                                                foreach (var an in record.ans[index])
                                                 {
-                                                    if (question.opt[an] != null)
+                                                    //
+                                                    if (question.opt.ContainsKey(an))
                                                     {
-                                                        question.opt[an].Add(record.userid);
+                                                        if (question.opt[an] != null)
+                                                        {
+                                                            question.opt[an].Add(record.userid);
+                                                        }
+                                                        else
+                                                        {
+                                                            question.opt[an] = new HashSet<string>() { record.userid };
+                                                        }
                                                     }
                                                     else
                                                     {
-                                                        question.opt[an] = new HashSet<string>() { record.userid };
-                                                    }
-                                                }
-                                                else
-                                                {
-                                                    if (survey.ans[index].Contains(an))
-                                                    {
-                                                        //如果是客观题code
-                                                        question.opt.Add(an, new HashSet<string> { record.userid });
-                                                    }
-                                                    else
-                                                    {
-                                                        //如果不是客观code
-                                                        question.other[record.userid] = an;
+                                                        if (survey.ans[index].Contains(an))
+                                                        {
+                                                            //如果是客观题code
+                                                            question.opt.Add(an, new HashSet<string> { record.userid });
+                                                        }
+                                                        else
+                                                        {
+                                                            //如果不是客观code
+                                                            question.other[record.userid] = an;
+                                                        }
                                                     }
                                                 }
                                             }
                                         }
+                                        await _azureStorage.UploadFileByContainer(survey.owner, question.ToJsonString(), "survey", url);
                                     }
-                                    tasks.Add(_azureStorage.UploadFileByContainer(survey.owner, question.ToJsonString(), "survey", url, false));
+                                }
+                                catch (Exception ex)
+                                {
+                                    await _dingDing.SendBotMsg($"问卷调查问题结算异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
                                 }
                                 if (string.IsNullOrEmpty(survey.recordUrl))
                                 {
@@ -598,9 +642,9 @@ namespace TEAMModelOS.Controllers
                                 else
                                 {
                                     //异动,且已经有结算记录则不必再继续。
-                                    break;
+                                    //break;
                                 }
-                                await Task.WhenAll(tasks);
+                                // await Task.WhenAll(tasks);
                                 //更新结束状态
                                 data.progress = "finish";
                                 if (survey.scope == "school")

+ 37 - 4
TEAMModelOS/Controllers/Common/VoteController.cs

@@ -296,17 +296,50 @@ namespace TEAMModelOS.Controllers.Learn
                     }
                 }
                 if (flag)
-                { 
+                {
                     //使用ttl删除,并处理相关事务逻辑
-                    vote.ttl = 10;
+                    vote.ttl = 1;
+                    vote.status = 404;
                     vote = await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(vote,  new PartitionKey($"{vote.code}"));
+                    var adid = vote.id;
+                    var adcode = $"Activity-{vote.owner}";
+                    ActivityData data = null;
+                    try
+                    {
+                        if (vote.scope == "school")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                        }
+                        else if (vote.scope == "private")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{adcode}"));
+                        }
+                    }
+                    catch
+                    {
+                        data = null;
+                    }
+                    await _dingDing.SendBotMsg($"投票活动【{vote.name}-{vote.id}-ttl={vote.ttl}】正在操作", GroupNames.成都开发測試群組);
+                    _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Record:{vote.id}");
+                    _azureRedis.GetRedisClient(8).KeyDelete($"Vote:Count:{vote.id}");
+                    if (data != null)
+                    {
+                        data.ttl = 1;
+                        if (vote.scope == "school")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "School").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
+                        }
+                        else if (vote.scope == "private")
+                        {
+                            data = await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<ActivityData>(adid, new Azure.Cosmos.PartitionKey($"{data.code}"));
+                        }
+                    }
+                    await _dingDing.SendBotMsg($"投票活动【{vote.name}-{vote.id}】被删除", GroupNames.成都开发測試群組);
                     return Ok(new { flag });
                 }
                 else {
                     return Ok(new { flag });
                 }
-                //var response = await client.GetContainer("TEAMModelOS", "Common").DeleteItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
-                //   return Ok(new { code = response.Status });
             }
             catch (Exception e)
             {

+ 127 - 44
TEAMModelOS/Controllers/School/ClassRoomController.cs

@@ -14,6 +14,7 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
+using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelOS.Controllers
 {
@@ -386,71 +387,153 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> FindStudent(JsonElement requert)
         {
             //ResponseBuilder builder = ResponseBuilder.custom();
-            if (!requert.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
+            //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
             if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
             if (!requert.TryGetProperty("ids", out JsonElement ids)) return BadRequest();
+            if (!requert.TryGetProperty("school_code", out JsonElement schoolId)) return BadRequest();
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
-                List<object> classrooms = new List<object>();
-                /* StringBuilder sql = new StringBuilder();
-                 Dictionary<string, object> dict = new Dictionary<string, object>();
-                 var emobj = requert.EnumerateObject();
-                 while (emobj.MoveNext())
-                 {
-                     dict[emobj.Current.Name] = emobj.Current.Value;
-                 }
-                 //处理code
-                 if (dict.TryGetValue("school_code", out object _))
-                 {
-                     dict.Remove("school_code");
-                 }
-                 if (scope.ToString().Equals("teacher", StringComparison.OrdinalIgnoreCase))
-                 {
-                     dict.Remove("scope");
-                 }*/
-                //sql.Append("select c.name,c.id,c.students,c.code from c ");
-
-                string info = "";
+                List<object> stus = new List<object>();
+                List<string> stuIds = new List<string>();
+                
                 for (int i = 0; i < ids.GetArrayLength(); i++)
                 {
-                    //ids.Add(id[i].ToJsonString());
-                    info += ids[i].ToJsonString() + ",";
-                }
-                //AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
-                if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
-                {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(
-                    queryText: $"select c.name,c.id,c.students,c.code from c where c.id in ({info[0..^1]})", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school_code}") }))
+                    List<object> scList = new List<object>();
+                    List<object> suList = new List<object>();
+                    List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)> listStudent = new List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)>();
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(
+                        queryText: $"select c.id,c.name,c.classId,c.code,c.groupId,c.groupName,c.no,c.picture from c where c.classId = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
                     {
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
                         if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
                         {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                            var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
+                            while (accounts.MoveNext())
                             {
-                                classrooms.Add(obj.ToObject<object>());
+                                JsonElement account = accounts.Current;
+                                stuIds.Add(account.GetProperty("id").GetString());
+                                listStudent.Add((account.GetProperty("id").GetString(),
+                                    account.GetProperty("name").GetString(), 
+                                    account.GetProperty("picture").GetString(),
+                                    account.GetProperty("code").GetString(), 
+                                    account.GetProperty("classId").GetString(), 
+                                    account.GetProperty("groupId").GetString(),
+                                    account.GetProperty("groupName").GetString(), 
+                                    account.GetProperty("no").GetString()));
                             }
+                            var scinfos = listStudent.Select(o =>
+                                        new
+                                        {
+                                            o.id,
+                                            o.name,
+                                            o.pic,
+                                            o.code,
+                                            o.classId,
+                                            o.groupId,
+                                            o.groupName,
+                                            o.no
+                                        });
+                            scList.AddRange(scinfos);
+                            stus.Add(scList);
                         }
                     }
-                }
-                else
-                {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(
-                    queryText: $"select c.name,c.id,c.students,c.code from c where c.id in ({info[0..^1]})", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{school_code}") }))
+                    List<(string id, string code, string stuId)> listStuList = new List<(string id, string code, string stuId)>();
+                    if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                     {
-                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        List<StuList> stuLists = new List<StuList>();
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{schoolId}") }))
+                        {
+                            stuLists.Add(item);
+                        }
+                        if (stuLists.Count > 0)
+                        {
+                            foreach (StuList stuList in stuLists)
+                            {
+                                foreach (Students stu in stuList.students)
+                                {
+                                    if (stu.code.Contains(schoolId.GetString()))
+                                    {
+                                        if (!stuIds.Contains(stu.id))
+                                        {
+                                            listStuList.Add((stu.id,
+                                                    stu.code,
+                                                    stuList.id));
+                                        }
+                                    }
+                                    else
+                                    {
+                                        listStuList.Add((stu.id,
+                                                    stu.code,
+                                                    stuList.id));
+                                    }
+                                }
+                                
+                            }
+                            var infos = listStuList.Select(o =>
+                                        new
+                                        {
+                                            o.id,
+                                            o.code,
+                                            o.stuId
+                                        });
+                            suList.AddRange(infos);
+                            stus.Add(suList);
+                        }
+                    }
+                    else {
+                        //处理发布对象为自选名单(个人)
+                        List<StuList> stuLists1 = new List<StuList>();
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
                         {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                            stuLists1.Add(item);
+                        }
+                        if (stuLists1.Count > 0)
+                        {
+                            foreach (StuList stuList in stuLists1)
                             {
-                                classrooms.Add(obj.ToObject<object>());
+                                foreach (Students students in stuList.students)
+                                {
+                                    if (students.code.Contains(schoolId.GetString()))
+                                    {
+                                        if (!stuIds.Contains(students.id))
+                                        {
+                                            listStuList.Add((students.id,
+                                                    students.code,
+                                                    stuList.id));
+                                        }
+                                    }
+                                    else
+                                    {
+                                        listStuList.Add((students.id,
+                                                    students.code,
+                                                    stuList.id));
+                                    }
+                                }
+                                if (stuList.tmids.Count > 0)
+                                {
+                                    foreach (string tid in stuList.tmids)
+                                    {
+                                        listStuList.Add((tid,
+                                                    default,
+                                                    stuList.id));
+                                    }
+                                }                               
                             }
+                            var infos = listStuList.Select(o =>
+                                       new
+                                       {
+                                           o.id,
+                                           o.code,
+                                           o.stuId
+                                       });
+                            suList.AddRange(infos);
+                            stus.Add(suList);
                         }
                     }
-                }
-                return Ok(new { classrooms });
-                /*List<Classroom> sc = await _azureCosmos.FindByDict<Classroom>(request);
-                return builder.Data(sc).build();*/
+
+                }               
+                return Ok(new { stus });
             }
             catch (Exception ex)
             {

+ 140 - 36
TEAMModelOS/Controllers/School/CourseController.cs

@@ -224,7 +224,7 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 List<object> stuList = new List<object>();
                 //List<int> stuCount = new List<int>();
-                var query = $"select c.id,c.name,c.students from c";
+                var query = $"select c.id,c.name,c.students,c.tmids from c";
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 {
                     await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
@@ -244,7 +244,7 @@ namespace TEAMModelOS.Controllers
                 }
                 else
                 {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
                     {
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
                         if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
@@ -269,25 +269,86 @@ namespace TEAMModelOS.Controllers
             }
 
         }
-        /// <summary>
-        /// 查询课程
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
+
+        //查询名单
         [ProducesDefaultResponseType]
         //[AuthToken(Roles = "Teacher")]
+        [HttpPost("get-summary-list")]
+        public async Task<IActionResult> getSummary(JsonElement requert)
+        {
+            try
+            {
+                if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
+                if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
+                if (!requert.TryGetProperty("ids", out JsonElement classId)) return BadRequest();
+                var client = _azureCosmos.GetCosmosClient();
+                List<object> stuList = new List<object>();
+                //List<int> stuCount = new List<int>();
+                List<string> ids = new List<string>();
+                ids = classId.ToObject<List<string>>();
+                var query = $"select c.id,c.name,c.students,c.tmids from c where c.id in ({string.Join(",", ids.Select(o => $"'{o}'"))})";
+                if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
+                {
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                            {
+                                List<Students> stu = obj.GetProperty("students").ToObject<List<Students>>();
+                                stuList.Add(obj.ToObject<object>());
+                                //stuList.Add(stu.Count);
+                                //stuCount.Add(stu.Count);
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
+                    {
+                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                        {
+                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                            {
+                                List<Students> stu = obj.GetProperty("students").ToObject<List<Students>>();
+                                stuList.Add(obj.ToObject<object>());
+                                //stuList.Add(stu.Count);
+                                //stuCount.Add(stu.Count);
+                            }
+                        }
+                    }
+                }
+
+                return Ok(new { stuList });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"OS,{_option.Location},course/get-summary-list()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
+        }
+            /// <summary>
+            /// 查询课程
+            /// </summary>
+            /// <param name="request"></param>
+            /// <returns></returns>
+            [ProducesDefaultResponseType]
+        //[AuthToken(Roles = "Teacher")]
         [HttpPost("find")]
         public async Task<IActionResult> Find(JsonElement requert)
         {
-            if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
+            if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
             if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
             
             try
             {
                 var client = _azureCosmos.GetCosmosClient();
                 List<object> courses = new List<object>();
-                var query = $"select c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c";
-                string continuationToken = string.Empty;
+                
+                /*string continuationToken = string.Empty;
                 string token = default;
                 //是否需要进行分页查询,默认不分页
                 //bool iscontinuation = false;
@@ -304,12 +365,14 @@ namespace TEAMModelOS.Controllers
                     {
                         topcout = data;
                     }
-                }                              
+                }*/
+                var query = $"select c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c";
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, continuationToken: token, requestOptions: new QueryRequestOptions() {MaxItemCount = topcout, PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
+                    
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() {PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
                     {
-                        continuationToken = item.GetContinuationToken();
+                        //continuationToken = item.GetContinuationToken();
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
                         if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
                         {
@@ -318,14 +381,15 @@ namespace TEAMModelOS.Controllers
                                 courses.Add(obj.ToObject<object>());
                             }
                         }
-                        break;
+                        //break;
                     }
                 }
                 else
                 {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, continuationToken: token, requestOptions: new QueryRequestOptions() {MaxItemCount = topcout, PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
+                   
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() {PartitionKey = new PartitionKey($"Course-{code.GetString()}") }))
                     {
-                        continuationToken = item.GetContinuationToken();
+                        //continuationToken = item.GetContinuationToken();
                         using var json = await JsonDocument.ParseAsync(item.ContentStream);
                         if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
                         {
@@ -334,11 +398,28 @@ namespace TEAMModelOS.Controllers
                                 courses.Add(obj.ToObject<object>());
                             }
                         }
-                        break;
+                        //break;
                     }
+                    if (requert.TryGetProperty("schoolId", out JsonElement schoolId)) {
+                        var querySchool = $"select distinct c.code,c.id,c.no,c.name,c.period,c.subject,c.scope from c join A0 in c.schedule where A0.teacherId = '{code}'";
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: querySchool, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{schoolId.GetString()}") }))
+                        {
+                            //continuationToken = item.GetContinuationToken();
+                            using var json = await JsonDocument.ParseAsync(item.ContentStream);
+                            if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
+                            {
+                                foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                                {
+                                    courses.Add(obj.ToObject<object>());
+                                }
+                            }
+                            //break;
+                        }
+                    };
+                   
                 }
-
-                return Ok(new { courses, courses.Count, token = continuationToken });
+                return Ok(new { courses, courses.Count});
+                //return Ok(new { courses, courses.Count, token = continuationToken });
             }
             catch (Exception ex)
             {
@@ -373,41 +454,64 @@ namespace TEAMModelOS.Controllers
             {
                 var client = _azureCosmos.GetCosmosClient();
                 List<object> courses = new List<object>();
+                List<Course> courseList = new List<Course>();
                 var query = $"select value(c) from c where c.id = '{id}'";
+                //List<(string id, string code, string name)> listCourse = new List<(string id, string code, string name)>();
                 if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
                 {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Course>(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
                     {
-                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                            {
-                                courses.Add(obj.ToObject<object>());
-                            }
-                        }
+                        courseList.Add(item);
                     }
+                    
                 }
                 else
                 {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
+                    await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<Course>(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Course-{school_code.GetString()}") }))
                     {
-                        using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        {
-                            foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
+                        courseList.Add(item);
+                    }
+                }
+                foreach (Course course in courseList)
+                {
+                    dynamic courseExtobj = new ExpandoObject();
+                    courseExtobj.id = course.id;
+                    courseExtobj.name = course.name;
+                    courseExtobj.id = course.id;
+                    courseExtobj.subject = course.subject;
+                    courseExtobj.period = course.period;
+                    courseExtobj.scope = course.scope;
+                    courseExtobj.no = course.no;
+                    courseExtobj.code = course.code;
+                    List<object> scheList = new List<object>();
+                    foreach (Schedule schedule in course.schedule)
+                    {
+                        dynamic scheduleExtobj = new ExpandoObject();
+                        scheduleExtobj.classId = schedule.classId;
+                        scheduleExtobj.teacherId = schedule.teacherId;
+                        if (!string.IsNullOrEmpty(schedule.teacherId)) {
+                            var response = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(schedule.teacherId, new PartitionKey("Base"));
+                            if (response.Status == 200)
                             {
-                                courses.Add(obj.ToObject<object>());
+                                using var json = await JsonDocument.ParseAsync(response.ContentStream);
+                                Teacher teacher = json.ToObject<Teacher>();
+                                scheduleExtobj.teacherName = teacher.name;
                             }
-                        }
+                        }                       
+                        scheduleExtobj.stulist = schedule.stulist;
+                        scheduleExtobj.time = schedule.time;
+                        scheduleExtobj.notice = schedule.notice;
+                        scheList.Add(scheduleExtobj);
                     }
+                    courseExtobj.schedule = scheList;
+                    courses.Add(courseExtobj);
                 }
 
                 return Ok(new { courses, courses.Count });
             }
             catch (Exception ex)
             {
-                await _dingDing.SendBotMsg($"CoreAPI2,{_option.Location},course/find()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"CoreAPI2,{_option.Location},course/find-summary()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
                 return BadRequest();
             }
 

+ 3 - 3
TEAMModelOS/Controllers/School/StudentController.cs

@@ -2054,8 +2054,8 @@ namespace TEAMModelOS.Controllers
         //查询学生名单详情
         [ProducesDefaultResponseType]
         //[AuthToken(Roles = "Teacher")]
-        [HttpPost("find-summary-student")]
-        public async Task<IActionResult> FindList(JsonElement requert)
+        [HttpPost("get-summary-student")]
+        public async Task<IActionResult> getSummary(JsonElement requert)
         {
             try
             {
@@ -2082,7 +2082,7 @@ namespace TEAMModelOS.Controllers
             }
             catch (Exception ex)
             {
-                await _dingDing.SendBotMsg($"OS,{_option.Location},student/find-summary-student()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"OS,{_option.Location},student/get-summary-student()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
                 return BadRequest();
             }
 

+ 3 - 0
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -29,6 +29,9 @@ namespace TEAMModelOS.Controllers.XTest
         [HttpGet("multiple-blob")]
         public async Task<IActionResult> MultipleBlob() {
             await  _azureStorage.GetBlobContainerClient("hbcn").List("other");
+            var dn=await _azureStorage.GetBlobContainerClient("hbcn").GetBlobClient("survey/2e44ee33-ba65-34b6-7e0f-b7e627c70a54/record.json").DownloadAsync();
+            var jsonc = await JsonDocument.ParseAsync(  dn.Value.Content);
+            var Recordc = jsonc.RootElement.ToObject<JsonElement>();
             return Ok();
         }
 

+ 113 - 0
TEAMModelOS/Properties/ServiceDependencies/teammodelos-test - Web Deploy/profile.arm.json

@@ -0,0 +1,113 @@
+{
+  "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
+  "contentVersion": "1.0.0.0",
+  "metadata": {
+    "_dependencyType": "appService.windows"
+  },
+  "parameters": {
+    "resourceGroupName": {
+      "type": "string",
+      "defaultValue": "TEAMModelChengdu",
+      "metadata": {
+        "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
+      }
+    },
+    "resourceGroupLocation": {
+      "type": "string",
+      "defaultValue": "",
+      "metadata": {
+        "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
+      }
+    },
+    "resourceName": {
+      "type": "string",
+      "defaultValue": "test",
+      "metadata": {
+        "description": "Name of the main resource to be created by this template."
+      }
+    },
+    "resourceLocation": {
+      "type": "string",
+      "defaultValue": "[parameters('resourceGroupLocation')]",
+      "metadata": {
+        "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
+      }
+    }
+  },
+  "variables": {
+    "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+    "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
+  },
+  "resources": [
+    {
+      "type": "Microsoft.Resources/resourceGroups",
+      "name": "[parameters('resourceGroupName')]",
+      "location": "[parameters('resourceGroupLocation')]",
+      "apiVersion": "2019-10-01"
+    },
+    {
+      "type": "Microsoft.Resources/deployments",
+      "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+      "resourceGroup": "[parameters('resourceGroupName')]",
+      "apiVersion": "2019-10-01",
+      "dependsOn": [
+        "[parameters('resourceGroupName')]"
+      ],
+      "properties": {
+        "mode": "Incremental",
+        "template": {
+          "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+          "contentVersion": "1.0.0.0",
+          "resources": [
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[parameters('resourceName')]",
+              "type": "Microsoft.Web/sites",
+              "apiVersion": "2015-08-01",
+              "tags": {
+                "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
+              },
+              "dependsOn": [
+                "[variables('appServicePlan_ResourceId')]"
+              ],
+              "kind": "app",
+              "properties": {
+                "name": "[parameters('resourceName')]",
+                "kind": "app",
+                "httpsOnly": true,
+                "reserved": false,
+                "serverFarmId": "[variables('appServicePlan_ResourceId')]",
+                "siteConfig": {
+                  "metadata": [
+                    {
+                      "name": "CURRENT_STACK",
+                      "value": "dotnetcore"
+                    }
+                  ]
+                }
+              },
+              "identity": {
+                "type": "SystemAssigned"
+              }
+            },
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[variables('appServicePlan_name')]",
+              "type": "Microsoft.Web/serverFarms",
+              "apiVersion": "2015-08-01",
+              "sku": {
+                "name": "S1",
+                "tier": "Standard",
+                "family": "S",
+                "size": "S1"
+              },
+              "properties": {
+                "name": "[variables('appServicePlan_name')]"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ]
+}

+ 5 - 2
TEAMModelOS/Services/Common/ActivityStudentService.cs

@@ -285,6 +285,9 @@ namespace TEAMModelOS.Services.Common
             } 
             //是否需要进行分页查询,默认不分页
             bool iscontinuation = false;
+            if (topcout != null && topcout.Value > 0) {
+                iscontinuation = true;
+            }
             //如果指定了返回大小
             if (requert.TryGetProperty("continuationTokenSchool", out JsonElement continuationSchool))
             {
@@ -292,7 +295,7 @@ namespace TEAMModelOS.Services.Common
                 if (!continuationSchool.ValueKind.Equals(JsonValueKind.Null) && continuationSchool.ValueKind.Equals(JsonValueKind.String))
                 {
                     continuationTokenSchool = continuationSchool.GetString();
-                    iscontinuation = true;
+                    
                 }
             }
             //如果指定了返回大小
@@ -302,7 +305,7 @@ namespace TEAMModelOS.Services.Common
                 if (!continuationTeacher.ValueKind.Equals(JsonValueKind.Null) && continuationTeacher.ValueKind.Equals(JsonValueKind.String))
                 {
                     continuationTokenTeacher = continuationTeacher.GetString();
-                    iscontinuation = true;
+                    
                 }
             }
             //个人tmdid

+ 5 - 1
TEAMModelOS/Services/Common/ActivityTeacherService.cs

@@ -86,6 +86,10 @@ namespace TEAMModelOS.Services.Common
             }
             //是否需要进行分页查询,默认不分页
             bool iscontinuation = false;
+            if (topcout != null && topcout.Value > 0)
+            {
+                iscontinuation = true;
+            }
             //如果指定了返回大小
             if (!requert.TryGetProperty("continuationToken", out JsonElement continuation))
             {
@@ -93,7 +97,7 @@ namespace TEAMModelOS.Services.Common
                 if (!continuation.ValueKind.Equals(JsonValueKind.Null) && continuation.ValueKind.Equals(JsonValueKind.String))
                 {
                     continuationToken = continuation.GetString();
-                    iscontinuation = true;
+                    
                 }
             }
             //班级