CrazyIter 4 роки тому
батько
коміт
897a500726

+ 1 - 1
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs

@@ -85,7 +85,7 @@ namespace TEAMModelOS.SDK.DI
             }
             byte[] bytes = System.Text.Encoding.Default.GetBytes(text);
             Stream streamBlob= new MemoryStream(bytes);
-            await blockBlob.UploadAsync(streamBlob);
+            await blockBlob.UploadAsync(streamBlob,true);
             blockBlob.SetHttpHeaders(new BlobHttpHeaders { ContentType = content_type });
             AzureBlobModel model = new AzureBlobModel(fileName, name, folder, fileName, folder, content_type, bytes.Length)
             {

+ 0 - 368
TEAMModelOS.Service/Services/Analysis/Implements/AchievementService.cs

@@ -1,368 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Analysis.Interfaces;
-
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Analysis.Implements
-{
-    public class AchievementService : IAchievementService
-    {
-        public AzureCosmosFactory _cosmosrepository;
-
-        public AchievementService(AzureCosmosFactory cosmosDBRepository)
-        {
-            _cosmosrepository = cosmosDBRepository;
-        }
-        //处理各个班级均分分析
-        public Dictionary<string, object> GetAverage(List<ExamResult> exams, List<string> gav, List<string> cav, List<List<double>> subSum, List<Student> students)
-        {
-            Dictionary<string, object> Average = new Dictionary<string, object>();
-            List<List<string>> classAverage = new List<List<string>>();
-            HashSet<string> classList = new HashSet<string>();
-            List<string> keys = new List<string>();
-            if (exams.IsNotEmpty())
-            {
-                keys.Add("setNo");
-                keys.Add("name");
-                keys.Add("score");
-                keys.Add("classAverage");               
-                keys.Add("gradeAverage");
-                int j = 0;
-                exams[0].classes.ForEach(c =>
-                    {
-                        //c.Keys遍历key值
-                        foreach (string key in c.Keys)
-                        {
-                            classList.Add(key);
-                        }
-                        int k = 0;
-                        //每个班级平均分
-                        foreach (int[] value in c.Values)
-                        {  
-                            for (int i = value[0]; i <= value[1]; i++)
-                            {
-                                List<string> stuPoint = new List<string>();
-                                keys.ForEach(x =>
-                                {
-                                    stuPoint.Add("-");
-                                });
-                                stuPoint[0] = (i + 1).ToString();
-                                foreach (Student ss in students)
-                                {
-                                    if (exams[0].ids[i].Equals(ss.studentId))
-                                    {
-                                        stuPoint[1] = ss.name;
-                                        break;
-                                    }
-                                }
-                                
-                                stuPoint[2] = subSum[j][k].ToString() ;
-                                stuPoint[3] = cav[j];
-                                stuPoint[4] = gav[0];
-                                classAverage.Add(stuPoint);
-                                k++;
-                            }
-                            j++;
-                        }                       
-                    });
-                Average.Add("keys",keys);
-                Average.Add("datas", classAverage);
-            }
-            return Average;
-                
-        }
-
-        public List<Dictionary<string, object>> GetPR(List<ExamResult> exams, List<List<double>> subSum,List<Student> students)
-        {
-            // 计算公式 PR=100- (100*R-50)/N
-            List<Dictionary<string, object>> subPR = new List<Dictionary<string, object>>();
-            List<Dictionary<string, object>> datas = new List<Dictionary<string, object>>();
-            HashSet<string> classList = new HashSet<string>();
-            List<string> keys = new List<string>();
-            List<string> className = new List<string>();
-            if (exams.IsNotEmpty()) {
-                keys.Add("name");
-                keys.Add("setNo");
-                keys.Add("score");
-                keys.Add("classRank");
-                keys.Add("classPR");
-                keys.Add("gradeRank");
-                keys.Add("gradePR");
-                keys.Add("areaRank");
-                keys.Add("areaPR");
-                //keys.Add("classAverage");
-                //keys.Add("gradeAverage");
-                
-                exams.ForEach(e =>
-                {
-                    Dictionary<string, object> PR = new Dictionary<string, object>
-                    {
-                        { "name", e.subjectCode }
-                    };
-                    List<string> stuPRG = new List<string>();
-                    List<string> ClassAverage = new List<string>();
-                    List<List<List<string>>> classPR = new List<List<List<string>>>();
-                    //初始化科目总分
-                    double subjectPoint = 0;
-
-                    //科目平均分
-                    double subAverage = 0;
-                    e.classes.ForEach(c =>
-                    {
-                        List<List<string>> classPRL = new List<List<string>>();
-                        //c.Keys遍历key值
-                        List<string> stuPR = new List<string>();
-                        //初始化各班参考人数
-                        int counts = 0;
-                        //初始化班级缺考人数
-                        int classCount = 0;
-                        //初始化班级平均分
-                        double points = 0;
-                        //初始化班级总分
-                        double classPoint = 0;
-                        foreach (string key in c.Keys)
-                        {
-                            classList.Add(key);
-                        }
-                        //每个班级平均分
-                        foreach (int[] value in c.Values)
-                        {
-                            int seatNo = 1;
-                            for (int i = value[0]; i <= value[1]; i++)
-                            {
-                                List<string> SPR = new List<string>();
-                                keys.ForEach(x =>
-                                {
-                                    SPR.Add("-");
-                                });
-                                if (e.result[i].Sum() == 0)
-                                {
-                                    classCount++;
-                                    seatNo++;
-                                    continue;
-
-                                }
-                                stuPR.Add(e.result[i].Sum().ToString());
-                                stuPRG.Add(e.result[i].Sum().ToString());
-                                SPR[1] = seatNo.ToString() ;
-                                SPR[2] = e.result[i].Sum().ToString();
-                                SPR[0] = e.ids[i];
-                                classPRL.Add(SPR);
-                                //计算班级PR值
-                                //int classPR = 100 - (100*)
-                                classPoint += e.result[i].Sum();                               
-                                seatNo++;
-                            }
-                            counts = value[1] - value[0] - classCount + 1;
-                            points = Convert.ToDouble(classPoint) / counts;
-                            ClassAverage.Add(points.ToString("0.00"));
-                        }
-                        
-                        //foreach (List<string> pl in classPRL) {
-                        //单科计算班级排名
-                        stuPR.Sort(delegate (string s1, string s2) { return int.Parse(s2).CompareTo(int.Parse(s1)); });
-                        
-                        foreach (List<string> pl in classPRL) {
-                            
-                            int index = stuPR.IndexOf(pl[2]);
-                            //int gradeIndex = stuPRG.IndexOf(pl[2]);
-                            pl[3] = (index + 1).ToString();
-                            int CPR = 100 - (100 * int.Parse(pl[3]) - 50) / stuPR.Count;
-                            pl[4] = CPR.ToString();
-                            //pl.Add(index.ToString());
-                            foreach (Student ss in students)
-                            {
-                                if (pl[0].Equals(ss.studentId))
-                                {
-                                    pl[0] = ss.name;
-                                    break;
-                                }
-                            }
-                        }
-
-                        //}
-                        classPR.Add(classPRL);
-
-                    });
-                    //科目平均分
-                    ClassAverage.ForEach(a =>
-                    {
-                        subjectPoint += Convert.ToDouble(a);
-                    });
-                    subAverage = subjectPoint / ClassAverage.Count();
-                    className = new List<string>();
-                    foreach (string cla in classList)
-                    {
-                        className.Add(cla);
-                    }
-                    //单科计算年级排名
-                    stuPRG.Sort(delegate (string s1, string s2) { return int.Parse(s2).CompareTo(int.Parse(s1)); });
-                    foreach (List<List<string>> p2 in classPR) {
-                        foreach (List<string> p3 in p2) {
-                            int index = stuPRG.IndexOf(p3[2]);
-                            p3[5] = (index + 1).ToString();
-                            int GPR = 100 - (100 * int.Parse(p3[5]) - 50) / stuPRG.Count;
-                            p3[6] = GPR.ToString();
-
-                        }
-                    }
-                    Dictionary<string, object> data = new Dictionary<string, object>();
-                    Dictionary<string, object> classData = new Dictionary<string, object>();
-                    for (int i =0;i< classPR.Count;i++) {                        
-                        data.Add(className[i], classPR[i]);
-                        classData.Add(className[i], ClassAverage[i]);
-                        //data.Add(i.ToString(), ClassAverage[i]);
-                    }
-
-                    PR.Add("keys", keys);
-                    PR.Add("datas", data);
-                    PR.Add("classAverage", classData);
-                    PR.Add("gradeAverage", subAverage.ToString("0.00"));
-                    PR.Add("areaAverage", subAverage.ToString("0.00"));
-                    subPR.Add(PR);
-                });
-                //处理全科PR值计算
-                List<string> stuIds = exams[0].ids;
-                /*for (int k=0;k< stuIds.Count;k++) {
-                    if (stuIds[k].Equals("0")) {
-                        stuIds.Remove(stuIds[k]);
-                    }
-                }*/
-                Dictionary<string, object> dataAll = new Dictionary<string, object>();
-                dataAll.Add("name", "Total");
-                dataAll.Add("keys",keys);
-                List<double> stuAll = new List<double>();
-                List<double> sortGradePoint = new List<double>();
-                Dictionary<string, object> classInfo = new Dictionary<string, object>();
-                List<List<List<string>>> GradePR = new List<List<List<string>>>();
-                int m = 0;
-                int p = 0;
-                List<string> allClassAverages = new List<string>();
-                Dictionary<string, object> classAllData = new Dictionary<string, object>();
-                foreach (List<double> classPoint in subSum)
-                {
-                    List<double> sortClassPoint = new List<double>();
-                    int n = 1;
-                    //初始化缺考人数
-                    int people = 0;
-                    double sumTotle = 0;
-                    List<List<string>> classStuInfo = new List<List<string>>();
-                    for (int i = 0;i < classPoint.Count();i++) {
-                        List<string> stu = new List<string>();
-                        keys.ForEach(x =>
-                        {
-                            stu.Add("-");
-                        });
-                        if (stuIds[m] == "0")
-                        {
-                            people++;
-                            n++;
-                            m++;
-                            continue;
-                        }
-                        stu[0] = stuIds[m];
-                        stu[1] = n.ToString();
-                        stu[2] = classPoint[i].ToString();
-                        sortClassPoint.Add(classPoint[i]);
-                        stuAll.Add(classPoint[i]);
-                        sortGradePoint.Add(classPoint[i]);
-                        sumTotle += classPoint[i];
-                        n++;
-                        m++;
-                        classStuInfo.Add(stu);
-                    }                   
-                    double allClassAverage = sumTotle / (classPoint.Count - people);
-                    classAllData.Add(className[p], allClassAverage.ToString("0.00"));
-                    //allClassAverages.Add(allClassAverage.ToString("0.00"));
-                    GradePR.Add(classStuInfo);
-                    sortClassPoint.Sort(delegate (double s1, double s2) { return s2.CompareTo(s1); });
-                    foreach (List<string> stuIn in classStuInfo) {
-                        int index = sortClassPoint.IndexOf(int.Parse(stuIn[2]));
-                        stuIn[3] = (index + 1).ToString();
-                        int CPR = 100 - (100 * (index + 1) - 50) / sortClassPoint.Count;
-                        stuIn[4] = CPR.ToString();
-                        foreach (Student ss in students)
-                        {
-                            if (stuIn[0].Equals(ss.studentId))
-                            {
-                                stuIn[0] = ss.name;
-                                break;
-                            }
-                        }
-                    }
-                    p++;
-                }
-                sortGradePoint.Sort(delegate (double s1, double s2) { return s2.CompareTo(s1); });
-                double allGradeAverage = sortGradePoint.Sum() / sortGradePoint.Count();
-                foreach (List<List<string>> gradeInfo in GradePR)
-                {
-                    foreach (List<string> info in gradeInfo)
-                    {
-                        int index = sortGradePoint.IndexOf(int.Parse(info[2]));
-                        info[5] = (index + 1).ToString();
-                        int GPR = 100 - (100 * int.Parse(info[5]) - 50) / sortGradePoint.Count;
-                        info[6] = GPR.ToString();
-
-                    }
-                }
-                Dictionary<string, object> classDataAll = new Dictionary<string, object>();
-                for (int i = 0; i < GradePR.Count; i++)
-                {
-                    classDataAll.Add(className[i], GradePR[i]);
-                }
-                dataAll.Add("datas", classDataAll);
-                dataAll.Add("classAverage", classAllData);
-                dataAll.Add("gradeAverage", allGradeAverage.ToString("0.00"));
-                dataAll.Add("areaAverage", allGradeAverage.ToString("0.00"));
-                subPR.Add(dataAll);
-            }
-            return subPR;
-
-
-        }
-
-        public List<List<string>> ReName(List<List<string>> datas, List<string> ids, List<Dictionary<string, int[]>> classToName, List<Student> students)
-        {
-            foreach (List<string> tableName in datas)
-            {
-                int index = ids.IndexOf(tableName[0]);
-                if (index == -1)
-                {
-                    continue;
-                }
-                foreach (Dictionary<string, int[]> classKey in classToName)
-                {
-                    bool flag = false;
-                    foreach (KeyValuePair<string, int[]> kvp in classKey)
-                    {
-                        if (kvp.Value[1] >= index && index >= kvp.Value[0])
-                        {
-                            tableName[1] = kvp.Key;
-                            flag = true;
-                            break;
-                        }
-                    }
-                    if (flag)
-                    {
-                        break;
-                    }
-                }
-
-                foreach (Student ss in students)
-                {
-                    if (tableName[0].Equals(ss.studentId))
-                    {
-                        tableName[0] = ss.name;
-                        break;
-                    }
-                }
-            }
-
-            return datas;
-        }
-    }
-}

+ 0 - 15
TEAMModelOS.Service/Services/Analysis/Interfaces/IAchievementService.cs

@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Analysis.Interfaces
-{
-    public interface IAchievementService : IBusinessService
-    {
-        List<Dictionary<string, object>> GetPR(List<ExamResult> exams, List<List<double>> subSum,List<Student> students);
-        Dictionary<string, object> GetAverage(List<ExamResult> exams,List<string> gav, List<string> cav, List<List<double>> subSum, List<Student> students);
-        List<List<string>> ReName(List<List<string>> datas, List<string> ids,
-        List<Dictionary<string, int[]>> classToName, List<Student> students);
-
-    }
-}

+ 3 - 0
TEAMModelOS.Service/TEAMModelOS.Service.csproj

@@ -14,4 +14,7 @@
   <ItemGroup>
     <PackageReference Include="protobuf-net" Version="2.4.6" />
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Services\Analysis\" />
+  </ItemGroup>
 </Project>

+ 10 - 10
TEAMModelOS/Controllers/Analysis/AchievementController.cs

@@ -8,14 +8,14 @@ using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.StringHelper;
 using TEAMModelOS.SDK.DI;
-
-using TEAMModelOS.Service.Analysis.Interfaces;
+ 
 
 using System.Diagnostics;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Analysis.Implements;
 
 namespace TEAMModelOS.Controllers.Analysis
 {
@@ -25,13 +25,13 @@ namespace TEAMModelOS.Controllers.Analysis
     {
 
         private readonly AzureCosmosFactory azureCosmosDBRepository;
-        private readonly IAchievementService achievementService;
+         
         private const string CacheCosmosPrefix = "Analysis:";
         private const int timeoutSeconds = 3600;
-        public AchievementController(IAchievementService _achievementService, AzureCosmosFactory _azureCosmosDBRepository)
+        public AchievementController( AzureCosmosFactory _azureCosmosDBRepository)
         {
             azureCosmosDBRepository = _azureCosmosDBRepository;
-            achievementService = _achievementService;
+           
 
         }
         [HttpPost("Achievement")]
@@ -339,7 +339,7 @@ namespace TEAMModelOS.Controllers.Analysis
                     rankScore.Add(score);
                     sp.Add(values);
                 }
-                achievementService.ReName(sp, idToName, classToName, students);
+                AchievementService.ReName(sp, idToName, classToName, students);
                 //处理人数为整
                 string ip = iPersons.ToString("0");
                 //初始化进线分数
@@ -471,8 +471,8 @@ namespace TEAMModelOS.Controllers.Analysis
                 //passRate.Add("passRate", passALL);
                 early.Add("keys", keyWarning);
                 early.Add("datas", earlyWarning);
-                AclassAverage = achievementService.GetAverage(exams, gAverage, cAverage, subSum, students);
-                List<Dictionary<string, object>> rankPR = achievementService.GetPR(exams, subSum, students);
+                AclassAverage = AchievementService.GetAverage(exams, gAverage, cAverage, subSum, students);
+                List<Dictionary<string, object>> rankPR = AchievementService.GetPR(exams, subSum, students);
 
                 entryLineBar.Add("keys", keyLine);
                 entryLineBar.Add("datas", datas);
@@ -658,7 +658,7 @@ namespace TEAMModelOS.Controllers.Analysis
                             }
                             i++;
                         });
-                        achievementService.ReName(datas, idToName, classToName, students);
+                        AchievementService.ReName(datas, idToName, classToName, students);
                         detail.Add("datas", datas);
                         subject.Add("scatter", detail);
                         scatterAnalysis.Add(subject);
@@ -1336,7 +1336,7 @@ namespace TEAMModelOS.Controllers.Analysis
                     stuPersent.Add(values);
                     m++;
                 }
-                achievementService.ReName(stuPersent, ids, classes, students);
+                AchievementService.ReName(stuPersent, ids, classes, students);
                 double knowPser = anwGPoint / poG;
                 knowPer.Add(knowPser.ToString("0.00"));
                 //错题关系表

+ 0 - 1
TEAMModelOS/Controllers/Core/FileController.cs

@@ -14,7 +14,6 @@ using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
 using TEAMModelOS.SDK.Module.AzureBlob.Container;
 using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
 
-using TEAMModelOS.Service.Services.PowerPoint.Interface;
 using TEAMModelOS.SDK.DI;
 
 namespace TEAMModelOS.Controllers

+ 6 - 6
TEAMModelOS/Controllers/Exam/ImportExerciseController.cs

@@ -9,9 +9,9 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK;
 using TEAMModelOS.Service.Model.PowerPoint; 
 using TEAMModelOS.Service.Services.Exam.Implements; 
-using TEAMModelOS.Service.Services.PowerPoint.Interface;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Service;
+using TEAMModelOS.Service.Services.PowerPoint.Implement;
 
 namespace TEAMModelOS.Controllers
 {
@@ -20,13 +20,13 @@ namespace TEAMModelOS.Controllers
     public class ImportExerciseController : BaseController
     { 
         
-        private readonly IHtexService htexService;
+      //  private readonly IHtexService htexService;
         private readonly AzureStorageFactory azureBlobDBRepository;
-        public ImportExerciseController(  IHtexService _htexService, AzureStorageFactory _azureBlobDBRepository)
+        public ImportExerciseController(   AzureStorageFactory _azureBlobDBRepository)
         {
             azureBlobDBRepository = _azureBlobDBRepository;
 
-               htexService = _htexService;
+              
         }
         /// <summary>
         /// </summary>
@@ -38,7 +38,7 @@ namespace TEAMModelOS.Controllers
         {
             ResponseBuilder responseBuilder = new ResponseBuilder();
 
-            Dictionary<string, object> model = await htexService.LoadDoc(file);
+            Dictionary<string, object> model = await HtexService.LoadDoc(azureBlobDBRepository, file);
             return responseBuilder.Data(model).build();
         }
         /// <summary>
@@ -94,7 +94,7 @@ namespace TEAMModelOS.Controllers
             bool flag = request.@params.TryGetValue("htmlString", out object htmlString);
             if (flag && htmlString != null && !string.IsNullOrEmpty(htmlString.ToString()))
             {
-                Htex exercises = await htexService.AnalyzeHtmlToHtex(htmlString.ToString(), request.lang);
+                Htex exercises = await HtexService.AnalyzeHtmlToHtex(azureBlobDBRepository, htmlString.ToString(), request.lang);
                 return builder.Data(exercises).build();
             }
             else

+ 6 - 11
TEAMModelOS/Service/Analysis/AchievementService.cs

@@ -2,23 +2,18 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Analysis.Interfaces;
 
 using TEAMModelOS.Service.Models;
 
 namespace TEAMModelOS.Service.Analysis.Implements
 {
-    public class AchievementService : IAchievementService
+    public static class AchievementService 
     {
-        public AzureCosmosFactory _cosmosrepository;
+       
 
-        public AchievementService(AzureCosmosFactory cosmosDBRepository)
-        {
-            _cosmosrepository = cosmosDBRepository;
-        }
+        
         //处理各个班级均分分析
-        public Dictionary<string, object> GetAverage(List<ExamResult> exams, List<string> gav, List<string> cav, List<List<double>> subSum, List<Student> students)
+        public static Dictionary<string, object> GetAverage(List<ExamResult> exams, List<string> gav, List<string> cav, List<List<double>> subSum, List<Student> students)
         {
             Dictionary<string, object> Average = new Dictionary<string, object>();
             List<List<string>> classAverage = new List<List<string>>();
@@ -76,7 +71,7 @@ namespace TEAMModelOS.Service.Analysis.Implements
                 
         }
 
-        public List<Dictionary<string, object>> GetPR(List<ExamResult> exams, List<List<double>> subSum,List<Student> students)
+        public static List<Dictionary<string, object>> GetPR(List<ExamResult> exams, List<List<double>> subSum,List<Student> students)
         {
             // 计算公式 PR=100- (100*R-50)/N
             List<Dictionary<string, object>> subPR = new List<Dictionary<string, object>>();
@@ -325,7 +320,7 @@ namespace TEAMModelOS.Service.Analysis.Implements
 
         }
 
-        public List<List<string>> ReName(List<List<string>> datas, List<string> ids, List<Dictionary<string, int[]>> classToName, List<Student> students)
+        public static List<List<string>> ReName(List<List<string>> datas, List<string> ids, List<Dictionary<string, int[]>> classToName, List<Student> students)
         {
             foreach (List<string> tableName in datas)
             {

+ 0 - 15
TEAMModelOS/Service/Analysis/Interfaces/IAchievementService.cs

@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Analysis.Interfaces
-{
-    public interface IAchievementService : IBusinessService
-    {
-        List<Dictionary<string, object>> GetPR(List<ExamResult> exams, List<List<double>> subSum,List<Student> students);
-        Dictionary<string, object> GetAverage(List<ExamResult> exams,List<string> gav, List<string> cav, List<List<double>> subSum, List<Student> students);
-        List<List<string>> ReName(List<List<string>> datas, List<string> ids,
-        List<Dictionary<string, int[]>> classToName, List<Student> students);
-
-    }
-}

+ 7 - 5
TEAMModelOS/Service/Evaluation/ImportExerciseService.cs

@@ -59,7 +59,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             //    await file.CopyToAsync(stream);
             //}
             var htmlInfo = ConvertDocxToHtml(file, folder);
-            AzureBlobModel model = await AzureStorageBlobExtensions.UploadFileByContainer(azureBlobDBRepository,"hbcn",htmlInfo.htmlString, "exercise", htmlInfo.blobPath, false);
+            AzureBlobModel model = await AzureStorageBlobExtensions.UploadFileByContainer(azureBlobDBRepository, "teammodelos", htmlInfo.htmlString, "exercise", htmlInfo.blobPath, false);
             model.Sha1Code = shaCode;
             await azureBlobDBRepository.Save<AzureBlobModel>(model);
            // FileHelper.DeleteDirAndFiles(BaseConfigModel.ContentRootPath + "/Upload");
@@ -157,18 +157,20 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
                                 sp = fileExt.Split("+");
                                 fileExt = "." + sp[sp.Length - 1];
                             }
-                            Stream stream = new MemoryStream(Convert.FromBase64String(strs[1]));
-                            // long bizno = IdWorker.getInstance().NextId();
+                            string url = "data:" + mimeType + ";base64," + strs[1];
+                            url = url.Replace("\r\n", "");
+                            
+                            //Stream stream = new MemoryStream(Convert.FromBase64String(strs[1]));
                             string filename = shaCode + fileExt;
                           //  AzureBlobModel model = azureBlobDBRepository.UploadFileByFolderNAsyn(stream, FolderName, filename, "exercise", false);
                             #endregion
                             XElement img = new XElement(Xhtml.img,
-                                 new XAttribute(NoNamespace.src, strs[1]),
+                                 new XAttribute(NoNamespace.src, url),
                                   //  new XAttribute(NoNamespace.src, model.BlobUrl),
                                     imageInfo.ImgStyleAttribute,
                                     imageInfo.AltText != null ?
                                         new XAttribute(NoNamespace.alt, imageInfo.AltText) : null);
-                            stream.Close();
+                            //stream.Close();
                             return img;
                         }
                     };

+ 3 - 3
TEAMModelOS/Service/PowerPoint/Implement/HtexService.cs

@@ -19,7 +19,6 @@ using TEAMModelOS.Service.Models.PowerPoint.Inner;
 using Fill = TEAMModelOS.Service.Model.PowerPoint.Fill;
 using Media = TEAMModelOS.Service.Model.PowerPoint.Media;
 using Position = TEAMModelOS.Service.Model.PowerPoint.Position;
-using TEAMModelOS.Service.Services.PowerPoint.Interface;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.Service;
 using TEAMModelOS.SDK.DI;
@@ -50,7 +49,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             {
                 Slide slide = new Slide { exercise = item, index = index, source = 2, flag = 2 };
                 index++;
-                AzureBlobModel model =  await azureBlobDBRepository.UploadFileByContainer("hbcn",slide.ToJson(), "htex/"+sha, index+".json",false);
+                AzureBlobModel model =  await azureBlobDBRepository.UploadFileByContainer("teammodelos", slide.ToJson(), "htex/"+sha, index+".json",false);
                 htex.slides.Add(model.BlobUrl);
             }
             htex.page = items.Count;
@@ -155,7 +154,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                
                 slide.source = 1;
                 slide.flag = 1;
-                AzureBlobModel model = await azureBlobDBRepository.UploadFileByContainer("hbcn",slide.ToJson(), "htex" + shaCode, (i + 1) + ".json", false);
+                AzureBlobModel model = await azureBlobDBRepository.UploadFileByContainer("teammodelos", slide.ToJson(), "htex/" + shaCode, (i + 1) + ".json", false);
                 pptx.slides.Add(model.BlobUrl);
                 slides.Add(slide);
                 //  post_ary.Add(new Dictionary<string, object> { { "slide", slideHtml } });
@@ -3014,6 +3013,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
 
             string url = "data:"+contentType+";base64,"+data;
+            url= url.Replace("\r\n", "");
             Stream streamBlob = new MemoryStream(Convert.FromBase64String(data));
             //   AzureBlobModel model = await azureBlobDBRepository.UploadFileByFolder(streamBlob, FolderName, fileName, "pptx", false);
             AzureBlobModel model =new AzureBlobModel { BlobUrl= url };

+ 0 - 16
TEAMModelOS/Service/PowerPoint/Interface/IHtexService.cs

@@ -1,16 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Model.PowerPoint;
-
-namespace TEAMModelOS.Service.Services.PowerPoint.Interface
-{
-    public interface IHtexService : IBusinessService
-    {
-        Task<Dictionary<string, object>> LoadDoc(IFormFile file);
-        Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang);
-    }
-}

TEAMModelOS/Service/PowerPoint/Implement/ShapeHelper.cs → TEAMModelOS/Service/PowerPoint/ShapeHelper.cs


TEAMModelOS/Service/PowerPoint/Implement/ShapeSvg.cs → TEAMModelOS/Service/PowerPoint/ShapeSvg.cs


+ 0 - 1
TEAMModelOS/TEAMModelOS.csproj

@@ -43,7 +43,6 @@
   <ItemGroup>
     <Folder Include="JwtRsaFile\" />
     <Folder Include="logfile\" />
-    <Folder Include="Service\Analysis\Implements\" />
     <Folder Include="wwwroot\" />
   </ItemGroup>