|
@@ -1,6 +1,7 @@
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
+using Microsoft.WindowsAzure.Storage.Table;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
@@ -9,14 +10,19 @@ using TEAMModelOS.Controllers.Core;
|
|
using TEAMModelOS.Model.Core.Models;
|
|
using TEAMModelOS.Model.Core.Models;
|
|
using TEAMModelOS.Model.Evaluation.Dtos;
|
|
using TEAMModelOS.Model.Evaluation.Dtos;
|
|
using TEAMModelOS.Model.Evaluation.Dtos.Own;
|
|
using TEAMModelOS.Model.Evaluation.Dtos.Own;
|
|
|
|
+using TEAMModelOS.SDK.Context.Attributes.Azure;
|
|
using TEAMModelOS.SDK.Context.Constant.Common;
|
|
using TEAMModelOS.SDK.Context.Constant.Common;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
|
|
using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
|
|
using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
|
|
using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
|
|
|
|
+using TEAMModelOS.SDK.Helper.Common.JsonHelper;
|
|
|
|
+using TEAMModelOS.SDK.Helper.Network.HttpHelper;
|
|
using TEAMModelOS.SDK.Helper.Security.ShaHash;
|
|
using TEAMModelOS.SDK.Helper.Security.ShaHash;
|
|
using TEAMModelOS.SDK.Module.AzureBlob.Container;
|
|
using TEAMModelOS.SDK.Module.AzureBlob.Container;
|
|
using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
|
|
using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
|
|
using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
|
|
using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
|
|
|
|
+using TEAMModelOS.SDK.Module.PowerPointX;
|
|
|
|
+using TEAMModelOS.SDK.Module.PowerPointX.Model;
|
|
using TEAMModelOS.Service.Core.Interfaces;
|
|
using TEAMModelOS.Service.Core.Interfaces;
|
|
using TEAMModelOS.Service.Evaluation.Interfaces;
|
|
using TEAMModelOS.Service.Evaluation.Interfaces;
|
|
|
|
|
|
@@ -99,7 +105,34 @@ namespace TEAMModelOS.Controllers.Evaluation
|
|
|
|
|
|
return responseBuilder.Data(model).build();
|
|
return responseBuilder.Data(model).build();
|
|
}
|
|
}
|
|
|
|
+ [HttpPost("ProcessPPT")]
|
|
|
|
+ [AllowAnonymous]
|
|
|
|
+ [RequestSizeLimit(102_400_000_00)] //最大10000m左右
|
|
|
|
+ public async Task<object> processPPT([FromForm]IFormFile file)
|
|
|
|
+ {
|
|
|
|
+ Dictionary<string, object> resdict = new Dictionary<string, object>();
|
|
|
|
+ string shaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
|
|
|
|
+ PPTXInfo info;
|
|
|
|
+ AzureBlobModel azureBlobModel = await _azureBlobDBRepository.UploadFile(file, "pptfiles", true);
|
|
|
|
+ azureBlobModel.Sha1Code = shaCode;
|
|
|
|
+ PresentationConvert convert = new PresentationConvert();
|
|
|
|
+ info = convert.LoadPresentation(file.OpenReadStream());
|
|
|
|
+ AzureBlobModel pptJsonFileModel = await _azureBlobDBRepository.UploadObject(shaCode + ".json", info, "pptfiles", true);
|
|
|
|
+ PPTData pptData = new PPTData { DataUrl = pptJsonFileModel.BlobUrl, Sha1Code = shaCode, RowKey = shaCode, PartitionKey = "pptfiles" };
|
|
|
|
+ var pptxjson = HttpHelper.HttpGet(pptData.DataUrl);
|
|
|
|
+ info = JsonSerialization.FromJsonAbs<PPTXInfo>(pptxjson);
|
|
|
|
+ resdict.Add("pptx", info);
|
|
|
|
+ resdict.Add("model", azureBlobModel);
|
|
|
|
+ resdict.Add("type", "pptx");
|
|
|
|
+ return resdict;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ [TableSpace(Name = "Core")]
|
|
|
|
+ public class PPTData : TableEntity
|
|
|
|
+ {
|
|
|
|
+ public string Sha1Code { get; set; }
|
|
|
|
+ public string DataUrl { get; set; }
|
|
|
|
+ }
|
|
/// <summary>
|
|
/// <summary>
|
|
/// htmlString
|
|
/// htmlString
|
|
/// </summary>
|
|
/// </summary>
|