|
@@ -68,12 +68,12 @@ namespace TEAMModelOS.Controllers
|
|
request.code = "Exam-" + request.code;
|
|
request.code = "Exam-" + request.code;
|
|
request.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
request.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
int stuCount = 0;
|
|
int stuCount = 0;
|
|
- for (int i = 0; i < request.targetClassIds.Count; i++)
|
|
|
|
|
|
+ for (int i = 0; i < request.classes.Count; i++)
|
|
{
|
|
{
|
|
List<string> ids = new List<string>();
|
|
List<string> ids = new List<string>();
|
|
//处理班级人数(公共部分的校本名单)
|
|
//处理班级人数(公共部分的校本名单)
|
|
//List<Student> students = new List<Student>();
|
|
//List<Student> students = new List<Student>();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{request.school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.classId = '{request.classes[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{request.school}") }))
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -90,7 +90,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
//处理发布对象为自选名单(个人)
|
|
//处理发布对象为自选名单(个人)
|
|
List<StuList> stuLists = new List<StuList>();
|
|
List<StuList> stuLists = new List<StuList>();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.classes[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
|
|
{
|
|
{
|
|
stuLists.Add(item);
|
|
stuLists.Add(item);
|
|
}
|
|
}
|
|
@@ -121,7 +121,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
//发布对象为自选名单(校本)
|
|
//发布对象为自选名单(校本)
|
|
List<StuList> stuLists = new List<StuList>();
|
|
List<StuList> stuLists = new List<StuList>();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.targetClassIds[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{request.classes[i]}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{code}") }))
|
|
{
|
|
{
|
|
stuLists.Add(item);
|
|
stuLists.Add(item);
|
|
}
|
|
}
|
|
@@ -276,23 +276,23 @@ namespace TEAMModelOS.Controllers
|
|
try
|
|
try
|
|
{
|
|
{
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
- var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c ";
|
|
|
|
|
|
+ var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.classes from c ";
|
|
if (requert.TryGetProperty("classIds", out JsonElement classIds)) {
|
|
if (requert.TryGetProperty("classIds", out JsonElement classIds)) {
|
|
List<string> ids = classIds.ToObject<List<string>>();
|
|
List<string> ids = classIds.ToObject<List<string>>();
|
|
HashSet<string> strs = new HashSet<string>();
|
|
HashSet<string> strs = new HashSet<string>();
|
|
if (ids.Count > 1)
|
|
if (ids.Count > 1)
|
|
{
|
|
{
|
|
foreach (string id in ids) {
|
|
foreach (string id in ids) {
|
|
- strs.Add($"array_contains(c.targetClassIds,'{id}')");
|
|
|
|
|
|
+ strs.Add($"array_contains(c.classes,'{id}')");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
string ssr = ids.Count > 0 ? ids[0] : "";
|
|
string ssr = ids.Count > 0 ? ids[0] : "";
|
|
- strs.Add($"array_contains(c.targetClassIds,'{ssr}')");
|
|
|
|
|
|
+ strs.Add($"array_contains(c.classes,'{ssr}')");
|
|
}
|
|
}
|
|
string ss = string.Join(" or ", strs);
|
|
string ss = string.Join(" or ", strs);
|
|
- query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.targetClassIds from c where ({ss})";
|
|
|
|
|
|
+ query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope,c.classes from c where ({ss})";
|
|
};
|
|
};
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<ExamInfo> examInfo = new List<ExamInfo>();
|
|
List<ExamInfo> examInfo = new List<ExamInfo>();
|
|
@@ -880,7 +880,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- var queryClassId = $"select c.targetClassIds id from c where c.id ='{id}'";
|
|
|
|
|
|
+ var queryClassId = $"select c.classes id from c where c.id ='{id}'";
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
@@ -1023,7 +1023,7 @@ namespace TEAMModelOS.Controllers
|
|
{
|
|
{
|
|
foreach (string str in resultIds)
|
|
foreach (string str in resultIds)
|
|
{
|
|
{
|
|
- strs.Add($"array_contains(c.targetClassIds,'{str}')");
|
|
|
|
|
|
+ strs.Add($"array_contains(c.classes,'{str}')");
|
|
//builder.Append($"array_contains(c.targetClassIds,'{str}')").Append("or");
|
|
//builder.Append($"array_contains(c.targetClassIds,'{str}')").Append("or");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1031,7 +1031,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
string ssr = resultIds.Count > 0 ? resultIds[0] : "";
|
|
string ssr = resultIds.Count > 0 ? resultIds[0] : "";
|
|
- strs.Add($"array_contains(c.targetClassIds,'{ssr}')");
|
|
|
|
|
|
+ strs.Add($"array_contains(c.classes,'{ssr}')");
|
|
//builder.Append($" array_contains(c.targetClassIds,'{ssr}')");
|
|
//builder.Append($" array_contains(c.targetClassIds,'{ssr}')");
|
|
}
|
|
}
|
|
string ss = string.Join(" or ", strs);
|
|
string ss = string.Join(" or ", strs);
|