소스 검색

Merge branch 'develop' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop

psycho 5 년 전
부모
커밋
ffa8278db2
23개의 변경된 파일544개의 추가작업 그리고 33개의 파일을 삭제
  1. 7 0
      TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHelper.cs
  2. 56 0
      TEAMModelOS.SDK/Helper/Common/JsonHelper/JsonSerialization.cs
  3. 188 0
      TEAMModelOS.SDK/Helper/Common/XmlHelper/Json2Xml.cs
  4. 67 0
      TEAMModelOS.SDK/Helper/Common/XmlHelper/XmlAndJson.cs
  5. 60 0
      TEAMModelOS.SDK/Helper/Common/XmlHelper/XmlSerializeHelper.cs
  6. 57 1
      TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs
  7. 3 1
      TEAMModelOS.SDK/Module/AzureBlob/Interfaces/IAzureBlobDBRepository.cs
  8. 1 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXChart.cs
  9. 1 1
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXConnector.cs
  10. 2 3
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXContainer.cs
  11. 2 1
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXElement.cs
  12. 1 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXInfo.cs
  13. 2 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXPicture.cs
  14. 1 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXPosition.cs
  15. 7 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXSlide.cs
  16. 2 1
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXTable.cs
  17. 1 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXText.cs
  18. 1 0
      TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXTheme.cs
  19. 1 1
      TEAMModelOS.SDK/TEAMModelOS.SDK.csproj
  20. 20 9
      TEAMModelOS/Controllers/Core/FileController.cs
  21. 33 0
      TEAMModelOS/Controllers/Evaluation/ImportExerciseController.cs
  22. 22 0
      TeamModelOS.Test.JsonPath/Answer.cs
  23. 9 15
      TeamModelOS.Test.JsonPath/Program.cs

+ 7 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHelper.cs

@@ -222,6 +222,13 @@ namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
             return p;
         }
 
+        public static Color GetColorLumModAndLumOff(Color color, int lumMod = 0, int lumOff = 0) {
+            ColorHSL colorHSL=  RgbToHsl(new ColorRGB(color.R,color.G,color.B));
+            colorHSL.L = (colorHSL.L / 100) * (lumMod / 100_000) + (lumOff / 100_000);
+            return color; 
+        }
+
+
         public static Color GetColorLumModAndOff(Color color, int lumMod=0, int lumOff=0)
         {
             float[] rgb = { color.R, color.G, color.B };

+ 56 - 0
TEAMModelOS.SDK/Helper/Common/JsonHelper/JsonSerialization.cs

@@ -36,7 +36,63 @@ namespace TEAMModelOS.SDK.Helper.Common.JsonHelper
             var json = JsonConvert.SerializeObject(input, format, settings);
             return json;
         }
+        /// <summary>
+        /// 使用json序列化为字符串
+        /// </summary>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制,如:"\/Date(1439335800000+0800)\/"</param>
+        /// <returns></returns>
+        public static string ToJsonAbs(this object input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true, bool isIndented = false)
+        {
+
+            settings = new JsonSerializerSettings
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                TypeNameHandling = TypeNameHandling.All
+            };
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
 
+            //no format
+            var format = isIndented ? Newtonsoft.Json.Formatting.Indented : Formatting.None;
+            var json = JsonConvert.SerializeObject(input, format, settings);
+            return json;
+        }
+        /// <summary>
+        /// 从序列化字符串里反序列化
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="input"></param>
+        /// <param name="dateTimeFormat">默认null,即使用json.net默认的序列化机制</param>
+        /// <returns></returns>
+        public static T FromJsonAbs<T>(this string input, string dateTimeFormat = "yyyy-MM-dd HH:mm:ss", bool ignoreNullValue = true)
+        {
+            var settings = new JsonSerializerSettings()
+            {
+                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+                PreserveReferencesHandling = PreserveReferencesHandling.Objects,
+                TypeNameHandling = TypeNameHandling.All
+            };
+            settings.NullValueHandling = ignoreNullValue ? Newtonsoft.Json.NullValueHandling.Ignore : NullValueHandling.Include;
+
+            if (!string.IsNullOrWhiteSpace(dateTimeFormat))
+            {
+                var jsonConverter = new List<JsonConverter>()
+                {
+                    new Newtonsoft.Json.Converters.IsoDateTimeConverter(){ DateTimeFormat = dateTimeFormat }//如: "yyyy-MM-dd HH:mm:ss"
+                };
+                settings.Converters = jsonConverter;
+            }
+
+            return JsonConvert.DeserializeObject<T>(input, settings);
+        }
         /// <summary>
         /// 从序列化字符串里反序列化
         /// </summary>

+ 188 - 0
TEAMModelOS.SDK/Helper/Common/XmlHelper/Json2Xml.cs

@@ -0,0 +1,188 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+namespace TEAMModelOS.SDK.Helper.Common.XmlHelper
+{
+    public class Json2Xml
+    {
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.2612.0")]
+        [System.SerializableAttribute()]
+        [System.Xml.Serialization.XmlTypeAttribute(Namespace = "urn:ebay:apis:eBLBaseComponents")]
+        public enum ItemSpecificSourceCodeType
+        {
+
+            /// <remarks/>
+            ItemSpecific,
+
+            /// <remarks/>
+            Attribute,
+
+            /// <remarks/>
+            Product,
+
+            /// <remarks/>
+            CustomCode,
+        }
+
+        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.2612.0")]
+        [System.SerializableAttribute()]
+        [System.Diagnostics.DebuggerStepThroughAttribute()]
+        [System.ComponentModel.DesignerCategoryAttribute("code")]
+        [System.Xml.Serialization.XmlTypeAttribute(Namespace = "urn:ebay:apis:eBLBaseComponents")]
+        public partial class NameValueListType
+        {
+
+            private string nameField;
+
+            private string[] valueField;
+
+            private ItemSpecificSourceCodeType sourceField;
+
+            private bool sourceFieldSpecified;
+
+            private System.Xml.XmlElement[] anyField;
+
+            /// <remarks/>
+            public string Name
+            {
+                get
+                {
+                    return this.nameField;
+                }
+                set
+                {
+                    this.nameField = value;
+                }
+            }
+
+            /// <remarks/>
+            [System.Xml.Serialization.XmlElementAttribute("Value")]
+            public string[] Value
+            {
+                get
+                {
+                    return this.valueField;
+                }
+                set
+                {
+                    this.valueField = value;
+                }
+            }
+
+            /// <remarks/>
+            public ItemSpecificSourceCodeType Source
+            {
+                get
+                {
+                    return this.sourceField;
+                }
+                set
+                {
+                    this.sourceField = value;
+                }
+            }
+
+            /// <remarks/>
+            [System.Xml.Serialization.XmlIgnoreAttribute()]
+            public bool SourceSpecified
+            {
+                get
+                {
+                    return this.sourceFieldSpecified;
+                }
+                set
+                {
+                    this.sourceFieldSpecified = value;
+                }
+            }
+
+            /// <remarks/>
+            [System.Xml.Serialization.XmlAnyElementAttribute()]
+            public System.Xml.XmlElement[] Any
+            {
+                get
+                {
+                    return this.anyField;
+                }
+                set
+                {
+                    this.anyField = value;
+                }
+            }
+        }
+
+        public class CustomItemSpecifics
+        {
+            public NameValueListType[] ItemSpecifics;
+        }
+
+        public class Item
+        {
+            public string Name { get; set; }
+
+            public string Value { get; set; }
+
+            public string[] RecommValues { get; set; }
+
+            //public void DataTable2Entity(Item item, DataRow dr) {
+            //    item.Name=dr.
+            //}
+        }
+
+        public static string ObjectToText(Object inObject, Type inType)
+        {
+            String XmlizedString = null;
+            MemoryStream ms = new MemoryStream();
+            XmlSerializer xs = new XmlSerializer(inType);
+            XmlTextWriter xmlTextWriter = new XmlTextWriter(ms, Encoding.UTF8);
+            xs.Serialize(xmlTextWriter, inObject);
+            ms = (MemoryStream)xmlTextWriter.BaseStream;
+            XmlizedString = UTF8ByteArrayToString(ms.ToArray());
+
+            return XmlizedString;
+        }
+
+        private static String UTF8ByteArrayToString(Byte[] characters)
+        {
+            UTF8Encoding encoding = new UTF8Encoding();
+            String constructedString = encoding.GetString(characters);
+
+            if (constructedString.Length > 0)
+            {
+                constructedString = constructedString.Substring(1);
+            }
+            return (constructedString);
+        }
+
+        public static Object TextToObject(string inText, Type inType)
+        {
+            try
+            {
+                if (string.IsNullOrEmpty(inText))
+                {
+                    return null;
+                }
+                else
+                {
+                    XmlSerializer xs = new XmlSerializer(inType);
+                    MemoryStream ms = new MemoryStream(StringToUTF8ByteArray(inText));
+                    XmlTextWriter xmlTextWriter = new XmlTextWriter(ms, Encoding.UTF8);
+                    return (Object)xs.Deserialize(ms);
+                }
+            }
+            catch
+            {
+                return null;
+            }
+        }
+        private static byte[] StringToUTF8ByteArray(string inText)
+        {
+            UTF8Encoding encoding = new UTF8Encoding();
+            Byte[] byteArray = encoding.GetBytes(inText);
+
+            return byteArray;
+        }
+    }
+}

+ 67 - 0
TEAMModelOS.SDK/Helper/Common/XmlHelper/XmlAndJson.cs

@@ -0,0 +1,67 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Text;
+using System.Xml;
+
+namespace TEAMModelOS.SDK.Helper.Common.XmlHelper
+{
+    public class XmlAndJson
+    {  /// <summary>
+       /// 返回指定节点下信息的JSON格式字符串
+       /// </summary>
+       /// <param name="str">xml字符串</param>
+       /// <param name="nodename">节点名称,应从根节点开始</param>
+       /// <returns></returns>
+        public static string XML2Json(string str, string nodename)
+        {
+            string result = null;
+            XmlDocument xmldoc = new XmlDocument();
+            xmldoc.LoadXml(str);
+            XmlNode node = xmldoc.SelectSingleNode(nodename);
+            result = Newtonsoft.Json.JsonConvert.SerializeXmlNode(node);
+            return result;
+        }
+
+        public static string Json2XML(string str)
+        {
+            string result = null;
+            XmlDocument xml = Newtonsoft.Json.JsonConvert.DeserializeXmlNode(str);
+            result = xml.OuterXml;
+            return result;
+        }
+        public static string GetCustomItemSpecifics(string str)
+        {
+            DataTable dt = JsonConvert.DeserializeObject<DataTable>(str);
+
+            List<Json2Xml.NameValueListType> nvl = new List<Json2Xml.NameValueListType>();
+
+            foreach (DataRow dr in dt.Rows)
+            {
+                Json2Xml.NameValueListType nv = new Json2Xml.NameValueListType();
+
+                string sName = dr["Name"].ToString();
+                string sValue = dr["Value"].ToString();
+
+                if (sName != string.Empty && sValue != string.Empty)
+                {
+                    nv.Name = sName;
+                    nv.Value = new string[] { sValue };
+                    nvl.Add(nv);
+                }
+            }
+
+            if (nvl.Count == 0)
+            {
+                return string.Empty;
+            }
+            else
+            {
+                Json2Xml.CustomItemSpecifics t = new Json2Xml.CustomItemSpecifics();
+                t.ItemSpecifics = nvl.ToArray();
+                return Json2Xml.ObjectToText(t, typeof(Json2Xml.CustomItemSpecifics));
+            }
+        }
+    }
+}

+ 60 - 0
TEAMModelOS.SDK/Helper/Common/XmlHelper/XmlSerializeHelper.cs

@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml.Serialization;
+
+namespace TEAMModelOS.SDK.Helper.Common.XmlHelper
+{
+
+    /// <summary>
+    /// XML序列化公共处理类
+    /// </summary>
+    public static class XmlSerializeHelper
+    {
+        /// <summary>
+        /// 将实体对象转换成XML
+        /// </summary>
+        /// <typeparam name="T">实体类型</typeparam>
+        /// <param name="obj">实体对象</param>
+        public static string XmlSerialize<T>(T obj)
+        {
+            try
+            {
+                using (StringWriter sw = new StringWriter())
+                {
+                    Type t = obj.GetType();
+                    XmlSerializer serializer = new XmlSerializer(obj.GetType());
+                    serializer.Serialize(sw, obj);
+                    sw.Close();
+                    return sw.ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("将实体对象转换成XML异常", ex);
+            }
+        }
+
+        /// <summary>
+        /// 将XML转换成实体对象
+        /// </summary>
+        /// <typeparam name="T">实体类型</typeparam>
+        /// <param name="strXML">XML</param>
+        public static T DESerializer<T>(string strXML) where T : class
+        {
+            try
+            {
+                using (StringReader sr = new StringReader(strXML))
+                {
+                    XmlSerializer serializer = new XmlSerializer(typeof(T));
+                    return serializer.Deserialize(sr) as T;
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception("将XML转换成实体对象异常", ex);
+            }
+        }
+    }
+}

+ 57 - 1
TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs

@@ -190,6 +190,62 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Implements
             return model;
         }
 
+
+
+        public async Task<AzureBlobModel> UploadText(string fileName, string text, string fileSpace = "common", bool contentTypeDefault = true)
+        {
+            string groupName = fileSpace + "/" + DateTime.Now.ToString("yyyyMMdd");
+            string newFileName = DateTime.Now.ToString("HHmmssfffffff");
+            blobContainer = blobClient.GetContainerReference(groupName);
+            StorageUri url = blobContainer.StorageUri;
+            //FileInfo file = new FileInfo(path);
+            string[] names = fileName.Split(".");
+            string name = "";
+            for (int i = 0; i < names.Length - 1; i++)
+            {
+                name = name + names[i];
+            }
+            if (names.Length <= 1)
+            {
+                name = fileName + "_" + newFileName;
+            }
+            else
+            {
+                name = name + "_" + newFileName + "." + names[names.Length - 1];
+            }
+            var blockBlob = blobContainer.GetBlockBlobReference(name);
+            //  var parsedContentDisposition = ContentDispositionHeaderValue.Parse("form-data; name=\"files\"; filename=\"" + file.Name + "\"");
+            string fileext = fileName.Substring(fileName.LastIndexOf(".") > 0 ? fileName.LastIndexOf(".") : 0);
+            string content_type = "application/octet-stream";
+            if (!contentTypeDefault)
+            {
+                ContentTypeDict.dict.TryGetValue(fileext, out string contenttype);
+                if (!string.IsNullOrEmpty(contenttype))
+                {
+                    blockBlob.Properties.ContentType = contenttype;
+                    content_type = contenttype;
+                }
+                else
+                {
+                    blockBlob.Properties.ContentType = content_type;
+                }
+            }
+            else
+            {
+                blockBlob.Properties.ContentType = content_type;
+            }
+            
+            long length = System.Text.Encoding.Default.GetBytes(text).Length;
+            await blockBlob.UploadTextAsync(text);
+            //var provider = new FileExtensionContentTypeProvider();
+            //var memi = provider.Mappings[fileext];
+            AzureBlobModel model = new AzureBlobModel(fileName, _options.Container, groupName, name, content_type, length)
+            {
+                BlobUrl = url.PrimaryUri.ToString().Split("?")[0] + "/" + name
+            };
+            return model;
+        }
+
         public async Task<AzureBlobModel> UploadObject(string fileName,object obj, string fileSpace = "common", bool contentTypeDefault =true)
         {
             string groupName = fileSpace + "/" + DateTime.Now.ToString("yyyyMMdd");
@@ -231,7 +287,7 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Implements
             else {
                 blockBlob.Properties.ContentType = content_type;
             }
-            string objStr = obj.ToJson();
+            string objStr = obj.ToJsonAbs();
             long length = System.Text.Encoding.Default.GetBytes(objStr).Length;
             await blockBlob.UploadTextAsync(objStr);
             //var provider = new FileExtensionContentTypeProvider();

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

@@ -11,6 +11,8 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Interfaces
         Task<AzureBlobModel> UploadFile(IFormFile file, string fileSpace = "wordfiles", bool contentTypeDefault = true);
         Task<AzureBlobModel> UploadPath(string path, string fileSpace = "common", bool contentTypeDefault = false);
         Task<AzureBlobModel> UploadObject(string fileName, object obj, string fileSpace = "common", bool contentTypeDefault = true);
-        
+        Task<AzureBlobModel> UploadText(string fileName, string text, string fileSpace = "common", bool contentTypeDefault = true);
+
+
     }
 }

+ 1 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXChart.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {

+ 1 - 1
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXConnector.cs

@@ -1,12 +1,12 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
     public class PPTXConnector : PPTXPosition
     {
-
         /// <summary>
         ///连接线 p:cxnSp
         /// </summary>

+ 2 - 3
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXContainer.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
@@ -40,14 +41,12 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
         public List<PPTXShapeGuide> ShapeGuides { get; set; }
 
     }
-
     public class PPTXShapeGuide
     {
         public string Name { get; set; }
         public string Fmla { get; set; }
 
     }
-
     public class PPTXParagraph
     {
         public PPTXParagraph() {
@@ -56,7 +55,6 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
         public List<PPTXText> Texts { get; set; }
 
     }
-
     public abstract class PPTXPath
     {
         public string Type { get; set; }
@@ -122,6 +120,7 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
         }
         public List<Point> Pts { get; set; }
     }
+ 
     public class Point{
         public double X { get; set; }
         public double Y { get; set; }

+ 2 - 1
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXElement.cs

@@ -1,10 +1,11 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
-    public interface PPTXElement
+    public abstract class PPTXElement
     {
     }
 }

+ 1 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXInfo.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {

+ 2 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXPicture.cs

@@ -1,9 +1,11 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
+ 
     public class PPTXPicture : PPTXPosition
     {
         //类型

+ 1 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXPosition.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {

+ 7 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXSlide.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
@@ -12,6 +13,12 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
         }
         //public int Width { get; set; }
         //public int Height { get; set; }
+        [XmlElement(typeof(PPTXChart))]
+        [XmlElement(typeof(PPTXConnector))]
+        [XmlElement(typeof(PPTXContainer))]
+        [XmlElement(typeof(PPTXPicture))]
+        [XmlElement(typeof(PPTXPosition))]
+        [XmlElement(typeof(PPTXTable))]
         public List<PPTXElement> Elements { get; set; }
 
 

+ 2 - 1
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXTable.cs

@@ -1,10 +1,11 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {
-     public class PPTXTable : PPTXPosition
+    public class PPTXTable : PPTXPosition
     {
         public string Type { get; set; }
         public int Row { get; }

+ 1 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXText.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {

+ 1 - 0
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXTheme.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Xml.Serialization;
 
 namespace TEAMModelOS.SDK.Module.PowerPointX.Model
 {

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

@@ -4,7 +4,7 @@
     <TargetFramework>netcoreapp2.2</TargetFramework>
     <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
     <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
-    <Version>1.0.3</Version>
+    <Version>1.0.5</Version>
   </PropertyGroup>
 
   <ItemGroup>

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 20 - 9
TEAMModelOS/Controllers/Core/FileController.cs


+ 33 - 0
TEAMModelOS/Controllers/Evaluation/ImportExerciseController.cs

@@ -1,6 +1,7 @@
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.WindowsAzure.Storage.Table;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,14 +10,19 @@ using TEAMModelOS.Controllers.Core;
 using TEAMModelOS.Model.Core.Models;
 using TEAMModelOS.Model.Evaluation.Dtos;
 using TEAMModelOS.Model.Evaluation.Dtos.Own;
+using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Constant.Common;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcRequest;
 using TEAMModelOS.SDK.Extension.DataResult.JsonRpcResponse;
 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.Module.AzureBlob.Container;
 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.Interfaces;
 using TEAMModelOS.Service.Evaluation.Interfaces;
 
@@ -99,7 +105,34 @@ namespace TEAMModelOS.Controllers.Evaluation
 
             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>

+ 22 - 0
TeamModelOS.Test.JsonPath/Answer.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TeamModelOS.Test.JsonPath
+{
+    public class Answer
+    {
+        public string Id { get; set; }
+        public string Number { get; set; }
+        public string ExNO { get; set; }
+        public string StudentId { get; set; }
+        public string Index { get; set; }
+        public float Point { get; set; }
+        public string Detail { get; set; }
+        public string CourseCode { get; set; }
+        public string ClassCode { get; set; }
+        public string GradeCode { get; set; }
+        public string SchoolCode { get; set; }
+        public string ExamName { get; set; }
+    }
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 9 - 15
TeamModelOS.Test.JsonPath/Program.cs