|
@@ -22,7 +22,7 @@ using static TEAMModelOS.SDK.Models.Teacher;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.BITest
|
|
|
{
|
|
|
- [Route("iesapitest")]
|
|
|
+ [Route("ies5test")]
|
|
|
[ApiController]
|
|
|
public class Ies5TestController : ControllerBase
|
|
|
{
|
|
@@ -78,9 +78,83 @@ namespace TEAMModelBI.Controllers.BITest
|
|
|
return Ok(new { state = 200, dateHours, dateHours1, dateHours2, dateDay, dateDays, dateMonth, });
|
|
|
}
|
|
|
|
|
|
- public async Task<IActionResult> GetRedisToTable(JsonElement jsonElement)
|
|
|
+ [HttpPost("get-fmember")]
|
|
|
+ public async Task<IActionResult> GetFMember(JsonElement jsonElement)
|
|
|
{
|
|
|
- return Ok(new { state = 200 });
|
|
|
+ var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
+
|
|
|
+ if (!jsonElement.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!jsonElement.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!jsonElement.TryGetProperty("actType", out JsonElement actType)) return BadRequest();
|
|
|
+
|
|
|
+ List<string> classes = new();
|
|
|
+ List<string> stuLists = new();
|
|
|
+ List<string> tchLists = new();
|
|
|
+ List<(string pId, List<string> gid)> ps = new();
|
|
|
+ string school = null;
|
|
|
+
|
|
|
+ if ($"{actType}".Equals("Study"))
|
|
|
+ {
|
|
|
+ Study study = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Study>($"{id}", new Azure.Cosmos.PartitionKey($"Study-{code}"));
|
|
|
+ if (study.groupLists.Count > 0)
|
|
|
+ {
|
|
|
+ var group = study.groupLists;
|
|
|
+ foreach (var gp in group)
|
|
|
+ {
|
|
|
+ foreach (KeyValuePair<string, List<string>> pp in gp)
|
|
|
+ {
|
|
|
+ ps.Add((pp.Key, pp.Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classes = study.classes;
|
|
|
+ stuLists = study.stuLists;
|
|
|
+ tchLists = study.tchLists;
|
|
|
+ school = study.school;
|
|
|
+ }
|
|
|
+ else if ($"{actType}".Equals("Vote"))
|
|
|
+ {
|
|
|
+ Vote vote = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>($"{id}", new Azure.Cosmos.PartitionKey($"Vote-{code}"));
|
|
|
+ classes = vote.classes;
|
|
|
+ stuLists = vote.stuLists;
|
|
|
+ tchLists = vote.tchLists;
|
|
|
+ school = vote.school;
|
|
|
+ }
|
|
|
+ else if ($"{actType}".Equals("Homework"))
|
|
|
+ {
|
|
|
+ Homework work = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Homework>($"{id}", new Azure.Cosmos.PartitionKey($"Homework-{code}"));
|
|
|
+ classes = work.classes;
|
|
|
+ stuLists = work.stuLists;
|
|
|
+ tchLists = work.tchLists;
|
|
|
+ school = work.school;
|
|
|
+ }
|
|
|
+ else if ($"{actType}".Equals("Survey"))
|
|
|
+ {
|
|
|
+ Survey survey = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>($"{id}", new Azure.Cosmos.PartitionKey($"Survey-{code}"));
|
|
|
+ classes = survey.classes;
|
|
|
+ stuLists = survey.stuLists;
|
|
|
+ tchLists = survey.tchLists;
|
|
|
+ school = survey.school;
|
|
|
+ }
|
|
|
+ else if ($"{actType}".Equals("ExamLite"))
|
|
|
+ {
|
|
|
+ ExamLite examLite = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamLite>($"{id}", new Azure.Cosmos.PartitionKey($"ExamLite-{code}"));
|
|
|
+ classes = examLite.classes;
|
|
|
+ stuLists = examLite.stuLists;
|
|
|
+ tchLists = examLite.tchLists;
|
|
|
+ school = examLite.school;
|
|
|
+ }
|
|
|
+ else if ($"{actType}".Equals("Exam"))
|
|
|
+ {
|
|
|
+ ExamInfo examInfo = await cosmosClient.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>($"{id}", new Azure.Cosmos.PartitionKey($"ExamLite-{code}"));
|
|
|
+ classes = examInfo.classes;
|
|
|
+ stuLists = examInfo.stuLists;
|
|
|
+ school = examInfo.school;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FMember> idsList = await GroupListService.GetFinishMemberInfo(_coreAPIHttpService, cosmosClient, _dingDing, school, classes, stuLists, tchLists, ps);
|
|
|
+
|
|
|
+ return Ok(new { state = 200, idsList });
|
|
|
}
|
|
|
|
|
|
}
|