Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
7cb177cb7c
|
@ -10,25 +10,25 @@
|
|||
<PackageReference Include="AlibabaCloud.SDK.Sts20150401" Version="1.1.4" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.402.7" />
|
||||
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.400.16" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.405" />
|
||||
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.400.36" />
|
||||
<PackageReference Include="DistributedLock.Core" Version="1.0.7" />
|
||||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.5" />
|
||||
<PackageReference Include="fo-dicom" Version="5.1.3" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.14.5" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.15.1" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Minio" Version="6.0.3" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.2" />
|
||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.2" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -62,25 +62,23 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ConfigMapFileProvider" Version="2.0.1" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.14" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.InMemory" Version="0.10.3" />
|
||||
<PackageReference Include="Hangfire.InMemory" Version="1.0.0" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.14" />
|
||||
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.2" />
|
||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
|
||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.1.2" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.7.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -144,14 +144,24 @@ builder.Services.AddMasaMinimalAPIs(options =>
|
|||
options.RouteHandlerBuilder= t=> {
|
||||
t.RequireAuthorization()
|
||||
.AddEndpointFilter<LimitUserRequestAuthorizationEndpointFilter>()
|
||||
.AddEndpointFilter<ModelValidationEndpointFilter>()
|
||||
//.AddEndpointFilter<ModelValidationEndpointFilter>()
|
||||
.AddEndpointFilter<UnifiedApiResultEndpointFilter>()
|
||||
.WithGroupName("Institution");
|
||||
.WithGroupName("Institution").DisableAntiforgery();
|
||||
};
|
||||
options.MapHttpMethodsForUnmatched = new string[] { "Post" };
|
||||
options.DisableTrimMethodPrefix = true; //禁用去除方法前缀
|
||||
options.DisableAutoMapRoute = false;//可通过配置true禁用全局自动路由映射或者删除此配置以启用全局自动路由映射
|
||||
});
|
||||
|
||||
//// 添加反伪造服务
|
||||
//builder.Services.AddAntiforgery(options =>
|
||||
//{
|
||||
// // 可选:设置自定义的头部名称以支持 AJAX 请求等
|
||||
// options.HeaderName = "X-XSRF-TOKEN";
|
||||
//});
|
||||
|
||||
//builder.Services.AddAntiforgery();
|
||||
|
||||
#endregion
|
||||
|
||||
var app = builder.Build();
|
||||
|
@ -160,7 +170,6 @@ var env = app.Environment;
|
|||
#region 配置中间件
|
||||
|
||||
|
||||
|
||||
app.UseMiddleware<EncryptionRequestMiddleware>();
|
||||
|
||||
#region 异常处理 全局业务异常已统一处理了,非业务错误会来到这里 400 -500状态码
|
||||
|
@ -235,6 +244,13 @@ app.UseRouting();
|
|||
app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
//Map MinimalAPI routes
|
||||
app.MapMasaMinimalAPIs();
|
||||
|
||||
//// 这里添加反伪造中间件
|
||||
//app.UseAntiforgery();
|
||||
app.MapControllers();
|
||||
|
||||
app.MapHub<UploadHub>("/UploadHub");
|
||||
|
@ -244,8 +260,7 @@ app.MapHealthChecks("/health");
|
|||
|
||||
#endregion
|
||||
|
||||
//Map MinimalAPI routes
|
||||
app.MapMasaMinimalAPIs();
|
||||
|
||||
|
||||
// Serilog
|
||||
SerilogExtension.AddSerilogSetup(enviromentName, app.Services);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using Autofac;
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IP2Region.Net.XDB;
|
||||
using IRaCIS.Core.Application.BackGroundJob;
|
||||
|
@ -96,42 +95,42 @@ public static class ServiceCollectionSetup
|
|||
}
|
||||
|
||||
#region Autofac ·ÏÆú
|
||||
public class AutofacModuleSetup : Autofac.Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder containerBuilder)
|
||||
{
|
||||
//public class AutofacModuleSetup : Autofac.Module
|
||||
//{
|
||||
// protected override void Load(ContainerBuilder containerBuilder)
|
||||
// {
|
||||
|
||||
#region byzhouhang 20210917 此处注册泛型仓储 可以减少Domain层 和Infra.EFcore 两层 空的仓储接口定义和 仓储文件定义
|
||||
// #region byzhouhang 20210917 此处注册泛型仓储 可以减少Domain层 和Infra.EFcore 两层 空的仓储接口定义和 仓储文件定义
|
||||
|
||||
containerBuilder.RegisterGeneric(typeof(Repository<>))
|
||||
.As(typeof(IRepository<>)).InstancePerLifetimeScope();//注册泛型仓储
|
||||
// containerBuilder.RegisterGeneric(typeof(Repository<>))
|
||||
// .As(typeof(IRepository<>)).InstancePerLifetimeScope();//注册泛型仓储
|
||||
|
||||
containerBuilder.RegisterType<Repository>().As<IRepository>().InstancePerLifetimeScope();
|
||||
// containerBuilder.RegisterType<Repository>().As<IRepository>().InstancePerLifetimeScope();
|
||||
|
||||
|
||||
#endregion
|
||||
// #endregion
|
||||
|
||||
#region 指定控制器也由autofac 来进行实例获取 https://www.cnblogs.com/xwhqwer/p/15320838.html
|
||||
// #region 指定控制器也由autofac 来进行实例获取 https://www.cnblogs.com/xwhqwer/p/15320838.html
|
||||
|
||||
//获取所有控制器类型并使用属性注入
|
||||
containerBuilder.RegisterAssemblyTypes(typeof(BaseService).Assembly)
|
||||
.Where(type => typeof(IDynamicWebApi).IsAssignableFrom(type))
|
||||
.PropertiesAutowired();
|
||||
// //获取所有控制器类型并使用属性注入
|
||||
// containerBuilder.RegisterAssemblyTypes(typeof(BaseService).Assembly)
|
||||
// .Where(type => typeof(IDynamicWebApi).IsAssignableFrom(type))
|
||||
// .PropertiesAutowired();
|
||||
|
||||
#endregion
|
||||
// #endregion
|
||||
|
||||
|
||||
Assembly application = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "IRaCIS.Core.Application.dll");
|
||||
containerBuilder.RegisterAssemblyTypes(application).Where(t => t.FullName.Contains("Service"))
|
||||
.PropertiesAutowired().AsImplementedInterfaces();
|
||||
// Assembly application = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "IRaCIS.Core.Application.dll");
|
||||
// containerBuilder.RegisterAssemblyTypes(application).Where(t => t.FullName.Contains("Service"))
|
||||
// .PropertiesAutowired().AsImplementedInterfaces();
|
||||
|
||||
//containerBuilder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().SingleInstance();
|
||||
//containerBuilder.RegisterType<UserInfo>().As<IUserInfo>().InstancePerLifetimeScope();
|
||||
// //containerBuilder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().SingleInstance();
|
||||
// //containerBuilder.RegisterType<UserInfo>().As<IUserInfo>().InstancePerLifetimeScope();
|
||||
|
||||
|
||||
//注册hangfire任务 依赖注入
|
||||
containerBuilder.RegisterType<ObtainTaskAutoCancelJob>().As<IObtainTaskAutoCancelJob>().InstancePerDependency();
|
||||
// //注册hangfire任务 依赖注入
|
||||
// containerBuilder.RegisterType<ObtainTaskAutoCancelJob>().As<IObtainTaskAutoCancelJob>().InstancePerDependency();
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
|
|
@ -72,7 +72,9 @@
|
|||
"ReadingRestTimeMin": 10,
|
||||
"IsNeedChangePassWord": true,
|
||||
|
||||
"ChangePassWordDays": 90
|
||||
"ChangePassWordDays": 90,
|
||||
|
||||
"ThirdPdfUrl": "http://106.14.89.110:30088/api/v1/convert/file/pdf"
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
|
|
|
@ -34,6 +34,8 @@ public class ServiceVerifyConfigOption
|
|||
[Description("修改密码的天数")]
|
||||
public int ChangePassWordDays { get; set; }
|
||||
|
||||
public string ThirdPdfUrl { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class SystemEmailSendConfig
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
using System.Diagnostics;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using RestSharp;
|
||||
using SharpCompress.Common;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace IRaCIS.Core.Application.Helper;
|
||||
|
||||
public class FileConvertHelper
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 镜像里面打入libreoffice 的方案
|
||||
/// </summary>
|
||||
/// <param name="inputWordFilePath"></param>
|
||||
/// <param name="outputPdfDir"></param>
|
||||
static public void ConvertWordToPdf(string inputWordFilePath, string outputPdfDir)
|
||||
{
|
||||
// 设置 libreoffice 命令行参数
|
||||
|
@ -30,4 +37,88 @@ public class FileConvertHelper
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 返回文件字节数组
|
||||
/// File.WriteAllBytes(outputFilePath, response.RawBytes); 直接将字节数组写入到本地某个路径
|
||||
/// var stream = new MemoryStream(response.RawBytes); 直接变为内存流,给其他程序用也可以
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
static public async Task<byte[]> ThirdStirling_PDFWordToPdfAsync(string filePath)
|
||||
{
|
||||
|
||||
var apiUrl = GetApiUrl();
|
||||
|
||||
var client = new RestClient(apiUrl);
|
||||
|
||||
var request = new RestRequest(apiUrl, Method.Post);
|
||||
|
||||
request.AddHeader("accept", "*/*");
|
||||
|
||||
// 直接上传文件,无需生成字节数组
|
||||
request.AddFile("fileInput", filePath);
|
||||
|
||||
return await GetPDFByteArrayAsync(client, request);
|
||||
}
|
||||
|
||||
static public async Task<byte[]> ThirdStirling_PDFWordToPdfAsync(byte[] fileBytes, string fileName)
|
||||
{
|
||||
|
||||
var apiUrl = GetApiUrl();
|
||||
var client = new RestClient(apiUrl);
|
||||
|
||||
var request = new RestRequest(apiUrl, Method.Post);
|
||||
|
||||
request.AddHeader("accept", "*/*");
|
||||
|
||||
// 添加文件流到请求
|
||||
request.AddFile("fileInput", fileBytes, fileName);
|
||||
|
||||
return await GetPDFByteArrayAsync(client, request);
|
||||
}
|
||||
|
||||
static private async Task<byte[]> GetPDFByteArrayAsync(RestClient client, RestRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
|
||||
// 发送请求并获取响应
|
||||
var response = await client.ExecuteAsync(request);
|
||||
|
||||
// 检查请求是否成功
|
||||
if (response.IsSuccessful)
|
||||
{
|
||||
return response.RawBytes ?? new byte[] { };
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"上传失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}");
|
||||
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("发生异常: " + ex.Message);
|
||||
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
}
|
||||
|
||||
static private string GetApiUrl()
|
||||
{
|
||||
|
||||
var enviromentName = Environment.GetEnvironmentVariables()["ASPNETCORE_ENVIRONMENT"]?.ToString();
|
||||
|
||||
var configuration = new ConfigurationBuilder().AddJsonFile($"appsettings.{enviromentName}.json", false, false).Build();
|
||||
|
||||
// 手动绑定配置
|
||||
var appSettings = new ServiceVerifyConfigOption();
|
||||
configuration.GetSection("BasicSystemConfig").Bind(appSettings);
|
||||
|
||||
return appSettings.ThirdPdfUrl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlibabaCloud.SDK.Sts20150401" Version="1.1.4" />
|
||||
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.400.16" />
|
||||
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.400.36" />
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.14.1" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.402.7" />
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.405" />
|
||||
<PackageReference Include="DocX" Version="3.0.1" />
|
||||
<PackageReference Include="FreeSpire.Doc" Version="12.2.0" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.14" />
|
||||
|
@ -60,13 +60,13 @@
|
|||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.5" />
|
||||
<PackageReference Include="fo-dicom" Version="5.1.3" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.3" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.14.5" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.15.1" />
|
||||
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
||||
<PackageReference Include="MailKit" Version="4.7.1.1" />
|
||||
<PackageReference Include="Masa.Contrib.Service.MinimalAPIs" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
|
||||
<PackageReference Include="MimeKit" Version="4.7.1" />
|
||||
<PackageReference Include="MiniExcel" Version="1.34.1" />
|
||||
<PackageReference Include="MiniExcel" Version="1.34.2" />
|
||||
<PackageReference Include="Minio" Version="6.0.3" />
|
||||
<PackageReference Include="MiniWord" Version="0.8.0" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
|
||||
|
@ -74,10 +74,10 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="NPOI" Version="2.7.1" />
|
||||
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.2" />
|
||||
<PackageReference Include="RestSharp" Version="112.0.0" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="ZiggyCreatures.FusionCache" Version="1.3.0" />
|
||||
<PackageReference Include="ZiggyCreatures.FusionCache" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -2273,6 +2273,20 @@
|
|||
<param name="password"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService">
|
||||
<summary>
|
||||
minimal api 测试
|
||||
学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.MinimalApiService.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)">
|
||||
<summary>
|
||||
minimal api 测试
|
||||
学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.QCCommon.VerifyIsCRCSubmmitAsync(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Domain.Share.IUserInfo,System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人
|
||||
|
@ -12683,20 +12697,6 @@
|
|||
<param name="outEnrollTime"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Service.TestMinimalApiService">
|
||||
<summary>
|
||||
minimal api 测试
|
||||
学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TestMinimalApiService.#ctor(IRaCIS.Core.Domain.Share.IUserInfo)">
|
||||
<summary>
|
||||
minimal api 测试
|
||||
学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.TestService.DeleteConsistentDate(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskConsistentRule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingConsistentClinicalDataPDF},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingConsistentClinicalData})">
|
||||
<summary>
|
||||
清理一致性分析任务
|
||||
|
@ -12762,6 +12762,21 @@
|
|||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.FileConvertHelper.ConvertWordToPdf(System.String,System.String)">
|
||||
<summary>
|
||||
镜像里面打入libreoffice 的方案
|
||||
</summary>
|
||||
<param name="inputWordFilePath"></param>
|
||||
<param name="outputPdfDir"></param>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.FileConvertHelper.ThirdStirling_PDFWordToPdfAsync(System.String)">
|
||||
<summary>
|
||||
返回文件字节数组
|
||||
File.WriteAllBytes(outputFilePath, response.RawBytes); 直接将字节数组写入到本地某个路径
|
||||
var stream = new MemoryStream(response.RawBytes); 直接变为内存流,给其他程序用也可以
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.FileStoreHelper.WriteFileAsync(System.IO.Stream,System.String)">
|
||||
<summary>
|
||||
写文件导到磁盘
|
||||
|
@ -12916,12 +12931,17 @@
|
|||
加急阅片 IR 申请重阅 或者PM 申请重阅
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UrgentIRApplyedReReadingConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.User},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskMedicalReview},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<summary>
|
||||
加急阅片 IR 申请重阅 或者PM 申请重阅
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.UserSiteSurveySubmitedEventConsumer">
|
||||
<summary>
|
||||
用户提交 发送邮件 通知SPM 或者PM
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UserSiteSurveySubmitedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.UserSiteSurveySubmitedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<summary>
|
||||
用户提交 发送邮件 通知SPM 或者PM
|
||||
</summary>
|
||||
|
@ -12931,7 +12951,7 @@
|
|||
调研表初审通过,进行复审发送邮件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.SiteSurveySPMSubmitedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.SiteSurveySPMSubmitedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<summary>
|
||||
调研表初审通过,进行复审发送邮件
|
||||
</summary>
|
||||
|
@ -12941,7 +12961,7 @@
|
|||
调研表驳回发送邮件 之前已有,需要迁移过来
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.SiteSurverRejectedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.User},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.SiteSurverRejectedEventConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig})">
|
||||
<summary>
|
||||
调研表驳回发送邮件 之前已有,需要迁移过来
|
||||
</summary>
|
||||
|
@ -13042,17 +13062,17 @@
|
|||
影像质控
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.QCImageQuestionSchedule">
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.QCImageQuestionRecurringSchedule">
|
||||
<summary>
|
||||
QC 影像质疑待处理
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.CRCImageQuestionSchedule">
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.CRCImageQuestionRecurringSchedule">
|
||||
<summary>
|
||||
CRC 影像质疑
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.ImageQCSchedule">
|
||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.ImageQCRecurringSchedule">
|
||||
<summary>
|
||||
影像质控
|
||||
</summary>
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
public class UserSiteSurveySubmitedEventConsumer(
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig
|
||||
|
@ -46,7 +47,7 @@ public class UserSiteSurveySubmitedEventConsumer(
|
|||
|
||||
var trialId = siteSurveyInfo.TrialId;
|
||||
|
||||
var trialUserList = await _trialSiteSurveyRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId).SelectMany(t => t.Trial.TrialUserList)
|
||||
var trialUserList = await _trialUserRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.User.FullName, t.User.EMail, t.User.UserTypeEnum }).ToListAsync();
|
||||
|
||||
|
@ -124,6 +125,7 @@ public class UserSiteSurveySubmitedEventConsumer(
|
|||
/// </summary>
|
||||
public class SiteSurveySPMSubmitedEventConsumer(
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
|
@ -143,8 +145,7 @@ public class SiteSurveySPMSubmitedEventConsumer(
|
|||
|
||||
var messageToSend = new MimeMessage();
|
||||
|
||||
var trialUserList = _trialRepository.Where(t => t.Id == trialId)
|
||||
.SelectMany(t => t.TrialUserList)
|
||||
var trialUserList = _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToList();
|
||||
|
||||
|
@ -199,7 +200,7 @@ public class SiteSurveySPMSubmitedEventConsumer(
|
|||
/// 调研表驳回发送邮件 之前已有,需要迁移过来
|
||||
/// </summary>
|
||||
public class SiteSurverRejectedEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
|
@ -232,8 +233,7 @@ public class SiteSurverRejectedEventConsumer(
|
|||
|
||||
//name = user.FullName;
|
||||
|
||||
var sPMOrCPMList = _trialRepository.Where(t => t.Id == trialId)
|
||||
.SelectMany(t => t.TrialUserList)
|
||||
var sPMOrCPMList = _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM)
|
||||
.Select(t => new { t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToList();
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
using IRaCIS.Core.Domain;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Domain;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using MassTransit;
|
||||
using MassTransit.Mediator;
|
||||
using MassTransit.Scheduling;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using Microsoft.Extensions.Options;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -71,11 +75,76 @@ public class TestMasstransitService : BaseService
|
|||
////发布后,不会立即进入消费者,消费者是另外的线程执行
|
||||
//await _mediatorScoped.Publish(new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
|
||||
|
||||
await _recurringMessageScheduler.ScheduleRecurringPublish(new QCImageQuestionSchedule() { CronExpression = "0/3 * * * * ? " }, new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
|
||||
await _recurringMessageScheduler.ScheduleRecurringPublish(new QCImageQuestionRecurringSchedule() { CronExpression = "0/3 * * * * ? " }, new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
|
||||
//await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransiTestCommand() { value = "message at " + DateTime.Now.ToString() });
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
public async Task<IResponseOutput> TestWordToPdf()
|
||||
{
|
||||
|
||||
var dd = await FileConvertHelper.ThirdStirling_PDFWordToPdfAsync(@"C:\Users\hang\Desktop\test.docx");
|
||||
|
||||
string outputFilePath = @"C:\Users\hang\Desktop\test-byte4-output.pdf"; // 保存路径
|
||||
File.WriteAllBytes(outputFilePath, dd); // 将响应字节数组写入文件
|
||||
|
||||
|
||||
|
||||
//var envName = Environment.GetEnvironmentVariables()["ASPNETCORE_ENVIRONMENT"]?.ToString();
|
||||
|
||||
//// API 地址
|
||||
//string apiUrl = "http://106.14.89.110:30088/api/v1/convert/file/pdf";
|
||||
|
||||
//// 模拟文件路径,假设你有一个内存流的文件,不指定实际文件
|
||||
//string filePath = @"C:\Users\hang\Desktop\test.docx"; // 本地文件路径或者你可以直接使用流
|
||||
|
||||
//var fileBytes = File.ReadAllBytes(@"C:\Users\hang\Desktop\test.docx");
|
||||
|
||||
|
||||
//try
|
||||
//{
|
||||
// // 创建 RestClient
|
||||
// var client = new RestClient(apiUrl);
|
||||
|
||||
// // 创建 RestRequest,使用 POST 方法
|
||||
// var request = new RestRequest(apiUrl, Method.Post);
|
||||
// request.AddHeader("accept", "*/*");
|
||||
|
||||
// //new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
|
||||
// // 直接上传文件,无需生成字节数组
|
||||
// //request.AddFile("fileInput", filePath, contentType);
|
||||
|
||||
// // 添加文件流到请求
|
||||
// request.AddFile("fileInput", fileBytes, "test-byte.docx");
|
||||
|
||||
// // 发送请求并获取响应
|
||||
// var response = await client.ExecuteAsync(request);
|
||||
|
||||
// // 检查请求是否成功
|
||||
// if (response.IsSuccessful)
|
||||
// {
|
||||
// // 保存接收到的文件到本地
|
||||
// string outputFilePath = @"C:\Users\hang\Desktop\test-byte3-output.pdf"; // 保存路径
|
||||
// File.WriteAllBytes(outputFilePath, response.RawBytes); // 将响应字节数组写入文件
|
||||
|
||||
// //如果要文件流,就这样
|
||||
// //var stream = new MemoryStream(response.RawBytes);
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine($"上传失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}");
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// Console.WriteLine("发生异常: " + ex.Message);
|
||||
//}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
|
||||
|
||||
|
||||
public class QCImageQuestionScheduleConsumer : IConsumer<QCImageQuestionSchedule>
|
||||
public class QCImageQuestionScheduleConsumer : IConsumer<QCImageQuestionRecurringSchedule>
|
||||
{
|
||||
public Task Consume(ConsumeContext<QCImageQuestionSchedule> context)
|
||||
public Task Consume(ConsumeContext<QCImageQuestionRecurringSchedule> context)
|
||||
{
|
||||
Console.WriteLine(DateTime.Now);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public abstract class IRCRecurringSchedule :
|
|||
/// <summary>
|
||||
/// QC 影像质疑待处理
|
||||
/// </summary>
|
||||
public class QCImageQuestionSchedule : IRCRecurringSchedule
|
||||
public class QCImageQuestionRecurringSchedule : IRCRecurringSchedule
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class QCImageQuestionSchedule : IRCRecurringSchedule
|
|||
/// <summary>
|
||||
/// CRC 影像质疑
|
||||
/// </summary>
|
||||
public class CRCImageQuestionSchedule : IRCRecurringSchedule
|
||||
public class CRCImageQuestionRecurringSchedule : IRCRecurringSchedule
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class CRCImageQuestionSchedule : IRCRecurringSchedule
|
|||
/// <summary>
|
||||
/// 影像质控
|
||||
/// </summary>
|
||||
public class ImageQCSchedule : IRCRecurringSchedule
|
||||
public class ImageQCRecurringSchedule : IRCRecurringSchedule
|
||||
{
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
using IRaCIS.Core.Application.Helper;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
using RestSharp;
|
||||
using SharpCompress.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.MinimalApiService
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Institution")]
|
||||
public class FileToPDFService(IWebHostEnvironment _hostEnvironment) : ServiceBase
|
||||
{
|
||||
|
||||
[AllowAnonymous]
|
||||
[RoutePattern(HttpMethod = "Post")]
|
||||
public async Task<IResult> UploadFileAsync([FromForm] IFormFile file)
|
||||
{
|
||||
var tempFileName = NewId.NextGuid() + file.FileName;
|
||||
var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf";
|
||||
|
||||
|
||||
// 获取wwwroot目录
|
||||
var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp");
|
||||
|
||||
// 检查wwwroot/temp目录是否存在,不存在则创建
|
||||
if (!Directory.Exists(wwwRootPath))
|
||||
{
|
||||
Directory.CreateDirectory(wwwRootPath);
|
||||
}
|
||||
|
||||
// 文件保存路径
|
||||
var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName);
|
||||
var tempFilePath = Path.Combine(wwwRootPath, tempFileName);
|
||||
|
||||
|
||||
using var stream = File.OpenWrite(tempFilePath);
|
||||
await file.CopyToAsync(stream);
|
||||
|
||||
FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath));
|
||||
|
||||
var fileBytes = await File.ReadAllBytesAsync(pdfFilePath);
|
||||
|
||||
// 清理临时上传的文件和pdf
|
||||
if (File.Exists(pdfFilePath))
|
||||
{
|
||||
File.Delete(pdfFilePath);
|
||||
}
|
||||
if (File.Exists(tempFilePath))
|
||||
{
|
||||
File.Delete(tempFilePath);
|
||||
}
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType);
|
||||
|
||||
return Results.File(fileBytes, contentType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResult> GetPDFFileAsync(string fileUrl)
|
||||
{
|
||||
var tempFileName = NewId.NextGuid() + Path.GetFileName(fileUrl);
|
||||
var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf";
|
||||
|
||||
|
||||
// 获取wwwroot目录
|
||||
var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp");
|
||||
|
||||
// 检查wwwroot/temp目录是否存在,不存在则创建
|
||||
if (!Directory.Exists(wwwRootPath))
|
||||
{
|
||||
Directory.CreateDirectory(wwwRootPath);
|
||||
}
|
||||
|
||||
// 文件保存路径
|
||||
var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName);
|
||||
var tempFilePath = Path.Combine(wwwRootPath, tempFileName);
|
||||
|
||||
|
||||
//请求url获取文件
|
||||
var client = new RestClient(fileUrl);
|
||||
|
||||
var request = new RestRequest(fileUrl, Method.Get);
|
||||
|
||||
var response = await client.ExecuteAsync(request);
|
||||
|
||||
// 检查响应是否成功
|
||||
if (response.IsSuccessful)
|
||||
{
|
||||
// 将响应内容写入到本地文件
|
||||
await File.WriteAllBytesAsync(tempFilePath, response.RawBytes);
|
||||
|
||||
FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath));
|
||||
|
||||
var fileBytes = await File.ReadAllBytesAsync(pdfFilePath);
|
||||
|
||||
// 清理临时上传的文件和pdf
|
||||
if (File.Exists(pdfFilePath))
|
||||
{
|
||||
File.Delete(pdfFilePath);
|
||||
}
|
||||
if (File.Exists(tempFilePath))
|
||||
{
|
||||
File.Delete(tempFilePath);
|
||||
}
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType);
|
||||
|
||||
return Results.File(fileBytes, contentType);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"下载文件失败: {response.ErrorMessage}");
|
||||
|
||||
return Results.Problem("下载文件失败", statusCode: StatusCodes.Status500InternalServerError);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.MinimalApiService
|
||||
{
|
||||
/// <summary>
|
||||
/// minimal api 测试
|
||||
/// 学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
/// 组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Institution")]
|
||||
|
||||
public class TestMinimalApiService(IUserInfo _userInfo) : ServiceBase
|
||||
{
|
||||
|
||||
|
||||
|
||||
public Task<List<string>> GetProjectList1Async()
|
||||
{
|
||||
var list = new List<string>()
|
||||
{
|
||||
"Auth",
|
||||
"DCC",
|
||||
"PM"
|
||||
};
|
||||
return Task.FromResult(list);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public IResponseOutput GetTest()
|
||||
{
|
||||
|
||||
//throw new BusinessValidationFailedException("手动抛出的异常");
|
||||
|
||||
return ResponseOutput.Ok(_userInfo.IP);
|
||||
}
|
||||
|
||||
public IResponseOutput GetTestI18n()
|
||||
{
|
||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
|
||||
//CultureInfo.CurrentCulture = new CultureInfo(StaticData.CultureInfo.en_US);
|
||||
//CultureInfo.CurrentUICulture = new CultureInfo(StaticData.CultureInfo.en_US);
|
||||
|
||||
return ResponseOutput.Ok(I18n.T("TaskAllocation_DoctorConfigExists"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -33,49 +33,6 @@ using System.Text;
|
|||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// minimal api 测试
|
||||
/// 学习参考文档:http://fanrk.cn/%E6%8A%80%E6%9C%AF%E6%96%87%E6%A1%A3/MinimalApi/MinimalApi.html
|
||||
/// 组件参考文档:https://docs.masastack.com/framework/building-blocks/minimal-apis#section-69828ff0
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Institution")]
|
||||
|
||||
public class TestMinimalApiService(IUserInfo _userInfo) : ServiceBase
|
||||
{
|
||||
|
||||
|
||||
|
||||
public Task<List<string>> GetProjectList1Async()
|
||||
{
|
||||
var list = new List<string>()
|
||||
{
|
||||
"Auth",
|
||||
"DCC",
|
||||
"PM"
|
||||
};
|
||||
return Task.FromResult(list);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public IResponseOutput GetTest()
|
||||
{
|
||||
|
||||
//throw new BusinessValidationFailedException("手动抛出的异常");
|
||||
|
||||
return ResponseOutput.Ok(_userInfo.IP);
|
||||
}
|
||||
|
||||
public IResponseOutput GetTestI18n()
|
||||
{
|
||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
|
||||
//CultureInfo.CurrentCulture = new CultureInfo(StaticData.CultureInfo.en_US);
|
||||
//CultureInfo.CurrentUICulture = new CultureInfo(StaticData.CultureInfo.en_US);
|
||||
|
||||
return ResponseOutput.Ok(I18n.T("TaskAllocation_DoctorConfigExists"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EntityFrameworkCore.Projectables.Abstractions" Version="3.0.4" />
|
||||
<PackageReference Include="MassTransit" Version="8.2.5" />
|
||||
<PackageReference Include="MassTransit" Version="8.3.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -25,17 +25,17 @@
|
|||
<PackageReference Include="EntityFrameworkCore.Triggered" Version="3.2.2" />
|
||||
<PackageReference Include="EntityFrameworkCore.Projectables" Version="3.0.4" />
|
||||
<PackageReference Include="EntityFrameworkCore.Exceptions.SqlServer" Version="8.1.3" />
|
||||
<PackageReference Include="MassTransit" Version="8.2.5" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.2.5" />
|
||||
<PackageReference Include="MassTransit.Hangfire" Version="8.2.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PackageReference Include="MassTransit" Version="8.3.0" />
|
||||
<PackageReference Include="MassTransit.EntityFrameworkCore" Version="8.3.0" />
|
||||
<PackageReference Include="MassTransit.Hangfire" Version="8.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -31,8 +31,8 @@ public static class DBContext_Ext
|
|||
|
||||
var originState = entry.Property(p => p.State).OriginalValue;
|
||||
|
||||
//状态从待提交 变为CRC提交 (驳回也会变为已提交,所以必须设置前置状态是待提交)
|
||||
if (trialSiteSurvey.State == TrialSiteSurveyEnum.CRCSubmitted && originState == TrialSiteSurveyEnum.ToSubmit)
|
||||
//状态从待提交 变为CRC提交||SPM 提交 (驳回也会变为已提交,所以必须设置前置状态是待提交)
|
||||
if ((trialSiteSurvey.State == TrialSiteSurveyEnum.CRCSubmitted || trialSiteSurvey.State == TrialSiteSurveyEnum.SPMApproved) && originState == TrialSiteSurveyEnum.ToSubmit)
|
||||
{
|
||||
trialSiteSurvey.AddDomainEvent(new UserSiteSurveySubmitedEvent() { TrialSiteSurveyId = trialSiteSurvey.Id });
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace IRaCIS.Core.Infra.EFCore.Interceptor
|
|||
// 发件箱模式参考: https://dev.to/antonmartyniuk/use-masstransit-to-implement-outbox-pattern-with-ef-core-and-mongodb-oep#:~:text=MongoDB%20replica%20set%20is%20required%20for%20both%20publisher%20and%20consumer
|
||||
// 1、IPublishEndpoint 才会将事件存储到发件箱表中, 高级IBus接口时 - 消息不会存储在发件箱中,必须有savechanges 才会一起提交保存到数据库中
|
||||
// 2、进入消息代理之前,发布事件在OutboxState OutboxMessage, 进入消费者以后(已经删除OutboxState OutboxMessage),消费失败,需要修改代码重新发布,然后之前消费事件的重新处理,错误处理参考:https://www.youtube.com/watch?v=3TMKUu7c4lc
|
||||
public class DispatchDomainEventsInterceptor(IMediator _mediator, IMessageScheduler _scheduler/*, IPublishEndpoint _publishEndpoint*/) : SaveChangesInterceptor
|
||||
public class DispatchDomainEventsInterceptor(/*IMediator _mediator,*/ IMessageScheduler _scheduler, IPublishEndpoint _publishEndpoint) : SaveChangesInterceptor
|
||||
{
|
||||
|
||||
//领域事件通常与数据变更密切相关。如果在 SaveChanges 之前发布事件,有可能事件发布时的数据状态还没有被持久化到数据库。这可能导致事件消费者看到的是一个不一致的状态
|
||||
|
@ -64,7 +64,7 @@ namespace IRaCIS.Core.Infra.EFCore.Interceptor
|
|||
await _scheduler.SchedulePublish(DateTime.Now.AddSeconds((int)domainEvent.DelaySeconds!), (object)domainEvent);
|
||||
}
|
||||
|
||||
await _mediator.Publish(domainEvent.GetType(), domainEvent);
|
||||
await _publishEndpoint.Publish(domainEvent.GetType(), domainEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="AutoMapper.Collection.EntityFrameworkCore" Version="10.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.4.2" />
|
||||
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.5" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.6" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fluid.Core" Version="2.11.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.8" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.10" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
Loading…
Reference in New Issue