CrazyIter 5 年 前
コミット
3baa7327c4

+ 0 - 6
.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>

+ 1 - 1
TEAMModelOS.SDK/Context/Constant/ContentTypeDict.cs

@@ -79,7 +79,7 @@ namespace TEAMModelOS.SDK.Context.Constant
 {"text/vnd.sun.j2me.app-descriptor",".jad"},
 {"text/x-java",".java"},
 {"image/x-jng",".jng"},
-{"image/jpeg",".jpe"},
+{"image/jpeg",".jpeg"},
 {"application/javascript",".js"},
 {"application/json",".json"},
 {"application/jsonp",".jsonp"},

+ 1 - 1
TEAMModelOS.SDK/Helper/Security/ShaHash/ShaHashHelper.cs

@@ -39,7 +39,7 @@ namespace TEAMModelOS.SDK.Helper.Security.ShaHash
             byte[] buffer = new byte[stream.Length];
 
             stream.Read(buffer, 0, buffer.Length);
-            stream.Close();
+            // stream.Close();
             var resbuffer = buffer;
             HashAlgorithm iSha = new SHA1CryptoServiceProvider();
             resbuffer = iSha.ComputeHash(buffer);

+ 52 - 0
TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs

@@ -341,6 +341,58 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Implements
             };
             return model;
         }
+
+
+        public  AzureBlobModel  UploadFileByFolderNAsyn(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true)
+        {
+
+            string groupName = fileSpace + "/" + folder;
+            //  string newFileName = sha1Code;
+            // await InitializeBlob(DateTime.Now.ToString("yyyyMMdd"));
+            blobContainer = blobClient.GetContainerReference(groupName);
+            StorageUri url = blobContainer.StorageUri;
+            string[] names = fileName.Split(".");
+            //  string name ;
+            //for (int i = 0; i < names.Length - 1; i++)
+            //{
+            //    name = name + names[i];
+            //}
+            //if (names.Length <= 1)
+            //{
+            //    name =  newFileName;
+            //}
+            //else
+            //{
+            //    name = newFileName + "." + names[names.Length - 1];
+            //}
+            //var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
+            //var filename = Path.Combine(parsedContentDisposition.FileName.Trim('"'));
+            var blockBlob = blobContainer.GetBlockBlobReference(fileName);
+            string fileext = fileName.Substring(fileName.LastIndexOf(".") > 0 ? fileName.LastIndexOf(".") : 0);
+            if (!contentTypeDefault)
+            {
+                ContentTypeDict.dict.TryGetValue(fileext, out string content_type);
+                if (!string.IsNullOrEmpty(content_type))
+                {
+                    blockBlob.Properties.ContentType = content_type;
+                }
+                else
+                {
+                    blockBlob.Properties.ContentType = "application/octet-stream";
+                }
+            }
+            blockBlob.UploadFromStreamAsync(fileSteam).GetAwaiter().GetResult() ;
+            AzureBlobModel model = new AzureBlobModel(fileName, _options.Container, groupName, fileName, folder, blockBlob.Properties.ContentType, fileSteam.Length)
+            {
+                BlobUrl = url.PrimaryUri.ToString().Split("?")[0] + "/" + fileName
+            };
+            return model;
+        }
+
+
+
+
+
         public async Task<AzureBlobModel> UploadFileByFolder(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true)
         {
             

+ 1 - 1
TEAMModelOS.SDK/Module/AzureBlob/Interfaces/IAzureBlobDBRepository.cs

@@ -15,7 +15,7 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Interfaces
         Task<AzureBlobModel> UploadText(string fileName, string text, string fileSpace = "common", bool contentTypeDefault = true);
         Task<AzureBlobModel> UploadFileByFolder(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true);
         Task<AzureBlobModel> UploadTextByFolder(string text, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true);
-
+        AzureBlobModel UploadFileByFolderNAsyn(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true);
 
     }
 }

+ 9 - 5
TEAMModelOS.SDK/Module/OpenXmlTool/WmlToHtmlConverter.cs

@@ -15,6 +15,10 @@ using System.Xml.Linq;
 using System.Xml.Xsl;
 using DocumentFormat.OpenXml.Packaging;
 using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Context.Constant;
+using TEAMModelOS.SDK.Extension.SnowFlake;
+using TEAMModelOS.SDK.Helper.Common.StringHelper;
+using TEAMModelOS.SDK.Module.AzureBlob.Container;
 
 // 200e lrm - LTR
 // 200f rlm - RTL
@@ -135,7 +139,7 @@ namespace OpenXmlPowerTools
         public string ContentType;
         public XElement DrawingElement;
         public string AltText;
-
+        public string Mathxml;
         public const int EmusPerInch = 914400;
         public const int EmusPerCm = 360000;
     }
@@ -3242,16 +3246,17 @@ namespace OpenXmlPowerTools
                         {
                             ContentType = contentType,
                             DrawingElement = element,
-                            AltText = ""
+                            AltText = "",
+                            Mathxml= mathxml
                         };
 
                         var style = (string)element.Elements(VML.shape).Attributes("style").FirstOrDefault();
-                        if (style == null) return ProcessWmf(imageInfo, mathxml);
+                        if (style == null) return imageHandler(imageInfo);
 
                         var tokens = style.Split(';');
                         var widthInPoints = WidthInPoints(tokens);
                         var heightInPoints = HeightInPoints(tokens);
-                        var imgElement2 = ProcessWmf(imageInfo, mathxml);
+                        var imgElement2 = imageHandler(imageInfo);
                         if (widthInPoints != null && heightInPoints != null)
                         {
                             imageInfo.ImgStyleAttribute = new XAttribute("style",
@@ -3296,7 +3301,6 @@ namespace OpenXmlPowerTools
             string base64 = System.Convert.ToBase64String(buffer);
             string imageSource =
                     string.Format("data:{0};base64,{1}", "image/svg+xml", base64);
-
             XElement img = new XElement(Xhtml.img,
                     new XAttribute(NoNamespace.src, imageSource),
                     imageInfo.ImgStyleAttribute= new XAttribute("style",

+ 3 - 1
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -4,9 +4,11 @@
     <TargetFramework>netcoreapp2.2</TargetFramework>
     <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
     <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
-    <Version>1.0.16</Version>
+    <Version>1.0.17</Version>
     <PackageReleaseNotes>修改JsonPRC id类型</PackageReleaseNotes>
     <Description>修改JsonPRC id类型</Description>
+    <AssemblyVersion>1.0.17.0</AssemblyVersion>
+    <FileVersion>1.0.17.0</FileVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 1 - 1
TEAMModelOS.Service/Evaluation/Implements/AnswerInfoService.cs

@@ -14,7 +14,7 @@ namespace TEAMModelOS.Service.EvaluaTion.Implements
         {
             await SaveOrUpdateAll<AnswerInfo>(items);
             return items;
-            //throw new NotImplementedException();
+            //throw new NotImplementedException();D:\VSProjectCode\TEAMModelOS\TEAMModelOS.Service\Evaluation\Implements\PaperService.cs
         }
     }
 }

+ 1 - 3
TEAMModelOS.Service/Evaluation/Implements/HtmlAnalyzeService.cs

@@ -1,12 +1,9 @@
 using HtmlAgilityPack;
-using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Threading.Tasks;
 using TEAMModelOS.Model.Core.Dtos;
-using TEAMModelOS.Model.Evaluation.Dtos;
 using TEAMModelOS.Model.Evaluation.Dtos.Own;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
@@ -340,4 +337,5 @@ namespace TEAMModelOS.Service.Evaluation.Implements
             return TestInType;
         }
     }
+  
 }

+ 118 - 83
TEAMModelOS.Service/Evaluation/Implements/ImportExerciseService.cs

@@ -16,6 +16,7 @@ using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Evaluation.Dtos.Own;
 using TEAMModelOS.Model.Evaluation.Models;
 using TEAMModelOS.SDK.Context.Configuration;
+using TEAMModelOS.SDK.Context.Constant;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.SnowFlake;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
@@ -25,7 +26,9 @@ using TEAMModelOS.SDK.Helper.Common.StringHelper;
 using TEAMModelOS.SDK.Helper.Network.HttpHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Module.AzureBlob.Container;
+using TEAMModelOS.SDK.Module.AzureBlob.Implements;
 using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
+using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.SDK.Module.PowerPointX;
 using TEAMModelOS.SDK.Module.PowerPointX.Model;
 using TEAMModelOS.Service.Core.Implements;
@@ -35,9 +38,27 @@ namespace TEAMModelOS.Service.Evaluation.Implements
 {
     public  class ImportExerciseService : BaseService, IImportExerciseService
     {
-
-
-      public async Task<Dictionary<string, object>> UploadPPTX(IFormFile file) {
+        private static string SummaryTag = "【题文】";
+        private static string AnswerTag = "【答案】";
+        private static string AnalysisTag = "【解析】";
+        private static string EndedTag = "【结束】";
+        private static string Options = "ABCDEFGHIJ";
+        private static string CompleteStart = "【";
+        private static string CompleteEnd = "】";
+        Dictionary<string, string> TestType = new Dictionary<string, string> {
+            { "Single", "单选题|多选题" }, { "Multiple", "多选题|判断题" },
+            { "Judge", "判断题|填空题" }, { "Complete", "填空题|主观题" },
+            { "Subjective", "主观题|【完结】" } };
+        private readonly IAzureTableDBRepository azureTableDBRepository;
+        private readonly IHttpContextAccessor httpContextAccessor;
+        private readonly IAzureBlobDBRepository azureBlobDBRepository;
+        public ImportExerciseService(IHttpContextAccessor _httpContextAccessor, IAzureBlobDBRepository _azureBlobDBRepository)
+        {
+            azureBlobDBRepository = _azureBlobDBRepository;
+            httpContextAccessor = _httpContextAccessor;
+           
+        }
+        public async Task<Dictionary<string, object>> UploadPPTX(IFormFile file) {
             Dictionary<string, object> resdict = new Dictionary<string, object>();
             PresentationConvert convert = new PresentationConvert();
             PPTXInfo info= convert.LoadPresentation(file.OpenReadStream());
@@ -53,12 +74,12 @@ namespace TEAMModelOS.Service.Evaluation.Implements
             Dictionary<string, object> dict = new Dictionary<string, object> { { "Sha1Code", shaCode } };
             List<AzureBlobModel> models = await FindListByDict<AzureBlobModel>(dict);
            
-            if (models.IsNotEmpty())
-            {
-                resdict.Add("HtmlString", HttpHelper.HttpGet(models[0].BlobUrl));
-                resdict.Add("Sha1Code", models[0].Sha1Code);
-                return resdict;
-            }
+            //if (models.IsNotEmpty())
+            //{
+            //    resdict.Add("HtmlString", HttpHelper.HttpGet(models[0].BlobUrl));
+            //    resdict.Add("Sha1Code", models[0].Sha1Code);
+            //    return resdict;
+            //}
            
             string folder = BaseConfigModel.ContentRootPath + "/Upload/" + IdWorker.getInstance().NextId();
             System.IO.Directory.CreateDirectory(folder);
@@ -77,12 +98,12 @@ namespace TEAMModelOS.Service.Evaluation.Implements
             return resdict;
         }
 
-        public static dynamic ConvertDocxToHtml(string filePath ,string folder)
+        public dynamic ConvertDocxToHtml(string filePath, string folder)
         {
+            string FolderName = DateTime.Now.ToString("yyyyMMdd");
             byte[] byteArray = File.ReadAllBytes(filePath);
 
             //byte[] bytes = new byte[stream.Length];
-           
             using (MemoryStream memoryStream = new MemoryStream())
             {
                 memoryStream.Write(byteArray, 0, byteArray.Length);
@@ -91,61 +112,92 @@ namespace TEAMModelOS.Service.Evaluation.Implements
                     int imageCounter = 0;
                     WmlToHtmlConverterSettings settings = new WmlToHtmlConverterSettings()
                     {
-                        PageTitle = "My Page Title",
+                        PageTitle = "",
                         AdditionalCss = "body { margin: 1cm auto; max-width: 20cm; padding: 0; }",
 
                         FabricateCssClasses = true,
                         CssClassPrefix = "pt-",
                         RestrictToSupportedLanguages = false,
                         RestrictToSupportedNumberingFormats = false,
-                        ImageHandler = imageInfo =>
+                        ImageHandler =   imageInfo =>
                         {
                             ++imageCounter;
                             string extension = imageInfo.ContentType.Split('/')[1].ToLower();
                             ImageFormat imageFormat = null;
-                            if (extension == "png") imageFormat = ImageFormat.Png;
-                            else if (extension == "gif") imageFormat = ImageFormat.Gif;
-                            else if (extension == "bmp") imageFormat = ImageFormat.Bmp;
-                            else if (extension == "jpeg") imageFormat = ImageFormat.Jpeg;
-                            else if (extension == "tiff")
+                            if (extension.Equals("png")) imageFormat = ImageFormat.Png;
+                            else if (extension.Equals("gif")) imageFormat = ImageFormat.Gif;
+                            else if (extension.Equals("bmp")) imageFormat = ImageFormat.Bmp;
+                            else if (extension.Equals("jpeg")) imageFormat = ImageFormat.Jpeg;
+                            else if (extension.Equals("tiff"))
                             {
                                 extension = "gif";
                                 imageFormat = ImageFormat.Gif;
                             }
-                            else if (extension == "x-wmf")
+                            else if (extension.Equals( "x-wmf"))
                             {
                                 extension = "wmf";
                                 imageFormat = ImageFormat.Wmf;
                             }
 
                             if (imageFormat == null) return null;
-
                             string base64 = null;
+                            string mimeType = null;
+                            string shaCode = null; 
                             try
                             {
-                                using (MemoryStream ms = new MemoryStream())
+                                if (extension.Equals("wmf"))
                                 {
-                                    imageInfo.Bitmap.Save(ms, imageFormat);
-                                    var ba = ms.ToArray();
-                                    base64 = System.Convert.ToBase64String(ba);
+                                    var buffer = Encoding.Default.GetBytes(imageInfo.Mathxml);
+                                    base64 = System.Convert.ToBase64String(buffer);
+                                    mimeType = "image/svg+xml";
+                                    shaCode = ShaHashHelper.GetSHA1( new MemoryStream(buffer));
+                                }
+                                else {
+                                    ImageFormat format = imageInfo.Bitmap.RawFormat;
+                                    ImageCodecInfo codec = ImageCodecInfo.GetImageDecoders()
+                                                                .First(c => c.FormatID == format.Guid);
+                                    mimeType = codec.MimeType;
+                                    using (MemoryStream ms = new MemoryStream())
+                                    {
+                                        
+                                        imageInfo.Bitmap.Save(ms, imageFormat);
+                                        var ba = ms.ToArray();
+                                        base64 = System.Convert.ToBase64String(ba);
+                                        shaCode = ShaHashHelper.GetSHA1(ms);
+                                    }
                                 }
                             }
                             catch (System.Runtime.InteropServices.ExternalException)
                             { return null; }
 
-                            ImageFormat format = imageInfo.Bitmap.RawFormat;
-                            ImageCodecInfo codec = ImageCodecInfo.GetImageDecoders()
-                                                        .First(c => c.FormatID == format.Guid);
-                            string mimeType = codec.MimeType;
-
                             string imageSource =
                                     string.Format("data:{0};base64,{1}", mimeType, base64);
-
+                            #region 处理图片存到Bolb
+                            string[] strs = imageSource.Split(',');
+                            string fileExt = StringHelper.SubMidString(strs[0], ":", ";");
+                            if (ContentTypeDict.extdict.TryGetValue(fileExt, out string ext))
+                            {
+                                fileExt = ext;
+                            }
+                            else
+                            {
+                                //解决多种扩展名不能获取的
+                                string[] sp = StringHelper.SubMidString(strs[0], "/", ";").Split("-");
+                                fileExt = sp[sp.Length - 1];
+                                sp = fileExt.Split("+");
+                                fileExt = "." + sp[sp.Length - 1];
+                            }
+                            Stream stream = new MemoryStream(Convert.FromBase64String(strs[1]));
+                             // long bizno = IdWorker.getInstance().NextId();
+                            string filename = shaCode + fileExt;
+                            AzureBlobModel model = azureBlobDBRepository.UploadFileByFolderNAsyn(stream, FolderName, filename, "exercise", false);
+                            #endregion
                             XElement img = new XElement(Xhtml.img,
-                                    new XAttribute(NoNamespace.src, imageSource),
+                                    new XAttribute(NoNamespace.src, model.BlobUrl),
                                     imageInfo.ImgStyleAttribute,
                                     imageInfo.AltText != null ?
                                         new XAttribute(NoNamespace.alt, imageInfo.AltText) : null);
+                            stream.Close();
                             return img;
                         }
                     };
@@ -156,33 +208,16 @@ namespace TEAMModelOS.Service.Evaluation.Implements
                     var htmlString = htmls.ToString(SaveOptions.DisableFormatting);
                     //引入MathJax插件
                     htmlString = htmlString + "<script type=\"text/javascript\" src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>";
-                    File.WriteAllText(folder+"/"+"index.html", htmlString);
-                    return new  { htmlString ,blobPath= folder + "/" + "index.html" };
+                    File.WriteAllText(folder + "/" + "index.html", htmlString);
+                    return new { htmlString, blobPath = folder + "/" + "index.html" };
                 };
             }
         }
 
 
-        private static string SummaryTag = "【题文】";
-        private static string AnswerTag = "【答案】";
-        private static string AnalysisTag = "【解析】";
-        private static string EndedTag = "【结束】";
-        private static string Options = "ABCDEFGHIJ";
-        private static string CompleteStart = "【";
-        private static string CompleteEnd = "】";
-        Dictionary<string, string> TestType = new Dictionary<string, string> {
-            { "Single", "单选题|多选题" }, { "Multiple", "多选题|判断题" },
-            { "Judge", "判断题|填空题" }, { "Complete", "填空题|主观题" },
-            { "Subjective", "主观题|【完结】" } };
-        //private readonly IAzureTableDBRepository azureTableDBRepository;
-        private readonly IHttpContextAccessor httpContextAccessor;
-        private readonly IAzureBlobDBRepository azureBlobDBRepository;
+       
 
-        public ImportExerciseService(IHttpContextAccessor _httpContextAccessor , IAzureBlobDBRepository _azureBlobDBRepository)
-        {
-            azureBlobDBRepository = _azureBlobDBRepository;
-            httpContextAccessor = _httpContextAccessor;
-        }
+       
 
 
         public async Task<List<ExerciseDto>> AnalyzeWordAsync(DocInfoDto dict, string Lang)
@@ -241,41 +276,41 @@ namespace TEAMModelOS.Service.Evaluation.Implements
                     default: break;
                 }
             }
-            SaveExercise(tests, Lang);
+            ///SaveExercise(tests, Lang);
             return tests;
         }
 
 
-        public async void SaveExercise(List<ExerciseDto> exercises, string Lang)
-        {
-            string tmdid = "";
-            List<string> ids = HttpContextHelper.GetLoginUser(httpContextAccessor, "id");
-            if (ids.IsNotEmpty())
-            {
-                tmdid = ids[0];
-            }
-            List<ExerciseVerify> exerciseVerifies = new List<ExerciseVerify>();
-            exercises.ForEach(x =>
-            {
-                ExerciseVerify exercise0 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode, Type = 0, PartitionKey = Lang, Content = x.Question, SummaryCode = x.ShaCode, Status = 1 };
-                exerciseVerifies.Add(exercise0);
-                if (x.Option.IsNotEmpty())
-                {
-                    string opt = MessagePackHelper.ObjectToJson(x.Option);
-                    ExerciseVerify exercise1 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(opt), Type = 1, PartitionKey = Lang, Content = opt, SummaryCode = x.ShaCode, Status = 1 };
-                    exerciseVerifies.Add(exercise1);
-                }
-                if (x.Answer.IsNotEmpty())
-                {
-                    string ans = MessagePackHelper.ObjectToJson(x.Answer);
-                    ExerciseVerify exercise2 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(ans), Type = 2, PartitionKey = Lang, Content = ans, SummaryCode = x.ShaCode, Status = 1 };
-                    exerciseVerifies.Add(exercise2);
-                }
-                ExerciseVerify exercise3 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(x.Explain), Type = 3, PartitionKey = Lang, Content = x.Explain, SummaryCode = x.ShaCode, Status = 1 };
-                exerciseVerifies.Add(exercise3);
-            });
-            await this.SaveOrUpdateAll(exerciseVerifies);
-        }
+        //public async void SaveExercise(List<ExerciseDto> exercises, string Lang)
+        //{
+        //    string tmdid = "";
+        //    List<string> ids = HttpContextHelper.GetLoginUser(httpContextAccessor, "id");
+        //    if (ids.IsNotEmpty())
+        //    {
+        //        tmdid = ids[0];
+        //    }
+        //    List<ExerciseVerify> exerciseVerifies = new List<ExerciseVerify>();
+        //    exercises.ForEach(x =>
+        //    {
+        //        ExerciseVerify exercise0 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode, Type = 0, PartitionKey = Lang, Content = x.Question, SummaryCode = x.ShaCode, Status = 1 };
+        //        exerciseVerifies.Add(exercise0);
+        //        if (x.Option.IsNotEmpty())
+        //        {
+        //            string opt = MessagePackHelper.ObjectToJson(x.Option);
+        //            ExerciseVerify exercise1 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(opt), Type = 1, PartitionKey = Lang, Content = opt, SummaryCode = x.ShaCode, Status = 1 };
+        //            exerciseVerifies.Add(exercise1);
+        //        }
+        //        if (x.Answer.IsNotEmpty())
+        //        {
+        //            string ans = MessagePackHelper.ObjectToJson(x.Answer);
+        //            ExerciseVerify exercise2 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(ans), Type = 2, PartitionKey = Lang, Content = ans, SummaryCode = x.ShaCode, Status = 1 };
+        //            exerciseVerifies.Add(exercise2);
+        //        }
+        //        ExerciseVerify exercise3 = new ExerciseVerify { TeamModelId = tmdid, RowKey = x.ShaCode + "-" + ShaHashHelper.GetSHA1(x.Explain), Type = 3, PartitionKey = Lang, Content = x.Explain, SummaryCode = x.ShaCode, Status = 1 };
+        //        exerciseVerifies.Add(exercise3);
+        //    });
+        //    await this.SaveOrUpdateAll(exerciseVerifies);
+        //}
 
 
         public static List<ExerciseDto> SingleConvert(string TypeKey, string testHtml)

+ 1 - 2
TEAMModelOS.Service/Evaluation/Interfaces/IImportExerciseService.cs

@@ -12,10 +12,9 @@ namespace TEAMModelOS.Service.Evaluation.Interfaces
 {
     public interface IImportExerciseService : IBusinessService, IBaseService
     {
-        Task<List<ExerciseDto>> AnalyzeWordAsync(DocInfoDto docInfo ,string Lang);
+       Task<List<ExerciseDto>> AnalyzeWordAsync(DocInfoDto docInfo ,string Lang);
         
         Task<Dictionary<string, object>> UploadWord(IFormFile file);
-        Task<Dictionary<string, object>> UploadPPTX(IFormFile file);
         
     }
 }

+ 4 - 59
TEAMModelOS/Controllers/Evaluation/ImportExerciseController.cs

@@ -51,20 +51,7 @@ namespace TEAMModelOS.Controllers.Evaluation
             htmlAnalyzeService = _htmlAnalyzeService;
         }
 
-        /// <summary>
-        /// docUrl
-        /// folder
-        /// shaCode
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("AnalyzeWord")]
-        public async Task<BaseJosnRPCResponse> AnalyzeWord(JosnRPCRequest<DocInfoDto> request)
-        {
-            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<ExerciseDto> exercises=  await importExerciseService.AnalyzeWordAsync(request.@params ,request.lang);
-            return builder.Data(exercises).build();
-        }
+        
 
         /// <summary>
         /// docUrl
@@ -74,6 +61,7 @@ namespace TEAMModelOS.Controllers.Evaluation
         /// <param name="request"></param>
         /// <returns></returns>
         [HttpPost("uploadWord")]
+        [AllowAnonymous]
         [RequestSizeLimit(102_400_000_00)] //最大10000m左右
         public async Task<BaseJosnRPCResponse> UploadWord([FromForm] IFormFile file)
         {
@@ -88,51 +76,8 @@ namespace TEAMModelOS.Controllers.Evaluation
         }
 
 
-        /// <summary>
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("uploadPPTX")]
-        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
-        public async Task<BaseJosnRPCResponse> uploadPPTX([FromForm] IFormFile file)
-        {
-            JsonRPCResponseBuilder responseBuilder = new JsonRPCResponseBuilder();
-            if (!FileType.GetExtention(file.FileName).ToLower().Equals("pptx"))
-            {
-                return responseBuilder.Error("type is not pptx").build();
-            }
-            Dictionary<string, object> model = await importExerciseService.UploadPPTX(file);
-
-            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>
         /// htmlString 
         /// </summary>