CrazyIter_Bin il y a 1 an
Parent
commit
86eb4a10bd

+ 5 - 4
TEAMModelOS.SDK/Models/Cosmos/School/SchoolSetting.cs

@@ -67,10 +67,10 @@ namespace TEAMModelOS.SDK.Models
         /// </summary>
         /// </summary>
         public List<string> examTypes { get; set; } = new List<string>();
         public List<string> examTypes { get; set; } = new List<string>();
         public List<CodeDouble> intelligenceWeight { get; set; } = new List<CodeDouble>() {
         public List<CodeDouble> intelligenceWeight { get; set; } = new List<CodeDouble>() {
-            new CodeDouble { code = "attitude", value = 0.10 },//态度
-            new CodeDouble { code = "cooperate", value = 0.10 },//合作
-            new CodeDouble { code = "ability", value = 0.10 },//能力
-            new CodeDouble { code = "standard", value = 0.70 },//水平
+            new CodeDouble { code = "attitude", value = 0.10 ,name ="态度"},//态度
+            new CodeDouble { code = "cooperate", value = 0.10,name="合作" },//合作
+            new CodeDouble { code = "ability", value = 0.10 ,name ="能力"},//能力
+            new CodeDouble { code = "standard", value = 0.70,name= "态度" },//水平
         };
         };
     }
     }
     public class CodeLong
     public class CodeLong
@@ -85,6 +85,7 @@ namespace TEAMModelOS.SDK.Models
         //attitude cooperate  ability  standard
         //attitude cooperate  ability  standard
         public double value { get; set; }
         public double value { get; set; }
         public string code { get; set; }
         public string code { get; set; }
+        public string name  { get; set; }
 
 
     }
     }
     public class LessonSetting
     public class LessonSetting

+ 1 - 1
TEAMModelOS.SDK/Models/Service/ExamService.cs

@@ -63,7 +63,7 @@ namespace TEAMModelOS.SDK.Models.Service
             }
             }
         }
         }
 
 
-        public static async Task<List<(string name, List<(string classId, double average)> classMore, double total,List<(string studentId, double scores, string classId)>)>> getGradeScore(CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, CosmosClient client, List<string> classIds, string periodId, string schooCode, long stime, long etime)
+        public static async Task<List<(string name, List<(string classId, double average)> classMore, double total,List<(string studentId, double scores, string classId)>students )>> getGradeScore(CoreAPIHttpService _coreAPIHttpService, DingDing _dingDing, CosmosClient client, List<string> classIds, string periodId, string schooCode, long stime, long etime)
         {
         {
             List<(string name, List<(string classId,double average)> classMore, double total, List<(string studentId, double scores, string classId)> stus)> grades = new();
             List<(string name, List<(string classId,double average)> classMore, double total, List<(string studentId, double scores, string classId)> stus)> grades = new();
             //List<(string grade, double score)> grades = new();
             //List<(string grade, double score)> grades = new();

+ 69 - 11
TEAMModelOS/Controllers/Student/OverallEducationController.cs

@@ -1,12 +1,4 @@
 using Azure.Cosmos;
 using Azure.Cosmos;
-using DocumentFormat.OpenXml.Drawing.Charts;
-using DocumentFormat.OpenXml.Office2010.Excel;
-using DocumentFormat.OpenXml.Office2013.Drawing.Chart;
-using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
-using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
-using DocumentFormat.OpenXml.Spreadsheet;
-using DocumentFormat.OpenXml.VariantTypes;
-using DocumentFormat.OpenXml.Wordprocessing;
 using HTEXLib.COMM.Helpers;
 using HTEXLib.COMM.Helpers;
 using MathNet.Numerics.Distributions;
 using MathNet.Numerics.Distributions;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Authorization;
@@ -21,6 +13,7 @@ using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using System.Reflection;
 using System.Reflection;
+using System.Security.Claims;
 using System.Text;
 using System.Text;
 using System.Text.Json;
 using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -32,6 +25,7 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
+using TEAMModelOS.SDK.Models.Service;
 using TEAMModelOS.SDK.Services;
 using TEAMModelOS.SDK.Services;
 using static TEAMModelOS.Controllers.OverallEducationController;
 using static TEAMModelOS.Controllers.OverallEducationController;
 using static TEAMModelOS.SDK.Models.Cosmos.Student.StudentAnalysis;
 using static TEAMModelOS.SDK.Models.Cosmos.Student.StudentAnalysis;
@@ -126,11 +120,13 @@ namespace TEAMModelOS.Controllers
                 {
                 {
                     years.Add(studentYear);
                     years.Add(studentYear);
                 }
                 }
+                Period period = school.period.Find(z => z.id.Equals($"{_periodId}")); ;
+                Semester semester = period.semesters.Find(x => x.id.Equals($"{_semesterId}"));
                 if (!years.Any())
                 if (!years.Any())
                 {
                 {
-                    var period = school.period.Find(z => z.id.Equals($"{_periodId}"));
                     if (period != null && period.grades.IsNotEmpty())
                     if (period != null && period.grades.IsNotEmpty())
                     {
                     {
+                        
                         List<int> grades = new List<int>();
                         List<int> grades = new List<int>();
                         period.grades.Select((z, index) => index).ToList().ForEach(t => { grades.Add(t); });
                         period.grades.Select((z, index) => index).ToList().ForEach(t => { grades.Add(t); });
                         var yearsdata = SchoolService.GetYears(school, $"{_periodId}", grades);
                         var yearsdata = SchoolService.GetYears(school, $"{_periodId}", grades);
@@ -355,8 +351,9 @@ namespace TEAMModelOS.Controllers
                             {
                             {
                                 dimensionScore.art = Math.Round(sumScore * 1.0 / item.art.Count,2);
                                 dimensionScore.art = Math.Round(sumScore * 1.0 / item.art.Count,2);
                             }
                             }
-                            var subject_music = art.itemScore.Find(x => x.id.Equals("subject_music"));
-                            var subject_painting = art.itemScore.Find(x => x.id.Equals("subject_painting"));
+                            
+                            var subject_music = art.itemScore.Find(x => !string.IsNullOrWhiteSpace(x.id)?x.id.Equals("subject_music"): x.type.Equals("subject_music"));
+                            var subject_painting = art.itemScore.Find(x => !string.IsNullOrWhiteSpace(x.id) ? x.id.Equals("subject_painting") : x.type.Equals("subject_painting"));
                             if (subject_music != null)
                             if (subject_music != null)
                             {
                             {
                                 dimensionScore.subject_music = Math.Round(subject_music.score * 1.0 / subject_music.totalScore *100,2);
                                 dimensionScore.subject_music = Math.Round(subject_music.score * 1.0 / subject_music.totalScore *100,2);
@@ -554,9 +551,62 @@ namespace TEAMModelOS.Controllers
                 if (!string.IsNullOrWhiteSpace($"{_studentId}")) {
                 if (!string.IsNullOrWhiteSpace($"{_studentId}")) {
                     studentOverallEducation = overallEducations.FindAll(x => x.studentId.Equals($"{_studentId}")).FirstOrDefault();
                     studentOverallEducation = overallEducations.FindAll(x => x.studentId.Equals($"{_studentId}")).FirstOrDefault();
                 }
                 }
+                var studyYear =  int.Parse($"{_studyYear}");
+                
+                var semesterData=  SchoolService.GetSemester(period, time: SchoolService.GetOpensByStudyYearAndSemester(period.semesters,studyYear,$"{_semesterId}"));
+                var examData =  await ExamService.getGradeScore(_coreAPIHttpService, _dingDing,_azureCosmos.GetCosmosClient(), grade_classes.Select(x=>x.id).ToList(), $"{_periodId}", school.id,   semesterData.date.ToUnixTimeMilliseconds(), semesterData.nextSemester.ToUnixTimeMilliseconds());
+              
+                var groupExam= examData.GroupBy(x => x.name).Select(y => new { key = y.Key, list = y });
+                List<Exam3Score> exam3Scores = new List<Exam3Score>();
+                foreach (var item in examData) {
+
+                    if (!string.IsNullOrWhiteSpace($"{_studentId}"))
+                    {
+                        var student =  students.Find(x => x.id.Equals($"{_studentId}"));
+                        Exam3Score exam3Score = new Exam3Score();
+                        exam3Score.name = item.name;
+                        exam3Score.gradeScore=item.total;
+                        exam3Score.xdatas= new List<CodeDouble> 
+                        { 
+                            new CodeDouble 
+                            {
+                                code=student.id,
+                                name= student.name,
+                                value=item.students.Find(x=>x.studentId.Equals(student.id)).scores
+                            } 
+                        };
+                        exam3Score.classScore=item.classMore.Find(x=>x.classId.Equals(student.classId)).average;
+                        exam3Scores.Add(exam3Score);
+                    }
+                    else
+                    {
+                        if (isClass)
+                        {
+                            Class clazz = classes.First();
+                            Exam3Score exam3Score = new Exam3Score();
+                            exam3Score.name = item.name;
+                            exam3Score.gradeScore=item.total;
+                            exam3Score.classScore=item.classMore.Find(x => x.classId.Equals(clazz.id)).average;
+                            exam3Score.xdatas= item.students.Where(y=>y.classId.Equals(clazz.id)).Select(x=>new CodeDouble { code=x.studentId,name= students.Find(z=>z.id.Equals(x.studentId))?.name,value=x.scores  }).ToList();
+                            exam3Scores.Add(exam3Score);
+                        }
+                        else
+                        {
+                            Exam3Score exam3Score = new Exam3Score();
+                            exam3Score.name = item.name;
+                            exam3Score.gradeScore=item.total;
+                            exam3Score.classScore=-1;
+                            exam3Score.xdatas= item.classMore.Select(x => new CodeDouble { code=x.classId, name= grade_classes.Find(z => z.id.Equals(x.classId))?.name, value=x.average }).ToList();
+                            exam3Scores.Add(exam3Score);
+                        }
+                    }
+                }
+               
                 #endregion
                 #endregion
                 return Ok(new
                 return Ok(new
                 {
                 {
+                    exam3Scores,
+                    examData,
                     sports_count60,
                     sports_count60,
                     sports_count90,
                     sports_count90,
                     labour_count60,
                     labour_count60,
@@ -605,6 +655,14 @@ namespace TEAMModelOS.Controllers
             }
             }
             return Ok();
             return Ok();
         }
         }
+        public class Exam3Score { 
+
+            public double gradeScore { get; set; }
+            public double classScore { get; set; }
+            public string name { get; set; }
+            public List<CodeDouble> xdatas = new List<CodeDouble>();
+        }
+
         /// <summary>
         /// <summary>
         /// 素养
         /// 素养
         /// </summary>
         /// </summary>