|
@@ -19,6 +19,7 @@ using TEAMModelOS.SDK.DI.AzureCosmos.Inner;
|
|
|
using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Models;
|
|
|
using TEAMModelOS.SDK.Models.Cosmos.Common;
|
|
|
+using TEAMModelOS.SDK.Models.Cosmos.Teacher;
|
|
|
using TEAMModelOS.SDK.Models.Service;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
@@ -335,7 +336,7 @@ namespace TEAMModelOS.Controllers
|
|
|
homework.targetType = "research";
|
|
|
//homework.blob = $"/{homework.areaId}/survey/{study.pId}/index.json";
|
|
|
await getMoreWork(pa, homework);
|
|
|
- string workId = await HomeworkService.saveMoreAsync(client, _dingDing, homework,_serviceBus,_azureStorage,_configuration);
|
|
|
+ string workId = await HomeworkService.saveMoreAsync(client, _dingDing, homework, _serviceBus, _azureStorage, _configuration);
|
|
|
if (string.IsNullOrEmpty(workId))
|
|
|
{
|
|
|
return Ok(new { code = (int)HttpStatusCode.BadRequest, msg = "作业活动异常" });
|
|
@@ -430,7 +431,7 @@ namespace TEAMModelOS.Controllers
|
|
|
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)
|
|
|
+ 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}") }))
|
|
|
{
|
|
@@ -447,6 +448,7 @@ namespace TEAMModelOS.Controllers
|
|
|
(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))
|
|
|
{
|
|
|
|
|
@@ -480,6 +482,22 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
moreInfo.Add((tchList, study));
|
|
|
};
|
|
|
+ //提取研修相关老师活动记录
|
|
|
+ List<StudyRecord> records = new();
|
|
|
+ foreach (var (teac, stu) in moreInfo)
|
|
|
+ {
|
|
|
+ foreach (var member in teac)
|
|
|
+ {
|
|
|
+ var response = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemStreamAsync(id.ToString(), new PartitionKey($"StudyRecord-{member.id}"));
|
|
|
+ if (response.Status == (int)HttpStatusCode.OK)
|
|
|
+ {
|
|
|
+ var json = await JsonDocument.ParseAsync(response.ContentStream);
|
|
|
+ StudyRecord record = json.ToObject<StudyRecord>();
|
|
|
+ records.Add(record);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
var survey = trSurveys.Select(s => new
|
|
|
{
|
|
|
count = s.teac.Count,
|
|
@@ -501,11 +519,11 @@ namespace TEAMModelOS.Controllers
|
|
|
name = ps.FirstOrDefault(c => c.id == s.stu.id).name,
|
|
|
count = s.teac.Count,
|
|
|
//hwCount = s.teachers.Where(h => h.hwTime > 0).ToList().Count,
|
|
|
- signCount = s.stu.teachers.Where(h => h.signTime > 0).ToList().Count,
|
|
|
- lateCount = s.stu.teachers.Where(h => !string.IsNullOrEmpty(h.sign) && h.sign.Equals("1")).ToList().Count,
|
|
|
- acount = s.stu.teachers.Where(h => h.aTime > 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 => new { m.teac, m.stu }) });
|
|
|
+ return Ok(new { survey, work = twork, exam, info, studies = moreInfo.Select(m => new { m.teac, m.stu }) });
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -568,7 +586,7 @@ namespace TEAMModelOS.Controllers
|
|
|
//List<string> aName = new();
|
|
|
List<Vote> votes = new List<Vote>();
|
|
|
Vote vote = null;
|
|
|
- List<(string code,string name, string url, int count)> recordUrl = new List<(string code, string name, string url, int count)>();
|
|
|
+ List<(string code, string name, string url, int count)> recordUrl = new List<(string code, string name, string url, int count)>();
|
|
|
var response = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id.GetString(), new PartitionKey($"Vote-{areaId}"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
@@ -590,7 +608,7 @@ namespace TEAMModelOS.Controllers
|
|
|
(List<RMember> tchList, List<RGroupList> classInfos) = await GroupListService.GetStutmdidListids(client, _dingDing, tcs, code);
|
|
|
// (List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{school}");
|
|
|
//(List<TmdInfo> tchList, _) = await TriggerStuActivity.GetTchList(client, _dingDing, tcs, code);
|
|
|
- recordUrl.Add((code,name, account.GetProperty("recordUrl").GetString(), tchList.Count));
|
|
|
+ recordUrl.Add((code, name, account.GetProperty("recordUrl").GetString(), tchList.Count));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -598,7 +616,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
|
|
|
//var info = ps.Select(p => new { p.id, p.name });
|
|
|
- return Ok(new { vote, code = recordUrl.Select(r => new { r.code,r.name, r.url, r.count }) });
|
|
|
+ return Ok(new { vote, code = recordUrl.Select(r => new { r.code, r.name, r.url, r.count }) });
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -659,7 +677,7 @@ namespace TEAMModelOS.Controllers
|
|
|
List<(string id, string name)> baseIds = await getId(client, areaId.GetString());
|
|
|
List<object> surveys = new();
|
|
|
Survey survey = null;
|
|
|
- List<(string code, string name,string url, int count)> recordUrl = new List<(string code, string name,string url, int count)>();
|
|
|
+ List<(string code, string name, string url, int count)> recordUrl = new List<(string code, string name, string url, int count)>();
|
|
|
var response = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id.GetString(), new PartitionKey($"Survey-{areaId}"));
|
|
|
if (response.Status == 200)
|
|
|
{
|
|
@@ -682,7 +700,7 @@ namespace TEAMModelOS.Controllers
|
|
|
// (List<TmdInfo> tmdInfos, List<ClassListInfo> classInfos) = await TriggerStuActivity.GetTchList(client, _dingDing, ids, $"{school}");
|
|
|
//(List<TmdInfo> tchList, _) = await TriggerStuActivity.GetTchList(client, _dingDing, tcs, code);
|
|
|
|
|
|
- recordUrl.Add((code, name,account.GetProperty("recordUrl").GetString(), tchList.Count));
|
|
|
+ recordUrl.Add((code, name, account.GetProperty("recordUrl").GetString(), tchList.Count));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -690,7 +708,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
|
|
|
//var info = ps.Select(p => new { p.id, p.name });
|
|
|
- return Ok(new { survey, code = recordUrl.Select(r => new { r.code,r.name, r.url, r.count }) });
|
|
|
+ return Ok(new { survey, code = recordUrl.Select(r => new { r.code, r.name, r.url, r.count }) });
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -1061,13 +1079,13 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
await getMoreSurvey(pa, trSurvey);
|
|
|
|
|
|
- trSurvey.id = Guid.NewGuid().ToString();
|
|
|
- trSurvey.recordUrl = $"/survey/{trSurvey.id}/record.json";
|
|
|
- var cods = new { records = new List<string>(), userids = new List<string>(), question = new List<QuestionRecord>() };
|
|
|
- await _azureStorage.UploadFileByContainer(code, cods.ToJsonString(), "survey", $"{trSurvey.id}/record.json");
|
|
|
- // trSurvey.blob = SurveyService.getBlob(trSurvey.id);
|
|
|
- await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(trSurvey, new PartitionKey($"{trSurvey.code}"));
|
|
|
-
|
|
|
+ trSurvey.id = Guid.NewGuid().ToString();
|
|
|
+ trSurvey.recordUrl = $"/survey/{trSurvey.id}/record.json";
|
|
|
+ var cods = new { records = new List<string>(), userids = new List<string>(), question = new List<QuestionRecord>() };
|
|
|
+ await _azureStorage.UploadFileByContainer(code, cods.ToJsonString(), "survey", $"{trSurvey.id}/record.json");
|
|
|
+ // trSurvey.blob = SurveyService.getBlob(trSurvey.id);
|
|
|
+ await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync(trSurvey, new PartitionKey($"{trSurvey.code}"));
|
|
|
+
|
|
|
surveys.Add(trSurvey);
|
|
|
}
|
|
|
//areaSurvey.targets = allName;
|
|
@@ -1187,7 +1205,7 @@ namespace TEAMModelOS.Controllers
|
|
|
private async Task<List<(string id, string name)>> getId(CosmosClient client, string id)
|
|
|
{
|
|
|
//获取区级以下所有学校编码和基础信息
|
|
|
- List<(string id,string name)> baseIds = new();
|
|
|
+ List<(string id, string name)> baseIds = new();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"select c.id,c.name from c where c.areaId = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|