1
This commit is contained in:
parent
a6c5c7c159
commit
65cae5e177
@ -15,17 +15,12 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\InterfaceForward.Application\InterfaceForward.Application.csproj" />
|
<ProjectReference Include="..\InterfaceForward.Application\InterfaceForward.Application.csproj" />
|
||||||
<ProjectReference Include="..\InterfaceForward.Repositories\InterfaceForward.Repositories.csproj"/>
|
|
||||||
<ProjectReference Include="..\InterfaceForward.ServiceDefaults\InterfaceForward.ServiceDefaults.csproj"/>
|
<ProjectReference Include="..\InterfaceForward.ServiceDefaults\InterfaceForward.ServiceDefaults.csproj"/>
|
||||||
|
<PackageReference Include="Fake.Autofac" Version="8.0.0-preview5" />
|
||||||
|
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
|
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Fake.AspNetCore" Version="8.0.0-preview.3"/>
|
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,33 +1,53 @@
|
|||||||
using Fake.AspNetCore;
|
using Fake.AspNetCore;
|
||||||
|
using Fake.AspNetCore.Mvc;
|
||||||
|
using Fake.AspNetCore.Mvc.Conventions;
|
||||||
using Fake.Authorization;
|
using Fake.Authorization;
|
||||||
using Fake.Helpers;
|
using Fake.Autofac;
|
||||||
using Fake.Modularity;
|
using Fake.Modularity;
|
||||||
using InterfaceForward.Application;
|
using InterfaceForward.Application;
|
||||||
using InterfaceForward.Application.Filters;
|
using InterfaceForward.Application.Filters;
|
||||||
using InterfaceForward.Repositories;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace InterfaceForward.Api;
|
namespace InterfaceForward.Api;
|
||||||
|
|
||||||
[DependsOn(typeof(FakeAspNetCoreModule))]
|
[DependsOn(typeof(FakeAutofacModule))]
|
||||||
[DependsOn(typeof(FakeAuthorizationModule))]
|
[DependsOn(typeof(FakeAspNetCoreMvcModule))]
|
||||||
[DependsOn(typeof(InterfaceForwardRepositoriesModule))]
|
|
||||||
[DependsOn(typeof(InterfaceForwardApplicationModule))]
|
[DependsOn(typeof(InterfaceForwardApplicationModule))]
|
||||||
public class InterfaceForwardApiModule : FakeModule
|
public class InterfaceForwardApiModule : FakeModule
|
||||||
{
|
{
|
||||||
|
private const string DefaultCorsPolicyName = "default";
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
var services = context.Services;
|
var services = context.Services;
|
||||||
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
services.AddProblemDetails();
|
services.AddProblemDetails();
|
||||||
|
|
||||||
services.AddControllers(options =>
|
services.Configure<MvcOptions>(options =>
|
||||||
{
|
{
|
||||||
options.Filters.AddService<GlobalExceptionFilter>();
|
options.Filters.AddService<GlobalExceptionFilter>();
|
||||||
options.Filters.AddService<UnifiedResultFilter>();
|
options.Filters.AddService<RequestLogFilter>();
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSwagger();
|
services.Configure<RemoteServiceConventionOptions>(options =>
|
||||||
|
{
|
||||||
|
options.AddAssembly(typeof(InterfaceForwardApplicationModule).Assembly);
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddUnifiedResultFilter();
|
||||||
|
services.AddFakeSwaggerGen();
|
||||||
|
|
||||||
|
services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy(DefaultCorsPolicyName, builder =>
|
||||||
|
{
|
||||||
|
builder.WithOrigins(configuration.GetSection("App:CorsOrigins").Get<string[]>() ?? [])
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowCredentials();
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ConfigureApplication(ApplicationConfigureContext context)
|
public override void ConfigureApplication(ApplicationConfigureContext context)
|
||||||
@ -36,19 +56,13 @@ public class InterfaceForwardApiModule : FakeModule
|
|||||||
|
|
||||||
// Add Aspire default endpoints.
|
// Add Aspire default endpoints.
|
||||||
app.MapDefaultEndpoints();
|
app.MapDefaultEndpoints();
|
||||||
|
|
||||||
app.MapGet("/", () => "Hello World!");
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
app.UseFakeSwagger();
|
||||||
{
|
|
||||||
app.UseSwagger();
|
app.UseRouting();
|
||||||
app.UseSwaggerUI(options =>
|
|
||||||
{
|
app.UseCors(DefaultCorsPolicyName);
|
||||||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
|
|
||||||
options.RoutePrefix = string.Empty;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,27 @@
|
|||||||
using InterfaceForward.Api;
|
using InterfaceForward.Api;
|
||||||
|
using InterfaceForward.Api.Logs;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
try
|
||||||
|
{
|
||||||
|
var builder = WebApplication.CreateSlimBuilder(args);
|
||||||
|
builder.UseSerilogDefault();
|
||||||
|
builder.WebHost.UseUrls(builder.Configuration.GetSection("App:Urls").Get<string[]>() ?? []);
|
||||||
|
builder.Host.UseAutofac();
|
||||||
|
builder.Services.AddApplication<InterfaceForwardApiModule>();
|
||||||
|
|
||||||
builder.Services.AddApplication<InterfaceForwardApiModule>();
|
// Add service defaults & Aspire components.
|
||||||
|
builder.AddServiceDefaults();
|
||||||
|
|
||||||
// Add service defaults & Aspire components.
|
var app = builder.Build();
|
||||||
builder.AddServiceDefaults();
|
app.InitializeApplication();
|
||||||
|
app.Run();
|
||||||
var app = builder.Build();
|
}
|
||||||
app.InitializeApplication();
|
catch (Exception ex)
|
||||||
app.Run();
|
{
|
||||||
|
Log.Fatal(ex, "G");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Log.CloseAndFlush();
|
||||||
|
}
|
||||||
@ -1,9 +1,30 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"Serilog": {
|
||||||
"LogLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Debug",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"Override": {
|
||||||
}
|
"Microsoft.AspNetCore": "Debug"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Enrich": [
|
||||||
|
"FromLogContext",
|
||||||
|
"WithMachineName",
|
||||||
|
"WithProcessId",
|
||||||
|
"WithThreadId"
|
||||||
|
],
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "Console"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*",
|
||||||
|
"App": {
|
||||||
|
"Urls": [
|
||||||
|
"http://*:8888"
|
||||||
|
],
|
||||||
|
"CorsOrigins": [
|
||||||
|
"http://localhost:8888"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using InterfaceForward.Domain.Shared.Dtos;
|
using Fake.DomainDrivenDesign.Application.Dtos;
|
||||||
|
|
||||||
namespace InterfaceForward.Application.Contracts.ForwardCore;
|
namespace InterfaceForward.Application.Contracts.ForwardCore;
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,4 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\InterfaceForward.Domain.Shared\InterfaceForward.Domain.Shared.csproj" />
|
<ProjectReference Include="..\InterfaceForward.Domain.Shared\InterfaceForward.Domain.Shared.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Fake.Core" Version="8.0.0-preview.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,57 +0,0 @@
|
|||||||
using InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Application.Filters;
|
|
||||||
|
|
||||||
public class DefaultUnifiedResultHandler : IUnifiedResultHandler
|
|
||||||
{
|
|
||||||
public void HandleActionResult(ResultExecutingContext context)
|
|
||||||
{
|
|
||||||
// void、Task会被包装成EmptyResult
|
|
||||||
if (context.Result is EmptyResult)
|
|
||||||
{
|
|
||||||
var res = new UnifyResultDto();
|
|
||||||
context.Result = new ObjectResult(res);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// string、int、list以及自定义的模型,都会被包装成为ObjectResult
|
|
||||||
if (context.Result is ObjectResult objectResult)
|
|
||||||
{
|
|
||||||
var value = objectResult.Value;
|
|
||||||
|
|
||||||
// 已unified的无须再包装
|
|
||||||
if (value is UnifyResultDto) return;
|
|
||||||
|
|
||||||
var res = new UnifyResultDto<object>();
|
|
||||||
|
|
||||||
// A machine-readable format for specifying errors in HTTP API responses based on https://tools.ietf.org/html/rfc7807.
|
|
||||||
if (value is ProblemDetails details)
|
|
||||||
{
|
|
||||||
res.Code = details.Status.ToString()?? "400";
|
|
||||||
res.Message = details.Title?? "";
|
|
||||||
res.Data = context.ModelState.Keys
|
|
||||||
.SelectMany(key =>
|
|
||||||
context.ModelState[key]!.Errors
|
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(key))
|
|
||||||
.Select(x => new
|
|
||||||
{
|
|
||||||
Field = key,
|
|
||||||
Message = x.ErrorMessage
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.ToList();
|
|
||||||
objectResult.Value = res;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
res.Data = value;
|
|
||||||
objectResult.Value = res;
|
|
||||||
|
|
||||||
// 解决string格式问题
|
|
||||||
objectResult.DeclaredType = res.GetType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
namespace InterfaceForward.Application.Filters;
|
|
||||||
|
|
||||||
public class DisableUnifiedResultAttribute : Attribute;
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Repositories;
|
using InterfaceForward.Repositories;
|
||||||
using InterfaceForward.Repositories.Log.Services;
|
using InterfaceForward.Repositories.Log.Services;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using Fake;
|
using InterfaceForward.Application.Contracts;
|
||||||
using InterfaceForward.Application.Contracts;
|
|
||||||
using InterfaceForward.Application.Contracts.ForwardCore;
|
using InterfaceForward.Application.Contracts.ForwardCore;
|
||||||
using InterfaceForward.Repositories.Log.Services;
|
using InterfaceForward.Repositories.Log.Services;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using Fake;
|
|
||||||
using Fake.DependencyInjection;
|
using Fake.DependencyInjection;
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
using InterfaceForward.Domain.Shared.Dtos;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Application.Filters;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 在这里定义你的结果格式
|
|
||||||
/// </summary>
|
|
||||||
public interface IUnifiedResultHandler
|
|
||||||
{
|
|
||||||
void HandleActionResult(ResultExecutingContext context);
|
|
||||||
}
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Application.Filters;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 统一包装action-result
|
|
||||||
/// </summary>
|
|
||||||
public class UnifiedResultFilter : IAsyncResultFilter
|
|
||||||
{
|
|
||||||
private readonly IUnifiedResultHandler _unifiedResultHandler;
|
|
||||||
|
|
||||||
public UnifiedResultFilter(IUnifiedResultHandler unifiedResultHandler)
|
|
||||||
{
|
|
||||||
_unifiedResultHandler = unifiedResultHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
|
|
||||||
{
|
|
||||||
if (context.ActionDescriptor.EndpointMetadata.Any(
|
|
||||||
x => x.GetType() == typeof(DisableUnifiedResultAttribute))) return;
|
|
||||||
|
|
||||||
_unifiedResultHandler.HandleActionResult(context);
|
|
||||||
|
|
||||||
await next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts;
|
using InterfaceForward.Application.Contracts;
|
||||||
using InterfaceForward.Application.Contracts.ForwardCore;
|
using InterfaceForward.Application.Contracts.ForwardCore;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
// Global using directives
|
// Global using directives
|
||||||
|
|
||||||
|
global using Fake;
|
||||||
|
global using Fake.DomainDrivenDesign.Application.Dtos;
|
||||||
global using InterfaceForward.Domain.Shared.Helpers;
|
global using InterfaceForward.Domain.Shared.Helpers;
|
||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8</TargetFramework>
|
<TargetFramework>net8</TargetFramework>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -15,12 +16,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
||||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
|
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
|
||||||
<PackageReference Include="Fake.AspNetCore" Version="8.0.0-preview.3"/>
|
|
||||||
<PackageReference Include="Fake.Core" Version="8.0.0-preview.3"/>
|
|
||||||
<PackageReference Include="Fake.ObjectMapping.AutoMapper" Version="8.0.0-preview.3"/>
|
|
||||||
<PackageReference Include="DotNetCore.Natasha.CSharp" Version="5.2.2.1"/>
|
<PackageReference Include="DotNetCore.Natasha.CSharp" Version="5.2.2.1"/>
|
||||||
<PackageReference Include="FreeRedis" Version="1.2.15" />
|
<PackageReference Include="FreeRedis" Version="1.2.15" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
|
|
||||||
|
<PackageReference Include="Fake.AspNetCore.Mvc" Version="8.0.0-preview5" />
|
||||||
|
<PackageReference Include="Fake.ObjectMapping.AutoMapper" Version="8.0.0-preview5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,14 +1,28 @@
|
|||||||
using System.Security.Authentication;
|
using System.Security.Authentication;
|
||||||
|
using Fake.AspNetCore.Mvc;
|
||||||
using Fake.Modularity;
|
using Fake.Modularity;
|
||||||
|
using Fake.ObjectMapping.AutoMapper;
|
||||||
|
using InterfaceForward.Application.Contracts;
|
||||||
|
using InterfaceForward.Repositories;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace InterfaceForward.Application;
|
namespace InterfaceForward.Application;
|
||||||
|
|
||||||
[DependsOn(typeof(FakeObjectMappingAutoMapperModule))]
|
[DependsOn(typeof(FakeObjectMappingAutoMapperModule))]
|
||||||
|
[DependsOn(typeof(InterfaceForwardRepositoriesModule))]
|
||||||
public class InterfaceForwardApplicationModule:FakeModule
|
public class InterfaceForwardApplicationModule:FakeModule
|
||||||
{
|
{
|
||||||
public override void ConfigureServices(ServiceConfigurationContext context)
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
||||||
{
|
{
|
||||||
|
var configuration = context.Services.GetConfiguration();
|
||||||
|
|
||||||
|
context.Services.Configure<FakeAutoMapperOptions>(options =>
|
||||||
|
{
|
||||||
|
options.AddMaps<InterfaceForwardApplicationModule>();
|
||||||
|
});
|
||||||
|
|
||||||
|
context.Services.Configure<InterfaceRelayOptions>(configuration.GetSection("InterfaceRelay"));
|
||||||
|
|
||||||
// 预热
|
// 预热
|
||||||
NatashaInitializer.Preheating();
|
NatashaInitializer.Preheating();
|
||||||
|
|
||||||
@ -16,7 +30,7 @@ public class InterfaceForwardApplicationModule:FakeModule
|
|||||||
{
|
{
|
||||||
client.Timeout = TimeSpan.FromSeconds(20);
|
client.Timeout = TimeSpan.FromSeconds(20);
|
||||||
})
|
})
|
||||||
.ConfigurePrimaryHttpMessageHandler(handler =>
|
.ConfigurePrimaryHttpMessageHandler(_ =>
|
||||||
{
|
{
|
||||||
var httpClientHandler = new HttpClientHandler();
|
var httpClientHandler = new HttpClientHandler();
|
||||||
// 确保支持较新的 SSL/TLS 版本
|
// 确保支持较新的 SSL/TLS 版本
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.App;
|
using InterfaceForward.Application.Contracts.Dtos.App;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Application.OSS;
|
using InterfaceForward.Application.OSS;
|
||||||
@ -47,7 +46,7 @@ public class AppsService : ApplicationService
|
|||||||
/// <param name="input">入参</param>
|
/// <param name="input">入参</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("GetList")]
|
[HttpGet("GetList")]
|
||||||
public async Task<UnifyPagedResultDto<AppListOutput>> GetList([FromQuery] PagedQueryInput input)
|
public async Task<PagedListDto<AppListOutput>> GetList([FromQuery] PagedQueryInput input)
|
||||||
{
|
{
|
||||||
var res = await _appRepository.AsQueryable()
|
var res = await _appRepository.AsQueryable()
|
||||||
.Select(x => new AppListOutput { Id = x.Id.SelectAll() })
|
.Select(x => new AppListOutput { Id = x.Id.SelectAll() })
|
||||||
|
|||||||
@ -32,11 +32,11 @@ namespace InterfaceForward.Application.Services.App
|
|||||||
/// <param name="input">入参</param>
|
/// <param name="input">入参</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("GetList")]
|
[HttpGet("GetList")]
|
||||||
public async Task<UnifyPagedResultDto<LogIndex>> GetList(LogGetListInputValueObject input)
|
public async Task<PagedListDto<LogIndex>> GetList(LogGetListInputValueObject input)
|
||||||
{
|
{
|
||||||
var res = await _logRepository.GetListAsync(input);
|
var res = await _logRepository.GetListAsync(input);
|
||||||
|
|
||||||
return new UnifyPagedResultDto<LogIndex>(res.list, (int)res.total);
|
return new PagedListDto<LogIndex>(res.list, (int)res.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -45,7 +45,7 @@ namespace InterfaceForward.Application.Services.App
|
|||||||
/// <param name="input">入参</param>
|
/// <param name="input">入参</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("GetLogsStatistics")]
|
[HttpGet("GetLogsStatistics")]
|
||||||
public async Task<UnifyPagedResultDto<LogGetListOutputValueObject>> GetLogsStatistics(LogStatisticsInputValueObject input)
|
public async Task<PagedListDto<LogGetListOutputValueObject>> GetLogsStatistics(LogStatisticsInputValueObject input)
|
||||||
{
|
{
|
||||||
var esData = await _logRepository.GetLogsStatisticsAsync(input);
|
var esData = await _logRepository.GetLogsStatisticsAsync(input);
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ namespace InterfaceForward.Application.Services.App
|
|||||||
.Skip((input.PageIndex - 1) * input.PageSize)
|
.Skip((input.PageIndex - 1) * input.PageSize)
|
||||||
.Take(input.PageSize).ToList();
|
.Take(input.PageSize).ToList();
|
||||||
|
|
||||||
return new UnifyPagedResultDto<LogGetListOutputValueObject>(res, list.Count);
|
return new PagedListDto<LogGetListOutputValueObject>(res, list.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
|
|
||||||
namespace InterfaceForward.Application.Services;
|
namespace InterfaceForward.Application.Services;
|
||||||
|
|
||||||
public class ApplicationService
|
public class ApplicationService:IRemoteService
|
||||||
{
|
{
|
||||||
public ILazyServiceProvider LazyServiceProvider { get; set; } = default!;
|
public ILazyServiceProvider LazyServiceProvider { get; set; } = default!;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Domain.Shared.Enum;
|
using InterfaceForward.Domain.Shared.Enum;
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Fake;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Application.Services.Parameter;
|
using InterfaceForward.Application.Services.Parameter;
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
using InterfaceForward.Domain.Shared.Enum;
|
using InterfaceForward.Domain.Shared.Enum;
|
||||||
using InterfaceForward.Repositories;
|
using InterfaceForward.Repositories;
|
||||||
using InterfaceForward.Repositories.Interface.Entitys;
|
using InterfaceForward.Repositories.Interface.Entitys;
|
||||||
@ -43,7 +41,7 @@ public class ServiceProviderInterfaceService : ApplicationService
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("Interface/ServiceProviderInterfacePaginatedList")]
|
[HttpPost("Interface/ServiceProviderInterfacePaginatedList")]
|
||||||
public async Task<UnifyPagedResultDto<ServiceProviderInterfacePaginatedOutputValueObject>>
|
public async Task<PagedListDto<ServiceProviderInterfacePaginatedOutputValueObject>>
|
||||||
ServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input)
|
ServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
return await InterfaceRepository.GetServiceProviderInterfacePaginatedListAsync(input);
|
return await InterfaceRepository.GetServiceProviderInterfacePaginatedListAsync(input);
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Fake;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Application.Services.Parameter;
|
using InterfaceForward.Application.Services.Parameter;
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
using InterfaceForward.Domain.Shared.Enum;
|
using InterfaceForward.Domain.Shared.Enum;
|
||||||
using InterfaceForward.Domain.Shared.Helpers;
|
|
||||||
using InterfaceForward.Repositories;
|
using InterfaceForward.Repositories;
|
||||||
using InterfaceForward.Repositories.Interface.Entitys;
|
using InterfaceForward.Repositories.Interface.Entitys;
|
||||||
using InterfaceForward.Repositories.Interface.Services;
|
using InterfaceForward.Repositories.Interface.Services;
|
||||||
@ -52,7 +49,7 @@ public class SystemInterfaceService : ApplicationService
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("Interface/SystemInterfacePaginatedList")]
|
[HttpPost("Interface/SystemInterfacePaginatedList")]
|
||||||
public async Task<UnifyPagedResultDto<SystemInterfacePaginatedOutputValueObject>>
|
public async Task<PagedListDto<SystemInterfacePaginatedOutputValueObject>>
|
||||||
SystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input)
|
SystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
return await _interfaceRepository.GetSystemInterfacePaginatedListAsync(input);
|
return await _interfaceRepository.GetSystemInterfacePaginatedListAsync(input);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using Fake;
|
|
||||||
using Fake.DependencyInjection;
|
using Fake.DependencyInjection;
|
||||||
using InterfaceForward.Application.Contracts;
|
using InterfaceForward.Application.Contracts;
|
||||||
using InterfaceForward.Application.Contracts.ForwardCore;
|
using InterfaceForward.Application.Contracts.ForwardCore;
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Fake;
|
using Fake.AspNetCore.Mvc.Filters.UnifiedResult;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using InterfaceForward.Application.Contracts;
|
using InterfaceForward.Application.Contracts;
|
||||||
using InterfaceForward.Application.Contracts.ForwardCore;
|
using InterfaceForward.Application.Contracts.ForwardCore;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using DiffPlex;
|
using DiffPlex;
|
||||||
using DiffPlex.DiffBuilder;
|
using DiffPlex.DiffBuilder;
|
||||||
using DiffPlex.DiffBuilder.Model;
|
using DiffPlex.DiffBuilder.Model;
|
||||||
using Fake;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Domain.Shared.Enum;
|
using InterfaceForward.Domain.Shared.Enum;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Domain.Shared;
|
using InterfaceForward.Domain.Shared;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Fake;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
using InterfaceForward.Application.Contracts.Dtos.Interface;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
using InterfaceForward.Domain.Shared.Dtos;
|
||||||
@ -193,12 +192,12 @@ public class ServiceProviderAccountService : ApplicationService
|
|||||||
/// <param name="pageSize">页大小</param>
|
/// <param name="pageSize">页大小</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("ServiceProviderAccount/GetAccountPageList")]
|
[HttpGet("ServiceProviderAccount/GetAccountPageList")]
|
||||||
public async Task<UnifyPagedResultDto<Dictionary<string, object>>> GetAccountPageListAsync(
|
public async Task<PagedListDto<Dictionary<string, object>>> GetAccountPageListAsync(
|
||||||
[Required] int serviceProviderId
|
[Required] int serviceProviderId
|
||||||
, int pageIndex = 1
|
, int pageIndex = 1
|
||||||
, int pageSize = 50)
|
, int pageSize = 50)
|
||||||
{
|
{
|
||||||
var res = new UnifyPagedResultDto<Dictionary<string, object>>();
|
var res = new PagedListDto<Dictionary<string, object>>();
|
||||||
|
|
||||||
// 获取账户列表分页数据
|
// 获取账户列表分页数据
|
||||||
var data = await _serviceProviderAccountRepository.GetAccountPageListAsync(serviceProviderId, pageIndex,
|
var data = await _serviceProviderAccountRepository.GetAccountPageListAsync(serviceProviderId, pageIndex,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using InterfaceForward.Application.Helpers;
|
using InterfaceForward.Application.Helpers;
|
||||||
using InterfaceForward.Domain.Shared.Enum;
|
using InterfaceForward.Domain.Shared.Enum;
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Text.Encodings.Web;
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Unicode;
|
using System.Text.Unicode;
|
||||||
using Fake;
|
|
||||||
using Fake.SqlSugarCore;
|
using Fake.SqlSugarCore;
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Fake;
|
|
||||||
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
using InterfaceForward.Application.Contracts.Dtos.ServiceProvider;
|
||||||
using InterfaceForward.Application.ForwardCore;
|
using InterfaceForward.Application.ForwardCore;
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
using InterfaceForward.Domain.Shared.Dtos;
|
||||||
@ -39,7 +38,7 @@ public class ServiceProviderService : ApplicationService
|
|||||||
/// <param name="input">入参</param>
|
/// <param name="input">入参</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("ServiceProvider/PaginatedList")]
|
[HttpPost("ServiceProvider/PaginatedList")]
|
||||||
public async Task<UnifyPagedResultDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
public async Task<PagedListDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
||||||
ServiceProviderPaginatedInputObjectValue input)
|
ServiceProviderPaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
return await _serviceProviderRepository.GetPaginatedListAsync(input);
|
return await _serviceProviderRepository.GetPaginatedListAsync(input);
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
namespace InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
|
|
||||||
public class UnifyPagedResultDto<T> : UnifyResultDto<List<T>>
|
|
||||||
{
|
|
||||||
public int TotalCount { get; set; }
|
|
||||||
|
|
||||||
public new List<T> Items { get; set; }
|
|
||||||
|
|
||||||
public UnifyPagedResultDto()
|
|
||||||
{
|
|
||||||
Items = new List<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnifyPagedResultDto(List<T> items, int totalCount)
|
|
||||||
{
|
|
||||||
Items = items;
|
|
||||||
TotalCount = totalCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
namespace InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
|
|
||||||
public class UnifyResultDto(string code = "200", string message = "成功")
|
|
||||||
{
|
|
||||||
public string Code { get; set; } = code;
|
|
||||||
|
|
||||||
public string Message { get; set; } = message;
|
|
||||||
|
|
||||||
public object? Data { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UnifyResultDto<T>(T? data = default) : UnifyResultDto
|
|
||||||
{
|
|
||||||
public new T? Data { get; set; } = data;
|
|
||||||
}
|
|
||||||
@ -24,14 +24,6 @@ public static class PublicExtensions
|
|||||||
return iValue;
|
return iValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Left(this string str, int len)
|
|
||||||
{
|
|
||||||
ThrowHelper.ThrowIfNull(str, nameof(str));
|
|
||||||
if (str.Length < len)
|
|
||||||
throw new ArgumentException("len argument can not be bigger than given string's length!");
|
|
||||||
return str.Substring(0, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Json 操作
|
#region Json 操作
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -5,9 +5,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Fake.Core" Version="8.0.0-preview.3"/>
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2"/>
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2"/>
|
||||||
<PackageReference Include="Serilog" Version="3.1.1"/>
|
<PackageReference Include="Serilog" Version="3.1.1"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview5" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using InterfaceForward.Domain.Aggregates.InterfaceAggregate;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
|
||||||
|
|
||||||
public class InterfaceEntityTypeConfiguration: IEntityTypeConfiguration<InterfaceEntity>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<InterfaceEntity> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("t_interface", InterfaceForwardContext.DefaultSchema);
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.Property(x => x.InterfaceType).IsRequired();
|
|
||||||
builder.Property(x => x.Code).HasMaxLength(50).IsRequired();
|
|
||||||
builder.Property(x => x.Name).HasMaxLength(100).IsRequired();
|
|
||||||
builder.Property(x => x.Description).HasMaxLength(500);
|
|
||||||
|
|
||||||
builder.HasMany(typeof(InterfaceParamEntity), "_params")
|
|
||||||
.WithOne()
|
|
||||||
.HasForeignKey(nameof(InterfaceParamEntity.InterfaceId))
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
builder.Ignore(s => s.InParams);
|
|
||||||
builder.Ignore(s => s.OutParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
using InterfaceForward.Domain.Aggregates.InterfaceMapAggregate;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
|
||||||
|
|
||||||
public class InterfaceMapDetailsEntityTypeConfiguration : IEntityTypeConfiguration<InterfaceMapDetailsEntity>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<InterfaceMapDetailsEntity> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("interface_map_details", InterfaceForwardContext.DefaultSchema);
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.Property(x => x.InterfaceMapId).IsRequired();
|
|
||||||
builder.Property(x => x.ParamId).IsRequired();
|
|
||||||
builder.Property(x => x.MappedParamId);
|
|
||||||
builder.Property(x => x.IsInParam).IsRequired();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using InterfaceForward.Domain.Aggregates.InterfaceMapAggregate;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
|
||||||
|
|
||||||
public class InterfaceMapEntityTypeConfiguration: IEntityTypeConfiguration<InterfaceMapEntity>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<InterfaceMapEntity> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("interface_map", InterfaceForwardContext.DefaultSchema);
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
builder.Property(x => x.UpStreamInterfaceCode).HasMaxLength(50).IsRequired();
|
|
||||||
builder.Property(x => x.ServiceProviderCode).HasMaxLength(50).IsRequired();
|
|
||||||
builder.Property(x => x.ServiceProviderInterfaceCodes)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConversion(
|
|
||||||
v => string.Join(',', v),
|
|
||||||
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()
|
|
||||||
);
|
|
||||||
builder.Property(x => x.OnlineVersion).HasMaxLength(50);
|
|
||||||
builder.Property(x => x.PrefixScript);
|
|
||||||
builder.Property(x => x.PostfixScript);
|
|
||||||
builder.Property(x => x.IsDeleted).HasDefaultValue(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
using InterfaceForward.Domain.Aggregates.InterfaceAggregate;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
|
||||||
|
|
||||||
public class InterfaceParamEntityTypeConfiguration: IEntityTypeConfiguration<InterfaceParamEntity>
|
|
||||||
{
|
|
||||||
public void Configure(EntityTypeBuilder<InterfaceParamEntity> builder)
|
|
||||||
{
|
|
||||||
builder.ToTable("t_interface_params", InterfaceForwardContext.DefaultSchema);
|
|
||||||
|
|
||||||
builder.HasKey(x => x.Id);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<Import Project="../../common.props" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Fake.EntityFrameworkCore" Version="8.0.0-preview.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\InterfaceForward.Domain\InterfaceForward.Domain.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
using Fake.EntityFrameworkCore;
|
|
||||||
using InterfaceForward.Domain.Aggregates.InterfaceAggregate;
|
|
||||||
using InterfaceForward.Domain.Aggregates.ServiceProviderAggregate;
|
|
||||||
using InterfaceForward.Domain.InterfaceAggregate;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure;
|
|
||||||
|
|
||||||
public class InterfaceForwardContext : FakeDbContext<InterfaceForwardContext>
|
|
||||||
{
|
|
||||||
public const string DefaultSchema = "forward";
|
|
||||||
|
|
||||||
public DbSet<InterfaceEntity> Interfaces { get; set; }
|
|
||||||
|
|
||||||
public DbSet<ServiceProviderEntity> ServiceProviders { get; set; }
|
|
||||||
|
|
||||||
public InterfaceForwardContext(DbContextOptions<InterfaceForwardContext> options) : base(options)
|
|
||||||
{
|
|
||||||
System.Diagnostics.Debug.WriteLine("InterfaceForwardContext::ctor ->" + base.GetHashCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
using Fake.EntityFrameworkCore;
|
|
||||||
using Fake.Modularity;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Infrastructure;
|
|
||||||
|
|
||||||
[DependsOn(typeof(FakeEntityFrameworkCoreModule))]
|
|
||||||
public class InterfaceForwardInfrastructureModule:FakeModule
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -2,5 +2,6 @@
|
|||||||
|
|
||||||
global using Fake.DependencyInjection;
|
global using Fake.DependencyInjection;
|
||||||
global using Fake.DomainDrivenDesign;
|
global using Fake.DomainDrivenDesign;
|
||||||
|
global using Fake.DomainDrivenDesign.Application.Dtos;
|
||||||
global using Fake.DomainDrivenDesign.Entities.Auditing;
|
global using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||||
global using SqlSugar;
|
global using SqlSugar;
|
||||||
@ -17,14 +17,14 @@ namespace InterfaceForward.Repositories.Interface.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UnifyPagedResultDto<SystemInterfacePaginatedOutputValueObject>> GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input);
|
Task<PagedListDto<SystemInterfacePaginatedOutputValueObject>> GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取服务商接口分页
|
/// 获取服务商接口分页
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UnifyPagedResultDto<ServiceProviderInterfacePaginatedOutputValueObject>> GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input);
|
Task<PagedListDto<ServiceProviderInterfacePaginatedOutputValueObject>> GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取参数列表
|
/// 获取参数列表
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class InterfaceRepository : BasicRepository<InterfaceEntity>, IInterfaceR
|
|||||||
public string InterfaceGroup => "InterfaceGroup";
|
public string InterfaceGroup => "InterfaceGroup";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<UnifyPagedResultDto<SystemInterfacePaginatedOutputValueObject>>
|
public async Task<PagedListDto<SystemInterfacePaginatedOutputValueObject>>
|
||||||
GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input)
|
GetSystemInterfacePaginatedListAsync(SystemInterfacePaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
// t_interface驱动t_interface_map,数据量上来可以在t_interface_map UpStreamId字段建立索引
|
// t_interface驱动t_interface_map,数据量上来可以在t_interface_map UpStreamId字段建立索引
|
||||||
@ -47,7 +47,7 @@ public class InterfaceRepository : BasicRepository<InterfaceEntity>, IInterfaceR
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<UnifyPagedResultDto<ServiceProviderInterfacePaginatedOutputValueObject>>
|
public async Task<PagedListDto<ServiceProviderInterfacePaginatedOutputValueObject>>
|
||||||
GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input)
|
GetServiceProviderInterfacePaginatedListAsync(ServiceProviderInterfacePaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
var query = AsQueryable()
|
var query = AsQueryable()
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview.3" />
|
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview5" />
|
||||||
<PackageReference Include="Fake.SqlSugarCore" Version="8.0.0-preview.3" />
|
<PackageReference Include="Fake.SqlSugarCore" Version="8.0.0-preview5" />
|
||||||
<PackageReference Include="NEST" Version="7.17.5" />
|
<PackageReference Include="NEST" Version="7.17.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public interface IServiceProviderAccountRepository : IBasicRepository<ServicePro
|
|||||||
/// <param name="pageIndex"></param>
|
/// <param name="pageIndex"></param>
|
||||||
/// <param name="pageSize"></param>
|
/// <param name="pageSize"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UnifyPagedResultDto<ServiceProviderAccountPageValueObject>> GetAccountPageListAsync(int serviceProviderId,
|
Task<PagedListDto<ServiceProviderAccountPageValueObject>> GetAccountPageListAsync(int serviceProviderId,
|
||||||
int pageIndex, int pageSize);
|
int pageIndex, int pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace InterfaceForward.Repositories.ServiceProvider.Services
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<UnifyPagedResultDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
Task<PagedListDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
||||||
ServiceProviderPaginatedInputObjectValue input);
|
ServiceProviderPaginatedInputObjectValue input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class ServiceProviderAccountRepository : BasicRepository<ServiceProviderA
|
|||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UnifyPagedResultDto<ServiceProviderAccountPageValueObject>> GetAccountPageListAsync(
|
public async Task<PagedListDto<ServiceProviderAccountPageValueObject>> GetAccountPageListAsync(
|
||||||
int serviceProviderId, int pageIndex, int pageSize)
|
int serviceProviderId, int pageIndex, int pageSize)
|
||||||
{
|
{
|
||||||
return await Context.Queryable<ServiceProviderAccountEntity>()
|
return await Context.Queryable<ServiceProviderAccountEntity>()
|
||||||
|
|||||||
@ -13,7 +13,7 @@ public class ServiceProviderRepository : BasicRepository<ServiceProviderEntity>,
|
|||||||
IServiceProviderRepository
|
IServiceProviderRepository
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<UnifyPagedResultDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
public async Task<PagedListDto<ServiceProviderPaginatedOutputValueObject>> GetPaginatedListAsync(
|
||||||
ServiceProviderPaginatedInputObjectValue input)
|
ServiceProviderPaginatedInputObjectValue input)
|
||||||
{
|
{
|
||||||
// t_service_provider驱动t_interface,数据量上来可以在t_interface ServiceProviderId字段建立索引
|
// t_service_provider驱动t_interface,数据量上来可以在t_interface ServiceProviderId字段建立索引
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
|
|
||||||
using InterfaceForward.Domain.Shared.Dtos;
|
|
||||||
|
|
||||||
namespace InterfaceForward.Repositories;
|
namespace InterfaceForward.Repositories;
|
||||||
|
|
||||||
public static class SugarQueryableExtensions
|
public static class SugarQueryableExtensions
|
||||||
{
|
{
|
||||||
public static async Task<UnifyPagedResultDto<TEntity>> ToPagedListAsync<TEntity>(this ISugarQueryable<TEntity> query,
|
public static async Task<PagedListDto<TEntity>> ToPagedListAsync<TEntity>(this ISugarQueryable<TEntity> query,
|
||||||
int pageIndex, int pageSize) where TEntity : class
|
int pageIndex, int pageSize) where TEntity : class
|
||||||
{
|
{
|
||||||
RefAsync<int> totalCount = 0;
|
RefAsync<int> totalCount = 0;
|
||||||
var items = await query.ToPageListAsync(pageIndex, pageSize, totalCount);
|
var items = await query.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||||
|
|
||||||
return new UnifyPagedResultDto<TEntity>(items, totalCount);
|
return new PagedListDto<TEntity>(items, totalCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,30 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.8.0.0
|
|
||||||
MinimumVisualStudioVersion = 17.8.0.0
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InterfaceForward.AppHost", "InterfaceForward.AppHost\InterfaceForward.AppHost.csproj", "{D4540BC1-77C8-407F-9009-CADE4E2A4CD9}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InterfaceForward.ServiceDefaults", "InterfaceForward.ServiceDefaults\InterfaceForward.ServiceDefaults.csproj", "{B0AC9CDE-3A63-4AE9-85A9-8854E9EB441E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D4540BC1-77C8-407F-9009-CADE4E2A4CD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D4540BC1-77C8-407F-9009-CADE4E2A4CD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D4540BC1-77C8-407F-9009-CADE4E2A4CD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D4540BC1-77C8-407F-9009-CADE4E2A4CD9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{B0AC9CDE-3A63-4AE9-85A9-8854E9EB441E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{B0AC9CDE-3A63-4AE9-85A9-8854E9EB441E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{B0AC9CDE-3A63-4AE9-85A9-8854E9EB441E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{B0AC9CDE-3A63-4AE9-85A9-8854E9EB441E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {B7073D5C-741D-4DC5-AFDB-C2C67E306A04}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
Loading…
Reference in New Issue
Block a user