|
@@ -31,6 +31,7 @@ using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
using Item = TEAMModelOS.SDK.Models.Cosmos.Common.Item;
|
|
|
using DocumentFormat.OpenXml.Office2016.Excel;
|
|
|
using OpenXmlPowerTools;
|
|
|
+using TEAMModelOS.SDK.Services;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
|
{
|
|
@@ -184,16 +185,13 @@ namespace TEAMModelOS.Controllers
|
|
|
if (request.scope.Equals("school"))
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.school).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "insert", root = $"exam/{request.id}", name = request.school }.ToJsonString());
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "insert", root = $"exam/{request.id}", name = request.school }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.creatorId).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "insert", root = $"exam/{request.id}", name = request.creatorId }.ToJsonString());
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "insert", root = $"exam/{request.id}", name = request.creatorId }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
- messageBlob.ApplicationProperties.Add("name", "BlobRoot");
|
|
|
- var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
|
|
|
int n = 0;
|
|
|
List<string> sheetIds = new List<string>();
|
|
|
foreach (PaperSimple simple in request.papers)
|
|
@@ -220,18 +218,14 @@ namespace TEAMModelOS.Controllers
|
|
|
if (request.scope.Equals("school"))
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.school).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "update", root = $"exam/{request.id}", name = request.school }.ToJsonString());
|
|
|
-
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "update", root = $"exam/{request.id}", name = request.school }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.creatorId).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "update", root = $"exam/{request.id}", name = request.creatorId }.ToJsonString());
|
|
|
-
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "update", root = $"exam/{request.id}", name = request.creatorId }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
- messageBlob.ApplicationProperties.Add("name", "BlobRoot");
|
|
|
- var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
|
|
|
+
|
|
|
request.progress = info.progress;
|
|
|
int n = 0;
|
|
|
foreach (PaperSimple simple in request.papers)
|
|
@@ -255,16 +249,13 @@ namespace TEAMModelOS.Controllers
|
|
|
if (request.scope.Equals("school"))
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.school).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "insert", root = $"exam/{request.id}", name = request.school }.ToJsonString());
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "insert", root = $"exam/{request.id}", name = request.school }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
request.size = await _azureStorage.GetBlobContainerClient(request.creatorId).GetBlobsSize($"exam/{request.id}");
|
|
|
- messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "insert", root = $"exam/{request.id}", name = request.creatorId }.ToJsonString());
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "insert", root = $"exam/{request.id}", name = request.creatorId }, _serviceBus, _configuration, _azureRedis);
|
|
|
}
|
|
|
- messageBlob.ApplicationProperties.Add("name", "BlobRoot");
|
|
|
- var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
|
|
|
int n = 0;
|
|
|
List<string> sheetIds = new List<string>();
|
|
|
foreach (PaperSimple simple in request.papers)
|
|
@@ -373,10 +364,7 @@ namespace TEAMModelOS.Controllers
|
|
|
//删除blob 相关资料
|
|
|
await _azureStorage.GetBlobServiceClient().DeleteBlobs(_dingDing, code.ToString(), new List<string> { $"exam/{id}" });
|
|
|
//通知评测删除信息
|
|
|
- var messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "delete", root = $"exam/{id}", name = $"{code}" }.ToJsonString());
|
|
|
- messageBlob.ApplicationProperties.Add("name", "BlobRoot");
|
|
|
- var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
|
|
|
+ await BlobService.RefreshBlobRoot(new BlobRefreshMessage { progress = "delete", root = $"exam/{id}", name = $"{code}" }, _serviceBus, _configuration, _azureRedis);
|
|
|
//删除阅卷配置
|
|
|
var cresponse = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"Correct-{code}"));
|
|
|
if (cresponse.Status == 200)
|