|
@@ -56,7 +56,7 @@ namespace IES.ExamServer.Controllers
|
|
return Ok();
|
|
return Ok();
|
|
}
|
|
}
|
|
[HttpPost("download-package")]
|
|
[HttpPost("download-package")]
|
|
- [AuthToken("admin","teacher")]
|
|
|
|
|
|
+ [AuthToken("admin","teacher", "visitor")]
|
|
public async Task<IActionResult> DownloadPackage(JsonNode json)
|
|
public async Task<IActionResult> DownloadPackage(JsonNode json)
|
|
{
|
|
{
|
|
//C#.NET 6 后端与前端流式通信
|
|
//C#.NET 6 后端与前端流式通信
|
|
@@ -128,32 +128,33 @@ namespace IES.ExamServer.Controllers
|
|
}
|
|
}
|
|
return Ok();
|
|
return Ok();
|
|
}
|
|
}
|
|
- [HttpPost("check-short-code")]
|
|
|
|
|
|
+ [HttpPost("check-evaluation")]
|
|
[AuthToken("admin", "teacher", "visitor")]
|
|
[AuthToken("admin", "teacher", "visitor")]
|
|
- public async Task<IActionResult> CheckShortCode(JsonNode json)
|
|
|
|
|
|
+ public async Task<IActionResult> CheckEvaluation(JsonNode json)
|
|
{
|
|
{
|
|
-
|
|
|
|
string shortCode = $"{json["shortCode"]}";
|
|
string shortCode = $"{json["shortCode"]}";
|
|
string evaluationId = $"{json["evaluationId"]}";
|
|
string evaluationId = $"{json["evaluationId"]}";
|
|
|
|
+ string checkCenter = $"{json["checkCenter"]}";
|
|
string deviceId = $"{json["deviceId"]}";
|
|
string deviceId = $"{json["deviceId"]}";
|
|
- string centerCode= string.Empty, centerMsg= string.Empty;
|
|
|
|
|
|
+ string centerCode = string.Empty, centerMsg = string.Empty;
|
|
Expression<Func<EvaluationClient, bool>> predicate = x => true;
|
|
Expression<Func<EvaluationClient, bool>> predicate = x => true;
|
|
|
|
+ var token = GetAuthTokenInfo();
|
|
int checkTotal = 0, checkSuccess = 0, checkError = 0, checkWarning = 0;
|
|
int checkTotal = 0, checkSuccess = 0, checkError = 0, checkWarning = 0;
|
|
int msg_status = Constant._Message_status_info;
|
|
int msg_status = Constant._Message_status_info;
|
|
- if (!string.IsNullOrEmpty(shortCode))
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(shortCode) || !string.IsNullOrEmpty(evaluationId))
|
|
{
|
|
{
|
|
- var codePredicate = ExpressionHelper.Or<EvaluationClient>(
|
|
|
|
- x => !string.IsNullOrWhiteSpace(x.shortCode) && x.shortCode == shortCode,
|
|
|
|
- x => !string.IsNullOrWhiteSpace(x.password) && x.password == shortCode
|
|
|
|
- );
|
|
|
|
- predicate= predicate.And(codePredicate);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- return Ok(new { code = 400,msg="必须输入开卷码" });
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(shortCode))
|
|
|
|
+ {
|
|
|
|
+ predicate= predicate.And(x => !string.IsNullOrWhiteSpace(x.shortCode) && x.shortCode.Equals(shortCode));
|
|
|
|
+ }
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(evaluationId))
|
|
|
|
+ {
|
|
|
|
+ predicate= predicate.And(x => x.id!.Equals(evaluationId));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (!string.IsNullOrWhiteSpace(evaluationId))
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- predicate= predicate.And(x => x.id!.Equals(evaluationId));
|
|
|
|
|
|
+ return Ok(new { code = 400, msg = "评测ID或提取码均未填写!" });
|
|
}
|
|
}
|
|
IEnumerable<EvaluationClient>? evaluationClients = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Find(predicate);
|
|
IEnumerable<EvaluationClient>? evaluationClients = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Find(predicate);
|
|
EvaluationClient? evaluationLocal = null;
|
|
EvaluationClient? evaluationLocal = null;
|
|
@@ -162,60 +163,65 @@ namespace IES.ExamServer.Controllers
|
|
{
|
|
{
|
|
evaluationLocal= evaluationClients.First();
|
|
evaluationLocal= evaluationClients.First();
|
|
}
|
|
}
|
|
- //如果要访问中心,则需要教师登录联网。
|
|
|
|
- var token = GetAuthTokenInfo();
|
|
|
|
- if ( token.scope.Equals(ExamConstant.ScopeTeacher) || token.scope.Equals(ExamConstant.ScopeVisitor))//由于已经绑定学校,访客教师也可以访问中心。
|
|
|
|
|
|
+ //从数据中心搜索
|
|
|
|
+ if ("1".Equals($"{checkCenter}") )
|
|
{
|
|
{
|
|
- if (_connectionService.centerIsConnected)
|
|
|
|
|
|
+ if (_connectionService.centerIsConnected)
|
|
{
|
|
{
|
|
- Teacher? teacher = _liteDBFactory.GetLiteDatabase().GetCollection<Teacher>().FindOne(x => x.id!.Equals(token.id));
|
|
|
|
- if (teacher != null)
|
|
|
|
|
|
+ if (token.scope.Equals(ExamConstant.ScopeTeacher) || token.scope.Equals(ExamConstant.ScopeVisitor))//由于已经绑定学校,访客教师也可以访问中心。
|
|
{
|
|
{
|
|
- string? CenterUrl = _configuration.GetValue<string>("ExamServer:CenterUrl");
|
|
|
|
- var client = _httpClientFactory.CreateClient();
|
|
|
|
- if (client.DefaultRequestHeaders.Contains(Constant._X_Auth_AuthToken))
|
|
|
|
|
|
+ Teacher? teacher = _liteDBFactory.GetLiteDatabase().GetCollection<Teacher>().FindOne(x => x.id!.Equals(token.id));
|
|
|
|
+ if (teacher != null)
|
|
{
|
|
{
|
|
- client.DefaultRequestHeaders.Remove(Constant._X_Auth_AuthToken);
|
|
|
|
- }
|
|
|
|
- client.DefaultRequestHeaders.Add(Constant._X_Auth_AuthToken, teacher.x_auth_token);
|
|
|
|
- try {
|
|
|
|
- HttpResponseMessage message = await client.PostAsJsonAsync($"{CenterUrl}/evaluation-sync/find-sync-info", new { shortCode, evaluationId });
|
|
|
|
- if (message.IsSuccessStatusCode)
|
|
|
|
|
|
+ string? CenterUrl = _configuration.GetValue<string>("ExamServer:CenterUrl");
|
|
|
|
+ var client = _httpClientFactory.CreateClient();
|
|
|
|
+ if (client.DefaultRequestHeaders.Contains(Constant._X_Auth_AuthToken))
|
|
|
|
+ {
|
|
|
|
+ client.DefaultRequestHeaders.Remove(Constant._X_Auth_AuthToken);
|
|
|
|
+ }
|
|
|
|
+ client.DefaultRequestHeaders.Add(Constant._X_Auth_AuthToken, teacher.x_auth_token);
|
|
|
|
+ try
|
|
{
|
|
{
|
|
- string content = await message.Content.ReadAsStringAsync();
|
|
|
|
- JsonNode? jsonNode = content.ToObject<JsonNode>();
|
|
|
|
- if (jsonNode != null)
|
|
|
|
|
|
+ HttpResponseMessage message = await client.PostAsJsonAsync($"{CenterUrl}/evaluation-sync/find-sync-info", new { shortCode, evaluationId });
|
|
|
|
+ if (message.IsSuccessStatusCode)
|
|
{
|
|
{
|
|
- centerCode = $"{jsonNode["code"]}";
|
|
|
|
- centerMsg = $"{jsonNode["msg"]}";
|
|
|
|
- if ($"{jsonNode["code"]}".Equals("200"))
|
|
|
|
|
|
+ string content = await message.Content.ReadAsStringAsync();
|
|
|
|
+ JsonNode? jsonNode = content.ToObject<JsonNode>();
|
|
|
|
+ if (jsonNode != null)
|
|
|
|
+ {
|
|
|
|
+ centerCode = $"{jsonNode["code"]}";
|
|
|
|
+ centerMsg = $"{jsonNode["msg"]}";
|
|
|
|
+ if ($"{jsonNode["code"]}".Equals("200"))
|
|
|
|
+ {
|
|
|
|
+ evaluationCloud = jsonNode["evaluation"]?.ToObject<EvaluationClient>();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- evaluationCloud = jsonNode["evaluation"]?.ToObject<EvaluationClient>();
|
|
|
|
|
|
+ centerCode = "500";
|
|
|
|
+ centerMsg = "数据转换异常";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- centerCode = "500";
|
|
|
|
- centerMsg = "数据转换异常";
|
|
|
|
|
|
+ centerCode = $"{message.StatusCode}";
|
|
|
|
+ centerMsg = "数据中心访问异常";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ catch (Exception ex)
|
|
{
|
|
{
|
|
- centerCode = $"{message.StatusCode}";
|
|
|
|
- centerMsg = "数据中心访问异常";
|
|
|
|
|
|
+ centerCode = $"500";
|
|
|
|
+ centerMsg = $"数据中心访问异常:{ex.Message}";
|
|
}
|
|
}
|
|
- } catch (Exception ex) {
|
|
|
|
- centerCode = $"500";
|
|
|
|
- centerMsg = $"数据中心访问异常:{ex.Message}";
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- centerCode = $"401";
|
|
|
|
- centerMsg = "当前登录账号未找到";
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ centerCode = $"401";
|
|
|
|
+ centerMsg = "当前登录账号未找到";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
centerCode = $"404";
|
|
centerCode = $"404";
|
|
centerMsg = "云端数据中心未连接";
|
|
centerMsg = "云端数据中心未连接";
|
|
@@ -226,7 +232,7 @@ namespace IES.ExamServer.Controllers
|
|
checkTotal++;
|
|
checkTotal++;
|
|
checkSuccess++;
|
|
checkSuccess++;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
msg_status=Constant._Message_status_warning;
|
|
msg_status=Constant._Message_status_warning;
|
|
checkTotal++;
|
|
checkTotal++;
|
|
@@ -234,23 +240,24 @@ namespace IES.ExamServer.Controllers
|
|
}
|
|
}
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent { dataId=evaluationCloud?.id, dataName=evaluationCloud?.name, messageType=Constant._Message_type_message, status=msg_status, content=$"云端数据检测结果:{centerMsg},状态:{centerCode}" });
|
|
new MessageContent { dataId=evaluationCloud?.id, dataName=evaluationCloud?.name, messageType=Constant._Message_type_message, status=msg_status, content=$"云端数据检测结果:{centerMsg},状态:{centerCode}" });
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
//数据,文件,页面 0 没有更新,1 有更新
|
|
//数据,文件,页面 0 没有更新,1 有更新
|
|
- int data = 0,blob=0,webview=0, groupList=0, status=0;
|
|
|
|
- long dataSize = 0, blobSize=0 , webviewSize=0, studentCount=0;
|
|
|
|
|
|
+ int data = 0, blob = 0, webview = 0, groupList = 0, status = 0;
|
|
|
|
+ long dataSize = 0, blobSize = 0, webviewSize = 0, studentCount = 0;
|
|
if (evaluationLocal== null && evaluationCloud==null)
|
|
if (evaluationLocal== null && evaluationCloud==null)
|
|
{
|
|
{
|
|
//线上线下没有数据
|
|
//线上线下没有数据
|
|
status=1;
|
|
status=1;
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- else if (evaluationLocal!=null && evaluationCloud!=null)
|
|
|
|
|
|
+ else if (evaluationLocal!=null && evaluationCloud!=null)
|
|
{
|
|
{
|
|
//线上线下有数据
|
|
//线上线下有数据
|
|
status = 2;
|
|
status = 2;
|
|
if ((!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) && !evaluationLocal.blobHash.Equals(evaluationCloud.blobHash))
|
|
if ((!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) && !evaluationLocal.blobHash.Equals(evaluationCloud.blobHash))
|
|
- ||(evaluationLocal.blobTime<evaluationCloud.blobTime)
|
|
|
|
|
|
+ ||(evaluationLocal.blobTime<evaluationCloud.blobTime)
|
|
||(evaluationLocal.blobCount!= evaluationCloud.blobCount)
|
|
||(evaluationLocal.blobCount!= evaluationCloud.blobCount)
|
|
||(evaluationLocal.blobSize!= evaluationCloud.blobSize))
|
|
||(evaluationLocal.blobSize!= evaluationCloud.blobSize))
|
|
{
|
|
{
|
|
@@ -265,15 +272,15 @@ namespace IES.ExamServer.Controllers
|
|
data=1;
|
|
data=1;
|
|
dataSize=evaluationCloud.dataSize;
|
|
dataSize=evaluationCloud.dataSize;
|
|
}
|
|
}
|
|
- if ((evaluationLocal.webviewCount!=evaluationCloud.webviewCount)
|
|
|
|
- ||(evaluationLocal.webviewSize!= evaluationCloud.webviewSize)
|
|
|
|
- ||(evaluationLocal.webviewTime!= evaluationCloud.webviewTime)
|
|
|
|
- ||(!string.IsNullOrWhiteSpace(evaluationLocal.webviewPath)&& !evaluationLocal.webviewPath.Equals(evaluationCloud.webviewPath)))
|
|
|
|
- {
|
|
|
|
- webview=1;
|
|
|
|
- webviewSize=evaluationCloud.webviewSize;
|
|
|
|
- }
|
|
|
|
- if ((evaluationLocal.studentCount!= evaluationCloud.studentCount)||(!$"{evaluationLocal.grouplistHash}".Equals(evaluationCloud.grouplistHash)))
|
|
|
|
|
|
+ //if ((evaluationLocal.webviewCount!=evaluationCloud.webviewCount)
|
|
|
|
+ // ||(evaluationLocal.webviewSize!= evaluationCloud.webviewSize)
|
|
|
|
+ // ||(evaluationLocal.webviewTime!= evaluationCloud.webviewTime)
|
|
|
|
+ // ||(!string.IsNullOrWhiteSpace(evaluationLocal.webviewPath)&& !evaluationLocal.webviewPath.Equals(evaluationCloud.webviewPath)))
|
|
|
|
+ //{
|
|
|
|
+ // webview=1;
|
|
|
|
+ // webviewSize=evaluationCloud.webviewSize;
|
|
|
|
+ //}
|
|
|
|
+ if ((evaluationLocal.studentCount!= evaluationCloud.studentCount)||(!$"{evaluationLocal.grouplistHash}".Equals(evaluationCloud.grouplistHash)))
|
|
{
|
|
{
|
|
groupList=1;
|
|
groupList=1;
|
|
studentCount=evaluationCloud.studentCount;
|
|
studentCount=evaluationCloud.studentCount;
|
|
@@ -294,17 +301,17 @@ namespace IES.ExamServer.Controllers
|
|
groupList=1;
|
|
groupList=1;
|
|
blobSize=evaluationCloud.blobSize;
|
|
blobSize=evaluationCloud.blobSize;
|
|
dataSize=evaluationCloud.dataSize;
|
|
dataSize=evaluationCloud.dataSize;
|
|
- webviewSize=evaluationCloud.webviewSize;
|
|
|
|
|
|
+ // webviewSize=evaluationCloud.webviewSize;
|
|
studentCount=evaluationCloud.studentCount;
|
|
studentCount=evaluationCloud.studentCount;
|
|
status = 4;
|
|
status = 4;
|
|
_liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Insert(evaluationLocal);
|
|
_liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Insert(evaluationLocal);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (evaluationLocal!=null)
|
|
if (evaluationLocal!=null)
|
|
{
|
|
{
|
|
- await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
|
|
- new MessageContent {dataId=evaluationLocal.id,dataName=evaluationLocal.name,messageType=Constant._Message_type_message, status=0, content="开始检查评测信息文件.." });
|
|
|
|
-
|
|
|
|
|
|
+ await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
|
|
+ new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=0, content="开始检查评测信息文件.." });
|
|
|
|
+
|
|
//校验本地文件数据
|
|
//校验本地文件数据
|
|
string packagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "package");
|
|
string packagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "package");
|
|
if (!Directory.Exists(packagePath))
|
|
if (!Directory.Exists(packagePath))
|
|
@@ -312,7 +319,7 @@ namespace IES.ExamServer.Controllers
|
|
Directory.CreateDirectory(packagePath);
|
|
Directory.CreateDirectory(packagePath);
|
|
}
|
|
}
|
|
string evaluationPath = Path.Combine(packagePath, evaluationLocal.id!);
|
|
string evaluationPath = Path.Combine(packagePath, evaluationLocal.id!);
|
|
- string evaluationDataPath = Path.Combine(evaluationPath,"data");
|
|
|
|
|
|
+ string evaluationDataPath = Path.Combine(evaluationPath, "data");
|
|
// await Task.Delay(DelayMacro);
|
|
// await Task.Delay(DelayMacro);
|
|
|
|
|
|
//await Task.Delay(DelayMacro);
|
|
//await Task.Delay(DelayMacro);
|
|
@@ -331,7 +338,7 @@ namespace IES.ExamServer.Controllers
|
|
checkTotal++;
|
|
checkTotal++;
|
|
checkSuccess++;
|
|
checkSuccess++;
|
|
}
|
|
}
|
|
- await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
|
|
|
|
+ await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测名单文件:{path_groupList}" });
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测名单文件:{path_groupList}" });
|
|
//await Task.Delay(DelayMacro);
|
|
//await Task.Delay(DelayMacro);
|
|
string path_source = Path.Combine(evaluationDataPath, "source.json");
|
|
string path_source = Path.Combine(evaluationDataPath, "source.json");
|
|
@@ -352,7 +359,8 @@ namespace IES.ExamServer.Controllers
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测原始数据:{path_source}" });
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测原始数据:{path_source}" });
|
|
msg_status =Constant._Message_status_info;
|
|
msg_status =Constant._Message_status_info;
|
|
- try {
|
|
|
|
|
|
+ try
|
|
|
|
+ {
|
|
//TODO 重整本地文件路径。 文件可能不存在D:\VisualStudioProjects\TEAMModelOS\TEAMModelOS.Extension\IES.Exam\IES.ExamServer\wwwroot\package\exam\6af32bbd-144e-4366-8bc0-61ba4c85677c\evaluation.json
|
|
//TODO 重整本地文件路径。 文件可能不存在D:\VisualStudioProjects\TEAMModelOS\TEAMModelOS.Extension\IES.Exam\IES.ExamServer\wwwroot\package\exam\6af32bbd-144e-4366-8bc0-61ba4c85677c\evaluation.json
|
|
string path_evaluation = Path.Combine(evaluationDataPath, "evaluation.json");
|
|
string path_evaluation = Path.Combine(evaluationDataPath, "evaluation.json");
|
|
if (!System.IO.File.Exists(path_evaluation))
|
|
if (!System.IO.File.Exists(path_evaluation))
|
|
@@ -374,7 +382,7 @@ namespace IES.ExamServer.Controllers
|
|
//数据格式: [下载][成功/失败][15:43]=>[评测数据文件:/wwwroot/package/623a9fe6-5445-0938-ff77-aeb80066ef27/evaluation.json][1024kb][15ms]
|
|
//数据格式: [下载][成功/失败][15:43]=>[评测数据文件:/wwwroot/package/623a9fe6-5445-0938-ff77-aeb80066ef27/evaluation.json][1024kb][15ms]
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测数据文件:{path_evaluation}" });
|
|
new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content=$"评测数据文件:{path_evaluation}" });
|
|
- if (System.IO.File.Exists(path_evaluation))
|
|
|
|
|
|
+ if (System.IO.File.Exists(path_evaluation))
|
|
{
|
|
{
|
|
string evaluation_str = await System.IO.File.ReadAllTextAsync(path_evaluation);
|
|
string evaluation_str = await System.IO.File.ReadAllTextAsync(path_evaluation);
|
|
JsonNode? evaluation_data = evaluation_str.ToObject<JsonNode>();
|
|
JsonNode? evaluation_data = evaluation_str.ToObject<JsonNode>();
|
|
@@ -388,14 +396,18 @@ namespace IES.ExamServer.Controllers
|
|
EvaluationClient? evaluationClient = evaluation_data["evaluationClient"]?.ToObject<EvaluationClient>();
|
|
EvaluationClient? evaluationClient = evaluation_data["evaluationClient"]?.ToObject<EvaluationClient>();
|
|
if (evaluationClient!=null)
|
|
if (evaluationClient!=null)
|
|
{
|
|
{
|
|
- if ((!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) && evaluationLocal.blobHash.Equals(evaluationClient.blobHash))
|
|
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) && evaluationLocal.blobHash.Equals(evaluationClient.blobHash)
|
|
&&(evaluationLocal.blobTime==evaluationClient.blobTime)
|
|
&&(evaluationLocal.blobTime==evaluationClient.blobTime)
|
|
&&(evaluationLocal.blobCount== evaluationClient.blobCount)
|
|
&&(evaluationLocal.blobCount== evaluationClient.blobCount)
|
|
- &&(evaluationLocal.blobSize== evaluationClient.blobSize)&& (evaluationLocal.dataTime==evaluationClient.dataTime)
|
|
|
|
- &&(evaluationLocal.dataSize==evaluationClient.dataSize)&&(evaluationLocal.webviewCount==evaluationClient.webviewCount)
|
|
|
|
- &&(evaluationLocal.webviewSize== evaluationClient.webviewSize)
|
|
|
|
- &&(evaluationLocal.webviewTime== evaluationClient.webviewTime)
|
|
|
|
- &&(!string.IsNullOrWhiteSpace(evaluationLocal.webviewPath)&& evaluationLocal.webviewPath.Equals(evaluationClient.webviewPath)))
|
|
|
|
|
|
+ &&(evaluationLocal.blobSize== evaluationClient.blobSize)
|
|
|
|
+ && (evaluationLocal.dataTime==evaluationClient.dataTime)
|
|
|
|
+ &&(evaluationLocal.dataSize==evaluationClient.dataSize)
|
|
|
|
+ //&&(evaluationLocal.webviewCount==evaluationClient.webviewCount)
|
|
|
|
+ //&&(evaluationLocal.webviewSize== evaluationClient.webviewSize)
|
|
|
|
+ //&&(evaluationLocal.webviewTime== evaluationClient.webviewTime)
|
|
|
|
+ //&&!string.IsNullOrWhiteSpace(evaluationLocal.webviewPath)
|
|
|
|
+ //&& evaluationLocal.webviewPath.Equals(evaluationClient.webviewPath)
|
|
|
|
+ )
|
|
{
|
|
{
|
|
msg_status=Constant._Message_status_info;
|
|
msg_status=Constant._Message_status_info;
|
|
}
|
|
}
|
|
@@ -415,12 +427,12 @@ namespace IES.ExamServer.Controllers
|
|
blob=1;
|
|
blob=1;
|
|
data=1;
|
|
data=1;
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
foreach (var evaluationExam in evaluationExams!)
|
|
foreach (var evaluationExam in evaluationExams!)
|
|
{
|
|
{
|
|
- string path_papers = Path.Combine(evaluationPath, "exams");
|
|
|
|
|
|
+ string path_papers = Path.Combine(evaluationPath, "exams");
|
|
var papers_files = FileHelper.ListAllFiles(path_papers);
|
|
var papers_files = FileHelper.ListAllFiles(path_papers);
|
|
int paperIndex = 0;
|
|
int paperIndex = 0;
|
|
foreach (var paper in evaluationExam.papers)
|
|
foreach (var paper in evaluationExam.papers)
|
|
@@ -487,12 +499,13 @@ namespace IES.ExamServer.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch (Exception e) {
|
|
|
|
- _logger.LogData<object>(new {code=500,msg=e.Message,data = new { content= e.StackTrace } }, evaluationLocal.id!);
|
|
|
|
|
|
+ catch (Exception e)
|
|
|
|
+ {
|
|
|
|
+ _logger.LogData<object>(new { code = 500, msg = e.Message, data = new { content = e.StackTrace } }, evaluationLocal.id!);
|
|
}
|
|
}
|
|
|
|
|
|
//检查需要更新的项目:
|
|
//检查需要更新的项目:
|
|
- if (data==1)
|
|
|
|
|
|
+ if (data==1)
|
|
{
|
|
{
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent
|
|
new MessageContent
|
|
@@ -516,7 +529,7 @@ namespace IES.ExamServer.Controllers
|
|
content=$"检查到评测试卷需要更新。[{blobSize}]"
|
|
content=$"检查到评测试卷需要更新。[{blobSize}]"
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (webview==1)
|
|
|
|
|
|
+ if (webview==1)
|
|
{
|
|
{
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent
|
|
new MessageContent
|
|
@@ -528,7 +541,7 @@ namespace IES.ExamServer.Controllers
|
|
content=$"检查到评测作答页面需要更新。[{webviewSize}]"
|
|
content=$"检查到评测作答页面需要更新。[{webviewSize}]"
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (groupList==1)
|
|
|
|
|
|
+ if (groupList==1)
|
|
{
|
|
{
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
new MessageContent
|
|
new MessageContent
|
|
@@ -542,7 +555,7 @@ namespace IES.ExamServer.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int finalStatus = Constant._Message_status_success;
|
|
int finalStatus = Constant._Message_status_success;
|
|
- if (checkWarning>0)
|
|
|
|
|
|
+ if (checkWarning>0)
|
|
{
|
|
{
|
|
finalStatus = Constant._Message_status_warning;
|
|
finalStatus = Constant._Message_status_warning;
|
|
}
|
|
}
|
|
@@ -551,14 +564,16 @@ namespace IES.ExamServer.Controllers
|
|
finalStatus = Constant._Message_status_error;
|
|
finalStatus = Constant._Message_status_error;
|
|
}
|
|
}
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
|
|
- new MessageContent {
|
|
|
|
|
|
+ new MessageContent
|
|
|
|
+ {
|
|
dataId=evaluationLocal?.id,
|
|
dataId=evaluationLocal?.id,
|
|
dataName=evaluationLocal?.name,
|
|
dataName=evaluationLocal?.name,
|
|
messageType=Constant._Message_type_message,
|
|
messageType=Constant._Message_type_message,
|
|
status=Constant._Message_status_warning,
|
|
status=Constant._Message_status_warning,
|
|
content=$"最终检测结果:总数({checkTotal}),成功({checkSuccess}),警告({checkWarning}),异常({checkError})。"
|
|
content=$"最终检测结果:总数({checkTotal}),成功({checkSuccess}),警告({checkWarning}),异常({checkError})。"
|
|
});
|
|
});
|
|
- return Ok(new {
|
|
|
|
|
|
+ return Ok(new
|
|
|
|
+ {
|
|
code = 200,
|
|
code = 200,
|
|
evaluation = evaluationLocal,
|
|
evaluation = evaluationLocal,
|
|
data,
|
|
data,
|
|
@@ -577,6 +592,8 @@ namespace IES.ExamServer.Controllers
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 激活或者取消激活考试
|
|
/// 激活或者取消激活考试
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -618,7 +635,7 @@ namespace IES.ExamServer.Controllers
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="json"></param>
|
|
/// <param name="json"></param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- [HttpPost("list-local-evaluation")]
|
|
|
|
|
|
+ [HttpPost("list-local-c")]
|
|
[AuthToken("admin", "teacher", "visitor")]
|
|
[AuthToken("admin", "teacher", "visitor")]
|
|
public IActionResult ListLocalEvaluation(JsonNode json)
|
|
public IActionResult ListLocalEvaluation(JsonNode json)
|
|
{
|
|
{
|