|
@@ -1,7 +1,6 @@
|
|
using Azure;
|
|
using Azure;
|
|
using Azure.Cosmos;
|
|
using Azure.Cosmos;
|
|
using DinkToPdf.Contracts;
|
|
using DinkToPdf.Contracts;
|
|
-using DocumentFormat.OpenXml.Drawing.Charts;
|
|
|
|
using HTEXLib.COMM.Helpers;
|
|
using HTEXLib.COMM.Helpers;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
@@ -124,6 +123,10 @@ namespace TEAMModelOS.Controllers
|
|
string comment1 = "";
|
|
string comment1 = "";
|
|
string comment2 = "";
|
|
string comment2 = "";
|
|
string comment3 = "";
|
|
string comment3 = "";
|
|
|
|
+ string comment4 = "";
|
|
|
|
+ string comment5 = "";
|
|
|
|
+ string comment_subject_music = "";
|
|
|
|
+ string comment_subject_painting = "";
|
|
var jsonDoc = readFileJson(path);
|
|
var jsonDoc = readFileJson(path);
|
|
if (jsonDoc != null)
|
|
if (jsonDoc != null)
|
|
{
|
|
{
|
|
@@ -139,7 +142,24 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
comment3 = $"{_c3}";
|
|
comment3 = $"{_c3}";
|
|
}
|
|
}
|
|
|
|
+ if (jsonDoc.RootElement.TryGetProperty("art-template-comment4", out JsonElement _c4))
|
|
|
|
+ {
|
|
|
|
+ comment4 = $"{_c4}";
|
|
|
|
+ }
|
|
|
|
+ if (jsonDoc.RootElement.TryGetProperty("art-template-comment5", out JsonElement _c5))
|
|
|
|
+ {
|
|
|
|
+ comment5 = $"{_c5}";
|
|
|
|
+ }
|
|
|
|
+ if (jsonDoc.RootElement.TryGetProperty("art-template-subject_music", out JsonElement _subject_music))
|
|
|
|
+ {
|
|
|
|
+ comment_subject_music = $"{_subject_music}";
|
|
|
|
+ }
|
|
|
|
+ if (jsonDoc.RootElement.TryGetProperty("art-template-subject_painting", out JsonElement _subject_painting))
|
|
|
|
+ {
|
|
|
|
+ comment_subject_painting = $"{_subject_painting}";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
string query = $" select value c from c where c.school = '{_schoolId}' ";
|
|
string query = $" select value c from c where c.school = '{_schoolId}' ";
|
|
List<StudentArtResult> artResults = new List<StudentArtResult>();
|
|
List<StudentArtResult> artResults = new List<StudentArtResult>();
|
|
@@ -150,7 +170,48 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
artResults.Add(item);
|
|
artResults.Add(item);
|
|
}
|
|
}
|
|
|
|
+ var allExamIds= art.settings.SelectMany(x => x.task).Where(z => z.type==1);
|
|
var subjects = art.subjects;
|
|
var subjects = art.subjects;
|
|
|
|
+ //获取学校的所有艺术科目的uuid,并映射找到相应的知识点,知识块。
|
|
|
|
+ var schoolSubjects= school.period.SelectMany(x => x.subjects).Where(s => !string.IsNullOrWhiteSpace(s.bindId) && subjects.Select(z=>z.id).Contains(s.bindId));
|
|
|
|
+ StringBuilder sql = new StringBuilder($"select value(c) from c");
|
|
|
|
+ List<KeyValuePair<string, List<Block>>> subjectBindBlocks = new List<KeyValuePair<string, List<Block>>>();
|
|
|
|
+ foreach (var schSub in schoolSubjects) {
|
|
|
|
+ List<Block> blocks = new List<Block>();
|
|
|
|
+ string code = $"Knowledge-{_schoolId}-{schSub.id}";
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School")
|
|
|
|
+ .GetItemQueryIterator<Knowledge>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
|
|
|
|
+ {
|
|
|
|
+ item.blocks.ForEach(x =>
|
|
|
|
+ {
|
|
|
|
+ var block = blocks.Find(z => z.name.Equals(x.name));
|
|
|
|
+ if (block != null)
|
|
|
|
+ {
|
|
|
|
+ block.points.AddRange(x.points);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ blocks.Add(x);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ subjectBindBlocks.Add(new KeyValuePair<string, List<Block>>(schSub.bindId, blocks));
|
|
|
|
+ }
|
|
|
|
+ List<ExamInfo> exams = new List<ExamInfo>();
|
|
|
|
+ List<ExamResult> examResults = new();
|
|
|
|
+ if (allExamIds.Any()) {
|
|
|
|
+ var queryExam = $"select value c from c where c.id in ({string.Join(",",allExamIds.Select(x=>$"'{x.acId}'"))}) ";
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamInfo>(queryText: queryExam, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{_schoolId}") }))
|
|
|
|
+ {
|
|
|
|
+ exams.Add(item);
|
|
|
|
+ }
|
|
|
|
+ foreach (var allexamId in allExamIds) {
|
|
|
|
+ var queryResult = $"select c.id,c.name,c.subjectId,c.studentScores,c.studentIds,c.paper,c.classes,c.sRate,c.average,c.standard,c.lostStus,c.record,c.phc,c.plc,c.examId from c where c.examId = '{allexamId.acId}' and c.subjectId = '{allexamId.subject}' ";
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryIterator<ExamResult>(queryText: queryResult, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamResult-{allexamId.acId}") }))
|
|
|
|
+ {
|
|
|
|
+ examResults.Add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
(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);
|
|
List<ArtStudentPdf> studentPdfs = new List<ArtStudentPdf>();
|
|
List<ArtStudentPdf> studentPdfs = new List<ArtStudentPdf>();
|
|
artResults.ForEach(x =>
|
|
artResults.ForEach(x =>
|
|
@@ -347,7 +408,6 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
string periodId = "";
|
|
string periodId = "";
|
|
string periodName = "";
|
|
string periodName = "";
|
|
- string schoolName = "";
|
|
|
|
if (periodIds.Any())
|
|
if (periodIds.Any())
|
|
{
|
|
{
|
|
var ps = school.period.FindAll(x => periodIds.Contains(x.id));
|
|
var ps = school.period.FindAll(x => periodIds.Contains(x.id));
|
|
@@ -357,7 +417,43 @@ namespace TEAMModelOS.Controllers
|
|
periodId = String.Join(",", ps.Select(x => x.id));
|
|
periodId = String.Join(",", ps.Select(x => x.id));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ List<ArtSubjectPdf> subjectPdfs = new List<ArtSubjectPdf>();
|
|
|
|
+ exams.ForEach(exam => {
|
|
|
|
+ var result= examResults.FindAll(e => e.examId.Equals(exam.id));
|
|
|
|
+ if (result.Any()) {
|
|
|
|
+ var datas = DoKnowledgePoint(result.First(), exam, x.studentId);
|
|
|
|
+ if (exam.subjects.Any()) {
|
|
|
|
+ ArtSubjectPdf artSubjectPdf = new ArtSubjectPdf() {
|
|
|
|
+ subjectId= exam.subjects.First().id,
|
|
|
|
+ subjectName=exam.subjects.First().name
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ datas.pointScores.Value.ForEach(k => {
|
|
|
|
+ var artPointPdfs=GetBlockAndDimension(k.score,k.tscore ,artSubjectPdf.subjectId,k.name,subjectBindBlocks,artSetting);
|
|
|
|
+ artSubjectPdf.pointPdfs.AddRange(artPointPdfs);
|
|
|
|
+ });
|
|
|
|
+ var pointHigh= artSubjectPdf.pointPdfs.Where(z => z.percent >= 0.8).Select(z=>z.point).ToHashSet();
|
|
|
|
+ var pointLow = artSubjectPdf.pointPdfs.Where(z => z.percent < 0.6).Select(z => z.point).ToHashSet();
|
|
|
|
+ StringBuilder comment = new StringBuilder();
|
|
|
|
+ if (pointHigh.Any()) {
|
|
|
|
+ comment.Append(comment4.Replace("{pointHigh}", string.Join("、", pointHigh)));
|
|
|
|
+ }
|
|
|
|
+ if (pointLow.Any())
|
|
|
|
+ {
|
|
|
|
+ comment.Append(comment5.Replace("{pointLow}", string.Join("、", pointLow)));
|
|
|
|
+ }
|
|
|
|
+ if (artSubjectPdf.subjectId.Equals("subject_music")) {
|
|
|
|
+ comment.Append(comment_subject_music);
|
|
|
|
+ }
|
|
|
|
+ if (artSubjectPdf.subjectId.Equals("subject_painting"))
|
|
|
|
+ {
|
|
|
|
+ comment.Append(comment_subject_painting);
|
|
|
|
+ }
|
|
|
|
+ artSubjectPdf.comment = comment.ToString();
|
|
|
|
+ subjectPdfs.Add(artSubjectPdf);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
ArtStudentPdf studentPdf = new ArtStudentPdf
|
|
ArtStudentPdf studentPdf = new ArtStudentPdf
|
|
{
|
|
{
|
|
artId = art.id,
|
|
artId = art.id,
|
|
@@ -374,6 +470,7 @@ namespace TEAMModelOS.Controllers
|
|
score = allScore,
|
|
score = allScore,
|
|
allSubjectQuotas = allSubjectQuotas.ToList(),
|
|
allSubjectQuotas = allSubjectQuotas.ToList(),
|
|
comment = comment.ToString(),
|
|
comment = comment.ToString(),
|
|
|
|
+ subjectPdfs= subjectPdfs,
|
|
};
|
|
};
|
|
studentPdfs.Add(studentPdf);
|
|
studentPdfs.Add(studentPdf);
|
|
});
|
|
});
|
|
@@ -381,6 +478,33 @@ namespace TEAMModelOS.Controllers
|
|
return Ok(new { studentPdfs = studentPdfs });
|
|
return Ok(new { studentPdfs = studentPdfs });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<ArtPointPdf> GetBlockAndDimension(double score,double tscore ,string subjectId , string point, List<KeyValuePair<string, List<Block>>> subjectBindBlocks, ArtSetting artSetting) {
|
|
|
|
+ var block= subjectBindBlocks.Find(z => z.Key.Equals(subjectId));
|
|
|
|
+ List<ArtPointPdf> artPointPdfs = new List<ArtPointPdf>();
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(block.Key)) {
|
|
|
|
+ block.Value.ForEach(z => {
|
|
|
|
+ if (z.points.Contains(point)) {
|
|
|
|
+ var dims = artSetting.dimensions.FindAll(m => m.blocks.Contains(z.name));
|
|
|
|
+ if (dims.Any()) {
|
|
|
|
+ foreach (var dim in dims) {
|
|
|
|
+ artPointPdfs.Add(
|
|
|
|
+ new ArtPointPdf
|
|
|
|
+ {
|
|
|
|
+ dimension = dim.dimension,
|
|
|
|
+ block = z.name,
|
|
|
|
+ point = point,
|
|
|
|
+ totalScore = score,
|
|
|
|
+ score = tscore,
|
|
|
|
+ percent = score > 0 ? tscore * 1.0 / score : 0,
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return artPointPdfs;
|
|
|
|
+ }
|
|
private JsonDocument readFileJson(string path)
|
|
private JsonDocument readFileJson(string path)
|
|
{
|
|
{
|
|
var sampleJson = System.IO.File.ReadAllBytes(path).AsSpan();
|
|
var sampleJson = System.IO.File.ReadAllBytes(path).AsSpan();
|
|
@@ -671,7 +795,10 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
examResults.Add(item);
|
|
examResults.Add(item);
|
|
}*/
|
|
}*/
|
|
- private static (KeyValuePair<string, List<string>>, KeyValuePair<string, List<(string name, double score)>>, KeyValuePair<string, List<(string name, double score)>>) DoKnowledgePoint(ExamResult exam, ExamInfo info, string studentId)
|
|
|
|
|
|
+ private static (KeyValuePair<string, List<string>> knowledgeName,
|
|
|
|
+ KeyValuePair<string, List<(string name, double score)>> pointScore,
|
|
|
|
+ KeyValuePair<string, List<(string name, double score)>> pointTScore,
|
|
|
|
+ KeyValuePair<string, List<(string name, double score,double tscore)>> pointScores) DoKnowledgePoint(ExamResult exam, ExamInfo info, string studentId)
|
|
{
|
|
{
|
|
HashSet<string> knowledge = new();
|
|
HashSet<string> knowledge = new();
|
|
List<double> point = new();
|
|
List<double> point = new();
|
|
@@ -703,7 +830,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- return (default, default, default);
|
|
|
|
|
|
+ return (default, default, default,default);
|
|
}
|
|
}
|
|
point = info.papers[index].point;
|
|
point = info.papers[index].point;
|
|
result = exam.studentScores;
|
|
result = exam.studentScores;
|
|
@@ -725,6 +852,7 @@ namespace TEAMModelOS.Controllers
|
|
//学生得分情况
|
|
//学生得分情况
|
|
List<(string name, double score)> pointScore = new();
|
|
List<(string name, double score)> pointScore = new();
|
|
List<(string name, double score)> pointTScore = new();
|
|
List<(string name, double score)> pointTScore = new();
|
|
|
|
+ List<(string name, double score,double tscore)> pointScores = new();
|
|
for (int k = 0; k < knowledgeName.Count; k++)
|
|
for (int k = 0; k < knowledgeName.Count; k++)
|
|
{
|
|
{
|
|
double OnePoint = 0;
|
|
double OnePoint = 0;
|
|
@@ -747,13 +875,15 @@ namespace TEAMModelOS.Controllers
|
|
});
|
|
});
|
|
//单个知识点的配分
|
|
//单个知识点的配分
|
|
pointScore.Add((knowledgeName[k], OnePoint));
|
|
pointScore.Add((knowledgeName[k], OnePoint));
|
|
- pointScore.Add((knowledgeName[k], scores));
|
|
|
|
|
|
+ pointTScore.Add((knowledgeName[k], scores));
|
|
|
|
+ pointScores.Add((knowledgeName[k], OnePoint, scores));
|
|
|
|
|
|
}
|
|
}
|
|
KeyValuePair<string, List<string>> key1 = new(exam.subjectId, knowledgeName);
|
|
KeyValuePair<string, List<string>> key1 = new(exam.subjectId, knowledgeName);
|
|
KeyValuePair<string, List<(string name, double score)>> key2 = new(exam.subjectId, pointScore);
|
|
KeyValuePair<string, List<(string name, double score)>> key2 = new(exam.subjectId, pointScore);
|
|
- KeyValuePair<string, List<(string name, double score)>> key3 = new(exam.subjectId, pointTScore);
|
|
|
|
- return (key1, key2, key3);
|
|
|
|
|
|
+ KeyValuePair<string, List<(string name, double score)>> key3 = new(exam.subjectId, pointTScore);
|
|
|
|
+ KeyValuePair<string, List<(string name, double score,double tscore)>> key4 = new(exam.subjectId, pointScores);
|
|
|
|
+ return (key1, key2, key3, key4 );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|