|
@@ -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)
|
|
|
{
|