Browse Source

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

zhousheng 4 years ago
parent
commit
c9925135bd
95 changed files with 1001 additions and 3639 deletions
  1. 0 77
      TEAMModelGrpc/Services/BlobSASService.cs
  2. 0 93
      TEAMModelGrpc/Services/KnowledgeService.cs
  3. 0 124
      TEAMModelGrpc/Services/SyllabusService.cs
  4. 0 82
      TEAMModelGrpc/Services/VolumeService.cs
  5. 2 2
      TEAMModelGrpc/Startup.cs
  6. 0 115
      TEAMModelGrpc/TEAMModelOS.GRPC.xml
  7. 5 5
      TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionInvoke.cs
  8. 19 19
      TEAMModelOS.SDK/DI/AzureCosmos/AzureCosmosExtensions.cs
  9. 2 2
      TEAMModelOS.SDK/DI/AzureCosmos/Inner/ID.cs
  10. 104 0
      TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusExtensions.cs
  11. 48 0
      TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactory.cs
  12. 22 0
      TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactoryExtensions.cs
  13. 14 0
      TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactoryOptions.cs
  14. 1 1
      TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs
  15. 0 74
      TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusClientSingleton.cs
  16. 0 39
      TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusCollectionExtensions.cs
  17. 0 29
      TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusOptions.cs
  18. 0 32
      TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusService.cs
  19. 0 24
      TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusServiceBuilder.cs
  20. 0 13
      TEAMModelOS.SDK/Module/AzureServiceBus/IAzureServiceBusService.cs
  21. 1 1
      TEAMModelOS.SDK/TEAMModelOS.SDK.csproj
  22. 0 15
      TEAMModelOS.Service/Services/Analysis/Interfaces/IAchievementService.cs
  23. 0 13
      TEAMModelOS.Service/Services/ChangeFeed/IChangeFeedService.cs
  24. 0 10
      TEAMModelOS.Service/Services/ChangeFeed/IChangeService.cs
  25. 0 24
      TEAMModelOS.Service/Services/ChangeFeed/KnowledgeChangeFeed.cs
  26. 0 23
      TEAMModelOS.Service/Services/ChangeFeed/SyllabusVolumeChangeFeed.cs
  27. 0 12
      TEAMModelOS.Service/Services/Evaluation/Implements/EvaluatingService.cs
  28. 0 9
      TEAMModelOS.Service/Services/Evaluation/Interfaces/IEvaluatingService.cs
  29. 0 13
      TEAMModelOS.Service/Services/Evaluation/Interfaces/IHtmlAnalyzeService.cs
  30. 0 18
      TEAMModelOS.Service/Services/Evaluation/Interfaces/IImportExerciseService.cs
  31. 0 119
      TEAMModelOS.Service/Services/Learn/Implements/ServiceBusReviceService.cs
  32. 0 46
      TEAMModelOS.Service/Services/Learn/Implements/TimerWorkService.cs
  33. 0 14
      TEAMModelOS.Service/Services/Learn/Interfaces/IServiceBusReviceService.cs
  34. 0 16
      TEAMModelOS.Service/Services/Learn/Interfaces/IServiceBusService.cs
  35. 0 13
      TEAMModelOS.Service/Services/Learn/Interfaces/ITimerWorkService.cs
  36. 0 16
      TEAMModelOS.Service/Services/PowerPoint/Interface/IHtexService.cs
  37. 0 17
      TEAMModelOS.Service/Services/Syllabus/Interface/IKnowledgeService.cs
  38. 0 34
      TEAMModelOS.Service/Services/Syllabus/Interface/ISyllabusService.cs
  39. 0 16
      TEAMModelOS.Service/Services/Syllabus/Interface/IVolumeService.cs
  40. 0 1969
      TEAMModelOS.Service/TEAMModelOS.Model.xml
  41. 3 0
      TEAMModelOS.Service/TEAMModelOS.Service.csproj
  42. 50 0
      TEAMModelOS/ClientApp/src/api/forgetPW.js
  43. 2 0
      TEAMModelOS/ClientApp/src/api/index.js
  44. 41 42
      TEAMModelOS/ClientApp/src/api/regist.js
  45. 5 3
      TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwTable.vue
  46. 13 0
      TEAMModelOS/ClientApp/src/router/routes.js
  47. 1 1
      TEAMModelOS/ClientApp/src/utils/countryCodeData.js
  48. 2 0
      TEAMModelOS/ClientApp/src/utils/public.js
  49. 4 0
      TEAMModelOS/ClientApp/src/view/evaluation/components/BaseChild.vue
  50. 11 0
      TEAMModelOS/ClientApp/src/view/evaluation/components/BaseCreateChild.vue
  51. 10 2
      TEAMModelOS/ClientApp/src/view/evaluation/index/CreateExercises.vue
  52. 14 0
      TEAMModelOS/ClientApp/src/view/forgotPw/Index.less
  53. 297 0
      TEAMModelOS/ClientApp/src/view/forgotPw/Index.vue
  54. 1 1
      TEAMModelOS/ClientApp/src/view/login/Index.vue
  55. 0 2
      TEAMModelOS/ClientApp/src/view/regist/Index.vue
  56. 10 1
      TEAMModelOS/ClientApp/src/view/school-mgmt/SystemSetting/SystemSetting.less
  57. 106 56
      TEAMModelOS/ClientApp/src/view/school-mgmt/SystemSetting/SystemSetting.vue
  58. 10 10
      TEAMModelOS/Controllers/Analysis/AchievementController.cs
  59. 2 2
      TEAMModelOS/Controllers/Analysis/ChangeController.cs
  60. 4 170
      TEAMModelOS/Controllers/Core/FileController.cs
  61. 8 6
      TEAMModelOS/Controllers/Exam/ExamController.cs
  62. 17 17
      TEAMModelOS/Controllers/Exam/ImportExerciseController.cs
  63. 5 6
      TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs
  64. 4 6
      TEAMModelOS/Controllers/Syllabus/ResourceController.cs
  65. 9 11
      TEAMModelOS/Controllers/Syllabus/SyllabusController.cs
  66. 5 7
      TEAMModelOS/Controllers/Syllabus/VolumeController.cs
  67. 4 5
      TEAMModelOS/Controllers/Task/HomeworkController.cs
  68. 7 5
      TEAMModelOS/Controllers/Task/LearnController.cs
  69. 7 5
      TEAMModelOS/Controllers/Task/SurveyController.cs
  70. 6 4
      TEAMModelOS/Controllers/Task/VoteController.cs
  71. 0 0
      TEAMModelOS/Dto/AzureBlobSASDto.cs
  72. 0 0
      TEAMModelOS/Dto/BlockPointDto.cs
  73. 0 0
      TEAMModelOS/Dto/CommentsDto.cs
  74. 0 0
      TEAMModelOS/Dto/CommonQuery.cs
  75. 0 0
      TEAMModelOS/Dto/CoursePlanDto.cs
  76. 0 0
      TEAMModelOS/Dto/HomeWorkCommentDto.cs
  77. 0 0
      TEAMModelOS/Dto/HomeWorkDto.cs
  78. 0 0
      TEAMModelOS/Dto/HomeWorkFindDto.cs
  79. 0 0
      TEAMModelOS/Dto/HomeWorkScoringDto.cs
  80. 0 0
      TEAMModelOS/Dto/KnowledgeDto.cs
  81. 0 0
      TEAMModelOS/Dto/PointDto.cs
  82. 0 0
      TEAMModelOS/Dto/SurveyDto.cs
  83. 0 0
      TEAMModelOS/Dto/VoteDto.cs
  84. 0 0
      TEAMModelOS/Dto/VoteStudentDto.cs
  85. 6 11
      TEAMModelOS.Service/Services/Analysis/Implements/AchievementService.cs
  86. 12 13
      TEAMModelOS.Service/Services/Evaluation/Implements/HtmlAnalyzeService.cs
  87. 21 20
      TEAMModelOS.Service/Services/Evaluation/Implements/ImportExerciseService.cs
  88. 5 9
      TEAMModelOS.Service/Services/Learn/Implements/ServiceBusService.cs
  89. 59 57
      TEAMModelOS.Service/Services/PowerPoint/Implement/HtexService.cs
  90. 0 0
      TEAMModelOS/Service/PowerPoint/ShapeHelper.cs
  91. 0 0
      TEAMModelOS/Service/PowerPoint/ShapeSvg.cs
  92. 5 11
      TEAMModelOS.Service/Services/Syllabus/Implement/KnowledgeService.cs
  93. 6 14
      TEAMModelOS.Service/Services/Syllabus/Implement/SyllabusService.cs
  94. 4 10
      TEAMModelOS.Service/Services/Syllabus/Implement/VolumeService.cs
  95. 7 3
      TEAMModelOS/Startup.cs

+ 0 - 77
TEAMModelGrpc/Services/BlobSASService.cs

@@ -1,77 +0,0 @@
-using Google.Protobuf.WellKnownTypes;
-using Grpc.Core;
-using Grpc.Extension.Abstract;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelGrpc.Models;
-using TEAMModelOS;
-using TEAMModelOS.SDK.Context.Exception;
-using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
-
-namespace TEAMModelGrpc.Services
-{
-    public class BlobSASService : IGrpcService
-    {
-
-        private readonly IAzureBlobDBRepository _azureBlobDBRepository;
-
-        public BlobSASService(IAzureBlobDBRepository azureBlobDBRepository)
-        {
-            _azureBlobDBRepository = azureBlobDBRepository;
-        }
-
-        /// <summary>
-        /// 获取bolb共享访问权限
-        /// </summary>
-        /// <param name="empty"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        public async Task<BlobSASDto> GetContainerSasUri(Empty empty, ServerCallContext context) {
-            (string,string, string) aaa = await _azureBlobDBRepository.GetContainerSasUri();
-            BlobSASDto blobSASDto = new BlobSASDto();
-            blobSASDto.Url = aaa.Item1;
-            blobSASDto.Container = aaa.Item2;
-            blobSASDto.SAS = aaa.Item3;
-            return blobSASDto;
-        }
-
-        /// <summary>
-        /// 获取blob共享访问权限 (只读)
-        /// </summary>
-        /// <param name="blob"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        public async Task<BlobSASDto> GetContainerSASRead(BlobSASDto blob, ServerCallContext context)
-        {
-            (string, string) a = BlobUrlString(blob.Url);
-            string ContainerName = a.Item1;
-            string BlobName = a.Item2;
-            bool flg = IsBlobName(BlobName);
-            if (flg)
-            {
-                var SAS = await _azureBlobDBRepository.GetBlobSasUriRead(ContainerName, BlobName);
-                return new BlobSASDto { Url = SAS.url+SAS.sas };
-            }
-            else throw new BizException("文件名错误", ResponseCode.PARAMS_ERROR);
-        }
-
-        private static (string, string) BlobUrlString(string sasUrl)
-        {
-            sasUrl = sasUrl.Substring(8);
-            string[] sasUrls = sasUrl.Split("/");
-            string ContainerName;
-            ContainerName = sasUrls[1].Clone().ToString();
-            string item = sasUrls[0] + "/" + sasUrls[1] + "/";
-            string blob = sasUrl.Replace(item, "");
-            return (ContainerName, blob);
-        }
-
-        public static bool IsBlobName(string BlobName)
-        {
-            return System.Text.RegularExpressions.Regex.IsMatch(BlobName,
-             @"(?!((^(con)$)|^(con)\\..*|(^(prn)$)|^(prn)\\..*|(^(aux)$)|^(aux)\\..*|(^(nul)$)|^(nul)\\..*|(^(com)[1-9]$)|^(com)[1-9]\\..*|(^(lpt)[1-9]$)|^(lpt)[1-9]\\..*)|^\\s+|.*\\s$)(^[^\\\\\\:\\<\\>\\*\\?\\\\\\""\\\\|]{1,255}$)");
-        }
-    }
-}

+ 0 - 93
TEAMModelGrpc/Services/KnowledgeService.cs

@@ -1,93 +0,0 @@
-using Google.Protobuf;
-using Grpc.Core;
-using Grpc.Extension.Abstract;
-using Microsoft.AspNetCore.Authorization;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelGrpc.Models;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
-
-namespace TEAMModelGrpc.Services
-{
- 
-    public class KnowledgeService : IGrpcService
-    {
-        private AzureCosmosFactory cosmosDBV3Repository;
-        private IKnowledgeService knowledgeService;
-
-        public KnowledgeService(AzureCosmosFactory cosmosDBV3Repository, IKnowledgeService knowledgeService)
-        {
-            this.cosmosDBV3Repository = cosmosDBV3Repository;
-            this.knowledgeService = knowledgeService;
-        }
-
-
-        /// <summary>
-        /// 查询知识点
-        /// </summary>
-        /// <param name="request"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task FinKnowledge(Dict request, IServerStreamWriter<Knowledge> responseStream, ServerCallContext context)
-        {
-            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
-            keyValuePairs = request.ToDict();
-            List<Knowledge> knowledges = await cosmosDBV3Repository.FindByDict<Knowledge>(keyValuePairs);
-            knowledges.ForEach(x =>
-            {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-        /// <summary>
-        /// 保存知识点
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task SaveKnowledge(IAsyncStreamReader<Knowledge> requestStream, IServerStreamWriter<Knowledge> responseStream, ServerCallContext context)
-        {
-            //Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
-            //keyValuePairs = request.ToDict();
-            List<Knowledge> knowledges = new List<Knowledge>();
-            await foreach (var message in requestStream.ReadAllAsync())
-            {
-                knowledges.Add(message);
-            }
-
-            await knowledgeService.SaveOrUpdateKnowledge(knowledges);
-
-            knowledges.ForEach(x =>
-            {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-        /// <summary>
-        /// 删除知识点
-        /// </summary>
-        /// <param name="listPid"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task<ListPid> DeleteKnowledge(ListPid listPid, ServerCallContext context)
-        {
-            List<IdPk> idPks = await knowledgeService.DeleteKnowledge(listPid.idPks);//await cosmosDBV3Repository.DeleteAll<Knowledge>(listPid.idPks);
-            listPid.idPks = idPks;
-            return listPid;
-        }
-
-    }
-}

+ 0 - 124
TEAMModelGrpc/Services/SyllabusService.cs

@@ -1,124 +0,0 @@
-using Grpc.Core;
-using Grpc.Extension.Abstract;
-using Microsoft.AspNetCore.Authorization;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelGrpc.Models;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
-
-namespace TEAMModelGrpc.Services
-{
-    /// <summary>
-    /// 课纲业务
-    /// </summary>
-    public class SyllabusService : IGrpcService
-    {
-        private ISyllabusService syllabusService;
-        private AzureCosmosFactory cosmosDBV3Repository;
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        /// <param name="syllabusService"></param>
-        /// <param name="cosmosDBV3Repository"></param>
-        public SyllabusService(ISyllabusService syllabusService, AzureCosmosFactory cosmosDBV3Repository)
-        {
-            this.syllabusService = syllabusService;
-            this.cosmosDBV3Repository = cosmosDBV3Repository;
-        }
-
-
-        /// <summary>
-        /// 查找课纲 
-        /// </summary>
-        /// <param name="request"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task FindSyllabusTree(Dict request, IServerStreamWriter<SyllabusTreeDto> responseStream, ServerCallContext context) 
-        {
-            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
-            keyValuePairs = request.ToDict();
-            List<SyllabusTree> knowledges = await syllabusService.Find(keyValuePairs);
-            List<SyllabusTreeDto> list = knowledges.ToJson().FromJson<List<SyllabusTreeDto>>();
-
-            list.ForEach(x =>
-            {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-        /// <summary>
-        /// 按节点新增课纲
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        public async Task<Response> SaveOrUpdateAsNodes(IAsyncStreamReader<SyllabusNode> requestStream,  ServerCallContext context) 
-        {
-
-            List<SyllabusNode> syllabusNodes = new List<SyllabusNode>();
-            await foreach (SyllabusNode syllabusNode in requestStream.ReadAllAsync()) 
-            {
-                syllabusNodes.Add(syllabusNode);
-            }
-
-            await syllabusService.SaveOrUpdateAsNodes(syllabusNodes);
-            Response response = new Response();
-            return response.Success();
-        }
-
-        /// <summary>
-        ///  按树形新增课纲结构
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        public async Task SaveOrUpdateAsTree(IAsyncStreamReader<SyllabusTreeDto> requestStream, IServerStreamWriter<SyllabusTreeDto> responseStream, ServerCallContext context)
-        {
-
-            List<SyllabusTree> syllabusTrees = new List<SyllabusTree>();
-            List<SyllabusTreeDto> syllabusTreeDtos = new List<SyllabusTreeDto>();
-            await foreach (SyllabusTreeDto syllabusNode in requestStream.ReadAllAsync())
-            {
-                syllabusTreeDtos.Add(syllabusNode);
-                SyllabusTree syllabusTree = syllabusNode.ToJson().FromJson<SyllabusTree>();
-                syllabusTrees.Add(syllabusTree);
-            }
-            await syllabusService.SaveOrUpdateAsTree(syllabusTrees);
-
-            syllabusTreeDtos.ForEach(x => {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-        /// <summary>
-        /// 删除课纲
-        /// </summary>
-        /// <param name="request"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task DeleteSyllabus(Dict request, IServerStreamWriter<SyllabusTreeDto> responseStream, ServerCallContext context)
-        {
-            Dictionary<string, object> keyValuePairs = new Dictionary<string, object>();
-            keyValuePairs = request.ToDict();
-            List<Syllabus> syllabuses = await syllabusService.DeleteSyllabus(keyValuePairs);//await cosmosDBV3Repository.DeleteAll<Knowledge>(listPid.idPks);
-            List<SyllabusTreeDto> syllabusTreeDtos = syllabuses.ToJson().FromJson<List<SyllabusTreeDto>>();
-
-            syllabusTreeDtos.ForEach(x => { 
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-    }
-}

+ 0 - 82
TEAMModelGrpc/Services/VolumeService.cs

@@ -1,82 +0,0 @@
-using Grpc.Core;
-using Grpc.Extension.Abstract;
-using Microsoft.AspNetCore.Authorization;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using TEAMModelGrpc.Models;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
-
-namespace TEAMModelGrpc.Services
-{
-    public class VolumeService :IGrpcService
-    {
-        private readonly AzureCosmosFactory azureCosmosDBRepository;
-        private IVolumeService volumeService;
-
-        public VolumeService(AzureCosmosFactory azureCosmosDBRepository, IVolumeService volumeService)
-        {
-            this.azureCosmosDBRepository = azureCosmosDBRepository;
-            this.volumeService = volumeService;
-        }
-
-        /// <summary>
-        /// 保存册别
-        /// </summary>
-        /// <param name="requestStream"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task SaveOrUpdateVolume(IAsyncStreamReader<Volume> requestStream, IServerStreamWriter<Volume> responseStream, ServerCallContext context) {
-
-            List<Volume> volumes = new List<Volume>();
-            await foreach (Volume syllabusNode in requestStream.ReadAllAsync())
-            {
-                List<Volume> volume = await volumeService.SaveOrUpdateVolume(syllabusNode);
-                volumes.AddRange(volume);
-            }
-            volumes.ForEach(x => {
-                responseStream.WriteAsync(x);
-            });
-        }
-
-        /// <summary>
-        /// 查询册别
-        /// </summary>
-        /// <param name="request"></param>
-        /// <param name="responseStream"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task FindVolume(Dict request, IServerStreamWriter<Volume> responseStream, ServerCallContext context) {
-
-            Dictionary<string, object> dict = request.ToDict();
-
-            List<Volume> syllabusVolumes = await azureCosmosDBRepository.FindByDict<Volume>(dict);
-
-            syllabusVolumes.ForEach(x => { 
-                responseStream.WriteAsync(x);
-            });
-        }
-
-
-        /// <summary>
-        ///  删除册别
-        /// </summary>
-        /// <param name="listPid"></param>
-        /// <param name="context"></param>
-        /// <returns></returns>
-        [Authorize]
-        public async Task<ListPid> Delete(ListPid listPid, ServerCallContext context)
-        {
-            List<IdPk> idPks = await azureCosmosDBRepository.DeleteAll<Volume>(listPid.idPks);
-            listPid.idPks = idPks;
-            return listPid;
-        }
-
-    }
-}

+ 2 - 2
TEAMModelGrpc/Startup.cs

@@ -107,7 +107,7 @@ namespace TEAMModelGrpc
 
             app.UseEndpoints(endpoints =>
             {
-                endpoints.MapGrpcService<KnowledgeService>();
+                endpoints.MapGrpcService<HomeWorkService>();
                 endpoints.MapGrpcHealthChecksService();
                 endpoints.MapGet("/generateJwtToken", context =>
                 {
@@ -122,7 +122,7 @@ namespace TEAMModelGrpc
             //CodeFirst的Grpc(会自动扫描TStartup所在程序集下的IGrpcSerivce)
 
 
-            app.UseGrpcExtensions<TEAMModelGrpc.Services.KnowledgeService>(options =>
+            app.UseGrpcExtensions<TEAMModelGrpc.Services.HomeWorkService>(options =>
             {
                 //CodeFirst配制
                 options.GlobalPackage = "TMDGrpc";

+ 0 - 115
TEAMModelGrpc/TEAMModelOS.GRPC.xml

@@ -206,22 +206,6 @@
             数据状态
             </summary>
         </member>
-        <member name="M:TEAMModelGrpc.Services.BlobSASService.GetContainerSasUri(Google.Protobuf.WellKnownTypes.Empty,Grpc.Core.ServerCallContext)">
-            <summary>
-            获取bolb共享访问权限
-            </summary>
-            <param name="empty"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.BlobSASService.GetContainerSASRead(TEAMModelGrpc.Models.BlobSASDto,Grpc.Core.ServerCallContext)">
-            <summary>
-            获取blob共享访问权限 (只读)
-            </summary>
-            <param name="blob"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
         <member name="M:TEAMModelGrpc.Services.ClassroomService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Classroom},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Classroom},Grpc.Core.ServerCallContext)">
             <summary>
             保存教室
@@ -317,105 +301,6 @@
             <param name="context"></param>
             <returns></returns>
         </member>
-        <member name="M:TEAMModelGrpc.Services.KnowledgeService.FinKnowledge(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.ServerCallContext)">
-            <summary>
-            查询知识点
-            </summary>
-            <param name="request"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.KnowledgeService.SaveKnowledge(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Knowledge},Grpc.Core.ServerCallContext)">
-            <summary>
-            保存知识点
-            </summary>
-            <param name="requestStream"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.KnowledgeService.DeleteKnowledge(TEAMModelGrpc.Models.ListPid,Grpc.Core.ServerCallContext)">
-            <summary>
-            删除知识点
-            </summary>
-            <param name="listPid"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="T:TEAMModelGrpc.Services.SyllabusService">
-            <summary>
-            课纲业务
-            </summary>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.#ctor(TEAMModelOS.Service.Services.Interface.ISyllabusService,TEAMModelOS.SDK.DI.AzureCosmosFactory)">
-            <summary>
-            构造函数
-            </summary>
-            <param name="syllabusService"></param>
-            <param name="cosmosDBV3Repository"></param>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.FindSyllabusTree(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
-            <summary>
-            查找课纲 
-            </summary>
-            <param name="request"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsNodes(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.SyllabusNode},Grpc.Core.ServerCallContext)">
-            <summary>
-            按节点新增课纲
-            </summary>
-            <param name="requestStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.SaveOrUpdateAsTree(Grpc.Core.IAsyncStreamReader{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
-            <summary>
-             按树形新增课纲结构
-            </summary>
-            <param name="requestStream"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.SyllabusService.DeleteSyllabus(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelGrpc.Models.SyllabusTreeDto},Grpc.Core.ServerCallContext)">
-            <summary>
-            删除课纲
-            </summary>
-            <param name="request"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.VolumeService.SaveOrUpdateVolume(Grpc.Core.IAsyncStreamReader{TEAMModelOS.Service.Models.Volume},Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Volume},Grpc.Core.ServerCallContext)">
-            <summary>
-            保存册别
-            </summary>
-            <param name="requestStream"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.VolumeService.FindVolume(TEAMModelGrpc.Models.Dict,Grpc.Core.IServerStreamWriter{TEAMModelOS.Service.Models.Volume},Grpc.Core.ServerCallContext)">
-            <summary>
-            查询册别
-            </summary>
-            <param name="request"></param>
-            <param name="responseStream"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
-        <member name="M:TEAMModelGrpc.Services.VolumeService.Delete(TEAMModelGrpc.Models.ListPid,Grpc.Core.ServerCallContext)">
-            <summary>
-             删除册别
-            </summary>
-            <param name="listPid"></param>
-            <param name="context"></param>
-            <returns></returns>
-        </member>
         <member name="T:TEAMModelGrpc.GreetReflection">
             <summary>Holder for reflection information generated from Protos/greet.proto</summary>
         </member>

+ 5 - 5
TEAMModelOS.SDK/Context/Filters/HttpGlobalExceptionInvoke.cs

@@ -1,4 +1,4 @@
-
+
 using Microsoft.AspNetCore.Http;
 using System;
 using System.Threading.Tasks;
@@ -42,18 +42,18 @@ namespace TEAMModelOS.SDK.Context.Filter
                     bizCode = ((BizException)ex).code;
                     if (bizCode == 401 || bizCode == 404 || bizCode == 502 || bizCode == 403)
                     {
-                        context.Response.StatusCode = bizCode;
+                        //context.Response.StatusCode = bizCode;
                     }
                     else
                     {
-                        context.Response.StatusCode = 200;
+                      //  context.Response.StatusCode = 200;
                     }
                     // context.Response.StatusCode = ((BizException)ex).code;
                 }
                 //未知异常
                 else
                 {
-                    context.Response.StatusCode = 500;
+                    //context.Response.StatusCode = 500;
                     //LogHelper.SetLog(LogLevel.Error, ex);
                 }
                 await HandleExceptionAsync(context, bizCode, ex.Message, ex.StackTrace);
@@ -105,7 +105,7 @@ namespace TEAMModelOS.SDK.Context.Filter
         {
             if (context.Response.StatusCode == 500)
             {
-                context.Response.StatusCode = 200;
+               // context.Response.StatusCode = 200;
             }
             var data = new ErrorResponse<string>(bizCode, msg, devmsg);
             context.Response.ContentType = Constants.CONTENT_TYPE_JSON;

+ 19 - 19
TEAMModelOS.SDK/DI/AzureCosmos/AzureCosmosExtensions.cs

@@ -26,19 +26,19 @@ namespace TEAMModelOS.SDK.DI
     public static class AzureCosmosExtensions
     {
         /// <summary>
-        /// 遣湔袟
+        /// 缓存前缀
         /// </summary>
         private const string CacheCosmosPrefix = "cosmos:";
         /// <summary>
-        /// ttl奀酗 1鏃
+        /// ttl时长 1秒
         /// </summary>
         private const int ttl = 1;
         /// <summary>
-        /// 煦珜湮苤
+        /// 分页大小
         /// </summary>
         private const int pageSize = 200;
         /// <summary>
-        /// 閉奀奀潔
+        /// 超时时间
         /// </summary>
         private const int timeoutSeconds = 86400;
         public static int RU(this Response response)
@@ -96,7 +96,7 @@ namespace TEAMModelOS.SDK.DI
              
             AzureCosmosModel container = await azureCosmosFactory. InitializeCollection<T>();
             entity.pk = container.type.Name;
-            entity.ttl = null;
+            entity.ttl = -1;
             ItemResponse<T> response = await container.container.CreateItemAsync<T>(entity);
             if (container.cache && RedisHelper.Instance != null)
             {
@@ -132,7 +132,7 @@ namespace TEAMModelOS.SDK.DI
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
-                    x.ttl = null;
+                    x.ttl = -1;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     object o = type.GetProperty(partitionKey).GetValue(x, null);
@@ -173,7 +173,7 @@ namespace TEAMModelOS.SDK.DI
         {
             AzureCosmosModel container = await azureCosmosFactory. InitializeCollection<T>();
             entity.pk = container.type.Name;
-            entity.ttl = null;
+            entity.ttl = -1;
             ItemResponse<T> response = await container.container.UpsertItemAsync(item: entity);
             if (container.cache && RedisHelper.Instance != null)
             {
@@ -208,7 +208,7 @@ namespace TEAMModelOS.SDK.DI
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
-                    x.ttl = null;
+                    x.ttl = -1;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     object o = type.GetProperty(partitionKey).GetValue(x, null);
@@ -343,7 +343,7 @@ namespace TEAMModelOS.SDK.DI
             string partitionKey =AzureCosmosUtil.GetPartitionKey<T>();
             Type type = typeof(T);
             entity.pk = type.Name;
-            entity.ttl = null;
+            entity.ttl = -1;
             object o = type.GetProperty(partitionKey).GetValue(entity, null);
             ItemResponse<T> response = await container.container.ReplaceItemAsync(entity, entity.id, new PartitionKey(o.ToString()));
             if (container.cache && RedisHelper.Instance != null)
@@ -390,7 +390,7 @@ namespace TEAMModelOS.SDK.DI
                 lists.ForEach(async x =>
                 {
                     x.pk = type.Name;
-                    x.ttl = null;
+                    x.ttl = -1;
                     MemoryStream stream = new MemoryStream();
                     await JsonSerializer.SerializeAsync(stream, x, new JsonSerializerOptions { IgnoreNullValues = true });
                     object o = type.GetProperty(partitionKey).GetValue(x, null);
@@ -515,7 +515,7 @@ namespace TEAMModelOS.SDK.DI
             }
             else
             {
-                throw new BizException("統杅峈諾", 500);
+                throw new BizException("参数为空", 500);
             }
 
         }
@@ -525,15 +525,15 @@ namespace TEAMModelOS.SDK.DI
             string pk =AzureCosmosUtil. GetPartitionKey<T>();
             AzureCosmosModel container = await azureCosmosFactory.InitializeCollection<T>();
             List<IdPk> idPks = new List<IdPk>();
-            //log4net 祩??
+            //log4net 日志記錄
             string uuidKey = Guid.NewGuid().ToString();
-            string logkey = "\r\n▽" + uuidKey + "▼\r\n";
-            LogHelper.Info(default(object),
+            string logkey = "\r\n【" + uuidKey + "】\r\n";
+            LogHelper.Info(new object(),
                            logkey
-                           + "刉壺------->>\r\n"
-                           + "桶ㄩ"
+                           + "删除------->>\r\n"
+                           + "表:"
                            + type.Name + "\r\n"
-                           + "杅擂ㄩ"
+                           + "数据:"
                            + enyites.ToApiJson()
                            + "\r\n" + logkey);
             if (container.monitor)
@@ -606,7 +606,7 @@ namespace TEAMModelOS.SDK.DI
                 }
                 else
                 {
-                    throw new BizException("帤梑善ID饜腔杅擂ㄛ刉壺囮啖");
+                    throw new BizException("未找到ID匹配的数据,删除失败");
                 }
             }
             else
@@ -666,7 +666,7 @@ namespace TEAMModelOS.SDK.DI
             }
             else
             {
-                throw new BizException("脤戙統杅斛剕扢离 .pk ", ResponseCode.PARAMS_ERROR);
+                throw new BizException("查询参数必须设置 .pk ", ResponseCode.PARAMS_ERROR);
             }
         }
         /// <summary>

+ 2 - 2
TEAMModelOS.SDK/DI/AzureCosmos/Inner/ID.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Text.Json.Serialization;
@@ -7,7 +7,7 @@ namespace TEAMModelOS.SDK.DI
 {
     public interface ID
     {
-        int? ttl { get; set; }
+        int? ttl { get; set; } 
         string pk { get; set; }
         string id { get; set; }
         string code { get; set; }

+ 104 - 0
TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusExtensions.cs

@@ -0,0 +1,104 @@
+using Microsoft.Azure.Cosmos.Table;
+using Microsoft.Azure.Cosmos.Table.Queryable;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Linq;
+using Azure.Messaging.ServiceBus;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+
+namespace TEAMModelOS.SDK.DI
+{
+    public static class AzureServiceBusExtensions
+    {
+        /// <summary>
+        /// 發送信息至對列或主題
+        /// </summary>       
+        /// <param name="pathName">QueueName or TopicName</param>
+        /// <param name="message">訊息</param>
+        /// <returns></returns>
+        public static async Task SendMessageAsync(this ServiceBusClient client, string pathName, string message)
+        {
+            try
+            {
+                ServiceBusSender sender = client.CreateSender(pathName);
+                await sender.SendMessageAsync(new ServiceBusMessage(Encoding.UTF8.GetBytes(message)));
+            }
+            catch
+            {
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 批量發送訊息至對列或主題,如果批量失敗返回False
+        /// </summary>       
+        /// <param name="pathName">QueueName or TopicName</param>
+        /// <param name="messages">批量訊息</param>
+        /// <returns></returns>
+        public static async Task<bool> SendBatchMessageAsync(this ServiceBusClient client, string pathName, IList<string> messages)
+        {
+            try
+            {
+                ServiceBusSender sender = client.CreateSender(pathName);
+                ServiceBusMessageBatch messageBatch = await sender.CreateMessageBatchAsync();
+                foreach (var msg in messages)
+                {
+                    if (!messageBatch.TryAddMessage(new ServiceBusMessage(Encoding.UTF8.GetBytes(msg)))) return false;
+                }
+                await sender.SendMessagesAsync(messageBatch);
+                return true;
+            }
+            catch
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// 發送信息至對列或主題(指定時間排程)
+        /// </summary>       
+        /// <param name="pathName">QueueName or TopicName</param>
+        /// <param name="message">訊息</param>
+        /// <returns>排程訊息的序列號。</returns>
+        public static async Task<long> SendScheduleMessageAsync(this ServiceBusClient client, string pathName, string message, DateTimeOffset scheduleTime)
+        {
+            try
+            {
+                ServiceBusSender sender = client.CreateSender(pathName);
+                return await sender.ScheduleMessageAsync(new ServiceBusMessage(Encoding.UTF8.GetBytes(message)), scheduleTime);
+            }
+            catch
+            {
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 批量發送訊息至對列或主題(指定時間排程),如果批量失敗返回False
+        /// </summary>       
+        /// <param name="pathName">QueueName or TopicName</param>
+        /// <param name="messages">批量訊息</param>
+        /// <returns>排程訊息的序列號</returns>
+        public static async Task<long[]> SendScheduleMessagesAsync(this ServiceBusClient client, string pathName, IList<string> messages, DateTimeOffset scheduleTime)
+        {
+            try
+            {
+                ServiceBusSender sender = client.CreateSender(pathName);
+                List<ServiceBusMessage> msgs = new List<ServiceBusMessage>() { };
+                foreach (var msg in messages)
+                {
+                    msgs.Add(new ServiceBusMessage(Encoding.UTF8.GetBytes(msg)));
+                }
+                return await sender.ScheduleMessagesAsync(msgs, scheduleTime);
+            }
+            catch
+            {
+                return null;
+            }
+        }
+    }
+}

+ 48 - 0
TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactory.cs

@@ -0,0 +1,48 @@
+
+using Microsoft.Azure.Cosmos.Table;
+using Microsoft.Extensions.Options;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.Extensions.DependencyInjection;
+using Azure.Storage.Blobs;
+using Azure.Storage.Blobs.Models;
+using Azure.Storage.Blobs.Specialized;
+using StackExchange.Redis;
+using System.Collections.Concurrent;
+using Azure.Messaging.ServiceBus;
+
+namespace TEAMModelOS.SDK.DI
+{
+    public class AzureServiceBusFactory
+    {
+        private readonly IServiceProvider _services;
+        private readonly IOptionsMonitor<AzureServiceBusFactoryOptions> _optionsMonitor;
+        private readonly ILogger _logger;
+        private ConcurrentDictionary<string, ServiceBusClient> ServiceBusClients { get; } = new ConcurrentDictionary<string, ServiceBusClient>();
+        public AzureServiceBusFactory(IServiceProvider services, IOptionsMonitor<AzureServiceBusFactoryOptions> optionsMonitor, ILogger<AzureServiceBusFactory> logger)
+        {
+            if (services == null) throw new ArgumentNullException(nameof(services));
+            if (optionsMonitor == null) throw new ArgumentNullException(nameof(optionsMonitor));
+
+            _services = services;
+            _optionsMonitor = optionsMonitor;
+            _logger = logger;            
+        }
+
+        public ServiceBusClient GetServiceBusClient(string name = "Default")
+        {           
+            try
+            {
+                var client = ServiceBusClients.GetOrAdd(name, x => new ServiceBusClient(_optionsMonitor.Get(name).ServiceBusConnectionString));               
+                return client;
+            }
+            catch (OptionsValidationException e)
+            {
+                _logger?.LogWarning(e, e.Message);
+                return null;
+            }
+        }       
+    }
+}

+ 22 - 0
TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactoryExtensions.cs

@@ -0,0 +1,22 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.DI
+{
+    public static class AzureServiceBusFactoryExtensions
+    {
+        public static IServiceCollection AddAzureServiceBus(this IServiceCollection services, string connectionString, string name = "Default")
+        {
+            if (services == null) throw new ArgumentNullException(nameof(services));            
+            if (connectionString == null) throw new ArgumentNullException(nameof(connectionString));
+
+            services.TryAddSingleton<AzureServiceBusFactory>();
+            services.Configure<AzureServiceBusFactoryOptions>(name, o => { o.Name = name; o.ServiceBusConnectionString = connectionString; });
+
+            return services;
+        }
+    }
+}

+ 14 - 0
TEAMModelOS.SDK/DI/AzureServiceBus/AzureServiceBusFactoryOptions.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.DI
+{
+    public class AzureServiceBusFactoryOptions
+    {
+        public string Name { get; set; }
+        public string ServiceBusConnectionString { get; set; }
+    }
+
+   
+}

+ 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 - 74
TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusClientSingleton.cs

@@ -1,74 +0,0 @@
-using Microsoft.Azure.ServiceBus;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Module.AzureServiceBus
-{
-    public  class AzureServiceBusClientSingleton
-    {
-
-        private ServiceBusModel ServiceBusModel;
-        public static AzureServiceBusOptions azureServiceBusOptions;
-        private AzureServiceBusClientSingleton() { }
-        public ServiceBusModel GetServiceBusClient()
-        {
-            if (ServiceBusModel != null)
-            {
-                return ServiceBusModel;
-            }
-            else
-            {
-                getInstance(azureServiceBusOptions);
-                return ServiceBusModel;
-            }
-        }
-        public static AzureServiceBusClientSingleton getInstance(AzureServiceBusOptions _azureServiceBusOptions)
-        {
-            azureServiceBusOptions= _azureServiceBusOptions;
-          
-         
-            return SingletonInstance.instance;
-        }
-
-        private static class SingletonInstance
-        {
-            public static AzureServiceBusClientSingleton instance = new AzureServiceBusClientSingleton()
-            {
-                ServiceBusModel = new ServiceBusModel { topClients = GetTopClients(),subClients=GetSubClients() }
-            };
-        }
-
-        private static Dictionary<string, TopClient> GetTopClients() {
-            Dictionary<string, TopClient> topClients = new Dictionary<string, TopClient>();
-            string ConnectionString = azureServiceBusOptions.ConnectionString;
-            azureServiceBusOptions.Topics.ForEach(x=> { topClients.TryAdd(x.Name, new TopClient { topicClient = new TopicClient(ConnectionString, x.Name) }); });
-            return topClients;
-        }
-        private static Dictionary<string, SubClient> GetSubClients()
-        {
-            Dictionary<string, SubClient>  subClients = new Dictionary<string, SubClient>();
-            string ConnectionString = azureServiceBusOptions.ConnectionString;
-            azureServiceBusOptions.Topics.ForEach(x => { x.Subscribe.ForEach(y => { subClients.TryAdd(y, new SubClient { topName = x.Name, subscriptionClient = new SubscriptionClient(ConnectionString, x.Name, y) }); }); });
-            return subClients;
-        }
-    }
-
-
-    public class ServiceBusModel {
-       public Dictionary<string, TopClient> topClients { get; set; } = new Dictionary<string, TopClient>();
-        public Dictionary<string, SubClient> subClients { get; set; } = new Dictionary<string, SubClient>();
-       
-    }
-
-    public class TopClient { 
-       
-        public ITopicClient topicClient { get; set; }
-    }
-    public class SubClient
-    {
-        public string topName { get; set; }
-       
-        public ISubscriptionClient subscriptionClient { get; set; }
-    }
-}

+ 0 - 39
TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusCollectionExtensions.cs

@@ -1,39 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Module.AzureServiceBus;
-
-namespace TEAMModelOS.SDK
-{
-    public static class AzureServiceBusCollectionExtensions
-    {
-
-        private static AzureServiceBusServiceBuilder AddServiceBusBuilder(this IServiceCollection services)
-        {
-            return new AzureServiceBusServiceBuilder(services);
-        }
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="services"></param>
-        /// <returns></returns>
-        public static AzureServiceBusServiceBuilder AddServiceBus(this IServiceCollection services)
-        {
-            var builder = services.AddServiceBusBuilder();
-            services.AddSingleton<IAzureServiceBusService, AzureServiceBusService>();
-            return builder;
-        }
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="builder"></param>
-        /// <param name="_connectionString"></param>
-        /// <returns></returns>
-        public static AzureServiceBusServiceBuilder AddServiceBusOptions(this AzureServiceBusServiceBuilder builder, AzureServiceBusOptions serviceBusOptions)
-        {
-            builder.Services.AddSingleton(serviceBusOptions);
-            return builder;
-        }
-    }
-}

+ 0 - 29
TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusOptions.cs

@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Module.AzureServiceBus
-{
-    /// <summary>
-    /// 主题配置信息
-    /// </summary>
-    public  class AzureServiceBusOptions
-    {
-        public string ConnectionString { get; set; } = null;
-        public List<Topic> Topics { get; set; } = null;
-       
-    }
-    /// <summary>
-    /// 主题
-    /// </summary>
-    public class Topic { 
-        /// <summary>
-        /// 主题名称
-        /// </summary>
-        public string Name { get; set; }
-        /// <summary>
-        /// 主题的订阅器
-        /// </summary>
-        public List<string> Subscribe { get; set; }
-    }
-}

+ 0 - 32
TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusService.cs

@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Module.AzureServiceBus
-{
-    public class AzureServiceBusService :IAzureServiceBusService
-    {
-        public ServiceBusModel serviceBusModel;
-
-        public AzureServiceBusService(AzureServiceBusOptions options) {
-            serviceBusModel = AzureServiceBusClientSingleton.getInstance(options).GetServiceBusClient() ;
-        }
-
-
-        public void init() {
-            if (serviceBusModel != null) {
-                
-            }
-        }
-        public TopClient GetTopClient(string TopName) {
-            serviceBusModel.topClients.TryGetValue(TopName, out TopClient topClient);
-            return topClient;
-        }
-
-        public SubClient GetSubClient(string SubName)
-        {
-            serviceBusModel.subClients.TryGetValue(SubName, out SubClient subClient);
-            return subClient;
-        }
-    }
-}

+ 0 - 24
TEAMModelOS.SDK/Module/AzureServiceBus/AzureServiceBusServiceBuilder.cs

@@ -1,24 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Module.AzureServiceBus
-{
-    public class AzureServiceBusServiceBuilder
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="services"></param>
-        public AzureServiceBusServiceBuilder(IServiceCollection services)
-        {
-            Services = services ?? throw new ArgumentNullException(nameof(services));
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public IServiceCollection Services { get; }
-    }
-}

+ 0 - 13
TEAMModelOS.SDK/Module/AzureServiceBus/IAzureServiceBusService.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.SDK.Module.AzureServiceBus
-{
-    public interface IAzureServiceBusService
-    {
-        public TopClient GetTopClient(string TopName);
-        public SubClient GetSubClient(string SubName);
-        void init();
-    }
-}

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

@@ -20,6 +20,7 @@
   <ItemGroup>
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.1.0" />
     <PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
+    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.0.0-preview.4" />
     <PackageReference Include="Azure.Storage.Blobs.Batch" Version="12.2.1" />
     <PackageReference Include="Azure.Storage.Queues" Version="12.3.2" />
     <PackageReference Include="ClouDASLibx" Version="1.1.4" />
@@ -37,7 +38,6 @@
     <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
     <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.6" />
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.6" />
-    <PackageReference Include="Microsoft.Azure.ServiceBus" Version="4.1.3" />
     <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.6" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.6" />

+ 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);
-
-    }
-}

+ 0 - 13
TEAMModelOS.Service/Services/ChangeFeed/IChangeFeedService.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Services.ChangeFeed
-{
-    public interface IChangeFeedService<T>
-    {
-        void Processor(IReadOnlyCollection<T> changes);
-    }
-}

+ 0 - 10
TEAMModelOS.Service/Services/ChangeFeed/IChangeService.cs

@@ -1,10 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TEAMModelOS.Service.Services.ChangeFeed
-{
-    public  interface IChangeService
-    {
-    }
-}

+ 0 - 24
TEAMModelOS.Service/Services/ChangeFeed/KnowledgeChangeFeed.cs

@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Services.ChangeFeed
-{
-    public class KnowledgeChangeFeed : IChangeFeedService<Knowledge>, IChangeService
-    {
-        private AzureCosmosFactory cosmosDBV3Repository;
-        public KnowledgeChangeFeed(AzureCosmosFactory azureCosmos) {
-            cosmosDBV3Repository = azureCosmos;
-        }
-        public   void Processor(IReadOnlyCollection<Knowledge> changes)
-        {
-            //List<Knowledge> s = await cosmosDBV3Repository.FindAll<Knowledge>();
-            Console.WriteLine(DateTimeOffset.Now.UtcTicks +"    "+changes.ToApiJson());
-        }
-    }
-}

+ 0 - 23
TEAMModelOS.Service/Services/ChangeFeed/SyllabusVolumeChangeFeed.cs

@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Services.ChangeFeed
-{
-    public class SyllabusVolumeChangeFeed : IChangeFeedService<Volume>, IChangeService
-    {
-        private AzureCosmosFactory cosmosDBV3Repository;
-        public SyllabusVolumeChangeFeed(AzureCosmosFactory azureCosmos)
-        {
-            cosmosDBV3Repository = azureCosmos;
-        }
-        public void Processor(IReadOnlyCollection<Volume> changes)
-        {
-            Console.WriteLine(DateTimeOffset.Now.UtcTicks + "    "+changes.ToApiJson());
-        }
-    }
-}

+ 0 - 12
TEAMModelOS.Service/Services/Evaluation/Implements/EvaluatingService.cs

@@ -1,12 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.Service.Exam.Interfaces;
-
-namespace TEAMModelOS.Service.Exam.Implements
-{
-    public class EvaluatingService :  IEvaluatingService
-    {
-
-    }
-}

+ 0 - 9
TEAMModelOS.Service/Services/Evaluation/Interfaces/IEvaluatingService.cs

@@ -1,9 +0,0 @@
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Exam.Interfaces
-{
-    public interface IEvaluatingService : IBusinessService
-    {
-
-    }
-}

+ 0 - 13
TEAMModelOS.Service/Services/Evaluation/Interfaces/IHtmlAnalyzeService.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Services.Exam.Interfaces
-{
-    public interface IHtmlAnalyzeService: IBusinessService
-    {
-        List<Models.ItemInfo> AnalyzeWordAsync(string htmlString, string Lang);
-  
-    }
-}

+ 0 - 18
TEAMModelOS.Service/Services/Evaluation/Interfaces/IImportExerciseService.cs

@@ -1,18 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Services.Exam.Interfaces
-{
-    public interface IImportExerciseService: IBusinessService
-    {
-      
-
-        Task<Dictionary<string, object>> UploadWord(IFormFile file);
-
-    }
-}

+ 0 - 119
TEAMModelOS.Service/Services/Learn/Implements/ServiceBusReviceService.cs

@@ -1,119 +0,0 @@
-using Microsoft.Azure.ServiceBus;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Text.Json;
-using System.Threading;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Module.AzureServiceBus;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
-
-namespace TEAMModelOS.Service.Services.Learn.Implements
-{
-    public class ServiceBusReviceService : IServiceBusReviceService
-    {
-        private readonly IAzureServiceBusService _serviceBus;
-        private readonly AzureCosmosFactory _cosmos;
-        private static ISubscriptionClient subscriptionClient;
-        public ServiceBusReviceService(IAzureServiceBusService azureServiceBus, AzureCosmosFactory cosmos)
-        {
-            _serviceBus = azureServiceBus;
-            _cosmos = cosmos;
-        }
-
-        public   void ReciveMessageAsync()
-        {
-            string SubName = "test_topic_ReciveTask";
-            subscriptionClient = _serviceBus.GetSubClient(SubName).subscriptionClient;
-            RegisterOnMessageHandlerAndReceiveMessages();
-          //  await subscriptionClient.CloseAsync();
-            //return "";
-        }
-        public void RegisterOnMessageHandlerAndReceiveMessages()
-        {
-            // Configure the message handler options in terms of exception handling, number of concurrent messages to deliver, etc.
-            var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
-            {
-                // Maximum number of concurrent calls to the callback ProcessMessagesAsync(), set to 1 for simplicity.
-                // Set it according to how many messages the application wants to process in parallel.
-                MaxConcurrentCalls = 1,
-
-                // Indicates whether MessagePump should automatically complete the messages after returning from User Callback.
-                // False below indicates the Complete will be handled by the User Callback as in `ProcessMessagesAsync` below.
-                AutoComplete = false
-            };
-            subscriptionClient.RegisterMessageHandler(ProcessMessagesAsync, messageHandlerOptions);
-
-        }
-        public async Task ProcessMessagesAsync(Message message, CancellationToken token)
-        {
-            // Process the message.
-            Console.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}");
-
-            // Complete the message so that it is not received again.
-            // This can be done only if the subscriptionClient is created in ReceiveMode.PeekLock mode (which is the default).
-            await subscriptionClient.CompleteAsync(message.SystemProperties.LockToken);
-            Dictionary<string, object> dict = Encoding.UTF8.GetString(message.Body).FromApiJson<Dictionary<string, object>>();
-            Dictionary<string, object> obj = new Dictionary<string, object>();
-            dict.TryGetValue("id", out object id);
-            dict.TryGetValue("pk", out object pk);
-            dict.TryGetValue("name", out object name);
-            dict.TryGetValue("status", out object status);
-            if (name != null && id!=null && pk!=null && status!=null ) {
-                if (name.ToString() == typeof(Homework).Name) {
-                    Homework data= await   _cosmos.FindByIdPk<Homework>(id.ToString(), pk.ToString());
-                    data.status = int.Parse(status.ToString());
-                    await _cosmos.Update(data);
-                }
-                if (name.ToString() == typeof(Vote).Name)
-                {
-                    Vote data = await _cosmos.FindByIdPk<Vote>(id.ToString(), pk.ToString());
-                    data.status = int.Parse(status.ToString());
-                    await _cosmos.Update(data);
-                }
-                if (name.ToString() == typeof(Survey).Name)
-                {
-                    Survey data= await _cosmos.FindByIdPk<Survey>(id.ToString(), pk.ToString());
-                    data.status = int.Parse(status.ToString());
-                    await _cosmos.Update(data);
-                }
-                if (name.ToString() == typeof(ExamInfo).Name)
-                {
-                    ExamInfo data= await _cosmos.FindByIdPk<ExamInfo>(id.ToString(), pk.ToString());
-                    data.status = int.Parse(status.ToString());
-                    await _cosmos.Update(data);
-                }
-                if (name.ToString() == typeof(LearnTask).Name)
-                {
-                    LearnTask data = await _cosmos.FindByIdPk<LearnTask>(id.ToString(), pk.ToString());
-                    data.status = int.Parse(status.ToString());
-                    await _cosmos.Update(data);
-                }
-            }
-           
-            //return message;
-
-            // Note: Use the cancellationToken passed as necessary to determine if the subscriptionClient has already been closed.
-            // If subscriptionClient has already been closed, you can choose to not call CompleteAsync() or AbandonAsync() etc.
-            // to avoid unnecessary exceptions.
-        }
-
-        public static Task ExceptionReceivedHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
-        {
-            Console.WriteLine($"Message handler encountered an exception {exceptionReceivedEventArgs.Exception}.");
-            var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
-            Console.WriteLine("Exception context for troubleshooting:");
-            Console.WriteLine($"- Endpoint: {context.Endpoint}");
-            Console.WriteLine($"- Entity Path: {context.EntityPath}");
-            Console.WriteLine($"- Executing Action: {context.Action}");
-            return Task.CompletedTask;
-        }
-    }
-}

+ 0 - 46
TEAMModelOS.Service/Services/Learn/Implements/TimerWorkService.cs

@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
-
-namespace TEAMModelOS.Service.Services.Learn.Implements
-{
-    public class TimerWorkService: ITimerWorkService
-    {
-        private readonly AzureCosmosFactory _cosmos;
-
-        public TimerWorkService(AzureCosmosFactory cosmos)
-        {
-            _cosmos = cosmos;
-        }
-
-        public void TimerWork<T>(long startTime, int status , Dictionary<string, object> dict) where T : ID
-        {
-            System.Timers.Timer aTimer = new System.Timers.Timer();
-            // Create a timer with a two second interval.
-            long time = Math.Abs(startTime - new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds());
-            aTimer = new System.Timers.Timer(time);
-            // Hook up the Elapsed event for the timer. 
-            aTimer.Elapsed += async (sender, e) => await OnTimedEventAsync<T>(_cosmos,status, dict);
-            aTimer.AutoReset = false;
-            aTimer.Enabled = true;
-        }
-
-        public static async Task OnTimedEventAsync<T>(AzureCosmosFactory _cosmos, int status, Dictionary<string, object> dict) where T : ID
-        {
-            List<T> homeWorks = await _cosmos.FindByDict<T>(dict);
-            if (homeWorks.IsNotEmpty())
-            {
-                PropertyInfo propertyInfo = homeWorks[0].GetType().GetProperty("status");
-                for (int i = 0; i < homeWorks.Count; i++)
-                    propertyInfo.SetValue(homeWorks[i], status);
-                await _cosmos.SaveOrUpdateAll<T>(homeWorks);
-
-            }
-        }
-    }
-}

+ 0 - 14
TEAMModelOS.Service/Services/Learn/Interfaces/IServiceBusReviceService.cs

@@ -1,14 +0,0 @@
-using Microsoft.Extensions.Hosting;
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Services.Learn.Interfaces
-{
-    public interface IServiceBusReviceService
-    {
-        public void ReciveMessageAsync();
-    }
-}

+ 0 - 16
TEAMModelOS.Service/Services/Learn/Interfaces/IServiceBusService.cs

@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-
-namespace TEAMModelOS.Service.Services.Learn.Interfaces
-{
-    public interface IServiceBusService : IBusinessService
-    {
-        public Task<long> SendMessage<T>(string TopicName, string id, string pk, long startTime,int status,string msgId);
-
-  
-
-    }
-}

+ 0 - 13
TEAMModelOS.Service/Services/Learn/Interfaces/ITimerWorkService.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.SDK.DI;
-
-namespace TEAMModelOS.Service.Services.Learn.Interfaces
-{
-    public interface ITimerWorkService : IBusinessService
-    {
-        public void TimerWork<T>(long startTime, int status,Dictionary<string, object> dict ) where T : ID;
-    }
-}

+ 0 - 16
TEAMModelOS.Service/Services/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);
-    }
-}

+ 0 - 17
TEAMModelOS.Service/Services/Syllabus/Interface/IKnowledgeService.cs

@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Services.Interface
-{
-    public interface IKnowledgeService : IBusinessService
-    {
-        public Task<List<Knowledge>> SaveOrUpdateKnowledge(List<Knowledge> request);
-
-        public Task<List<IdPk>> DeleteKnowledge(List<IdPk> listPid);
-    }
-}

+ 0 - 34
TEAMModelOS.Service/Services/Syllabus/Interface/ISyllabusService.cs

@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Services.Interface
-{
-    public interface ISyllabusService : IBusinessService
-    {
-
-        /// <summary>
-        /// 查找课纲 
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public Task<List<SyllabusTree>> Find(Dictionary<string, object> request);
-
-        /// <summary>
-        /// 保存或者修改课纲
-        /// </summary>
-        /// <param name="syllabusNodes"></param>
-        /// <returns></returns>
-        public Task<List<Syllabus>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes);
-
-        public Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request);
-
-        public Task<List<Syllabus>> DeleteSyllabus(Dictionary<string, object> request);
-
-
-    }
-}

+ 0 - 16
TEAMModelOS.Service/Services/Syllabus/Interface/IVolumeService.cs

@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TEAMModelOS.SDK.Context.Configuration;
-using TEAMModelOS.Service.Models;
-
-namespace TEAMModelOS.Service.Services.Interface
-{
-    public interface IVolumeService : IBusinessService
-    {
-
-        public  Task<List<Volume>> SaveOrUpdateVolume(Volume request);
-
-    }
-}

File diff suppressed because it is too large
+ 0 - 1969
TEAMModelOS.Service/TEAMModelOS.Model.xml


+ 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>

+ 50 - 0
TEAMModelOS/ClientApp/src/api/forgetPW.js

@@ -0,0 +1,50 @@
+import { corePost } from '@/filters/http'
+import config from '@/store/module/config'
+import jwtDecode from 'jwt-decode'
+
+export default {
+/**
+ * 重置密碼
+ * @param {String} applyType - 寄信類型(email, phone)
+ * @param {String} name - 姓名
+ * @param {String} account - 驗證帳號
+ * @param {String} pw - 密碼
+ * @param {String} country - 手機區碼,無須+號(有phone為必填)
+ * @param {String} pinCode - 驗證碼
+ */
+restPW: function(item)   {
+    return new Promise((resolve) => {
+        let srvAdr = localStorage.getItem('srvAdr')
+        let url = config.state[srvAdr].coreAPIUrl
+        let nonceStr = 'habook'  // 檢查項目
+        let data = {
+            "grant_type": "reset",
+            'client_id': config.state[srvAdr].clientID,
+            'nonce': nonceStr,
+            "password": item.pw,
+            "pin_code": item.pinCode.toString()
+        }
+
+        if(item.applyType == 'phone'){
+            data.account = '+' + item.country + '-' + item.account
+        } else {
+            data.account = item.account
+        }
+
+        corePost(url+'/oauth2/login', data).then( res => {
+            if(res.error){
+                resolve(res)
+            } else {
+            let t_data = jwtDecode(res.id_token)
+            if(nonceStr === t_data.nonce){
+                resolve(res)
+            } else {
+                resolve({error: 'nonce'})
+            }
+            }
+        },err => {
+            console.log(err)
+        })
+    })
+  },
+}

+ 2 - 0
TEAMModelOS/ClientApp/src/api/index.js

@@ -20,6 +20,7 @@ import teachMgmt from './teachMgmt'
 import schoolUser from './schoolUser'
 import accessToken from './accessToken'
 import regist from './regist'
+import forgetPW from './forgetPW'
 export default {
     accessToken,
     learnActivity,
@@ -41,6 +42,7 @@ export default {
     teachMgmt,
     schoolUser,
     regist,
+    forgetPW,
     // 获取登录跳转链接
     getLoginLink: function (data) {
         return post('api/login/login', data)

+ 41 - 42
TEAMModelOS/ClientApp/src/api/regist.js

@@ -3,50 +3,49 @@ import config from '@/store/module/config'
 import jwtDecode from 'jwt-decode'
 
 export default {
+/**
+ * 註冊帳號
+ * @param {String} applyType - 寄信類型(email, phone)
+ * @param {String} name - 姓名
+ * @param {String} account - 驗證帳號
+ * @param {String} pw - 密碼
+ * @param {String} country - 手機區碼,無須+號(有phone為必填)
+ * @param {String} pinCode - 驗證碼
+ */
+crtAccount: function(item)   {
+    return new Promise((resolve) => {
+      let srvAdr = localStorage.getItem('srvAdr')
+      let url = config.state[srvAdr].coreAPIUrl
+      let nonceStr = 'habook'  // 檢查項目
+      let data = {
+        "grant_type": "create",
+        'client_id': config.state[srvAdr].clientID,
+        'nonce': nonceStr,
+        "name" : item.name,
+        "password": item.pw,
+        "pin_code": item.pinCode.toString()
+      }
 
-    /**
-     * 註冊帳號
-     * @param {String} applyType - 寄信類型(email, phone)
-     * @param {String} name - 姓名
-     * @param {String} account - 驗證帳號
-     * @param {Stringn} pw - 密碼
-     * @param {String} country - 手機區碼,無須+號(有phone為必填)
-     * @param {String} pinCode - 驗證碼
-     */
-    crtAccount: function(item)   {
-        return new Promise((resolve) => {
-          let srvAdr = localStorage.getItem('srvAdr')
-          let url = config.state[srvAdr].coreAPIUrl
-          let nonceStr = 'habook'  // 檢查項目
-          let data = {
-            "grant_type": "create",
-            'client_id': config.state[srvAdr].clientID,
-            'nonce': nonceStr,
-            "name" : item.name,
-            "password": item.pw,
-            "pin_code": item.pinCode.toString()
-          }
+      if(item.applyType == 'phone'){
+          data.account = '+' + item.country + '-' + item.account
+      } else {
+        data.account = item.account
+      }
 
-          if(item.applyType == 'phone'){
-              data.account = '+' + item.country + '-' + item.account
+      corePost(url+'/oauth2/login', data).then( res => {
+        if(res.error){
+          resolve(res)
+        } else {
+          let t_data = jwtDecode(res.id_token)
+          if(nonceStr === t_data.nonce){
+            resolve(res)
           } else {
-            data.account = item.account
+            resolve({error: 'nonce'})
           }
-
-          corePost(url+'/oauth2/login', data).then( res => {
-            if(res.error){
-              resolve(res)
-            } else {
-              let t_data = jwtDecode(res.id_token)
-              if(nonceStr === t_data.nonce){
-                resolve(res)
-              } else {
-                resolve({error: 'nonce'})
-              }
-            }
-          },err => {
-            console.log(err)
-          })
-        })
-      },
+        }
+      },err => {
+        console.log(err)
+      })
+    })
+  },
 }

+ 5 - 3
TEAMModelOS/ClientApp/src/components/learnactivity/BaseHwTable.vue

@@ -324,7 +324,7 @@
             }
         },
         created() {
-            this.getSasStr()
+            // this.getSasStr()
         },
         methods: {
             /**
@@ -497,8 +497,10 @@
              * @param blobUrl
              */
             onDownloadFile(downloadList) {
-                downloadList.forEach(item => {
-                    window.location.href = item + this.sasString
+                downloadList.forEach(async item => {
+					let fileSas = await this.$tools.getFileSas(item)
+					console.log(fileSas)
+                    window.location.href = item + '?' +  fileSas.sas
                 })
             },
 

+ 13 - 0
TEAMModelOS/ClientApp/src/router/routes.js

@@ -35,6 +35,19 @@ export const routes = [
             }
         ]
     },
+    {
+        path: '/forgotpw', component: FrontEndMain,
+        children: [
+            {
+                name: 'forgotpw',
+                path: '/',
+                meta: {
+                    middleware: ['login?']
+                },
+                component: resolve => require(['@/view/forgotPw/Index.vue'], resolve)
+            }
+        ]
+    },
     {
         path: '/schoolList',
         component: Home,

File diff suppressed because it is too large
+ 1 - 1
TEAMModelOS/ClientApp/src/utils/countryCodeData.js


+ 2 - 0
TEAMModelOS/ClientApp/src/utils/public.js

@@ -317,6 +317,7 @@ export default {
                     (res) => {
                         if (res.error == null) {
                             store.commit('setPrivateSas', res.result.data)
+							res.result.data.sas  = '?' + res.result.data.sas
                             r(res.result.data)
                         } else {
                             j(500)
@@ -345,6 +346,7 @@ export default {
                     (res) => {
                         if (res.error == null) {
                             store.commit('setSchoolSas', res.result.data)
+							res.result.data.sas  = '?' + res.result.data.sas
                             r(res.result.data)
                         } else {
                             j(500)

+ 4 - 0
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseChild.vue

@@ -107,14 +107,18 @@
 			&-option{
 				font-size: 14px;
 				margin: 10px 5px;
+				margin-left: 80px;
 				
 				&-order{
 					display: inline-block;
+					width: 25px;
 				}
 				
 				&-text{
 					display: inline-block;
 					margin-left: 5px;
+					width: calc(90% - 25px);
+					vertical-align: text-top;
 				}
 			}
 		}

+ 11 - 0
TEAMModelOS/ClientApp/src/view/evaluation/components/BaseCreateChild.vue

@@ -305,6 +305,17 @@
 					this.repairEditor.txt.clear()
 				}
 			},
+			
+			// 重置本页面
+			doReset(){
+				this.exerciseField = 0
+				this.exercisePoints = []
+				this.exersicesDiff = '1'
+				this.exersicesType = 'Single'
+				this.analysisEditor.txt.clear()
+				this.repairEditor.txt.clear()
+				this.editInfo = null
+			},
 
 			// 难度与背景颜色切换
 			diffChange(e, type) {

+ 10 - 2
TEAMModelOS/ClientApp/src/view/evaluation/index/CreateExercises.vue

@@ -120,7 +120,7 @@
 		</div>
 
         <div class="save-wrap display-flex">
-			<Button type="info" @click="addComposeChildModal = true" style="margin-right:10px" v-show="exersicesType === 'Compose'">添加小题</Button>
+			<Button type="info" @click="onAddChild" style="margin-right:10px" v-show="exersicesType === 'Compose'">添加小题</Button>
             <Button type="success" @click="getContent(exersicesType)" :loading="saveLoading">保存</Button>
         </div>
 
@@ -157,7 +157,7 @@
 		<!-- 添加小题弹窗 -->
 		<Modal v-model="addComposeChildModal" width="1080" footer-hide class="">
 		    <div class="modal-header" slot="header">添加小题</div>
-		    <BaseCreateChild @addFinish='onAddChildFinish' ></BaseCreateChild>
+		    <BaseCreateChild @addFinish='onAddChildFinish' ref='createAddChild' v-if="addComposeChildModal"></BaseCreateChild>
 		</Modal>
 
     </div>
@@ -348,6 +348,7 @@
 					console.log(exerciseItem)
                     this.$Message.warning('请将题目填写完整!')
                 }
+				
             },
 			
 			/* 保存单个试题 */
@@ -365,6 +366,13 @@
                 })
             },
 			
+			/* 添加小题 重置新增页面 */
+			onAddChild(){
+				this.addComposeChildModal = true
+				if(this.$refs.createAddChild) this.$refs.createAddChild.doReset()
+			},
+			
+			/* 添加小题完成 */
 			onAddChildFinish(item){
 				console.log('获取到小题')
 				console.log(item)

+ 14 - 0
TEAMModelOS/ClientApp/src/view/forgotPw/Index.less

@@ -0,0 +1,14 @@
+.forgotDiv{
+    width: 500px;
+    height: 500px;
+    display: flex;
+    justify-content: center;
+    align-content: flex-start;
+    .validForm{
+        width: 400px;
+        .formItem{
+            
+        }
+        
+    }
+}

+ 297 - 0
TEAMModelOS/ClientApp/src/view/forgotPw/Index.vue

@@ -0,0 +1,297 @@
+<style lang="less" scoped>
+  @import './Index.less';
+</style>
+
+<style lang="less">
+  .forgotBox{
+    .validForm{
+      .formItem{
+          .ivu-form-item-label {
+            color: white;
+          }
+          input, select, button{
+              border-radius: 0;
+              font-size: 12px;
+          }
+          .ivu-btn-primary{
+            background-color: #4d6b9d;
+          }
+          .ivu-select-selection{
+            border-radius: 0;
+          }
+      }
+    }
+  }
+</style>
+
+<template>
+    <div class="forgotDiv">
+        <div class="forgotBox">
+          <h3 style="text-align: center;margin-bottom: 5px;font-weight: 100;letter-spacing: 3px;font-size: 20px;color: white;">
+              {{ $t('重置密碼') }}
+          </h3>
+          <Form v-show="restPWStep == 1" class="validForm" ref="sendForm" :model="sendForm" :rules="sendRules" label-position="top" @keydown.enter.native="handleSubmit('sendForm')" style="color: white;">
+            <FormItem class="formItem">
+              <span v-if="applyType == 'email' " style="display: block;text-align: center;font-size: 13px;color: rgb(244, 67, 54);">{{ $t('regist.form.text7')}}</span>
+            </FormItem>
+            <FormItem class="formItem" prop="account" >
+              <Row type="flex" justify="center" align="top">
+                <Col v-if="applyType == 'phone'" :span="9">
+                  <CountryCode v-model="cCode"/>
+                </Col>
+                <Col :span="applyType == 'phone' ? 15 : 24">
+                  <Input :placeholder="$t('regist.form.placeholder.' + applyType)" v-model="sendForm.account"></Input>                                                                        
+                </Col>
+              </Row>
+            </FormItem>
+            <FormItem class="formItem">
+                <Button long  type="primary" @click="handleSubmit('sendForm')">
+                  <span>{{ $t('發送驗證碼') }}</span>
+                </Button>
+            </FormItem>
+            <FormItem class="formItem" style="text-align: center;">
+              <Button style="color: #409eff;" type="text" @click="chgValidType()" >{{ applyType == 'email' ? '改用手機驗證' : '改用Email驗證' }}</Button>
+            </FormItem>
+          </Form>
+          <Form v-show="restPWStep == 2" class="validForm" ref="resPwForm" :model="resPwForm" :rules="resPwRules" label-position="top" style="color: white;">
+              <FormItem class="formItem" style="text-align: center;">
+                {{'+' + cCode + '-' + sendForm.account}} <Button  type="primary" size="small" :disabled="countdown" @click="handleSubmit('sendForm')"> {{ sendBtnText }}</Button>
+              </Formitem>
+              <FormItem class="formItem">
+                  <span v-if="applyType == 'email' " style="width: 400px;display: block;text-align: center;font-size: 13px;color: rgb(244, 67, 54);">{{ $t('regist.form.text7')}}</span>
+              </FormItem>
+              <FormItem class="formItem" prop="pinCode" :label="$t('請輸入驗證碼')">
+                <Input  class="radius-left-0 input-font-size-12" v-model="resPwForm.pinCode"></Input>
+              </FormItem>
+              <FormItem class="formItem"  :label="$t('新密碼')" prop="pw" >
+                <Input   type="password" password  v-model="resPwForm.pw" ></Input>
+              </FormItem>
+              <FormItem class="formItem"  :label="$t('請再確認一次密碼')" prop="pwCheck" >
+                <Input   type="password" password v-model="resPwForm.pwCheck" ></Input>
+              </FormItem>
+              <FormItem class="formItem">
+                  <Button long  type="primary" @click="handleSubmit('resPwForm')" style="margin-top:20px;">
+                      <span>{{ $t('regist.btn.signUp') }}</span>
+                  </Button>
+              </FormItem>
+          </Form>
+        </div>
+    </div>
+</template>
+<script>
+import { User } from '@/service/User'
+import CountryCode from '@/components/public/countryCode/Index.vue'
+import { mapState, mapGetters } from 'vuex'
+
+export default {
+  components:{
+    CountryCode
+  },
+  data() {
+    const validAccount = (rule, value, callback) => {
+      if (value === '') {
+        if(this.applyType == 'phone'){
+          callback(new Error( this.$t('error.input.phone')));
+        } else {
+          callback(new Error( this.$t('error.input.email')));
+        }    
+      } else {
+        switch (this.applyType) {
+          case 'email':
+            let emailRule = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/;
+            if(value.search(emailRule) != -1){
+              callback();
+            } else {
+              callback(new Error( this.$t('error.format.email')));
+            }
+            break;
+          case 'phone':
+            if(this.cCode === '') {
+              callback(new Error( this.$t('error.input.countryCode')));
+            } else if(!(/^[0-9]*$/.test(value))) {
+              callback(new Error( this.$t('error.format.numeric')));
+            } else {
+              callback();
+            }
+            break;
+        }
+      }
+    };
+    const validPW = (rule, value, callback) => {
+      if (!(/^(?=.*[a-zA-Z])(?=.*\d)[\S]{8,30}$/.test(value))) {
+        callback(new Error(this.$t('error.format.pw')));
+      } else {
+        callback();
+      }
+    };
+    const validPWCheck = (rule, value, callback) => {
+      if(value == ''){
+        callback(new Error(this.$t('error.input.pwCheck')));
+      }
+      else if(value != this.registForm.pw){
+        callback(new Error(this.$t('error.input.pwCheckFail')));
+      } else {
+        callback();
+      }
+    };
+    return {
+      applyType: 'phone',
+      restPWStep: 1, // 發送驗證碼 1, 重置密碼 2
+      cCode:'',
+      teammodelID: '',
+      sendText: '',
+      lang: localStorage.getItem('local'),
+      countdownSec: 60,
+      verfTime: 0,
+      countdown: false,
+      sendForm:{
+        account: '',
+      },
+      sendRules:{
+        account: [
+          {validator: validAccount , trigger: 'blur' },
+        ],
+      },
+      resPwForm: {
+          pw: '',
+          pwCheck: '',
+          pinCode:''
+      },
+      resPwRules: {
+        pw: [
+          {required: true, message: () => this.$t('error.required') , trigger: 'blur' },
+          {validator: validPW , trigger: 'blur' }
+        ],
+        pwCheck: [
+          {required: true, message: () => this.$t('error.required') , trigger: 'blur' },
+          {validator: validPWCheck , trigger: 'blur' }
+        ],
+        pinCode: [
+          {required: true, message: () => this.$t('error.required') , trigger: 'blur' },
+        ],        
+      },
+      loading: false
+    }
+  },
+  computed: {
+    ...mapState({
+      config: state => state.config
+    }),
+    ...mapGetters({
+        loginSchooCode: 'user/getLoginSchooCode',
+        srvAdr: 'config/getSrvAdr'
+    }),
+    sendBtnText: function(){ // 發送驗證信與驗證碼字串判斷
+        let str = this.$t('regist.btn.send' + this.applyType)
+        let timeStr = ''
+        if(this.countdown) timeStr = '(' + this.verfTime + ')'
+
+        return str + timeStr
+    },
+    accFormat: function(){
+      let acc = this.sendForm.account
+      if(this.applyType == 'phone' && this.cCode == 886 && acc.indexOf(0) == 0) {
+        acc = acc.substr(1)
+      }
+
+      return acc
+    }
+  },
+  created() {
+    this.verfTime = this.countdownSec;
+    // this.teammodelID = Math.floor(new Date().getTime() / 1000)
+  },
+  methods: {
+    chgValidType: function(){
+      if(this.applyType == 'phone') {
+        this.applyType = 'email'
+      } else {
+        this.applyType = 'phone'
+      }
+    },
+    handleSubmit: function(name){
+      this.$refs[name].validate( async(valid) => {
+        if (valid) {
+          let data = {}
+          switch (name) {
+            case 'sendForm':
+              data = {
+                applyType: this.applyType,
+                to: this.accFormat,
+                lang: this.lang,
+                hasUser: true,
+                country: this.cCode
+              }
+              this.$api.SendPinCode(data).then(res => {
+                let errorFlag = false
+                if(res){
+                  errorFlag = true
+                  this.$Message.warning({
+                    content: this.applyType == 'phone' ?  this.$t('此手機號碼不存在') : this.$t('此信箱不存在'),
+                    duration: 7,
+                    closable: true
+                  })
+                } 
+
+                if(!errorFlag){
+                  this.restPWStep = 2
+                  this.countdown = true
+                  this.reciprocal()
+                }
+              })
+            break;
+            case 'resPwForm':
+              data = {
+              applyType: this.applyType,
+              account: this.accFormat,
+              pw: this.registForm.pw,
+              country: this.cCode,
+              pinCode: this.registForm.pinCode
+            }
+
+            this.$api.forgetPW.resetPW(data).then(res => {
+              if(res.error){
+                let text;
+                switch (res.error) {
+                  case 2:
+                    text = this.$t('error.coreApi.error2.default')
+                    break;
+                  case 3:
+                    text = this.$t('error.coreApi.error3')
+                    break;
+                }
+
+                this.$Message.warning({
+                    content: text,
+                    duration: 7,
+                    closable: true
+                })
+              } else {
+                console.log('登入')
+                console.log(res)
+                // 1. 登入大雲
+                // 2. 檢查是否有學校沒有則跳至schoolList
+                // 3. 有學校是否和login_schollCode 一樣
+                // 4. 沒有一樣預設第一個
+                // 5. 儲存 asscess_token, id_token, expires_in
+                // 6. 登入User.API
+              }
+            })
+              break;
+          }
+        }
+      })
+    },
+    reciprocal () { // 調整倒數時間至可控
+        this.verfTime -=1;
+        if(this.verfTime==0){
+          this.countdown = false
+          this.verfTime = this.countdownSec;
+        } else{
+          //每秒執行一次,showTime()
+          setTimeout(this.reciprocal,1000);
+        }
+    },
+  }
+}
+</script>

+ 1 - 1
TEAMModelOS/ClientApp/src/view/login/Index.vue

@@ -79,7 +79,7 @@
                 <a @click="chgLoginType()">{{ $t('login.link.QRLogin') }}</a>
               </div>
               <div class="link">
-                <router-link to="/regist">{{ $t('login.link.regist') }}</router-link> | <a>{{ $t('login.link.forgetPsw') }}</a>
+                <router-link to="/regist">{{ $t('login.link.regist') }}</router-link> | <router-link to="/forgotpw">{{ $t('login.link.forgetPsw') }}</router-link>
               </div>
             </div>
 

+ 0 - 2
TEAMModelOS/ClientApp/src/view/regist/Index.vue

@@ -193,8 +193,6 @@ export default {
     }
   },
   computed: {
-    userAccess() { return this.$access.getExtendInfo('userAccess');},
-    userInfo() { return this.$access.getExtendInfo('userInfo');},
     ...mapState({
       config: state => state.config
     }),

+ 10 - 1
TEAMModelOS/ClientApp/src/view/school-mgmt/SystemSetting/SystemSetting.less

@@ -382,7 +382,6 @@
                 .ivu-icon {
                     margin-top: -3px;
                     margin-right: 5px;
-                    display: none;
                 }
             }
 
@@ -519,3 +518,13 @@
     display: inline-block;
     vertical-align: super;
 }
+
+#get-width {
+    position: absolute;
+    left: 0px;
+    top: 0px;
+    font-size: 18px;
+    visibility: hidden;
+    border: 1px solid black;
+    width: fit-content;
+}

+ 106 - 56
TEAMModelOS/ClientApp/src/view/school-mgmt/SystemSetting/SystemSetting.vue

@@ -1,29 +1,5 @@
-<style lang="less" scoped>
-    @import './SystemSetting.less';
-</style>
-<style>
-    .second-arrow {
-        margin-left: -16px;
-    }
-
-    .color-check {
-        color: #08d0c8;
-    }
-
-    .color-uncheck {
-        color: #FF6C6B;
-    }
-
-    .bg-color-check {
-        background-color: #08d0c8 !important;
-    }
-
-    .bg-color-uncheck {
-        background-color: #FF6C6B !important;
-    }
-</style>
 <template>
-    <div class="sm-system">
+    <div class="sm-system" @click="editSubStatus = false">
         <div class="sm-school-name">
             <div>
                 <span class="setting-title">{{$t('schoolBaseInfo.schoolNameLabel')}}</span>
@@ -54,15 +30,13 @@
                             <span class="campus-label" @click="setCampus">
                                 {{item.campusCode === null ? '请设置校区': $JSONPath.query(schoolSetting, "$..campuses[?(@.campusCode=='" + item.campusCode + "')]").length > 0 ? $JSONPath.query(schoolSetting, "$..campuses[?(@.campusCode=='" + item.campusCode + "')]")[0].campusName : '请设置校区' }}
                             </span>
-                            <!--<Icon type="md-create" class="period-btn-edit" title="编辑" @click="changePeriodEditStatus(index)" />-->
                         </p>
-
                         <p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.semesterNum') + item.semesters.length}}</p>
                         <p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.gradeNum') + item.grades.length}}</p>
                         <p class="period-item-num"><span></span>{{ $t('schoolBaseInfo.periodNum') + item.subjects.length}}</p>
 
                     </div>
-                    
+
                 </div>
             </div>
             <!--学期列表-->
@@ -84,17 +58,14 @@
                             </p>
                             <div class="term-item-start">
                                 <span>{{$t('schoolBaseInfo.startDate')}}</span>
-                                <!--<Select v-model="item.month" :disabled="editSemIndex !== index" :placeholder="$t('schoolBaseInfo.monthHolder')">
-        <Option v-for="(item,index) in monthList" :value="item" :key="index">{{ item }}</Option>
-    </Select>-->
-                                <InputNumber v-model="item.month" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="12" :min="1"></InputNumber>
+                                <InputNumber @on-change="countSemDays" v-model="item.month" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="12" :min="1"></InputNumber>
                                 <span> / </span>
-                                <InputNumber v-model="item.day" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="31" :min="1"></InputNumber>
+                                <InputNumber @on-change="countSemDays" v-model="item.day" size="small" style="width:50px;" :disabled="editSemIndex !== index" :max="31" :min="1"></InputNumber>
                             </div>
                             <p class="term-item-students-num">{{$t('schoolBaseInfo.semesterDuration')+ item.days + $t('schoolBaseInfo.dayUnit')  }}</p>
                         </div>
                     </div>
-                    
+
                     <div class="term-item-time-line" v-if="schoolSetting.period[currentSchoolSysIndex].semesters.length">
                         <ul>
                             <li v-for="(item,index) in monthEnList" :key="index">
@@ -134,17 +105,22 @@
                     </div>
                 </div>
                 <!--学科显示区域-->
-                <div class="col-title">
+                <div class="col-title" @click.stop>
                     <span>{{$t('schoolBaseInfo.subjectSetting')}}</span>
-                    <Icon type="md-add" @click="addSubject()" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll"/>
+                    <Icon type="md-add" @click="addSubject()" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
+                    <Icon type="md-trash" @click="delSubStatus = true" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
+                    <Icon type="md-create" @click.stop="editSubStatus = true" class="action-btn-icon" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
                 </div>
-                <div class="grade-body">
+                <div class="grade-body dark-iview-input disabled-iview-input" @click.stop>
                     <div class="grade-item item-active" v-for="(item,index) in schoolSetting.period[currentSchoolSysIndex].subjects" :key="index">
                         <span class="grade-item-icon"></span>
-                        <EditableLabel ref="subjectName" class="grade-item-name" :content="item.subjectName" @editComplete="handleEditSubject($event,index)">
-                        </EditableLabel>
-                        <Icon type="md-create" class="period-btn-edit" :title="$t('schoolBaseInfo.editLabel')" @click="changeSubjectEditStatus(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
-                        <Icon type="md-close" @click="delSubject(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />
+                        <!--<EditableLabel ref="subjectName" class="grade-item-name" :content="item.subjectName" @editComplete="handleEditSubject($event,index)">
+    </EditableLabel>-->
+                        <p :class="'get-width'+index" id="get-width">{{item.subjectName}}</p>
+
+                        <Input v-model="item.subjectName" :disabled="!editSubStatus" placeholder="设置学科..." :style="{width: getWidth(index)+'px'}" />
+                        <!--<Icon type="md-create" class="period-btn-edit" :title="$t('schoolBaseInfo.editLabel')" @click="changeSubjectEditStatus(index)" v-if="$access.ability('admin','schoolSetting-upd').validateAll" />-->
+                        <Icon type="md-close" @click="delSubject(index)" v-show="delSubStatus" />
                     </div>
                 </div>
             </div>
@@ -190,6 +166,8 @@
         },
         data() {
             return {
+                editSubStatus: false,
+                delSubStatus: false,
                 updateDays: false,
                 isSaveLoading: false,
                 delSemesterStatus: false,
@@ -215,25 +193,71 @@
                 subjectSelectList: [],
                 TERM_MAX_LENGTH: 3, // 学期数上限
                 campusStatus: false,
-                selectedCampusIndex: -1
+                selectedCampusIndex: -1,
+                width:[]
             }
         },
         methods: {
+            /**
+             * 动态设置input宽度
+             * */
+            getWidth(index) {
+                let width = 100
+                this.$nextTick(() => {
+                    let dom = document.getElementsByClassName('get-width' + index)
+                    console.log(dom)
+                    if (dom.length > 0) {
+                        width = dom[0].clientWidth + 25
+                        console.log(width)
+                    }
+                })
+
+                return width
+            },
+
+            /**
+             * 计算学期天数
+             * @param date1
+             * @param date2
+            */
+            countSemDays() {
+                if (this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length > 0) {
+                    let count = 365
+                    let index = 0
+                    let year = new Date().getFullYear()
+                    for (let i = 0; i < this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length; i++) {
+                        if (i == (this.schoolSetting.period[this.currentSchoolSysIndex].semesters.length - 1)) {
+                            index = i
+                            break
+                        } else {
+                            let sDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].day
+                            let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].day
+                            let d = this.getDays(sDate, eDate)
+                            count -= d
+                            this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i], 'days', d)
+
+                        }
+                    }
+                    this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[index], 'days', count)
+
+                    this.updated = false
+                }
+            },
             /**
              * 计算两个日期的天数
              * @param date1
              * @param date2
              */
-            getDays(date1 , date2){
+            getDays(date1, date2) {
                 var date1Str = date1.split("-");//将日期字符串分隔为数组,数组元素分别为年.月.日
                 //根据年 . 月 . 日的值创建Date对象
-                var date1Obj = new Date(date1Str[0],(date1Str[1]-1),date1Str[2]);
+                var date1Obj = new Date(date1Str[0], (date1Str[1] - 1), date1Str[2]);
                 var date2Str = date2.split("-");
-                var date2Obj = new Date(date2Str[0],(date2Str[1]-1),date2Str[2]);
+                var date2Obj = new Date(date2Str[0], (date2Str[1] - 1), date2Str[2]);
                 var t1 = date1Obj.getTime();
                 var t2 = date2Obj.getTime();
-                var dateTime = 1000*60*60*24; //每一天的毫秒数
-                var minusDays = Math.floor(((t2-t1)/dateTime));//计算出两个日期的天数差
+                var dateTime = 1000 * 60 * 60 * 24; //每一天的毫秒数
+                var minusDays = Math.floor(((t2 - t1) / dateTime));//计算出两个日期的天数差
                 var days = Math.abs(minusDays);//取绝对值
                 return days;
             },
@@ -281,7 +305,7 @@
                 if (this.$access.ability('admin', 'schoolSetting-upd').validateAll) {
                     this.campusStatus = true
                 }
-                
+
             },
             // 删除节点
             delGrade(index) {
@@ -314,6 +338,7 @@
                     this.currentSchoolSysIndex = 0
                     this.curSemIndex = 0
                     this.schoolSetting.period[this.currentSchoolSysIndex].semesters.splice(index, 1)
+                    this.countSemDays()
                 } else {
                     this.$Message.warning(this.$t('schoolBaseInfo.ssTips2'))
                 }
@@ -401,21 +426,21 @@
                                 break
                             } else {
                                 let sDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i].day
-                                let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i+1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i+1].day
+                                let eDate = year + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].month + '-' + this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i + 1].day
                                 let d = this.getDays(sDate, eDate)
                                 console.log(d)
                                 count -= d
                                 this.updateDays = true
-                                this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i],'days',d)
-                                
+                                this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[i], 'days', d)
+
                             }
                         }
                         this.updateDays = true
                         this.$set(this.schoolSetting.period[this.currentSchoolSysIndex].semesters[index], 'days', count)
-                        
+
                     }
                 }
-                
+
             },
             //保存数据
             saveData() {
@@ -427,6 +452,7 @@
                             this.$Message.success(this.$t('schoolBaseInfo.ssTips3'))
                             this.updated = false
                             this.isSaveLoading = false
+                            this.editSemIndex = -1
                         }
                     },
                     (err) => {
@@ -627,6 +653,7 @@
                         day: 26,
                         semesterCode: this.guid()
                     })
+                    this.countSemDays()
                 } else {
                     this.$Message.info(this.$t('schoolBaseInfo.ssTips7'))
                 }
@@ -756,17 +783,40 @@
                 } else {
                     return false
                 }
-            }
+            },
+            
         }
 
     }
 </script>
 
-<!-- 覆盖iview样式 -->
+<style lang="less" scoped>
+    @import './SystemSetting.less';
+</style>
 <style>
+    .second-arrow {
+        margin-left: -16px;
+    }
+
+    .color-check {
+        color: #08d0c8;
+    }
+
+    .color-uncheck {
+        color: #FF6C6B;
+    }
+
+    .bg-color-check {
+        background-color: #08d0c8 !important;
+    }
+
+    .bg-color-uncheck {
+        background-color: #FF6C6B !important;
+    }
+
     .semester-name-label .ivu-input[disabled] {
         font-size: 20px !important;
         font-weight: bold;
         color: white;
     }
-</style>
+</style>

+ 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"));
                 //错题关系表

+ 2 - 2
TEAMModelOS/Controllers/Analysis/ChangeController.cs

@@ -25,8 +25,8 @@ namespace TEAMModelOS.Controllers.Analysis
 
         private readonly IWebHostEnvironment _hostingEnvironment;
         public AzureCosmosFactory _cosmosrepository;
-        public IAzureBlobDBRepository azureBlobDB;
-        public ChangeController(IWebHostEnvironment hostingEnvironment, AzureCosmosFactory cosmosDBRepository, IAzureBlobDBRepository _azureBlobDB)
+        public AzureStorageFactory azureBlobDB;
+        public ChangeController(IWebHostEnvironment hostingEnvironment, AzureCosmosFactory cosmosDBRepository, AzureStorageFactory _azureBlobDB)
         {
             _hostingEnvironment = hostingEnvironment;
             _cosmosrepository = cosmosDBRepository;

+ 4 - 170
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
@@ -24,12 +23,12 @@ namespace TEAMModelOS.Controllers
     public class FileController:BaseController
     {
         private readonly AzureStorageFactory azureTableDBRepository;
-        private readonly IAzureBlobDBRepository _azureBlobDBRepository;
-        public FileController(AzureStorageFactory _azureTableDBRepository, IAzureBlobDBRepository azureBlobDBRepository 
+       // private readonly IAzureBlobDBRepository _azureBlobDBRepository;
+        public FileController(AzureStorageFactory _azureTableDBRepository 
         )
         {
             azureTableDBRepository = _azureTableDBRepository;
-            _azureBlobDBRepository = azureBlobDBRepository;
+           // _azureBlobDBRepository = azureBlobDBRepository;
         }
 
 
@@ -133,172 +132,7 @@ namespace TEAMModelOS.Controllers
             }
         }
 
-
-        /// <summary>
-        /// 获取某个文件夹下所以文件列表
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("GetBlobDirectory")]
-        public async Task<BaseResponse> GetBlobDirectory(JosnRequest<string> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            string azureBlobSAS = azureBlobSASDto.@params;
-            (string, string) a = BlobUrlString(azureBlobSAS);
-            string ContainerName = a.Item1;
-            string BlobName = a.Item2;
-            bool flg = IsBlobName(BlobName);
-            List<BlobFileDto> blobProperties = new List<BlobFileDto>();
-            if (flg)
-            {
-                string[] blobstring = BlobName.Split("/");
-                //string SAS = _azureBlobDBRepository.GetBlobSasUriRead(ContainerName, BlobName);
-                blobProperties =await _azureBlobDBRepository.GetBlobDirectory(ContainerName, blobstring[0]);
-
-            }
-            return responseBuilder.Data(blobProperties).build();
-        }
-
-
-
-        /// <summary>
-        /// 获取 blob文件 共享访问签名 (写,新增)
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("getBlobSAS")]
-        public async Task<BaseResponse> GetBlobSAS(JosnRequest<string> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            string BlobName = azureBlobSASDto.@params;
-            bool flg = IsBlobName(BlobName);
-            if (flg)
-            {
-                string SAS =await _azureBlobDBRepository.GetBlobSasUri(BlobName);
-                return responseBuilder.Data(SAS).build();
-            }
-            else {
-                return responseBuilder.Error(ResponseCode.PARAMS_ERROR, "文件名错误").build();
-            };
-        }
-
-        /// <summary>
-        /// 获取 blob文件 共享访问签名 (读)
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("getBlobSASRead")]
-        public async Task<BaseResponse> GetBlobSASRead(JosnRequest<string> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            string azureBlobSAS = azureBlobSASDto.@params;
-            (string, string) a = BlobUrlString(azureBlobSAS);
-            string ContainerName = a.Item1;
-            string BlobName = a.Item2;
-            bool flg = IsBlobName(BlobName);
-            if (flg)
-            {
-                var SAS =await _azureBlobDBRepository.GetBlobSasUriRead(ContainerName, BlobName);
-                return responseBuilder.Data(SAS).build();
-            }
-            else {
-                return responseBuilder.Error(ResponseCode.PARAMS_ERROR, "文件名错误").build();
-            };
-        }
-
-
-        /// <summary>
-        /// 获取 容器 共享访问签名 (写,新增)
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("getContainerSAS")]
-        public async Task<BaseResponse> GetContainerSAS(JosnRequest<string> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            (string, string, string) aaa =await _azureBlobDBRepository.GetContainerSasUri();
-            string Url = aaa.Item1;
-            string Container = aaa.Item2;
-            string SAS = aaa.Item3;
-            return responseBuilder.Data(new Dictionary<string,object> { 
-                { "Url",Url },
-                {"Container",Container },
-                { "SAS",SAS},
-            }).build();
-        }
-
-        /// <summary>
-        /// 获取 容器 共享访问签名 (读)
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("getContainerSASRead")]
-        public async Task<BaseResponse> GetContainerSASRead(JosnRequest<string> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            string azureBlobSAS = azureBlobSASDto.@params;
-            string ContainerName = ContainerUrlString(azureBlobSAS);
-            (string, string) aaa =await _azureBlobDBRepository.GetContainerSasUriRead(ContainerName);
-
-            string Url = aaa.Item1;
-            string SAS = aaa.Item2;
-
-            return responseBuilder.Data(new Dictionary<string, object> {
-                { "Url",Url },
-                { "SAS",SAS}
-            }).build();
-        }
-
-
-        /// <summary>
-        /// 创建共享访问策略 (删除权限)
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("CreateSharedAccessPolicy")]
-        public async Task<BaseResponse> CreateSharedAccessPolicyAsync(JosnRequest<AzureBlobSASDto> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            AzureBlobSASDto azureBlobSAS = azureBlobSASDto.@params;
-            bool flg = await _azureBlobDBRepository.CreateSharedAccessPolicyAsync( azureBlobSAS.PolicyName);
-            return responseBuilder.Data(flg).build();
-        }
-
-        /// <summary>
-        /// 删除共享访问策略
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("DeleteSharedAccessPolicyAsync")]
-        public async Task<BaseResponse> DeleteSharedAccessPolicyAsync(JosnRequest<AzureBlobSASDto> azureBlobSASDto)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            AzureBlobSASDto azureBlobSAS = azureBlobSASDto.@params;
-             await _azureBlobDBRepository.DeleteSharedAccessPolicyAsync( azureBlobSAS.PolicyName);
-            return responseBuilder.build();
-
-        }
-
-
-
-        /// <summary>
-        /// 删除blob
-        /// </summary>
-        /// <param name="azureBlobSASDto"></param>
-        /// <returns></returns>
-        [HttpPost("DeleteBlob")]
-        public async Task<BaseResponse> DeleteBlobAsync(JosnRequest<string> bloburl)
-        {
-            ResponseBuilder responseBuilder = new ResponseBuilder();
-            string URL = bloburl.@params;
-            if (!string.IsNullOrEmpty(URL))
-            {
-                await _azureBlobDBRepository.Deleteblob(URL);
-            }
-            return responseBuilder.build();
-
-        }
-
+            
         private static (string, string) BlobUrlString( string sasUrl) {
             sasUrl= sasUrl.Substring(8);
             string[] sasUrls = sasUrl.Split("/");

+ 8 - 6
TEAMModelOS/Controllers/Exam/ExamController.cs

@@ -8,9 +8,11 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
+using TEAMModelOS.Service.Models; 
 using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.Service.Services.Learn.Implements;
+using TEAMModelOS.SDK.Module.AzureServiceBus;
+
 namespace TEAMModelOS.Controllers
 {
     [Route("api/[controller]")]
@@ -18,12 +20,12 @@ namespace TEAMModelOS.Controllers
     public class ExamController : BaseController
     {
         private readonly AzureCosmosFactory cosmosDBV3Repository;
-        private readonly IServiceBusService _serviceBus;
-        public ExamController(AzureCosmosFactory _cosmosDBV3Repository , IServiceBusService serviceBus)
+        private readonly IAzureServiceBusService _serviceBus;
+        public ExamController(AzureCosmosFactory _cosmosDBV3Repository, IAzureServiceBusService serviceBus)
         {
-            _serviceBus = serviceBus;
+            
             cosmosDBV3Repository = _cosmosDBV3Repository;
-          
+            _serviceBus = serviceBus;
         }
 
         /// <summary>

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

@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
@@ -8,25 +8,25 @@ using TEAMModelOS.SDK.Context.Constant.Common;
 using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK;
 using TEAMModelOS.Service.Model.PowerPoint; 
-using TEAMModelOS.Service.Services.Exam.Implements;
-using TEAMModelOS.Service.Services.Exam.Interfaces;
-using TEAMModelOS.Service.Services.PowerPoint.Interface;
+using TEAMModelOS.Service.Services.Exam.Implements; 
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.Service;
+using TEAMModelOS.Service.Services.PowerPoint.Implement;
 
 namespace TEAMModelOS.Controllers
 {
     [Route("api/[controller]")]
     [ApiController]
     public class ImportExerciseController : BaseController
-    {
-        private readonly IImportExerciseService importExerciseService;
-        private readonly IHtmlAnalyzeService htmlAnalyzeService;
-        private readonly IHtexService htexService;
-
-        public ImportExerciseController(IImportExerciseService _importExerciseService, IHtmlAnalyzeService _htmlAnalyzeService , IHtexService _htexService)
+    { 
+        
+      //  private readonly IHtexService htexService;
+        private readonly AzureStorageFactory azureBlobDBRepository;
+        public ImportExerciseController(   AzureStorageFactory _azureBlobDBRepository)
         {
-            importExerciseService = _importExerciseService;
-            htmlAnalyzeService = _htmlAnalyzeService;
-            htexService = _htexService;
+            azureBlobDBRepository = _azureBlobDBRepository;
+
+              
         }
         /// <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>
@@ -57,7 +57,7 @@ namespace TEAMModelOS.Controllers
             {
                 return responseBuilder.Error(ResponseCode.FAILED, "type is not docx!").build();
             }
-           Dictionary<string, object> model = await importExerciseService.UploadWord(file);
+           Dictionary<string, object> model = await ImportExerciseService.UploadWord(azureBlobDBRepository, file);
 
             return responseBuilder.Data(model).build();
         }
@@ -74,7 +74,7 @@ namespace TEAMModelOS.Controllers
             bool flag = request.@params.TryGetValue("htmlString", out object htmlString);
             if (flag && htmlString != null && !string.IsNullOrEmpty(htmlString.ToString()))
             {
-                List<Service.Models.ItemInfo> exercises = htmlAnalyzeService.AnalyzeWordAsync(htmlString.ToString(), request.lang);
+                List<Service.Models.ItemInfo> exercises = HtmlAnalyzeService.AnalyzeWordAsync(htmlString.ToString(), request.lang);
                 return builder.Data(exercises).build();
             }
             else
@@ -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

+ 5 - 6
TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs

@@ -12,7 +12,7 @@ using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.DI;
 
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
+using TEAMModelOS.Service.Services.Implement;
 
 namespace TEAMModelOS.Controllers
 {
@@ -22,14 +22,13 @@ namespace TEAMModelOS.Controllers
     public class KnowledgeController : BaseController
     {
         private AzureStorageFactory _table;
-        private AzureCosmosFactory _cosmos;
-        private IKnowledgeService knowledgeService;
+        private AzureCosmosFactory _cosmos; 
 
-        public KnowledgeController(AzureStorageFactory table, AzureCosmosFactory cosmos, IKnowledgeService knowledgeService)
+        public KnowledgeController(AzureStorageFactory table, AzureCosmosFactory cosmos )
         {
             _table = table;
             _cosmos = cosmos;
-            this.knowledgeService = knowledgeService;
+          
         }
 
         /// <summary>
@@ -289,7 +288,7 @@ namespace TEAMModelOS.Controllers
             ResponseBuilder builder = ResponseBuilder.custom();
             if (request.@params.IsNotEmpty())
             {
-                List<Knowledge> ts = await knowledgeService.SaveOrUpdateKnowledge(request.@params);
+                List<Knowledge> ts = await KnowledgeService.SaveOrUpdateKnowledge(_cosmos,request.@params);
                 if (ts.Count > 0) builder.Data(ts).Extend(new Dictionary<string, object> { { "count", ts.Count } });
                 else {
                     return builder.Error(ResponseCode.FAILED, "失败!").build();

+ 4 - 6
TEAMModelOS/Controllers/Syllabus/ResourceController.cs

@@ -19,13 +19,11 @@ namespace TEAMModelOS.Controllers
     {
         private AzureStorageFactory _table;
         private AzureCosmosFactory _cosmos;
-        private readonly IAzureBlobDBRepository _azureBlobDBRepository;
-
-        public ResourceController(AzureStorageFactory table, AzureCosmosFactory cosmos, IAzureBlobDBRepository azureBlobDBRepository)
+        
+        public ResourceController(AzureStorageFactory table, AzureCosmosFactory cosmos)
         {
             _table = table;
             _cosmos = cosmos;
-            _azureBlobDBRepository = azureBlobDBRepository;
         }
 
         /// <summary>
@@ -120,12 +118,12 @@ namespace TEAMModelOS.Controllers
                 string blobUrl = syllabusResource.blobUrl;
                 if (!string.IsNullOrEmpty(blobUrl))
                 {
-                    await _azureBlobDBRepository.Deleteblob(blobUrl);
+                  //  await _azureBlobDBRepository.Deleteblob(blobUrl);
                 }
                 string compressUrl = syllabusResource.compressUrl;
                 if (!string.IsNullOrEmpty(compressUrl))
                 {
-                    await _azureBlobDBRepository.Deleteblob(compressUrl);
+                   // await _azureBlobDBRepository.Deleteblob(compressUrl);
                 }
             }
 

+ 9 - 11
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -8,11 +8,9 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using System;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
-using System.Linq;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using TEAMModelOS.Service.Services.Interface;
+using System.Linq; 
 using TEAMModelOS.Service.Models;
+using TEAMModelOS.Service.Services.Implement;
 
 namespace TEAMModelOS.Controllers
 {
@@ -22,12 +20,12 @@ namespace TEAMModelOS.Controllers
     public class SyllabusController : BaseController
     {
         private AzureCosmosFactory azureCosmosDBRepository;
-        private ISyllabusService syllabusService;
+         
 
-        public SyllabusController(AzureCosmosFactory azureCosmosDBRepository, ISyllabusService syllabusService)
+        public SyllabusController(AzureCosmosFactory azureCosmosDBRepository )
         {
             this.azureCosmosDBRepository = azureCosmosDBRepository;
-            this.syllabusService = syllabusService;
+           
         }
 
 
@@ -40,7 +38,7 @@ namespace TEAMModelOS.Controllers
         public async Task<BaseResponse> SaveOrUpdateAsTree(JosnRequest<List<SyllabusTree>> request)
         {
             ResponseBuilder builder = ResponseBuilder.custom();
-            List<SyllabusTree> treess = await syllabusService.SaveOrUpdateAsTree(request.@params);
+            List<SyllabusTree> treess = await SyllabusService.SaveOrUpdateAsTree(azureCosmosDBRepository,request.@params);
             return builder.Data(treess).build();
         }
 
@@ -54,7 +52,7 @@ namespace TEAMModelOS.Controllers
         public async Task<BaseResponse> SaveOrUpdateAsNodes(JosnRequest<List<SyllabusNode>> request)
         {
             ResponseBuilder builder = ResponseBuilder.custom();
-            List<Syllabus> syllabuses = await syllabusService.SaveOrUpdateAsNodes(request.@params);
+            List<Syllabus> syllabuses = await SyllabusService.SaveOrUpdateAsNodes(azureCosmosDBRepository, request.@params);
             if (syllabuses.IsNotEmpty()) return builder.Data(request.@params).build();
             else return builder.Data(syllabuses).build();
         }
@@ -70,7 +68,7 @@ namespace TEAMModelOS.Controllers
             ResponseBuilder builder = ResponseBuilder.custom();
             if (request.@params.Keys.Count > 0)
             {
-                List<Syllabus> syllabuses = await syllabusService.DeleteSyllabus(request.@params);
+                List<Syllabus> syllabuses = await SyllabusService.DeleteSyllabus(azureCosmosDBRepository ,request.@params);
 
                 if (syllabuses.IsNotEmpty())
                 {
@@ -115,7 +113,7 @@ namespace TEAMModelOS.Controllers
         public async Task<BaseResponse> Find(JosnRequest<Dictionary<string, object>> request)
         {
             ResponseBuilder builder = ResponseBuilder.custom();
-            List<SyllabusTree> treess = await syllabusService.Find(request.@params);
+            List<SyllabusTree> treess = await SyllabusService.Find(azureCosmosDBRepository, request.@params);
             return builder.Data(treess).build();
         }
 

+ 5 - 7
TEAMModelOS/Controllers/Syllabus/VolumeController.cs

@@ -9,11 +9,10 @@ using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Extension.SnowFlake;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Controllers;
-using TEAMModelOS.Service.Services.Interface;
+using TEAMModelOS.SDK.DI; 
 using TEAMModelOS.Service.Models;
 using Org.BouncyCastle.Ocsp;
+using TEAMModelOS.Service.Services.Implement;
 
 namespace TEAMModelOS.Controllers
 {
@@ -22,12 +21,11 @@ namespace TEAMModelOS.Controllers
     public class VolumeController : BaseController
     {
         private AzureCosmosFactory azureCosmosDBRepository;
-        private IVolumeService volumeService;
 
-        public VolumeController(AzureCosmosFactory azureCosmosDBRepository, IVolumeService volumeService)
+        public VolumeController(AzureCosmosFactory azureCosmosDBRepository )
         {
             this.azureCosmosDBRepository = azureCosmosDBRepository;
-            this.volumeService = volumeService;
+            
         }
 
 
@@ -40,7 +38,7 @@ namespace TEAMModelOS.Controllers
         public async Task<BaseResponse> Upsert(JosnRequest<Volume> request)
         {
             ResponseBuilder builder = ResponseBuilder.custom();
-            List<Volume> volume = await volumeService.SaveOrUpdateVolume(request.@params);
+            List<Volume> volume = await VolumeService.SaveOrUpdateVolume(azureCosmosDBRepository,request.@params);
             return builder.Data(volume.IsEmpty() ? null : volume[0]).build();
         }
 

+ 4 - 5
TEAMModelOS/Controllers/Task/HomeworkController.cs

@@ -17,10 +17,9 @@ using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Module.AzureServiceBus;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Learn;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
+using TEAMModelOS.Service.Models; 
 using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.Service.Services.Learn.Implements;
 
 namespace TEAMModelOS.Controllers.Learn
 {
@@ -33,8 +32,8 @@ namespace TEAMModelOS.Controllers.Learn
     {
         private readonly AzureCosmosFactory _cosmos;
        
-        private readonly IServiceBusService _serviceBus;
-        public HomeworkController(AzureCosmosFactory cosmos , IServiceBusService serviceBus  )
+        private readonly IAzureServiceBusService _serviceBus;
+        public HomeworkController(AzureCosmosFactory cosmos , IAzureServiceBusService serviceBus  )
         {
             _cosmos = cosmos;
             _serviceBus = serviceBus;

+ 7 - 5
TEAMModelOS/Controllers/Task/LearnController.cs

@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,9 +9,11 @@ using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Helper.Common.ValidateHelper;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Models;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
+using TEAMModelOS.Models; 
 using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.SDK.Module.AzureServiceBus;
+using TEAMModelOS.Service.Services.Learn.Implements;
+
 namespace TEAMModelOS.Controllers.Learn
 {
     /// <summary>
@@ -22,8 +24,8 @@ namespace TEAMModelOS.Controllers.Learn
     public class LearnController: BaseController
     {
         private readonly AzureCosmosFactory cosmosDBV3Repository;
-        private readonly IServiceBusService _serviceBus;
-        public LearnController(AzureCosmosFactory _cosmosDBV3Repository, IServiceBusService serviceBus)
+        private readonly IAzureServiceBusService _serviceBus;
+        public LearnController(AzureCosmosFactory _cosmosDBV3Repository, IAzureServiceBusService serviceBus)
         {
             _serviceBus = serviceBus;
             cosmosDBV3Repository = _cosmosDBV3Repository;

+ 7 - 5
TEAMModelOS/Controllers/Task/SurveyController.cs

@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -8,9 +8,11 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
+using TEAMModelOS.Service.Models; 
 using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.SDK.Module.AzureServiceBus;
+using TEAMModelOS.Service.Services.Learn.Implements;
+
 namespace TEAMModelOS.Controllers
 {
     /// <summary>
@@ -22,8 +24,8 @@ namespace TEAMModelOS.Controllers
     {
         private readonly AzureCosmosFactory azureCosmosDBV3Repository;
  
-        private readonly IServiceBusService _serviceBus;
-        public SurveyController(AzureCosmosFactory _azureCosmosDBV3Repository,  IServiceBusService serviceBus)
+        private readonly IAzureServiceBusService _serviceBus;
+        public SurveyController(AzureCosmosFactory _azureCosmosDBV3Repository, IAzureServiceBusService serviceBus)
         {
             //  _timerWorkService = timerWorkService;
             _serviceBus = serviceBus;

+ 6 - 4
TEAMModelOS/Controllers/Task/VoteController.cs

@@ -12,9 +12,11 @@ using TEAMModelOS.SDK.Context.Exception;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
+using TEAMModelOS.Service.Models; 
 using TEAMModelOS.SDK.Context.Constant.Common;
+using TEAMModelOS.SDK.Module.AzureServiceBus;
+using TEAMModelOS.Service.Services.Learn.Implements;
+
 namespace TEAMModelOS.Controllers.Learn
 {
     /// <summary>
@@ -27,8 +29,8 @@ namespace TEAMModelOS.Controllers.Learn
 
         private readonly AzureCosmosFactory _cosmos;
        
-        private readonly IServiceBusService _serviceBus;
-        public VoteController(AzureCosmosFactory cosmos, IServiceBusService serviceBus)
+        private readonly IAzureServiceBusService _serviceBus;
+        public VoteController(AzureCosmosFactory cosmos, IAzureServiceBusService serviceBus)
         {
             _cosmos = cosmos;
             _serviceBus = serviceBus;

TEAMModelOS/Models/AzureBlobSASDto.cs → TEAMModelOS/Dto/AzureBlobSASDto.cs


TEAMModelOS/Models/BlockPointDto.cs → TEAMModelOS/Dto/BlockPointDto.cs


TEAMModelOS/Models/CommentsDto.cs → TEAMModelOS/Dto/CommentsDto.cs


TEAMModelOS/Models/CommonQuery.cs → TEAMModelOS/Dto/CommonQuery.cs


TEAMModelOS/Models/CoursePlanDto.cs → TEAMModelOS/Dto/CoursePlanDto.cs


TEAMModelOS/Models/HomeWorkCommentDto.cs → TEAMModelOS/Dto/HomeWorkCommentDto.cs


TEAMModelOS/Models/HomeWorkDto.cs → TEAMModelOS/Dto/HomeWorkDto.cs


TEAMModelOS/Models/HomeWorkFindDto.cs → TEAMModelOS/Dto/HomeWorkFindDto.cs


TEAMModelOS/Models/HomeWorkScoringDto.cs → TEAMModelOS/Dto/HomeWorkScoringDto.cs


TEAMModelOS/Models/KnowledgeDto.cs → TEAMModelOS/Dto/KnowledgeDto.cs


TEAMModelOS/Models/PointDto.cs → TEAMModelOS/Dto/PointDto.cs


TEAMModelOS/Models/SurveyDto.cs → TEAMModelOS/Dto/SurveyDto.cs


TEAMModelOS/Models/VoteDto.cs → TEAMModelOS/Dto/VoteDto.cs


TEAMModelOS/Models/VoteStudentDto.cs → TEAMModelOS/Dto/VoteStudentDto.cs


+ 6 - 11
TEAMModelOS.Service/Services/Analysis/Implements/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)
             {

+ 12 - 13
TEAMModelOS.Service/Services/Evaluation/Implements/HtmlAnalyzeService.cs

@@ -1,4 +1,4 @@
-using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Packaging;
 using HtmlAgilityPack;
 using Microsoft.AspNetCore.Http;
 using OpenXmlPowerTools;
@@ -16,10 +16,9 @@ using TEAMModelOS.SDK.Helper.Common.StringHelper;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.Service.Model.PowerPoint;
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Exam.Interfaces;
-namespace TEAMModelOS.Service.Services.Exam.Implements
+namespace TEAMModelOS.Service
 {
-   public class HtmlAnalyzeService : IHtmlAnalyzeService
+   public class HtmlAnalyzeService  
     {
         private static string SummaryTag = "【题文】";
         private static string AnswerTag = "【答案】";
@@ -35,7 +34,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             { "Single", "【单选题】|【结束】" }, { "Multiple", "【多选题】|【结束】" },
             { "Judge", "【判断题】|【结束】" }, { "Complete", "【填空题】|【结束】" },
             { "Subjective", "【问答题】|【结束】" } , { "Compose", "【综合题】|【完结】" }};
-        public List<Models.ItemInfo> AnalyzeWordAsync(string html, string Lang)
+        public static List<Models.ItemInfo> AnalyzeWordAsync(string html, string Lang)
         { 
             //去除class 以及span标签"
             string classpattern = "class=\"([^\"]*)\"";
@@ -80,31 +79,31 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return tests;
         }
 
-        private List<Models.ItemInfo> SingleConvert(string TypeKey, List<string> list)
+        private static List<Models.ItemInfo> SingleConvert(string TypeKey, List<string> list)
         {
             List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
         }
 
-        private List<Models.ItemInfo> MultipleConvert(string TypeKey, List<string> list)
+        private static List<Models.ItemInfo> MultipleConvert(string TypeKey, List<string> list)
         {
             List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
         }
 
-        private List<Models.ItemInfo> JudgeConvert(string TypeKey, List<string> list)
+        private static List<Models.ItemInfo> JudgeConvert(string TypeKey, List<string> list)
         {
             List<Models.ItemInfo> testInfos = OptionProcess(TypeKey, list);
             return testInfos;
         }
 
 
-        private List<Models.ItemInfo> CompleteConvert(string TypeKey, List<string> list)
+        private static List<Models.ItemInfo> CompleteConvert(string TypeKey, List<string> list)
         {
             List<Models.ItemInfo> testInfos = CompleteProcess(TypeKey, list);
             return testInfos;
         }
-        private List<Models.ItemInfo> CompleteProcess(string TypeKey, List<string> tests)
+        private static List<Models.ItemInfo> CompleteProcess(string TypeKey, List<string> tests)
         {
             //List<string> tests = ConvertTest(testHtml);
             List<Models.ItemInfo> testInfos = ConvertTestInfo(tests, TypeKey);
@@ -155,7 +154,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return testInfos;
         }
 
-        private List<Models.ItemInfo> OptionProcess(string typeKey, List<string> list)
+        private static List<Models.ItemInfo> OptionProcess(string typeKey, List<string> list)
         {
             string[] optionsKeys = Options.Select(s => s.ToString()).ToArray();
             List<Models.ItemInfo> testInfos = ConvertTestInfo(list, typeKey);
@@ -221,7 +220,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
         }
 
 
-        private List<Models.ItemInfo> SubjectiveConvert(string TypeKey, List<string> tests)
+        private static List<Models.ItemInfo> SubjectiveConvert(string TypeKey, List<string> tests)
         {
             // List<string> tests = ConvertTest(testHtml);
             List<Models.ItemInfo> testInfos = ConvertTestInfo(tests, TypeKey);
@@ -243,7 +242,7 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             return testInfos;
         }
 
-        private List<Models.ItemInfo> ComposeConvert(string TypeKey, List<string> list, string Lang)
+        private static List<Models.ItemInfo> ComposeConvert(string TypeKey, List<string> list, string Lang)
         {
             List<Models.ItemInfo> exerciseDtos = new List<Models.ItemInfo>();
             foreach (string html in list)

+ 21 - 20
TEAMModelOS.Service/Services/Evaluation/Implements/ImportExerciseService.cs

@@ -22,30 +22,28 @@ using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Module.AzureBlob.Container;
 using TEAMModelOS.SDK.Module.AzureBlob.Interfaces;
 
-using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Exam.Interfaces;
 
 namespace TEAMModelOS.Service.Services.Exam.Implements
 {
-    public class ImportExerciseService : IImportExerciseService
+    public static class ImportExerciseService 
     {
       
        
-        private readonly IAzureBlobDBRepository azureBlobDBRepository;
-        private readonly AzureStorageFactory azureTableDBRepository;
-        public ImportExerciseService(IAzureBlobDBRepository _azureBlobDBRepository, AzureStorageFactory _azureTableDBRepository)
-        {
-            azureBlobDBRepository = _azureBlobDBRepository;
-            azureTableDBRepository = _azureTableDBRepository;
-        }
-        public async Task<Dictionary<string, object>> UploadWord(IFormFile file)
+     //   private readonly IAzureBlobDBRepository azureBlobDBRepository;
+       // private readonly AzureStorageFactory azureTableDBRepository;
+        //public ImportExerciseService(IAzureBlobDBRepository _azureBlobDBRepository, AzureStorageFactory _azureTableDBRepository)
+        //{
+        //   // azureBlobDBRepository = _azureBlobDBRepository;
+        //    azureTableDBRepository = _azureTableDBRepository;
+        //}
+        public static async Task<Dictionary<string, object>> UploadWord(this AzureStorageFactory azureBlobDBRepository, IFormFile file)
         {
 
             Dictionary<string, object> resdict = new Dictionary<string, object>();
             string shaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
             long length = file.Length;
             Dictionary<string, object> dict = new Dictionary<string, object> { { "Sha1Code", shaCode } };
-            List<AzureBlobModel> models = await azureTableDBRepository.FindListByDict<AzureBlobModel>(dict);
+            List<AzureBlobModel> models = await azureBlobDBRepository.FindListByDict<AzureBlobModel>(dict);
 
             //if (models.IsNotEmpty())
             //{
@@ -61,15 +59,15 @@ namespace TEAMModelOS.Service.Services.Exam.Implements
             //    await file.CopyToAsync(stream);
             //}
             var htmlInfo = ConvertDocxToHtml(file, folder);
-            AzureBlobModel model = await azureBlobDBRepository.UploadTextByFolder(htmlInfo.htmlString, "",htmlInfo.blobPath, "exercise",false);
+            AzureBlobModel model = await AzureStorageBlobExtensions.UploadFileByContainer(azureBlobDBRepository, "teammodelos", htmlInfo.htmlString, "exercise", htmlInfo.blobPath, false);
             model.Sha1Code = shaCode;
-            await azureTableDBRepository.Save<AzureBlobModel>(model);
+            await azureBlobDBRepository.Save<AzureBlobModel>(model);
            // FileHelper.DeleteDirAndFiles(BaseConfigModel.ContentRootPath + "/Upload");
             resdict.Add("HtmlString", htmlInfo.htmlString);
             resdict.Add("Sha1Code", shaCode);
             return resdict;
         }
-        public dynamic ConvertDocxToHtml(IFormFile file, string folder)
+        public static dynamic ConvertDocxToHtml(IFormFile file, string folder)
         {
             string FolderName =  DateTime.Now.ToString("yyyyMMdd")+"/"+ folder;
             byte[] byteArray = new byte[file.OpenReadStream().Length];
@@ -159,17 +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);
+                          //  AzureBlobModel model = azureBlobDBRepository.UploadFileByFolderNAsyn(stream, FolderName, filename, "exercise", false);
                             #endregion
                             XElement img = new XElement(Xhtml.img,
-                                    new XAttribute(NoNamespace.src, model.BlobUrl),
+                                 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;
                         }
                     };

+ 5 - 9
TEAMModelOS.Service/Services/Learn/Implements/ServiceBusService.cs

@@ -1,4 +1,4 @@
-using Microsoft.Azure.ServiceBus;
+using Microsoft.Azure.ServiceBus;
 using System;
 using System.Collections.Generic;
 using System.Reflection;
@@ -10,20 +10,16 @@ using TEAMModelOS.SDK.Helper.Common.DateTimeHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Module.AzureServiceBus;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
 
 namespace TEAMModelOS.Service.Services.Learn.Implements
 {
     
-    public class ServiceBusService : IServiceBusService
+    public static class ServiceBusService  
     {
-        private readonly IAzureServiceBusService _serviceBus;
-        public ServiceBusService(IAzureServiceBusService azureServiceBus)
-        {
-            _serviceBus = azureServiceBus;
-        }        
+       // private readonly IAzureServiceBusService _serviceBus;
+                
 
-        public async Task<long> SendMessage<T>(string TopicName, string id,string pk, long startTime, int status, string msgId)
+        public static async Task<long> SendMessage<T>(this IAzureServiceBusService _serviceBus ,string TopicName, string id,string pk, long startTime, int status, string msgId)
         {
             ITopicClient topicClient = _serviceBus.GetTopClient(TopicName).topicClient;
             //设定开始时间

+ 59 - 57
TEAMModelOS.Service/Services/PowerPoint/Implement/HtexService.cs

@@ -19,52 +19,50 @@ 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.Service.Models;
-using TEAMModelOS.Service.Services.Exam.Interfaces;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
+using TEAMModelOS.Service;
+using TEAMModelOS.SDK.DI;
 
 namespace TEAMModelOS.Service.Services.PowerPoint.Implement
 {
-    public class HtexService : IHtexService
+    public static class HtexService  
     {
-        private string fileShaCode { get; set; }
-        private Dictionary<string, string> slideLayoutClrOvride { get; set; }
+        private static string fileShaCode { get; set; }
+        private static  Dictionary<string, string> slideLayoutClrOvride { get; set; }
         private const int degree = 4;
         //private Dictionary<string, Dictionary<string, string>> styleTable = new Dictionary<string, Dictionary<string, string>>();
         private const double px96 = 96.00, px72 = 72.00, px914400 = 914400.00, px12700 = 12700.00;
         private const double rot60000 = 60000.00;
-        public readonly IAzureBlobDBRepository azureBlobDBRepository;
-        public readonly IHtmlAnalyzeService htmlAnalyzeService;
-        public HtexService(IAzureBlobDBRepository _azureBlobDBRepository, IHtmlAnalyzeService _htmlAnalyzeService)
-        {
-            azureBlobDBRepository = _azureBlobDBRepository;
-            htmlAnalyzeService = _htmlAnalyzeService;
-        }
-        public async Task<Htex> AnalyzeHtmlToHtex(string htmlString, string Lang)
+      //  public readonly IHtmlAnalyzeService htmlAnalyzeService;
+        //public HtexService(IAzureBlobDBRepository _azureBlobDBRepository)
+        //{
+        //    azureBlobDBRepository = _azureBlobDBRepository;
+        //   // htmlAnalyzeService = _htmlAnalyzeService;
+        //}
+        public static async Task<Htex> AnalyzeHtmlToHtex(this AzureStorageFactory azureBlobDBRepository, string htmlString, string Lang)
         {
             Htex htex = new Htex();
-            List<Models.ItemInfo> items = htmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
+            List<Models.ItemInfo> items = HtmlAnalyzeService.AnalyzeWordAsync(htmlString, Lang);
             string sha=  ShaHashHelper.GetSHA1(htmlString);
             int index = 0;
             foreach (Models.ItemInfo item in items)
             {
                 Slide slide = new Slide { exercise = item, index = index, source = 2, flag = 2 };
                 index++;
-                AzureBlobModel model =  await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), sha, index+".json","htex",false);
+                AzureBlobModel model =  await azureBlobDBRepository.UploadFileByContainer("teammodelos", slide.ToJson(), "htex/"+sha, index+".json",false);
                 htex.slides.Add(model.BlobUrl);
             }
             htex.page = items.Count;
             return htex;
         }
-        public async Task<Dictionary<string, object>> LoadDoc(IFormFile file)
+        public static async Task<Dictionary<string, object>> LoadDoc(this AzureStorageFactory azureBlobDBRepository, IFormFile file)
         {
             Dictionary<string, object> resdict = new Dictionary<string, object>();
 
             if (FileType.GetExtention(file.FileName).ToLower().Equals("pptx"))
             {
                 
-                return await ConvertPPTX(file, resdict);
+                return await ConvertPPTX(azureBlobDBRepository, file, resdict);
             }
             else if (FileType.GetExtention(file.FileName).ToLower().Equals("pdf"))
             {
@@ -84,7 +82,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                 sr.Close();
                 xmlDocument.LoadXml(builder.ToString());
                 string shaCode = fileShaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
-                var rslt_ary = await ProcessPPTX(xmlDocument, shaCode);
+                var rslt_ary = await ProcessPPTX(azureBlobDBRepository, xmlDocument, shaCode);
                 //TODO
                 Dictionary<string, object> data = new Dictionary<string, object> { { "htexl", rslt_ary } };
                 return data;
@@ -95,7 +93,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        public async Task<Dictionary<string, object>> ConvertPPTX(IFormFile file, Dictionary<string, object> resdict)
+        public static async Task<Dictionary<string, object>> ConvertPPTX(this AzureStorageFactory azureBlobDBRepository, IFormFile file, Dictionary<string, object> resdict)
         {
             string shaCode = fileShaCode = ShaHashHelper.GetSHA1(file.OpenReadStream());
 
@@ -109,7 +107,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.LoadXml(xdoc.ToString());
 
-            var rslt_ary = await ProcessPPTX(xmlDocument, shaCode);
+            var rslt_ary = await ProcessPPTX(azureBlobDBRepository, xmlDocument, shaCode);
             //TODO
             Dictionary<string, object> data = new Dictionary<string, object> { { "pptx",rslt_ary} };
             return data;
@@ -121,7 +119,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// <param name="xdoc"></param>
         /// <param name="shaCode"></param>
         /// <returns></returns>
-        public async Task<Htex> ProcessPPTX(XmlDocument xdoc, string shaCode)
+        public static async Task<Htex> ProcessPPTX(this AzureStorageFactory azureBlobDBRepository, XmlDocument xdoc, string shaCode)
         {
             Htex pptx = new Htex();
           //  List<Dictionary<string, object>> post_ary = new List<Dictionary<string, object>>();
@@ -156,7 +154,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                
                 slide.source = 1;
                 slide.flag = 1;
-                AzureBlobModel model = await azureBlobDBRepository.UploadTextByFolder(slide.ToJson(), shaCode, (i + 1) + ".json", "htex", 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 } });
@@ -185,7 +183,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         //    return cssText;
         //}
 
-        public async Task<Slide> ProcessSingleSlide(XmlDocument xdoc, XmlNode xnode, string sldFileName, int index, dynamic slideSize, XmlNode themeContent, XmlNode tableStyles,Htex pptx)
+        public static async Task<Slide> ProcessSingleSlide(XmlDocument xdoc, XmlNode xnode, string sldFileName, int index, dynamic slideSize, XmlNode themeContent, XmlNode tableStyles,Htex pptx)
         {
 
             var resName = sldFileName.Replace("slides/slide", "slides/_rels/slide") + ".rels";
@@ -342,7 +340,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return slide;
         }
 
-        public async Task ProcessNodesInSlide(List<Model.PowerPoint.Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
+        public static async Task ProcessNodesInSlide(List<Model.PowerPoint.Item> items, string nodeKey, XmlNode node, int order, WarpObj warpObj)
         {
             //  string result = "";
 
@@ -399,7 +397,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        public async Task ProcessGroupSpNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
+        public static async Task ProcessGroupSpNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
         {
             var factor = 1.00 * px96 / px914400;
             var xfrmNode = node.GetTextByPath("p:grpSpPr/a:xfrm");
@@ -435,7 +433,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             //return result;
         }
 
-        public async Task ProcessGraphicFrameNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
+        public static async Task ProcessGraphicFrameNode(List<Model.PowerPoint.Item> items, XmlNode node, int order, WarpObj warpObj)
         {
         //    var result = "";
             var graphicTypeUri = node.GetTextByPath("a:graphic/a:graphicData/@uri");
@@ -460,7 +458,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             //return result;
         }
 
-        public async Task  GenDiagram(List<Model.PowerPoint.Item> items,  XmlNode node, int order, WarpObj warpObj)
+        public static async Task  GenDiagram(List<Model.PowerPoint.Item> items,  XmlNode node, int order, WarpObj warpObj)
         {
             var xfrmNode = node.GetTextByPath("p:xfrm");
             var dgmRelIds = node.GetTextByPath("a:graphic/a:graphicData/dgm:relIds");
@@ -511,7 +509,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        public  Chart  GenChart(XmlNode node,int order , WarpObj warpObj)
+        public static  Chart  GenChart(XmlNode node,int order , WarpObj warpObj)
         {
             Chart chart = new Chart { index=order,type= "Chart" };
             var slideXfrmNode = node.GetTextByPath("p:xfrm");
@@ -770,7 +768,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return chart;
         }
 
-        public List<Dictionary<string,object>> ExtractChartData(XmlNodeList nodes) {
+        public static List<Dictionary<string,object>> ExtractChartData(XmlNodeList nodes) {
 
             if (nodes != null) {
                 List<Dictionary<string, object>> listDict = new List<Dictionary<string, object>>();
@@ -841,7 +839,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return null;
         }
 
-        public async Task<Table> GenTable(XmlNode node, int order, WarpObj warpObj)
+        public static async Task<Table> GenTable(XmlNode node, int order, WarpObj warpObj)
         {
             Table table = new Table();
             table.index = order;
@@ -1125,7 +1123,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
             return table;
         }
-       private List<Border> GetTableBorders(XmlNode node, WarpObj warpObj) {
+       private static List<Border> GetTableBorders(XmlNode node, WarpObj warpObj) {
             List<Border> borders = new List<Border>();
             if (node.GetTextByPath("a:bottom") != null) {
                 string xml= "<p:spPr><a:ln>"+  node.GetTextByPath("a:bottom/a:ln").InnerXml + "</p:spPr></a:ln>";
@@ -1173,14 +1171,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return borders;
         }
 
-        public async Task<Model.PowerPoint.Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
+        public static async Task<Model.PowerPoint.Item> ProcessCxnSpNode(XmlNode node, int order, WarpObj warpObj)
         {
             var id = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@id");
             var name = node.GetTextByPath("p:nvCxnSpPr/p:cNvPr/@name");
             return await GenShape("CxnSp", node, null, null, id, name, null, null, order, warpObj);
         }
 
-        public async Task<Model.PowerPoint.Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
+        public static async Task<Model.PowerPoint.Item> ProcessSpNode(XmlNode node, int order, WarpObj warpObj)
         {
 
             /*
@@ -1222,7 +1220,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return item;
         }
 
-        public async Task<Model.PowerPoint.Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
+        public static async Task<Model.PowerPoint.Item> GenShape(string ShapeType, XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode id, XmlNode name, XmlNode idx, XmlNode type, int order, WarpObj warpObj)
         {
             var xfrmList = "p:spPr/a:xfrm";
             var slideXfrmNode = node.GetTextByPath(xfrmList);
@@ -1588,7 +1586,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
              
         }
 
-        private async Task<List<Paragraph>> GenTextBody(XmlNode textBodyNode, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
+        private static async Task<List<Paragraph>> GenTextBody(XmlNode textBodyNode, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
         {
             List<Paragraph> paragraphs = new List<Paragraph>();
             var slideMasterTextStyles = warpObj.slideMasterTextStyles;
@@ -1659,7 +1657,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return paragraphs;
         }
 
-        private Text GenSpanElement(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
+        private static Text GenSpanElement(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
         {
             string text;
             var slideMasterTextStyles = warpObj.slideMasterTextStyles;
@@ -1742,7 +1740,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             };
         }
 
-        private string GetTextVerticalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
+        private static string GetTextVerticalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
         {
             var baseline = node.GetTextByPath("a:rPr/@baseline");
             if (baseline != null)
@@ -1755,7 +1753,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        private string GetTextHorizontalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
+        private static string GetTextHorizontalAlign(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
         {
             var getAlgn = node.GetTextByPath("a:pPr/@algn");
             var align = "initial";
@@ -1786,7 +1784,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return align;
         }
 
-        private string GetFontDecoration(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
+        private static string GetFontDecoration(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
         {
             if (node.GetTextByPath("a:rPr") != null)
             {
@@ -1817,7 +1815,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        private string GetFontItalic(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
+        private static string GetFontItalic(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
         {
             var FontBold = node.GetTextByPath("a:rPr/@i");
             if (FontBold != null)
@@ -1837,7 +1835,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        private string GetFontBold(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
+        private static string GetFontBold(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles)
         {
             var FontBold = node.GetTextByPath("a:rPr/@b");
             if (FontBold != null)
@@ -1857,7 +1855,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        private string GetFontType(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles, XmlNode themeContent)
+        private static string GetFontType(XmlNode node, XmlNode type, XmlNode slideMasterTextStyles, XmlNode themeContent)
         {
             string typeface = "inherit";
             XmlNode typefaceNode = node.GetTextByPath("a:rPr/a:latin/@typeface");
@@ -1885,7 +1883,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return typeface;
         }
 
-        private async Task<BuChar> GenBuChar(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
+        private static async Task<BuChar> GenBuChar(XmlNode node, XmlNode spNode, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, WarpObj warpObj)
         {
             var sldMstrTxtStyles = warpObj.slideMasterTextStyles;
             var slideMasterContent = warpObj.slideMasterContent;
@@ -2215,7 +2213,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return BuChar;
         }
 
-        private double GetFontSize(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, XmlNode slideMasterTextStyles)
+        private static double GetFontSize(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode, XmlNode type, XmlNode slideMasterTextStyles)
         {
             double fontSize = 0;
             if (node.GetTextByPath("a:rPr/@sz") != null)
@@ -2267,7 +2265,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return fontSize;
         }
 
-        private dynamic GetFontColorPr(XmlNode node, XmlNode spNode, XmlNode type, XmlNode sldMstrTxtStyles, XmlNode slideMasterContent, XmlNode themeContent)
+        private static dynamic GetFontColorPr(XmlNode node, XmlNode spNode, XmlNode type, XmlNode sldMstrTxtStyles, XmlNode slideMasterContent, XmlNode themeContent)
         {
             var rPrNode = node.GetTextByPath("a:rPr");
             string filTyp, textBordr;
@@ -2328,7 +2326,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
             return new { color, textBordr };
         }
-        public string GetVerticalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
+        public static string GetVerticalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
         {
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(node.OuterXml);
@@ -2356,7 +2354,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
 
-        public string GetWritingMode(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
+        public static string GetWritingMode(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode)
         {
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(node.OuterXml);
@@ -2384,7 +2382,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             }
         }
          
-        public string GetHorizontalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode,
+        public static string GetHorizontalAlign(XmlNode node, XmlNode slideLayoutSpNode, XmlNode slideMasterSpNode,
             XmlNode typeNode, XmlNode slideMasterTextStyles)
         {
             XmlDocument doc = new XmlDocument();
@@ -2452,7 +2450,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         /// <param name="index"></param>
         /// <param name="warpObj"></param>
         /// <returns></returns>
-        public async Task<Fill> GetSlideBackgroundFill(XmlNode slideContent, int index, WarpObj warpObj)
+        public static async Task<Fill> GetSlideBackgroundFill(XmlNode slideContent, int index, WarpObj warpObj)
         {
             var bgPr = slideContent.GetTextByPath("pkg:xmlData/p:sld/p:cSld/p:bg/p:bgPr");
             var bgRef = slideContent.GetTextByPath("pkg:xmlData/p:sld/p:cSld/p:bg/p:bgRef");
@@ -2727,7 +2725,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
 
 
 
-        public async Task<Fill> GetPicFill(string type, XmlNode node, WarpObj warpObj)
+        public static async Task<Fill> GetPicFill(string type, XmlNode node, WarpObj warpObj)
         {
 
             //Need to test/////////////////////////////////////////////
@@ -2804,7 +2802,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         }
 
 
-        public async Task<Fill> GetShapeFill(XmlNode node, WarpObj warpObj)
+        public static async Task<Fill> GetShapeFill(XmlNode node, WarpObj warpObj)
         {
 
             // 1. presentationML
@@ -2964,7 +2962,7 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
         }
 
 
-        public async Task<AzureBlobModel> GetThumbnailModel(XmlDocument xdoc, string shaCode)
+        public static async Task<AzureBlobModel> GetThumbnailModel(XmlDocument xdoc, string shaCode)
         {
             var thumbnailNode = xdoc.GetTextByPath("//pkg:part[@pkg:name='/docProps/thumbnail.jpeg']");
             if (thumbnailNode != null)
@@ -2976,14 +2974,14 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
             return null;
         }
 
-        public XmlNode LoadTheme(XmlDocument xdoc)
+        public static XmlNode LoadTheme(XmlDocument xdoc)
         {
             var themeRelationship = xdoc.GetTextByPath("//pkg:part[@pkg:name='/ppt/_rels/presentation.xml.rels']/pkg:xmlData/rel:Relationships/rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme']/@Target");
             //  "/ppt/theme/theme1.xml"
             string themeURI = "/ppt/" + themeRelationship.Value;
             return xdoc.GetTextByPath("//pkg:part[@pkg:name='" + themeURI + "']");
         }
-        public async Task<AzureBlobModel> SaveBase64ToBolob(string data, string contentType, string FolderName, string fileName)
+        public static async Task<AzureBlobModel> SaveBase64ToBolob(string data, string contentType, string FolderName, string fileName)
         {
             string fileExt;
             if (ContentTypeDict.extdict.TryGetValue(contentType, out string ext))
@@ -3013,13 +3011,17 @@ namespace TEAMModelOS.Service.Services.PowerPoint.Implement
                     fileName += fileExt;
                 }
             }
+
+            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 = await azureBlobDBRepository.UploadFileByFolder(streamBlob, FolderName, fileName, "pptx", false);
+            AzureBlobModel model =new AzureBlobModel { BlobUrl= url };
             return model;
         }
 
 
-        public async Task<Media> ProcessPicNode(XmlNode node, int order, WarpObj warpObj)
+        public static async Task<Media> ProcessPicNode(XmlNode node, int order, WarpObj warpObj)
         {
             var xfrmList = "p:spPr/a:xfrm";
             var xfrmNode = node.GetTextByPath(xfrmList);

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


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


+ 5 - 11
TEAMModelOS.Service/Services/Syllabus/Implement/KnowledgeService.cs

@@ -1,23 +1,17 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
 
 namespace TEAMModelOS.Service.Services.Implement
 {
-    public class KnowledgeService : IKnowledgeService
+    public static class KnowledgeService  
     {
-        private AzureCosmosFactory _cosmos;
+       
 
-        public KnowledgeService(AzureCosmosFactory cosmos)
-        {
-            _cosmos = cosmos;
-        }
-
-        public async Task<List<IdPk>> DeleteKnowledge(List<IdPk> listPid)
+        public static async Task<List<IdPk>> DeleteKnowledge(this AzureCosmosFactory _cosmos ,List<IdPk> listPid)
         {
             List<IdPk> idPks = await _cosmos.DeleteAll<Knowledge>(listPid);
             foreach (IdPk Knowledge in idPks)
@@ -32,7 +26,7 @@ namespace TEAMModelOS.Service.Services.Implement
             return idPks;
         }
 
-        public async Task<List<Knowledge>> SaveOrUpdateKnowledge(List<Knowledge> request)
+        public static async Task<List<Knowledge>> SaveOrUpdateKnowledge(this AzureCosmosFactory _cosmos, List<Knowledge> request)
         {
             foreach (Knowledge item in request)
             {

+ 6 - 14
TEAMModelOS.Service/Services/Syllabus/Implement/SyllabusService.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -8,26 +8,18 @@ using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Helper.Common.JsonHelper;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
 
 namespace TEAMModelOS.Service.Services.Implement
 {
-    public class SyllabusService: ISyllabusService
+    public static class SyllabusService 
     {
-        private readonly AzureCosmosFactory azureCosmosDBRepository;
-
-        public SyllabusService(AzureCosmosFactory azureCosmosDBRepository)
-        {
-            this.azureCosmosDBRepository = azureCosmosDBRepository;
-        }
-
 
         /// <summary>
         /// 查找课纲 
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<List<SyllabusTree>> Find(Dictionary<string, object> request)
+        public static async Task<List<SyllabusTree>> Find(this AzureCosmosFactory azureCosmosDBRepository,  Dictionary<string, object> request)
         {
             Dictionary<string, object> dict = new Dictionary<string, object>();
             foreach (KeyValuePair<string, object> keyValuePair in request)
@@ -87,7 +79,7 @@ namespace TEAMModelOS.Service.Services.Implement
         }
         
 
-        public async Task<List<Syllabus>> SaveOrUpdateAsNodes(List<SyllabusNode> syllabusNodes)
+        public static async Task<List<Syllabus>> SaveOrUpdateAsNodes(this AzureCosmosFactory azureCosmosDBRepository,  List<SyllabusNode> syllabusNodes)
         {
             List<Syllabus> syllabuses;
 
@@ -143,7 +135,7 @@ namespace TEAMModelOS.Service.Services.Implement
             return syllabuses;
         }
 
-        public async Task<List<SyllabusTree>> SaveOrUpdateAsTree(List<SyllabusTree> request)
+        public static async Task<List<SyllabusTree>> SaveOrUpdateAsTree(this AzureCosmosFactory azureCosmosDBRepository,  List<SyllabusTree> request)
         {
             List<SyllabusNode> nodes = new List<SyllabusNode>();
             Syllabus syllabus = new Syllabus();
@@ -210,7 +202,7 @@ namespace TEAMModelOS.Service.Services.Implement
             return trees;
         }
 
-        public async Task<List<Syllabus>> DeleteSyllabus(Dictionary<string, object> request)
+        public static async Task<List<Syllabus>> DeleteSyllabus(this AzureCosmosFactory azureCosmosDBRepository, Dictionary<string, object> request)
         {
             Dictionary<string, object> dict = new Dictionary<string, object>();
             foreach (KeyValuePair<string, object> keyValuePair in request)

+ 4 - 10
TEAMModelOS.Service/Services/Syllabus/Implement/VolumeService.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
@@ -7,21 +7,15 @@ using TEAMModelOS.SDK.Extension.SnowFlake;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.Service.Models;
-using TEAMModelOS.Service.Services.Interface;
 
 namespace TEAMModelOS.Service.Services.Implement
 {
-    public class VolumeService : IVolumeService
+    public static class VolumeService 
     {
 
-        private readonly AzureCosmosFactory azureCosmosDBRepository;
+        
 
-        public VolumeService(AzureCosmosFactory azureCosmosDBRepository)
-        {
-            this.azureCosmosDBRepository = azureCosmosDBRepository;
-        }
-
-        public async Task<List<Volume>> SaveOrUpdateVolume(Volume request)
+        public static  async Task<List<Volume>> SaveOrUpdateVolume(this AzureCosmosFactory azureCosmosDBRepository, Volume request)
         {
             if (request.editors != null && request.editors.Count > 5)
             {

+ 7 - 3
TEAMModelOS/Startup.cs

@@ -28,7 +28,6 @@ using TEAMModelOS.SDK.Context.Filter;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Module.AzureServiceBus;
 using TEAMModelOS.Service.Services.Learn.Implements;
-using TEAMModelOS.Service.Services.Learn.Interfaces;
 using VueCliMiddleware;
 
 namespace TEAMModelOS
@@ -95,13 +94,18 @@ namespace TEAMModelOS
             //services.AddAzureBlobStorage().AddConnection(Configuration.GetSection("Azure:Blob").Get<AzureBlobOptions>());
             //使用AzureServiceBus
             services.AddServiceBus().AddServiceBusOptions(Configuration.GetSection("Azure:ServiceBus").Get<AzureServiceBusOptions>());
-            services.AddSingleton<IServiceBusService, ServiceBusService>();
             //HttpContextAccessor,并用来访问HttpContext。
             services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
             //services.AddSingleton<IServiceBusReviceService, ServiceBusReviceService>();
             //注入CSRedis
             var csredis = new CSRedis.CSRedisClient(Configuration.GetSection("Azure:Redis:ConnectionString").Get<string>());
             RedisHelper.Initialization(csredis);
+            //全局扫描基于IBusinessService接口的实现类
+            //services.Scan(scan => scan.FromApplicationDependencies()
+            //   .AddClasses(classes => classes.AssignableTo<IBusinessService>())
+            //       .AsImplementedInterfaces()
+            //       .WithScopedLifetime());
+
         }
 
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -111,7 +115,7 @@ namespace TEAMModelOS
             {
                 app.UseDeveloperExceptionPage();
             }
-            //app.UseMiddleware<HttpGlobalExceptionInvoke>();
+            app.UseMiddleware<HttpGlobalExceptionInvoke>();
             //以下需要按照順序載入中間件  如果应用调用 UseStaticFiles,请将 UseStaticFiles 置于 UseRouting之前。
             app.UseStaticFiles();
             //app.UseSpaStaticFiles(); //使用中間件不開