Browse Source

Merge branch 'develop3.0' of http://106.12.23.251:10080/TEAMMODEL/TEAMModelOS into develop3.0

OnePsycho 5 years ago
parent
commit
7e52560f81

+ 76 - 4
TEAMModelOS.SDK/Module/AzureCosmosDB/Implements/AzureCosmosDBRepository.cs

@@ -727,14 +727,86 @@ namespace TEAMModelOS.SDK.Module.AzureCosmosDB.Implements
         {
         {
             if (DocumentCollectionDict.TryGetValue(CollectionName, out DocumentCollection collection))
             if (DocumentCollectionDict.TryGetValue(CollectionName, out DocumentCollection collection))
             {
             {
-              //  collection = await InitializeCollection(CollectionName, "");
-                StringBuilder sql = new StringBuilder("select * from " + CollectionName + " c where 1=1 ");
+                //  collection = await InitializeCollection(CollectionName, "");
+                /*    StringBuilder sql = new StringBuilder("select * from " + CollectionName + " c where 1=1 ");
+                    if (dict != null)
+                    {
+                        foreach (string key in dict.Keys)
+                        {
+                            sql.Append(GenSql(dict[key], key));
+                        }
+                    }*/
+                StringBuilder sql = new StringBuilder("select value(c) from c");
                 if (dict != null)
                 if (dict != null)
                 {
                 {
-                    foreach (string key in dict.Keys)
+
+                    string Join = " join ";
+                    string instring = "in ";
+                    Dictionary<string, string> keyValues = new Dictionary<string, string>();
+                    StringBuilder ps = new StringBuilder();
+                    int heada = 0;
+                    string[] sqlHead = new string[] { "A", "B", "C", "D", "E", "F" };
+                    int kslength = 0;
+                    foreach (KeyValuePair<string, object> item in dict)
                     {
                     {
-                        sql.Append(GenSql(dict[key], key));
+
+                        int index = 0;
+                        string[] ks = item.Key.Split("[*]");
+
+                        if (ks.Length > 1)
+                        {
+                            kslength += ks.Length;
+                            if (kslength < (7 + heada))
+                            {
+                                StringBuilder sqlitem = new StringBuilder();
+                                for (int i = 0; i < ks.Length - 1; i++)
+                                {
+
+                                    //Console.WriteLine(ks[i]);
+                                    if (i == 0)
+                                    {
+                                        sqlitem.Append(Join);
+                                        string a = sqlHead[heada] + index;
+                                        sqlitem.Append(a + " ");
+                                        //keyValues.Add(ks[i], a);
+                                        keyValues[ks[i]] = a;
+                                        sqlitem.Append(instring);
+                                        sqlitem.Append("c.");
+                                        sqlitem.Append(ks[i]);
+                                    }
+                                    else
+                                    {
+                                        sqlitem.Append(Join + " ");
+                                        string a = sqlHead[heada] + index;
+                                        sqlitem.Append(a + " ");
+                                        //keyValues.Add(ks[i], a);
+                                        keyValues[ks[i]] = a;
+                                        sqlitem.Append(instring);
+                                        sqlitem.Append(keyValues[ks[i - 1]]);
+                                        sqlitem.Append(ks[i]);
+                                    }
+                                    index += 1;
+                                }
+                                // Console.WriteLine(sqlitem);
+                                sql.Append(sqlitem);
+                                string s;
+                                s = "and " + sqlHead[heada] + (ks.Length - 2) + ks[index] + " = " + "\"" + item.Value.ToString() + "\"";
+                                ps.Append(s);
+                            }
+                            else
+                            {
+                                 throw new BizException("数组总共深度不能超过5层",ResponseCode.PARAMS_ERROR);
+                                
+                            }
+
+                        }
+                        else
+                        {
+                            ps.Append(GenSql(dict[item.Key], item.Key));
+                        }
+                        heada += 1;
                     }
                     }
+                    sql.Append(" where 1=1 ").Append(ps);
                 }
                 }
                 FeedOptions queryOptions;
                 FeedOptions queryOptions;
                 if (collection.PartitionKey.Paths.Count > 0)
                 if (collection.PartitionKey.Paths.Count > 0)

+ 5 - 0
TEAMModelOS.Service/Models/PowerPoint/FontStyle.cs

@@ -6,6 +6,11 @@ namespace HiTeachCC.Model.PowerPoint
 {
 {
     public  class FontStyle
     public  class FontStyle
     {
     {
+        /// <summary>
+        /// 
+        /// font-family、font-style、font-weight、font-variant、font-stretch、font-size、font-size-adjust、
+        /// kerning、letter-spacing、word-spacing和text-decoration
+        /// </summary>
         public string Color { get; set; }
         public string Color { get; set; }
         public int Size { get; set; }
         public int Size { get; set; }
         public string Type { get; set; }
         public string Type { get; set; }

+ 2 - 0
TEAMModelOS.Service/Models/PowerPoint/Item.cs

@@ -6,10 +6,12 @@ namespace HiTeachCC.Model.PowerPoint
 {
 {
     public abstract class Item
     public abstract class Item
     {
     {
+        // Sp  CxnSp Media Group
         public string Type { get; set; }
         public string Type { get; set; }
         public Position Position { get; set; }
         public Position Position { get; set; }
         public string Xml { get; set; }
         public string Xml { get; set; }
         public int Index { get; set; }
         public int Index { get; set; }
+        public Svg Svg { get; set; }
         //public Picture Picture { get; set; }
         //public Picture Picture { get; set; }
         //public Shape Shape { get; set; }
         //public Shape Shape { get; set; }
         //public Math Math { get; set; }
         //public Math Math { get; set; }

+ 3 - 1
TEAMModelOS.Service/Models/PowerPoint/Path.cs

@@ -5,7 +5,9 @@ using System.Text;
 namespace HiTeachCC.Model.PowerPoint
 namespace HiTeachCC.Model.PowerPoint
 {
 {
     public abstract class Path
     public abstract class Path
-    {
+    {   
+        double w { get; set; }
+        double h { get; set; }
         public string Type { get; set; }
         public string Type { get; set; }
     }
     }
     public   class ClosePath :Path
     public   class ClosePath :Path

+ 102 - 1
TEAMModelOS.Service/Models/PowerPoint/Shape.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Text;
 using System.Text;
 
 
@@ -13,7 +13,108 @@ namespace HiTeachCC.Model.PowerPoint
        
        
         public List<ShapeGuide> ShapeGuides { get; set; }
         public List<ShapeGuide> ShapeGuides { get; set; }
         public List<Path> Paths { get; set; }
         public List<Path> Paths { get; set; }
+         
 
 
+    }
+
+    public class Svg { 
+        public string Id { get; set; }
+        public string Width { get; set; }
+        public string Height { get; set; }
+        public string Top { get; set; }
+        public string Left { get; set; }
+        public string Style { get; set; }
+        public List<SvgShape> SvgShape { get; set; }
+        public string Defs { get; set; }
+        public string Transform { get; set; }
+        public string SvgData { get; set; }
+       
+    }
+
+    public abstract class SvgShape {
+        // rect ,circle ,ellipse ,line ,polygon ,polyline ,path
+        public string Type { get; set; }
+        public string Style { get; set; }
+        public string Stroke { get; set; }
+        //描边的不透明度
+       // public string StrokeOpacity { get; set; } = "1";
+        public string StrokeWidth { get; set; }
+        // 虚线类型描边
+        public string StrokeDasharray { get; set; }
+        public string Fill { get; set; }
+        public string Transform { get; set; }
+        public string MarkerStart { get; set; }
+        public string MarkerEnd { get; set; }
+        //填充色的不透明度
+        //  public string FillOpacity { get; set; } = "1";
+    }
+    public class Rect : SvgShape
+    { 
+        //矩形左上角的x位置
+        public string X { get; set; }
+        //矩形左上角的y位置
+        public string Y { get; set; }
+        //矩形的宽度
+        public string Width { get; set; }
+        //矩形的高度
+        public string Height { get; set; }
+        // 圆角的x方位的半径
+        public string Rx { get; set; }
+        // 圆角的y方位的半径
+        public string Ry { get; set; }
+    }
+    public class Circle : SvgShape
+    {
+        //圆的半径
+        public string R { get; set; }
+        //圆心的x位置
+        public string Cx { get; set; }
+        //圆心的y位置
+        public string Cy { get; set; }
+    }
+    public class Ellipse : SvgShape
+    {
+        // 椭圆的x方位的半径
+        public string Rx { get; set; }
+        // 椭圆的y方位的半径
+        public string Ry { get; set; }
+
+        //椭圆的x位置
+        public string Cx { get; set; }
+        //椭圆的y位置
+        public string Cy { get; set; }
+    }
+    public class Line : SvgShape
+    {
+        //起点的x位置
+        public string X1 { get; set; }
+        //起点的Y位置
+        public string Y1 { get; set; }
+        //终点的X位置
+        public string X2 { get; set; }
+        //终点的Y位置
+        public string Y2 { get; set; }
+    }
+    public class Polyline : SvgShape
+    {
+        /// <summary>
+        /// 点集数列。每个数字用空白、逗号、终止命令符或者换行符分隔开。每个点必须包含2个数字,一个是x坐标,一个是y坐标。所以点列表 (0,0), (1,1) 和(2,2)可以写成这样:“0 0, 1 1, 2 2”。
+        /// </summary>
+        public string Points { get; set; }
+    }
+    public class Polygon : SvgShape
+    {
+        /// <summary>
+        /// 点集数列。每个数字用空白符、逗号、终止命令或者换行符分隔开。每个点必须包含2个数字,一个是x坐标,一个是y坐标。
+        /// 所以点列表 (0,0), (1,1) 和(2,2)可以写成这样:“0 0, 1 1, 2 2”。路径绘制完后闭合图形,所以最终的直线将从位置(2,2)连接到位置(0,0)。
+        /// </summary>
+        public string Points { get; set; }
+
+    }
+    public class SvgPath : SvgShape
+    {
+        public string D { get; set; }
+    
     }
     }
     public class ShapeGuide
     public class ShapeGuide
     {
     {

File diff suppressed because it is too large
+ 227 - 799
TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeGenerator.cs


File diff suppressed because it is too large
+ 2223 - 469
TEAMModelOS.Service/Services/PowerPoint/Implement/ShapeSvg.cs


+ 16 - 1
TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs

@@ -9,7 +9,6 @@ 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.Common.JsonHelper;
-using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.SDK.Module.AzureCosmosDB.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
 using TEAMModelOS.Service.Models.Core;
 using TEAMModelOS.Service.Models.Core;
@@ -405,5 +404,21 @@ namespace TEAMModelOS.Controllers.Syllabus
                 builder.Error(false, ResponseCode.NOT_FOUND, "未找到对应知识块");
                 builder.Error(false, ResponseCode.NOT_FOUND, "未找到对应知识块");
             }
             }
         }
         }
+
+
+      
+        [HttpPost("Test")]
+        public async Task<BaseJosnRPCResponse> Test(JosnRPCRequest<Dictionary<string, object>> request)
+        {
+            JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
+            if (request.@params != null)
+            {
+                IQueryable<dynamic> data = _cosmos.FindByDict("SchoolBlock", request.@params);
+                return builder.Data(data).build();
+
+            }
+            else return builder.Error(false, ResponseCode.PARAMS_ERROR, "参数为空").build();
+        }
+
     }
     }
 }
 }

+ 2 - 0
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -43,7 +43,9 @@ namespace TEAMModelOS.Controllers.Syllabus
         }
         }
         public static List<SyllabusNode> TreeToList(List<SyllabusTree> trees, List<SyllabusNode> nodes)
         public static List<SyllabusNode> TreeToList(List<SyllabusTree> trees, List<SyllabusNode> nodes)
         {
         {
+            trees = trees.OrderBy(x => x.order).ToList(); 
             nodes.AddRange(trees.ToJson().FromJson<List<SyllabusNode>>());
             nodes.AddRange(trees.ToJson().FromJson<List<SyllabusNode>>());
+
             foreach (SyllabusTree tree in trees)
             foreach (SyllabusTree tree in trees)
             {
             {
                 if (null != tree.children && tree.children.Count > 0)
                 if (null != tree.children && tree.children.Count > 0)

+ 3 - 2
TEAMModelOS/Startup.cs

@@ -11,11 +11,13 @@ using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Http.Features;
 using Microsoft.AspNetCore.Http.Features;
+using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.SpaServices;
 using Microsoft.AspNetCore.SpaServices;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Hosting;
 using Microsoft.IdentityModel.Tokens;
 using Microsoft.IdentityModel.Tokens;
+using Newtonsoft.Json;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Attributes.Azure;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Configuration;
 using TEAMModelOS.SDK.Context.Filter;
 using TEAMModelOS.SDK.Context.Filter;
@@ -96,7 +98,7 @@ namespace TEAMModelOS
             //    });
             //    });
             //});
             //});
             services.AddMemoryCache();
             services.AddMemoryCache();
-            services.AddControllers().AddNewtonsoftJson();
+            services.AddControllers().AddNewtonsoftJson().AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = true; });
             //上传文件最大处理
             //上传文件最大处理
             services.Configure<FormOptions>(x =>
             services.Configure<FormOptions>(x =>
             {   x.BufferBodyLengthLimit= long.MaxValue;
             {   x.BufferBodyLengthLimit= long.MaxValue;
@@ -105,7 +107,6 @@ namespace TEAMModelOS
                 x.MultipartHeadersLengthLimit = int.MaxValue;
                 x.MultipartHeadersLengthLimit = int.MaxValue;
             });
             });
 
 
-
             // Table配置
             // Table配置
             services.AddScoped<IAzureTableDBRepository, AzureTableDBRepository>();
             services.AddScoped<IAzureTableDBRepository, AzureTableDBRepository>();
             //使用Blob配置
             //使用Blob配置