|
@@ -423,14 +423,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find")]
|
|
|
- public async Task<IActionResult> Find(JsonElement requert)
|
|
|
+ public async Task<IActionResult> Find(JsonElement request)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
StringBuilder stringBuilder = new($"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime,c.source, c.subjects, c.grades,c.owner, c.scope,c.classes, c.stuLists, c.sRate,c.lostStu,c.sStatus,c.qamode,c.school from c where (c.status<>404 or IS_DEFINED(c.status) = false) ");
|
|
|
- if (requert.TryGetProperty("classIds", out JsonElement classIds))
|
|
|
+ if (request.TryGetProperty("classIds", out JsonElement classIds))
|
|
|
{
|
|
|
List<string> ids = classIds.ToObject<List<string>>();
|
|
|
HashSet<string> strs = new HashSet<string>();
|
|
@@ -449,19 +449,19 @@ namespace TEAMModelOS.Controllers
|
|
|
string ss = string.Join(" or ", strs);
|
|
|
stringBuilder.Append($" and {ss}");
|
|
|
};
|
|
|
- if (requert.TryGetProperty("period", out JsonElement period) && !string.IsNullOrWhiteSpace($"{period}"))
|
|
|
+ if (request.TryGetProperty("period", out JsonElement period) && !string.IsNullOrWhiteSpace($"{period}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.period.id = '{period}' ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("name", out JsonElement name) && !string.IsNullOrWhiteSpace($"{name}"))
|
|
|
+ if (request.TryGetProperty("name", out JsonElement name) && !string.IsNullOrWhiteSpace($"{name}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and Contains( c.name , '{name}') = true ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("progress", out JsonElement progress) && !string.IsNullOrWhiteSpace($"{progress}"))
|
|
|
+ if (request.TryGetProperty("progress", out JsonElement progress) && !string.IsNullOrWhiteSpace($"{progress}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.progress = '{progress}' ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("source", out JsonElement source) && !string.IsNullOrWhiteSpace($"{source}"))
|
|
|
+ if (request.TryGetProperty("source", out JsonElement source) && !string.IsNullOrWhiteSpace($"{source}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.source = '{source}' ");
|
|
|
}
|
|
@@ -470,7 +470,7 @@ namespace TEAMModelOS.Controllers
|
|
|
string token = default;
|
|
|
//默认不指定返回大小
|
|
|
int? topcout = null;
|
|
|
- if (requert.TryGetProperty("count", out JsonElement jcount))
|
|
|
+ if (request.TryGetProperty("count", out JsonElement jcount))
|
|
|
{
|
|
|
if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
|
|
|
{
|
|
@@ -484,7 +484,7 @@ namespace TEAMModelOS.Controllers
|
|
|
iscontinuation = true;
|
|
|
}
|
|
|
//如果指定了返回大小
|
|
|
- if (requert.TryGetProperty("token", out JsonElement token_1))
|
|
|
+ if (request.TryGetProperty("token", out JsonElement token_1))
|
|
|
{
|
|
|
if (!token_1.ValueKind.Equals(JsonValueKind.Null) && token_1.ValueKind.Equals(JsonValueKind.String))
|
|
|
{
|
|
@@ -527,11 +527,11 @@ namespace TEAMModelOS.Controllers
|
|
|
/* [Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]*/
|
|
|
[HttpPost("find-by-analysis")]
|
|
|
- public async Task<IActionResult> FindByAnalysis(JsonElement requert)
|
|
|
+ public async Task<IActionResult> FindByAnalysis(JsonElement request)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("SchoolYear");
|
|
|
List<SchoolYear> years = await table.FindListByDict<SchoolYear>(new Dictionary<string, object>() { { "RowKey", code }, { "PartitionKey", "Exam" } });
|
|
@@ -589,49 +589,49 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
string sub = string.Empty;
|
|
|
string subject = string.Empty;
|
|
|
- if (requert.TryGetProperty("subjectId", out JsonElement subjectId) && !string.IsNullOrWhiteSpace($"{subjectId}"))
|
|
|
+ if (request.TryGetProperty("subjectId", out JsonElement subjectId) && !string.IsNullOrWhiteSpace($"{subjectId}"))
|
|
|
{
|
|
|
sub = $" join A0 in c.subjects ";
|
|
|
subject = $" and A0.id = '{subjectId}'";
|
|
|
}
|
|
|
string grade = string.Empty;
|
|
|
string grades = string.Empty;
|
|
|
- if (requert.TryGetProperty("grades", out JsonElement gs) && !string.IsNullOrWhiteSpace($"{gs}"))
|
|
|
+ if (request.TryGetProperty("grades", out JsonElement gs) && !string.IsNullOrWhiteSpace($"{gs}"))
|
|
|
{
|
|
|
grade = $" join A1 in c.grades ";
|
|
|
grades = $" and A1.id = '{gs}'";
|
|
|
}
|
|
|
StringBuilder stringBuilder = new StringBuilder($"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime,c.source, c.subjects, c.grades,c.owner, c.scope,c.classes,c.sRate,c.lostStu,c.sStatus,c.qamode,c.school from c {sub} {grade}" +
|
|
|
$"where (c.status<>404 or IS_DEFINED(c.status) = false) and c.scope = 'school' and c.school = '{code}' and c.pk = 'Exam' {subject} {grades}");
|
|
|
- if (requert.TryGetProperty("period", out JsonElement period) && !string.IsNullOrWhiteSpace($"{period}"))
|
|
|
+ if (request.TryGetProperty("period", out JsonElement period) && !string.IsNullOrWhiteSpace($"{period}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.period.id = '{period}' ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("owner", out JsonElement owner) && !string.IsNullOrWhiteSpace($"{owner}"))
|
|
|
+ if (request.TryGetProperty("owner", out JsonElement owner) && !string.IsNullOrWhiteSpace($"{owner}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.owner= '{owner}' ");
|
|
|
}
|
|
|
|
|
|
- if (requert.TryGetProperty("year", out JsonElement yy) && !string.IsNullOrWhiteSpace($"{yy}"))
|
|
|
+ if (request.TryGetProperty("year", out JsonElement yy) && !string.IsNullOrWhiteSpace($"{yy}"))
|
|
|
{
|
|
|
int end = yy.GetInt32() + 1;
|
|
|
long stime = DateTimeOffset.Parse($"{yy.GetInt32()}-1-1").ToUnixTimeMilliseconds();
|
|
|
long etime = DateTimeOffset.Parse($"{end}-1-1").ToUnixTimeMilliseconds();
|
|
|
stringBuilder.Append($" and c.startTime >= {stime} and c.startTime < {etime} ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("name", out JsonElement name) && !string.IsNullOrWhiteSpace($"{name}"))
|
|
|
+ if (request.TryGetProperty("name", out JsonElement name) && !string.IsNullOrWhiteSpace($"{name}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and Contains( c.name , '{name}') = true ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("examType", out JsonElement examType) && !string.IsNullOrWhiteSpace($"{examType}"))
|
|
|
+ if (request.TryGetProperty("examType", out JsonElement examType) && !string.IsNullOrWhiteSpace($"{examType}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.examType.id = '{examType}' ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("progress", out JsonElement progress) && !string.IsNullOrWhiteSpace($"{progress}"))
|
|
|
+ if (request.TryGetProperty("progress", out JsonElement progress) && !string.IsNullOrWhiteSpace($"{progress}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.progress = '{progress}' ");
|
|
|
}
|
|
|
- if (requert.TryGetProperty("source", out JsonElement source) && !string.IsNullOrWhiteSpace($"{source}"))
|
|
|
+ if (request.TryGetProperty("source", out JsonElement source) && !string.IsNullOrWhiteSpace($"{source}"))
|
|
|
{
|
|
|
stringBuilder.Append($" and c.source = '{source}' ");
|
|
|
}
|
|
@@ -639,13 +639,13 @@ namespace TEAMModelOS.Controllers
|
|
|
string token = default;
|
|
|
//是否需要进行分页查询,默认不分页
|
|
|
bool iscontinuation = false;
|
|
|
- if (requert.TryGetProperty("token", out JsonElement token_1))
|
|
|
+ if (request.TryGetProperty("token", out JsonElement token_1))
|
|
|
{
|
|
|
token = token_1.GetString();
|
|
|
};
|
|
|
//默认不指定返回大小
|
|
|
int? topcout = null;
|
|
|
- if (requert.TryGetProperty("count", out JsonElement jcount))
|
|
|
+ if (request.TryGetProperty("count", out JsonElement jcount))
|
|
|
{
|
|
|
if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
|
|
|
{
|
|
@@ -703,12 +703,12 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find-summary")]
|
|
|
- public async Task<IActionResult> FindSummary(JsonElement requert)
|
|
|
+ public async Task<IActionResult> FindSummary(JsonElement request)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<ExamInfo> examInfo = new List<ExamInfo>();
|
|
@@ -1347,14 +1347,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find-summary-record")]
|
|
|
- public async Task<IActionResult> findSummaryRecord(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findSummaryRecord(JsonElement request)
|
|
|
{
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("classId", out JsonElement classId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement school_code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("classId", out JsonElement classId)) return BadRequest();
|
|
|
try
|
|
|
{
|
|
|
// 如果只有学生id则返回学生参加过的考试 只返回相关摘要信息
|
|
@@ -1484,7 +1484,7 @@ namespace TEAMModelOS.Controllers
|
|
|
//List<ufo> students = new List<ufo>();
|
|
|
|
|
|
|
|
|
- /*if (StringHelper.getKeyCount(requert) == 1 && requert.TryGetProperty("code", out JsonElement code))
|
|
|
+ /*if (StringHelper.getKeyCount(request) == 1 && request.TryGetProperty("code", out JsonElement code))
|
|
|
{
|
|
|
List<object> props = new List<object>();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select c.id, c.code, c.examCode, c.status ,c.mark, c.score from c where c.id = {id}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"ExamRecord-{school_code}") }))
|
|
@@ -1502,7 +1502,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (requert.TryGetProperty("examCode", out JsonElement _))
|
|
|
+ if (request.TryGetProperty("examCode", out JsonElement _))
|
|
|
{
|
|
|
//List<string> props = new List<string> { "id", "code", "examCode", "status", "mark", "score" };
|
|
|
//List<ExamRecord> examRecords = await _azureCosmos.FindByDict<ExamRecord>(request, props);
|
|
@@ -1536,15 +1536,15 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "student,teacher,admin")]
|
|
|
[HttpPost("find-summary-by-student")]
|
|
|
- public async Task<IActionResult> findSummaryStudent(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findSummaryStudent(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("cIds", out JsonElement cIds)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("scode", out JsonElement scode)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("cIds", out JsonElement cIds)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("scode", out JsonElement scode)) return BadRequest();
|
|
|
try
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
@@ -1916,14 +1916,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "student")]
|
|
|
[HttpPost("find-all-by-student")]
|
|
|
- public async Task<IActionResult> findAllStudent(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findAllStudent(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
|
List<string> resultIds = new List<string>();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//查询校本班级ID
|
|
@@ -1975,7 +1975,7 @@ namespace TEAMModelOS.Controllers
|
|
|
//builder.Append($" array_contains(c.targetClassIds,'{ssr}')");
|
|
|
}
|
|
|
string ss = string.Join(" or ", strs);
|
|
|
- //if (!requert.TryGetProperty("school", out JsonElement school)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("school", out JsonElement school)) return BadRequest();
|
|
|
|
|
|
var query = $"select c.id,c.code,c.name,c.startTime,c.endTime,c.type,c.progress,c.school,c.scope from c where ({ss}) and c.progress != 'pending' ";
|
|
|
List<object> props = new List<object>();
|
|
@@ -2030,14 +2030,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "student")]
|
|
|
[HttpPost("find-score-by-student")]
|
|
|
- public async Task<IActionResult> findScoreByStudent(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findScoreByStudent(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var query = $"select c.examId,c.subjectId,c.studentScores from c where array_contains(c.studentIds,'{id}') ";
|
|
|
List<object> props = new List<object>();
|
|
@@ -2069,14 +2069,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("finish")]
|
|
|
- public async Task<IActionResult> finish(JsonElement requert)
|
|
|
+ public async Task<IActionResult> finish(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
info.progress = "finish";
|
|
@@ -2122,15 +2122,15 @@ namespace TEAMModelOS.Controllers
|
|
|
[ProducesDefaultResponseType]
|
|
|
//[AuthToken(Roles = "Student")]
|
|
|
[HttpPost("scoring")]
|
|
|
- public async Task<IActionResult> Scoring(JsonElement requert)
|
|
|
+ public async Task<IActionResult> Scoring(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
ExamInfo info = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
int index = 0;
|
|
@@ -2207,18 +2207,18 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("scoring")]
|
|
|
- public async Task<IActionResult> scoring(JsonElement requert)
|
|
|
+ public async Task<IActionResult> scoring(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("count", out JsonElement scount)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("count", out JsonElement scount)) return BadRequest();
|
|
|
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//var redisClient = _azureRedis.GetRedisClient(8);
|
|
@@ -2329,7 +2329,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (requert.TryGetProperty("stuId", out JsonElement stuId))
|
|
|
+ if (request.TryGetProperty("stuId", out JsonElement stuId))
|
|
|
{
|
|
|
objs = await Review(attrSc, id.GetString(), code.GetString(), subjectId.GetString(), scount.GetInt32(), tId.GetString(), stuId.GetString());
|
|
|
}
|
|
@@ -2356,16 +2356,16 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find-err")]
|
|
|
- public async Task<IActionResult> findErr(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findErr(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var response = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"Exam-{code}"));
|
|
|
if (response.Status == 200)
|
|
@@ -2424,17 +2424,17 @@ namespace TEAMModelOS.Controllers
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find-arb")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> findArb(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findArb(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("et", out JsonElement et)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("et", out JsonElement et)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
long time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
if (et.GetInt64() > time)
|
|
@@ -2694,20 +2694,20 @@ namespace TEAMModelOS.Controllers
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("sub-result")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> SubResult(JsonElement requert)
|
|
|
+ public async Task<IActionResult> SubResult(JsonElement request)
|
|
|
{
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
//var (id, school) = HttpContext.GetAuthTokenInfo();
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("stuId", out JsonElement sId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("score", out JsonElement score)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("count", out JsonElement count)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- requert.TryGetProperty("mark", out JsonElement mark);
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("stuId", out JsonElement sId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("score", out JsonElement score)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("count", out JsonElement count)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ request.TryGetProperty("mark", out JsonElement mark);
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var (userid, name, _, school) = HttpContext.GetAuthTokenInfo();
|
|
|
//取得学校基本信息
|
|
@@ -2738,7 +2738,7 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
int itemIndex = 0;
|
|
|
//int tIdIndex = scoring.tIds.IndexOf(tId.GetString());
|
|
|
- if (requert.TryGetProperty("qu", out JsonElement qu))
|
|
|
+ if (request.TryGetProperty("qu", out JsonElement qu))
|
|
|
{
|
|
|
List<int> nos = qu.ToObject<List<int>>();
|
|
|
foreach (int number in nos)
|
|
@@ -2953,14 +2953,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("find-scoring")]
|
|
|
- public async Task<IActionResult> findScoring(JsonElement requert)
|
|
|
+ public async Task<IActionResult> findScoring(JsonElement request)
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("stuId", out JsonElement sId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("stuId", out JsonElement sId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("type", out JsonElement type)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<SDK.Models.Cosmos.Common.Scoring> attr = new();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<SDK.Models.Cosmos.Common.Scoring>(
|
|
@@ -2977,13 +2977,13 @@ namespace TEAMModelOS.Controllers
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("save-err")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> saveErr(JsonElement requert)
|
|
|
+ public async Task<IActionResult> saveErr(JsonElement request)
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("err", out JsonElement err)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("index", out JsonElement index)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("err", out JsonElement err)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("index", out JsonElement index)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var (userid, name, _, school) = HttpContext.GetAuthTokenInfo();
|
|
|
//取得学校基本信息
|
|
@@ -3056,13 +3056,13 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("fd-err")]
|
|
|
- public async Task<IActionResult> fdErr(JsonElement requert)
|
|
|
+ public async Task<IActionResult> fdErr(JsonElement request)
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("improve", out JsonElement improve)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("index", out JsonElement index)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("improve", out JsonElement improve)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("index", out JsonElement index)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
SDK.Models.Cosmos.Common.Scoring scoring = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemAsync<SDK.Models.Cosmos.Common.Scoring>(id.GetString(), new PartitionKey($"Scoring-{code}"));
|
|
|
if (null != scoring)
|
|
@@ -3094,12 +3094,12 @@ namespace TEAMModelOS.Controllers
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("save-arb")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> saveArb(JsonElement requert)
|
|
|
+ public async Task<IActionResult> saveArb(JsonElement request)
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("score", out JsonElement score)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("index", out JsonElement indexScore)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("score", out JsonElement score)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("index", out JsonElement indexScore)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//List<double> scs = score.ToObject<List<double>>();
|
|
|
List<ExamClassResult> classResults = new();
|
|
@@ -3140,11 +3140,11 @@ namespace TEAMModelOS.Controllers
|
|
|
[AuthToken(Roles = "teacher,admin,student")]
|
|
|
[HttpPost("score")]
|
|
|
[Authorize(Roles = "IES")]
|
|
|
- public async Task<IActionResult> score(JsonElement requert)
|
|
|
+ public async Task<IActionResult> score(JsonElement request)
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("courseId", out JsonElement courseId)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("cId", out JsonElement cId)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("courseId", out JsonElement courseId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("cId", out JsonElement cId)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
List<(string eId, string cId, string cname, List<string> sIds, List<double> sum)> classResults = new();
|
|
|
List<string> eIds = new();
|
|
@@ -3182,7 +3182,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
string sub = string.Empty;
|
|
|
- if (requert.TryGetProperty("subjectId", out JsonElement subjectId))
|
|
|
+ if (request.TryGetProperty("subjectId", out JsonElement subjectId))
|
|
|
{
|
|
|
sub = subjectId.GetString();
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Common").GetItemQueryStreamIterator(
|
|
@@ -3265,7 +3265,7 @@ namespace TEAMModelOS.Controllers
|
|
|
papers = exam.Where(e => e.id.Equals(x.eId)).FirstOrDefault().points,
|
|
|
sum = x.sum
|
|
|
});
|
|
|
- if (requert.TryGetProperty("stuId", out JsonElement stuId))
|
|
|
+ if (request.TryGetProperty("stuId", out JsonElement stuId))
|
|
|
{
|
|
|
var info = scores.Where(x => !string.IsNullOrEmpty(x.examName) && x.studentIds.Contains(stuId.GetString())).Select(x => new
|
|
|
{
|
|
@@ -3307,14 +3307,14 @@ namespace TEAMModelOS.Controllers
|
|
|
[Authorize(Roles = "IES")]
|
|
|
[AuthToken(Roles = "teacher,admin")]
|
|
|
[HttpPost("analysis-scoring")]
|
|
|
- public async Task<IActionResult> Analysis(JsonElement requert)
|
|
|
+ public async Task<IActionResult> Analysis(JsonElement request)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if (!requert.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
- if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
- //if (!requert.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("id", out JsonElement id)) return BadRequest();
|
|
|
+ if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("subjectId", out JsonElement subjectId)) return BadRequest();
|
|
|
+ //if (!request.TryGetProperty("tmdId", out JsonElement tId)) return BadRequest();
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
var queryTeacher = $"select c.id,c.name from c ";
|
|
|
//List<object> props = new List<object>();
|