升级依赖以及数据迁移

This commit is contained in:
陈益 2026-03-20 23:52:06 +08:00
parent 3d402d01bc
commit c15e1ed3ac
9 changed files with 11148 additions and 129 deletions

View File

@ -36,7 +36,6 @@ global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi.Models;
global using JiShe.IoT;
global using Serilog;
global using StackExchange.Redis;

View File

@ -1,9 +1,11 @@
using Google.Protobuf.Compiler;
using Hangfire.Redis.StackExchange;
using JiShe.ServicePro.FreeRedisProvider;
using JiShe.ServicePro.SwaggerConfigs;
using Medallion.Threading;
using Medallion.Threading.Redis;
using Microsoft.CodeAnalysis;
using Microsoft.OpenApi;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem;
@ -145,102 +147,7 @@ public partial class IoTHttpApiHostModule
private void ConfigureSwaggerServices(ServiceConfigurationContext context)
{
context.Services.AddSwaggerGen(
options =>
{
// 文件下载类型
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
options.SwaggerDoc("AbpPro", new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
var configuration = context.Services.GetConfiguration();
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(group =>
{
if (!excludeSwaggerGroups.Where(e => e == group.Key).Any())
{
options.SwaggerDoc(group.Key,
new OpenApiInfo { Title = group.Value, Version = "v1" });
}
});
options.DocInclusionPredicate((docName, description) =>
{
if (docName == "AbpPro")
{
return true;
}
return description.GroupName == docName;
});
//options.EnableAnnotations(enableAnnotationsForInheritance: true, enableAnnotationsForPolymorphism: true); // 启用注解
options.DocumentFilter<HiddenAbpDefaultApiFilter>();
options.SchemaFilter<EnumSchemaFilter>();
// 加载所有xml注释这里会导致swagger加载有点缓慢
var xmlPaths = Directory.GetFiles(AppContext.BaseDirectory, "*.xml");
foreach (var xml in xmlPaths)
{
options.IncludeXmlComments(xml, true);
}
// 加载 模块引入的xml注释
// 加载所有xml注释这里会导致swagger加载有点缓慢
var modulePath = Path.Combine(AppContext.BaseDirectory, "moduleSwagger");
if (Directory.Exists(modulePath))
{
var xmlModulePaths = Directory.GetFiles(modulePath, "*.xml");
foreach (var xml in xmlModulePaths)
{
options.IncludeXmlComments(xml, true);
}
}
options.AddSecurityDefinition(JwtBearerDefaults.AuthenticationScheme,
new OpenApiSecurityScheme()
{
Description = "直接在下框输入JWT生成的Token",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.Http,
Scheme = JwtBearerDefaults.AuthenticationScheme,
BearerFormat = "JWT"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = "Bearer"
}
},
new List<string>()
}
});
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme()
{
Type = SecuritySchemeType.ApiKey,
In = ParameterLocation.Header,
Name = "Accept-Language",
Description = "多语言设置系统预设语言有zh-Hans、en默认为zh-Hans",
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
Array.Empty<string>()
}
});
});
context.Services.AddJiSheServiceProSwagger("AbpPro");
}

View File

@ -88,39 +88,13 @@ namespace JiShe.IoT
}
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(attr =>
{
if (!excludeSwaggerGroups.Where(e => e == attr.Key).Any())
{
options.SwaggerEndpoint($"/swagger/{attr.Key}/swagger.json", attr.Value);
}
});
options.SwaggerEndpoint("/swagger/AbpPro/swagger.json", "AbpPro API");
options.DocExpansion(DocExpansion.None);
options.DefaultModelsExpandDepth(-1);
});
app.UseJiSheServiceProSwaggerUI(configuration,"/swagger/AbpPro/swagger.json", "AbpPro",true);
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
// {
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
// IgnoreAntiforgeryToken = true
// });
endpoints.MapHealthChecks("/health");
});
if (configuration.GetValue("Consul:Enabled", false))

View File

@ -47,15 +47,15 @@ public class Program
//options.Limits.MaxConcurrentConnections = 1000;//限制并发连接数,默认无限制
});
builder.WebHost.UseUrls($"http://+:10500");
builder.WebHost.UseUrls($"http://+:20500");
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception)
catch (Exception ex)
{
throw;
throw ex;
}
finally
{

View File

@ -1,9 +1,10 @@
using JiShe.ServicePro.PulsarProvider;
using Volo.Abp.Localization;
namespace JiShe.IoT.DbMigrator
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAutofacModule),
typeof(IoTEntityFrameworkCoreModule),
typeof(IoTApplicationContractsModule)
)]

View File

@ -89,6 +89,7 @@ namespace JiShe.IoT.EntityFrameworkCore
public DbSet<OneNETAccountInfos> OneNETAccountInfo { get; set; }
public DbSet<OneNETProductInfos> OneNETProductInfo { get; set; }
public DbSet<ResourcePermissionGrant> ResourcePermissionGrants { get; set; }
public IoTDbContext(DbContextOptions<IoTDbContext> options)
: base(options)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff