|
@@ -20,13 +20,15 @@ using OpenXmlPowerTools;
|
|
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
|
using DocumentFormat.OpenXml.Office2016.Excel;
|
|
|
using static TEAMModelOS.SDK.Models.Cosmos.Student.StudentAnalysis;
|
|
|
+using HTEXLib.Helpers.ShapeHelpers;
|
|
|
+using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
|
|
|
namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
{
|
|
|
public class TriggerArt
|
|
|
{
|
|
|
public static async Task Trigger(CoreAPIHttpService _coreAPIHttpService, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
|
|
|
- CosmosClient client, JsonElement input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
|
|
|
+ CosmosClient client, JsonElement input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration, HttpTrigger _httpTrigger)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -241,11 +243,11 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
break;
|
|
|
case "finish":
|
|
|
//判定是否是区级创建的活动内容
|
|
|
- if (art.lost.Count == 0 && art.pass == 0)
|
|
|
+ /* if (art.lost.Count == 0 && art.pass == 0)
|
|
|
{
|
|
|
if (art.owner.Equals("area") && string.IsNullOrEmpty(art.pId))
|
|
|
{
|
|
|
- /* List<(string id, string code, List<Tasks> settings)> artSchools = new();
|
|
|
+ *//* List<(string id, string code, List<Tasks> settings)> artSchools = new();
|
|
|
string ql = $"select c.id,c.school,c.settings,c.classes from c where c.pk = 'Art' and c.pId = '{art.id}'";
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: ql))
|
|
|
{
|
|
@@ -293,13 +295,13 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
|
|
|
}
|
|
|
art.pass = 1;
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<ArtEvaluation>(art, art.id, new PartitionKey(art.code));*/
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<ArtEvaluation>(art, art.id, new PartitionKey(art.code));*//*
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取当前艺术评价相关评测ID目前暂时排除区级发布的评测信息
|
|
|
|
|
|
- /*List<(string eId, string sId)> ids = new();
|
|
|
+ *//*List<(string eId, string sId)> ids = new();
|
|
|
var examId = art.settings.SelectMany(x => x.task).Where(c => c.type == 1).Select(z => new { z.acId, z.subject }).ToList();
|
|
|
examId.ForEach(x =>
|
|
|
{
|
|
@@ -328,9 +330,9 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
art.miss.Add(stus.Count);
|
|
|
//art.miss = stus.Count;
|
|
|
art.pass = 1;
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<ArtEvaluation>(art, art.id, new PartitionKey(art.code));*/
|
|
|
+ await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<ArtEvaluation>(art, art.id, new PartitionKey(art.code));*//*
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
List<StudentArtResult> studentArtResults = new();
|
|
|
string sql = $"SELECT value c FROM c where c.pk='ArtResult' ";
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, Constant.Student)
|
|
@@ -362,6 +364,16 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
|
|
|
}
|
|
|
List<Task<ItemResponse<StudentArtResult>>> tasks = new List<Task<ItemResponse<StudentArtResult>>>();
|
|
|
+ //新增数据推送 obj => Portrait
|
|
|
+ Portrait portrait = new()
|
|
|
+ {
|
|
|
+ schoolCode = art.school,
|
|
|
+ periodId = art.period.id,
|
|
|
+ subjectId = "subject_art"
|
|
|
+ };
|
|
|
+ var period = scInfo.period.Where(x => x.id.Equals(art.period.id)).FirstOrDefault();
|
|
|
+ //获取学期信息
|
|
|
+ var (currSemester, studyYear, date, nextSemester) = SchoolService.GetSemester(period, art.startTime);
|
|
|
//总分的占比情况
|
|
|
|
|
|
foreach (var rs in studentArtResults)
|
|
@@ -375,6 +387,7 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
res.score = Math.Round(res.score);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//if (rs.totalScore == 0)
|
|
|
//{
|
|
|
foreach (var sc in rs.subjectScores)
|
|
@@ -408,12 +421,59 @@ namespace TEAMModelOS.FunctionV4.CosmosDB
|
|
|
}
|
|
|
rs.totalScore = Math.Round(rs.subjectScores.Where(m => m.score >= 0).Sum(z => z.score),2);
|
|
|
tasks.Add(client.GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync(rs, rs.id, new PartitionKey(rs.code)));
|
|
|
+ PortraitStudent student = new()
|
|
|
+ {
|
|
|
+ studentId = rs.studentId,
|
|
|
+ name = rs.studentName,
|
|
|
+ classId = rs.classIds[0]
|
|
|
+ };
|
|
|
+ SemesterData semesterData = new()
|
|
|
+ {
|
|
|
+ examName = art.name,
|
|
|
+ examId = art.id,
|
|
|
+ examDate = art.startTime,
|
|
|
+ examType = "",
|
|
|
+ year = studyYear,
|
|
|
+ semesterId = currSemester.id,
|
|
|
+ totalScore = 200,
|
|
|
+ sumScore = rs.totalScore,
|
|
|
+ excellenceRate = 0,
|
|
|
+ passRate = 0,
|
|
|
+ };
|
|
|
+ int index = 0;
|
|
|
+ foreach (var sj in art.subjects)
|
|
|
+ {
|
|
|
+ ItemScore item = new()
|
|
|
+ {
|
|
|
+ name = sj.name,
|
|
|
+ score = rs.subjectScores.Where(x => x.subjectId.Equals(sj.id)).FirstOrDefault().score,
|
|
|
+ time = art.startTime,
|
|
|
+ totalScore = 100,
|
|
|
+ type = sj.id
|
|
|
+ };
|
|
|
+ index++;
|
|
|
+ semesterData.itemScore.Add(item);
|
|
|
+ }
|
|
|
+ student.semesterData.Add(semesterData);
|
|
|
+
|
|
|
+ portrait.students.Add(student);
|
|
|
//}
|
|
|
}
|
|
|
if (tasks.Count > 0)
|
|
|
{
|
|
|
await Task.WhenAll(tasks);
|
|
|
}
|
|
|
+
|
|
|
+ //获取学生信息
|
|
|
+ //(List<RMember> rmembers, List<RGroupList> groups) = await GroupListService.GetMemberByListids(_coreAPIHttpService, client, _dingDing, art.classes, art.school);
|
|
|
+ /* foreach (var member in studentArtResults)
|
|
|
+ {
|
|
|
+
|
|
|
+ }*/
|
|
|
+ string location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
|
|
|
+ var responseData = await _httpTrigger.RequestHttpTrigger(portrait.ToJson(), location, "upsert-student-portrait");
|
|
|
+
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|