|
@@ -741,10 +741,10 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
}
|
|
|
[ProducesDefaultResponseType]
|
|
|
- /* [Authorize(Roles = "IES")]
|
|
|
- [AuthToken(Roles = "teacher,admin")]*/
|
|
|
- [HttpPost("find-recod")]
|
|
|
- public async Task<IActionResult> findRecod(JsonElement request)
|
|
|
+ [Authorize(Roles = "IES")]
|
|
|
+ [AuthToken(Roles = "teacher,admin")]
|
|
|
+ [HttpPost("settle-recod")]
|
|
|
+ public async Task<IActionResult> settleRecod(JsonElement request)
|
|
|
{
|
|
|
//if (!request.TryGetProperty("tmdId", out JsonElement tmdId)) return BadRequest();
|
|
|
if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
@@ -754,42 +754,8 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
try
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
- List<LessonRecord> records = new List<LessonRecord>();
|
|
|
- StringBuilder sql = new StringBuilder($"select value(c) from c where c.school = '{code}' and c.periodId = '{periodId}'");
|
|
|
- /*if (request.TryGetProperty("tmdname", out JsonElement tmdname))
|
|
|
- {
|
|
|
- sql.Append($" and c.tmdname='{tmdname}'");
|
|
|
- }
|
|
|
- if (request.TryGetProperty("name", out JsonElement name))
|
|
|
- {
|
|
|
- sql.Append($" and c.name='{name}'");
|
|
|
- }
|
|
|
- if (request.TryGetProperty("grade", out JsonElement grade))
|
|
|
- {
|
|
|
- sql.Append($" and c.grade='{grade}'");
|
|
|
- }
|
|
|
- if (request.TryGetProperty("subjectId", out JsonElement subjectId))
|
|
|
- {
|
|
|
- sql.Append($" and c.subjectId='{subjectId}'");
|
|
|
- }*/
|
|
|
- /*string continuationToken = string.Empty;
|
|
|
- string token = default;
|
|
|
- //是否需要进行分页查询,默认不分页
|
|
|
- bool iscontinuation = false;
|
|
|
- if (request.TryGetProperty("token", out JsonElement token_1))
|
|
|
- {
|
|
|
- token = token_1.GetString();
|
|
|
- iscontinuation = true;
|
|
|
- };
|
|
|
- //默认不指定返回大小
|
|
|
- int? topcout = null;
|
|
|
- if (request.TryGetProperty("count", out JsonElement jcount))
|
|
|
- {
|
|
|
- if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
|
|
|
- {
|
|
|
- topcout = data;
|
|
|
- }
|
|
|
- }*/
|
|
|
+ List<LessonRecord> records = new();
|
|
|
+ StringBuilder sql = new($"select c.periodId,c.tmdid,c.collateTaskCount,c.collateCount,c.clientInteractionCount,c.scpoe from c where c.school = '{code}' and c.periodId = '{periodId}'");
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(
|
|
|
queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{code}") }))
|
|
|
{
|
|
@@ -800,12 +766,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
{
|
|
|
records.Add(obj.ToObject<LessonRecord>());
|
|
|
}
|
|
|
- }
|
|
|
- /*if (iscontinuation)
|
|
|
- {
|
|
|
- continuationToken = item.GetContinuationToken();
|
|
|
- break;
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
double total = records.Count;
|
|
|
double teachCount = records.Where((x, i) => records.FindIndex(z => z.tmdid == x.tmdid) == i).ToList().Count;
|
|
@@ -818,7 +779,7 @@ namespace TEAMModelOS.Controllers.Analysis
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- await _dingDing.SendBotMsg($"OS,{_option.Location},class/analysis/find-recod()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
|
|
|
+ await _dingDing.SendBotMsg($"OS,{_option.Location},class/analysis/settle-recod()\n{ex.Message}", GroupNames.醍摩豆服務運維群組);
|
|
|
return Ok(new { code = 404, msg = ex.Message });
|
|
|
}
|
|
|
}
|