Selaa lähdekoodia

update startTime

zhouj1203@hotmail.com 1 vuosi sitten
vanhempi
commit
ef633fe4cc

+ 1 - 1
TEAMModelOS/Controllers/Analysis/AnalysisController.cs

@@ -338,7 +338,7 @@ namespace TEAMModelOS.Controllers.Analysis
                 }
                 //以班级为单位(此处处理的是行政班级,教学班如果被移除则会无法分析)
                 List<string> clas = ExamService.getClasses(info.classes, info.stuLists);
-                (List<RMember> members, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, clas, info.school, null);
+                (List<RMember> members, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, clas, info.school, null,-1,info.startTime);
                 foreach (RGroupList rGroup in classLists)
                 {
                    /* Class classroom = null;

+ 1 - 2
TEAMModelOS/Controllers/Analysis/ArtAnalysisController.cs

@@ -104,7 +104,6 @@ namespace TEAMModelOS.Controllers.Analysis
 
                 if (!request.TryGetProperty("areaId", out JsonElement _areaId)) return BadRequest();
                 ArtSetting setting = await client.GetContainer(Constant.TEAMModelOS, "Normal").ReadItemAsync<ArtSetting>($"{_areaId}", partitionKey: new PartitionKey("ArtSetting"));
-                (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classIds, code.GetString(), null);
                 //学校基本信息
                 School scInfo = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{code}", partitionKey: new PartitionKey("Base"));
                 var perMore = scInfo.period.Where(c => c.id.Equals(periodId.GetString())).FirstOrDefault()?.grades;
@@ -158,10 +157,10 @@ namespace TEAMModelOS.Controllers.Analysis
                 }
                 var pow = Math.Round(stus.Count > 0 ? Math.Pow(powSum / stus.Count, 0.5) : 0, 2);
 
-
                 //获取本次评测所有科目结算结果
                 List<ExamResult> examResults = new();
                 ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(examId.ToString(), new PartitionKey($"Exam-{code}"));
+                (List<RMember> tchList, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, classIds, code.GetString(), null,-1,info.startTime);
                 //获取评测ID
                 //var examId = arts[0].settings.SelectMany(s => s.task).Where(a => a.type == 1 && a.subject.Equals(subjectId.GetString())).FirstOrDefault().acId;
                 //根据科目标识获取科目ID以及知识块和知识点关系TODO 引用不同试卷时 获取知识点得差异

+ 1 - 1
TEAMModelOS/Controllers/Common/AreaController.cs

@@ -2192,7 +2192,7 @@ namespace TEAMModelOS.Controllers
                 {
                     var sJson = await JsonDocument.ParseAsync(aresponse.ContentStream);
                     Study study = sJson.ToObject<Study>();
-                    (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, study.tchLists, study.school);
+                    (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, study.tchLists, study.school,null,-1,study.startTime);
                     teac = tchList;
                     var query = $"select value(c) from c where c.pId = '{id}'";
                     foreach ((string code, string name) in baseIds)

+ 28 - 6
TEAMModelOS/Controllers/Common/ArtController.cs

@@ -725,7 +725,7 @@ namespace TEAMModelOS.Controllers.Common
                             music = json.ToObject<ArtMusic>();
                         }
                     }
-                    (List<RMember> rmembers, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, art.classes, art.school);
+                    (List<RMember> rmembers, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, art.classes, art.school,null,-1,art.startTime);
                     var classes = art.classes.Select(c => new
                     {
                         id = c,
@@ -866,7 +866,8 @@ namespace TEAMModelOS.Controllers.Common
                 ArtMusic music = new();
                 if (art != null)
                 {
-                    List<StuActivity> stus = new();
+                    //List<StuActivity> stus = new();
+                    List<studentInfos> stus = new();
                     List<string> wIds = new();
                     List<StudentArtResult> works = new();
 
@@ -892,11 +893,26 @@ namespace TEAMModelOS.Controllers.Common
                     //wIds = art.settings.SelectMany(z => z.task).Where(t => t.type == 2).Select(a => a.acId).ToList();
                     if (taskType1 != null && taskType1.Any())
                     {
-                        string sql = $"select value c from  c where c.id in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))})";
-                        await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student)
-                            .GetItemQueryIterator<StuActivity>(sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Activity-{school}-{userid}") }))
+                        List<ExamClassResult> examClassResults = new();
+                        //string sql = $"select value(c) from c where c.examId in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))})' and c.pk = 'ExamClassResult' and array_contains(c.studentIds,'{userid}')";
+                        await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(
+                        queryText: $"select value(c) from c where c.examId in ({string.Join(",", taskType1.Select(z => $"'{z.acId}'"))}) and c.pk = 'ExamClassResult' and array_contains(c.studentIds,'{userid}')"))
                         {
-                            stus.Add(item);
+                            examClassResults.Add(item);
+                        }
+                        foreach (ExamClassResult classResult in examClassResults)
+                        {
+                            int index = classResult.studentIds.IndexOf(userid);
+                            if (index != -1)
+                            {
+                                studentInfos infos = new()
+                                {
+                                    id = classResult.id,
+                                    paper = classResult.paper[index],
+                                    subject = classResult.subjectId
+                                };
+                                stus.Add(infos);
+                            }
                         }
                     }                   
                     await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StudentArtResult>(
@@ -1131,6 +1147,12 @@ namespace TEAMModelOS.Controllers.Common
             public string id { get; set; }
             public string paper { get; set; }
             public string subject { get; set; }
+            // 评分状态,0,未评分, 1已评分
+            public int sStatus { get; set; }
+            //任务完成状态,-1 未参与,0,未完成, 1已完成
+            public int taskStatus { get; set; }
+            public long startTime { get; set; }
+            public long endTime { get; set; }
         }
     }
 }

+ 3 - 3
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -1556,7 +1556,7 @@ namespace TEAMModelOS.Controllers
                 var client = _azureCosmos.GetCosmosClient();
                 var (_, _, _, school) = HttpContext.GetAuthTokenInfo();
                 //string code = school_code.ToString().Substring(5);
-                //ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{school_code}"));
+                ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{school_code}"));
                 List<ExamClassResult> examClassResults = new List<ExamClassResult>();
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamClassResult>(queryText: $"select c.id,c.subjectId,c.code,c.scIds,c.info,c.studentIds,c.studentAnswers,c.studentScores,c.mark,c.status from c where c.examId = '{id}' and c.subjectId = '{subjectId}' and c.info.id = '{classId}'",
                     requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamClassResult-{school_code}") }))
@@ -1574,7 +1574,7 @@ namespace TEAMModelOS.Controllers
                 {
                     classId.GetString()
                 };
-                (List<RMember> members, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, cid, $"{school}");
+                (List<RMember> members, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, cid, $"{school}", null, -1, info.startTime);
                 //await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<GroupList>(classId.GetString, new PartitionKey($"Exam-{code}"));
                 ///获取真实的名称 
                 List<ufo> ufos = new();
@@ -1905,7 +1905,7 @@ namespace TEAMModelOS.Controllers
                 List<KeyValuePair<string, List<KeyValuePair<string, Dictionary<string, string>>>>> subjectScatter = new();
                 if (!string.IsNullOrEmpty(info.progress) && info.progress.Equals("finish"))
                 {
-                    (List<RMember> members, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, infoIds, school.GetString(), null);
+                    (List<RMember> members, List<RGroupList> classLists) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, infoIds, school.GetString(), null,-1,info.startTime);
                     await foreach (var s in stuTask(subId, info.papers, answers, classResults, studentId.GetString()))
                     {
                         know = s.know;

+ 1 - 1
TEAMModelOS/Controllers/Common/HomeworkController.cs

@@ -514,7 +514,7 @@ namespace TEAMModelOS.Controllers.Learn
                             if (!request.TryGetProperty("listIds", out JsonElement _listIds)) return BadRequest();
                             List<string> listIds = _listIds.ToJsonString().ToObject<List<string>>();
                             List<TypeUser> typeUsers = new List<TypeUser>();
-                            (List<RMember> tmdinfos, List<RGroupList> classInfo) = await GroupListService.GetMemberByListids(_coreAPIHttpService,client, _dingDing, listIds, homework.school);
+                            (List<RMember> tmdinfos, List<RGroupList> classInfo) = await GroupListService.GetMemberByListids(_coreAPIHttpService,client, _dingDing, listIds, homework.school,null,-1,homework.startTime);
                             var addStudentsCls = tmdinfos.FindAll(x => x.type == 2);
                             var addTmdidsCls = tmdinfos.FindAll(x => x.type == 1);
                             if ($"{_targetType}".Equals("research", StringComparison.OrdinalIgnoreCase) || $"{_targetType}".Equals("yxtrain", StringComparison.OrdinalIgnoreCase))

+ 1 - 1
TEAMModelOS/Controllers/Common/StudyController.cs

@@ -524,7 +524,7 @@ namespace TEAMModelOS.Controllers.Common
                 Study study = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<Study>(id.GetString(), new PartitionKey($"Study-{code}"));
                 if (study != null)
                 {
-                    (List<RMember> tchList, List<RGroupList> classInfo) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, study.tchLists, study.school);
+                    (List<RMember> tchList, List<RGroupList> classInfo) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, study.tchLists, study.school,null,-1,study.startTime);
                     List<StudyRecord> records = new();
 
                     foreach (var member in tchList)

+ 18 - 17
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -337,6 +337,7 @@ namespace TEAMModelOS.Controllers
                 id = p.studentId,
                 name = p.studentName,
                 school = sc.Where(x => x.id.Equals(p.school)).FirstOrDefault().name,
+                code = p.school,
                 info = p.results.Select(c => new
                 {
                     c.score,
@@ -405,16 +406,15 @@ namespace TEAMModelOS.Controllers
             return Ok(new { code = 200, students });
         }
 
-        [HttpPost("fix_exam_paper")]
+        [HttpPost("fix-exam-paper")]
         //[Authorize(Roles = "IES")]
         //[AuthToken(Roles = "teacher,admin,business")]
         [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<IActionResult> fixExamPaper([FromForm] IFormFile file)
+        public async Task<IActionResult> fixExamPaper(JsonElement json)
         {
-            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
             var client = _azureCosmos.GetCosmosClient();
-            //string stusql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
-            string stusql = "select * from c where c.pk = 'Art' and c.pId  = '306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2'";
+            string stusql = "select * from c where c.pk = 'Art' and c.pId in ('2f74d38e-80c1-4c55-9dd0-de0d8f6fdf6d','306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2')";
+            //string stusql = "select * from c where c.pk = 'Art' and c.pId  = '306fa576-7ae4-4baa-ac24-0b5ad4dd1bc2'";
             List<ArtEvaluation> art = new List<ArtEvaluation>();
             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Common).GetItemQueryIterator<ArtEvaluation>(queryText: stusql))
             {
@@ -486,23 +486,24 @@ namespace TEAMModelOS.Controllers
                 string value = "";
                 string code = "";
                 try {
-                    int n = 0;
+                    //int n = 0;
                     var activity = stus.Where(c => c.id.Equals(classResult.examId)).ToList();
-                    List<(string studentId, string blob)> stuBlob = new();
+                    //List<(string studentId, string blob)> stuBlob = new();
                     foreach (StuActivity stu in activity) { 
                         List<string> tas = stu.code.Split('-').ToList();
                         JsonElement dict = stu.paper;
                         dict[0].TryGetProperty("blob", out JsonElement element);
                         string blob = element.ToString();
-
+                        int index =  classResult.studentIds.IndexOf(tas[2]);
+                        if (index != -1)
+                        {
+                            classResult.paper[index] = blob;
+                        }
                     }
-                    /*foreach (var stuId in classResult.studentIds) {
-
-                        classResult.paper = stus.Where(c => c.school.Equals(classResult.school) && c.);
-                        n++;
-                    }*/
-                } catch (Exception e) { 
-                
+                    await client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(classResult, classResult.id, new PartitionKey(classResult.code));
+                } catch (Exception e) {
+                    value = classResult.examId;
+                    code = classResult.school;
                 }
 
                 yield return (code, value);
@@ -604,14 +605,14 @@ namespace TEAMModelOS.Controllers
             List<Task<ItemResponse<ArtEvaluation>>> tasks = new List<Task<ItemResponse<ArtEvaluation>>>();
             foreach (ArtEvaluation evaluation in art)
             {
-                evaluation.endTime = 1706716800000;
+                evaluation.endTime = 1709222400000;
                 tasks.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(evaluation, evaluation.id, new PartitionKey(evaluation.code)));
             }
             await tasks.TaskPage(10);
             List<Task<ItemResponse<ExamInfo>>> taskInfo = new List<Task<ItemResponse<ExamInfo>>>();
             foreach (ExamInfo info in infos)
             {
-                info.endTime = 1706716800000;
+                info.endTime = 1709222400000;
                 taskInfo.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Common).ReplaceItemAsync(info, info.id, new PartitionKey(info.code)));
             }
             await taskInfo.TaskPage(10);