Преглед изворни кода

Merge branch 'develop5.0-tmd' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

CrazyIter_Bin пре 3 година
родитељ
комит
b0f3ed8a3f

+ 1 - 1
TEAMModelOS/ClientApp/src/common/BaseNotification.vue

@@ -158,7 +158,7 @@
 				return new Promise((r,j) => {
 					if(!routerInfo) return
 					// 如果是同一学校则不做处理
-					if (schoolCode === this.$store.state.userInfo.schoolCode || !schoolCode) {
+					if (schoolCode === this.$store.state.userInfo.schoolCode || !schoolCode || routerInfo.name === 'settings') {
 						this.$router.push(routerInfo)
 						return
 					}

+ 1 - 1
TEAMModelOS/ClientApp/src/view/assessment/Assessment.vue

@@ -488,7 +488,7 @@
 				this.tableLoading = true
 				this.$api.ability.getSchoolAppraise({}).then((res) => {
 					if (!res.error) {
-						this.assessmentList = this.getRenderJson(res).sort((a,b) => b.totalTime - a.totalTime)
+						this.assessmentList = this.getRenderJson(res).sort((a,b) => a.userInfo.name.localeCompare(b.userInfo.name))
 						this.originList = this._.cloneDeep(this.assessmentList)
 						if(!this.groupList.length){
 							this.groupList = ['全部教研组', ...new Set(res.teacherTrains.map(i => i.groupName))]

+ 57 - 56
TEAMModelOS/Controllers/Common/AreaController.cs

@@ -433,63 +433,67 @@ namespace TEAMModelOS.Controllers
                 List<Study> studies = new();
                 List<(string id, string name)> ps = await getInfo(client, areaId.GetString());
                 //List<string> aName = new();
-                var query = $"select value(c) from c where c.pId = '{id}'";
-                foreach ((string code, string name) in baseIds)
-                {
-                    await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Study>(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Study-{code}") }))
-                    {
-                        studies.Add(item);
-                    }
-                }
-
-                List<(List<RMember> teac, Survey sur)> trSurveys = new List<(List<RMember> teac, Survey sur)>();
-                List<(List<RMember> teac, ExamLite examLite)> trExams = new List<(List<RMember> teac, ExamLite examLite)>();
-                List<(List<RMember> teac, Study stu)> moreInfo = new List<(List<RMember> teac, Study stu)>();
-                List<(List<RMember> teac, Homework tw)> works = new List<(List<RMember> teac, Homework tw)>();
-                foreach (Study study in studies)
+                List< Survey > trSurveys = new();
+                List< ExamLite> trExams = new();
+                List<Study> moreInfo = new();
+                List<Homework> works = new();
+                //提取研修相关老师活动记录
+                List<StudyRecord> records = new();
+                List<RMember> teac = new();
+                var aresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"Study-{areaId}"));
+                if (aresponse.Status == (int)HttpStatusCode.OK)
                 {
+                    var sJson = await JsonDocument.ParseAsync(aresponse.ContentStream);
+                    Study study = sJson.ToObject<Study>();
                     (List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, study.tchLists, study.school);
-                    // (List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{school}");
-                    //(List<TmdInfo> tchList, _) = await TriggerStuActivity.GetTchList(client, _dingDing, study.tchLists, study.school);
-
-                    if (!string.IsNullOrEmpty(study.surveyId))
+                    teac = tchList;
+                    var query = $"select value(c) from c where c.pId = '{id}'";
+                    foreach ((string code, string name) in baseIds)
                     {
-
-                        var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(study.surveyId, new PartitionKey($"Survey-{study.school}"));
-                        if (sresponse.Status == 200)
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Study>(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Study-{code}") }))
                         {
-                            using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
-                            Survey surs = json.ToObject<Survey>();
-                            trSurveys.Add((tchList, surs));
+                            studies.Add(item);
                         }
                     }
-                    if (!string.IsNullOrEmpty(study.examId))
+
+                    
+                    foreach (Study stu in studies)
                     {
-                        var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(study.examId, new PartitionKey($"ExamLite-{study.school}"));
-                        if (sresponse.Status == 200)
+                        if (!string.IsNullOrEmpty(stu.surveyId))
+                        {
+
+                            var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(stu.surveyId, new PartitionKey($"Survey-{stu.school}"));
+                            if (sresponse.Status == 200)
+                            {
+                                using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
+                                Survey surs = json.ToObject<Survey>();
+                                trSurveys.Add(surs);
+                            }
+                        }
+                        if (!string.IsNullOrEmpty(stu.examId))
                         {
-                            using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
-                            ExamLite lite = json.ToObject<ExamLite>();
-                            trExams.Add((tchList, lite));
+                            var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(stu.examId, new PartitionKey($"ExamLite-{stu.school}"));
+                            if (sresponse.Status == 200)
+                            {
+                                using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
+                                ExamLite lite = json.ToObject<ExamLite>();
+                                trExams.Add(lite);
+                            }
                         }
-                    }
-                    if (!string.IsNullOrEmpty(study.workId))
-                    {
-                        var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(study.workId, new PartitionKey($"Homework-{study.school}"));
-                        if (sresponse.Status == 200)
+                        if (!string.IsNullOrEmpty(stu.workId))
                         {
-                            using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
-                            Homework work = json.ToObject<Homework>();
-                            works.Add((tchList, work));
+                            var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(stu.workId, new PartitionKey($"Homework-{stu.school}"));
+                            if (sresponse.Status == 200)
+                            {
+                                using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
+                                Homework work = json.ToObject<Homework>();
+                                works.Add(work);
+                            }
                         }
-                    }
-                    moreInfo.Add((tchList, study));
-                };
-                //提取研修相关老师活动记录
-                List<StudyRecord> records = new();
-                foreach (var (teac, stu) in moreInfo)
-                {
-                    foreach (var member in teac)
+                        moreInfo.Add(study);
+                    };
+
+                    foreach (var member in tchList)
                     {
                         var response = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(id.ToString(), new PartitionKey($"StudyRecord-{member.id}"));
                         if (response.Status == (int)HttpStatusCode.OK)
@@ -501,32 +505,29 @@ namespace TEAMModelOS.Controllers
                     }
 
                 }
+                                        
                 var survey = trSurveys.Select(s => new
                 {
-                    count = s.teac.Count,
-                    ansCount = s.sur.answers.Count,
+                    ansCount = s.answers.Count,
                 });
                 var twork = works.Select(s => new
                 {
-                    count = s.teac.Count,
-                    ansCount = s.tw.teachers.Where(h => !string.IsNullOrEmpty(h.hw)).ToList().Count,
+                    ansCount = s.teachers.Where(h => !string.IsNullOrEmpty(h.hw)).ToList().Count,
                 });
                 var exam = trExams.Select(s => new
                 {
-                    count = s.teac.Count,
-                    ansCount = s.examLite.teachers.Where(h => h.answer.Count > 0).ToList().Count,
+                    ansCount = s.teachers.Where(h => h.answer.Count > 0).ToList().Count,
                 });
                 var info = moreInfo.Select(s => new
                 {
-                    s.stu.id,
-                    name = ps.FirstOrDefault(c => c.id == s.stu.id).name,
-                    count = s.teac.Count,
+                    s.id,
+                    name = ps.FirstOrDefault(c => c.id == s.id).name,
                     //hwCount = s.teachers.Where(h => h.hwTime > 0).ToList().Count,
                     signCount = records.Where(h => h.signTime > 0).ToList().Count,
                     lateCount = records.Where(h => !string.IsNullOrEmpty(h.sign) && h.sign.Equals("1")).ToList().Count,
                     acount = records.Where(h => h.aTime > 0).ToList().Count
                 });
-                return Ok(new { survey, work = twork, exam, info, studies = moreInfo.Select(m =>  m.stu ),teac = moreInfo.Select(m => m.teac).First() });
+                return Ok(new { survey, work = twork, exam, info, studies = moreInfo.Select(m =>  m ), teac });
             }
             catch (Exception e)
             {